From patchwork Wed Mar 29 02:38:54 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Jason Wang X-Patchwork-Id: 744596 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3vtBmg0Sntz9vg2 for ; Wed, 29 Mar 2017 13:39:30 +1100 (AEDT) Received: from localhost ([::1]:56172 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ct3WB-0005qr-Gp for incoming@patchwork.ozlabs.org; Tue, 28 Mar 2017 22:39:27 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:57898) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ct3Vr-0005ql-2k for qemu-devel@nongnu.org; Tue, 28 Mar 2017 22:39:08 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ct3Vm-0006t8-0m for qemu-devel@nongnu.org; Tue, 28 Mar 2017 22:39:07 -0400 Received: from mx1.redhat.com ([209.132.183.28]:57444) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1ct3Vl-0006sw-Pd for qemu-devel@nongnu.org; Tue, 28 Mar 2017 22:39:01 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 0CB923DBF7; Wed, 29 Mar 2017 02:39:00 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 0CB923DBF7 Authentication-Results: ext-mx06.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx06.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=jasowang@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 0CB923DBF7 Received: from [10.72.7.97] (vpn1-7-97.pek2.redhat.com [10.72.7.97]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 1C5A317ADD; Wed, 29 Mar 2017 02:38:57 +0000 (UTC) To: Andrew Baumann , Stefan Weil , "qemu-devel@nongnu.org" References: <20170324234646.15264-1-Andrew.Baumann@microsoft.com> <5b6dc1d9-996a-66fe-7142-2c9be4670540@weilnetz.de> From: Jason Wang Message-ID: <2695069b-5704-536d-33e3-66e8d014475c@redhat.com> Date: Wed, 29 Mar 2017 10:38:54 +0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0 MIME-Version: 1.0 In-Reply-To: X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Wed, 29 Mar 2017 02:39:00 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: Re: [Qemu-devel] [PATCH for 2.9?] tap-win32: don't abort in tap_enable(); enables -netdev tap X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 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" On 2017年03月29日 02:55, Andrew Baumann wrote: >> From: Stefan Weil [mailto:sw@weilnetz.de] >> Sent: Tuesday, 28 March 2017 11:28 >> Am 25.03.2017 um 00:46 schrieb Andrew Baumann: >>> The docs generally steer users away from using the legacy -net >>> parameter, however on win32 attempting to enable a tap device using >>> -netdev tap fails at an abort() in tap_enable(). Removing the abort()s >>> seems to be enough to get everything working, so do that. >>> >>> Signed-off-by: Andrew Baumann >>> --- >>> net/tap-win32.c | 4 ++-- >>> 1 file changed, 2 insertions(+), 2 deletions(-) >>> >>> diff --git a/net/tap-win32.c b/net/tap-win32.c >>> index 662f9b6..3620843 100644 >>> --- a/net/tap-win32.c >>> +++ b/net/tap-win32.c >>> @@ -811,10 +811,10 @@ int net_init_tap(const Netdev *netdev, const char >> *name, >>> int tap_enable(NetClientState *nc) >>> { >>> - abort(); >>> + return 0; >>> } >>> >>> int tap_disable(NetClientState *nc) >>> { >>> - abort(); >>> + return 0; >>> } >> As I never worked with TAP on Windows, I cannot say much to this fix. >> >> Jason, what is the use of tap_enable, tap_disable? It should be only used when we want to enable and disable a specific queue of a multiqueue supported tap. >> Is it fine >> to simply do nothing on Windows here? Unless windows support multiqueue tap, we should keep the assert here. > I was also hoping for a review -- I'm no expert on this stuff either, but my quick reading of those code paths is that they issue ioctls to enable/disable packet reception on the underlying tap device. As win32 TAP is implemented, that is already enabled from start of day. > > It's possible this patch still does not permit dynamic reconfiguration of tap devices (e.g. from the monitor console). However, it does work with the -netdev tap option on the command-line. > >> And is this something for QEMU‌ 2.9 (I added question to subject line)? > Ideally, yes. If not, -netdev tap will continue to blow up in the abort as it does today... > > Andrew Yes, so the problem is we should prevent tap_enable() and tap_disable() from being called if multiqueue is disabled. I believe the following patch can fix this issue, could you give a try on this? diff --git a/hw/net/virtio-net.c b/hw/net/virtio-net.c index c321680..7d091c9 100644 --- a/hw/net/virtio-net.c +++ b/hw/net/virtio-net.c @@ -510,6 +510,10 @@ static int peer_attach(VirtIONet *n, int index) return 0; } + if (n->max_queues == 1) { + return 0; + } + return tap_enable(nc->peer); }