Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NFtv0-0004TV-Eo for qemu-devel@nongnu.org; Wed, 02 Dec 2009 13:27:14 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1NFtuy-0004Qd-G1 for qemu-devel@nongnu.org; Wed, 02 Dec 2009 13:27:14 -0500 Received: from [199.232.76.173] (port=55233 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NFtuy-0004QK-7m for qemu-devel@nongnu.org; Wed, 02 Dec 2009 13:27:12 -0500 Received: from mx1.redhat.com ([209.132.183.28]:54994) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1NFtux-0005fn-Q6 for qemu-devel@nongnu.org; Wed, 02 Dec 2009 13:27:12 -0500 From: Juan Quintela In-Reply-To: <20091202144915.GD18519@redhat.com> (Michael S. Tsirkin's message of "Wed, 2 Dec 2009 16:49:15 +0200") References: <0212bb69ec7e94e572f4f0a7d8718a6131e9ceaa.1259754427.git.quintela@redhat.com> <20091202144915.GD18519@redhat.com> Date: Wed, 02 Dec 2009 19:26:30 +0100 Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Subject: [Qemu-devel] Re: [PATCH 27/41] virtio-net: abstract vlans operations List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: "Michael S. Tsirkin" Cc: qemu-devel@nongnu.org "Michael S. Tsirkin" wrote: > On Wed, Dec 02, 2009 at 01:04:25PM +0100, Juan Quintela wrote: >> >> Signed-off-by: Juan Quintela >> --- >> hw/virtio-net.c | 21 ++++++++++++++++++--- >> 1 files changed, 18 insertions(+), 3 deletions(-) >> >> diff --git a/hw/virtio-net.c b/hw/virtio-net.c >> index 97db0d0..cf13e94 100644 >> --- a/hw/virtio-net.c >> +++ b/hw/virtio-net.c >> @@ -63,6 +63,21 @@ typedef struct VirtIONet >> * - we could suppress RX interrupt if we were so inclined. >> */ >> >> +static void vlan_add(VirtIONet *n, int vid) >> +{ >> + n->vlans[vid >> 5] |= (1U << (vid & 0x1f)); >> +} >> + >> +static void vlan_del(VirtIONet *n, int vid) >> +{ >> + n->vlans[vid >> 5] &= ~(1U << (vid & 0x1f)); >> +} >> + >> +static bool vlan_is_set(VirtIONet *n, int vid) >> +{ >> + return n->vlans[vid >> 5] & ~(1U << (vid & 0x1f)); > > This one looks wrong. Did you check this does not break vlans? I don't know how to use vlans (more than one). Current code is wrong (it is not big<->little endian safe. And it is not trivial to make it correct and work from big/little endian old states. I commented in the cover patch that this needed testing/investigation. How is that supposde to be tested? Later, Juan.