From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:47738) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TGT36-00025u-5m for qemu-devel@nongnu.org; Tue, 25 Sep 2012 07:11:33 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TGT31-0002uZ-Qa for qemu-devel@nongnu.org; Tue, 25 Sep 2012 07:11:32 -0400 Received: from mx1.redhat.com ([209.132.183.28]:51437) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TGT31-0002uR-Ih for qemu-devel@nongnu.org; Tue, 25 Sep 2012 07:11:27 -0400 Date: Tue, 25 Sep 2012 13:12:53 +0200 From: "Michael S. Tsirkin" Message-ID: <4a8a287e04536124e633b595ae6faca3ae4c8a1a.1348571185.git.mst@redhat.com> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Subject: [Qemu-devel] [PATCHv2 12/14] virtio-net: minor code simplification List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , 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 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; -- MST