From patchwork Wed Aug 1 12:54: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: 174445 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 0F8462C00B0 for ; Wed, 1 Aug 2012 22:55:52 +1000 (EST) Received: from localhost ([::1]:49286 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SwYSr-00085B-Vm for incoming@patchwork.ozlabs.org; Wed, 01 Aug 2012 08:55:49 -0400 Received: from eggs.gnu.org ([208.118.235.92]:60516) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SwYSG-00078A-FC for qemu-devel@nongnu.org; Wed, 01 Aug 2012 08:55:21 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SwYSB-0007lo-Ap for qemu-devel@nongnu.org; Wed, 01 Aug 2012 08:55:12 -0400 Received: from e06smtp11.uk.ibm.com ([195.75.94.107]:56246) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SwYSB-0007jB-10 for qemu-devel@nongnu.org; Wed, 01 Aug 2012 08:55:07 -0400 Received: from /spool/local by e06smtp11.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Wed, 1 Aug 2012 13:55:05 +0100 Received: from d06nrmr1307.portsmouth.uk.ibm.com (9.149.38.129) by e06smtp11.uk.ibm.com (192.168.101.141) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Wed, 1 Aug 2012 13:55:03 +0100 Received: from d06av01.portsmouth.uk.ibm.com (d06av01.portsmouth.uk.ibm.com [9.149.37.212]) by d06nrmr1307.portsmouth.uk.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id q71Ct2602257132 for ; Wed, 1 Aug 2012 13:55:02 +0100 Received: from d06av01.portsmouth.uk.ibm.com (loopback [127.0.0.1]) by d06av01.portsmouth.uk.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id q71Ct211021877 for ; Wed, 1 Aug 2012 06:55:02 -0600 Received: from localhost (sig-9-146-165-117.uk.ibm.com [9.146.165.117]) by d06av01.portsmouth.uk.ibm.com (8.14.4/8.13.1/NCO v10.0 AVin) with ESMTP id q71Ct2bZ021871; Wed, 1 Aug 2012 06:55:02 -0600 From: Stefan Hajnoczi To: Anthony Liguori Date: Wed, 1 Aug 2012 13:54:40 +0100 Message-Id: <1343825691-343-9-git-send-email-stefanha@linux.vnet.ibm.com> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1343825691-343-1-git-send-email-stefanha@linux.vnet.ibm.com> References: <1343825691-343-1-git-send-email-stefanha@linux.vnet.ibm.com> x-cbid: 12080112-5024-0000-0000-00000365058C X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 195.75.94.107 Cc: Zhi Yong Wu , qemu-devel@nongnu.org, Stefan Hajnoczi Subject: [Qemu-devel] [PATCH 08/19] 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 Reviewed-by: Laszlo Ersek --- 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 274f3bd..819fff7 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; 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,