From patchwork Fri Feb 10 15:10:44 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxime Coquelin X-Patchwork-Id: 123684 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 35B0941C61; Fri, 10 Feb 2023 16:10:52 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 0F56B410D3; Fri, 10 Feb 2023 16:10:52 +0100 (CET) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mails.dpdk.org (Postfix) with ESMTP id 9345F410D0 for ; Fri, 10 Feb 2023 16:10:50 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1676041850; 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; bh=4IeFHnUxV7C4CJ2N2yz9vZCcuAnqdIWT4s5jgPohl+s=; b=jBipb5jqEHMhn041ApT+R78Os4LaBVSw7YmK6Cr2xxTNGorwJ7tGjNWmdVm2SKaEGffAkr 4GGCWNP0Tpblfpw5JYD/9VT2UW2GdLsPfC/31//fGHKU8xqqTnZbzUwZBOECJyNl2CZJpQ 6piF3RAoiC1lay8EhG1/z+AQJHTRO5I= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-480-kvD5LaLHNkOqcrkNZlR6Og-1; Fri, 10 Feb 2023 10:10:47 -0500 X-MC-Unique: kvD5LaLHNkOqcrkNZlR6Og-1 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 474BB885622; Fri, 10 Feb 2023 15:10:47 +0000 (UTC) Received: from max-t490s.redhat.com (unknown [10.39.208.22]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0A061175AD; Fri, 10 Feb 2023 15:10:45 +0000 (UTC) From: Maxime Coquelin To: dev@dpdk.org, chenbo.xia@intel.com, david.marchand@redhat.com, eperezma@redhat.com Cc: Maxime Coquelin Subject: [PATCH] net/virtio-user: fix number of vrings calculation Date: Fri, 10 Feb 2023 16:10:44 +0100 Message-Id: <20230210151044.229324-1-maxime.coquelin@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.5 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 When moving to dynamic allocation of vrings metadata, the number of vrings to allocate was incremented if the backend supports control queue. The problem is that the control queue metadata have to be allocated even if the backend does not use it directly, since the control queue is managed by the Virtio-user layer as soon as multiqueue is negotiated.. This patch fixes this by incrementing the number of vrings as soon as the device features have VIRTIO_NET_F_MQ. Fixes: d57c3a601e44 ("net/virtio-user: remove max queues limitation") Signed-off-by: Maxime Coquelin Acked-by: David Marchand --- I plan to squash it with faulty commit in the Virtio branch since it has not been pulled yet by Thomas once acked and if no objection. drivers/net/virtio/virtio_user/virtio_user_dev.c | 2 +- 1 file changed, 1 insertion(+), 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 cf58b63029..ccb4d7326b 100644 --- a/drivers/net/virtio/virtio_user/virtio_user_dev.c +++ b/drivers/net/virtio/virtio_user/virtio_user_dev.c @@ -575,7 +575,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->hw_cvq) + if (dev->device_features & (1ull << VIRTIO_NET_F_MQ)) nr_vrings++; dev->callfds = rte_zmalloc("virtio_user_dev", nr_vrings * sizeof(*dev->callfds), 0);