From patchwork Mon Sep 24 23:05:06 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [12/14] virtio-net: minor code simplification Date: Mon, 24 Sep 2012 13:05:06 -0000 From: "Michael S. Tsirkin" X-Patchwork-Id: 186637 Message-Id: <3b1c8e18f8a61bd1e9a5ab296c7003a88679b3de.1348527749.git.mst@redhat.com> To: qemu-devel@nongnu.org, Jason Wang , Anthony Liguori , stefanha@linux.vnet.ibm.com, aurelien@aurel32.net During packet filtering, we can now use host hdr len to offset incoming buffer unconditionally. Signed-off-by: Michael S. Tsirkin --- hw/virtio-net.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/hw/virtio-net.c b/hw/virtio-net.c index d9a9f8f..c65dead 100644 --- a/hw/virtio-net.c +++ b/hw/virtio-net.c @@ -543,9 +543,7 @@ static int receive_filter(VirtIONet *n, const uint8_t *buf, int size) if (n->promisc) return 1; - if (n->has_vnet_hdr) { - ptr += sizeof(struct virtio_net_hdr); - } + ptr += n->host_hdr_len; if (!memcmp(&ptr[12], vlan, sizeof(vlan))) { int vid = be16_to_cpup((uint16_t *)(ptr + 14)) & 0xfff;