From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 97334A0C41; Thu, 30 Sep 2021 11:28:01 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 7DF7740DDA; Thu, 30 Sep 2021 11:28:01 +0200 (CEST) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by mails.dpdk.org (Postfix) with ESMTP id 2BB1C4067E for ; Thu, 30 Sep 2021 11:28:00 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1632994079; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=NJ11hiSdJ37wvVHwX3Aa3ViU1a7xFtcAnDlFucv8b2E=; b=XvYp8BxonJ8CrClB7uyZ4aGhN3pgl9uN7SqL3GABQrgEEltWT+tG2A8ZmZVxxnYEqJUBsX YMplfRcOTmnOSCb/1IViA1ObF07dVXr2cr0dN68W9w1bdS/h42+IIe4hYCEqqVCFoMtJMw ThFRGzVYZt29jAiW5qQw/Qm9mab711E= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-1-clXnvApbPGKb7z3fgPaeHA-1; Thu, 30 Sep 2021 05:27:58 -0400 X-MC-Unique: clXnvApbPGKb7z3fgPaeHA-1 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 4F1DF10151FA; Thu, 30 Sep 2021 09:27:55 +0000 (UTC) Received: from [10.39.208.6] (unknown [10.39.208.6]) by smtp.corp.redhat.com (Postfix) with ESMTPS id D4D8960854; Thu, 30 Sep 2021 09:27:53 +0000 (UTC) Message-ID: <4443f090-5321-b1b3-9781-e1576dc83fe7@redhat.com> Date: Thu, 30 Sep 2021 11:27:52 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.1.0 To: Ferruh Yigit , David Marchand , dev@dpdk.org Cc: olivier.matz@6wind.com, Chenbo Xia References: <20210917093344.31719-1-david.marchand@redhat.com> <20210928085114.30737-1-david.marchand@redhat.com> <8acaa61f-a5c8-b118-045b-c42b4ad3f6b9@intel.com> From: Maxime Coquelin In-Reply-To: <8acaa61f-a5c8-b118-045b-c42b4ad3f6b9@intel.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=maxime.coquelin@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Language: en-US Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [dpdk-dev] [PATCH v2] net/virtio: fix virtio-user init when using existing tap X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" On 9/29/21 15:19, Ferruh Yigit wrote: > On 9/28/2021 9:51 AM, David Marchand wrote: >> When attaching to an existing mono queue tap, the virtio-user was not >> reporting that the virtio device was not properly initialised which >> prevented from starting the port later. >> >> $ ip tuntap add test mode tap >> $ dpdk-testpmd --vdev \ >> net_virtio_user0,iface=test,path=/dev/vhost-net,queues=2 -- -i >> >> ... >> virtio_user_dev_init_mac(): (/dev/vhost-net) No valid MAC in devargs or >> device, use random >> vhost_kernel_open_tap(): TUNSETIFF failed: Invalid argument >> vhost_kernel_enable_queue_pair(): fail to open tap for vhost kernel >> virtio_user_start_device(): (/dev/vhost-net) Failed to start device >> ... >> Configuring Port 0 (socket 0) >> vhost_kernel_open_tap(): TUNSETIFF failed: Invalid argument >> vhost_kernel_enable_queue_pair(): fail to open tap for vhost kernel >> virtio_set_multiple_queues(): Multiqueue configured but send command >> failed, this is too late now... >> Fail to start port 0: Invalid argument >> Please stop the ports first >> Done >> >> The virtio-user with vhost-kernel backend was going through a lot >> of complications to initialise tap fds only when using them. >> >> For each qp enabled for the first time, a tapfd was created via >> TUNSETIFF with unneeded additional steps (see below) and then mapped to >> the right qp in the vhost-net backend. >> Unneeded steps (as long as it has been done once for the port): >> - tap features were queried while this is a constant on a running >> system, >> - the device name in DPDK was updated, >> - the mac address of the tap was set, >> >> On subsequent qps state change, the vhost-net backend fd mapping was >> updated and the associated queue/tapfd were disabled/enabled via >> TUNSETQUEUE. >> >> Now, this patch simplifies the whole logic by keeping all tapfds opened >> and in enabled state (from the tap point of view) at all time. >> >> Unused ioctl defines are removed. >> >> Tap features are validated earlier to fail initialisation asap. >> Tap name discovery and mac address configuration are moved when >> configuring qp 0. >> >> To support attaching to mono queue tap, the virtio-user driver now tries >> to attach in multi queue first, then fallbacks to mono queue. >> >> Finally (but this is more for consistency), VIRTIO_NET_F_MQ feature is >> exposed only if the underlying tap supports multi queue. >> >> Signed-off-by: David Marchand > > Do we want to backport this patch? If so can you please provide a fixes tag? > No, we don't want to backport it. Thanks, Maxime