aboutsummaryrefslogtreecommitdiff
path: root/net.c
diff options
context:
space:
mode:
authorStefan Hajnoczi <stefanha@linux.vnet.ibm.com>2012-07-24 16:35:10 +0100
committerStefan Hajnoczi <stefanha@linux.vnet.ibm.com>2012-08-01 12:28:51 +0100
commitec8b1f6cc8d0a5921fba93cd180b05328e537170 (patch)
tree1e4683f8d273c02f32bc1bf8f3eb7afdff7ecac9 /net.c
parent606c10e2bd5877e01f0ff1812d9abebf40fb522b (diff)
net: Remove vlan code from net.c
The vlan implementation in net.c has been replaced by hubs so we can remove the code. Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com> Signed-off-by: Zhi Yong Wu <wuzhy@linux.vnet.ibm.com> Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Diffstat (limited to 'net.c')
-rw-r--r--net.c108
1 files changed, 0 insertions, 108 deletions
diff --git a/net.c b/net.c
index 274f3bddd7..819fff7255 100644
--- a/net.c
+++ b/net.c
@@ -391,50 +391,6 @@ static ssize_t qemu_deliver_packet(VLANClientState *sender,
return ret;
}
-static ssize_t qemu_vlan_deliver_packet(VLANClientState *sender,
- unsigned flags,
- const uint8_t *buf,
- size_t size,
- void *opaque)
-{
- VLANState *vlan = opaque;
- VLANClientState *vc;
- ssize_t ret = -1;
-
- QTAILQ_FOREACH(vc, &vlan->clients, next) {
- ssize_t len;
-
- if (vc == sender) {
- continue;
- }
-
- if (vc->link_down) {
- ret = size;
- continue;
- }
-
- if (vc->receive_disabled) {
- ret = 0;
- continue;
- }
-
- if (flags & QEMU_NET_PACKET_FLAG_RAW && vc->info->receive_raw) {
- len = vc->info->receive_raw(vc, buf, size);
- } else {
- len = vc->info->receive(vc, buf, size);
- }
-
- if (len == 0) {
- vc->receive_disabled = 1;
- }
-
- ret = (ret >= 0) ? ret : len;
-
- }
-
- return ret;
-}
-
void qemu_purge_queued_packets(VLANClientState *vc)
{
NetQueue *queue;
@@ -541,42 +497,6 @@ static ssize_t qemu_deliver_packet_iov(VLANClientState *sender,
}
}
-static ssize_t qemu_vlan_deliver_packet_iov(VLANClientState *sender,
- unsigned flags,
- const struct iovec *iov,
- int iovcnt,
- void *opaque)
-{
- VLANState *vlan = opaque;
- VLANClientState *vc;
- ssize_t ret = -1;
-
- QTAILQ_FOREACH(vc, &vlan->clients, next) {
- ssize_t len;
-
- if (vc == sender) {
- continue;
- }
-
- if (vc->link_down) {
- ret = iov_size(iov, iovcnt);
- continue;
- }
-
- assert(!(flags & QEMU_NET_PACKET_FLAG_RAW));
-
- if (vc->info->receive_iov) {
- len = vc->info->receive_iov(vc, iov, iovcnt);
- } else {
- len = vc_sendv_compat(vc, iov, iovcnt);
- }
-
- ret = (ret >= 0) ? ret : len;
- }
-
- return ret;
-}
-
ssize_t qemu_sendv_packet_async(VLANClientState *sender,
const struct iovec *iov, int iovcnt,
NetPacketSent *sent_cb)
@@ -604,34 +524,6 @@ qemu_sendv_packet(VLANClientState *vc, const struct iovec *iov, int iovcnt)
return qemu_sendv_packet_async(vc, iov, iovcnt, NULL);
}
-/* find or alloc a new VLAN */
-VLANState *qemu_find_vlan(int id, int allocate)
-{
- VLANState *vlan;
-
- QTAILQ_FOREACH(vlan, &vlans, next) {
- if (vlan->id == id) {
- return vlan;
- }
- }
-
- if (!allocate) {
- return NULL;
- }
-
- vlan = g_malloc0(sizeof(VLANState));
- vlan->id = id;
- QTAILQ_INIT(&vlan->clients);
-
- vlan->send_queue = qemu_new_net_queue(qemu_vlan_deliver_packet,
- qemu_vlan_deliver_packet_iov,
- vlan);
-
- QTAILQ_INSERT_TAIL(&vlans, vlan, next);
-
- return vlan;
-}
-
VLANClientState *qemu_find_netdev(const char *id)
{
VLANClientState *vc;