[dpdk-stable] patch 'net/virtio: fix split queue vectorized Rx' has been queued to stable release 20.11.4

Xueming Li xuemingl at nvidia.com
Wed Nov 10 07:28:54 CET 2021


Hi,

FYI, your patch has been queued to stable release 20.11.4

Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet.
It will be pushed if I get no objections before 11/12/21. 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://github.com/steevenlee/dpdk

This queued commit can be viewed at:
https://github.com/steevenlee/dpdk/commit/b95404765490eb484a534e7d01aea2c95d046fb9

Thanks.

Xueming Li <xuemingl at nvidia.com>

---
>From b95404765490eb484a534e7d01aea2c95d046fb9 Mon Sep 17 00:00:00 2001
From: Ivan Ilchenko <ivan.ilchenko at oktetlabs.ru>
Date: Fri, 20 Aug 2021 15:47:52 +0300
Subject: [PATCH] net/virtio: fix split queue vectorized Rx
Cc: Xueming Li <xuemingl at nvidia.com>

[ upstream commit c97e73779c3eb2f7c214a7300673e54b886223b6 ]

Descriptors number may be set less than queue size for split queue
vectorized Rx path. Pointers to mbufs for received packets are
obtained from SW ring, that is initially filled with them in the end
of queue setup in virtio_dev_rx_queue_setup_finish(). The begin of the
SW ring filled up to the size of descriptors number. At queue size
offset from the begin of the SW ring pointers to some fake mbuf are also
set for wrapping purpose. So the ring may contains the hole of invalid
pointers from descriptors number offset to queue size offset, and split
vectorized Rx routines could write to the invalid addresses since they
use the ring up to the queue size. Fix this by setting descriptors
number to queue size on Rx queue setup.

Fixes: fc3d66212fed ("virtio: add vector Rx")

Signed-off-by: Ivan Ilchenko <ivan.ilchenko at oktetlabs.ru>
Signed-off-by: Andrew Rybchenko <andrew.rybchenko at oktetlabs.ru>
Reviewed-by: Maxime Coquelin <maxime.coquelin at redhat.com>
---
 drivers/net/virtio/virtio_rxtx.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/drivers/net/virtio/virtio_rxtx.c b/drivers/net/virtio/virtio_rxtx.c
index b5b99d19f8..7fb41f12af 100644
--- a/drivers/net/virtio/virtio_rxtx.c
+++ b/drivers/net/virtio/virtio_rxtx.c
@@ -711,8 +711,14 @@ virtio_dev_rx_queue_setup(struct rte_eth_dev *dev,
 	}
 	vq->vq_free_thresh = rx_free_thresh;
 
-	if (nb_desc == 0 || nb_desc > vq->vq_nentries)
+	/*
+	 * For split ring vectorized path descriptors number must be
+	 * equal to the ring size.
+	 */
+	if (nb_desc > vq->vq_nentries ||
+	    (!vtpci_packed_queue(hw) && hw->use_vec_rx)) {
 		nb_desc = vq->vq_nentries;
+	}
 	vq->vq_free_cnt = RTE_MIN(vq->vq_free_cnt, nb_desc);
 
 	rxvq = &vq->rxq;
-- 
2.33.0

---
  Diff of the applied patch vs upstream commit (please double-check if non-empty:
---
--- -	2021-11-10 14:17:04.333221337 +0800
+++ 0050-net-virtio-fix-split-queue-vectorized-Rx.patch	2021-11-10 14:17:01.804079970 +0800
@@ -1 +1 @@
-From c97e73779c3eb2f7c214a7300673e54b886223b6 Mon Sep 17 00:00:00 2001
+From b95404765490eb484a534e7d01aea2c95d046fb9 Mon Sep 17 00:00:00 2001
@@ -4,0 +5,3 @@
+Cc: Xueming Li <xuemingl at nvidia.com>
+
+[ upstream commit c97e73779c3eb2f7c214a7300673e54b886223b6 ]
@@ -19 +21,0 @@
-Cc: stable at dpdk.org
@@ -29 +31 @@
-index 18f03c9fc9..97ed69596a 100644
+index b5b99d19f8..7fb41f12af 100644
@@ -32 +34 @@
-@@ -706,8 +706,14 @@ virtio_dev_rx_queue_setup(struct rte_eth_dev *dev,
+@@ -711,8 +711,14 @@ virtio_dev_rx_queue_setup(struct rte_eth_dev *dev,
@@ -36 +38 @@
--	if (nb_desc > vq->vq_nentries)
+-	if (nb_desc == 0 || nb_desc > vq->vq_nentries)
@@ -42 +44 @@
-+	    (!virtio_with_packed_queue(hw) && hw->use_vec_rx)) {
++	    (!vtpci_packed_queue(hw) && hw->use_vec_rx)) {


More information about the stable mailing list