DPDK patches and discussions
 help / color / mirror / Atom feed
From: Hao Chen <chenh@yusur.tech>
To: dev@dpdk.org
Cc: zy@yusur.tech, huangml@yusur.tech,
	Maxime Coquelin <maxime.coquelin@redhat.com>,
	Chenbo Xia <chenbo.xia@intel.com>
Subject: [PATCH] vhost: fix vdpa driver multi-queue initialization failure
Date: Sat, 28 Jan 2023 11:06:03 +0800	[thread overview]
Message-ID: <20230128030603.1168073-2-chenh@yusur.tech> (raw)
In-Reply-To: <20230128030603.1168073-1-chenh@yusur.tech>

When 'virtio_is_Ready' returns 1, 'vdpa_dev->ops->dev_conf' will be
called, and the vdpa driver called 'rte_vhost_get_vhost_vring' to
get the vring addr info from 'vhost_devices->virtqueue[]'.
virtio_is_ready's nr_vring is VIRTIO_BUILTIN_NUM_VQS_TO_BE_READY(2),
multi-queue's nr_vring is greater than 2.
Only 'vhost_devices->virtqueue[0]' and 'vhost_devices->virtqueue[1]'
are obtained in the for loop. Other queues of multiple queues cannot
obtain the corresponding 'vhost_devices->virtqueue[i]', which will
cause 'vdpa_dev->ops->dev_conf' to obtain QEMU vring addr information
from 'vhost_devices->virtqueue[i]' failed.
Here, nr_ving is modified to dev->nr_vring, so that multiple queues
can obtain the corresponding 'vhost_devices->virtqueue[i]'.

Signed-off-by: Hao Chen <chenh@yusur.tech>
---
 lib/vhost/vhost_user.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/vhost/vhost_user.c b/lib/vhost/vhost_user.c
index 9902ae9944..9249eafc06 100644
--- a/lib/vhost/vhost_user.c
+++ b/lib/vhost/vhost_user.c
@@ -1473,7 +1473,7 @@ virtio_is_ready(struct virtio_net *dev)
 	if (dev->nr_vring < nr_vring)
 		return 0;
 
-	for (i = 0; i < nr_vring; i++) {
+	for (i = 0; i < dev->nr_vring; i++) {
 		vq = dev->virtqueue[i];
 
 		if (!vq_is_ready(dev, vq))
-- 
2.27.0


  reply	other threads:[~2023-01-28  3:05 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-28  3:06 Hao Chen
2023-01-28  3:06 ` Hao Chen [this message]
2023-02-01 12:23   ` Maxime Coquelin
2023-02-03 10:38 ` Maxime Coquelin
2023-02-08  9:56   ` Hao Chen

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=20230128030603.1168073-2-chenh@yusur.tech \
    --to=chenh@yusur.tech \
    --cc=chenbo.xia@intel.com \
    --cc=dev@dpdk.org \
    --cc=huangml@yusur.tech \
    --cc=maxime.coquelin@redhat.com \
    --cc=zy@yusur.tech \
    /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).