Patchwork [PATCHv2,12/14] virtio-net: minor code simplification

login
register
mail settings
Submitter Michael S. Tsirkin
Date Sept. 25, 2012, 11:12 a.m.
Message ID <4a8a287e04536124e633b595ae6faca3ae4c8a1a.1348571185.git.mst@redhat.com>
Download mbox | patch
Permalink /patch/186793/
State New
Headers show

Comments

Michael S. Tsirkin - Sept. 25, 2012, 11:12 a.m.
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 | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

Patch

diff --git a/hw/virtio-net.c b/hw/virtio-net.c
index ef7f399..8ecc07b 100644
--- a/hw/virtio-net.c
+++ b/hw/virtio-net.c
@@ -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;