patch 'net/virtio: fix vDPA device init advertising control queue' has been queued to stable release 23.11.1

Xueming Li xuemingl at nvidia.com
Sat Apr 13 14:49:13 CEST 2024


Hi,

FYI, your patch has been queued to stable release 23.11.1

Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet.
It will be pushed if I get no objections before 04/15/24. So please
shout if anyone has objections.

Also note that after the patch there's a diff of the upstream commit vs the
patch applied to the branch. This will indicate if there was any rebasing
needed to apply to the stable branch. If there were code changes for rebasing
(ie: not only metadata diffs), please double check that the rebase was
correctly done.

Queued patches are on a temporary branch at:
https://git.dpdk.org/dpdk-stable/log/?h=23.11-staging

This queued commit can be viewed at:
https://git.dpdk.org/dpdk-stable/commit/?h=23.11-staging&id=7105c8a2997b364313c06f7d4cbc62a64eb61dec

Thanks.

Xueming Li <xuemingl at nvidia.com>

---
>From 7105c8a2997b364313c06f7d4cbc62a64eb61dec Mon Sep 17 00:00:00 2001
From: Maxime Coquelin <maxime.coquelin at redhat.com>
Date: Wed, 13 Mar 2024 13:59:31 +0100
Subject: [PATCH] net/virtio: fix vDPA device init advertising control queue
Cc: Xueming Li <xuemingl at nvidia.com>

[ upstream commit 58c894154165f24de8344383e2d1d5cccf4a42bc ]

If the vDPA device advertises control queue support, but
the user neither passes "cq=1" as devarg nor requests
multiple queues, the initialization fails because the
driver tries to setup the control queue without negotiating
related feature.

This patch enables the control queue at driver level as
soon as the device claims to support it, and not only when
multiple queue pairs are requested. Also, enable the
control queue event if multiqueue feature has not been
negotiated and device start time, and disable it at device
stop time.

Fixes: b277308e8868 ("net/virtio-user: advertise control VQ support with vDPA")

Signed-off-by: Maxime Coquelin <maxime.coquelin at redhat.com>
Reviewed-by: David Marchand <david.marchand at redhat.com>
---
 .../net/virtio/virtio_user/virtio_user_dev.c  | 22 ++++++++++++++-----
 1 file changed, 16 insertions(+), 6 deletions(-)

diff --git a/drivers/net/virtio/virtio_user/virtio_user_dev.c b/drivers/net/virtio/virtio_user/virtio_user_dev.c
index af1f8c8237..4fd89a8e97 100644
--- a/drivers/net/virtio/virtio_user/virtio_user_dev.c
+++ b/drivers/net/virtio/virtio_user/virtio_user_dev.c
@@ -215,6 +215,12 @@ virtio_user_start_device(struct virtio_user_dev *dev)
 	if (ret < 0)
 		goto error;
 
+	if (dev->scvq) {
+		ret = dev->ops->cvq_enable(dev, 1);
+		if (ret < 0)
+			goto error;
+	}
+
 	dev->started = true;
 
 	pthread_mutex_unlock(&dev->mutex);
@@ -247,6 +253,12 @@ int virtio_user_stop_device(struct virtio_user_dev *dev)
 			goto err;
 	}
 
+	if (dev->scvq) {
+		ret = dev->ops->cvq_enable(dev, 0);
+		if (ret < 0)
+			goto err;
+	}
+
 	/* Stop the backend. */
 	for (i = 0; i < dev->max_queue_pairs * 2; ++i) {
 		state.index = i;
@@ -725,7 +737,7 @@ virtio_user_dev_init(struct virtio_user_dev *dev, char *path, uint16_t queues,
 	if (virtio_user_dev_init_max_queue_pairs(dev, queues))
 		dev->unsupported_features |= (1ull << VIRTIO_NET_F_MQ);
 
-	if (dev->max_queue_pairs > 1)
+	if (dev->max_queue_pairs > 1 || dev->hw_cvq)
 		cq = 1;
 
 	if (!mrg_rxbuf)
@@ -743,8 +755,9 @@ virtio_user_dev_init(struct virtio_user_dev *dev, char *path, uint16_t queues,
 		dev->unsupported_features |= (1ull << VIRTIO_NET_F_MAC);
 
 	if (cq) {
-		/* device does not really need to know anything about CQ,
-		 * so if necessary, we just claim to support CQ
+		/* Except for vDPA, the device does not really need to know
+		 * anything about CQ, so if necessary, we just claim to support
+		 * control queue.
 		 */
 		dev->frontend_features |= (1ull << VIRTIO_NET_F_CTRL_VQ);
 	} else {
@@ -844,9 +857,6 @@ virtio_user_handle_mq(struct virtio_user_dev *dev, uint16_t q_pairs)
 	for (i = q_pairs; i < dev->max_queue_pairs; ++i)
 		ret |= dev->ops->enable_qp(dev, i, 0);
 
-	if (dev->scvq)
-		ret |= dev->ops->cvq_enable(dev, 1);
-
 	dev->queue_pairs = q_pairs;
 
 	return ret;
-- 
2.34.1

---
  Diff of the applied patch vs upstream commit (please double-check if non-empty:
---
--- -	2024-04-13 20:43:07.252100287 +0800
+++ 0073-net-virtio-fix-vDPA-device-init-advertising-control-.patch	2024-04-13 20:43:05.027753892 +0800
@@ -1 +1 @@
-From 58c894154165f24de8344383e2d1d5cccf4a42bc Mon Sep 17 00:00:00 2001
+From 7105c8a2997b364313c06f7d4cbc62a64eb61dec Mon Sep 17 00:00:00 2001
@@ -4,0 +5,3 @@
+Cc: Xueming Li <xuemingl at nvidia.com>
+
+[ upstream commit 58c894154165f24de8344383e2d1d5cccf4a42bc ]
@@ -20 +22,0 @@
-Cc: stable at dpdk.org
@@ -29 +31 @@
-index d395fc1676..54187fedf5 100644
+index af1f8c8237..4fd89a8e97 100644
@@ -32 +34 @@
-@@ -216,6 +216,12 @@ virtio_user_start_device(struct virtio_user_dev *dev)
+@@ -215,6 +215,12 @@ virtio_user_start_device(struct virtio_user_dev *dev)
@@ -45 +47 @@
-@@ -248,6 +254,12 @@ int virtio_user_stop_device(struct virtio_user_dev *dev)
+@@ -247,6 +253,12 @@ int virtio_user_stop_device(struct virtio_user_dev *dev)
@@ -58 +60 @@
-@@ -752,7 +764,7 @@ virtio_user_dev_init(struct virtio_user_dev *dev, char *path, uint16_t queues,
+@@ -725,7 +737,7 @@ virtio_user_dev_init(struct virtio_user_dev *dev, char *path, uint16_t queues,
@@ -67 +69 @@
-@@ -770,8 +782,9 @@ virtio_user_dev_init(struct virtio_user_dev *dev, char *path, uint16_t queues,
+@@ -743,8 +755,9 @@ virtio_user_dev_init(struct virtio_user_dev *dev, char *path, uint16_t queues,
@@ -79 +81 @@
-@@ -871,9 +884,6 @@ virtio_user_handle_mq(struct virtio_user_dev *dev, uint16_t q_pairs)
+@@ -844,9 +857,6 @@ virtio_user_handle_mq(struct virtio_user_dev *dev, uint16_t q_pairs)


More information about the stable mailing list