DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [RFC] vhost: fix vDPA driver configuration timing
@ 2020-06-09 11:15 Matan Azrad
  0 siblings, 0 replies; only message in thread
From: Matan Azrad @ 2020-06-09 11:15 UTC (permalink / raw)
  To: Maxime Coquelin, Xiao Wang; +Cc: dev

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


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2020-06-09 11:16 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-09 11:15 [dpdk-dev] [RFC] vhost: fix vDPA driver configuration timing Matan Azrad

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).