patch 'net/nfp: fix Tx descriptor free logic of NFD3' has been queued to stable release 22.11.3

Xueming Li xuemingl at nvidia.com
Thu Aug 10 02:10:43 CEST 2023


Hi,

FYI, your patch has been queued to stable release 22.11.3

Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet.
It will be pushed if I get no objections before 08/11/23. 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=22.11-staging

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

Thanks.

Xueming Li <xuemingl at nvidia.com>

---
>From c12883295e0a268e471fe990acde498b50e1455d Mon Sep 17 00:00:00 2001
From: Chaoyong He <chaoyong.he at corigine.com>
Date: Tue, 20 Jun 2023 10:49:57 +0800
Subject: [PATCH] net/nfp: fix Tx descriptor free logic of NFD3
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: Xueming Li <xuemingl at nvidia.com>

[ upstream commit e97738919c2315e07c2e98b6a9cc3912c335364a ]

In the Tx descriptor free logic of nfd3, the former logic might force
cast a negative number into a very big unsigned number, and which will
cause potential problem in the xmit loop.

The xmit loop will continue in the place where it should break, and will
overwrite the Tx descriptor which is not free to use by the PMD.

Fixes: 74a640dac864 ("net/nfp: avoid modulo operations for handling ring wrapping")

Signed-off-by: Chaoyong He <chaoyong.he at corigine.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund at corigine.com>
---
 drivers/net/nfp/nfp_rxtx.h | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/drivers/net/nfp/nfp_rxtx.h b/drivers/net/nfp/nfp_rxtx.h
index e2b48374fe..1c2a00e300 100644
--- a/drivers/net/nfp/nfp_rxtx.h
+++ b/drivers/net/nfp/nfp_rxtx.h
@@ -340,10 +340,14 @@ nfp_net_mbuf_alloc_failed(struct nfp_net_rxq *rxq)
 static inline uint32_t
 nfp_net_nfd3_free_tx_desc(struct nfp_net_txq *txq)
 {
+	uint32_t free_desc;
+
 	if (txq->wr_p >= txq->rd_p)
-		return txq->tx_count - (txq->wr_p - txq->rd_p) - 8;
+		free_desc = txq->tx_count - (txq->wr_p - txq->rd_p);
 	else
-		return txq->rd_p - txq->wr_p - 8;
+		free_desc = txq->rd_p - txq->wr_p;
+
+	return (free_desc > 8) ? (free_desc - 8) : 0;
 }
 
 /*
-- 
2.25.1

---
  Diff of the applied patch vs upstream commit (please double-check if non-empty:
---
--- -	2023-08-09 21:51:21.354583000 +0800
+++ 0126-net-nfp-fix-Tx-descriptor-free-logic-of-NFD3.patch	2023-08-09 21:51:18.294352000 +0800
@@ -1 +1 @@
-From e97738919c2315e07c2e98b6a9cc3912c335364a Mon Sep 17 00:00:00 2001
+From c12883295e0a268e471fe990acde498b50e1455d Mon Sep 17 00:00:00 2001
@@ -3 +3 @@
-Date: Thu, 18 May 2023 19:02:47 +0800
+Date: Tue, 20 Jun 2023 10:49:57 +0800
@@ -7,0 +8,3 @@
+Cc: Xueming Li <xuemingl at nvidia.com>
+
+[ upstream commit e97738919c2315e07c2e98b6a9cc3912c335364a ]
@@ -17 +19,0 @@
-Cc: stable at dpdk.org
@@ -22 +24 @@
- drivers/net/nfp/nfd3/nfp_nfd3.h | 8 ++++++--
+ drivers/net/nfp/nfp_rxtx.h | 8 ++++++--
@@ -25,5 +27,5 @@
-diff --git a/drivers/net/nfp/nfd3/nfp_nfd3.h b/drivers/net/nfp/nfd3/nfp_nfd3.h
-index 7bf2349904..e772bc4711 100644
---- a/drivers/net/nfp/nfd3/nfp_nfd3.h
-+++ b/drivers/net/nfp/nfd3/nfp_nfd3.h
-@@ -52,10 +52,14 @@ struct nfp_net_nfd3_tx_desc {
+diff --git a/drivers/net/nfp/nfp_rxtx.h b/drivers/net/nfp/nfp_rxtx.h
+index e2b48374fe..1c2a00e300 100644
+--- a/drivers/net/nfp/nfp_rxtx.h
++++ b/drivers/net/nfp/nfp_rxtx.h
+@@ -340,10 +340,14 @@ nfp_net_mbuf_alloc_failed(struct nfp_net_rxq *rxq)


More information about the stable mailing list