DPDK patches and discussions
 help / color / mirror / Atom feed
From: Matan Azrad <matan@mellanox.com>
To: Maxime Coquelin <maxime.coquelin@redhat.com>,
	Xiao Wang <xiao.w.wang@intel.com>
Cc: dev@dpdk.org
Subject: [dpdk-dev] [RFC] vhost: fix vDPA driver configuration timing
Date: Tue,  9 Jun 2020 11:15:46 +0000	[thread overview]
Message-ID: <1591701346-210050-1-git-send-email-matan@mellanox.com> (raw)

The vhost virtio standard has multi-queue feature.
The master side defines the meximum supported queues number and the
slave can choose to work with all the queues or only with part of them.

The vhost library, which manages the host side, expects to see
configuration of all the queues before the device becomes ready even if
the guest doesn't enable all the queues.

So, if the guest doesn't enable all the queues, the vhost library never
notifies the application on the new device and never triggers the vDPA
driver configuration.

Remove disabled queues ready check.
Also no need anymore callfd validation as last command.

Signed-off-by: Matan Azrad <matan@mellanox.com>
---
 drivers/vdpa/mlx5/mlx5_vdpa_virtq.c | 4 +++-
 lib/librte_vhost/vhost_user.c       | 5 ++++-
 2 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/drivers/vdpa/mlx5/mlx5_vdpa_virtq.c b/drivers/vdpa/mlx5/mlx5_vdpa_virtq.c
index 86aded2..8cbeef4 100644
--- a/drivers/vdpa/mlx5/mlx5_vdpa_virtq.c
+++ b/drivers/vdpa/mlx5/mlx5_vdpa_virtq.c
@@ -179,6 +179,8 @@
 	ret = rte_vhost_get_vhost_vring(priv->vid, index, &vq);
 	if (ret)
 		return -1;
+	DRV_LOG(DEBUG, "virtq %d info: size = %d, callfd = %d, kickfd = %d.",
+		index, (int)vq.size, vq.callfd, vq.kickfd);
 	virtq->index = index;
 	virtq->vq_size = vq.size;
 	attr.tso_ipv4 = !!(priv->features & (1ULL << VIRTIO_NET_F_HOST_TSO4));
@@ -421,7 +423,7 @@
 	for (i = 0; i < nr_vring; i++) {
 		claim_zero(rte_vhost_enable_guest_notification(priv->vid, i,
 							       1));
-		if (mlx5_vdpa_virtq_setup(priv, i))
+		if (priv->virtqs[i].enable && mlx5_vdpa_virtq_setup(priv, i))
 			goto error;
 	}
 	return 0;
diff --git a/lib/librte_vhost/vhost_user.c b/lib/librte_vhost/vhost_user.c
index 84bebad..d030d60 100644
--- a/lib/librte_vhost/vhost_user.c
+++ b/lib/librte_vhost/vhost_user.c
@@ -1298,6 +1298,9 @@
 	if (!vq)
 		return false;
 
+	if (!vq->enabled)
+		return true;
+
 	if (vq_is_packed(dev))
 		rings_ok = vq->desc_packed && vq->driver_event &&
 			vq->device_event;
@@ -1315,7 +1318,7 @@
 	struct vhost_virtqueue *vq;
 	uint32_t i;
 
-	if (dev->nr_vring == 0)
+	if (dev->nr_vring == 0 || !dev->mem)
 		return 0;
 
 	for (i = 0; i < dev->nr_vring; i++) {
-- 
1.8.3.1


                 reply	other threads:[~2020-06-09 11:16 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=1591701346-210050-1-git-send-email-matan@mellanox.com \
    --to=matan@mellanox.com \
    --cc=dev@dpdk.org \
    --cc=maxime.coquelin@redhat.com \
    --cc=xiao.w.wang@intel.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).