]> www.infradead.org Git - users/dwmw2/qemu.git/commitdiff
virtio-net: minor code simplification
authorMichael S. Tsirkin <mst@redhat.com>
Mon, 24 Sep 2012 14:27:27 +0000 (16:27 +0200)
committerMichael S. Tsirkin <mst@redhat.com>
Mon, 29 Oct 2012 16:25:23 +0000 (18:25 +0200)
During packet filtering, we can now use host hdr len
to offset incoming buffer unconditionally.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
hw/virtio-net.c

index dc4a26cbd62f28f42109ad114449b7b02c4d89c4..c94521e0fe41fdea093f90e3b0d4d5310fe03df9 100644 (file)
@@ -544,9 +544,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;