From patchwork Thu Mar 28 13:08:13 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxime Coquelin X-Patchwork-Id: 138956 X-Patchwork-Delegate: maxime.coquelin@redhat.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id E44F843D6C; Thu, 28 Mar 2024 14:09:01 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 51EF5427DD; Thu, 28 Mar 2024 14:08:37 +0100 (CET) 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 56D2A4114B for ; Thu, 28 Mar 2024 14:08:35 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1711631314; 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=luKtjAB0g4fsel0poRwQ/ihDa6Ti2ObUnoidq2P5sVI=; b=K1DHL94ZmHPvzCmxosp9dQMn6NSDDb2vj0lWOQ1/limaGqycJ4hwN2y/dlB4FZ8RfvS7KF 4AgS4ZmVVMXPydki9wQj6bFvtUEoxnM3Y+qwLPDpJFdR1peV7QLFtIkn1hQhbXKcaBBegz a6HCFuqglXqs1LzjZOPjIjDmvNkubMc= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-407-7Y3GrrGaPl6Bw9nQfa8OJA-1; Thu, 28 Mar 2024 09:08:30 -0400 X-MC-Unique: 7Y3GrrGaPl6Bw9nQfa8OJA-1 Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 5B15D8007A2; Thu, 28 Mar 2024 13:08:30 +0000 (UTC) Received: from max-p1.redhat.com (unknown [10.39.208.26]) by smtp.corp.redhat.com (Postfix) with ESMTP id 891B8492BD7; Thu, 28 Mar 2024 13:08:28 +0000 (UTC) From: Maxime Coquelin To: dev@dpdk.org, david.marchand@redhat.com, chenbox@nvidia.com Cc: Maxime Coquelin , stable@dpdk.org Subject: [PATCH v2 4/4] net/virtio-user: fix control queue allocation Date: Thu, 28 Mar 2024 14:08:13 +0100 Message-ID: <20240328130813.3696005-5-maxime.coquelin@redhat.com> In-Reply-To: <20240328130813.3696005-1-maxime.coquelin@redhat.com> References: <20240328130813.3696005-1-maxime.coquelin@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.10 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com 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 It is possible to have the control queue without the device advertising VIRTIO_NET_F_MQ. Rely on the VIRTIO_NET_F_CTRL_VQ feature being advertised instead. Fixes: 6fdf32d1e318 ("net/virtio-user: remove max queues limitation") Cc: stable@dpdk.org Signed-off-by: Maxime Coquelin --- drivers/net/virtio/virtio_user/virtio_user_dev.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/net/virtio/virtio_user/virtio_user_dev.c b/drivers/net/virtio/virtio_user/virtio_user_dev.c index 912e87fecf..b3aed48452 100644 --- a/drivers/net/virtio/virtio_user/virtio_user_dev.c +++ b/drivers/net/virtio/virtio_user/virtio_user_dev.c @@ -21,6 +21,7 @@ #include #include "vhost.h" +#include "virtio.h" #include "virtio_user_dev.h" #include "../virtio_ethdev.h" @@ -615,7 +616,7 @@ virtio_user_alloc_vrings(struct virtio_user_dev *dev) bool packed_ring = !!(dev->device_features & (1ull << VIRTIO_F_RING_PACKED)); nr_vrings = dev->max_queue_pairs * 2; - if (dev->device_features & (1ull << VIRTIO_NET_F_MQ)) + if (dev->device_features & (1ull << VIRTIO_NET_F_CTRL_VQ)) nr_vrings++; dev->callfds = rte_zmalloc("virtio_user_dev", nr_vrings * sizeof(*dev->callfds), 0);