patch 'net/bnxt: fix ring calculation for representors' has been queued to stable release 20.11.5

luca.boccassi at gmail.com luca.boccassi at gmail.com
Fri Feb 18 13:39:27 CET 2022


Hi,

FYI, your patch has been queued to stable release 20.11.5

Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet.
It will be pushed if I get no objections before 02/20/22. 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/bluca/dpdk-stable

This queued commit can be viewed at:
https://github.com/bluca/dpdk-stable/commit/045d6f7c38225082358a11c79570dd5535197482

Thanks.

Luca Boccassi

---
>From 045d6f7c38225082358a11c79570dd5535197482 Mon Sep 17 00:00:00 2001
From: Ajit Khaparde <ajit.khaparde at broadcom.com>
Date: Wed, 26 Jan 2022 10:13:26 -0800
Subject: [PATCH] net/bnxt: fix ring calculation for representors

[ upstream commit 59e62818877aa45c0066743470192c317670678c ]

Currently the Tx and Rx ring count for representors is fixed.
It does not consider the number of rings created for the parent
function. And that can cause issues not only during initialization
but while running traffic.
Instead check the number of rings created for the parent function
while configuring the ring resources for representors.
In some cases VF rep ring init may happen before the parent function's
rings have been setup. And this can cause representor ring count to be
configured as 0. In such cases, initialize the VF representor
ring count to 8.

Fixes: 322bd6e70272 ("net/bnxt: add port representor infrastructure")

Signed-off-by: Ajit Khaparde <ajit.khaparde at broadcom.com>
Reviewed-by: Somnath Kotur <somnath.kotur at broadcom.com>
Reviewed-by: Kalesh AP <kalesh-anakkur.purayil at broadcom.com>
---
 drivers/net/bnxt/bnxt.h      |  2 +-
 drivers/net/bnxt/bnxt_reps.c | 21 ++++++++++++---------
 2 files changed, 13 insertions(+), 10 deletions(-)

diff --git a/drivers/net/bnxt/bnxt.h b/drivers/net/bnxt/bnxt.h
index b1ed54dd35..30265d245b 100644
--- a/drivers/net/bnxt/bnxt.h
+++ b/drivers/net/bnxt/bnxt.h
@@ -798,7 +798,7 @@ struct bnxt {
 	uint16_t		max_rx_rings;
 #define MAX_STINGRAY_RINGS		128U
 
-#define BNXT_MAX_VF_REP_RINGS	8
+#define BNXT_MAX_VF_REP_RINGS	8U
 
 	uint16_t		max_nq_rings;
 	uint16_t		max_l2_ctx;
diff --git a/drivers/net/bnxt/bnxt_reps.c b/drivers/net/bnxt/bnxt_reps.c
index db780c3d2c..b35c54fe13 100644
--- a/drivers/net/bnxt/bnxt_reps.c
+++ b/drivers/net/bnxt/bnxt_reps.c
@@ -523,7 +523,10 @@ int bnxt_rep_dev_info_get_op(struct rte_eth_dev *eth_dev,
 	dev_info->max_mac_addrs = parent_bp->max_l2_ctx;
 	dev_info->max_hash_mac_addrs = 0;
 
-	max_rx_rings = BNXT_MAX_VF_REP_RINGS;
+	max_rx_rings = parent_bp->rx_nr_rings ?
+		RTE_MIN(parent_bp->rx_nr_rings, BNXT_MAX_VF_REP_RINGS) :
+		BNXT_MAX_VF_REP_RINGS;
+
 	/* For the sake of symmetry, max_rx_queues = max_tx_queues */
 	dev_info->max_rx_queues = max_rx_rings;
 	dev_info->max_tx_queues = max_rx_rings;
@@ -603,10 +606,10 @@ int bnxt_rep_rx_queue_setup_op(struct rte_eth_dev *eth_dev,
 	struct rte_mbuf **buf_ring;
 	int rc = 0;
 
-	if (queue_idx >= BNXT_MAX_VF_REP_RINGS) {
+	if (queue_idx >= rep_bp->rx_nr_rings) {
 		PMD_DRV_LOG(ERR,
 			    "Cannot create Rx ring %d. %d rings available\n",
-			    queue_idx, BNXT_MAX_VF_REP_RINGS);
+			    queue_idx, rep_bp->rx_nr_rings);
 		return -EINVAL;
 	}
 
@@ -702,10 +705,10 @@ int bnxt_rep_tx_queue_setup_op(struct rte_eth_dev *eth_dev,
 	struct bnxt_tx_queue *parent_txq, *txq;
 	struct bnxt_vf_rep_tx_queue *vfr_txq;
 
-	if (queue_idx >= BNXT_MAX_VF_REP_RINGS) {
+	if (queue_idx >= rep_bp->rx_nr_rings) {
 		PMD_DRV_LOG(ERR,
 			    "Cannot create Tx rings %d. %d rings available\n",
-			    queue_idx, BNXT_MAX_VF_REP_RINGS);
+			    queue_idx, rep_bp->rx_nr_rings);
 		return -EINVAL;
 	}
 
@@ -777,10 +780,10 @@ int bnxt_rep_stats_get_op(struct rte_eth_dev *eth_dev,
 			     struct rte_eth_stats *stats)
 {
 	struct bnxt_representor *rep_bp = eth_dev->data->dev_private;
-	int i;
+	unsigned int i;
 
 	memset(stats, 0, sizeof(*stats));
-	for (i = 0; i < BNXT_MAX_VF_REP_RINGS; i++) {
+	for (i = 0; i < rep_bp->rx_nr_rings; i++) {
 		stats->obytes += rep_bp->tx_bytes[i];
 		stats->opackets += rep_bp->tx_pkts[i];
 		stats->ibytes += rep_bp->rx_bytes[i];
@@ -800,9 +803,9 @@ int bnxt_rep_stats_get_op(struct rte_eth_dev *eth_dev,
 int bnxt_rep_stats_reset_op(struct rte_eth_dev *eth_dev)
 {
 	struct bnxt_representor *rep_bp = eth_dev->data->dev_private;
-	int i;
+	unsigned int i;
 
-	for (i = 0; i < BNXT_MAX_VF_REP_RINGS; i++) {
+	for (i = 0; i < rep_bp->rx_nr_rings; i++) {
 		rep_bp->tx_pkts[i] = 0;
 		rep_bp->tx_bytes[i] = 0;
 		rep_bp->rx_pkts[i] = 0;
-- 
2.30.2

---
  Diff of the applied patch vs upstream commit (please double-check if non-empty:
---
--- -	2022-02-18 12:37:42.266148105 +0000
+++ 0118-net-bnxt-fix-ring-calculation-for-representors.patch	2022-02-18 12:37:37.878796119 +0000
@@ -1 +1 @@
-From 59e62818877aa45c0066743470192c317670678c Mon Sep 17 00:00:00 2001
+From 045d6f7c38225082358a11c79570dd5535197482 Mon Sep 17 00:00:00 2001
@@ -5,0 +6,2 @@
+[ upstream commit 59e62818877aa45c0066743470192c317670678c ]
+
@@ -18 +19,0 @@
-Cc: stable at dpdk.org
@@ -29 +30 @@
-index 433f1c80be..0cbb58b2cf 100644
+index b1ed54dd35..30265d245b 100644
@@ -32,2 +33 @@
-@@ -831,7 +831,7 @@ struct bnxt {
- 	uint16_t		max_tx_rings;
+@@ -798,7 +798,7 @@ struct bnxt {
@@ -35 +35,2 @@
- #define MAX_STINGRAY_RINGS		236U
+ #define MAX_STINGRAY_RINGS		128U
+ 
@@ -42 +43 @@
-index 5e140f0cdb..e773932681 100644
+index db780c3d2c..b35c54fe13 100644
@@ -45 +46 @@
-@@ -548,7 +548,10 @@ int bnxt_rep_dev_info_get_op(struct rte_eth_dev *eth_dev,
+@@ -523,7 +523,10 @@ int bnxt_rep_dev_info_get_op(struct rte_eth_dev *eth_dev,
@@ -57 +58 @@
-@@ -629,10 +632,10 @@ int bnxt_rep_rx_queue_setup_op(struct rte_eth_dev *eth_dev,
+@@ -603,10 +606,10 @@ int bnxt_rep_rx_queue_setup_op(struct rte_eth_dev *eth_dev,
@@ -70 +71 @@
-@@ -729,10 +732,10 @@ int bnxt_rep_tx_queue_setup_op(struct rte_eth_dev *eth_dev,
+@@ -702,10 +705,10 @@ int bnxt_rep_tx_queue_setup_op(struct rte_eth_dev *eth_dev,
@@ -83 +84 @@
-@@ -805,10 +808,10 @@ int bnxt_rep_stats_get_op(struct rte_eth_dev *eth_dev,
+@@ -777,10 +780,10 @@ int bnxt_rep_stats_get_op(struct rte_eth_dev *eth_dev,
@@ -96 +97 @@
-@@ -828,9 +831,9 @@ int bnxt_rep_stats_get_op(struct rte_eth_dev *eth_dev,
+@@ -800,9 +803,9 @@ int bnxt_rep_stats_get_op(struct rte_eth_dev *eth_dev,


More information about the stable mailing list