From mboxrd@z Thu Jan 1 00:00:00 1970 From: zwu.kernel@gmail.com Subject: [PATCH v1 07/12] net: Remove vlan code from net.c Date: Fri, 9 Mar 2012 17:00:20 +0800 Message-ID: <1331283625-26439-8-git-send-email-zwu.kernel@gmail.com> References: <1331283625-26439-1-git-send-email-zwu.kernel@gmail.com> Cc: kvm@vger.kernel.org, aliguori@us.ibm.com, stefanha@linux.vnet.ibm.com, ryanh@us.ibm.com, linuxram@us.ibm.com, zwu.kernel@gmail.com, luowenj@cn.ibm.com, Zhi Yong Wu To: qemu-devel@nongnu.org Return-path: Received: from e5.ny.us.ibm.com ([32.97.182.145]:40623 "EHLO e5.ny.us.ibm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753961Ab2CIJBc (ORCPT ); Fri, 9 Mar 2012 04:01:32 -0500 Received: from /spool/local by e5.ny.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Fri, 9 Mar 2012 04:01:31 -0500 Received: from d01relay04.pok.ibm.com (d01relay04.pok.ibm.com [9.56.227.236]) by d01dlp01.pok.ibm.com (Postfix) with ESMTP id 092D438C805E for ; Fri, 9 Mar 2012 04:01:29 -0500 (EST) Received: from d03av01.boulder.ibm.com (d03av01.boulder.ibm.com [9.17.195.167]) by d01relay04.pok.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id q2991SdJ235766 for ; Fri, 9 Mar 2012 04:01:28 -0500 Received: from d03av01.boulder.ibm.com (loopback [127.0.0.1]) by d03av01.boulder.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id q2991GFi005622 for ; Fri, 9 Mar 2012 02:01:19 -0700 In-Reply-To: <1331283625-26439-1-git-send-email-zwu.kernel@gmail.com> Sender: kvm-owner@vger.kernel.org List-ID: From: Stefan Hajnoczi 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, 0 insertions(+), 110 deletions(-) diff --git a/hw/xen_nic.c b/hw/xen_nic.c index 9a59bda..85526fe 100644 --- a/hw/xen_nic.c +++ b/hw/xen_nic.c @@ -328,7 +328,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 b287ce8..33b1d9a 100644 --- a/net.c +++ b/net.c @@ -388,50 +388,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; @@ -538,42 +494,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) @@ -601,34 +521,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 a7a4bde..36d6cb5 100644 --- a/net.h +++ b/net.h @@ -87,7 +87,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, -- 1.7.6 From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:54315) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1S5vif-0000mz-CN for qemu-devel@nongnu.org; Fri, 09 Mar 2012 04:02:38 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1S5viG-0008EO-AZ for qemu-devel@nongnu.org; Fri, 09 Mar 2012 04:02:36 -0500 Received: from e31.co.us.ibm.com ([32.97.110.149]:60218) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1S5viG-0008E8-1x for qemu-devel@nongnu.org; Fri, 09 Mar 2012 04:02:12 -0500 Received: from /spool/local by e31.co.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Fri, 9 Mar 2012 02:02:10 -0700 Received: from d03relay02.boulder.ibm.com (d03relay02.boulder.ibm.com [9.17.195.227]) by d03dlp01.boulder.ibm.com (Postfix) with ESMTP id 7C0CE1FF0038 for ; Fri, 9 Mar 2012 02:01:35 -0700 (MST) Received: from d03av01.boulder.ibm.com (d03av01.boulder.ibm.com [9.17.195.167]) by d03relay02.boulder.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id q2991Vxj071554 for ; Fri, 9 Mar 2012 02:01:32 -0700 Received: from d03av01.boulder.ibm.com (loopback [127.0.0.1]) by d03av01.boulder.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id q2991GFe005622 for ; Fri, 9 Mar 2012 02:01:18 -0700 From: zwu.kernel@gmail.com Date: Fri, 9 Mar 2012 17:00:20 +0800 Message-Id: <1331283625-26439-8-git-send-email-zwu.kernel@gmail.com> In-Reply-To: <1331283625-26439-1-git-send-email-zwu.kernel@gmail.com> References: <1331283625-26439-1-git-send-email-zwu.kernel@gmail.com> Subject: [Qemu-devel] [PATCH v1 07/12] net: Remove vlan code from net.c List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: aliguori@us.ibm.com, stefanha@linux.vnet.ibm.com, kvm@vger.kernel.org, linuxram@us.ibm.com, zwu.kernel@gmail.com, ryanh@us.ibm.com, luowenj@cn.ibm.com, Zhi Yong Wu From: Stefan Hajnoczi 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, 0 insertions(+), 110 deletions(-) diff --git a/hw/xen_nic.c b/hw/xen_nic.c index 9a59bda..85526fe 100644 --- a/hw/xen_nic.c +++ b/hw/xen_nic.c @@ -328,7 +328,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 b287ce8..33b1d9a 100644 --- a/net.c +++ b/net.c @@ -388,50 +388,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; @@ -538,42 +494,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) @@ -601,34 +521,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 a7a4bde..36d6cb5 100644 --- a/net.h +++ b/net.h @@ -87,7 +87,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, -- 1.7.6