From patchwork Fri Jul 20 12:01:40 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Hajnoczi X-Patchwork-Id: 172257 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id C3ABE2C03C7 for ; Fri, 20 Jul 2012 22:57:04 +1000 (EST) Received: from localhost ([::1]:57050 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SsBvF-0005zn-KJ for incoming@patchwork.ozlabs.org; Fri, 20 Jul 2012 08:03:05 -0400 Received: from eggs.gnu.org ([208.118.235.92]:44361) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SsBuS-00043m-8J for qemu-devel@nongnu.org; Fri, 20 Jul 2012 08:02:22 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SsBuK-0003UA-Fl for qemu-devel@nongnu.org; Fri, 20 Jul 2012 08:02:16 -0400 Received: from e06smtp15.uk.ibm.com ([195.75.94.111]:43570) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SsBuK-0003Ty-76 for qemu-devel@nongnu.org; Fri, 20 Jul 2012 08:02:08 -0400 Received: from /spool/local by e06smtp15.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Fri, 20 Jul 2012 13:02:07 +0100 Received: from d06nrmr1307.portsmouth.uk.ibm.com (9.149.38.129) by e06smtp15.uk.ibm.com (192.168.101.145) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Fri, 20 Jul 2012 13:02:05 +0100 Received: from d06av06.portsmouth.uk.ibm.com (d06av06.portsmouth.uk.ibm.com [9.149.37.217]) by d06nrmr1307.portsmouth.uk.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id q6KC245O1691820 for ; Fri, 20 Jul 2012 13:02:04 +0100 Received: from d06av06.portsmouth.uk.ibm.com (loopback [127.0.0.1]) by d06av06.portsmouth.uk.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id q6KC23RN020636 for ; Fri, 20 Jul 2012 06:02:03 -0600 Received: from localhost (stefanha-thinkpad.manchester-maybrook.uk.ibm.com [9.174.219.145]) by d06av06.portsmouth.uk.ibm.com (8.14.4/8.13.1/NCO v10.0 AVin) with ESMTP id q6KC232N020633; Fri, 20 Jul 2012 06:02:03 -0600 From: Stefan Hajnoczi To: Date: Fri, 20 Jul 2012 13:01:40 +0100 Message-Id: <1342785709-3152-8-git-send-email-stefanha@linux.vnet.ibm.com> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1342785709-3152-1-git-send-email-stefanha@linux.vnet.ibm.com> References: <1342785709-3152-1-git-send-email-stefanha@linux.vnet.ibm.com> x-cbid: 12072012-0342-0000-0000-000002597631 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 195.75.94.111 Cc: Paolo Bonzini , Zhi Yong Wu , lersek@redhat.com, Stefan Hajnoczi , Zhi Yong Wu Subject: [Qemu-devel] [PATCH 07/16] net: Remove vlan code from net.c X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org The vlan implementation in net.c has been replaced by hubs so we can remove the code. Signed-off-by: Stefan Hajnoczi Signed-off-by: Zhi Yong Wu --- hw/xen_nic.c | 1 - net.c | 108 ---------------------------------------------------------- net.h | 1 - 3 files changed, 110 deletions(-) diff --git a/hw/xen_nic.c b/hw/xen_nic.c index 593a572..5c3c1c6 100644 --- a/hw/xen_nic.c +++ b/hw/xen_nic.c @@ -325,7 +325,6 @@ static int net_init(struct XenDevice *xendev) return -1; } - netdev->conf.vlan = qemu_find_vlan(netdev->xendev.dev, 1); netdev->conf.peer = NULL; netdev->nic = qemu_new_nic(&net_xen_info, &netdev->conf, diff --git a/net.c b/net.c index 7615819..fb6e665 100644 --- a/net.c +++ b/net.c @@ -392,50 +392,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; @@ -542,42 +498,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) @@ -605,34 +525,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; diff --git a/net.h b/net.h index 4bccead..9393e4d 100644 --- a/net.h +++ b/net.h @@ -76,7 +76,6 @@ struct VLANState { NetQueue *send_queue; }; -VLANState *qemu_find_vlan(int id, int allocate); VLANClientState *qemu_find_netdev(const char *id); VLANClientState *qemu_new_net_client(NetClientInfo *info, VLANClientState *peer,