From patchwork Tue Nov 13 10:23:23 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 198598 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 3ABE52C00BF for ; Tue, 13 Nov 2012 21:21:04 +1100 (EST) Received: from localhost ([::1]:48975 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TYDc6-0002yc-6S for incoming@patchwork.ozlabs.org; Tue, 13 Nov 2012 05:21:02 -0500 Received: from eggs.gnu.org ([208.118.235.92]:44706) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TYDbx-0002uK-44 for qemu-devel@nongnu.org; Tue, 13 Nov 2012 05:20:56 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TYDbu-0004op-2O for qemu-devel@nongnu.org; Tue, 13 Nov 2012 05:20:53 -0500 Received: from mx1.redhat.com ([209.132.183.28]:57068) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TYDbt-0004oc-Ii for qemu-devel@nongnu.org; Tue, 13 Nov 2012 05:20:49 -0500 Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id qADAKl79003026 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Tue, 13 Nov 2012 05:20:48 -0500 Received: from redhat.com (vpn1-4-205.ams2.redhat.com [10.36.4.205]) by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with SMTP id qADAKiuw019359; Tue, 13 Nov 2012 05:20:45 -0500 Date: Tue, 13 Nov 2012 12:23:23 +0200 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org, agraf@suse.de Message-ID: <20121113102323.GA29422@redhat.com> MIME-Version: 1.0 Content-Disposition: inline X-Scanned-By: MIMEDefang 2.67 on 10.5.11.11 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 209.132.183.28 Cc: Anthony Liguori , Stefan Hajnoczi Subject: [Qemu-devel] [PATCHv2] 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 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 --- This fixes the issue reported by Alexander Graf on the kvm forum. Alexander, could you confirm please? Thanks, net/tap.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/net/tap.c b/net/tap.c index df89caa..1abfd44 100644 --- a/net/tap.c +++ b/net/tap.c @@ -341,6 +341,13 @@ static TAPState *net_tap_fd_init(NetClientState *peer, 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;