From patchwork Wed Jun 20 09:42:11 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zhiyong Wu X-Patchwork-Id: 165979 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 641C8B6FD9 for ; Wed, 20 Jun 2012 20:16:46 +1000 (EST) Received: from localhost ([::1]:34571 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ShHxs-0007bR-7j for incoming@patchwork.ozlabs.org; Wed, 20 Jun 2012 06:16:44 -0400 Received: from eggs.gnu.org ([208.118.235.92]:59232) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ShHRS-0001vW-K3 for qemu-devel@nongnu.org; Wed, 20 Jun 2012 05:43:20 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ShHRK-0002LA-Ua for qemu-devel@nongnu.org; Wed, 20 Jun 2012 05:43:14 -0400 Received: from e34.co.us.ibm.com ([32.97.110.152]:46577) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ShHRK-0002Kn-Mo for qemu-devel@nongnu.org; Wed, 20 Jun 2012 05:43:06 -0400 Received: from /spool/local by e34.co.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Wed, 20 Jun 2012 03:43:05 -0600 Received: from d01dlp03.pok.ibm.com (9.56.224.17) by e34.co.us.ibm.com (192.168.1.134) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Wed, 20 Jun 2012 03:43:01 -0600 Received: from d01relay05.pok.ibm.com (d01relay05.pok.ibm.com [9.56.227.237]) by d01dlp03.pok.ibm.com (Postfix) with ESMTP id A7A52C90052 for ; Wed, 20 Jun 2012 05:42:59 -0400 (EDT) Received: from d01av04.pok.ibm.com (d01av04.pok.ibm.com [9.56.224.64]) by d01relay05.pok.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id q5K9h0x7194248 for ; Wed, 20 Jun 2012 05:43:00 -0400 Received: from d01av04.pok.ibm.com (loopback [127.0.0.1]) by d01av04.pok.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id q5K9h0oN023214 for ; Wed, 20 Jun 2012 05:43:00 -0400 Received: from us.ibm.com (f15.cn.ibm.com [9.115.118.27]) by d01av04.pok.ibm.com (8.14.4/8.13.1/NCO v10.0 AVin) with SMTP id q5K9guse023075; Wed, 20 Jun 2012 05:42:57 -0400 Received: by us.ibm.com (sSMTP sendmail emulation); Wed, 20 Jun 2012 17:42:55 +0800 From: zwu.kernel@gmail.com To: qemu-devel@nongnu.org Date: Wed, 20 Jun 2012 17:42:11 +0800 Message-Id: <1340185341-30803-8-git-send-email-zwu.kernel@gmail.com> X-Mailer: git-send-email 1.7.6 In-Reply-To: <1340185341-30803-1-git-send-email-zwu.kernel@gmail.com> References: <1340185341-30803-1-git-send-email-zwu.kernel@gmail.com> X-Content-Scanned: Fidelis XPS MAILER x-cbid: 12062009-1780-0000-0000-0000069FDE8D X-IBM-ISS-SpamDetectors: X-IBM-ISS-DetailInfo: BY=3.00000282; HX=3.00000190; KW=3.00000007; PH=3.00000001; SC=3.00000002; SDB=6.00149652; UDB=6.00034032; UTC=2012-06-20 09:43:03 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 32.97.110.152 Cc: pbonzini@redhat.com, aliguori@us.ibm.com, Zhi Yong Wu , stefanha@linux.vnet.ibm.com, jan.kiszka@siemens.com Subject: [Qemu-devel] [PATCH v6 07/17] 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 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 553f032..812589a 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 42fbc49..791ca4f 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,