From patchwork Mon Feb 4 10:40:59 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Tokarev X-Patchwork-Id: 217926 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id A3CC72C02B1 for ; Tue, 5 Feb 2013 00:38:19 +1100 (EST) Received: from localhost ([::1]:55307 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U2JgG-0001Gp-K4 for incoming@patchwork.ozlabs.org; Mon, 04 Feb 2013 05:53:44 -0500 Received: from eggs.gnu.org ([208.118.235.92]:53502) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U2JfL-0007Bi-AZ for qemu-devel@nongnu.org; Mon, 04 Feb 2013 05:52:48 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1U2JfG-0004He-PR for qemu-devel@nongnu.org; Mon, 04 Feb 2013 05:52:47 -0500 Received: from isrv.corpit.ru ([86.62.121.231]:38258) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U2JfG-0004HN-Hj; Mon, 04 Feb 2013 05:52:42 -0500 Received: from gandalf.tls.msk.ru (mjt.vpn.tls.msk.ru [192.168.177.99]) by isrv.corpit.ru (Postfix) with ESMTP id CBDB8A03F4; Mon, 4 Feb 2013 14:52:41 +0400 (MSK) Received: by gandalf.tls.msk.ru (Postfix, from userid 1000) id 54B3B545; Mon, 4 Feb 2013 14:41:29 +0400 (MSK) From: Michael Tokarev To: qemu-devel@nongnu.org Date: Mon, 4 Feb 2013 14:40:59 +0400 Message-Id: <1359974470-17044-50-git-send-email-mjt@msgid.tls.msk.ru> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1359974470-17044-1-git-send-email-mjt@msgid.tls.msk.ru> References: <1359974470-17044-1-git-send-email-mjt@msgid.tls.msk.ru> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 86.62.121.231 Cc: Michael Tokarev , qemu-stable@nongnu.org, Stefan Hajnoczi , "Michael S. Tsirkin" Subject: [Qemu-devel] [PATCH 49/60] tap: reset vnet header size on open X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: "Michael S. Tsirkin" For tap, we currently assume the vnet header size is 10 (the default value) but that might not be the case if tap is persistent and has been used by qemu previously. To fix, set host header size in tap device on open. Signed-off-by: Michael S. Tsirkin Tested-by: Alexander Graf Signed-off-by: Stefan Hajnoczi (cherry picked from commit 58ddcd50f30cb5c020bd4f9f36b01ee160a27cac) Signed-off-by: Michael Tokarev --- net/tap.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/net/tap.c b/net/tap.c index f240028..08be84f 100644 --- a/net/tap.c +++ b/net/tap.c @@ -339,6 +339,13 @@ static TAPState *net_tap_fd_init(VLANState *vlan, s->using_vnet_hdr = 0; s->has_ufo = tap_probe_has_ufo(s->fd); tap_set_offload(&s->nc, 0, 0, 0, 0, 0); + /* + * Make sure host header length is set correctly in tap: + * it might have been modified by another instance of qemu. + */ + if (tap_probe_vnet_hdr_len(s->fd, s->host_vnet_hdr_len)) { + tap_fd_set_vnet_hdr_len(s->fd, s->host_vnet_hdr_len); + } tap_read_poll(s, 1); s->vhost_net = NULL; return s;