DPDK patches and discussions
 help / color / mirror / Atom feed
From: Maxime Coquelin <maxime.coquelin@redhat.com>
To: dev@dpdk.org, chenbo.xia@intel.com, david.marchand@redhat.com,
	eperezma@redhat.com
Cc: Maxime Coquelin <maxime.coquelin@redhat.com>
Subject: [PATCH] net/virtio-user: fix number of vrings calculation
Date: Fri, 10 Feb 2023 16:10:44 +0100	[thread overview]
Message-ID: <20230210151044.229324-1-maxime.coquelin@redhat.com> (raw)

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 <maxime.coquelin@redhat.com>
---

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);
-- 
2.39.1


             reply	other threads:[~2023-02-10 15:10 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-10 15:10 Maxime Coquelin [this message]
2023-02-10 15:23 ` David Marchand
2023-02-10 15:28 ` Maxime Coquelin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230210151044.229324-1-maxime.coquelin@redhat.com \
    --to=maxime.coquelin@redhat.com \
    --cc=chenbo.xia@intel.com \
    --cc=david.marchand@redhat.com \
    --cc=dev@dpdk.org \
    --cc=eperezma@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).