DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH v2 00/17] fixes and refactoring changes for bnxt
@ 2020-12-09 19:22 Ajit Khaparde
  2020-12-09 19:22 ` [dpdk-dev] [PATCH v2 01/17] net/bnxt: fix RX rings in RSS redirection table Ajit Khaparde
                   ` (17 more replies)
  0 siblings, 18 replies; 47+ messages in thread
From: Ajit Khaparde @ 2020-12-09 19:22 UTC (permalink / raw)
  To: dev

Some fixes and refactoring changes for bnxt PMD.

v1->v2: Resend without the legal signature/footer.

Ajit Khaparde (9):
  net/bnxt: remove unused field
  net/bnxt: remove references to Thor
  net/bnxt: fix cleanup on mutex init failure
  net/bnxt: fix format specifier for unsigned int
  net/bnxt: use the right function to free mbuf
  net/bnxt: remove function declaration
  net/bnxt: changes to indentation and coding style
  net/bnxt: add missing comments
  net/bnxt: modify ring index logic

Kalesh AP (3):
  net/bnxt: release hwrm lock in the error case
  net/bnxt: fix to return error when fw command fails
  net/bnxt: fix vnic RSS configure function

Rahul Gupta (1):
  net/bnxt: support for 236 queues in NS3

Samik Gupta (2):
  net/bnxt: fix RX rings in RSS redirection table
  net/bnxt: fix VNIC config on Rx queue stop

Somnath Kotur (1):
  net/bnxt: fix PF resource query

Sriharsha Basavapatna (1):
  net/bnxt: fix max rings computation

 drivers/net/bnxt/bnxt.h                       |  75 +++++++----
 drivers/net/bnxt/bnxt_cpr.h                   |  10 +-
 drivers/net/bnxt/bnxt_ethdev.c                |  78 ++++++-----
 drivers/net/bnxt/bnxt_hwrm.c                  | 127 +++++++++++-------
 drivers/net/bnxt/bnxt_hwrm.h                  |   2 -
 drivers/net/bnxt/bnxt_reps.c                  |   8 +-
 drivers/net/bnxt/bnxt_ring.c                  |  50 +++----
 drivers/net/bnxt/bnxt_ring.h                  |  40 ++++--
 drivers/net/bnxt/bnxt_rxq.c                   |  35 +++--
 drivers/net/bnxt/bnxt_rxr.c                   | 122 +++++++++--------
 drivers/net/bnxt/bnxt_rxr.h                   |   6 +-
 drivers/net/bnxt/bnxt_rxtx_vec_common.h       |  16 +--
 drivers/net/bnxt/bnxt_rxtx_vec_neon.c         |  16 +--
 drivers/net/bnxt/bnxt_rxtx_vec_sse.c          |  16 +--
 drivers/net/bnxt/bnxt_txq.c                   |   2 +-
 drivers/net/bnxt/bnxt_txr.c                   |  51 ++++---
 drivers/net/bnxt/bnxt_txr.h                   |   6 +-
 drivers/net/bnxt/bnxt_vnic.c                  |   4 +-
 drivers/net/bnxt/tf_core/tf_core.c            |   2 +-
 drivers/net/bnxt/tf_ulp/bnxt_ulp.c            |   2 +-
 drivers/net/bnxt/tf_ulp/ulp_template_db_act.c |   5 +
 .../net/bnxt/tf_ulp/ulp_template_db_class.c   |   6 +
 22 files changed, 403 insertions(+), 276 deletions(-)

-- 
2.21.1 (Apple Git-122.3)


^ permalink raw reply	[flat|nested] 47+ messages in thread

* [dpdk-dev] [PATCH v2 01/17] net/bnxt: fix RX rings in RSS redirection table
  2020-12-09 19:22 [dpdk-dev] [PATCH v2 00/17] fixes and refactoring changes for bnxt Ajit Khaparde
@ 2020-12-09 19:22 ` Ajit Khaparde
  2020-12-09 19:22 ` [dpdk-dev] [PATCH v2 02/17] net/bnxt: fix VNIC config on Rx queue stop Ajit Khaparde
                   ` (16 subsequent siblings)
  17 siblings, 0 replies; 47+ messages in thread
From: Ajit Khaparde @ 2020-12-09 19:22 UTC (permalink / raw)
  To: dev; +Cc: Samik Gupta, stable

From: Samik Gupta <samik.gupta@broadcom.com>

This commit introduces a limit on the number of RX rings included in
the RSS redirection table to a value no larger than the size supported
by Thor as defined by BNXT_RSS_TBL_SIZE_THOR.

Fixes: d819382543f3 ("net/bnxt: add RSS redirection table operations")
Cc: stable@dpdk.org

Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
Signed-off-by: Samik Gupta <samik.gupta@broadcom.com>
---
 drivers/net/bnxt/bnxt.h        |  2 +-
 drivers/net/bnxt/bnxt_ethdev.c | 15 +++++++++++++--
 2 files changed, 14 insertions(+), 3 deletions(-)

diff --git a/drivers/net/bnxt/bnxt.h b/drivers/net/bnxt/bnxt.h
index 90ced972c..9bd4f1da9 100644
--- a/drivers/net/bnxt/bnxt.h
+++ b/drivers/net/bnxt/bnxt.h
@@ -389,7 +389,7 @@ struct bnxt_coal {
 #define DBR_TYPE_NQ				(0xaULL << 60)
 #define DBR_TYPE_NQ_ARM				(0xbULL << 60)
 
-#define BNXT_RSS_TBL_SIZE_THOR		512
+#define BNXT_RSS_TBL_SIZE_THOR		512U
 #define BNXT_RSS_ENTRIES_PER_CTX_THOR	64
 #define BNXT_MAX_RSS_CTXTS_THOR \
 	(BNXT_RSS_TBL_SIZE_THOR / BNXT_RSS_ENTRIES_PER_CTX_THOR)
diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c
index 81c8f8d79..c363c8427 100644
--- a/drivers/net/bnxt/bnxt_ethdev.c
+++ b/drivers/net/bnxt/bnxt_ethdev.c
@@ -207,12 +207,15 @@ int is_bnxt_in_error(struct bnxt *bp)
 
 static uint16_t bnxt_rss_ctxts(const struct bnxt *bp)
 {
+	unsigned int num_rss_rings = RTE_MIN(bp->rx_nr_rings,
+					     BNXT_RSS_TBL_SIZE_THOR);
+
 	if (!BNXT_CHIP_THOR(bp))
 		return 1;
 
-	return RTE_ALIGN_MUL_CEIL(bp->rx_nr_rings,
+	return RTE_ALIGN_MUL_CEIL(num_rss_rings,
 				  BNXT_RSS_ENTRIES_PER_CTX_THOR) /
-				    BNXT_RSS_ENTRIES_PER_CTX_THOR;
+				  BNXT_RSS_ENTRIES_PER_CTX_THOR;
 }
 
 uint16_t bnxt_rss_hash_tbl_size(const struct bnxt *bp)
@@ -424,6 +427,14 @@ static int bnxt_setup_one_vnic(struct bnxt *bp, uint16_t vnic_id)
 	if (dev_conf->rxmode.mq_mode & ETH_MQ_RX_RSS) {
 		int j, nr_ctxs = bnxt_rss_ctxts(bp);
 
+		if (bp->rx_nr_rings > BNXT_RSS_TBL_SIZE_THOR) {
+			PMD_DRV_LOG(ERR, "RxQ cnt %d > reta_size %d\n",
+				    bp->rx_nr_rings, BNXT_RSS_TBL_SIZE_THOR);
+			PMD_DRV_LOG(ERR,
+				    "Only queues 0-%d will be in RSS table\n",
+				    BNXT_RSS_TBL_SIZE_THOR - 1);
+		}
+
 		rc = 0;
 		for (j = 0; j < nr_ctxs; j++) {
 			rc = bnxt_hwrm_vnic_ctx_alloc(bp, vnic, j);
-- 
2.21.1 (Apple Git-122.3)


^ permalink raw reply	[flat|nested] 47+ messages in thread

* [dpdk-dev] [PATCH v2 02/17] net/bnxt: fix VNIC config on Rx queue stop
  2020-12-09 19:22 [dpdk-dev] [PATCH v2 00/17] fixes and refactoring changes for bnxt Ajit Khaparde
  2020-12-09 19:22 ` [dpdk-dev] [PATCH v2 01/17] net/bnxt: fix RX rings in RSS redirection table Ajit Khaparde
@ 2020-12-09 19:22 ` Ajit Khaparde
  2020-12-09 19:22 ` [dpdk-dev] [PATCH v2 03/17] net/bnxt: remove unused field Ajit Khaparde
                   ` (15 subsequent siblings)
  17 siblings, 0 replies; 47+ messages in thread
From: Ajit Khaparde @ 2020-12-09 19:22 UTC (permalink / raw)
  To: dev; +Cc: Samik Gupta, stable, Lance Richardson, Somnath Kotur

From: Samik Gupta <samik.gupta@broadcom.com>

This commit reconfigures a vnic's default ring if the current default
ring is stopped by the application. It picks the lowest numbered ring
that is currently active to be the new default, and issues the
hwrm_vnic_cfg command to update the configuration. Applies to adapters
that are not Thor-based.

Fixes: 9b63c6fd70e3 ("net/bnxt: support Rx/Tx queue start/stop")
Cc: stable@dpdk.org

Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
Reviewed-by: Lance Richardson <lance.richardson@broadcom.com>
Reviewed-by: Somnath Kotur <somnath.kotur@broadcom.com>

Signed-off-by: Samik Gupta <samik.gupta@broadcom.com>
---
 drivers/net/bnxt/bnxt_rxq.c | 26 +++++++++++++++++++++-----
 1 file changed, 21 insertions(+), 5 deletions(-)

diff --git a/drivers/net/bnxt/bnxt_rxq.c b/drivers/net/bnxt/bnxt_rxq.c
index e0ec34216..61196eba9 100644
--- a/drivers/net/bnxt/bnxt_rxq.c
+++ b/drivers/net/bnxt/bnxt_rxq.c
@@ -557,12 +557,12 @@ int bnxt_rx_queue_stop(struct rte_eth_dev *dev, uint16_t rx_queue_id)
 		rc = bnxt_vnic_rss_configure(bp, vnic);
 	}
 
-	if (BNXT_CHIP_THOR(bp)) {
-		/* Compute current number of active receive queues. */
-		for (i = vnic->start_grp_id; i < vnic->end_grp_id; i++)
-			if (bp->rx_queues[i]->rx_started)
-				active_queue_cnt++;
+	/* Compute current number of active receive queues. */
+	for (i = vnic->start_grp_id; i < vnic->end_grp_id; i++)
+		if (bp->rx_queues[i]->rx_started)
+			active_queue_cnt++;
 
+	if (BNXT_CHIP_THOR(bp)) {
 		/*
 		 * For Thor, we need to ensure that the VNIC default receive
 		 * ring corresponds to an active receive queue. When no queue
@@ -582,6 +582,22 @@ int bnxt_rx_queue_stop(struct rte_eth_dev *dev, uint16_t rx_queue_id)
 			/* Reconfigure default receive ring. */
 			bnxt_hwrm_vnic_cfg(bp, vnic);
 		}
+	} else if (active_queue_cnt) {
+		/*
+		 * If the queue being stopped is the current default queue and
+		 * there are other active queues, pick one of them as the
+		 * default and reconfigure the vnic.
+		 */
+		if (vnic->dflt_ring_grp == bp->grp_info[rx_queue_id].fw_grp_id) {
+			for (i = vnic->start_grp_id; i < vnic->end_grp_id; i++) {
+				if (bp->rx_queues[i]->rx_started) {
+					vnic->dflt_ring_grp =
+						bp->grp_info[i].fw_grp_id;
+					bnxt_hwrm_vnic_cfg(bp, vnic);
+					break;
+				}
+			}
+		}
 	}
 
 	if (rc == 0)
-- 
2.21.1 (Apple Git-122.3)


^ permalink raw reply	[flat|nested] 47+ messages in thread

* [dpdk-dev] [PATCH v2 03/17] net/bnxt: remove unused field
  2020-12-09 19:22 [dpdk-dev] [PATCH v2 00/17] fixes and refactoring changes for bnxt Ajit Khaparde
  2020-12-09 19:22 ` [dpdk-dev] [PATCH v2 01/17] net/bnxt: fix RX rings in RSS redirection table Ajit Khaparde
  2020-12-09 19:22 ` [dpdk-dev] [PATCH v2 02/17] net/bnxt: fix VNIC config on Rx queue stop Ajit Khaparde
@ 2020-12-09 19:22 ` Ajit Khaparde
  2020-12-09 19:22 ` [dpdk-dev] [PATCH v2 04/17] net/bnxt: release hwrm lock in the error case Ajit Khaparde
                   ` (14 subsequent siblings)
  17 siblings, 0 replies; 47+ messages in thread
From: Ajit Khaparde @ 2020-12-09 19:22 UTC (permalink / raw)
  To: dev

Remove flow_xstat from bnxt structure.

Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
---
 drivers/net/bnxt/bnxt.h | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/net/bnxt/bnxt.h b/drivers/net/bnxt/bnxt.h
index 9bd4f1da9..f13d586d4 100644
--- a/drivers/net/bnxt/bnxt.h
+++ b/drivers/net/bnxt/bnxt.h
@@ -818,7 +818,6 @@ struct bnxt {
 	struct bnxt_dmabuf_info dmabuf;
 	struct bnxt_ulp_context	*ulp_ctx;
 	struct bnxt_flow_stat_info *flow_stat;
-	uint8_t			flow_xstat;
 	uint16_t		max_num_kflows;
 	uint16_t		tx_cfa_action;
 };
-- 
2.21.1 (Apple Git-122.3)


^ permalink raw reply	[flat|nested] 47+ messages in thread

* [dpdk-dev] [PATCH v2 04/17] net/bnxt: release hwrm lock in the error case
  2020-12-09 19:22 [dpdk-dev] [PATCH v2 00/17] fixes and refactoring changes for bnxt Ajit Khaparde
                   ` (2 preceding siblings ...)
  2020-12-09 19:22 ` [dpdk-dev] [PATCH v2 03/17] net/bnxt: remove unused field Ajit Khaparde
@ 2020-12-09 19:22 ` Ajit Khaparde
  2020-12-09 19:22 ` [dpdk-dev] [PATCH v2 05/17] net/bnxt: remove references to Thor Ajit Khaparde
                   ` (13 subsequent siblings)
  17 siblings, 0 replies; 47+ messages in thread
From: Ajit Khaparde @ 2020-12-09 19:22 UTC (permalink / raw)
  To: dev; +Cc: Kalesh AP, stable, Somnath Kotur

From: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>

In __bnxt_hwrm_func_qcaps, when memory allocations fails
driver is not releasing the hwrm lock. This patch fixes it
by calling hwrm_unlock in that error case.

Fixes: b7778e8a1c00 ("net/bnxt: refactor to properly allocate resources for PF/VF")
Cc: stable@dpdk.org

Signed-off-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
Reviewed-by: Somnath Kotur <somnath.kotur@broadcom.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
---
 drivers/net/bnxt/bnxt_hwrm.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/net/bnxt/bnxt_hwrm.c b/drivers/net/bnxt/bnxt_hwrm.c
index ebbf504c0..784e9778a 100644
--- a/drivers/net/bnxt/bnxt_hwrm.c
+++ b/drivers/net/bnxt/bnxt_hwrm.c
@@ -718,6 +718,7 @@ static int __bnxt_hwrm_func_qcaps(struct bnxt *bp)
 			    sizeof(bp->pf->vf_info[0]) * new_max_vfs, 0);
 			if (bp->pf->vf_info == NULL) {
 				PMD_DRV_LOG(ERR, "Alloc vf info fail\n");
+				HWRM_UNLOCK();
 				return -ENOMEM;
 			}
 			bp->pf->max_vfs = new_max_vfs;
-- 
2.21.1 (Apple Git-122.3)


^ permalink raw reply	[flat|nested] 47+ messages in thread

* [dpdk-dev] [PATCH v2 05/17] net/bnxt: remove references to Thor
  2020-12-09 19:22 [dpdk-dev] [PATCH v2 00/17] fixes and refactoring changes for bnxt Ajit Khaparde
                   ` (3 preceding siblings ...)
  2020-12-09 19:22 ` [dpdk-dev] [PATCH v2 04/17] net/bnxt: release hwrm lock in the error case Ajit Khaparde
@ 2020-12-09 19:22 ` Ajit Khaparde
  2020-12-09 19:22 ` [dpdk-dev] [PATCH v2 06/17] net/bnxt: fix to return error when fw command fails Ajit Khaparde
                   ` (12 subsequent siblings)
  17 siblings, 0 replies; 47+ messages in thread
From: Ajit Khaparde @ 2020-12-09 19:22 UTC (permalink / raw)
  To: dev

Refactor code to remove references to Thor.
Instead use P5 as in phase 5 of development cycle since it is applicable
to boards other than Thor as well.

Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
---
 drivers/net/bnxt/bnxt.h            | 20 +++++++-------
 drivers/net/bnxt/bnxt_ethdev.c     | 43 +++++++++++++++--------------
 drivers/net/bnxt/bnxt_hwrm.c       | 44 +++++++++++++++---------------
 drivers/net/bnxt/bnxt_ring.c       |  8 +++---
 drivers/net/bnxt/bnxt_rxq.c        |  4 +--
 drivers/net/bnxt/bnxt_rxr.c        | 12 ++++----
 drivers/net/bnxt/bnxt_rxr.h        |  2 +-
 drivers/net/bnxt/bnxt_vnic.c       |  4 +--
 drivers/net/bnxt/tf_ulp/bnxt_ulp.c |  2 +-
 9 files changed, 70 insertions(+), 69 deletions(-)

diff --git a/drivers/net/bnxt/bnxt.h b/drivers/net/bnxt/bnxt.h
index f13d586d4..9c1c87489 100644
--- a/drivers/net/bnxt/bnxt.h
+++ b/drivers/net/bnxt/bnxt.h
@@ -112,11 +112,11 @@
 #define TPA_MAX_SEGS		5 /* 32 segments in log2 units */
 
 #define BNXT_TPA_MAX_AGGS(bp) \
-	(BNXT_CHIP_THOR(bp) ? TPA_MAX_AGGS_TH : \
+	(BNXT_CHIP_P5(bp) ? TPA_MAX_AGGS_TH : \
 			     TPA_MAX_AGGS)
 
 #define BNXT_TPA_MAX_SEGS(bp) \
-	(BNXT_CHIP_THOR(bp) ? TPA_MAX_SEGS_TH : \
+	(BNXT_CHIP_P5(bp) ? TPA_MAX_SEGS_TH : \
 			      TPA_MAX_SEGS)
 
 /*
@@ -389,10 +389,10 @@ struct bnxt_coal {
 #define DBR_TYPE_NQ				(0xaULL << 60)
 #define DBR_TYPE_NQ_ARM				(0xbULL << 60)
 
-#define BNXT_RSS_TBL_SIZE_THOR		512U
-#define BNXT_RSS_ENTRIES_PER_CTX_THOR	64
-#define BNXT_MAX_RSS_CTXTS_THOR \
-	(BNXT_RSS_TBL_SIZE_THOR / BNXT_RSS_ENTRIES_PER_CTX_THOR)
+#define BNXT_RSS_TBL_SIZE_P5		512U
+#define BNXT_RSS_ENTRIES_PER_CTX_P5	64
+#define BNXT_MAX_RSS_CTXTS_P5 \
+	(BNXT_RSS_TBL_SIZE_P5 / BNXT_RSS_ENTRIES_PER_CTX_P5)
 
 #define BNXT_MAX_TC    8
 #define BNXT_MAX_QUEUE 8
@@ -629,7 +629,7 @@ struct bnxt {
 #define BNXT_FLAG_KONG_MB_EN		BIT(10)
 #define BNXT_FLAG_TRUSTED_VF_EN		BIT(11)
 #define BNXT_FLAG_DFLT_VNIC_SET		BIT(12)
-#define BNXT_FLAG_THOR_CHIP		BIT(13)
+#define BNXT_FLAG_CHIP_P5		BIT(13)
 #define BNXT_FLAG_STINGRAY		BIT(14)
 #define BNXT_FLAG_FW_RESET		BIT(15)
 #define BNXT_FLAG_FATAL_ERROR		BIT(16)
@@ -653,10 +653,10 @@ struct bnxt {
 #define BNXT_USE_CHIMP_MB	0 //For non-CFA commands, everything uses Chimp.
 #define BNXT_USE_KONG(bp)	((bp)->flags & BNXT_FLAG_KONG_MB_EN)
 #define BNXT_VF_IS_TRUSTED(bp)	((bp)->flags & BNXT_FLAG_TRUSTED_VF_EN)
-#define BNXT_CHIP_THOR(bp)	((bp)->flags & BNXT_FLAG_THOR_CHIP)
+#define BNXT_CHIP_P5(bp)	((bp)->flags & BNXT_FLAG_CHIP_P5)
 #define BNXT_STINGRAY(bp)	((bp)->flags & BNXT_FLAG_STINGRAY)
-#define BNXT_HAS_NQ(bp)		BNXT_CHIP_THOR(bp)
-#define BNXT_HAS_RING_GRPS(bp)	(!BNXT_CHIP_THOR(bp))
+#define BNXT_HAS_NQ(bp)		BNXT_CHIP_P5(bp)
+#define BNXT_HAS_RING_GRPS(bp)	(!BNXT_CHIP_P5(bp))
 #define BNXT_FLOW_XSTATS_EN(bp)	((bp)->flags & BNXT_FLAG_FLOW_XSTATS_EN)
 #define BNXT_HAS_DFLT_MAC_SET(bp)      ((bp)->flags & BNXT_FLAG_DFLT_MAC_SET)
 #define BNXT_TRUFLOW_EN(bp)	((bp)->flags & BNXT_FLAG_TRUFLOW_EN)
diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c
index c363c8427..8047b0b5d 100644
--- a/drivers/net/bnxt/bnxt_ethdev.c
+++ b/drivers/net/bnxt/bnxt_ethdev.c
@@ -208,22 +208,22 @@ int is_bnxt_in_error(struct bnxt *bp)
 static uint16_t bnxt_rss_ctxts(const struct bnxt *bp)
 {
 	unsigned int num_rss_rings = RTE_MIN(bp->rx_nr_rings,
-					     BNXT_RSS_TBL_SIZE_THOR);
+					     BNXT_RSS_TBL_SIZE_P5);
 
-	if (!BNXT_CHIP_THOR(bp))
+	if (!BNXT_CHIP_P5(bp))
 		return 1;
 
 	return RTE_ALIGN_MUL_CEIL(num_rss_rings,
-				  BNXT_RSS_ENTRIES_PER_CTX_THOR) /
-				  BNXT_RSS_ENTRIES_PER_CTX_THOR;
+				  BNXT_RSS_ENTRIES_PER_CTX_P5) /
+				  BNXT_RSS_ENTRIES_PER_CTX_P5;
 }
 
 uint16_t bnxt_rss_hash_tbl_size(const struct bnxt *bp)
 {
-	if (!BNXT_CHIP_THOR(bp))
+	if (!BNXT_CHIP_P5(bp))
 		return HW_HASH_INDEX_SIZE;
 
-	return bnxt_rss_ctxts(bp) * BNXT_RSS_ENTRIES_PER_CTX_THOR;
+	return bnxt_rss_ctxts(bp) * BNXT_RSS_ENTRIES_PER_CTX_P5;
 }
 
 static void bnxt_free_parent_info(struct bnxt *bp)
@@ -427,12 +427,12 @@ static int bnxt_setup_one_vnic(struct bnxt *bp, uint16_t vnic_id)
 	if (dev_conf->rxmode.mq_mode & ETH_MQ_RX_RSS) {
 		int j, nr_ctxs = bnxt_rss_ctxts(bp);
 
-		if (bp->rx_nr_rings > BNXT_RSS_TBL_SIZE_THOR) {
+		if (bp->rx_nr_rings > BNXT_RSS_TBL_SIZE_P5) {
 			PMD_DRV_LOG(ERR, "RxQ cnt %d > reta_size %d\n",
-				    bp->rx_nr_rings, BNXT_RSS_TBL_SIZE_THOR);
+				    bp->rx_nr_rings, BNXT_RSS_TBL_SIZE_P5);
 			PMD_DRV_LOG(ERR,
 				    "Only queues 0-%d will be in RSS table\n",
-				    BNXT_RSS_TBL_SIZE_THOR - 1);
+				    BNXT_RSS_TBL_SIZE_P5 - 1);
 		}
 
 		rc = 0;
@@ -712,8 +712,8 @@ static int bnxt_init_chip(struct bnxt *bp)
 	/* THOR does not support ring groups.
 	 * But we will use the array to save RSS context IDs.
 	 */
-	if (BNXT_CHIP_THOR(bp))
-		bp->max_ring_grps = BNXT_MAX_RSS_CTXTS_THOR;
+	if (BNXT_CHIP_P5(bp))
+		bp->max_ring_grps = BNXT_MAX_RSS_CTXTS_P5;
 
 	rc = bnxt_alloc_all_hwrm_stat_ctxs(bp);
 	if (rc) {
@@ -1832,7 +1832,7 @@ static int bnxt_reta_update_op(struct rte_eth_dev *eth_dev,
 			return -EINVAL;
 		}
 
-		if (BNXT_CHIP_THOR(bp)) {
+		if (BNXT_CHIP_P5(bp)) {
 			vnic->rss_table[i * 2] =
 				rxq->rx_ring->rx_ring_struct->fw_ring_id;
 			vnic->rss_table[i * 2 + 1] =
@@ -1881,7 +1881,7 @@ static int bnxt_reta_query_op(struct rte_eth_dev *eth_dev,
 		if (reta_conf[idx].mask & (1ULL << sft)) {
 			uint16_t qid;
 
-			if (BNXT_CHIP_THOR(bp))
+			if (BNXT_CHIP_P5(bp))
 				qid = bnxt_rss_to_qid(bp,
 						      vnic->rss_table[i * 2]);
 			else
@@ -3232,7 +3232,7 @@ bnxt_timesync_read_time(struct rte_eth_dev *dev, struct timespec *ts)
 	if (!ptp)
 		return 0;
 
-	if (BNXT_CHIP_THOR(bp))
+	if (BNXT_CHIP_P5(bp))
 		rc = bnxt_hwrm_port_ts_query(bp, BNXT_PTP_FLAGS_CURRENT_TIME,
 					     &systime_cycles);
 	else
@@ -3278,7 +3278,7 @@ bnxt_timesync_enable(struct rte_eth_dev *dev)
 	ptp->tx_tstamp_tc.cc_shift = shift;
 	ptp->tx_tstamp_tc.nsec_mask = (1ULL << shift) - 1;
 
-	if (!BNXT_CHIP_THOR(bp))
+	if (!BNXT_CHIP_P5(bp))
 		bnxt_map_ptp_regs(bp);
 
 	return 0;
@@ -3299,7 +3299,7 @@ bnxt_timesync_disable(struct rte_eth_dev *dev)
 
 	bnxt_hwrm_ptp_cfg(bp);
 
-	if (!BNXT_CHIP_THOR(bp))
+	if (!BNXT_CHIP_P5(bp))
 		bnxt_unmap_ptp_regs(bp);
 
 	return 0;
@@ -3318,7 +3318,7 @@ bnxt_timesync_read_rx_timestamp(struct rte_eth_dev *dev,
 	if (!ptp)
 		return 0;
 
-	if (BNXT_CHIP_THOR(bp))
+	if (BNXT_CHIP_P5(bp))
 		rx_tstamp_cycles = ptp->rx_timestamp;
 	else
 		bnxt_get_rx_ts(bp, &rx_tstamp_cycles);
@@ -3341,7 +3341,7 @@ bnxt_timesync_read_tx_timestamp(struct rte_eth_dev *dev,
 	if (!ptp)
 		return 0;
 
-	if (BNXT_CHIP_THOR(bp))
+	if (BNXT_CHIP_P5(bp))
 		rc = bnxt_hwrm_port_ts_query(bp, BNXT_PTP_FLAGS_PATH_TX,
 					     &tx_tstamp_cycles);
 	else
@@ -4007,7 +4007,8 @@ static bool bnxt_vf_pciid(uint16_t device_id)
 	}
 }
 
-static bool bnxt_thor_device(uint16_t device_id)
+/* Phase 5 device */
+static bool bnxt_p5_device(uint16_t device_id)
 {
 	switch (device_id) {
 	case BROADCOM_DEV_ID_57508:
@@ -5240,8 +5241,8 @@ bnxt_dev_init(struct rte_eth_dev *eth_dev, void *params __rte_unused)
 	if (bnxt_vf_pciid(pci_dev->id.device_id))
 		bp->flags |= BNXT_FLAG_VF;
 
-	if (bnxt_thor_device(pci_dev->id.device_id))
-		bp->flags |= BNXT_FLAG_THOR_CHIP;
+	if (bnxt_p5_device(pci_dev->id.device_id))
+		bp->flags |= BNXT_FLAG_CHIP_P5;
 
 	if (pci_dev->id.device_id == BROADCOM_DEV_ID_58802 ||
 	    pci_dev->id.device_id == BROADCOM_DEV_ID_58804 ||
diff --git a/drivers/net/bnxt/bnxt_hwrm.c b/drivers/net/bnxt/bnxt_hwrm.c
index 784e9778a..6f5402070 100644
--- a/drivers/net/bnxt/bnxt_hwrm.c
+++ b/drivers/net/bnxt/bnxt_hwrm.c
@@ -635,7 +635,7 @@ static int bnxt_hwrm_ptp_qcfg(struct bnxt *bp)
 
 	HWRM_CHECK_RESULT();
 
-	if (!BNXT_CHIP_THOR(bp) &&
+	if (!BNXT_CHIP_P5(bp) &&
 	    !(resp->flags & HWRM_PORT_MAC_PTP_QCFG_OUTPUT_FLAGS_DIRECT_ACCESS))
 		return 0;
 
@@ -646,7 +646,7 @@ static int bnxt_hwrm_ptp_qcfg(struct bnxt *bp)
 	if (!ptp)
 		return -ENOMEM;
 
-	if (!BNXT_CHIP_THOR(bp)) {
+	if (!BNXT_CHIP_P5(bp)) {
 		ptp->rx_regs[BNXT_PTP_RX_TS_L] =
 			rte_le_to_cpu_32(resp->rx_ts_reg_off_lower);
 		ptp->rx_regs[BNXT_PTP_RX_TS_H] =
@@ -766,7 +766,7 @@ static int __bnxt_hwrm_func_qcaps(struct bnxt *bp)
 	bp->first_vf_id = rte_le_to_cpu_16(resp->first_vf_id);
 	bp->max_rx_em_flows = rte_le_to_cpu_16(resp->max_rx_em_flows);
 	bp->max_l2_ctx = rte_le_to_cpu_16(resp->max_l2_ctxs);
-	if (!BNXT_CHIP_THOR(bp) && !bp->pdev->max_vfs)
+	if (!BNXT_CHIP_P5(bp) && !bp->pdev->max_vfs)
 		bp->max_l2_ctx += bp->max_rx_em_flows;
 	/* TODO: For now, do not support VMDq/RFS on VFs. */
 	if (BNXT_PF(bp)) {
@@ -1056,7 +1056,7 @@ int bnxt_hwrm_func_resc_qcaps(struct bnxt *bp)
 	 * So use the value provided by func_qcaps.
 	 */
 	bp->max_l2_ctx = rte_le_to_cpu_16(resp->max_l2_ctxs);
-	if (!BNXT_CHIP_THOR(bp) && !bp->pdev->max_vfs)
+	if (!BNXT_CHIP_P5(bp) && !bp->pdev->max_vfs)
 		bp->max_l2_ctx += bp->max_rx_em_flows;
 	bp->max_vnics = rte_le_to_cpu_16(resp->max_vnics);
 	bp->max_stat_ctx = rte_le_to_cpu_16(resp->max_stat_ctx);
@@ -1557,7 +1557,7 @@ int bnxt_hwrm_ring_alloc(struct bnxt *bp,
 		req.ring_type = ring_type;
 		req.cmpl_ring_id = rte_cpu_to_le_16(cmpl_ring_id);
 		req.stat_ctx_id = rte_cpu_to_le_32(stats_ctx_id);
-		if (BNXT_CHIP_THOR(bp)) {
+		if (BNXT_CHIP_P5(bp)) {
 			mb_pool = bp->rx_queues[0]->mb_pool;
 			rx_buf_size = rte_pktmbuf_data_room_size(mb_pool) -
 				      RTE_PKTMBUF_HEADROOM;
@@ -1927,7 +1927,7 @@ int bnxt_hwrm_vnic_cfg(struct bnxt *bp, struct bnxt_vnic_info *vnic)
 
 	HWRM_PREP(&req, HWRM_VNIC_CFG, BNXT_USE_CHIMP_MB);
 
-	if (BNXT_CHIP_THOR(bp)) {
+	if (BNXT_CHIP_P5(bp)) {
 		int dflt_rxq = vnic->start_grp_id;
 		struct bnxt_rx_ring_info *rxr;
 		struct bnxt_cp_ring_info *cpr;
@@ -2117,7 +2117,7 @@ int bnxt_hwrm_vnic_ctx_free(struct bnxt *bp, struct bnxt_vnic_info *vnic)
 {
 	int rc = 0;
 
-	if (BNXT_CHIP_THOR(bp)) {
+	if (BNXT_CHIP_P5(bp)) {
 		int j;
 
 		for (j = 0; j < vnic->num_lb_ctxts; j++) {
@@ -2164,7 +2164,7 @@ int bnxt_hwrm_vnic_free(struct bnxt *bp, struct bnxt_vnic_info *vnic)
 }
 
 static int
-bnxt_hwrm_vnic_rss_cfg_thor(struct bnxt *bp, struct bnxt_vnic_info *vnic)
+bnxt_hwrm_vnic_rss_cfg_p5(struct bnxt *bp, struct bnxt_vnic_info *vnic)
 {
 	int i;
 	int rc = 0;
@@ -2208,8 +2208,8 @@ int bnxt_hwrm_vnic_rss_cfg(struct bnxt *bp,
 	if (!vnic->rss_table)
 		return 0;
 
-	if (BNXT_CHIP_THOR(bp))
-		return bnxt_hwrm_vnic_rss_cfg_thor(bp, vnic);
+	if (BNXT_CHIP_P5(bp))
+		return bnxt_hwrm_vnic_rss_cfg_p5(bp, vnic);
 
 	HWRM_PREP(&req, HWRM_VNIC_RSS_CFG, BNXT_USE_CHIMP_MB);
 
@@ -2274,7 +2274,7 @@ int bnxt_hwrm_vnic_tpa_cfg(struct bnxt *bp,
 	struct hwrm_vnic_tpa_cfg_input req = {.req_type = 0 };
 	struct hwrm_vnic_tpa_cfg_output *resp = bp->hwrm_cmd_resp_addr;
 
-	if (BNXT_CHIP_THOR(bp) && !bp->max_tpa_v2) {
+	if (BNXT_CHIP_P5(bp) && !bp->max_tpa_v2) {
 		if (enable)
 			PMD_DRV_LOG(ERR, "No HW support for LRO\n");
 		return -ENOTSUP;
@@ -2566,7 +2566,7 @@ void bnxt_free_hwrm_rx_ring(struct bnxt *bp, int queue_index)
 	ring = rxr->ag_ring_struct;
 	if (ring->fw_ring_id != INVALID_HW_RING_ID) {
 		bnxt_hwrm_ring_free(bp, ring,
-				    BNXT_CHIP_THOR(bp) ?
+				    BNXT_CHIP_P5(bp) ?
 				    HWRM_RING_FREE_INPUT_RING_TYPE_RX_AGG :
 				    HWRM_RING_FREE_INPUT_RING_TYPE_RX);
 		if (BNXT_HAS_RING_GRPS(bp))
@@ -3068,7 +3068,7 @@ int bnxt_set_hwrm_link_config(struct bnxt *bp, bool link_up)
 		goto port_phy_cfg;
 
 	autoneg = bnxt_check_eth_link_autoneg(dev_conf->link_speeds);
-	if (BNXT_CHIP_THOR(bp) &&
+	if (BNXT_CHIP_P5(bp) &&
 	    dev_conf->link_speeds == ETH_LINK_SPEED_40G) {
 		/* 40G is not supported as part of media auto detect.
 		 * The speed should be forced and autoneg disabled
@@ -3093,7 +3093,7 @@ int bnxt_set_hwrm_link_config(struct bnxt *bp, bool link_up)
 	 * to 40G until link comes up at new speed.
 	 */
 	if (autoneg == 1 &&
-	    !(!BNXT_CHIP_THOR(bp) &&
+	    !(!BNXT_CHIP_P5(bp) &&
 	      (bp->link_info->auto_link_speed ||
 	       bp->link_info->force_link_speed))) {
 		link_req.phy_flags |=
@@ -4820,7 +4820,7 @@ int bnxt_hwrm_clear_ntuple_filter(struct bnxt *bp,
 }
 
 static int
-bnxt_vnic_rss_configure_thor(struct bnxt *bp, struct bnxt_vnic_info *vnic)
+bnxt_vnic_rss_configure_p5(struct bnxt *bp, struct bnxt_vnic_info *vnic)
 {
 	struct hwrm_vnic_rss_cfg_output *resp = bp->hwrm_cmd_resp_addr;
 	uint8_t *rx_queue_state = bp->eth_dev->data->rx_queue_state;
@@ -4844,7 +4844,7 @@ bnxt_vnic_rss_configure_thor(struct bnxt *bp, struct bnxt_vnic_info *vnic)
 
 		req.ring_grp_tbl_addr =
 		    rte_cpu_to_le_64(vnic->rss_table_dma_addr +
-				     i * BNXT_RSS_ENTRIES_PER_CTX_THOR *
+				     i * BNXT_RSS_ENTRIES_PER_CTX_P5 *
 				     2 * sizeof(*ring_tbl));
 		req.hash_key_tbl_addr =
 		    rte_cpu_to_le_64(vnic->rss_hash_key_dma_addr);
@@ -4899,8 +4899,8 @@ int bnxt_vnic_rss_configure(struct bnxt *bp, struct bnxt_vnic_info *vnic)
 	if (!(vnic->rss_table && vnic->hash_type))
 		return 0;
 
-	if (BNXT_CHIP_THOR(bp))
-		return bnxt_vnic_rss_configure_thor(bp, vnic);
+	if (BNXT_CHIP_P5(bp))
+		return bnxt_vnic_rss_configure_p5(bp, vnic);
 
 	if (vnic->fw_vnic_id == INVALID_HW_RING_ID)
 		return 0;
@@ -4959,7 +4959,7 @@ static void bnxt_hwrm_set_coal_params(struct bnxt_coal *hw_coal,
 	req->flags = rte_cpu_to_le_16(flags);
 }
 
-static int bnxt_hwrm_set_coal_params_thor(struct bnxt *bp,
+static int bnxt_hwrm_set_coal_params_p5(struct bnxt *bp,
 		struct hwrm_ring_cmpl_ring_cfg_aggint_params_input *agg_req)
 {
 	struct hwrm_ring_aggint_qcaps_input req = {0};
@@ -4996,8 +4996,8 @@ int bnxt_hwrm_set_ring_coal(struct bnxt *bp,
 	int rc;
 
 	/* Set ring coalesce parameters only for 100G NICs */
-	if (BNXT_CHIP_THOR(bp)) {
-		if (bnxt_hwrm_set_coal_params_thor(bp, &req))
+	if (BNXT_CHIP_P5(bp)) {
+		if (bnxt_hwrm_set_coal_params_p5(bp, &req))
 			return -1;
 	} else if (bnxt_stratus_device(bp)) {
 		bnxt_hwrm_set_coal_params(coal, &req);
@@ -5026,7 +5026,7 @@ int bnxt_hwrm_func_backing_store_qcaps(struct bnxt *bp)
 	int total_alloc_len;
 	int rc, i, tqm_rings;
 
-	if (!BNXT_CHIP_THOR(bp) ||
+	if (!BNXT_CHIP_P5(bp) ||
 	    bp->hwrm_spec_code < HWRM_VERSION_1_9_2 ||
 	    BNXT_VF(bp) ||
 	    bp->ctx)
diff --git a/drivers/net/bnxt/bnxt_ring.c b/drivers/net/bnxt/bnxt_ring.c
index aeb6cb615..579c48d8c 100644
--- a/drivers/net/bnxt/bnxt_ring.c
+++ b/drivers/net/bnxt/bnxt_ring.c
@@ -57,8 +57,8 @@ int bnxt_alloc_ring_grps(struct bnxt *bp)
 	/* THOR does not support ring groups.
 	 * But we will use the array to save RSS context IDs.
 	 */
-	if (BNXT_CHIP_THOR(bp)) {
-		bp->max_ring_grps = BNXT_MAX_RSS_CTXTS_THOR;
+	if (BNXT_CHIP_P5(bp)) {
+		bp->max_ring_grps = BNXT_MAX_RSS_CTXTS_P5;
 	} else if (bp->max_ring_grps < bp->rx_cp_nr_rings) {
 		/* 1 ring is for default completion ring */
 		PMD_DRV_LOG(ERR, "Insufficient resource: Ring Group\n");
@@ -344,7 +344,7 @@ static void bnxt_set_db(struct bnxt *bp,
 			uint32_t map_idx,
 			uint32_t fid)
 {
-	if (BNXT_CHIP_THOR(bp)) {
+	if (BNXT_CHIP_P5(bp)) {
 		if (BNXT_PF(bp))
 			db->doorbell = (char *)bp->doorbell_base + 0x10000;
 		else
@@ -538,7 +538,7 @@ static int bnxt_alloc_rx_agg_ring(struct bnxt *bp, int queue_index)
 
 	ring->fw_rx_ring_id = rxr->rx_ring_struct->fw_ring_id;
 
-	if (BNXT_CHIP_THOR(bp)) {
+	if (BNXT_CHIP_P5(bp)) {
 		ring_type = HWRM_RING_ALLOC_INPUT_RING_TYPE_RX_AGG;
 		hw_stats_ctx_id = cpr->hw_stats_ctx_id;
 	} else {
diff --git a/drivers/net/bnxt/bnxt_rxq.c b/drivers/net/bnxt/bnxt_rxq.c
index 61196eba9..328cc994d 100644
--- a/drivers/net/bnxt/bnxt_rxq.c
+++ b/drivers/net/bnxt/bnxt_rxq.c
@@ -472,7 +472,7 @@ int bnxt_rx_queue_start(struct rte_eth_dev *dev, uint16_t rx_queue_id)
 	if (rc)
 		return rc;
 
-	if (BNXT_CHIP_THOR(bp)) {
+	if (BNXT_CHIP_P5(bp)) {
 		/* Reconfigure default receive ring and MRU. */
 		bnxt_hwrm_vnic_cfg(bp, rxq->vnic);
 	}
@@ -562,7 +562,7 @@ int bnxt_rx_queue_stop(struct rte_eth_dev *dev, uint16_t rx_queue_id)
 		if (bp->rx_queues[i]->rx_started)
 			active_queue_cnt++;
 
-	if (BNXT_CHIP_THOR(bp)) {
+	if (BNXT_CHIP_P5(bp)) {
 		/*
 		 * For Thor, we need to ensure that the VNIC default receive
 		 * ring corresponds to an active receive queue. When no queue
diff --git a/drivers/net/bnxt/bnxt_rxr.c b/drivers/net/bnxt/bnxt_rxr.c
index af1774844..e9c4fffed 100644
--- a/drivers/net/bnxt/bnxt_rxr.c
+++ b/drivers/net/bnxt/bnxt_rxr.c
@@ -225,13 +225,13 @@ static int bnxt_rx_pages(struct bnxt_rx_queue *rxq,
 	uint16_t cp_cons, ag_cons;
 	struct rx_pkt_cmpl *rxcmp;
 	struct rte_mbuf *last = mbuf;
-	bool is_thor_tpa = tpa_info && BNXT_CHIP_THOR(rxq->bp);
+	bool is_p5_tpa = tpa_info && BNXT_CHIP_P5(rxq->bp);
 
 	for (i = 0; i < agg_buf; i++) {
 		struct rte_mbuf **ag_buf;
 		struct rte_mbuf *ag_mbuf;
 
-		if (is_thor_tpa) {
+		if (is_p5_tpa) {
 			rxcmp = (void *)&tpa_info->agg_arr[i];
 		} else {
 			*tmp_raw_cons = NEXT_RAW_CMP(*tmp_raw_cons);
@@ -285,7 +285,7 @@ static inline struct rte_mbuf *bnxt_tpa_end(
 	uint8_t payload_offset;
 	struct bnxt_tpa_info *tpa_info;
 
-	if (BNXT_CHIP_THOR(rxq->bp)) {
+	if (BNXT_CHIP_P5(rxq->bp)) {
 		struct rx_tpa_v2_end_cmpl *th_tpa_end;
 		struct rx_tpa_v2_end_cmpl_hi *th_tpa_end1;
 
@@ -497,11 +497,11 @@ bnxt_set_ol_flags(struct rx_pkt_cmpl *rxcmp, struct rx_pkt_cmpl_hi *rxcmp1,
 
 #ifdef RTE_LIBRTE_IEEE1588
 static void
-bnxt_get_rx_ts_thor(struct bnxt *bp, uint32_t rx_ts_cmpl)
+bnxt_get_rx_ts_p5(struct bnxt *bp, uint32_t rx_ts_cmpl)
 {
 	uint64_t systime_cycles = 0;
 
-	if (!BNXT_CHIP_THOR(bp))
+	if (!BNXT_CHIP_P5(bp))
 		return;
 
 	/* On Thor, Rx timestamps are provided directly in the
@@ -747,7 +747,7 @@ static int bnxt_rx_pkt(struct rte_mbuf **rx_pkt,
 		      RX_PKT_CMPL_FLAGS_MASK) ==
 		      RX_PKT_CMPL_FLAGS_ITYPE_PTP_W_TIMESTAMP)) {
 		mbuf->ol_flags |= PKT_RX_IEEE1588_PTP | PKT_RX_IEEE1588_TMST;
-		bnxt_get_rx_ts_thor(rxq->bp, rxcmp1->reorder);
+		bnxt_get_rx_ts_p5(rxq->bp, rxcmp1->reorder);
 	}
 #endif
 
diff --git a/drivers/net/bnxt/bnxt_rxr.h b/drivers/net/bnxt/bnxt_rxr.h
index 3fc901fdf..2a53cf87b 100644
--- a/drivers/net/bnxt/bnxt_rxr.h
+++ b/drivers/net/bnxt/bnxt_rxr.h
@@ -17,7 +17,7 @@
 static inline uint16_t bnxt_tpa_start_agg_id(struct bnxt *bp,
 					     struct rx_tpa_start_cmpl *cmp)
 {
-	if (BNXT_CHIP_THOR(bp))
+	if (BNXT_CHIP_P5(bp))
 		return BNXT_TPA_START_AGG_ID_TH(cmp);
 	else
 		return BNXT_TPA_START_AGG_ID_PRE_TH(cmp);
diff --git a/drivers/net/bnxt/bnxt_vnic.c b/drivers/net/bnxt/bnxt_vnic.c
index 1602fb2b8..4d378eca4 100644
--- a/drivers/net/bnxt/bnxt_vnic.c
+++ b/drivers/net/bnxt/bnxt_vnic.c
@@ -129,8 +129,8 @@ int bnxt_alloc_vnic_attributes(struct bnxt *bp)
 	entry_length = HW_HASH_KEY_SIZE +
 		       BNXT_MAX_MC_ADDRS * RTE_ETHER_ADDR_LEN;
 
-	if (BNXT_CHIP_THOR(bp))
-		rss_table_size = BNXT_RSS_TBL_SIZE_THOR *
+	if (BNXT_CHIP_P5(bp))
+		rss_table_size = BNXT_RSS_TBL_SIZE_P5 *
 				 2 * sizeof(*vnic->rss_table);
 	else
 		rss_table_size = HW_HASH_INDEX_SIZE * sizeof(*vnic->rss_table);
diff --git a/drivers/net/bnxt/tf_ulp/bnxt_ulp.c b/drivers/net/bnxt/tf_ulp/bnxt_ulp.c
index 26fd3009f..de47fde88 100644
--- a/drivers/net/bnxt/tf_ulp/bnxt_ulp.c
+++ b/drivers/net/bnxt/tf_ulp/bnxt_ulp.c
@@ -52,7 +52,7 @@ static int32_t
 bnxt_ulp_devid_get(struct bnxt *bp,
 		   enum bnxt_ulp_device_id  *ulp_dev_id)
 {
-	if (BNXT_CHIP_THOR(bp))
+	if (BNXT_CHIP_P5(bp))
 		return -EINVAL;
 	/* Assuming Whitney */
 	*ulp_dev_id = BNXT_ULP_DEVICE_ID_WH_PLUS;
-- 
2.21.1 (Apple Git-122.3)


^ permalink raw reply	[flat|nested] 47+ messages in thread

* [dpdk-dev] [PATCH v2 06/17] net/bnxt: fix to return error when fw command fails
  2020-12-09 19:22 [dpdk-dev] [PATCH v2 00/17] fixes and refactoring changes for bnxt Ajit Khaparde
                   ` (4 preceding siblings ...)
  2020-12-09 19:22 ` [dpdk-dev] [PATCH v2 05/17] net/bnxt: remove references to Thor Ajit Khaparde
@ 2020-12-09 19:22 ` Ajit Khaparde
  2020-12-09 19:22 ` [dpdk-dev] [PATCH v2 07/17] net/bnxt: fix cleanup on mutex init failure Ajit Khaparde
                   ` (11 subsequent siblings)
  17 siblings, 0 replies; 47+ messages in thread
From: Ajit Khaparde @ 2020-12-09 19:22 UTC (permalink / raw)
  To: dev; +Cc: Kalesh AP, stable, Somnath Kotur

From: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>

In bnxt_reta_update_op() and bnxt_rss_hash_update_op(), driver does not
propagate the error back to the application when the fw command fails.

Fixes: 378ab645bb0b ("net/bnxt: fix RSS RETA indirection table ops")
Fixes: fcc0aa1edc10 ("net/bnxt: add RSS hash configuration")
Cc: stable@dpdk.org

Signed-off-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
Reviewed-by: Somnath Kotur <somnath.kotur@broadcom.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
---
 drivers/net/bnxt/bnxt_ethdev.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c
index 8047b0b5d..33358779b 100644
--- a/drivers/net/bnxt/bnxt_ethdev.c
+++ b/drivers/net/bnxt/bnxt_ethdev.c
@@ -1843,8 +1843,8 @@ static int bnxt_reta_update_op(struct rte_eth_dev *eth_dev,
 		}
 	}
 
-	bnxt_hwrm_vnic_rss_cfg(bp, vnic);
-	return 0;
+	rc = bnxt_hwrm_vnic_rss_cfg(bp, vnic);
+	return rc;
 }
 
 static int bnxt_reta_query_op(struct rte_eth_dev *eth_dev,
@@ -1949,8 +1949,8 @@ static int bnxt_rss_hash_update_op(struct rte_eth_dev *eth_dev,
 	memcpy(vnic->rss_hash_key, rss_conf->rss_key, rss_conf->rss_key_len);
 
 rss_config:
-	bnxt_hwrm_vnic_rss_cfg(bp, vnic);
-	return 0;
+	rc = bnxt_hwrm_vnic_rss_cfg(bp, vnic);
+	return rc;
 }
 
 static int bnxt_rss_hash_conf_get_op(struct rte_eth_dev *eth_dev,
-- 
2.21.1 (Apple Git-122.3)


^ permalink raw reply	[flat|nested] 47+ messages in thread

* [dpdk-dev] [PATCH v2 07/17] net/bnxt: fix cleanup on mutex init failure
  2020-12-09 19:22 [dpdk-dev] [PATCH v2 00/17] fixes and refactoring changes for bnxt Ajit Khaparde
                   ` (5 preceding siblings ...)
  2020-12-09 19:22 ` [dpdk-dev] [PATCH v2 06/17] net/bnxt: fix to return error when fw command fails Ajit Khaparde
@ 2020-12-09 19:22 ` Ajit Khaparde
  2020-12-09 19:22 ` [dpdk-dev] [PATCH v2 08/17] net/bnxt: fix format specifier for unsigned int Ajit Khaparde
                   ` (10 subsequent siblings)
  17 siblings, 0 replies; 47+ messages in thread
From: Ajit Khaparde @ 2020-12-09 19:22 UTC (permalink / raw)
  To: dev; +Cc: stable

In case mutex init fails during initialization, start cleanup and
fail the initialization process.

Fixes: a73b8e939f10 ("net/bnxt: fix race between start and interrupt handler")
Cc: stable@dpdk.org

Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
---
 drivers/net/bnxt/bnxt_ethdev.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c
index 33358779b..0b14ca234 100644
--- a/drivers/net/bnxt/bnxt_ethdev.c
+++ b/drivers/net/bnxt/bnxt_ethdev.c
@@ -4739,8 +4739,10 @@ bnxt_init_locks(struct bnxt *bp)
 	}
 
 	err = pthread_mutex_init(&bp->def_cp_lock, NULL);
-	if (err)
+	if (err) {
 		PMD_DRV_LOG(ERR, "Unable to initialize def_cp_lock\n");
+		return err;
+	}
 
 	err = pthread_mutex_init(&bp->health_check_lock, NULL);
 	if (err)
-- 
2.21.1 (Apple Git-122.3)


^ permalink raw reply	[flat|nested] 47+ messages in thread

* [dpdk-dev] [PATCH v2 08/17] net/bnxt: fix format specifier for unsigned int
  2020-12-09 19:22 [dpdk-dev] [PATCH v2 00/17] fixes and refactoring changes for bnxt Ajit Khaparde
                   ` (6 preceding siblings ...)
  2020-12-09 19:22 ` [dpdk-dev] [PATCH v2 07/17] net/bnxt: fix cleanup on mutex init failure Ajit Khaparde
@ 2020-12-09 19:22 ` Ajit Khaparde
  2020-12-09 19:22 ` [dpdk-dev] [PATCH v2 09/17] net/bnxt: fix max rings computation Ajit Khaparde
                   ` (9 subsequent siblings)
  17 siblings, 0 replies; 47+ messages in thread
From: Ajit Khaparde @ 2020-12-09 19:22 UTC (permalink / raw)
  To: dev; +Cc: stable

&device requires the %u format specifer not the %d specifier, as
&device is unsigned.

Fixes: a46bbb57605b ("net/bnxt: update multi device design")
Cc: stable@dpdk.org

Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
---
 drivers/net/bnxt/tf_core/tf_core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/bnxt/tf_core/tf_core.c b/drivers/net/bnxt/tf_core/tf_core.c
index 24d49096a..3409cbbce 100644
--- a/drivers/net/bnxt/tf_core/tf_core.c
+++ b/drivers/net/bnxt/tf_core/tf_core.c
@@ -82,7 +82,7 @@ tf_open_session(struct tf *tfp,
 		return rc;
 
 	TFP_DRV_LOG(INFO,
-		    "domain:%d, bus:%d, device:%d\n",
+		    "domain:%d, bus:%d, device:%u\n",
 		    parms->session_id.internal.domain,
 		    parms->session_id.internal.bus,
 		    parms->session_id.internal.device);
-- 
2.21.1 (Apple Git-122.3)


^ permalink raw reply	[flat|nested] 47+ messages in thread

* [dpdk-dev] [PATCH v2 09/17] net/bnxt: fix max rings computation
  2020-12-09 19:22 [dpdk-dev] [PATCH v2 00/17] fixes and refactoring changes for bnxt Ajit Khaparde
                   ` (7 preceding siblings ...)
  2020-12-09 19:22 ` [dpdk-dev] [PATCH v2 08/17] net/bnxt: fix format specifier for unsigned int Ajit Khaparde
@ 2020-12-09 19:22 ` Ajit Khaparde
  2020-12-09 19:22 ` [dpdk-dev] [PATCH v2 10/17] net/bnxt: support for 236 queues in NS3 Ajit Khaparde
                   ` (8 subsequent siblings)
  17 siblings, 0 replies; 47+ messages in thread
From: Ajit Khaparde @ 2020-12-09 19:22 UTC (permalink / raw)
  To: dev; +Cc: Sriharsha Basavapatna, stable, Somnath Kotur

From: Sriharsha Basavapatna <sriharsha.basavapatna@broadcom.com>

The current max_rings computation does not take into account the case
when max_nq_rings is <= num_async_cpr. This results in a wrong value
like 0, when max_nq_rings is 1. Fix this by subtracting num_async_cpr
only when max_cp_rings > num_async_cpr.

Apart from this, the entire logic is currently spread across a few
macros, making it hard to read and debug this code. Move this code
into an inline function.

max_msix is not used in the max_rings calculation.
Apparently the max_msix field returned in HWRM_RESC_QCAPS is only
valid for Thor and newer chips. On Wh+ it will be equal to min_compl_rings.
Also, when a function reset is performed on an application quit, FW
will not reset the VF resource pool as per design.
This can lead to a strange condition wherein the max_msix field
on Wh+ keeps changing on each application re-load thereby throwing
throwing off the max_rings computation.

Fixes: f03e66cb64ce ("net/bnxt: limit queue count for NS3/Stingray devices")
Cc: stable@dpdk.org

Signed-off-by: Sriharsha Basavapatna <sriharsha.basavapatna@broadcom.com>
Signed-off-by: Somnath Kotur <somnath.kotur@broadcom.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
---
 drivers/net/bnxt/bnxt.h        | 41 +++++++++++++++++++++++-----------
 drivers/net/bnxt/bnxt_ethdev.c |  2 +-
 drivers/net/bnxt/bnxt_rxq.c    |  7 +++---
 drivers/net/bnxt/bnxt_txq.c    |  2 +-
 4 files changed, 34 insertions(+), 18 deletions(-)

diff --git a/drivers/net/bnxt/bnxt.h b/drivers/net/bnxt/bnxt.h
index 9c1c87489..bc0935272 100644
--- a/drivers/net/bnxt/bnxt.h
+++ b/drivers/net/bnxt/bnxt.h
@@ -752,19 +752,6 @@ struct bnxt {
 	uint16_t		max_tx_rings;
 	uint16_t		max_rx_rings;
 #define MAX_STINGRAY_RINGS		128U
-/* For sake of symmetry, max Tx rings == max Rx rings, one stat ctx for each */
-#define BNXT_MAX_RX_RINGS(bp) \
-	(BNXT_STINGRAY(bp) ? RTE_MIN(RTE_MIN(bp->max_rx_rings / 2U, \
-					     MAX_STINGRAY_RINGS), \
-				     bp->max_stat_ctx / 2U) : \
-				RTE_MIN(bp->max_rx_rings / 2U, \
-					bp->max_stat_ctx / 2U))
-#define BNXT_MAX_TX_RINGS(bp) \
-	(RTE_MIN((bp)->max_tx_rings, BNXT_MAX_RX_RINGS(bp)))
-
-#define BNXT_MAX_RINGS(bp) \
-	(RTE_MIN((((bp)->max_cp_rings - BNXT_NUM_ASYNC_CPR(bp)) / 2U), \
-		 BNXT_MAX_TX_RINGS(bp)))
 
 #define BNXT_MAX_VF_REP_RINGS	8
 
@@ -822,6 +809,34 @@ struct bnxt {
 	uint16_t		tx_cfa_action;
 };
 
+static
+inline uint16_t bnxt_max_rings(struct bnxt *bp)
+{
+	uint16_t max_tx_rings = bp->max_tx_rings;
+	uint16_t max_rx_rings = bp->max_rx_rings;
+	uint16_t max_cp_rings = bp->max_cp_rings;
+	uint16_t max_rings;
+
+	/* For the sake of symmetry:
+	 * max Tx rings == max Rx rings, one stat ctx for each.
+	 */
+	if (BNXT_STINGRAY(bp)) {
+		max_rx_rings = RTE_MIN(RTE_MIN(max_rx_rings / 2U,
+					       MAX_STINGRAY_RINGS),
+				       bp->max_stat_ctx / 2U);
+	} else {
+		max_rx_rings = RTE_MIN(max_rx_rings / 2U,
+				       bp->max_stat_ctx / 2U);
+	}
+
+	max_tx_rings = RTE_MIN(max_tx_rings, max_rx_rings);
+	if (max_cp_rings > BNXT_NUM_ASYNC_CPR(bp))
+		max_cp_rings -= BNXT_NUM_ASYNC_CPR(bp);
+	max_rings = RTE_MIN(max_cp_rings / 2U, max_tx_rings);
+
+	return max_rings;
+}
+
 #define BNXT_FC_TIMER	1 /* Timer freq in Sec Flow Counters */
 
 /**
diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c
index 0b14ca234..bf8963577 100644
--- a/drivers/net/bnxt/bnxt_ethdev.c
+++ b/drivers/net/bnxt/bnxt_ethdev.c
@@ -920,7 +920,7 @@ static int bnxt_dev_info_get_op(struct rte_eth_dev *eth_dev,
 	if (BNXT_PF(bp))
 		dev_info->max_vfs = pdev->max_vfs;
 
-	max_rx_rings = BNXT_MAX_RINGS(bp);
+	max_rx_rings = bnxt_max_rings(bp);
 	/* 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;
diff --git a/drivers/net/bnxt/bnxt_rxq.c b/drivers/net/bnxt/bnxt_rxq.c
index 328cc994d..19e11e47b 100644
--- a/drivers/net/bnxt/bnxt_rxq.c
+++ b/drivers/net/bnxt/bnxt_rxq.c
@@ -311,7 +311,7 @@ int bnxt_rx_queue_setup_op(struct rte_eth_dev *eth_dev,
 	if (rc)
 		return rc;
 
-	if (queue_idx >= BNXT_MAX_RINGS(bp)) {
+	if (queue_idx >= bnxt_max_rings(bp)) {
 		PMD_DRV_LOG(ERR,
 			"Cannot create Rx ring %d. Only %d rings available\n",
 			queue_idx, bp->max_rx_rings);
@@ -364,8 +364,9 @@ int bnxt_rx_queue_setup_op(struct rte_eth_dev *eth_dev,
 
 	eth_dev->data->rx_queues[queue_idx] = rxq;
 	/* Allocate RX ring hardware descriptors */
-	if (bnxt_alloc_rings(bp, queue_idx, NULL, rxq, rxq->cp_ring, NULL,
-			     "rxr")) {
+	rc = bnxt_alloc_rings(bp, queue_idx, NULL, rxq, rxq->cp_ring, NULL,
+			     "rxr");
+	if (rc) {
 		PMD_DRV_LOG(ERR,
 			    "ring_dma_zone_reserve for rx_ring failed!\n");
 		goto err;
diff --git a/drivers/net/bnxt/bnxt_txq.c b/drivers/net/bnxt/bnxt_txq.c
index c9792a2af..99a31cef2 100644
--- a/drivers/net/bnxt/bnxt_txq.c
+++ b/drivers/net/bnxt/bnxt_txq.c
@@ -98,7 +98,7 @@ int bnxt_tx_queue_setup_op(struct rte_eth_dev *eth_dev,
 	if (rc)
 		return rc;
 
-	if (queue_idx >= BNXT_MAX_RINGS(bp)) {
+	if (queue_idx >= bnxt_max_rings(bp)) {
 		PMD_DRV_LOG(ERR,
 			"Cannot create Tx ring %d. Only %d rings available\n",
 			queue_idx, bp->max_tx_rings);
-- 
2.21.1 (Apple Git-122.3)


^ permalink raw reply	[flat|nested] 47+ messages in thread

* [dpdk-dev] [PATCH v2 10/17] net/bnxt: support for 236 queues in NS3
  2020-12-09 19:22 [dpdk-dev] [PATCH v2 00/17] fixes and refactoring changes for bnxt Ajit Khaparde
                   ` (8 preceding siblings ...)
  2020-12-09 19:22 ` [dpdk-dev] [PATCH v2 09/17] net/bnxt: fix max rings computation Ajit Khaparde
@ 2020-12-09 19:22 ` Ajit Khaparde
  2020-12-09 19:22 ` [dpdk-dev] [PATCH v2 11/17] net/bnxt: use the right function to free mbuf Ajit Khaparde
                   ` (7 subsequent siblings)
  17 siblings, 0 replies; 47+ messages in thread
From: Ajit Khaparde @ 2020-12-09 19:22 UTC (permalink / raw)
  To: dev; +Cc: Rahul Gupta

From: Rahul Gupta <rahul.gupta@broadcom.com>

For NS3, increased CONFIG_RTE_ETHDEV_QUEUE_STAT_CNTRS to support
236 counters and increased MAX_STINGRAY_RINGS in driver to support
more rings.

Signed-off-by: Rahul Gupta <rahul.gupta@broadcom.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
---
 drivers/net/bnxt/bnxt.h | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/net/bnxt/bnxt.h b/drivers/net/bnxt/bnxt.h
index bc0935272..2a318efaf 100644
--- a/drivers/net/bnxt/bnxt.h
+++ b/drivers/net/bnxt/bnxt.h
@@ -751,8 +751,7 @@ struct bnxt {
 	uint16_t		max_cp_rings;
 	uint16_t		max_tx_rings;
 	uint16_t		max_rx_rings;
-#define MAX_STINGRAY_RINGS		128U
-
+#define MAX_STINGRAY_RINGS		236U
 #define BNXT_MAX_VF_REP_RINGS	8
 
 	uint16_t		max_nq_rings;
-- 
2.21.1 (Apple Git-122.3)


^ permalink raw reply	[flat|nested] 47+ messages in thread

* [dpdk-dev] [PATCH v2 11/17] net/bnxt: use the right function to free mbuf
  2020-12-09 19:22 [dpdk-dev] [PATCH v2 00/17] fixes and refactoring changes for bnxt Ajit Khaparde
                   ` (9 preceding siblings ...)
  2020-12-09 19:22 ` [dpdk-dev] [PATCH v2 10/17] net/bnxt: support for 236 queues in NS3 Ajit Khaparde
@ 2020-12-09 19:22 ` Ajit Khaparde
  2020-12-09 19:22 ` [dpdk-dev] [PATCH v2 12/17] net/bnxt: remove function declaration Ajit Khaparde
                   ` (6 subsequent siblings)
  17 siblings, 0 replies; 47+ messages in thread
From: Ajit Khaparde @ 2020-12-09 19:22 UTC (permalink / raw)
  To: dev; +Cc: Somnath Kotur

mbufs are being allocated using rte_mbuf_raw_alloc().
Use corresponding rte_mbuf_raw_free() to free mbuf.

Signed-off-by: Somnath Kotur <somnath.kotur@broadcom.com>

Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
---
 drivers/net/bnxt/bnxt_reps.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/bnxt/bnxt_reps.c b/drivers/net/bnxt/bnxt_reps.c
index e5ba0909b..167c46ad4 100644
--- a/drivers/net/bnxt/bnxt_reps.c
+++ b/drivers/net/bnxt/bnxt_reps.c
@@ -65,7 +65,7 @@ bnxt_vfr_recv(uint16_t port_id, uint16_t queue_id, struct rte_mbuf *mbuf)
 		/* Representor Rx ring full, drop pkt */
 		vfr_bp->rx_drop_bytes[que] += mbuf->pkt_len;
 		vfr_bp->rx_drop_pkts[que]++;
-		rte_pktmbuf_free(mbuf);
+		rte_mbuf_raw_free(mbuf);
 	}
 
 	return 0;
-- 
2.21.1 (Apple Git-122.3)


^ permalink raw reply	[flat|nested] 47+ messages in thread

* [dpdk-dev] [PATCH v2 12/17] net/bnxt: remove function declaration
  2020-12-09 19:22 [dpdk-dev] [PATCH v2 00/17] fixes and refactoring changes for bnxt Ajit Khaparde
                   ` (10 preceding siblings ...)
  2020-12-09 19:22 ` [dpdk-dev] [PATCH v2 11/17] net/bnxt: use the right function to free mbuf Ajit Khaparde
@ 2020-12-09 19:22 ` Ajit Khaparde
  2020-12-09 19:22 ` [dpdk-dev] [PATCH v2 13/17] net/bnxt: fix vnic RSS configure function Ajit Khaparde
                   ` (5 subsequent siblings)
  17 siblings, 0 replies; 47+ messages in thread
From: Ajit Khaparde @ 2020-12-09 19:22 UTC (permalink / raw)
  To: dev

Remove an orphan function declaration.
It has not been defined yet and hence not used anywhere.

Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
---
 drivers/net/bnxt/bnxt_hwrm.h | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/net/bnxt/bnxt_hwrm.h b/drivers/net/bnxt/bnxt_hwrm.h
index 23ca6ab51..4b3290773 100644
--- a/drivers/net/bnxt/bnxt_hwrm.h
+++ b/drivers/net/bnxt/bnxt_hwrm.h
@@ -288,8 +288,6 @@ int bnxt_hwrm_cfa_counter_qstats(struct bnxt *bp,
 				 enum bnxt_flow_dir dir,
 				 uint16_t cntr,
 				 uint16_t num_entries);
-int bnxt_hwrm_get_dflt_vnic_id(struct bnxt *bp, uint16_t fid,
-			       uint16_t *vnic_id);
 int bnxt_hwrm_get_dflt_vnic_svif(struct bnxt *bp, uint16_t fid,
 				 uint16_t *vnic_id, uint16_t *svif);
 int bnxt_hwrm_parent_pf_qcfg(struct bnxt *bp);
-- 
2.21.1 (Apple Git-122.3)


^ permalink raw reply	[flat|nested] 47+ messages in thread

* [dpdk-dev] [PATCH v2 13/17] net/bnxt: fix vnic RSS configure function
  2020-12-09 19:22 [dpdk-dev] [PATCH v2 00/17] fixes and refactoring changes for bnxt Ajit Khaparde
                   ` (11 preceding siblings ...)
  2020-12-09 19:22 ` [dpdk-dev] [PATCH v2 12/17] net/bnxt: remove function declaration Ajit Khaparde
@ 2020-12-09 19:22 ` Ajit Khaparde
  2020-12-09 19:22 ` [dpdk-dev] [PATCH v2 14/17] net/bnxt: fix PF resource query Ajit Khaparde
                   ` (4 subsequent siblings)
  17 siblings, 0 replies; 47+ messages in thread
From: Ajit Khaparde @ 2020-12-09 19:22 UTC (permalink / raw)
  To: dev; +Cc: Kalesh AP, stable, Somnath Kotur

From: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>

1. moved invalid VNIC id check to the beginning of the function.
2. removed a duplicate check which avoids unnecessary code indentation.

Fixes: 49d0709b257fc ("net/bnxt: delete and flush L2 filters cleanly")
Cc: stable@dpdk.org

Signed-off-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
Reviewed-by: Somnath Kotur <somnath.kotur@broadcom.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
---
 drivers/net/bnxt/bnxt_hwrm.c | 42 +++++++++++++++++-------------------
 1 file changed, 20 insertions(+), 22 deletions(-)

diff --git a/drivers/net/bnxt/bnxt_hwrm.c b/drivers/net/bnxt/bnxt_hwrm.c
index 6f5402070..cee2656c1 100644
--- a/drivers/net/bnxt/bnxt_hwrm.c
+++ b/drivers/net/bnxt/bnxt_hwrm.c
@@ -4896,37 +4896,35 @@ int bnxt_vnic_rss_configure(struct bnxt *bp, struct bnxt_vnic_info *vnic)
 {
 	unsigned int rss_idx, fw_idx, i;
 
+	if (vnic->fw_vnic_id == INVALID_HW_RING_ID)
+		return 0;
+
 	if (!(vnic->rss_table && vnic->hash_type))
 		return 0;
 
 	if (BNXT_CHIP_P5(bp))
 		return bnxt_vnic_rss_configure_p5(bp, vnic);
 
-	if (vnic->fw_vnic_id == INVALID_HW_RING_ID)
-		return 0;
-
-	if (vnic->rss_table && vnic->hash_type) {
-		/*
-		 * Fill the RSS hash & redirection table with
-		 * ring group ids for all VNICs
-		 */
-		for (rss_idx = 0, fw_idx = 0; rss_idx < HW_HASH_INDEX_SIZE;
-			rss_idx++, fw_idx++) {
-			for (i = 0; i < bp->rx_cp_nr_rings; i++) {
-				fw_idx %= bp->rx_cp_nr_rings;
-				if (vnic->fw_grp_ids[fw_idx] !=
-				    INVALID_HW_RING_ID)
-					break;
-				fw_idx++;
-			}
-			if (i == bp->rx_cp_nr_rings)
-				return 0;
-			vnic->rss_table[rss_idx] = vnic->fw_grp_ids[fw_idx];
+	/*
+	 * Fill the RSS hash & redirection table with
+	 * ring group ids for all VNICs
+	 */
+	for (rss_idx = 0, fw_idx = 0; rss_idx < HW_HASH_INDEX_SIZE;
+	     rss_idx++, fw_idx++) {
+		for (i = 0; i < bp->rx_cp_nr_rings; i++) {
+			fw_idx %= bp->rx_cp_nr_rings;
+			if (vnic->fw_grp_ids[fw_idx] != INVALID_HW_RING_ID)
+				break;
+			fw_idx++;
 		}
-		return bnxt_hwrm_vnic_rss_cfg(bp, vnic);
+
+		if (i == bp->rx_cp_nr_rings)
+			return 0;
+
+		vnic->rss_table[rss_idx] = vnic->fw_grp_ids[fw_idx];
 	}
 
-	return 0;
+	return bnxt_hwrm_vnic_rss_cfg(bp, vnic);
 }
 
 static void bnxt_hwrm_set_coal_params(struct bnxt_coal *hw_coal,
-- 
2.21.1 (Apple Git-122.3)


^ permalink raw reply	[flat|nested] 47+ messages in thread

* [dpdk-dev] [PATCH v2 14/17] net/bnxt: fix PF resource query
  2020-12-09 19:22 [dpdk-dev] [PATCH v2 00/17] fixes and refactoring changes for bnxt Ajit Khaparde
                   ` (12 preceding siblings ...)
  2020-12-09 19:22 ` [dpdk-dev] [PATCH v2 13/17] net/bnxt: fix vnic RSS configure function Ajit Khaparde
@ 2020-12-09 19:22 ` Ajit Khaparde
  2020-12-09 19:22 ` [dpdk-dev] [PATCH v2 15/17] net/bnxt: changes to indentation and coding style Ajit Khaparde
                   ` (3 subsequent siblings)
  17 siblings, 0 replies; 47+ messages in thread
From: Ajit Khaparde @ 2020-12-09 19:22 UTC (permalink / raw)
  To: dev; +Cc: Somnath Kotur, stable, Venkat Duvvuru, Kalesh AP

From: Somnath Kotur <somnath.kotur@broadcom.com>

This cmd should be called by every driver after 'hwrm_func_cfg'
to get the actual number of resources allocated by the HWRM.
The values returned in the cmd are the max values for that PF.

Also, now that the max values for the PF are computed in probe itself,
no need to invoke FUNC_QCAPs or any other cmd in dev_configure_op()
as that would just override the actual max values obtained above.

Fixes: f8168ca0e690 ("net/bnxt: support thor controller")
Cc: stable@dpdk.org

Signed-off-by: Somnath Kotur <somnath.kotur@broadcom.com>
Reviewed-by: Venkat Duvvuru <venkatkumar.duvvuru@broadcom.com>
Reviewed-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
---
 drivers/net/bnxt/bnxt_ethdev.c |  7 -------
 drivers/net/bnxt/bnxt_hwrm.c   | 36 +++++++++++++++++++++++++++++++++-
 2 files changed, 35 insertions(+), 8 deletions(-)

diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c
index bf8963577..21d9e26ca 100644
--- a/drivers/net/bnxt/bnxt_ethdev.c
+++ b/drivers/net/bnxt/bnxt_ethdev.c
@@ -1071,13 +1071,6 @@ static int bnxt_dev_configure_op(struct rte_eth_dev *eth_dev)
 		}
 
 		pthread_mutex_unlock(&bp->def_cp_lock);
-	} else {
-		/* legacy driver needs to get updated values */
-		rc = bnxt_hwrm_func_qcaps(bp);
-		if (rc) {
-			PMD_DRV_LOG(ERR, "hwrm func qcaps fail:%d\n", rc);
-			return rc;
-		}
 	}
 
 	/* Inherit new configurations */
diff --git a/drivers/net/bnxt/bnxt_hwrm.c b/drivers/net/bnxt/bnxt_hwrm.c
index cee2656c1..a3eb133c0 100644
--- a/drivers/net/bnxt/bnxt_hwrm.c
+++ b/drivers/net/bnxt/bnxt_hwrm.c
@@ -3456,6 +3456,35 @@ static int bnxt_update_max_resources(struct bnxt *bp,
 	return 0;
 }
 
+/* Update the PF resource values based on how many resources
+ * got allocated to it.
+ */
+static int bnxt_update_max_resources_pf_only(struct bnxt *bp)
+{
+	struct hwrm_func_qcfg_input req = {0};
+	struct hwrm_func_qcfg_output *resp = bp->hwrm_cmd_resp_addr;
+	int rc;
+
+	/* Get the actual allocated values now */
+	HWRM_PREP(&req, HWRM_FUNC_QCFG, BNXT_USE_CHIMP_MB);
+	req.fid = rte_cpu_to_le_16(0xffff);
+	rc = bnxt_hwrm_send_message(bp, &req, sizeof(req), BNXT_USE_CHIMP_MB);
+	HWRM_CHECK_RESULT();
+
+	bp->max_rsscos_ctx = rte_le_to_cpu_16(resp->alloc_rsscos_ctx);
+	bp->max_stat_ctx = rte_le_to_cpu_16(resp->alloc_stat_ctx);
+	bp->max_cp_rings = rte_le_to_cpu_16(resp->alloc_cmpl_rings);
+	bp->max_tx_rings = rte_le_to_cpu_16(resp->alloc_tx_rings);
+	bp->max_rx_rings = rte_le_to_cpu_16(resp->alloc_rx_rings);
+	bp->max_l2_ctx = rte_le_to_cpu_16(resp->alloc_l2_ctx);
+	bp->max_ring_grps = rte_le_to_cpu_16(resp->alloc_hw_ring_grps);
+	bp->max_vnics = rte_le_to_cpu_16(resp->alloc_vnics);
+
+	HWRM_UNLOCK();
+
+	return 0;
+}
+
 int bnxt_hwrm_func_qcfg_current_vf_vlan(struct bnxt *bp, int vf)
 {
 	struct hwrm_func_qcfg_input req = {0};
@@ -3555,8 +3584,13 @@ int bnxt_hwrm_allocate_pf_only(struct bnxt *bp)
 		  HWRM_FUNC_CFG_INPUT_FLAGS_STD_TX_RING_MODE_DISABLE);
 	bp->pf->func_cfg_flags |=
 		HWRM_FUNC_CFG_INPUT_FLAGS_STD_TX_RING_MODE_DISABLE;
+
 	rc = bnxt_hwrm_pf_func_cfg(bp, &pf_resc);
-	rc = __bnxt_hwrm_func_qcaps(bp);
+	if (rc)
+		return rc;
+
+	rc = bnxt_update_max_resources_pf_only(bp);
+
 	return rc;
 }
 
-- 
2.21.1 (Apple Git-122.3)


^ permalink raw reply	[flat|nested] 47+ messages in thread

* [dpdk-dev] [PATCH v2 15/17] net/bnxt: changes to indentation and coding style
  2020-12-09 19:22 [dpdk-dev] [PATCH v2 00/17] fixes and refactoring changes for bnxt Ajit Khaparde
                   ` (13 preceding siblings ...)
  2020-12-09 19:22 ` [dpdk-dev] [PATCH v2 14/17] net/bnxt: fix PF resource query Ajit Khaparde
@ 2020-12-09 19:22 ` Ajit Khaparde
  2020-12-09 19:22 ` [dpdk-dev] [PATCH v2 16/17] net/bnxt: add missing comments Ajit Khaparde
                   ` (2 subsequent siblings)
  17 siblings, 0 replies; 47+ messages in thread
From: Ajit Khaparde @ 2020-12-09 19:22 UTC (permalink / raw)
  To: dev

Indentation and coding style fixes.

Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
---
 drivers/net/bnxt/bnxt.h        | 4 ++--
 drivers/net/bnxt/bnxt_ethdev.c | 9 ++++-----
 drivers/net/bnxt/bnxt_reps.c   | 2 +-
 drivers/net/bnxt/bnxt_ring.c   | 3 +--
 4 files changed, 8 insertions(+), 10 deletions(-)

diff --git a/drivers/net/bnxt/bnxt.h b/drivers/net/bnxt/bnxt.h
index 2a318efaf..556e99203 100644
--- a/drivers/net/bnxt/bnxt.h
+++ b/drivers/net/bnxt/bnxt.h
@@ -127,9 +127,9 @@
  */
 #ifdef RTE_EXEC_ENV_FREEBSD
 /* In FreeBSD OS, nic_uio driver does not support interrupts */
-#define BNXT_NUM_ASYNC_CPR(bp) 0
+#define BNXT_NUM_ASYNC_CPR(bp) 0U
 #else
-#define BNXT_NUM_ASYNC_CPR(bp) 1
+#define BNXT_NUM_ASYNC_CPR(bp) 1U
 #endif
 
 #define BNXT_MISC_VEC_ID               RTE_INTR_VEC_ZERO_OFFSET
diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c
index 21d9e26ca..9d5c8aa0f 100644
--- a/drivers/net/bnxt/bnxt_ethdev.c
+++ b/drivers/net/bnxt/bnxt_ethdev.c
@@ -1264,11 +1264,10 @@ static int bnxt_dev_start_op(struct rte_eth_dev *eth_dev)
 		return -EINVAL;
 	}
 
-	if (bp->rx_cp_nr_rings > RTE_ETHDEV_QUEUE_STAT_CNTRS) {
+	if (bp->rx_cp_nr_rings > RTE_ETHDEV_QUEUE_STAT_CNTRS)
 		PMD_DRV_LOG(ERR,
-			"RxQ cnt %d > RTE_ETHDEV_QUEUE_STAT_CNTRS %d\n",
-			bp->rx_cp_nr_rings, RTE_ETHDEV_QUEUE_STAT_CNTRS);
-	}
+			    "RxQ cnt %d > RTE_ETHDEV_QUEUE_STAT_CNTRS %d\n",
+			    bp->rx_cp_nr_rings, RTE_ETHDEV_QUEUE_STAT_CNTRS);
 
 	do {
 		rc = bnxt_hwrm_if_change(bp, true);
@@ -1622,7 +1621,7 @@ int bnxt_link_update_op(struct rte_eth_dev *eth_dev, int wait_to_complete)
 out:
 	/* Timed out or success */
 	if (new.link_status != eth_dev->data->dev_link.link_status ||
-	new.link_speed != eth_dev->data->dev_link.link_speed) {
+	    new.link_speed != eth_dev->data->dev_link.link_speed) {
 		rte_eth_linkstatus_set(eth_dev, &new);
 
 		rte_eth_dev_callback_process(eth_dev,
diff --git a/drivers/net/bnxt/bnxt_reps.c b/drivers/net/bnxt/bnxt_reps.c
index 167c46ad4..12d677d32 100644
--- a/drivers/net/bnxt/bnxt_reps.c
+++ b/drivers/net/bnxt/bnxt_reps.c
@@ -56,7 +56,7 @@ bnxt_vfr_recv(uint16_t port_id, uint16_t queue_id, struct rte_mbuf *mbuf)
 
 	/* Put this mbuf on the RxQ of the Representor */
 	prod_rx_buf = &rep_rxr->rx_buf_ring[rep_rxr->rx_prod & mask];
-	if (!*prod_rx_buf) {
+	if (*prod_rx_buf == NULL) {
 		*prod_rx_buf = mbuf;
 		vfr_bp->rx_bytes[que] += mbuf->pkt_len;
 		vfr_bp->rx_pkts[que]++;
diff --git a/drivers/net/bnxt/bnxt_ring.c b/drivers/net/bnxt/bnxt_ring.c
index 579c48d8c..f83bcaba2 100644
--- a/drivers/net/bnxt/bnxt_ring.c
+++ b/drivers/net/bnxt/bnxt_ring.c
@@ -599,8 +599,7 @@ int bnxt_alloc_hwrm_rx_ring(struct bnxt *bp, int queue_index)
 
 	if (rxq->rx_started) {
 		if (bnxt_init_one_rx_ring(rxq)) {
-			PMD_DRV_LOG(ERR,
-				"bnxt_init_one_rx_ring failed!\n");
+			PMD_DRV_LOG(ERR, "bnxt_init_one_rx_ring failed!\n");
 			bnxt_rx_queue_release_op(rxq);
 			rc = -ENOMEM;
 			goto err_out;
-- 
2.21.1 (Apple Git-122.3)


^ permalink raw reply	[flat|nested] 47+ messages in thread

* [dpdk-dev] [PATCH v2 16/17] net/bnxt: add missing comments
  2020-12-09 19:22 [dpdk-dev] [PATCH v2 00/17] fixes and refactoring changes for bnxt Ajit Khaparde
                   ` (14 preceding siblings ...)
  2020-12-09 19:22 ` [dpdk-dev] [PATCH v2 15/17] net/bnxt: changes to indentation and coding style Ajit Khaparde
@ 2020-12-09 19:22 ` Ajit Khaparde
  2020-12-09 19:22 ` [dpdk-dev] [PATCH v2 17/17] net/bnxt: modify ring index logic Ajit Khaparde
  2020-12-09 23:53 ` [dpdk-dev] [PATCH v3 00/17] fixes and refactoring changes for bnxt Ajit Khaparde
  17 siblings, 0 replies; 47+ messages in thread
From: Ajit Khaparde @ 2020-12-09 19:22 UTC (permalink / raw)
  To: dev

Add and update some missing comments in the code.

Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
---
 drivers/net/bnxt/bnxt.h                         | 6 ++++++
 drivers/net/bnxt/tf_ulp/ulp_template_db_act.c   | 5 +++++
 drivers/net/bnxt/tf_ulp/ulp_template_db_class.c | 6 ++++++
 3 files changed, 17 insertions(+)

diff --git a/drivers/net/bnxt/bnxt.h b/drivers/net/bnxt/bnxt.h
index 556e99203..07d39ee93 100644
--- a/drivers/net/bnxt/bnxt.h
+++ b/drivers/net/bnxt/bnxt.h
@@ -724,7 +724,13 @@ struct bnxt {
 	void				*hwrm_short_cmd_req_addr;
 	rte_iova_t			hwrm_short_cmd_req_dma_addr;
 	rte_spinlock_t			hwrm_lock;
+	/* synchronize between dev_configure_op and int handler */
 	pthread_mutex_t			def_cp_lock;
+	/* synchronize between dev_start_op and async evt handler
+	 * Locking sequence in async evt handler will be
+	 * def_cp_lock
+	 * health_check_lock
+	 */
 	pthread_mutex_t			health_check_lock;
 	uint16_t			max_req_len;
 	uint16_t			max_resp_len;
diff --git a/drivers/net/bnxt/tf_ulp/ulp_template_db_act.c b/drivers/net/bnxt/tf_ulp/ulp_template_db_act.c
index 00ada607a..509af7c58 100644
--- a/drivers/net/bnxt/tf_ulp/ulp_template_db_act.c
+++ b/drivers/net/bnxt/tf_ulp/ulp_template_db_act.c
@@ -8,6 +8,10 @@
 #include "ulp_template_struct.h"
 #include "ulp_rte_parser.h"
 
+/*
+ * Action signature table:
+ * maps hash id to ulp_act_match_list[] index
+ */
 uint16_t ulp_act_sig_tbl[BNXT_ULP_ACT_SIG_TBL_MAX_SZ] = {
 	[BNXT_ULP_ACT_HID_015a] = 1,
 	[BNXT_ULP_ACT_HID_00eb] = 2,
@@ -93,6 +97,7 @@ uint16_t ulp_act_sig_tbl[BNXT_ULP_ACT_SIG_TBL_MAX_SZ] = {
 	[BNXT_ULP_ACT_HID_0b4e] = 82
 };
 
+/* Array for the act matcher list */
 struct bnxt_ulp_act_match_info ulp_act_match_list[] = {
 	[1] = {
 	.act_hid = BNXT_ULP_ACT_HID_015a,
diff --git a/drivers/net/bnxt/tf_ulp/ulp_template_db_class.c b/drivers/net/bnxt/tf_ulp/ulp_template_db_class.c
index fdb26da3e..d904a04cb 100644
--- a/drivers/net/bnxt/tf_ulp/ulp_template_db_class.c
+++ b/drivers/net/bnxt/tf_ulp/ulp_template_db_class.c
@@ -8,6 +8,11 @@
 #include "ulp_template_struct.h"
 #include "ulp_rte_parser.h"
 
+/* Define the template structures */
+/*
+ * Classification signature table:
+ * maps hash id to ulp_class_match_list[] index
+ */
 uint16_t ulp_class_sig_tbl[BNXT_ULP_CLASS_SIG_TBL_MAX_SZ] = {
 	[BNXT_ULP_CLASS_HID_0138] = 1,
 	[BNXT_ULP_CLASS_HID_03f0] = 2,
@@ -227,6 +232,7 @@ uint16_t ulp_class_sig_tbl[BNXT_ULP_CLASS_SIG_TBL_MAX_SZ] = {
 	[BNXT_ULP_CLASS_HID_01b4] = 216
 };
 
+/* Array for the proto matcher list */
 struct bnxt_ulp_class_match_info ulp_class_match_list[] = {
 	[1] = {
 	.class_hid = BNXT_ULP_CLASS_HID_0138,
-- 
2.21.1 (Apple Git-122.3)


^ permalink raw reply	[flat|nested] 47+ messages in thread

* [dpdk-dev] [PATCH v2 17/17] net/bnxt: modify ring index logic
  2020-12-09 19:22 [dpdk-dev] [PATCH v2 00/17] fixes and refactoring changes for bnxt Ajit Khaparde
                   ` (15 preceding siblings ...)
  2020-12-09 19:22 ` [dpdk-dev] [PATCH v2 16/17] net/bnxt: add missing comments Ajit Khaparde
@ 2020-12-09 19:22 ` Ajit Khaparde
  2020-12-09 20:49   ` Lance Richardson
  2020-12-09 23:53 ` [dpdk-dev] [PATCH v3 00/17] fixes and refactoring changes for bnxt Ajit Khaparde
  17 siblings, 1 reply; 47+ messages in thread
From: Ajit Khaparde @ 2020-12-09 19:22 UTC (permalink / raw)
  To: dev

Change the ring logic so that the index increments
unbounded and mask it only when needed.

Modify the existing macros so that the index is not masked.
Add a new macro RING_IDX() to mask it only when needed.

Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
---
 drivers/net/bnxt/bnxt_cpr.h             |  10 ++-
 drivers/net/bnxt/bnxt_hwrm.c            |   4 +-
 drivers/net/bnxt/bnxt_reps.c            |   4 +-
 drivers/net/bnxt/bnxt_ring.c            |  39 +++++----
 drivers/net/bnxt/bnxt_ring.h            |  40 ++++++---
 drivers/net/bnxt/bnxt_rxr.c             | 110 +++++++++++++-----------
 drivers/net/bnxt/bnxt_rxr.h             |   4 +-
 drivers/net/bnxt/bnxt_rxtx_vec_common.h |  16 ++--
 drivers/net/bnxt/bnxt_rxtx_vec_neon.c   |  16 ++--
 drivers/net/bnxt/bnxt_rxtx_vec_sse.c    |  16 ++--
 drivers/net/bnxt/bnxt_txr.c             |  51 ++++++-----
 drivers/net/bnxt/bnxt_txr.h             |   6 +-
 12 files changed, 180 insertions(+), 136 deletions(-)

diff --git a/drivers/net/bnxt/bnxt_cpr.h b/drivers/net/bnxt/bnxt_cpr.h
index ff9697f4c..a763f6006 100644
--- a/drivers/net/bnxt/bnxt_cpr.h
+++ b/drivers/net/bnxt/bnxt_cpr.h
@@ -45,7 +45,7 @@ struct bnxt_db_info;
 } while (0)
 #define B_CP_DB_REARM(cpr, raw_cons)					\
 	rte_write32((DB_CP_REARM_FLAGS |				\
-		    RING_CMP(((cpr)->cp_ring_struct), raw_cons)),	\
+		    DB_RING_IDX(&((cpr)->cp_db), raw_cons)),		\
 		    ((cpr)->cp_db.doorbell))
 
 #define B_CP_DB_ARM(cpr)	rte_write32((DB_KEY_CP),		\
@@ -65,8 +65,8 @@ struct bnxt_db_info;
 } while (0)
 #define B_CP_DIS_DB(cpr, raw_cons)					\
 	rte_write32_relaxed((DB_CP_FLAGS |				\
-			    RING_CMP(((cpr)->cp_ring_struct), raw_cons)), \
-			    ((cpr)->cp_db.doorbell))
+		    DB_RING_IDX(&((cpr)->cp_db), raw_cons)),		\
+		    ((cpr)->cp_db.doorbell))
 
 #define B_CP_DB(cpr, raw_cons, ring_mask)				\
 	rte_write32((DB_CP_FLAGS |					\
@@ -80,8 +80,11 @@ struct bnxt_db_info {
 		uint32_t        db_key32;
 	};
 	bool                    db_64;
+	uint32_t		db_ring_mask;
 };
 
+#define DB_RING_IDX(db, idx)	((idx) & (db)->db_ring_mask)
+
 struct bnxt_ring;
 struct bnxt_cp_ring_info {
 	uint32_t		cp_raw_cons;
@@ -95,7 +98,6 @@ struct bnxt_cp_ring_info {
 	uint32_t		hw_stats_ctx_id;
 
 	struct bnxt_ring	*cp_ring_struct;
-	uint16_t		cp_cons;
 	bool			valid;
 };
 
diff --git a/drivers/net/bnxt/bnxt_hwrm.c b/drivers/net/bnxt/bnxt_hwrm.c
index a3eb133c0..73647fba8 100644
--- a/drivers/net/bnxt/bnxt_hwrm.c
+++ b/drivers/net/bnxt/bnxt_hwrm.c
@@ -2601,8 +2601,8 @@ bnxt_free_all_hwrm_rings(struct bnxt *bp)
 			memset(txr->tx_buf_ring, 0,
 					txr->tx_ring_struct->ring_size *
 					sizeof(*txr->tx_buf_ring));
-			txr->tx_prod = 0;
-			txr->tx_cons = 0;
+			txr->tx_raw_prod = 0;
+			txr->tx_raw_cons = 0;
 		}
 		if (cpr->cp_ring_struct->fw_ring_id != INVALID_HW_RING_ID) {
 			bnxt_free_cp_ring(bp, cpr);
diff --git a/drivers/net/bnxt/bnxt_reps.c b/drivers/net/bnxt/bnxt_reps.c
index 12d677d32..f7bbf77d3 100644
--- a/drivers/net/bnxt/bnxt_reps.c
+++ b/drivers/net/bnxt/bnxt_reps.c
@@ -55,12 +55,12 @@ bnxt_vfr_recv(uint16_t port_id, uint16_t queue_id, struct rte_mbuf *mbuf)
 	mask = rep_rxr->rx_ring_struct->ring_mask;
 
 	/* Put this mbuf on the RxQ of the Representor */
-	prod_rx_buf = &rep_rxr->rx_buf_ring[rep_rxr->rx_prod & mask];
+	prod_rx_buf = &rep_rxr->rx_buf_ring[rep_rxr->rx_raw_prod & mask];
 	if (*prod_rx_buf == NULL) {
 		*prod_rx_buf = mbuf;
 		vfr_bp->rx_bytes[que] += mbuf->pkt_len;
 		vfr_bp->rx_pkts[que]++;
-		rep_rxr->rx_prod++;
+		rep_rxr->rx_raw_prod++;
 	} else {
 		/* Representor Rx ring full, drop pkt */
 		vfr_bp->rx_drop_bytes[que] += mbuf->pkt_len;
diff --git a/drivers/net/bnxt/bnxt_ring.c b/drivers/net/bnxt/bnxt_ring.c
index f83bcaba2..adddf9bc4 100644
--- a/drivers/net/bnxt/bnxt_ring.c
+++ b/drivers/net/bnxt/bnxt_ring.c
@@ -342,7 +342,8 @@ static void bnxt_set_db(struct bnxt *bp,
 			struct bnxt_db_info *db,
 			uint32_t ring_type,
 			uint32_t map_idx,
-			uint32_t fid)
+			uint32_t fid,
+			uint32_t ring_mask)
 {
 	if (BNXT_CHIP_P5(bp)) {
 		if (BNXT_PF(bp))
@@ -381,6 +382,7 @@ static void bnxt_set_db(struct bnxt *bp,
 		}
 		db->db_64 = false;
 	}
+	db->db_ring_mask = ring_mask;
 }
 
 static int bnxt_alloc_cmpl_ring(struct bnxt *bp, int queue_index,
@@ -409,9 +411,9 @@ static int bnxt_alloc_cmpl_ring(struct bnxt *bp, int queue_index,
 	if (rc)
 		return rc;
 
-	cpr->cp_cons = 0;
+	cpr->cp_raw_cons = 0;
 	bnxt_set_db(bp, &cpr->cp_db, ring_type, cp_ring_index,
-		    cp_ring->fw_ring_id);
+		    cp_ring->fw_ring_id, cp_ring->ring_mask);
 	bnxt_db_cq(cpr);
 
 	return 0;
@@ -472,7 +474,7 @@ int bnxt_alloc_rxtx_nq_ring(struct bnxt *bp)
 	}
 
 	bnxt_set_db(bp, &nqr->cp_db, ring_type, ring_index,
-		    ring->fw_ring_id);
+		    ring->fw_ring_id, ring->ring_mask);
 	bnxt_db_nq(nqr);
 
 	bp->rxtx_nq_ring = nqr;
@@ -515,11 +517,12 @@ static int bnxt_alloc_rx_ring(struct bnxt *bp, int queue_index)
 	if (rc)
 		return rc;
 
-	rxr->rx_prod = 0;
+	rxr->rx_raw_prod = 0;
 	if (BNXT_HAS_RING_GRPS(bp))
 		bp->grp_info[queue_index].rx_fw_ring_id = ring->fw_ring_id;
-	bnxt_set_db(bp, &rxr->rx_db, ring_type, queue_index, ring->fw_ring_id);
-	bnxt_db_write(&rxr->rx_db, rxr->rx_prod);
+	bnxt_set_db(bp, &rxr->rx_db, ring_type, queue_index, ring->fw_ring_id,
+		    ring->ring_mask);
+	bnxt_db_write(&rxr->rx_db, rxr->rx_raw_prod);
 
 	return 0;
 }
@@ -551,11 +554,12 @@ static int bnxt_alloc_rx_agg_ring(struct bnxt *bp, int queue_index)
 	if (rc)
 		return rc;
 
-	rxr->ag_prod = 0;
+	rxr->ag_raw_prod = 0;
 	if (BNXT_HAS_RING_GRPS(bp))
 		bp->grp_info[queue_index].ag_fw_ring_id = ring->fw_ring_id;
-	bnxt_set_db(bp, &rxr->ag_db, ring_type, map_idx, ring->fw_ring_id);
-	bnxt_db_write(&rxr->ag_db, rxr->ag_prod);
+	bnxt_set_db(bp, &rxr->ag_db, ring_type, map_idx, ring->fw_ring_id,
+		    ring->ring_mask);
+	bnxt_db_write(&rxr->ag_db, rxr->ag_raw_prod);
 
 	return 0;
 }
@@ -604,8 +608,8 @@ int bnxt_alloc_hwrm_rx_ring(struct bnxt *bp, int queue_index)
 			rc = -ENOMEM;
 			goto err_out;
 		}
-		bnxt_db_write(&rxr->rx_db, rxr->rx_prod);
-		bnxt_db_write(&rxr->ag_db, rxr->ag_prod);
+		bnxt_db_write(&rxr->rx_db, rxr->rx_raw_prod);
+		bnxt_db_write(&rxr->ag_db, rxr->ag_raw_prod);
 	}
 	rxq->index = queue_index;
 #if defined(RTE_ARCH_X86) || defined(RTE_ARCH_ARM64)
@@ -710,8 +714,8 @@ int bnxt_alloc_hwrm_rings(struct bnxt *bp)
 			bnxt_rx_queue_release_op(rxq);
 			return -ENOMEM;
 		}
-		bnxt_db_write(&rxr->rx_db, rxr->rx_prod);
-		bnxt_db_write(&rxr->ag_db, rxr->ag_prod);
+		bnxt_db_write(&rxr->rx_db, rxr->rx_raw_prod);
+		bnxt_db_write(&rxr->ag_db, rxr->ag_raw_prod);
 		rxq->index = i;
 #if defined(RTE_ARCH_X86) || defined(RTE_ARCH_ARM64)
 		bnxt_rxq_vec_setup(rxq);
@@ -744,7 +748,8 @@ int bnxt_alloc_hwrm_rings(struct bnxt *bp)
 		if (rc)
 			goto err_out;
 
-		bnxt_set_db(bp, &txr->tx_db, ring_type, i, ring->fw_ring_id);
+		bnxt_set_db(bp, &txr->tx_db, ring_type, i, ring->fw_ring_id,
+			    ring->ring_mask);
 		txq->index = idx;
 		bnxt_hwrm_set_ring_coal(bp, &coal, cp_ring->fw_ring_id);
 	}
@@ -777,10 +782,10 @@ int bnxt_alloc_async_cp_ring(struct bnxt *bp)
 	if (rc)
 		return rc;
 
-	cpr->cp_cons = 0;
+	cpr->cp_raw_cons = 0;
 	cpr->valid = 0;
 	bnxt_set_db(bp, &cpr->cp_db, ring_type, 0,
-		    cp_ring->fw_ring_id);
+		    cp_ring->fw_ring_id, cp_ring->ring_mask);
 
 	if (BNXT_HAS_NQ(bp))
 		bnxt_db_nq(cpr);
diff --git a/drivers/net/bnxt/bnxt_ring.h b/drivers/net/bnxt/bnxt_ring.h
index 0a4685d16..49ae5c3c6 100644
--- a/drivers/net/bnxt/bnxt_ring.h
+++ b/drivers/net/bnxt/bnxt_ring.h
@@ -10,8 +10,9 @@
 
 #include <rte_memory.h>
 
-#define RING_ADV(ring, idx, n)		(((idx) + (n)) & (ring)->ring_mask)
-#define RING_NEXT(ring, idx)		RING_ADV(ring, idx, 1)
+#define RING_ADV(idx, n)		((idx) + (n))
+#define RING_NEXT(idx)			RING_ADV(idx, 1)
+#define RING_IDX(ring, idx)		((idx) & (ring)->ring_mask)
 
 #define DB_IDX_MASK						0xffffff
 #define DB_IDX_VALID						(0x1 << 26)
@@ -82,38 +83,51 @@ void bnxt_free_rxtx_nq_ring(struct bnxt *bp);
 
 static inline void bnxt_db_write(struct bnxt_db_info *db, uint32_t idx)
 {
-	if (db->db_64)
-		rte_write64(db->db_key64 | idx, db->doorbell);
-	else
-		rte_write32(db->db_key32 | idx, db->doorbell);
+	uint32_t db_idx = DB_RING_IDX(db, idx);
+	void *doorbell = db->doorbell;
+
+	if (db->db_64) {
+		uint64_t key_idx = db->db_key64 | db_idx;
+
+		rte_write64(key_idx, doorbell);
+	} else {
+		uint32_t key_idx = db->db_key32 | db_idx;
+
+		rte_write32(key_idx, doorbell);
+	}
 }
 
 /* Ring an NQ doorbell and disable interrupts for the ring. */
 static inline void bnxt_db_nq(struct bnxt_cp_ring_info *cpr)
 {
+	uint32_t db_idx = DB_RING_IDX(&cpr->cp_db, cpr->cp_raw_cons);
+	uint64_t key_idx = cpr->cp_db.db_key64 | DBR_TYPE_NQ | db_idx;
+	void *doorbell = cpr->cp_db.doorbell;
+
+
 	if (unlikely(!cpr->cp_db.db_64))
 		return;
 
-	rte_write64(cpr->cp_db.db_key64 | DBR_TYPE_NQ |
-		    RING_CMP(cpr->cp_ring_struct, cpr->cp_raw_cons),
-		    cpr->cp_db.doorbell);
+	rte_write64(key_idx, doorbell);
 }
 
 /* Ring an NQ doorbell and enable interrupts for the ring. */
 static inline void bnxt_db_nq_arm(struct bnxt_cp_ring_info *cpr)
 {
+	uint32_t db_idx = DB_RING_IDX(&cpr->cp_db, cpr->cp_raw_cons);
+	uint64_t key_idx = cpr->cp_db.db_key64 | DBR_TYPE_NQ_ARM | db_idx;
+	void *doorbell = cpr->cp_db.doorbell;
+
 	if (unlikely(!cpr->cp_db.db_64))
 		return;
 
-	rte_write64(cpr->cp_db.db_key64 | DBR_TYPE_NQ_ARM |
-		    RING_CMP(cpr->cp_ring_struct, cpr->cp_raw_cons),
-		    cpr->cp_db.doorbell);
+	rte_write64(key_idx, doorbell);
 }
 
 static inline void bnxt_db_cq(struct bnxt_cp_ring_info *cpr)
 {
 	struct bnxt_db_info *db = &cpr->cp_db;
-	uint32_t idx = RING_CMP(cpr->cp_ring_struct, cpr->cp_raw_cons);
+	uint32_t idx = DB_RING_IDX(&cpr->cp_db, cpr->cp_raw_cons);
 
 	if (db->db_64) {
 		uint64_t key_idx = db->db_key64 | idx;
diff --git a/drivers/net/bnxt/bnxt_rxr.c b/drivers/net/bnxt/bnxt_rxr.c
index e9c4fffed..445e6150d 100644
--- a/drivers/net/bnxt/bnxt_rxr.c
+++ b/drivers/net/bnxt/bnxt_rxr.c
@@ -39,12 +39,15 @@ static inline struct rte_mbuf *__bnxt_alloc_rx_data(struct rte_mempool *mb)
 
 static inline int bnxt_alloc_rx_data(struct bnxt_rx_queue *rxq,
 				     struct bnxt_rx_ring_info *rxr,
-				     uint16_t prod)
+				     uint16_t raw_prod)
 {
-	struct rx_prod_pkt_bd *rxbd = &rxr->rx_desc_ring[prod];
-	struct rte_mbuf **rx_buf = &rxr->rx_buf_ring[prod];
+	uint16_t prod = RING_IDX(rxr->rx_ring_struct, raw_prod);
+	struct rx_prod_pkt_bd *rxbd;
+	struct rte_mbuf **rx_buf;
 	struct rte_mbuf *mbuf;
 
+	rxbd = &rxr->rx_desc_ring[prod];
+	rx_buf = &rxr->rx_buf_ring[prod];
 	mbuf = __bnxt_alloc_rx_data(rxq->mb_pool);
 	if (!mbuf) {
 		rte_atomic64_inc(&rxq->rx_mbuf_alloc_fail);
@@ -61,12 +64,15 @@ static inline int bnxt_alloc_rx_data(struct bnxt_rx_queue *rxq,
 
 static inline int bnxt_alloc_ag_data(struct bnxt_rx_queue *rxq,
 				     struct bnxt_rx_ring_info *rxr,
-				     uint16_t prod)
+				     uint16_t raw_prod)
 {
-	struct rx_prod_pkt_bd *rxbd = &rxr->ag_desc_ring[prod];
-	struct rte_mbuf **rx_buf = &rxr->ag_buf_ring[prod];
+	uint16_t prod = RING_IDX(rxr->ag_ring_struct, raw_prod);
+	struct rx_prod_pkt_bd *rxbd;
+	struct rte_mbuf **rx_buf;
 	struct rte_mbuf *mbuf;
 
+	rxbd = &rxr->ag_desc_ring[prod];
+	rx_buf = &rxr->ag_buf_ring[prod];
 	if (rxbd == NULL) {
 		PMD_DRV_LOG(ERR, "Jumbo Frame. rxbd is NULL\n");
 		return -EINVAL;
@@ -94,10 +100,11 @@ static inline int bnxt_alloc_ag_data(struct bnxt_rx_queue *rxq,
 static inline void bnxt_reuse_rx_mbuf(struct bnxt_rx_ring_info *rxr,
 			       struct rte_mbuf *mbuf)
 {
-	uint16_t prod = RING_NEXT(rxr->rx_ring_struct, rxr->rx_prod);
+	uint16_t prod, raw_prod = RING_NEXT(rxr->rx_raw_prod);
 	struct rte_mbuf **prod_rx_buf;
 	struct rx_prod_pkt_bd *prod_bd;
 
+	prod = RING_IDX(rxr->rx_ring_struct, raw_prod);
 	prod_rx_buf = &rxr->rx_buf_ring[prod];
 
 	RTE_ASSERT(*prod_rx_buf == NULL);
@@ -109,7 +116,7 @@ static inline void bnxt_reuse_rx_mbuf(struct bnxt_rx_ring_info *rxr,
 
 	prod_bd->address = rte_cpu_to_le_64(rte_mbuf_data_iova_default(mbuf));
 
-	rxr->rx_prod = prod;
+	rxr->rx_raw_prod = raw_prod;
 }
 
 static inline
@@ -119,7 +126,7 @@ struct rte_mbuf *bnxt_consume_rx_buf(struct bnxt_rx_ring_info *rxr,
 	struct rte_mbuf **cons_rx_buf;
 	struct rte_mbuf *mbuf;
 
-	cons_rx_buf = &rxr->rx_buf_ring[cons];
+	cons_rx_buf = &rxr->rx_buf_ring[RING_IDX(rxr->rx_ring_struct, cons)];
 	RTE_ASSERT(*cons_rx_buf != NULL);
 	mbuf = *cons_rx_buf;
 	*cons_rx_buf = NULL;
@@ -175,7 +182,7 @@ static void bnxt_tpa_start(struct bnxt_rx_queue *rxq,
 		mbuf->ol_flags |= PKT_RX_L4_CKSUM_GOOD;
 
 	/* recycle next mbuf */
-	data_cons = RING_NEXT(rxr->rx_ring_struct, data_cons);
+	data_cons = RING_NEXT(data_cons);
 	bnxt_reuse_rx_mbuf(rxr, bnxt_consume_rx_buf(rxr, data_cons));
 }
 
@@ -198,18 +205,20 @@ static int bnxt_agg_bufs_valid(struct bnxt_cp_ring_info *cpr,
 static int bnxt_prod_ag_mbuf(struct bnxt_rx_queue *rxq)
 {
 	struct bnxt_rx_ring_info *rxr = rxq->rx_ring;
-	uint16_t next = RING_NEXT(rxr->ag_ring_struct, rxr->ag_prod);
+	uint16_t raw_next = RING_NEXT(rxr->ag_raw_prod);
+	uint16_t bmap_next = RING_IDX(rxr->ag_ring_struct, raw_next);
 
 	/* TODO batch allocation for better performance */
-	while (rte_bitmap_get(rxr->ag_bitmap, next)) {
-		if (unlikely(bnxt_alloc_ag_data(rxq, rxr, next))) {
-			PMD_DRV_LOG(ERR,
-				"agg mbuf alloc failed: prod=0x%x\n", next);
+	while (rte_bitmap_get(rxr->ag_bitmap, bmap_next)) {
+		if (unlikely(bnxt_alloc_ag_data(rxq, rxr, raw_next))) {
+			PMD_DRV_LOG(ERR, "agg mbuf alloc failed: prod=0x%x\n",
+				    raw_next);
 			break;
 		}
-		rte_bitmap_clear(rxr->ag_bitmap, next);
-		rxr->ag_prod = next;
-		next = RING_NEXT(rxr->ag_ring_struct, next);
+		rte_bitmap_clear(rxr->ag_bitmap, bmap_next);
+		rxr->ag_raw_prod = raw_next;
+		raw_next = RING_NEXT(raw_next);
+		bmap_next = RING_IDX(rxr->ag_ring_struct, raw_next);
 	}
 
 	return 0;
@@ -666,7 +675,7 @@ static int bnxt_rx_pkt(struct rte_mbuf **rx_pkt,
 	struct rx_pkt_cmpl *rxcmp;
 	struct rx_pkt_cmpl_hi *rxcmp1;
 	uint32_t tmp_raw_cons = *raw_cons;
-	uint16_t cons, prod, cp_cons =
+	uint16_t cons, raw_prod, cp_cons =
 	    RING_CMP(cpr->cp_ring_struct, tmp_raw_cons);
 	struct rte_mbuf *mbuf;
 	int rc = 0;
@@ -726,7 +735,7 @@ static int bnxt_rx_pkt(struct rte_mbuf **rx_pkt,
 	if (agg_buf && !bnxt_agg_bufs_valid(cpr, agg_buf, tmp_raw_cons))
 		return -EBUSY;
 
-	prod = rxr->rx_prod;
+	raw_prod = rxr->rx_raw_prod;
 
 	cons = rxcmp->opaque;
 	mbuf = bnxt_consume_rx_buf(rxr, cons);
@@ -786,13 +795,14 @@ static int bnxt_rx_pkt(struct rte_mbuf **rx_pkt,
 	 * calls in favour of a tight loop with the same function being called
 	 * in it.
 	 */
-	prod = RING_NEXT(rxr->rx_ring_struct, prod);
-	if (bnxt_alloc_rx_data(rxq, rxr, prod)) {
-		PMD_DRV_LOG(ERR, "mbuf alloc failed with prod=0x%x\n", prod);
+	raw_prod = RING_NEXT(raw_prod);
+	if (bnxt_alloc_rx_data(rxq, rxr, raw_prod)) {
+		PMD_DRV_LOG(ERR, "mbuf alloc failed with prod=0x%x\n",
+			    raw_prod);
 		rc = -ENOMEM;
 		goto rx;
 	}
-	rxr->rx_prod = prod;
+	rxr->rx_raw_prod = raw_prod;
 
 	if (BNXT_TRUFLOW_EN(bp) && (BNXT_VF_IS_TRUSTED(bp) || BNXT_PF(bp)) &&
 	    vfr_flag) {
@@ -826,13 +836,13 @@ uint16_t bnxt_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts,
 	struct bnxt_rx_queue *rxq = rx_queue;
 	struct bnxt_cp_ring_info *cpr = rxq->cp_ring;
 	struct bnxt_rx_ring_info *rxr = rxq->rx_ring;
+	uint16_t rx_raw_prod = rxr->rx_raw_prod;
+	uint16_t ag_raw_prod = rxr->ag_raw_prod;
 	uint32_t raw_cons = cpr->cp_raw_cons;
 	uint32_t cons;
 	int nb_rx_pkts = 0;
 	int nb_rep_rx_pkts = 0;
 	struct rx_pkt_cmpl *rxcmp;
-	uint16_t prod = rxr->rx_prod;
-	uint16_t ag_prod = rxr->ag_prod;
 	int rc = 0;
 	bool evt = false;
 
@@ -850,8 +860,8 @@ uint16_t bnxt_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts,
 	 */
 	while (unlikely(rxq->rxrearm_nb)) {
 		if (!bnxt_alloc_rx_data(rxq, rxr, rxq->rxrearm_start)) {
-			rxr->rx_prod = rxq->rxrearm_start;
-			bnxt_db_write(&rxr->rx_db, rxr->rx_prod);
+			rxr->rx_raw_prod = rxq->rxrearm_start;
+			bnxt_db_write(&rxr->rx_db, rxr->rx_raw_prod);
 			rxq->rxrearm_start++;
 			rxq->rxrearm_nb--;
 		} else {
@@ -895,7 +905,7 @@ uint16_t bnxt_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts,
 			break;
 		/* Post some Rx buf early in case of larger burst processing */
 		if (nb_rx_pkts == BNXT_RX_POST_THRESH)
-			bnxt_db_write(&rxr->rx_db, rxr->rx_prod);
+			bnxt_db_write(&rxr->rx_db, rxr->rx_raw_prod);
 	}
 
 	cpr->cp_raw_cons = raw_cons;
@@ -907,23 +917,27 @@ uint16_t bnxt_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts,
 		goto done;
 	}
 
-	if (prod != rxr->rx_prod)
-		bnxt_db_write(&rxr->rx_db, rxr->rx_prod);
+	rte_compiler_barrier();
+	if (rx_raw_prod != rxr->rx_raw_prod)
+		bnxt_db_write(&rxr->rx_db, rxr->rx_raw_prod);
 
+	rte_compiler_barrier();
 	/* Ring the AGG ring DB */
-	if (ag_prod != rxr->ag_prod)
-		bnxt_db_write(&rxr->ag_db, rxr->ag_prod);
+	if (ag_raw_prod != rxr->ag_raw_prod)
+		bnxt_db_write(&rxr->ag_db, rxr->ag_raw_prod);
 
 	bnxt_db_cq(cpr);
 
 	/* Attempt to alloc Rx buf in case of a previous allocation failure. */
 	if (rc == -ENOMEM) {
-		int i = RING_NEXT(rxr->rx_ring_struct, prod);
+		int i = RING_NEXT(rx_raw_prod);
 		int cnt = nb_rx_pkts;
 
-		for (; cnt;
-			i = RING_NEXT(rxr->rx_ring_struct, i), cnt--) {
-			struct rte_mbuf **rx_buf = &rxr->rx_buf_ring[i];
+		for (; nb_rx_pkts; i = RING_NEXT(i), cnt--) {
+			struct rte_mbuf **rx_buf;
+			uint16_t rx_raw_prod = RING_IDX(rxr->rx_ring_struct, i);
+
+			rx_buf = &rxr->rx_buf_ring[rx_raw_prod];
 
 			/* Buffer already allocated for this index. */
 			if (*rx_buf != NULL && *rx_buf != &rxq->fake_mbuf)
@@ -931,8 +945,8 @@ uint16_t bnxt_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts,
 
 			/* This slot is empty. Alloc buffer for Rx */
 			if (!bnxt_alloc_rx_data(rxq, rxr, i)) {
-				rxr->rx_prod = i;
-				bnxt_db_write(&rxr->rx_db, rxr->rx_prod);
+				rxr->rx_raw_prod = i;
+				bnxt_db_write(&rxr->rx_db, rxr->rx_raw_prod);
 			} else {
 				PMD_DRV_LOG(ERR, "Alloc  mbuf failed\n");
 				break;
@@ -1100,7 +1114,7 @@ int bnxt_init_one_rx_ring(struct bnxt_rx_queue *rxq)
 {
 	struct bnxt_rx_ring_info *rxr;
 	struct bnxt_ring *ring;
-	uint32_t prod, type;
+	uint32_t raw_prod, type;
 	unsigned int i;
 	uint16_t size;
 
@@ -1119,18 +1133,18 @@ int bnxt_init_one_rx_ring(struct bnxt_rx_queue *rxq)
 	ring = rxr->rx_ring_struct;
 	bnxt_init_rxbds(ring, type, size);
 
-	prod = rxr->rx_prod;
+	raw_prod = rxr->rx_raw_prod;
 	for (i = 0; i < ring->ring_size; i++) {
 		if (unlikely(!rxr->rx_buf_ring[i])) {
-			if (bnxt_alloc_rx_data(rxq, rxr, prod) != 0) {
+			if (bnxt_alloc_rx_data(rxq, rxr, raw_prod) != 0) {
 				PMD_DRV_LOG(WARNING,
 					    "init'ed rx ring %d with %d/%d mbufs only\n",
 					    rxq->queue_id, i, ring->ring_size);
 				break;
 			}
 		}
-		rxr->rx_prod = prod;
-		prod = RING_NEXT(rxr->rx_ring_struct, prod);
+		rxr->rx_raw_prod = raw_prod;
+		raw_prod = RING_NEXT(raw_prod);
 	}
 
 	/* Initialize dummy mbuf pointers for vector mode rx. */
@@ -1142,19 +1156,19 @@ int bnxt_init_one_rx_ring(struct bnxt_rx_queue *rxq)
 	ring = rxr->ag_ring_struct;
 	type = RX_PROD_AGG_BD_TYPE_RX_PROD_AGG;
 	bnxt_init_rxbds(ring, type, size);
-	prod = rxr->ag_prod;
+	raw_prod = rxr->ag_raw_prod;
 
 	for (i = 0; i < ring->ring_size; i++) {
 		if (unlikely(!rxr->ag_buf_ring[i])) {
-			if (bnxt_alloc_ag_data(rxq, rxr, prod) != 0) {
+			if (bnxt_alloc_ag_data(rxq, rxr, raw_prod) != 0) {
 				PMD_DRV_LOG(WARNING,
 					    "init'ed AG ring %d with %d/%d mbufs only\n",
 					    rxq->queue_id, i, ring->ring_size);
 				break;
 			}
 		}
-		rxr->ag_prod = prod;
-		prod = RING_NEXT(rxr->ag_ring_struct, prod);
+		rxr->ag_raw_prod = raw_prod;
+		raw_prod = RING_NEXT(raw_prod);
 	}
 	PMD_DRV_LOG(DEBUG, "AGG Done!\n");
 
diff --git a/drivers/net/bnxt/bnxt_rxr.h b/drivers/net/bnxt/bnxt_rxr.h
index 2a53cf87b..af6ff0972 100644
--- a/drivers/net/bnxt/bnxt_rxr.h
+++ b/drivers/net/bnxt/bnxt_rxr.h
@@ -50,8 +50,8 @@ struct bnxt_tpa_info {
 };
 
 struct bnxt_rx_ring_info {
-	uint16_t		rx_prod;
-	uint16_t		ag_prod;
+	uint16_t		rx_raw_prod;
+	uint16_t		ag_raw_prod;
 	uint16_t                rx_cons; /* Needed for representor */
 	struct bnxt_db_info     rx_db;
 	struct bnxt_db_info     ag_db;
diff --git a/drivers/net/bnxt/bnxt_rxtx_vec_common.h b/drivers/net/bnxt/bnxt_rxtx_vec_common.h
index d540e9eee..202291202 100644
--- a/drivers/net/bnxt/bnxt_rxtx_vec_common.h
+++ b/drivers/net/bnxt/bnxt_rxtx_vec_common.h
@@ -105,21 +105,21 @@ bnxt_tx_cmp_vec_fast(struct bnxt_tx_queue *txq, int nr_pkts)
 	struct bnxt_tx_ring_info *txr = txq->tx_ring;
 	uint32_t ring_mask = txr->tx_ring_struct->ring_mask;
 	struct rte_mbuf **free = txq->free;
-	uint16_t cons = txr->tx_cons;
+	uint16_t raw_cons = txr->tx_raw_cons;
 	unsigned int blk = 0;
 
 	while (nr_pkts--) {
 		struct bnxt_sw_tx_bd *tx_buf;
 
-		tx_buf = &txr->tx_buf_ring[cons];
-		cons = (cons + 1) & ring_mask;
+		raw_cons = (raw_cons + 1) & ring_mask;
+		tx_buf = &txr->tx_buf_ring[raw_cons];
 		free[blk++] = tx_buf->mbuf;
 		tx_buf->mbuf = NULL;
 	}
 	if (blk)
 		rte_mempool_put_bulk(free[0]->pool, (void **)free, blk);
 
-	txr->tx_cons = cons;
+	txr->tx_raw_cons = raw_cons;
 }
 
 static inline void
@@ -127,7 +127,7 @@ bnxt_tx_cmp_vec(struct bnxt_tx_queue *txq, int nr_pkts)
 {
 	struct bnxt_tx_ring_info *txr = txq->tx_ring;
 	struct rte_mbuf **free = txq->free;
-	uint16_t cons = txr->tx_cons;
+	uint16_t raw_cons = txr->tx_raw_cons;
 	unsigned int blk = 0;
 	uint32_t ring_mask = txr->tx_ring_struct->ring_mask;
 
@@ -135,8 +135,8 @@ bnxt_tx_cmp_vec(struct bnxt_tx_queue *txq, int nr_pkts)
 		struct bnxt_sw_tx_bd *tx_buf;
 		struct rte_mbuf *mbuf;
 
-		tx_buf = &txr->tx_buf_ring[cons];
-		cons = (cons + 1) & ring_mask;
+		raw_cons = (raw_cons + 1) & ring_mask;
+		tx_buf = &txr->tx_buf_ring[raw_cons];
 		mbuf = rte_pktmbuf_prefree_seg(tx_buf->mbuf);
 		if (unlikely(mbuf == NULL))
 			continue;
@@ -151,6 +151,6 @@ bnxt_tx_cmp_vec(struct bnxt_tx_queue *txq, int nr_pkts)
 	if (blk)
 		rte_mempool_put_bulk(free[0]->pool, (void **)free, blk);
 
-	txr->tx_cons = cons;
+	txr->tx_raw_cons = raw_cons;
 }
 #endif /* _BNXT_RXTX_VEC_COMMON_H_ */
diff --git a/drivers/net/bnxt/bnxt_rxtx_vec_neon.c b/drivers/net/bnxt/bnxt_rxtx_vec_neon.c
index de1d96570..81f9a7da2 100644
--- a/drivers/net/bnxt/bnxt_rxtx_vec_neon.c
+++ b/drivers/net/bnxt/bnxt_rxtx_vec_neon.c
@@ -295,8 +295,7 @@ bnxt_recv_pkts_vec(void *rx_queue, struct rte_mbuf **rx_pkts,
 
 out:
 	if (nb_rx_pkts) {
-		rxr->rx_prod =
-			RING_ADV(rxr->rx_ring_struct, rxr->rx_prod, nb_rx_pkts);
+		rxr->rx_raw_prod = RING_ADV(rxr->rx_raw_prod, nb_rx_pkts);
 
 		rxq->rxrearm_nb += nb_rx_pkts;
 		cpr->cp_raw_cons += 2 * nb_rx_pkts;
@@ -353,7 +352,7 @@ bnxt_xmit_fixed_burst_vec(void *tx_queue, struct rte_mbuf **tx_pkts,
 {
 	struct bnxt_tx_queue *txq = tx_queue;
 	struct bnxt_tx_ring_info *txr = txq->tx_ring;
-	uint16_t prod = txr->tx_prod;
+	uint16_t tx_prod, tx_raw_prod = txr->tx_raw_prod;
 	struct rte_mbuf *tx_mbuf;
 	struct tx_bd_long *txbd = NULL;
 	struct bnxt_sw_tx_bd *tx_buf;
@@ -370,16 +369,17 @@ bnxt_xmit_fixed_burst_vec(void *tx_queue, struct rte_mbuf **tx_pkts,
 		tx_mbuf = *tx_pkts++;
 		rte_prefetch0(tx_mbuf);
 
-		tx_buf = &txr->tx_buf_ring[prod];
+		tx_prod = RING_IDX(txr->tx_ring_struct, tx_raw_prod);
+		tx_buf = &txr->tx_buf_ring[tx_prod];
 		tx_buf->mbuf = tx_mbuf;
 		tx_buf->nr_bds = 1;
 
-		txbd = &txr->tx_desc_ring[prod];
+		txbd = &txr->tx_desc_ring[tx_prod];
 		txbd->address = tx_mbuf->buf_iova + tx_mbuf->data_off;
 		txbd->len = tx_mbuf->data_len;
 		txbd->flags_type = bnxt_xmit_flags_len(tx_mbuf->data_len,
 						       TX_BD_FLAGS_NOCMPL);
-		prod = RING_NEXT(txr->tx_ring_struct, prod);
+		tx_raw_prod = RING_NEXT(tx_raw_prod);
 		to_send--;
 	}
 
@@ -390,9 +390,9 @@ bnxt_xmit_fixed_burst_vec(void *tx_queue, struct rte_mbuf **tx_pkts,
 	}
 
 	rte_compiler_barrier();
-	bnxt_db_write(&txr->tx_db, prod);
+	bnxt_db_write(&txr->tx_db, tx_raw_prod);
 
-	txr->tx_prod = prod;
+	txr->tx_raw_prod = tx_raw_prod;
 
 	return nb_pkts;
 }
diff --git a/drivers/net/bnxt/bnxt_rxtx_vec_sse.c b/drivers/net/bnxt/bnxt_rxtx_vec_sse.c
index e12bf8bb7..ce92629ab 100644
--- a/drivers/net/bnxt/bnxt_rxtx_vec_sse.c
+++ b/drivers/net/bnxt/bnxt_rxtx_vec_sse.c
@@ -277,8 +277,7 @@ bnxt_recv_pkts_vec(void *rx_queue, struct rte_mbuf **rx_pkts,
 
 out:
 	if (nb_rx_pkts) {
-		rxr->rx_prod =
-			RING_ADV(rxr->rx_ring_struct, rxr->rx_prod, nb_rx_pkts);
+		rxr->rx_raw_prod = RING_ADV(rxr->rx_raw_prod, nb_rx_pkts);
 
 		rxq->rxrearm_nb += nb_rx_pkts;
 		cpr->cp_raw_cons += 2 * nb_rx_pkts;
@@ -351,11 +350,12 @@ bnxt_xmit_fixed_burst_vec(struct bnxt_tx_queue *txq, struct rte_mbuf **tx_pkts,
 			  uint16_t nb_pkts)
 {
 	struct bnxt_tx_ring_info *txr = txq->tx_ring;
-	uint16_t tx_prod = txr->tx_prod;
+	uint16_t tx_prod, tx_raw_prod = txr->tx_raw_prod;
 	struct tx_bd_long *txbd;
 	struct bnxt_sw_tx_bd *tx_buf;
 	uint16_t to_send;
 
+	tx_prod = RING_IDX(txr->tx_ring_struct, tx_raw_prod);
 	txbd = &txr->tx_desc_ring[tx_prod];
 	tx_buf = &txr->tx_buf_ring[tx_prod];
 
@@ -395,10 +395,10 @@ bnxt_xmit_fixed_burst_vec(struct bnxt_tx_queue *txq, struct rte_mbuf **tx_pkts,
 	txbd[-1].opaque = nb_pkts;
 	txbd[-1].flags_type &= ~TX_BD_LONG_FLAGS_NO_CMPL;
 
-	tx_prod = RING_ADV(txr->tx_ring_struct, tx_prod, nb_pkts);
-	bnxt_db_write(&txr->tx_db, tx_prod);
+	tx_raw_prod += nb_pkts;
+	bnxt_db_write(&txr->tx_db, tx_raw_prod);
 
-	txr->tx_prod = tx_prod;
+	txr->tx_raw_prod = tx_raw_prod;
 
 	return nb_pkts;
 }
@@ -435,8 +435,8 @@ bnxt_xmit_pkts_vec(void *tx_queue, struct rte_mbuf **tx_pkts,
 		 * Ensure that a ring wrap does not occur within a call to
 		 * bnxt_xmit_fixed_burst_vec().
 		 */
-		num = RTE_MIN(num,
-			      ring_size - (txr->tx_prod & (ring_size - 1)));
+		num = RTE_MIN(num, ring_size -
+				   (txr->tx_raw_prod & (ring_size - 1)));
 		ret = bnxt_xmit_fixed_burst_vec(txq, &tx_pkts[nb_sent], num);
 		nb_sent += ret;
 		nb_pkts -= ret;
diff --git a/drivers/net/bnxt/bnxt_txr.c b/drivers/net/bnxt/bnxt_txr.c
index fb358d6f1..9cf0126d2 100644
--- a/drivers/net/bnxt/bnxt_txr.c
+++ b/drivers/net/bnxt/bnxt_txr.c
@@ -110,12 +110,14 @@ static uint16_t bnxt_start_xmit(struct rte_mbuf *tx_pkt,
 				struct tx_bd_long **last_txbd)
 {
 	struct bnxt_tx_ring_info *txr = txq->tx_ring;
+	struct bnxt_ring *ring = txr->tx_ring_struct;
 	uint32_t outer_tpid_bd = 0;
 	struct tx_bd_long *txbd;
 	struct tx_bd_long_hi *txbd1 = NULL;
 	uint32_t vlan_tag_flags;
 	bool long_bd = false;
 	unsigned short nr_bds = 0;
+	uint16_t prod;
 	struct rte_mbuf *m_seg;
 	struct bnxt_sw_tx_bd *tx_buf;
 	static const uint32_t lhint_arr[4] = {
@@ -168,11 +170,12 @@ static uint16_t bnxt_start_xmit(struct rte_mbuf *tx_pkt,
 	/* Check non zero data_len */
 	RTE_VERIFY(tx_pkt->data_len);
 
-	tx_buf = &txr->tx_buf_ring[txr->tx_prod];
+	prod = RING_IDX(ring, txr->tx_raw_prod);
+	tx_buf = &txr->tx_buf_ring[prod];
 	tx_buf->mbuf = tx_pkt;
 	tx_buf->nr_bds = nr_bds;
 
-	txbd = &txr->tx_desc_ring[txr->tx_prod];
+	txbd = &txr->tx_desc_ring[prod];
 	txbd->opaque = *coal_pkts;
 	txbd->flags_type = nr_bds << TX_BD_LONG_FLAGS_BD_CNT_SFT;
 	txbd->flags_type |= TX_BD_SHORT_FLAGS_COAL_NOW;
@@ -210,10 +213,10 @@ static uint16_t bnxt_start_xmit(struct rte_mbuf *tx_pkt,
 					TX_BD_LONG_CFA_META_VLAN_TPID_TPID8100;
 		}
 
-		txr->tx_prod = RING_NEXT(txr->tx_ring_struct, txr->tx_prod);
+		txr->tx_raw_prod = RING_NEXT(txr->tx_raw_prod);
 
-		txbd1 = (struct tx_bd_long_hi *)
-					&txr->tx_desc_ring[txr->tx_prod];
+		prod = RING_IDX(ring, txr->tx_raw_prod);
+		txbd1 = (struct tx_bd_long_hi *)&txr->tx_desc_ring[prod];
 		txbd1->lflags = 0;
 		txbd1->cfa_meta = vlan_tag_flags;
 		/* Legacy tx_bd_long_hi->mss =
@@ -318,11 +321,13 @@ static uint16_t bnxt_start_xmit(struct rte_mbuf *tx_pkt,
 	while (m_seg) {
 		/* Check non zero data_len */
 		RTE_VERIFY(m_seg->data_len);
-		txr->tx_prod = RING_NEXT(txr->tx_ring_struct, txr->tx_prod);
-		tx_buf = &txr->tx_buf_ring[txr->tx_prod];
+		txr->tx_raw_prod = RING_NEXT(txr->tx_raw_prod);
+
+		prod = RING_IDX(ring, txr->tx_raw_prod);
+		tx_buf = &txr->tx_buf_ring[prod];
 		tx_buf->mbuf = m_seg;
 
-		txbd = &txr->tx_desc_ring[txr->tx_prod];
+		txbd = &txr->tx_desc_ring[prod];
 		txbd->address = rte_cpu_to_le_64(rte_mbuf_data_iova(m_seg));
 		txbd->flags_type = TX_BD_SHORT_TYPE_TX_BD_SHORT;
 		txbd->len = m_seg->data_len;
@@ -332,7 +337,7 @@ static uint16_t bnxt_start_xmit(struct rte_mbuf *tx_pkt,
 
 	txbd->flags_type |= TX_BD_LONG_FLAGS_PACKET_END;
 
-	txr->tx_prod = RING_NEXT(txr->tx_ring_struct, txr->tx_prod);
+	txr->tx_raw_prod = RING_NEXT(txr->tx_raw_prod);
 
 	return 0;
 }
@@ -344,8 +349,9 @@ static uint16_t bnxt_start_xmit(struct rte_mbuf *tx_pkt,
 static void bnxt_tx_cmp_fast(struct bnxt_tx_queue *txq, int nr_pkts)
 {
 	struct bnxt_tx_ring_info *txr = txq->tx_ring;
+	struct bnxt_ring *ring = txr->tx_ring_struct;
 	struct rte_mbuf **free = txq->free;
-	uint16_t cons = txr->tx_cons;
+	uint16_t raw_cons = txr->tx_raw_cons;
 	unsigned int blk = 0;
 	int i, j;
 
@@ -353,7 +359,7 @@ static void bnxt_tx_cmp_fast(struct bnxt_tx_queue *txq, int nr_pkts)
 		struct bnxt_sw_tx_bd *tx_buf;
 		unsigned short nr_bds;
 
-		tx_buf = &txr->tx_buf_ring[cons];
+		tx_buf = &txr->tx_buf_ring[RING_IDX(ring, raw_cons)];
 		nr_bds = tx_buf->nr_bds;
 		for (j = 0; j < nr_bds; j++) {
 			if (tx_buf->mbuf) {
@@ -361,35 +367,38 @@ static void bnxt_tx_cmp_fast(struct bnxt_tx_queue *txq, int nr_pkts)
 				free[blk++] = tx_buf->mbuf;
 				tx_buf->mbuf = NULL;
 			}
-			cons = RING_NEXT(txr->tx_ring_struct, cons);
-			tx_buf = &txr->tx_buf_ring[cons];
+			raw_cons = RING_NEXT(raw_cons);
+			tx_buf = &txr->tx_buf_ring[RING_IDX(ring, raw_cons)];
 		}
 	}
 	if (blk)
 		rte_mempool_put_bulk(free[0]->pool, (void *)free, blk);
 
-	txr->tx_cons = cons;
+	txr->tx_raw_cons = raw_cons;
 }
 
 static void bnxt_tx_cmp(struct bnxt_tx_queue *txq, int nr_pkts)
 {
 	struct bnxt_tx_ring_info *txr = txq->tx_ring;
+	struct bnxt_ring *ring = txr->tx_ring_struct;
 	struct rte_mempool *pool = NULL;
 	struct rte_mbuf **free = txq->free;
-	uint16_t cons = txr->tx_cons;
+	uint16_t raw_cons = txr->tx_raw_cons;
 	unsigned int blk = 0;
 	int i, j;
 
 	for (i = 0; i < nr_pkts; i++) {
 		struct rte_mbuf *mbuf;
-		struct bnxt_sw_tx_bd *tx_buf = &txr->tx_buf_ring[cons];
-		unsigned short nr_bds = tx_buf->nr_bds;
+		struct bnxt_sw_tx_bd *tx_buf;
+		unsigned short nr_bds;
 
+		tx_buf = &txr->tx_buf_ring[RING_IDX(ring, raw_cons)];
+		nr_bds = tx_buf->nr_bds;
 		for (j = 0; j < nr_bds; j++) {
 			mbuf = tx_buf->mbuf;
 			tx_buf->mbuf = NULL;
-			cons = RING_NEXT(txr->tx_ring_struct, cons);
-			tx_buf = &txr->tx_buf_ring[cons];
+			raw_cons = RING_NEXT(raw_cons);
+			tx_buf = &txr->tx_buf_ring[RING_IDX(ring, raw_cons)];
 			if (!mbuf)	/* long_bd's tx_buf ? */
 				continue;
 
@@ -422,7 +431,7 @@ static void bnxt_tx_cmp(struct bnxt_tx_queue *txq, int nr_pkts)
 	if (blk)
 		rte_mempool_put_bulk(pool, (void *)free, blk);
 
-	txr->tx_cons = cons;
+	txr->tx_raw_cons = raw_cons;
 }
 
 static int bnxt_handle_tx_cp(struct bnxt_tx_queue *txq)
@@ -504,7 +513,7 @@ uint16_t bnxt_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
 	if (likely(nb_tx_pkts)) {
 		/* Request a completion on the last packet */
 		last_txbd->flags_type &= ~TX_BD_LONG_FLAGS_NO_CMPL;
-		bnxt_db_write(&txq->tx_ring->tx_db, txq->tx_ring->tx_prod);
+		bnxt_db_write(&txq->tx_ring->tx_db, txq->tx_ring->tx_raw_prod);
 	}
 
 	return nb_tx_pkts;
diff --git a/drivers/net/bnxt/bnxt_txr.h b/drivers/net/bnxt/bnxt_txr.h
index 3dfc8ef9b..447c68b7d 100644
--- a/drivers/net/bnxt/bnxt_txr.h
+++ b/drivers/net/bnxt/bnxt_txr.h
@@ -12,8 +12,8 @@
 #define BNXT_MIN_PKT_SIZE	52
 
 struct bnxt_tx_ring_info {
-	uint16_t		tx_prod;
-	uint16_t		tx_cons;
+	uint16_t		tx_raw_prod;
+	uint16_t		tx_raw_cons;
 	struct bnxt_db_info     tx_db;
 
 	struct tx_bd_long	*tx_desc_ring;
@@ -31,7 +31,7 @@ struct bnxt_sw_tx_bd {
 
 static inline uint32_t bnxt_tx_bds_in_hw(struct bnxt_tx_queue *txq)
 {
-	return ((txq->tx_ring->tx_prod - txq->tx_ring->tx_cons) &
+	return ((txq->tx_ring->tx_raw_prod - txq->tx_ring->tx_raw_cons) &
 		txq->tx_ring->tx_ring_struct->ring_mask);
 }
 
-- 
2.21.1 (Apple Git-122.3)


^ permalink raw reply	[flat|nested] 47+ messages in thread

* Re: [dpdk-dev] [PATCH v2 17/17] net/bnxt: modify ring index logic
  2020-12-09 19:22 ` [dpdk-dev] [PATCH v2 17/17] net/bnxt: modify ring index logic Ajit Khaparde
@ 2020-12-09 20:49   ` Lance Richardson
  0 siblings, 0 replies; 47+ messages in thread
From: Lance Richardson @ 2020-12-09 20:49 UTC (permalink / raw)
  To: Ajit Khaparde; +Cc: dev

On Wed, Dec 9, 2020 at 2:28 PM Ajit Khaparde <ajitkhaparde@gmail.com> wrote:
>
> Change the ring logic so that the index increments
> unbounded and mask it only when needed.
>
> Modify the existing macros so that the index is not masked.
> Add a new macro RING_IDX() to mask it only when needed.
>
> Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
> ---

<snip>

> index d540e9eee..202291202 100644
> --- a/drivers/net/bnxt/bnxt_rxtx_vec_common.h
> +++ b/drivers/net/bnxt/bnxt_rxtx_vec_common.h
> @@ -105,21 +105,21 @@ bnxt_tx_cmp_vec_fast(struct bnxt_tx_queue *txq, int nr_pkts)
>         struct bnxt_tx_ring_info *txr = txq->tx_ring;
>         uint32_t ring_mask = txr->tx_ring_struct->ring_mask;
>         struct rte_mbuf **free = txq->free;
> -       uint16_t cons = txr->tx_cons;
> +       uint16_t raw_cons = txr->tx_raw_cons;
>         unsigned int blk = 0;
>
>         while (nr_pkts--) {
>                 struct bnxt_sw_tx_bd *tx_buf;
>
> -               tx_buf = &txr->tx_buf_ring[cons];
> -               cons = (cons + 1) & ring_mask;
> +               raw_cons = (raw_cons + 1) & ring_mask;
> +               tx_buf = &txr->tx_buf_ring[raw_cons];

If the intention is (as stated in the commit log) to track the unmasked
index and only mask it when needed, this does not accomplish that,
and if the naming convention is for "raw" indices to refer to the unmasked
version, this might be misleading. Maybe change to this:
                 raw_cons = RING_NEXT(raw_cons);
                 tx_buf = &txr->tx_buf_ring[raw_cons & ring_mask];

>                 free[blk++] = tx_buf->mbuf;
>                 tx_buf->mbuf = NULL;
>         }
>         if (blk)
>                 rte_mempool_put_bulk(free[0]->pool, (void **)free, blk);
>
> -       txr->tx_cons = cons;
> +       txr->tx_raw_cons = raw_cons;
>  }
>
>  static inline void
> @@ -127,7 +127,7 @@ bnxt_tx_cmp_vec(struct bnxt_tx_queue *txq, int nr_pkts)
>  {
>         struct bnxt_tx_ring_info *txr = txq->tx_ring;
>         struct rte_mbuf **free = txq->free;
> -       uint16_t cons = txr->tx_cons;
> +       uint16_t raw_cons = txr->tx_raw_cons;
>         unsigned int blk = 0;
>         uint32_t ring_mask = txr->tx_ring_struct->ring_mask;
>
> @@ -135,8 +135,8 @@ bnxt_tx_cmp_vec(struct bnxt_tx_queue *txq, int nr_pkts)
>                 struct bnxt_sw_tx_bd *tx_buf;
>                 struct rte_mbuf *mbuf;
>
> -               tx_buf = &txr->tx_buf_ring[cons];
> -               cons = (cons + 1) & ring_mask;
> +               raw_cons = (raw_cons + 1) & ring_mask;
> +               tx_buf = &txr->tx_buf_ring[raw_cons];

See previous comment.

>                 mbuf = rte_pktmbuf_prefree_seg(tx_buf->mbuf);
>                 if (unlikely(mbuf == NULL))
>                         continue;
> @@ -151,6 +151,6 @@ bnxt_tx_cmp_vec(struct bnxt_tx_queue *txq, int nr_pkts)
>         if (blk)
>                 rte_mempool_put_bulk(free[0]->pool, (void **)free, blk);
>
> -       txr->tx_cons = cons;
> +       txr->tx_raw_cons = raw_cons;
>  }
>  #endif /* _BNXT_RXTX_VEC_COMMON_H_ */

^ permalink raw reply	[flat|nested] 47+ messages in thread

* [dpdk-dev] [PATCH v3 00/17] fixes and refactoring changes for bnxt
  2020-12-09 19:22 [dpdk-dev] [PATCH v2 00/17] fixes and refactoring changes for bnxt Ajit Khaparde
                   ` (16 preceding siblings ...)
  2020-12-09 19:22 ` [dpdk-dev] [PATCH v2 17/17] net/bnxt: modify ring index logic Ajit Khaparde
@ 2020-12-09 23:53 ` Ajit Khaparde
  2020-12-09 23:53   ` [dpdk-dev] [PATCH v3 01/17] net/bnxt: fix RX rings in RSS redirection table Ajit Khaparde
                     ` (17 more replies)
  17 siblings, 18 replies; 47+ messages in thread
From: Ajit Khaparde @ 2020-12-09 23:53 UTC (permalink / raw)
  To: dev

Some fixes and refactoring changes for bnxt PMD.

v1->v2: Resend without the legal signature/footer.
v2->v3: Fix index calculation in patch 17/17.

Ajit Khaparde (9):
  net/bnxt: remove unused field
  net/bnxt: remove references to Thor
  net/bnxt: fix cleanup on mutex init failure
  net/bnxt: fix format specifier for unsigned int
  net/bnxt: use the right function to free mbuf
  net/bnxt: remove function declaration
  net/bnxt: changes to indentation and coding style
  net/bnxt: add missing comments
  net/bnxt: modify ring index logic

Kalesh AP (3):
  net/bnxt: release hwrm lock in the error case
  net/bnxt: fix to return error when fw command fails
  net/bnxt: fix vnic RSS configure function

Rahul Gupta (1):
  net/bnxt: support for 236 queues in NS3

Samik Gupta (2):
  net/bnxt: fix RX rings in RSS redirection table
  net/bnxt: fix VNIC config on Rx queue stop

Somnath Kotur (1):
  net/bnxt: fix PF resource query

Sriharsha Basavapatna (1):
  net/bnxt: fix max rings computation

 drivers/net/bnxt/bnxt.h                       |  75 +++++++----
 drivers/net/bnxt/bnxt_cpr.h                   |  10 +-
 drivers/net/bnxt/bnxt_ethdev.c                |  78 ++++++-----
 drivers/net/bnxt/bnxt_hwrm.c                  | 127 +++++++++++-------
 drivers/net/bnxt/bnxt_hwrm.h                  |   2 -
 drivers/net/bnxt/bnxt_reps.c                  |   8 +-
 drivers/net/bnxt/bnxt_ring.c                  |  50 +++----
 drivers/net/bnxt/bnxt_ring.h                  |  40 ++++--
 drivers/net/bnxt/bnxt_rxq.c                   |  35 +++--
 drivers/net/bnxt/bnxt_rxr.c                   | 122 +++++++++--------
 drivers/net/bnxt/bnxt_rxr.h                   |   6 +-
 drivers/net/bnxt/bnxt_rxtx_vec_common.h       |  14 +-
 drivers/net/bnxt/bnxt_rxtx_vec_neon.c         |  16 +--
 drivers/net/bnxt/bnxt_rxtx_vec_sse.c          |  16 +--
 drivers/net/bnxt/bnxt_txq.c                   |   2 +-
 drivers/net/bnxt/bnxt_txr.c                   |  51 ++++---
 drivers/net/bnxt/bnxt_txr.h                   |   6 +-
 drivers/net/bnxt/bnxt_vnic.c                  |   4 +-
 drivers/net/bnxt/tf_core/tf_core.c            |   2 +-
 drivers/net/bnxt/tf_ulp/bnxt_ulp.c            |   2 +-
 drivers/net/bnxt/tf_ulp/ulp_template_db_act.c |   5 +
 .../net/bnxt/tf_ulp/ulp_template_db_class.c   |   6 +
 22 files changed, 402 insertions(+), 275 deletions(-)

-- 
2.21.1 (Apple Git-122.3)


^ permalink raw reply	[flat|nested] 47+ messages in thread

* [dpdk-dev] [PATCH v3 01/17] net/bnxt: fix RX rings in RSS redirection table
  2020-12-09 23:53 ` [dpdk-dev] [PATCH v3 00/17] fixes and refactoring changes for bnxt Ajit Khaparde
@ 2020-12-09 23:53   ` Ajit Khaparde
  2020-12-09 23:53   ` [dpdk-dev] [PATCH v3 02/17] net/bnxt: fix VNIC config on Rx queue stop Ajit Khaparde
                     ` (16 subsequent siblings)
  17 siblings, 0 replies; 47+ messages in thread
From: Ajit Khaparde @ 2020-12-09 23:53 UTC (permalink / raw)
  To: dev; +Cc: Samik Gupta, stable

From: Samik Gupta <samik.gupta@broadcom.com>

This commit introduces a limit on the number of RX rings included in
the RSS redirection table to a value no larger than the size supported
by Thor as defined by BNXT_RSS_TBL_SIZE_THOR.

Fixes: d819382543f3 ("net/bnxt: add RSS redirection table operations")
Cc: stable@dpdk.org

Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
Signed-off-by: Samik Gupta <samik.gupta@broadcom.com>
---
 drivers/net/bnxt/bnxt.h        |  2 +-
 drivers/net/bnxt/bnxt_ethdev.c | 15 +++++++++++++--
 2 files changed, 14 insertions(+), 3 deletions(-)

diff --git a/drivers/net/bnxt/bnxt.h b/drivers/net/bnxt/bnxt.h
index 90ced972c..9bd4f1da9 100644
--- a/drivers/net/bnxt/bnxt.h
+++ b/drivers/net/bnxt/bnxt.h
@@ -389,7 +389,7 @@ struct bnxt_coal {
 #define DBR_TYPE_NQ				(0xaULL << 60)
 #define DBR_TYPE_NQ_ARM				(0xbULL << 60)
 
-#define BNXT_RSS_TBL_SIZE_THOR		512
+#define BNXT_RSS_TBL_SIZE_THOR		512U
 #define BNXT_RSS_ENTRIES_PER_CTX_THOR	64
 #define BNXT_MAX_RSS_CTXTS_THOR \
 	(BNXT_RSS_TBL_SIZE_THOR / BNXT_RSS_ENTRIES_PER_CTX_THOR)
diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c
index 81c8f8d79..c363c8427 100644
--- a/drivers/net/bnxt/bnxt_ethdev.c
+++ b/drivers/net/bnxt/bnxt_ethdev.c
@@ -207,12 +207,15 @@ int is_bnxt_in_error(struct bnxt *bp)
 
 static uint16_t bnxt_rss_ctxts(const struct bnxt *bp)
 {
+	unsigned int num_rss_rings = RTE_MIN(bp->rx_nr_rings,
+					     BNXT_RSS_TBL_SIZE_THOR);
+
 	if (!BNXT_CHIP_THOR(bp))
 		return 1;
 
-	return RTE_ALIGN_MUL_CEIL(bp->rx_nr_rings,
+	return RTE_ALIGN_MUL_CEIL(num_rss_rings,
 				  BNXT_RSS_ENTRIES_PER_CTX_THOR) /
-				    BNXT_RSS_ENTRIES_PER_CTX_THOR;
+				  BNXT_RSS_ENTRIES_PER_CTX_THOR;
 }
 
 uint16_t bnxt_rss_hash_tbl_size(const struct bnxt *bp)
@@ -424,6 +427,14 @@ static int bnxt_setup_one_vnic(struct bnxt *bp, uint16_t vnic_id)
 	if (dev_conf->rxmode.mq_mode & ETH_MQ_RX_RSS) {
 		int j, nr_ctxs = bnxt_rss_ctxts(bp);
 
+		if (bp->rx_nr_rings > BNXT_RSS_TBL_SIZE_THOR) {
+			PMD_DRV_LOG(ERR, "RxQ cnt %d > reta_size %d\n",
+				    bp->rx_nr_rings, BNXT_RSS_TBL_SIZE_THOR);
+			PMD_DRV_LOG(ERR,
+				    "Only queues 0-%d will be in RSS table\n",
+				    BNXT_RSS_TBL_SIZE_THOR - 1);
+		}
+
 		rc = 0;
 		for (j = 0; j < nr_ctxs; j++) {
 			rc = bnxt_hwrm_vnic_ctx_alloc(bp, vnic, j);
-- 
2.21.1 (Apple Git-122.3)


^ permalink raw reply	[flat|nested] 47+ messages in thread

* [dpdk-dev] [PATCH v3 02/17] net/bnxt: fix VNIC config on Rx queue stop
  2020-12-09 23:53 ` [dpdk-dev] [PATCH v3 00/17] fixes and refactoring changes for bnxt Ajit Khaparde
  2020-12-09 23:53   ` [dpdk-dev] [PATCH v3 01/17] net/bnxt: fix RX rings in RSS redirection table Ajit Khaparde
@ 2020-12-09 23:53   ` Ajit Khaparde
  2020-12-09 23:53   ` [dpdk-dev] [PATCH v3 03/17] net/bnxt: remove unused field Ajit Khaparde
                     ` (15 subsequent siblings)
  17 siblings, 0 replies; 47+ messages in thread
From: Ajit Khaparde @ 2020-12-09 23:53 UTC (permalink / raw)
  To: dev; +Cc: Samik Gupta, stable, Lance Richardson, Somnath Kotur

From: Samik Gupta <samik.gupta@broadcom.com>

This commit reconfigures a vnic's default ring if the current default
ring is stopped by the application. It picks the lowest numbered ring
that is currently active to be the new default, and issues the
hwrm_vnic_cfg command to update the configuration. Applies to adapters
that are not Thor-based.

Fixes: 9b63c6fd70e3 ("net/bnxt: support Rx/Tx queue start/stop")
Cc: stable@dpdk.org

Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
Reviewed-by: Lance Richardson <lance.richardson@broadcom.com>
Reviewed-by: Somnath Kotur <somnath.kotur@broadcom.com>

Signed-off-by: Samik Gupta <samik.gupta@broadcom.com>
---
 drivers/net/bnxt/bnxt_rxq.c | 26 +++++++++++++++++++++-----
 1 file changed, 21 insertions(+), 5 deletions(-)

diff --git a/drivers/net/bnxt/bnxt_rxq.c b/drivers/net/bnxt/bnxt_rxq.c
index e0ec34216..61196eba9 100644
--- a/drivers/net/bnxt/bnxt_rxq.c
+++ b/drivers/net/bnxt/bnxt_rxq.c
@@ -557,12 +557,12 @@ int bnxt_rx_queue_stop(struct rte_eth_dev *dev, uint16_t rx_queue_id)
 		rc = bnxt_vnic_rss_configure(bp, vnic);
 	}
 
-	if (BNXT_CHIP_THOR(bp)) {
-		/* Compute current number of active receive queues. */
-		for (i = vnic->start_grp_id; i < vnic->end_grp_id; i++)
-			if (bp->rx_queues[i]->rx_started)
-				active_queue_cnt++;
+	/* Compute current number of active receive queues. */
+	for (i = vnic->start_grp_id; i < vnic->end_grp_id; i++)
+		if (bp->rx_queues[i]->rx_started)
+			active_queue_cnt++;
 
+	if (BNXT_CHIP_THOR(bp)) {
 		/*
 		 * For Thor, we need to ensure that the VNIC default receive
 		 * ring corresponds to an active receive queue. When no queue
@@ -582,6 +582,22 @@ int bnxt_rx_queue_stop(struct rte_eth_dev *dev, uint16_t rx_queue_id)
 			/* Reconfigure default receive ring. */
 			bnxt_hwrm_vnic_cfg(bp, vnic);
 		}
+	} else if (active_queue_cnt) {
+		/*
+		 * If the queue being stopped is the current default queue and
+		 * there are other active queues, pick one of them as the
+		 * default and reconfigure the vnic.
+		 */
+		if (vnic->dflt_ring_grp == bp->grp_info[rx_queue_id].fw_grp_id) {
+			for (i = vnic->start_grp_id; i < vnic->end_grp_id; i++) {
+				if (bp->rx_queues[i]->rx_started) {
+					vnic->dflt_ring_grp =
+						bp->grp_info[i].fw_grp_id;
+					bnxt_hwrm_vnic_cfg(bp, vnic);
+					break;
+				}
+			}
+		}
 	}
 
 	if (rc == 0)
-- 
2.21.1 (Apple Git-122.3)


^ permalink raw reply	[flat|nested] 47+ messages in thread

* [dpdk-dev] [PATCH v3 03/17] net/bnxt: remove unused field
  2020-12-09 23:53 ` [dpdk-dev] [PATCH v3 00/17] fixes and refactoring changes for bnxt Ajit Khaparde
  2020-12-09 23:53   ` [dpdk-dev] [PATCH v3 01/17] net/bnxt: fix RX rings in RSS redirection table Ajit Khaparde
  2020-12-09 23:53   ` [dpdk-dev] [PATCH v3 02/17] net/bnxt: fix VNIC config on Rx queue stop Ajit Khaparde
@ 2020-12-09 23:53   ` Ajit Khaparde
  2020-12-10 15:23     ` Lance Richardson
  2020-12-09 23:53   ` [dpdk-dev] [PATCH v3 04/17] net/bnxt: release hwrm lock in the error case Ajit Khaparde
                     ` (14 subsequent siblings)
  17 siblings, 1 reply; 47+ messages in thread
From: Ajit Khaparde @ 2020-12-09 23:53 UTC (permalink / raw)
  To: dev

Remove flow_xstat from bnxt structure.

Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
---
 drivers/net/bnxt/bnxt.h | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/net/bnxt/bnxt.h b/drivers/net/bnxt/bnxt.h
index 9bd4f1da9..f13d586d4 100644
--- a/drivers/net/bnxt/bnxt.h
+++ b/drivers/net/bnxt/bnxt.h
@@ -818,7 +818,6 @@ struct bnxt {
 	struct bnxt_dmabuf_info dmabuf;
 	struct bnxt_ulp_context	*ulp_ctx;
 	struct bnxt_flow_stat_info *flow_stat;
-	uint8_t			flow_xstat;
 	uint16_t		max_num_kflows;
 	uint16_t		tx_cfa_action;
 };
-- 
2.21.1 (Apple Git-122.3)


^ permalink raw reply	[flat|nested] 47+ messages in thread

* [dpdk-dev] [PATCH v3 04/17] net/bnxt: release hwrm lock in the error case
  2020-12-09 23:53 ` [dpdk-dev] [PATCH v3 00/17] fixes and refactoring changes for bnxt Ajit Khaparde
                     ` (2 preceding siblings ...)
  2020-12-09 23:53   ` [dpdk-dev] [PATCH v3 03/17] net/bnxt: remove unused field Ajit Khaparde
@ 2020-12-09 23:53   ` Ajit Khaparde
  2020-12-09 23:53   ` [dpdk-dev] [PATCH v3 05/17] net/bnxt: remove references to Thor Ajit Khaparde
                     ` (13 subsequent siblings)
  17 siblings, 0 replies; 47+ messages in thread
From: Ajit Khaparde @ 2020-12-09 23:53 UTC (permalink / raw)
  To: dev; +Cc: Kalesh AP, stable, Somnath Kotur

From: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>

In __bnxt_hwrm_func_qcaps, when memory allocations fails
driver is not releasing the hwrm lock. This patch fixes it
by calling hwrm_unlock in that error case.

Fixes: b7778e8a1c00 ("net/bnxt: refactor to properly allocate resources for PF/VF")
Cc: stable@dpdk.org

Signed-off-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
Reviewed-by: Somnath Kotur <somnath.kotur@broadcom.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
---
 drivers/net/bnxt/bnxt_hwrm.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/net/bnxt/bnxt_hwrm.c b/drivers/net/bnxt/bnxt_hwrm.c
index ebbf504c0..784e9778a 100644
--- a/drivers/net/bnxt/bnxt_hwrm.c
+++ b/drivers/net/bnxt/bnxt_hwrm.c
@@ -718,6 +718,7 @@ static int __bnxt_hwrm_func_qcaps(struct bnxt *bp)
 			    sizeof(bp->pf->vf_info[0]) * new_max_vfs, 0);
 			if (bp->pf->vf_info == NULL) {
 				PMD_DRV_LOG(ERR, "Alloc vf info fail\n");
+				HWRM_UNLOCK();
 				return -ENOMEM;
 			}
 			bp->pf->max_vfs = new_max_vfs;
-- 
2.21.1 (Apple Git-122.3)


^ permalink raw reply	[flat|nested] 47+ messages in thread

* [dpdk-dev] [PATCH v3 05/17] net/bnxt: remove references to Thor
  2020-12-09 23:53 ` [dpdk-dev] [PATCH v3 00/17] fixes and refactoring changes for bnxt Ajit Khaparde
                     ` (3 preceding siblings ...)
  2020-12-09 23:53   ` [dpdk-dev] [PATCH v3 04/17] net/bnxt: release hwrm lock in the error case Ajit Khaparde
@ 2020-12-09 23:53   ` Ajit Khaparde
  2020-12-10 15:28     ` Lance Richardson
  2020-12-09 23:53   ` [dpdk-dev] [PATCH v3 06/17] net/bnxt: fix to return error when fw command fails Ajit Khaparde
                     ` (12 subsequent siblings)
  17 siblings, 1 reply; 47+ messages in thread
From: Ajit Khaparde @ 2020-12-09 23:53 UTC (permalink / raw)
  To: dev

Refactor code to remove references to Thor.
Instead use P5 as in phase 5 of development cycle since it is applicable
to boards other than Thor as well.

Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
---
 drivers/net/bnxt/bnxt.h            | 20 +++++++-------
 drivers/net/bnxt/bnxt_ethdev.c     | 43 +++++++++++++++--------------
 drivers/net/bnxt/bnxt_hwrm.c       | 44 +++++++++++++++---------------
 drivers/net/bnxt/bnxt_ring.c       |  8 +++---
 drivers/net/bnxt/bnxt_rxq.c        |  4 +--
 drivers/net/bnxt/bnxt_rxr.c        | 12 ++++----
 drivers/net/bnxt/bnxt_rxr.h        |  2 +-
 drivers/net/bnxt/bnxt_vnic.c       |  4 +--
 drivers/net/bnxt/tf_ulp/bnxt_ulp.c |  2 +-
 9 files changed, 70 insertions(+), 69 deletions(-)

diff --git a/drivers/net/bnxt/bnxt.h b/drivers/net/bnxt/bnxt.h
index f13d586d4..9c1c87489 100644
--- a/drivers/net/bnxt/bnxt.h
+++ b/drivers/net/bnxt/bnxt.h
@@ -112,11 +112,11 @@
 #define TPA_MAX_SEGS		5 /* 32 segments in log2 units */
 
 #define BNXT_TPA_MAX_AGGS(bp) \
-	(BNXT_CHIP_THOR(bp) ? TPA_MAX_AGGS_TH : \
+	(BNXT_CHIP_P5(bp) ? TPA_MAX_AGGS_TH : \
 			     TPA_MAX_AGGS)
 
 #define BNXT_TPA_MAX_SEGS(bp) \
-	(BNXT_CHIP_THOR(bp) ? TPA_MAX_SEGS_TH : \
+	(BNXT_CHIP_P5(bp) ? TPA_MAX_SEGS_TH : \
 			      TPA_MAX_SEGS)
 
 /*
@@ -389,10 +389,10 @@ struct bnxt_coal {
 #define DBR_TYPE_NQ				(0xaULL << 60)
 #define DBR_TYPE_NQ_ARM				(0xbULL << 60)
 
-#define BNXT_RSS_TBL_SIZE_THOR		512U
-#define BNXT_RSS_ENTRIES_PER_CTX_THOR	64
-#define BNXT_MAX_RSS_CTXTS_THOR \
-	(BNXT_RSS_TBL_SIZE_THOR / BNXT_RSS_ENTRIES_PER_CTX_THOR)
+#define BNXT_RSS_TBL_SIZE_P5		512U
+#define BNXT_RSS_ENTRIES_PER_CTX_P5	64
+#define BNXT_MAX_RSS_CTXTS_P5 \
+	(BNXT_RSS_TBL_SIZE_P5 / BNXT_RSS_ENTRIES_PER_CTX_P5)
 
 #define BNXT_MAX_TC    8
 #define BNXT_MAX_QUEUE 8
@@ -629,7 +629,7 @@ struct bnxt {
 #define BNXT_FLAG_KONG_MB_EN		BIT(10)
 #define BNXT_FLAG_TRUSTED_VF_EN		BIT(11)
 #define BNXT_FLAG_DFLT_VNIC_SET		BIT(12)
-#define BNXT_FLAG_THOR_CHIP		BIT(13)
+#define BNXT_FLAG_CHIP_P5		BIT(13)
 #define BNXT_FLAG_STINGRAY		BIT(14)
 #define BNXT_FLAG_FW_RESET		BIT(15)
 #define BNXT_FLAG_FATAL_ERROR		BIT(16)
@@ -653,10 +653,10 @@ struct bnxt {
 #define BNXT_USE_CHIMP_MB	0 //For non-CFA commands, everything uses Chimp.
 #define BNXT_USE_KONG(bp)	((bp)->flags & BNXT_FLAG_KONG_MB_EN)
 #define BNXT_VF_IS_TRUSTED(bp)	((bp)->flags & BNXT_FLAG_TRUSTED_VF_EN)
-#define BNXT_CHIP_THOR(bp)	((bp)->flags & BNXT_FLAG_THOR_CHIP)
+#define BNXT_CHIP_P5(bp)	((bp)->flags & BNXT_FLAG_CHIP_P5)
 #define BNXT_STINGRAY(bp)	((bp)->flags & BNXT_FLAG_STINGRAY)
-#define BNXT_HAS_NQ(bp)		BNXT_CHIP_THOR(bp)
-#define BNXT_HAS_RING_GRPS(bp)	(!BNXT_CHIP_THOR(bp))
+#define BNXT_HAS_NQ(bp)		BNXT_CHIP_P5(bp)
+#define BNXT_HAS_RING_GRPS(bp)	(!BNXT_CHIP_P5(bp))
 #define BNXT_FLOW_XSTATS_EN(bp)	((bp)->flags & BNXT_FLAG_FLOW_XSTATS_EN)
 #define BNXT_HAS_DFLT_MAC_SET(bp)      ((bp)->flags & BNXT_FLAG_DFLT_MAC_SET)
 #define BNXT_TRUFLOW_EN(bp)	((bp)->flags & BNXT_FLAG_TRUFLOW_EN)
diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c
index c363c8427..8047b0b5d 100644
--- a/drivers/net/bnxt/bnxt_ethdev.c
+++ b/drivers/net/bnxt/bnxt_ethdev.c
@@ -208,22 +208,22 @@ int is_bnxt_in_error(struct bnxt *bp)
 static uint16_t bnxt_rss_ctxts(const struct bnxt *bp)
 {
 	unsigned int num_rss_rings = RTE_MIN(bp->rx_nr_rings,
-					     BNXT_RSS_TBL_SIZE_THOR);
+					     BNXT_RSS_TBL_SIZE_P5);
 
-	if (!BNXT_CHIP_THOR(bp))
+	if (!BNXT_CHIP_P5(bp))
 		return 1;
 
 	return RTE_ALIGN_MUL_CEIL(num_rss_rings,
-				  BNXT_RSS_ENTRIES_PER_CTX_THOR) /
-				  BNXT_RSS_ENTRIES_PER_CTX_THOR;
+				  BNXT_RSS_ENTRIES_PER_CTX_P5) /
+				  BNXT_RSS_ENTRIES_PER_CTX_P5;
 }
 
 uint16_t bnxt_rss_hash_tbl_size(const struct bnxt *bp)
 {
-	if (!BNXT_CHIP_THOR(bp))
+	if (!BNXT_CHIP_P5(bp))
 		return HW_HASH_INDEX_SIZE;
 
-	return bnxt_rss_ctxts(bp) * BNXT_RSS_ENTRIES_PER_CTX_THOR;
+	return bnxt_rss_ctxts(bp) * BNXT_RSS_ENTRIES_PER_CTX_P5;
 }
 
 static void bnxt_free_parent_info(struct bnxt *bp)
@@ -427,12 +427,12 @@ static int bnxt_setup_one_vnic(struct bnxt *bp, uint16_t vnic_id)
 	if (dev_conf->rxmode.mq_mode & ETH_MQ_RX_RSS) {
 		int j, nr_ctxs = bnxt_rss_ctxts(bp);
 
-		if (bp->rx_nr_rings > BNXT_RSS_TBL_SIZE_THOR) {
+		if (bp->rx_nr_rings > BNXT_RSS_TBL_SIZE_P5) {
 			PMD_DRV_LOG(ERR, "RxQ cnt %d > reta_size %d\n",
-				    bp->rx_nr_rings, BNXT_RSS_TBL_SIZE_THOR);
+				    bp->rx_nr_rings, BNXT_RSS_TBL_SIZE_P5);
 			PMD_DRV_LOG(ERR,
 				    "Only queues 0-%d will be in RSS table\n",
-				    BNXT_RSS_TBL_SIZE_THOR - 1);
+				    BNXT_RSS_TBL_SIZE_P5 - 1);
 		}
 
 		rc = 0;
@@ -712,8 +712,8 @@ static int bnxt_init_chip(struct bnxt *bp)
 	/* THOR does not support ring groups.
 	 * But we will use the array to save RSS context IDs.
 	 */
-	if (BNXT_CHIP_THOR(bp))
-		bp->max_ring_grps = BNXT_MAX_RSS_CTXTS_THOR;
+	if (BNXT_CHIP_P5(bp))
+		bp->max_ring_grps = BNXT_MAX_RSS_CTXTS_P5;
 
 	rc = bnxt_alloc_all_hwrm_stat_ctxs(bp);
 	if (rc) {
@@ -1832,7 +1832,7 @@ static int bnxt_reta_update_op(struct rte_eth_dev *eth_dev,
 			return -EINVAL;
 		}
 
-		if (BNXT_CHIP_THOR(bp)) {
+		if (BNXT_CHIP_P5(bp)) {
 			vnic->rss_table[i * 2] =
 				rxq->rx_ring->rx_ring_struct->fw_ring_id;
 			vnic->rss_table[i * 2 + 1] =
@@ -1881,7 +1881,7 @@ static int bnxt_reta_query_op(struct rte_eth_dev *eth_dev,
 		if (reta_conf[idx].mask & (1ULL << sft)) {
 			uint16_t qid;
 
-			if (BNXT_CHIP_THOR(bp))
+			if (BNXT_CHIP_P5(bp))
 				qid = bnxt_rss_to_qid(bp,
 						      vnic->rss_table[i * 2]);
 			else
@@ -3232,7 +3232,7 @@ bnxt_timesync_read_time(struct rte_eth_dev *dev, struct timespec *ts)
 	if (!ptp)
 		return 0;
 
-	if (BNXT_CHIP_THOR(bp))
+	if (BNXT_CHIP_P5(bp))
 		rc = bnxt_hwrm_port_ts_query(bp, BNXT_PTP_FLAGS_CURRENT_TIME,
 					     &systime_cycles);
 	else
@@ -3278,7 +3278,7 @@ bnxt_timesync_enable(struct rte_eth_dev *dev)
 	ptp->tx_tstamp_tc.cc_shift = shift;
 	ptp->tx_tstamp_tc.nsec_mask = (1ULL << shift) - 1;
 
-	if (!BNXT_CHIP_THOR(bp))
+	if (!BNXT_CHIP_P5(bp))
 		bnxt_map_ptp_regs(bp);
 
 	return 0;
@@ -3299,7 +3299,7 @@ bnxt_timesync_disable(struct rte_eth_dev *dev)
 
 	bnxt_hwrm_ptp_cfg(bp);
 
-	if (!BNXT_CHIP_THOR(bp))
+	if (!BNXT_CHIP_P5(bp))
 		bnxt_unmap_ptp_regs(bp);
 
 	return 0;
@@ -3318,7 +3318,7 @@ bnxt_timesync_read_rx_timestamp(struct rte_eth_dev *dev,
 	if (!ptp)
 		return 0;
 
-	if (BNXT_CHIP_THOR(bp))
+	if (BNXT_CHIP_P5(bp))
 		rx_tstamp_cycles = ptp->rx_timestamp;
 	else
 		bnxt_get_rx_ts(bp, &rx_tstamp_cycles);
@@ -3341,7 +3341,7 @@ bnxt_timesync_read_tx_timestamp(struct rte_eth_dev *dev,
 	if (!ptp)
 		return 0;
 
-	if (BNXT_CHIP_THOR(bp))
+	if (BNXT_CHIP_P5(bp))
 		rc = bnxt_hwrm_port_ts_query(bp, BNXT_PTP_FLAGS_PATH_TX,
 					     &tx_tstamp_cycles);
 	else
@@ -4007,7 +4007,8 @@ static bool bnxt_vf_pciid(uint16_t device_id)
 	}
 }
 
-static bool bnxt_thor_device(uint16_t device_id)
+/* Phase 5 device */
+static bool bnxt_p5_device(uint16_t device_id)
 {
 	switch (device_id) {
 	case BROADCOM_DEV_ID_57508:
@@ -5240,8 +5241,8 @@ bnxt_dev_init(struct rte_eth_dev *eth_dev, void *params __rte_unused)
 	if (bnxt_vf_pciid(pci_dev->id.device_id))
 		bp->flags |= BNXT_FLAG_VF;
 
-	if (bnxt_thor_device(pci_dev->id.device_id))
-		bp->flags |= BNXT_FLAG_THOR_CHIP;
+	if (bnxt_p5_device(pci_dev->id.device_id))
+		bp->flags |= BNXT_FLAG_CHIP_P5;
 
 	if (pci_dev->id.device_id == BROADCOM_DEV_ID_58802 ||
 	    pci_dev->id.device_id == BROADCOM_DEV_ID_58804 ||
diff --git a/drivers/net/bnxt/bnxt_hwrm.c b/drivers/net/bnxt/bnxt_hwrm.c
index 784e9778a..6f5402070 100644
--- a/drivers/net/bnxt/bnxt_hwrm.c
+++ b/drivers/net/bnxt/bnxt_hwrm.c
@@ -635,7 +635,7 @@ static int bnxt_hwrm_ptp_qcfg(struct bnxt *bp)
 
 	HWRM_CHECK_RESULT();
 
-	if (!BNXT_CHIP_THOR(bp) &&
+	if (!BNXT_CHIP_P5(bp) &&
 	    !(resp->flags & HWRM_PORT_MAC_PTP_QCFG_OUTPUT_FLAGS_DIRECT_ACCESS))
 		return 0;
 
@@ -646,7 +646,7 @@ static int bnxt_hwrm_ptp_qcfg(struct bnxt *bp)
 	if (!ptp)
 		return -ENOMEM;
 
-	if (!BNXT_CHIP_THOR(bp)) {
+	if (!BNXT_CHIP_P5(bp)) {
 		ptp->rx_regs[BNXT_PTP_RX_TS_L] =
 			rte_le_to_cpu_32(resp->rx_ts_reg_off_lower);
 		ptp->rx_regs[BNXT_PTP_RX_TS_H] =
@@ -766,7 +766,7 @@ static int __bnxt_hwrm_func_qcaps(struct bnxt *bp)
 	bp->first_vf_id = rte_le_to_cpu_16(resp->first_vf_id);
 	bp->max_rx_em_flows = rte_le_to_cpu_16(resp->max_rx_em_flows);
 	bp->max_l2_ctx = rte_le_to_cpu_16(resp->max_l2_ctxs);
-	if (!BNXT_CHIP_THOR(bp) && !bp->pdev->max_vfs)
+	if (!BNXT_CHIP_P5(bp) && !bp->pdev->max_vfs)
 		bp->max_l2_ctx += bp->max_rx_em_flows;
 	/* TODO: For now, do not support VMDq/RFS on VFs. */
 	if (BNXT_PF(bp)) {
@@ -1056,7 +1056,7 @@ int bnxt_hwrm_func_resc_qcaps(struct bnxt *bp)
 	 * So use the value provided by func_qcaps.
 	 */
 	bp->max_l2_ctx = rte_le_to_cpu_16(resp->max_l2_ctxs);
-	if (!BNXT_CHIP_THOR(bp) && !bp->pdev->max_vfs)
+	if (!BNXT_CHIP_P5(bp) && !bp->pdev->max_vfs)
 		bp->max_l2_ctx += bp->max_rx_em_flows;
 	bp->max_vnics = rte_le_to_cpu_16(resp->max_vnics);
 	bp->max_stat_ctx = rte_le_to_cpu_16(resp->max_stat_ctx);
@@ -1557,7 +1557,7 @@ int bnxt_hwrm_ring_alloc(struct bnxt *bp,
 		req.ring_type = ring_type;
 		req.cmpl_ring_id = rte_cpu_to_le_16(cmpl_ring_id);
 		req.stat_ctx_id = rte_cpu_to_le_32(stats_ctx_id);
-		if (BNXT_CHIP_THOR(bp)) {
+		if (BNXT_CHIP_P5(bp)) {
 			mb_pool = bp->rx_queues[0]->mb_pool;
 			rx_buf_size = rte_pktmbuf_data_room_size(mb_pool) -
 				      RTE_PKTMBUF_HEADROOM;
@@ -1927,7 +1927,7 @@ int bnxt_hwrm_vnic_cfg(struct bnxt *bp, struct bnxt_vnic_info *vnic)
 
 	HWRM_PREP(&req, HWRM_VNIC_CFG, BNXT_USE_CHIMP_MB);
 
-	if (BNXT_CHIP_THOR(bp)) {
+	if (BNXT_CHIP_P5(bp)) {
 		int dflt_rxq = vnic->start_grp_id;
 		struct bnxt_rx_ring_info *rxr;
 		struct bnxt_cp_ring_info *cpr;
@@ -2117,7 +2117,7 @@ int bnxt_hwrm_vnic_ctx_free(struct bnxt *bp, struct bnxt_vnic_info *vnic)
 {
 	int rc = 0;
 
-	if (BNXT_CHIP_THOR(bp)) {
+	if (BNXT_CHIP_P5(bp)) {
 		int j;
 
 		for (j = 0; j < vnic->num_lb_ctxts; j++) {
@@ -2164,7 +2164,7 @@ int bnxt_hwrm_vnic_free(struct bnxt *bp, struct bnxt_vnic_info *vnic)
 }
 
 static int
-bnxt_hwrm_vnic_rss_cfg_thor(struct bnxt *bp, struct bnxt_vnic_info *vnic)
+bnxt_hwrm_vnic_rss_cfg_p5(struct bnxt *bp, struct bnxt_vnic_info *vnic)
 {
 	int i;
 	int rc = 0;
@@ -2208,8 +2208,8 @@ int bnxt_hwrm_vnic_rss_cfg(struct bnxt *bp,
 	if (!vnic->rss_table)
 		return 0;
 
-	if (BNXT_CHIP_THOR(bp))
-		return bnxt_hwrm_vnic_rss_cfg_thor(bp, vnic);
+	if (BNXT_CHIP_P5(bp))
+		return bnxt_hwrm_vnic_rss_cfg_p5(bp, vnic);
 
 	HWRM_PREP(&req, HWRM_VNIC_RSS_CFG, BNXT_USE_CHIMP_MB);
 
@@ -2274,7 +2274,7 @@ int bnxt_hwrm_vnic_tpa_cfg(struct bnxt *bp,
 	struct hwrm_vnic_tpa_cfg_input req = {.req_type = 0 };
 	struct hwrm_vnic_tpa_cfg_output *resp = bp->hwrm_cmd_resp_addr;
 
-	if (BNXT_CHIP_THOR(bp) && !bp->max_tpa_v2) {
+	if (BNXT_CHIP_P5(bp) && !bp->max_tpa_v2) {
 		if (enable)
 			PMD_DRV_LOG(ERR, "No HW support for LRO\n");
 		return -ENOTSUP;
@@ -2566,7 +2566,7 @@ void bnxt_free_hwrm_rx_ring(struct bnxt *bp, int queue_index)
 	ring = rxr->ag_ring_struct;
 	if (ring->fw_ring_id != INVALID_HW_RING_ID) {
 		bnxt_hwrm_ring_free(bp, ring,
-				    BNXT_CHIP_THOR(bp) ?
+				    BNXT_CHIP_P5(bp) ?
 				    HWRM_RING_FREE_INPUT_RING_TYPE_RX_AGG :
 				    HWRM_RING_FREE_INPUT_RING_TYPE_RX);
 		if (BNXT_HAS_RING_GRPS(bp))
@@ -3068,7 +3068,7 @@ int bnxt_set_hwrm_link_config(struct bnxt *bp, bool link_up)
 		goto port_phy_cfg;
 
 	autoneg = bnxt_check_eth_link_autoneg(dev_conf->link_speeds);
-	if (BNXT_CHIP_THOR(bp) &&
+	if (BNXT_CHIP_P5(bp) &&
 	    dev_conf->link_speeds == ETH_LINK_SPEED_40G) {
 		/* 40G is not supported as part of media auto detect.
 		 * The speed should be forced and autoneg disabled
@@ -3093,7 +3093,7 @@ int bnxt_set_hwrm_link_config(struct bnxt *bp, bool link_up)
 	 * to 40G until link comes up at new speed.
 	 */
 	if (autoneg == 1 &&
-	    !(!BNXT_CHIP_THOR(bp) &&
+	    !(!BNXT_CHIP_P5(bp) &&
 	      (bp->link_info->auto_link_speed ||
 	       bp->link_info->force_link_speed))) {
 		link_req.phy_flags |=
@@ -4820,7 +4820,7 @@ int bnxt_hwrm_clear_ntuple_filter(struct bnxt *bp,
 }
 
 static int
-bnxt_vnic_rss_configure_thor(struct bnxt *bp, struct bnxt_vnic_info *vnic)
+bnxt_vnic_rss_configure_p5(struct bnxt *bp, struct bnxt_vnic_info *vnic)
 {
 	struct hwrm_vnic_rss_cfg_output *resp = bp->hwrm_cmd_resp_addr;
 	uint8_t *rx_queue_state = bp->eth_dev->data->rx_queue_state;
@@ -4844,7 +4844,7 @@ bnxt_vnic_rss_configure_thor(struct bnxt *bp, struct bnxt_vnic_info *vnic)
 
 		req.ring_grp_tbl_addr =
 		    rte_cpu_to_le_64(vnic->rss_table_dma_addr +
-				     i * BNXT_RSS_ENTRIES_PER_CTX_THOR *
+				     i * BNXT_RSS_ENTRIES_PER_CTX_P5 *
 				     2 * sizeof(*ring_tbl));
 		req.hash_key_tbl_addr =
 		    rte_cpu_to_le_64(vnic->rss_hash_key_dma_addr);
@@ -4899,8 +4899,8 @@ int bnxt_vnic_rss_configure(struct bnxt *bp, struct bnxt_vnic_info *vnic)
 	if (!(vnic->rss_table && vnic->hash_type))
 		return 0;
 
-	if (BNXT_CHIP_THOR(bp))
-		return bnxt_vnic_rss_configure_thor(bp, vnic);
+	if (BNXT_CHIP_P5(bp))
+		return bnxt_vnic_rss_configure_p5(bp, vnic);
 
 	if (vnic->fw_vnic_id == INVALID_HW_RING_ID)
 		return 0;
@@ -4959,7 +4959,7 @@ static void bnxt_hwrm_set_coal_params(struct bnxt_coal *hw_coal,
 	req->flags = rte_cpu_to_le_16(flags);
 }
 
-static int bnxt_hwrm_set_coal_params_thor(struct bnxt *bp,
+static int bnxt_hwrm_set_coal_params_p5(struct bnxt *bp,
 		struct hwrm_ring_cmpl_ring_cfg_aggint_params_input *agg_req)
 {
 	struct hwrm_ring_aggint_qcaps_input req = {0};
@@ -4996,8 +4996,8 @@ int bnxt_hwrm_set_ring_coal(struct bnxt *bp,
 	int rc;
 
 	/* Set ring coalesce parameters only for 100G NICs */
-	if (BNXT_CHIP_THOR(bp)) {
-		if (bnxt_hwrm_set_coal_params_thor(bp, &req))
+	if (BNXT_CHIP_P5(bp)) {
+		if (bnxt_hwrm_set_coal_params_p5(bp, &req))
 			return -1;
 	} else if (bnxt_stratus_device(bp)) {
 		bnxt_hwrm_set_coal_params(coal, &req);
@@ -5026,7 +5026,7 @@ int bnxt_hwrm_func_backing_store_qcaps(struct bnxt *bp)
 	int total_alloc_len;
 	int rc, i, tqm_rings;
 
-	if (!BNXT_CHIP_THOR(bp) ||
+	if (!BNXT_CHIP_P5(bp) ||
 	    bp->hwrm_spec_code < HWRM_VERSION_1_9_2 ||
 	    BNXT_VF(bp) ||
 	    bp->ctx)
diff --git a/drivers/net/bnxt/bnxt_ring.c b/drivers/net/bnxt/bnxt_ring.c
index aeb6cb615..579c48d8c 100644
--- a/drivers/net/bnxt/bnxt_ring.c
+++ b/drivers/net/bnxt/bnxt_ring.c
@@ -57,8 +57,8 @@ int bnxt_alloc_ring_grps(struct bnxt *bp)
 	/* THOR does not support ring groups.
 	 * But we will use the array to save RSS context IDs.
 	 */
-	if (BNXT_CHIP_THOR(bp)) {
-		bp->max_ring_grps = BNXT_MAX_RSS_CTXTS_THOR;
+	if (BNXT_CHIP_P5(bp)) {
+		bp->max_ring_grps = BNXT_MAX_RSS_CTXTS_P5;
 	} else if (bp->max_ring_grps < bp->rx_cp_nr_rings) {
 		/* 1 ring is for default completion ring */
 		PMD_DRV_LOG(ERR, "Insufficient resource: Ring Group\n");
@@ -344,7 +344,7 @@ static void bnxt_set_db(struct bnxt *bp,
 			uint32_t map_idx,
 			uint32_t fid)
 {
-	if (BNXT_CHIP_THOR(bp)) {
+	if (BNXT_CHIP_P5(bp)) {
 		if (BNXT_PF(bp))
 			db->doorbell = (char *)bp->doorbell_base + 0x10000;
 		else
@@ -538,7 +538,7 @@ static int bnxt_alloc_rx_agg_ring(struct bnxt *bp, int queue_index)
 
 	ring->fw_rx_ring_id = rxr->rx_ring_struct->fw_ring_id;
 
-	if (BNXT_CHIP_THOR(bp)) {
+	if (BNXT_CHIP_P5(bp)) {
 		ring_type = HWRM_RING_ALLOC_INPUT_RING_TYPE_RX_AGG;
 		hw_stats_ctx_id = cpr->hw_stats_ctx_id;
 	} else {
diff --git a/drivers/net/bnxt/bnxt_rxq.c b/drivers/net/bnxt/bnxt_rxq.c
index 61196eba9..328cc994d 100644
--- a/drivers/net/bnxt/bnxt_rxq.c
+++ b/drivers/net/bnxt/bnxt_rxq.c
@@ -472,7 +472,7 @@ int bnxt_rx_queue_start(struct rte_eth_dev *dev, uint16_t rx_queue_id)
 	if (rc)
 		return rc;
 
-	if (BNXT_CHIP_THOR(bp)) {
+	if (BNXT_CHIP_P5(bp)) {
 		/* Reconfigure default receive ring and MRU. */
 		bnxt_hwrm_vnic_cfg(bp, rxq->vnic);
 	}
@@ -562,7 +562,7 @@ int bnxt_rx_queue_stop(struct rte_eth_dev *dev, uint16_t rx_queue_id)
 		if (bp->rx_queues[i]->rx_started)
 			active_queue_cnt++;
 
-	if (BNXT_CHIP_THOR(bp)) {
+	if (BNXT_CHIP_P5(bp)) {
 		/*
 		 * For Thor, we need to ensure that the VNIC default receive
 		 * ring corresponds to an active receive queue. When no queue
diff --git a/drivers/net/bnxt/bnxt_rxr.c b/drivers/net/bnxt/bnxt_rxr.c
index af1774844..e9c4fffed 100644
--- a/drivers/net/bnxt/bnxt_rxr.c
+++ b/drivers/net/bnxt/bnxt_rxr.c
@@ -225,13 +225,13 @@ static int bnxt_rx_pages(struct bnxt_rx_queue *rxq,
 	uint16_t cp_cons, ag_cons;
 	struct rx_pkt_cmpl *rxcmp;
 	struct rte_mbuf *last = mbuf;
-	bool is_thor_tpa = tpa_info && BNXT_CHIP_THOR(rxq->bp);
+	bool is_p5_tpa = tpa_info && BNXT_CHIP_P5(rxq->bp);
 
 	for (i = 0; i < agg_buf; i++) {
 		struct rte_mbuf **ag_buf;
 		struct rte_mbuf *ag_mbuf;
 
-		if (is_thor_tpa) {
+		if (is_p5_tpa) {
 			rxcmp = (void *)&tpa_info->agg_arr[i];
 		} else {
 			*tmp_raw_cons = NEXT_RAW_CMP(*tmp_raw_cons);
@@ -285,7 +285,7 @@ static inline struct rte_mbuf *bnxt_tpa_end(
 	uint8_t payload_offset;
 	struct bnxt_tpa_info *tpa_info;
 
-	if (BNXT_CHIP_THOR(rxq->bp)) {
+	if (BNXT_CHIP_P5(rxq->bp)) {
 		struct rx_tpa_v2_end_cmpl *th_tpa_end;
 		struct rx_tpa_v2_end_cmpl_hi *th_tpa_end1;
 
@@ -497,11 +497,11 @@ bnxt_set_ol_flags(struct rx_pkt_cmpl *rxcmp, struct rx_pkt_cmpl_hi *rxcmp1,
 
 #ifdef RTE_LIBRTE_IEEE1588
 static void
-bnxt_get_rx_ts_thor(struct bnxt *bp, uint32_t rx_ts_cmpl)
+bnxt_get_rx_ts_p5(struct bnxt *bp, uint32_t rx_ts_cmpl)
 {
 	uint64_t systime_cycles = 0;
 
-	if (!BNXT_CHIP_THOR(bp))
+	if (!BNXT_CHIP_P5(bp))
 		return;
 
 	/* On Thor, Rx timestamps are provided directly in the
@@ -747,7 +747,7 @@ static int bnxt_rx_pkt(struct rte_mbuf **rx_pkt,
 		      RX_PKT_CMPL_FLAGS_MASK) ==
 		      RX_PKT_CMPL_FLAGS_ITYPE_PTP_W_TIMESTAMP)) {
 		mbuf->ol_flags |= PKT_RX_IEEE1588_PTP | PKT_RX_IEEE1588_TMST;
-		bnxt_get_rx_ts_thor(rxq->bp, rxcmp1->reorder);
+		bnxt_get_rx_ts_p5(rxq->bp, rxcmp1->reorder);
 	}
 #endif
 
diff --git a/drivers/net/bnxt/bnxt_rxr.h b/drivers/net/bnxt/bnxt_rxr.h
index 3fc901fdf..2a53cf87b 100644
--- a/drivers/net/bnxt/bnxt_rxr.h
+++ b/drivers/net/bnxt/bnxt_rxr.h
@@ -17,7 +17,7 @@
 static inline uint16_t bnxt_tpa_start_agg_id(struct bnxt *bp,
 					     struct rx_tpa_start_cmpl *cmp)
 {
-	if (BNXT_CHIP_THOR(bp))
+	if (BNXT_CHIP_P5(bp))
 		return BNXT_TPA_START_AGG_ID_TH(cmp);
 	else
 		return BNXT_TPA_START_AGG_ID_PRE_TH(cmp);
diff --git a/drivers/net/bnxt/bnxt_vnic.c b/drivers/net/bnxt/bnxt_vnic.c
index 1602fb2b8..4d378eca4 100644
--- a/drivers/net/bnxt/bnxt_vnic.c
+++ b/drivers/net/bnxt/bnxt_vnic.c
@@ -129,8 +129,8 @@ int bnxt_alloc_vnic_attributes(struct bnxt *bp)
 	entry_length = HW_HASH_KEY_SIZE +
 		       BNXT_MAX_MC_ADDRS * RTE_ETHER_ADDR_LEN;
 
-	if (BNXT_CHIP_THOR(bp))
-		rss_table_size = BNXT_RSS_TBL_SIZE_THOR *
+	if (BNXT_CHIP_P5(bp))
+		rss_table_size = BNXT_RSS_TBL_SIZE_P5 *
 				 2 * sizeof(*vnic->rss_table);
 	else
 		rss_table_size = HW_HASH_INDEX_SIZE * sizeof(*vnic->rss_table);
diff --git a/drivers/net/bnxt/tf_ulp/bnxt_ulp.c b/drivers/net/bnxt/tf_ulp/bnxt_ulp.c
index 26fd3009f..de47fde88 100644
--- a/drivers/net/bnxt/tf_ulp/bnxt_ulp.c
+++ b/drivers/net/bnxt/tf_ulp/bnxt_ulp.c
@@ -52,7 +52,7 @@ static int32_t
 bnxt_ulp_devid_get(struct bnxt *bp,
 		   enum bnxt_ulp_device_id  *ulp_dev_id)
 {
-	if (BNXT_CHIP_THOR(bp))
+	if (BNXT_CHIP_P5(bp))
 		return -EINVAL;
 	/* Assuming Whitney */
 	*ulp_dev_id = BNXT_ULP_DEVICE_ID_WH_PLUS;
-- 
2.21.1 (Apple Git-122.3)


^ permalink raw reply	[flat|nested] 47+ messages in thread

* [dpdk-dev] [PATCH v3 06/17] net/bnxt: fix to return error when fw command fails
  2020-12-09 23:53 ` [dpdk-dev] [PATCH v3 00/17] fixes and refactoring changes for bnxt Ajit Khaparde
                     ` (4 preceding siblings ...)
  2020-12-09 23:53   ` [dpdk-dev] [PATCH v3 05/17] net/bnxt: remove references to Thor Ajit Khaparde
@ 2020-12-09 23:53   ` Ajit Khaparde
  2020-12-09 23:53   ` [dpdk-dev] [PATCH v3 07/17] net/bnxt: fix cleanup on mutex init failure Ajit Khaparde
                     ` (11 subsequent siblings)
  17 siblings, 0 replies; 47+ messages in thread
From: Ajit Khaparde @ 2020-12-09 23:53 UTC (permalink / raw)
  To: dev; +Cc: Kalesh AP, stable, Somnath Kotur

From: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>

In bnxt_reta_update_op() and bnxt_rss_hash_update_op(), driver does not
propagate the error back to the application when the fw command fails.

Fixes: 378ab645bb0b ("net/bnxt: fix RSS RETA indirection table ops")
Fixes: fcc0aa1edc10 ("net/bnxt: add RSS hash configuration")
Cc: stable@dpdk.org

Signed-off-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
Reviewed-by: Somnath Kotur <somnath.kotur@broadcom.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
---
 drivers/net/bnxt/bnxt_ethdev.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c
index 8047b0b5d..33358779b 100644
--- a/drivers/net/bnxt/bnxt_ethdev.c
+++ b/drivers/net/bnxt/bnxt_ethdev.c
@@ -1843,8 +1843,8 @@ static int bnxt_reta_update_op(struct rte_eth_dev *eth_dev,
 		}
 	}
 
-	bnxt_hwrm_vnic_rss_cfg(bp, vnic);
-	return 0;
+	rc = bnxt_hwrm_vnic_rss_cfg(bp, vnic);
+	return rc;
 }
 
 static int bnxt_reta_query_op(struct rte_eth_dev *eth_dev,
@@ -1949,8 +1949,8 @@ static int bnxt_rss_hash_update_op(struct rte_eth_dev *eth_dev,
 	memcpy(vnic->rss_hash_key, rss_conf->rss_key, rss_conf->rss_key_len);
 
 rss_config:
-	bnxt_hwrm_vnic_rss_cfg(bp, vnic);
-	return 0;
+	rc = bnxt_hwrm_vnic_rss_cfg(bp, vnic);
+	return rc;
 }
 
 static int bnxt_rss_hash_conf_get_op(struct rte_eth_dev *eth_dev,
-- 
2.21.1 (Apple Git-122.3)


^ permalink raw reply	[flat|nested] 47+ messages in thread

* [dpdk-dev] [PATCH v3 07/17] net/bnxt: fix cleanup on mutex init failure
  2020-12-09 23:53 ` [dpdk-dev] [PATCH v3 00/17] fixes and refactoring changes for bnxt Ajit Khaparde
                     ` (5 preceding siblings ...)
  2020-12-09 23:53   ` [dpdk-dev] [PATCH v3 06/17] net/bnxt: fix to return error when fw command fails Ajit Khaparde
@ 2020-12-09 23:53   ` Ajit Khaparde
  2020-12-10 15:42     ` Lance Richardson
  2020-12-09 23:53   ` [dpdk-dev] [PATCH v3 08/17] net/bnxt: fix format specifier for unsigned int Ajit Khaparde
                     ` (10 subsequent siblings)
  17 siblings, 1 reply; 47+ messages in thread
From: Ajit Khaparde @ 2020-12-09 23:53 UTC (permalink / raw)
  To: dev; +Cc: stable

In case mutex init fails during initialization, start cleanup and
fail the initialization process.

Fixes: a73b8e939f10 ("net/bnxt: fix race between start and interrupt handler")
Cc: stable@dpdk.org

Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
---
 drivers/net/bnxt/bnxt_ethdev.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c
index 33358779b..0b14ca234 100644
--- a/drivers/net/bnxt/bnxt_ethdev.c
+++ b/drivers/net/bnxt/bnxt_ethdev.c
@@ -4739,8 +4739,10 @@ bnxt_init_locks(struct bnxt *bp)
 	}
 
 	err = pthread_mutex_init(&bp->def_cp_lock, NULL);
-	if (err)
+	if (err) {
 		PMD_DRV_LOG(ERR, "Unable to initialize def_cp_lock\n");
+		return err;
+	}
 
 	err = pthread_mutex_init(&bp->health_check_lock, NULL);
 	if (err)
-- 
2.21.1 (Apple Git-122.3)


^ permalink raw reply	[flat|nested] 47+ messages in thread

* [dpdk-dev] [PATCH v3 08/17] net/bnxt: fix format specifier for unsigned int
  2020-12-09 23:53 ` [dpdk-dev] [PATCH v3 00/17] fixes and refactoring changes for bnxt Ajit Khaparde
                     ` (6 preceding siblings ...)
  2020-12-09 23:53   ` [dpdk-dev] [PATCH v3 07/17] net/bnxt: fix cleanup on mutex init failure Ajit Khaparde
@ 2020-12-09 23:53   ` Ajit Khaparde
  2020-12-10 15:54     ` Lance Richardson
  2020-12-09 23:53   ` [dpdk-dev] [PATCH v3 09/17] net/bnxt: fix max rings computation Ajit Khaparde
                     ` (9 subsequent siblings)
  17 siblings, 1 reply; 47+ messages in thread
From: Ajit Khaparde @ 2020-12-09 23:53 UTC (permalink / raw)
  To: dev; +Cc: stable

&device requires the %u format specifer not the %d specifier, as
&device is unsigned.

Fixes: a46bbb57605b ("net/bnxt: update multi device design")
Cc: stable@dpdk.org

Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
---
 drivers/net/bnxt/tf_core/tf_core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/bnxt/tf_core/tf_core.c b/drivers/net/bnxt/tf_core/tf_core.c
index 24d49096a..3409cbbce 100644
--- a/drivers/net/bnxt/tf_core/tf_core.c
+++ b/drivers/net/bnxt/tf_core/tf_core.c
@@ -82,7 +82,7 @@ tf_open_session(struct tf *tfp,
 		return rc;
 
 	TFP_DRV_LOG(INFO,
-		    "domain:%d, bus:%d, device:%d\n",
+		    "domain:%d, bus:%d, device:%u\n",
 		    parms->session_id.internal.domain,
 		    parms->session_id.internal.bus,
 		    parms->session_id.internal.device);
-- 
2.21.1 (Apple Git-122.3)


^ permalink raw reply	[flat|nested] 47+ messages in thread

* [dpdk-dev] [PATCH v3 09/17] net/bnxt: fix max rings computation
  2020-12-09 23:53 ` [dpdk-dev] [PATCH v3 00/17] fixes and refactoring changes for bnxt Ajit Khaparde
                     ` (7 preceding siblings ...)
  2020-12-09 23:53   ` [dpdk-dev] [PATCH v3 08/17] net/bnxt: fix format specifier for unsigned int Ajit Khaparde
@ 2020-12-09 23:53   ` Ajit Khaparde
  2020-12-09 23:53   ` [dpdk-dev] [PATCH v3 10/17] net/bnxt: support for 236 queues in NS3 Ajit Khaparde
                     ` (8 subsequent siblings)
  17 siblings, 0 replies; 47+ messages in thread
From: Ajit Khaparde @ 2020-12-09 23:53 UTC (permalink / raw)
  To: dev; +Cc: Sriharsha Basavapatna, stable, Somnath Kotur

From: Sriharsha Basavapatna <sriharsha.basavapatna@broadcom.com>

The current max_rings computation does not take into account the case
when max_nq_rings is <= num_async_cpr. This results in a wrong value
like 0, when max_nq_rings is 1. Fix this by subtracting num_async_cpr
only when max_cp_rings > num_async_cpr.

Apart from this, the entire logic is currently spread across a few
macros, making it hard to read and debug this code. Move this code
into an inline function.

max_msix is not used in the max_rings calculation.
Apparently the max_msix field returned in HWRM_RESC_QCAPS is only
valid for Thor and newer chips. On Wh+ it will be equal to min_compl_rings.
Also, when a function reset is performed on an application quit, FW
will not reset the VF resource pool as per design.
This can lead to a strange condition wherein the max_msix field
on Wh+ keeps changing on each application re-load thereby throwing
throwing off the max_rings computation.

Fixes: f03e66cb64ce ("net/bnxt: limit queue count for NS3/Stingray devices")
Cc: stable@dpdk.org

Signed-off-by: Sriharsha Basavapatna <sriharsha.basavapatna@broadcom.com>
Signed-off-by: Somnath Kotur <somnath.kotur@broadcom.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
---
 drivers/net/bnxt/bnxt.h        | 41 +++++++++++++++++++++++-----------
 drivers/net/bnxt/bnxt_ethdev.c |  2 +-
 drivers/net/bnxt/bnxt_rxq.c    |  7 +++---
 drivers/net/bnxt/bnxt_txq.c    |  2 +-
 4 files changed, 34 insertions(+), 18 deletions(-)

diff --git a/drivers/net/bnxt/bnxt.h b/drivers/net/bnxt/bnxt.h
index 9c1c87489..bc0935272 100644
--- a/drivers/net/bnxt/bnxt.h
+++ b/drivers/net/bnxt/bnxt.h
@@ -752,19 +752,6 @@ struct bnxt {
 	uint16_t		max_tx_rings;
 	uint16_t		max_rx_rings;
 #define MAX_STINGRAY_RINGS		128U
-/* For sake of symmetry, max Tx rings == max Rx rings, one stat ctx for each */
-#define BNXT_MAX_RX_RINGS(bp) \
-	(BNXT_STINGRAY(bp) ? RTE_MIN(RTE_MIN(bp->max_rx_rings / 2U, \
-					     MAX_STINGRAY_RINGS), \
-				     bp->max_stat_ctx / 2U) : \
-				RTE_MIN(bp->max_rx_rings / 2U, \
-					bp->max_stat_ctx / 2U))
-#define BNXT_MAX_TX_RINGS(bp) \
-	(RTE_MIN((bp)->max_tx_rings, BNXT_MAX_RX_RINGS(bp)))
-
-#define BNXT_MAX_RINGS(bp) \
-	(RTE_MIN((((bp)->max_cp_rings - BNXT_NUM_ASYNC_CPR(bp)) / 2U), \
-		 BNXT_MAX_TX_RINGS(bp)))
 
 #define BNXT_MAX_VF_REP_RINGS	8
 
@@ -822,6 +809,34 @@ struct bnxt {
 	uint16_t		tx_cfa_action;
 };
 
+static
+inline uint16_t bnxt_max_rings(struct bnxt *bp)
+{
+	uint16_t max_tx_rings = bp->max_tx_rings;
+	uint16_t max_rx_rings = bp->max_rx_rings;
+	uint16_t max_cp_rings = bp->max_cp_rings;
+	uint16_t max_rings;
+
+	/* For the sake of symmetry:
+	 * max Tx rings == max Rx rings, one stat ctx for each.
+	 */
+	if (BNXT_STINGRAY(bp)) {
+		max_rx_rings = RTE_MIN(RTE_MIN(max_rx_rings / 2U,
+					       MAX_STINGRAY_RINGS),
+				       bp->max_stat_ctx / 2U);
+	} else {
+		max_rx_rings = RTE_MIN(max_rx_rings / 2U,
+				       bp->max_stat_ctx / 2U);
+	}
+
+	max_tx_rings = RTE_MIN(max_tx_rings, max_rx_rings);
+	if (max_cp_rings > BNXT_NUM_ASYNC_CPR(bp))
+		max_cp_rings -= BNXT_NUM_ASYNC_CPR(bp);
+	max_rings = RTE_MIN(max_cp_rings / 2U, max_tx_rings);
+
+	return max_rings;
+}
+
 #define BNXT_FC_TIMER	1 /* Timer freq in Sec Flow Counters */
 
 /**
diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c
index 0b14ca234..bf8963577 100644
--- a/drivers/net/bnxt/bnxt_ethdev.c
+++ b/drivers/net/bnxt/bnxt_ethdev.c
@@ -920,7 +920,7 @@ static int bnxt_dev_info_get_op(struct rte_eth_dev *eth_dev,
 	if (BNXT_PF(bp))
 		dev_info->max_vfs = pdev->max_vfs;
 
-	max_rx_rings = BNXT_MAX_RINGS(bp);
+	max_rx_rings = bnxt_max_rings(bp);
 	/* 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;
diff --git a/drivers/net/bnxt/bnxt_rxq.c b/drivers/net/bnxt/bnxt_rxq.c
index 328cc994d..19e11e47b 100644
--- a/drivers/net/bnxt/bnxt_rxq.c
+++ b/drivers/net/bnxt/bnxt_rxq.c
@@ -311,7 +311,7 @@ int bnxt_rx_queue_setup_op(struct rte_eth_dev *eth_dev,
 	if (rc)
 		return rc;
 
-	if (queue_idx >= BNXT_MAX_RINGS(bp)) {
+	if (queue_idx >= bnxt_max_rings(bp)) {
 		PMD_DRV_LOG(ERR,
 			"Cannot create Rx ring %d. Only %d rings available\n",
 			queue_idx, bp->max_rx_rings);
@@ -364,8 +364,9 @@ int bnxt_rx_queue_setup_op(struct rte_eth_dev *eth_dev,
 
 	eth_dev->data->rx_queues[queue_idx] = rxq;
 	/* Allocate RX ring hardware descriptors */
-	if (bnxt_alloc_rings(bp, queue_idx, NULL, rxq, rxq->cp_ring, NULL,
-			     "rxr")) {
+	rc = bnxt_alloc_rings(bp, queue_idx, NULL, rxq, rxq->cp_ring, NULL,
+			     "rxr");
+	if (rc) {
 		PMD_DRV_LOG(ERR,
 			    "ring_dma_zone_reserve for rx_ring failed!\n");
 		goto err;
diff --git a/drivers/net/bnxt/bnxt_txq.c b/drivers/net/bnxt/bnxt_txq.c
index c9792a2af..99a31cef2 100644
--- a/drivers/net/bnxt/bnxt_txq.c
+++ b/drivers/net/bnxt/bnxt_txq.c
@@ -98,7 +98,7 @@ int bnxt_tx_queue_setup_op(struct rte_eth_dev *eth_dev,
 	if (rc)
 		return rc;
 
-	if (queue_idx >= BNXT_MAX_RINGS(bp)) {
+	if (queue_idx >= bnxt_max_rings(bp)) {
 		PMD_DRV_LOG(ERR,
 			"Cannot create Tx ring %d. Only %d rings available\n",
 			queue_idx, bp->max_tx_rings);
-- 
2.21.1 (Apple Git-122.3)


^ permalink raw reply	[flat|nested] 47+ messages in thread

* [dpdk-dev] [PATCH v3 10/17] net/bnxt: support for 236 queues in NS3
  2020-12-09 23:53 ` [dpdk-dev] [PATCH v3 00/17] fixes and refactoring changes for bnxt Ajit Khaparde
                     ` (8 preceding siblings ...)
  2020-12-09 23:53   ` [dpdk-dev] [PATCH v3 09/17] net/bnxt: fix max rings computation Ajit Khaparde
@ 2020-12-09 23:53   ` Ajit Khaparde
  2020-12-09 23:53   ` [dpdk-dev] [PATCH v3 11/17] net/bnxt: use the right function to free mbuf Ajit Khaparde
                     ` (7 subsequent siblings)
  17 siblings, 0 replies; 47+ messages in thread
From: Ajit Khaparde @ 2020-12-09 23:53 UTC (permalink / raw)
  To: dev; +Cc: Rahul Gupta

From: Rahul Gupta <rahul.gupta@broadcom.com>

For NS3, increased CONFIG_RTE_ETHDEV_QUEUE_STAT_CNTRS to support
236 counters and increased MAX_STINGRAY_RINGS in driver to support
more rings.

Signed-off-by: Rahul Gupta <rahul.gupta@broadcom.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
---
 drivers/net/bnxt/bnxt.h | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/net/bnxt/bnxt.h b/drivers/net/bnxt/bnxt.h
index bc0935272..2a318efaf 100644
--- a/drivers/net/bnxt/bnxt.h
+++ b/drivers/net/bnxt/bnxt.h
@@ -751,8 +751,7 @@ struct bnxt {
 	uint16_t		max_cp_rings;
 	uint16_t		max_tx_rings;
 	uint16_t		max_rx_rings;
-#define MAX_STINGRAY_RINGS		128U
-
+#define MAX_STINGRAY_RINGS		236U
 #define BNXT_MAX_VF_REP_RINGS	8
 
 	uint16_t		max_nq_rings;
-- 
2.21.1 (Apple Git-122.3)


^ permalink raw reply	[flat|nested] 47+ messages in thread

* [dpdk-dev] [PATCH v3 11/17] net/bnxt: use the right function to free mbuf
  2020-12-09 23:53 ` [dpdk-dev] [PATCH v3 00/17] fixes and refactoring changes for bnxt Ajit Khaparde
                     ` (9 preceding siblings ...)
  2020-12-09 23:53   ` [dpdk-dev] [PATCH v3 10/17] net/bnxt: support for 236 queues in NS3 Ajit Khaparde
@ 2020-12-09 23:53   ` Ajit Khaparde
  2020-12-10 15:56     ` Lance Richardson
  2020-12-09 23:53   ` [dpdk-dev] [PATCH v3 12/17] net/bnxt: remove function declaration Ajit Khaparde
                     ` (6 subsequent siblings)
  17 siblings, 1 reply; 47+ messages in thread
From: Ajit Khaparde @ 2020-12-09 23:53 UTC (permalink / raw)
  To: dev; +Cc: Somnath Kotur

mbufs are being allocated using rte_mbuf_raw_alloc().
Use corresponding rte_mbuf_raw_free() to free mbuf.

Signed-off-by: Somnath Kotur <somnath.kotur@broadcom.com>

Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
---
 drivers/net/bnxt/bnxt_reps.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/bnxt/bnxt_reps.c b/drivers/net/bnxt/bnxt_reps.c
index e5ba0909b..167c46ad4 100644
--- a/drivers/net/bnxt/bnxt_reps.c
+++ b/drivers/net/bnxt/bnxt_reps.c
@@ -65,7 +65,7 @@ bnxt_vfr_recv(uint16_t port_id, uint16_t queue_id, struct rte_mbuf *mbuf)
 		/* Representor Rx ring full, drop pkt */
 		vfr_bp->rx_drop_bytes[que] += mbuf->pkt_len;
 		vfr_bp->rx_drop_pkts[que]++;
-		rte_pktmbuf_free(mbuf);
+		rte_mbuf_raw_free(mbuf);
 	}
 
 	return 0;
-- 
2.21.1 (Apple Git-122.3)


^ permalink raw reply	[flat|nested] 47+ messages in thread

* [dpdk-dev] [PATCH v3 12/17] net/bnxt: remove function declaration
  2020-12-09 23:53 ` [dpdk-dev] [PATCH v3 00/17] fixes and refactoring changes for bnxt Ajit Khaparde
                     ` (10 preceding siblings ...)
  2020-12-09 23:53   ` [dpdk-dev] [PATCH v3 11/17] net/bnxt: use the right function to free mbuf Ajit Khaparde
@ 2020-12-09 23:53   ` Ajit Khaparde
  2020-12-10 15:57     ` Lance Richardson
  2020-12-09 23:53   ` [dpdk-dev] [PATCH v3 13/17] net/bnxt: fix vnic RSS configure function Ajit Khaparde
                     ` (5 subsequent siblings)
  17 siblings, 1 reply; 47+ messages in thread
From: Ajit Khaparde @ 2020-12-09 23:53 UTC (permalink / raw)
  To: dev

Remove an orphan function declaration.
It has not been defined yet and hence not used anywhere.

Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
---
 drivers/net/bnxt/bnxt_hwrm.h | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/net/bnxt/bnxt_hwrm.h b/drivers/net/bnxt/bnxt_hwrm.h
index 23ca6ab51..4b3290773 100644
--- a/drivers/net/bnxt/bnxt_hwrm.h
+++ b/drivers/net/bnxt/bnxt_hwrm.h
@@ -288,8 +288,6 @@ int bnxt_hwrm_cfa_counter_qstats(struct bnxt *bp,
 				 enum bnxt_flow_dir dir,
 				 uint16_t cntr,
 				 uint16_t num_entries);
-int bnxt_hwrm_get_dflt_vnic_id(struct bnxt *bp, uint16_t fid,
-			       uint16_t *vnic_id);
 int bnxt_hwrm_get_dflt_vnic_svif(struct bnxt *bp, uint16_t fid,
 				 uint16_t *vnic_id, uint16_t *svif);
 int bnxt_hwrm_parent_pf_qcfg(struct bnxt *bp);
-- 
2.21.1 (Apple Git-122.3)


^ permalink raw reply	[flat|nested] 47+ messages in thread

* [dpdk-dev] [PATCH v3 13/17] net/bnxt: fix vnic RSS configure function
  2020-12-09 23:53 ` [dpdk-dev] [PATCH v3 00/17] fixes and refactoring changes for bnxt Ajit Khaparde
                     ` (11 preceding siblings ...)
  2020-12-09 23:53   ` [dpdk-dev] [PATCH v3 12/17] net/bnxt: remove function declaration Ajit Khaparde
@ 2020-12-09 23:53   ` Ajit Khaparde
  2020-12-09 23:53   ` [dpdk-dev] [PATCH v3 14/17] net/bnxt: fix PF resource query Ajit Khaparde
                     ` (4 subsequent siblings)
  17 siblings, 0 replies; 47+ messages in thread
From: Ajit Khaparde @ 2020-12-09 23:53 UTC (permalink / raw)
  To: dev; +Cc: Kalesh AP, stable, Somnath Kotur

From: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>

1. moved invalid VNIC id check to the beginning of the function.
2. removed a duplicate check which avoids unnecessary code indentation.

Fixes: 49d0709b257fc ("net/bnxt: delete and flush L2 filters cleanly")
Cc: stable@dpdk.org

Signed-off-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
Reviewed-by: Somnath Kotur <somnath.kotur@broadcom.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
---
 drivers/net/bnxt/bnxt_hwrm.c | 42 +++++++++++++++++-------------------
 1 file changed, 20 insertions(+), 22 deletions(-)

diff --git a/drivers/net/bnxt/bnxt_hwrm.c b/drivers/net/bnxt/bnxt_hwrm.c
index 6f5402070..cee2656c1 100644
--- a/drivers/net/bnxt/bnxt_hwrm.c
+++ b/drivers/net/bnxt/bnxt_hwrm.c
@@ -4896,37 +4896,35 @@ int bnxt_vnic_rss_configure(struct bnxt *bp, struct bnxt_vnic_info *vnic)
 {
 	unsigned int rss_idx, fw_idx, i;
 
+	if (vnic->fw_vnic_id == INVALID_HW_RING_ID)
+		return 0;
+
 	if (!(vnic->rss_table && vnic->hash_type))
 		return 0;
 
 	if (BNXT_CHIP_P5(bp))
 		return bnxt_vnic_rss_configure_p5(bp, vnic);
 
-	if (vnic->fw_vnic_id == INVALID_HW_RING_ID)
-		return 0;
-
-	if (vnic->rss_table && vnic->hash_type) {
-		/*
-		 * Fill the RSS hash & redirection table with
-		 * ring group ids for all VNICs
-		 */
-		for (rss_idx = 0, fw_idx = 0; rss_idx < HW_HASH_INDEX_SIZE;
-			rss_idx++, fw_idx++) {
-			for (i = 0; i < bp->rx_cp_nr_rings; i++) {
-				fw_idx %= bp->rx_cp_nr_rings;
-				if (vnic->fw_grp_ids[fw_idx] !=
-				    INVALID_HW_RING_ID)
-					break;
-				fw_idx++;
-			}
-			if (i == bp->rx_cp_nr_rings)
-				return 0;
-			vnic->rss_table[rss_idx] = vnic->fw_grp_ids[fw_idx];
+	/*
+	 * Fill the RSS hash & redirection table with
+	 * ring group ids for all VNICs
+	 */
+	for (rss_idx = 0, fw_idx = 0; rss_idx < HW_HASH_INDEX_SIZE;
+	     rss_idx++, fw_idx++) {
+		for (i = 0; i < bp->rx_cp_nr_rings; i++) {
+			fw_idx %= bp->rx_cp_nr_rings;
+			if (vnic->fw_grp_ids[fw_idx] != INVALID_HW_RING_ID)
+				break;
+			fw_idx++;
 		}
-		return bnxt_hwrm_vnic_rss_cfg(bp, vnic);
+
+		if (i == bp->rx_cp_nr_rings)
+			return 0;
+
+		vnic->rss_table[rss_idx] = vnic->fw_grp_ids[fw_idx];
 	}
 
-	return 0;
+	return bnxt_hwrm_vnic_rss_cfg(bp, vnic);
 }
 
 static void bnxt_hwrm_set_coal_params(struct bnxt_coal *hw_coal,
-- 
2.21.1 (Apple Git-122.3)


^ permalink raw reply	[flat|nested] 47+ messages in thread

* [dpdk-dev] [PATCH v3 14/17] net/bnxt: fix PF resource query
  2020-12-09 23:53 ` [dpdk-dev] [PATCH v3 00/17] fixes and refactoring changes for bnxt Ajit Khaparde
                     ` (12 preceding siblings ...)
  2020-12-09 23:53   ` [dpdk-dev] [PATCH v3 13/17] net/bnxt: fix vnic RSS configure function Ajit Khaparde
@ 2020-12-09 23:53   ` Ajit Khaparde
  2020-12-09 23:53   ` [dpdk-dev] [PATCH v3 15/17] net/bnxt: changes to indentation and coding style Ajit Khaparde
                     ` (3 subsequent siblings)
  17 siblings, 0 replies; 47+ messages in thread
From: Ajit Khaparde @ 2020-12-09 23:53 UTC (permalink / raw)
  To: dev; +Cc: Somnath Kotur, stable, Venkat Duvvuru, Kalesh AP

From: Somnath Kotur <somnath.kotur@broadcom.com>

This cmd should be called by every driver after 'hwrm_func_cfg'
to get the actual number of resources allocated by the HWRM.
The values returned in the cmd are the max values for that PF.

Also, now that the max values for the PF are computed in probe itself,
no need to invoke FUNC_QCAPs or any other cmd in dev_configure_op()
as that would just override the actual max values obtained above.

Fixes: f8168ca0e690 ("net/bnxt: support thor controller")
Cc: stable@dpdk.org

Signed-off-by: Somnath Kotur <somnath.kotur@broadcom.com>
Reviewed-by: Venkat Duvvuru <venkatkumar.duvvuru@broadcom.com>
Reviewed-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
---
 drivers/net/bnxt/bnxt_ethdev.c |  7 -------
 drivers/net/bnxt/bnxt_hwrm.c   | 36 +++++++++++++++++++++++++++++++++-
 2 files changed, 35 insertions(+), 8 deletions(-)

diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c
index bf8963577..21d9e26ca 100644
--- a/drivers/net/bnxt/bnxt_ethdev.c
+++ b/drivers/net/bnxt/bnxt_ethdev.c
@@ -1071,13 +1071,6 @@ static int bnxt_dev_configure_op(struct rte_eth_dev *eth_dev)
 		}
 
 		pthread_mutex_unlock(&bp->def_cp_lock);
-	} else {
-		/* legacy driver needs to get updated values */
-		rc = bnxt_hwrm_func_qcaps(bp);
-		if (rc) {
-			PMD_DRV_LOG(ERR, "hwrm func qcaps fail:%d\n", rc);
-			return rc;
-		}
 	}
 
 	/* Inherit new configurations */
diff --git a/drivers/net/bnxt/bnxt_hwrm.c b/drivers/net/bnxt/bnxt_hwrm.c
index cee2656c1..a3eb133c0 100644
--- a/drivers/net/bnxt/bnxt_hwrm.c
+++ b/drivers/net/bnxt/bnxt_hwrm.c
@@ -3456,6 +3456,35 @@ static int bnxt_update_max_resources(struct bnxt *bp,
 	return 0;
 }
 
+/* Update the PF resource values based on how many resources
+ * got allocated to it.
+ */
+static int bnxt_update_max_resources_pf_only(struct bnxt *bp)
+{
+	struct hwrm_func_qcfg_input req = {0};
+	struct hwrm_func_qcfg_output *resp = bp->hwrm_cmd_resp_addr;
+	int rc;
+
+	/* Get the actual allocated values now */
+	HWRM_PREP(&req, HWRM_FUNC_QCFG, BNXT_USE_CHIMP_MB);
+	req.fid = rte_cpu_to_le_16(0xffff);
+	rc = bnxt_hwrm_send_message(bp, &req, sizeof(req), BNXT_USE_CHIMP_MB);
+	HWRM_CHECK_RESULT();
+
+	bp->max_rsscos_ctx = rte_le_to_cpu_16(resp->alloc_rsscos_ctx);
+	bp->max_stat_ctx = rte_le_to_cpu_16(resp->alloc_stat_ctx);
+	bp->max_cp_rings = rte_le_to_cpu_16(resp->alloc_cmpl_rings);
+	bp->max_tx_rings = rte_le_to_cpu_16(resp->alloc_tx_rings);
+	bp->max_rx_rings = rte_le_to_cpu_16(resp->alloc_rx_rings);
+	bp->max_l2_ctx = rte_le_to_cpu_16(resp->alloc_l2_ctx);
+	bp->max_ring_grps = rte_le_to_cpu_16(resp->alloc_hw_ring_grps);
+	bp->max_vnics = rte_le_to_cpu_16(resp->alloc_vnics);
+
+	HWRM_UNLOCK();
+
+	return 0;
+}
+
 int bnxt_hwrm_func_qcfg_current_vf_vlan(struct bnxt *bp, int vf)
 {
 	struct hwrm_func_qcfg_input req = {0};
@@ -3555,8 +3584,13 @@ int bnxt_hwrm_allocate_pf_only(struct bnxt *bp)
 		  HWRM_FUNC_CFG_INPUT_FLAGS_STD_TX_RING_MODE_DISABLE);
 	bp->pf->func_cfg_flags |=
 		HWRM_FUNC_CFG_INPUT_FLAGS_STD_TX_RING_MODE_DISABLE;
+
 	rc = bnxt_hwrm_pf_func_cfg(bp, &pf_resc);
-	rc = __bnxt_hwrm_func_qcaps(bp);
+	if (rc)
+		return rc;
+
+	rc = bnxt_update_max_resources_pf_only(bp);
+
 	return rc;
 }
 
-- 
2.21.1 (Apple Git-122.3)


^ permalink raw reply	[flat|nested] 47+ messages in thread

* [dpdk-dev] [PATCH v3 15/17] net/bnxt: changes to indentation and coding style
  2020-12-09 23:53 ` [dpdk-dev] [PATCH v3 00/17] fixes and refactoring changes for bnxt Ajit Khaparde
                     ` (13 preceding siblings ...)
  2020-12-09 23:53   ` [dpdk-dev] [PATCH v3 14/17] net/bnxt: fix PF resource query Ajit Khaparde
@ 2020-12-09 23:53   ` Ajit Khaparde
  2020-12-10 15:59     ` Lance Richardson
  2020-12-09 23:53   ` [dpdk-dev] [PATCH v3 16/17] net/bnxt: add missing comments Ajit Khaparde
                     ` (2 subsequent siblings)
  17 siblings, 1 reply; 47+ messages in thread
From: Ajit Khaparde @ 2020-12-09 23:53 UTC (permalink / raw)
  To: dev

Indentation and coding style fixes.

Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
---
 drivers/net/bnxt/bnxt.h        | 4 ++--
 drivers/net/bnxt/bnxt_ethdev.c | 9 ++++-----
 drivers/net/bnxt/bnxt_reps.c   | 2 +-
 drivers/net/bnxt/bnxt_ring.c   | 3 +--
 4 files changed, 8 insertions(+), 10 deletions(-)

diff --git a/drivers/net/bnxt/bnxt.h b/drivers/net/bnxt/bnxt.h
index 2a318efaf..556e99203 100644
--- a/drivers/net/bnxt/bnxt.h
+++ b/drivers/net/bnxt/bnxt.h
@@ -127,9 +127,9 @@
  */
 #ifdef RTE_EXEC_ENV_FREEBSD
 /* In FreeBSD OS, nic_uio driver does not support interrupts */
-#define BNXT_NUM_ASYNC_CPR(bp) 0
+#define BNXT_NUM_ASYNC_CPR(bp) 0U
 #else
-#define BNXT_NUM_ASYNC_CPR(bp) 1
+#define BNXT_NUM_ASYNC_CPR(bp) 1U
 #endif
 
 #define BNXT_MISC_VEC_ID               RTE_INTR_VEC_ZERO_OFFSET
diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c
index 21d9e26ca..9d5c8aa0f 100644
--- a/drivers/net/bnxt/bnxt_ethdev.c
+++ b/drivers/net/bnxt/bnxt_ethdev.c
@@ -1264,11 +1264,10 @@ static int bnxt_dev_start_op(struct rte_eth_dev *eth_dev)
 		return -EINVAL;
 	}
 
-	if (bp->rx_cp_nr_rings > RTE_ETHDEV_QUEUE_STAT_CNTRS) {
+	if (bp->rx_cp_nr_rings > RTE_ETHDEV_QUEUE_STAT_CNTRS)
 		PMD_DRV_LOG(ERR,
-			"RxQ cnt %d > RTE_ETHDEV_QUEUE_STAT_CNTRS %d\n",
-			bp->rx_cp_nr_rings, RTE_ETHDEV_QUEUE_STAT_CNTRS);
-	}
+			    "RxQ cnt %d > RTE_ETHDEV_QUEUE_STAT_CNTRS %d\n",
+			    bp->rx_cp_nr_rings, RTE_ETHDEV_QUEUE_STAT_CNTRS);
 
 	do {
 		rc = bnxt_hwrm_if_change(bp, true);
@@ -1622,7 +1621,7 @@ int bnxt_link_update_op(struct rte_eth_dev *eth_dev, int wait_to_complete)
 out:
 	/* Timed out or success */
 	if (new.link_status != eth_dev->data->dev_link.link_status ||
-	new.link_speed != eth_dev->data->dev_link.link_speed) {
+	    new.link_speed != eth_dev->data->dev_link.link_speed) {
 		rte_eth_linkstatus_set(eth_dev, &new);
 
 		rte_eth_dev_callback_process(eth_dev,
diff --git a/drivers/net/bnxt/bnxt_reps.c b/drivers/net/bnxt/bnxt_reps.c
index 167c46ad4..12d677d32 100644
--- a/drivers/net/bnxt/bnxt_reps.c
+++ b/drivers/net/bnxt/bnxt_reps.c
@@ -56,7 +56,7 @@ bnxt_vfr_recv(uint16_t port_id, uint16_t queue_id, struct rte_mbuf *mbuf)
 
 	/* Put this mbuf on the RxQ of the Representor */
 	prod_rx_buf = &rep_rxr->rx_buf_ring[rep_rxr->rx_prod & mask];
-	if (!*prod_rx_buf) {
+	if (*prod_rx_buf == NULL) {
 		*prod_rx_buf = mbuf;
 		vfr_bp->rx_bytes[que] += mbuf->pkt_len;
 		vfr_bp->rx_pkts[que]++;
diff --git a/drivers/net/bnxt/bnxt_ring.c b/drivers/net/bnxt/bnxt_ring.c
index 579c48d8c..f83bcaba2 100644
--- a/drivers/net/bnxt/bnxt_ring.c
+++ b/drivers/net/bnxt/bnxt_ring.c
@@ -599,8 +599,7 @@ int bnxt_alloc_hwrm_rx_ring(struct bnxt *bp, int queue_index)
 
 	if (rxq->rx_started) {
 		if (bnxt_init_one_rx_ring(rxq)) {
-			PMD_DRV_LOG(ERR,
-				"bnxt_init_one_rx_ring failed!\n");
+			PMD_DRV_LOG(ERR, "bnxt_init_one_rx_ring failed!\n");
 			bnxt_rx_queue_release_op(rxq);
 			rc = -ENOMEM;
 			goto err_out;
-- 
2.21.1 (Apple Git-122.3)


^ permalink raw reply	[flat|nested] 47+ messages in thread

* [dpdk-dev] [PATCH v3 16/17] net/bnxt: add missing comments
  2020-12-09 23:53 ` [dpdk-dev] [PATCH v3 00/17] fixes and refactoring changes for bnxt Ajit Khaparde
                     ` (14 preceding siblings ...)
  2020-12-09 23:53   ` [dpdk-dev] [PATCH v3 15/17] net/bnxt: changes to indentation and coding style Ajit Khaparde
@ 2020-12-09 23:53   ` Ajit Khaparde
  2020-12-10 16:02     ` Lance Richardson
  2020-12-09 23:53   ` [dpdk-dev] [PATCH v3 17/17] net/bnxt: modify ring index logic Ajit Khaparde
  2020-12-11  2:42   ` [dpdk-dev] [PATCH v3 00/17] fixes and refactoring changes for bnxt Ajit Khaparde
  17 siblings, 1 reply; 47+ messages in thread
From: Ajit Khaparde @ 2020-12-09 23:53 UTC (permalink / raw)
  To: dev

Add and update some missing comments in the code.

Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
---
 drivers/net/bnxt/bnxt.h                         | 6 ++++++
 drivers/net/bnxt/tf_ulp/ulp_template_db_act.c   | 5 +++++
 drivers/net/bnxt/tf_ulp/ulp_template_db_class.c | 6 ++++++
 3 files changed, 17 insertions(+)

diff --git a/drivers/net/bnxt/bnxt.h b/drivers/net/bnxt/bnxt.h
index 556e99203..07d39ee93 100644
--- a/drivers/net/bnxt/bnxt.h
+++ b/drivers/net/bnxt/bnxt.h
@@ -724,7 +724,13 @@ struct bnxt {
 	void				*hwrm_short_cmd_req_addr;
 	rte_iova_t			hwrm_short_cmd_req_dma_addr;
 	rte_spinlock_t			hwrm_lock;
+	/* synchronize between dev_configure_op and int handler */
 	pthread_mutex_t			def_cp_lock;
+	/* synchronize between dev_start_op and async evt handler
+	 * Locking sequence in async evt handler will be
+	 * def_cp_lock
+	 * health_check_lock
+	 */
 	pthread_mutex_t			health_check_lock;
 	uint16_t			max_req_len;
 	uint16_t			max_resp_len;
diff --git a/drivers/net/bnxt/tf_ulp/ulp_template_db_act.c b/drivers/net/bnxt/tf_ulp/ulp_template_db_act.c
index 00ada607a..509af7c58 100644
--- a/drivers/net/bnxt/tf_ulp/ulp_template_db_act.c
+++ b/drivers/net/bnxt/tf_ulp/ulp_template_db_act.c
@@ -8,6 +8,10 @@
 #include "ulp_template_struct.h"
 #include "ulp_rte_parser.h"
 
+/*
+ * Action signature table:
+ * maps hash id to ulp_act_match_list[] index
+ */
 uint16_t ulp_act_sig_tbl[BNXT_ULP_ACT_SIG_TBL_MAX_SZ] = {
 	[BNXT_ULP_ACT_HID_015a] = 1,
 	[BNXT_ULP_ACT_HID_00eb] = 2,
@@ -93,6 +97,7 @@ uint16_t ulp_act_sig_tbl[BNXT_ULP_ACT_SIG_TBL_MAX_SZ] = {
 	[BNXT_ULP_ACT_HID_0b4e] = 82
 };
 
+/* Array for the act matcher list */
 struct bnxt_ulp_act_match_info ulp_act_match_list[] = {
 	[1] = {
 	.act_hid = BNXT_ULP_ACT_HID_015a,
diff --git a/drivers/net/bnxt/tf_ulp/ulp_template_db_class.c b/drivers/net/bnxt/tf_ulp/ulp_template_db_class.c
index fdb26da3e..d904a04cb 100644
--- a/drivers/net/bnxt/tf_ulp/ulp_template_db_class.c
+++ b/drivers/net/bnxt/tf_ulp/ulp_template_db_class.c
@@ -8,6 +8,11 @@
 #include "ulp_template_struct.h"
 #include "ulp_rte_parser.h"
 
+/* Define the template structures */
+/*
+ * Classification signature table:
+ * maps hash id to ulp_class_match_list[] index
+ */
 uint16_t ulp_class_sig_tbl[BNXT_ULP_CLASS_SIG_TBL_MAX_SZ] = {
 	[BNXT_ULP_CLASS_HID_0138] = 1,
 	[BNXT_ULP_CLASS_HID_03f0] = 2,
@@ -227,6 +232,7 @@ uint16_t ulp_class_sig_tbl[BNXT_ULP_CLASS_SIG_TBL_MAX_SZ] = {
 	[BNXT_ULP_CLASS_HID_01b4] = 216
 };
 
+/* Array for the proto matcher list */
 struct bnxt_ulp_class_match_info ulp_class_match_list[] = {
 	[1] = {
 	.class_hid = BNXT_ULP_CLASS_HID_0138,
-- 
2.21.1 (Apple Git-122.3)


^ permalink raw reply	[flat|nested] 47+ messages in thread

* [dpdk-dev] [PATCH v3 17/17] net/bnxt: modify ring index logic
  2020-12-09 23:53 ` [dpdk-dev] [PATCH v3 00/17] fixes and refactoring changes for bnxt Ajit Khaparde
                     ` (15 preceding siblings ...)
  2020-12-09 23:53   ` [dpdk-dev] [PATCH v3 16/17] net/bnxt: add missing comments Ajit Khaparde
@ 2020-12-09 23:53   ` Ajit Khaparde
  2020-12-10 14:23     ` Lance Richardson
  2020-12-11  2:42   ` [dpdk-dev] [PATCH v3 00/17] fixes and refactoring changes for bnxt Ajit Khaparde
  17 siblings, 1 reply; 47+ messages in thread
From: Ajit Khaparde @ 2020-12-09 23:53 UTC (permalink / raw)
  To: dev

Change the ring logic so that the index increments
unbounded and mask it only when needed.

Modify the existing macros so that the index is not masked.
Add a new macro RING_IDX() to mask it only when needed.
-
v2->v3: Updated the index calculation in Tx completion processing.

Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
---
 drivers/net/bnxt/bnxt_cpr.h             |  10 ++-
 drivers/net/bnxt/bnxt_hwrm.c            |   4 +-
 drivers/net/bnxt/bnxt_reps.c            |   4 +-
 drivers/net/bnxt/bnxt_ring.c            |  39 +++++----
 drivers/net/bnxt/bnxt_ring.h            |  40 ++++++---
 drivers/net/bnxt/bnxt_rxr.c             | 110 +++++++++++++-----------
 drivers/net/bnxt/bnxt_rxr.h             |   4 +-
 drivers/net/bnxt/bnxt_rxtx_vec_common.h |  14 +--
 drivers/net/bnxt/bnxt_rxtx_vec_neon.c   |  16 ++--
 drivers/net/bnxt/bnxt_rxtx_vec_sse.c    |  16 ++--
 drivers/net/bnxt/bnxt_txr.c             |  51 ++++++-----
 drivers/net/bnxt/bnxt_txr.h             |   6 +-
 12 files changed, 179 insertions(+), 135 deletions(-)

diff --git a/drivers/net/bnxt/bnxt_cpr.h b/drivers/net/bnxt/bnxt_cpr.h
index ff9697f4c..a763f6006 100644
--- a/drivers/net/bnxt/bnxt_cpr.h
+++ b/drivers/net/bnxt/bnxt_cpr.h
@@ -45,7 +45,7 @@ struct bnxt_db_info;
 } while (0)
 #define B_CP_DB_REARM(cpr, raw_cons)					\
 	rte_write32((DB_CP_REARM_FLAGS |				\
-		    RING_CMP(((cpr)->cp_ring_struct), raw_cons)),	\
+		    DB_RING_IDX(&((cpr)->cp_db), raw_cons)),		\
 		    ((cpr)->cp_db.doorbell))
 
 #define B_CP_DB_ARM(cpr)	rte_write32((DB_KEY_CP),		\
@@ -65,8 +65,8 @@ struct bnxt_db_info;
 } while (0)
 #define B_CP_DIS_DB(cpr, raw_cons)					\
 	rte_write32_relaxed((DB_CP_FLAGS |				\
-			    RING_CMP(((cpr)->cp_ring_struct), raw_cons)), \
-			    ((cpr)->cp_db.doorbell))
+		    DB_RING_IDX(&((cpr)->cp_db), raw_cons)),		\
+		    ((cpr)->cp_db.doorbell))
 
 #define B_CP_DB(cpr, raw_cons, ring_mask)				\
 	rte_write32((DB_CP_FLAGS |					\
@@ -80,8 +80,11 @@ struct bnxt_db_info {
 		uint32_t        db_key32;
 	};
 	bool                    db_64;
+	uint32_t		db_ring_mask;
 };
 
+#define DB_RING_IDX(db, idx)	((idx) & (db)->db_ring_mask)
+
 struct bnxt_ring;
 struct bnxt_cp_ring_info {
 	uint32_t		cp_raw_cons;
@@ -95,7 +98,6 @@ struct bnxt_cp_ring_info {
 	uint32_t		hw_stats_ctx_id;
 
 	struct bnxt_ring	*cp_ring_struct;
-	uint16_t		cp_cons;
 	bool			valid;
 };
 
diff --git a/drivers/net/bnxt/bnxt_hwrm.c b/drivers/net/bnxt/bnxt_hwrm.c
index a3eb133c0..73647fba8 100644
--- a/drivers/net/bnxt/bnxt_hwrm.c
+++ b/drivers/net/bnxt/bnxt_hwrm.c
@@ -2601,8 +2601,8 @@ bnxt_free_all_hwrm_rings(struct bnxt *bp)
 			memset(txr->tx_buf_ring, 0,
 					txr->tx_ring_struct->ring_size *
 					sizeof(*txr->tx_buf_ring));
-			txr->tx_prod = 0;
-			txr->tx_cons = 0;
+			txr->tx_raw_prod = 0;
+			txr->tx_raw_cons = 0;
 		}
 		if (cpr->cp_ring_struct->fw_ring_id != INVALID_HW_RING_ID) {
 			bnxt_free_cp_ring(bp, cpr);
diff --git a/drivers/net/bnxt/bnxt_reps.c b/drivers/net/bnxt/bnxt_reps.c
index 12d677d32..f7bbf77d3 100644
--- a/drivers/net/bnxt/bnxt_reps.c
+++ b/drivers/net/bnxt/bnxt_reps.c
@@ -55,12 +55,12 @@ bnxt_vfr_recv(uint16_t port_id, uint16_t queue_id, struct rte_mbuf *mbuf)
 	mask = rep_rxr->rx_ring_struct->ring_mask;
 
 	/* Put this mbuf on the RxQ of the Representor */
-	prod_rx_buf = &rep_rxr->rx_buf_ring[rep_rxr->rx_prod & mask];
+	prod_rx_buf = &rep_rxr->rx_buf_ring[rep_rxr->rx_raw_prod & mask];
 	if (*prod_rx_buf == NULL) {
 		*prod_rx_buf = mbuf;
 		vfr_bp->rx_bytes[que] += mbuf->pkt_len;
 		vfr_bp->rx_pkts[que]++;
-		rep_rxr->rx_prod++;
+		rep_rxr->rx_raw_prod++;
 	} else {
 		/* Representor Rx ring full, drop pkt */
 		vfr_bp->rx_drop_bytes[que] += mbuf->pkt_len;
diff --git a/drivers/net/bnxt/bnxt_ring.c b/drivers/net/bnxt/bnxt_ring.c
index f83bcaba2..adddf9bc4 100644
--- a/drivers/net/bnxt/bnxt_ring.c
+++ b/drivers/net/bnxt/bnxt_ring.c
@@ -342,7 +342,8 @@ static void bnxt_set_db(struct bnxt *bp,
 			struct bnxt_db_info *db,
 			uint32_t ring_type,
 			uint32_t map_idx,
-			uint32_t fid)
+			uint32_t fid,
+			uint32_t ring_mask)
 {
 	if (BNXT_CHIP_P5(bp)) {
 		if (BNXT_PF(bp))
@@ -381,6 +382,7 @@ static void bnxt_set_db(struct bnxt *bp,
 		}
 		db->db_64 = false;
 	}
+	db->db_ring_mask = ring_mask;
 }
 
 static int bnxt_alloc_cmpl_ring(struct bnxt *bp, int queue_index,
@@ -409,9 +411,9 @@ static int bnxt_alloc_cmpl_ring(struct bnxt *bp, int queue_index,
 	if (rc)
 		return rc;
 
-	cpr->cp_cons = 0;
+	cpr->cp_raw_cons = 0;
 	bnxt_set_db(bp, &cpr->cp_db, ring_type, cp_ring_index,
-		    cp_ring->fw_ring_id);
+		    cp_ring->fw_ring_id, cp_ring->ring_mask);
 	bnxt_db_cq(cpr);
 
 	return 0;
@@ -472,7 +474,7 @@ int bnxt_alloc_rxtx_nq_ring(struct bnxt *bp)
 	}
 
 	bnxt_set_db(bp, &nqr->cp_db, ring_type, ring_index,
-		    ring->fw_ring_id);
+		    ring->fw_ring_id, ring->ring_mask);
 	bnxt_db_nq(nqr);
 
 	bp->rxtx_nq_ring = nqr;
@@ -515,11 +517,12 @@ static int bnxt_alloc_rx_ring(struct bnxt *bp, int queue_index)
 	if (rc)
 		return rc;
 
-	rxr->rx_prod = 0;
+	rxr->rx_raw_prod = 0;
 	if (BNXT_HAS_RING_GRPS(bp))
 		bp->grp_info[queue_index].rx_fw_ring_id = ring->fw_ring_id;
-	bnxt_set_db(bp, &rxr->rx_db, ring_type, queue_index, ring->fw_ring_id);
-	bnxt_db_write(&rxr->rx_db, rxr->rx_prod);
+	bnxt_set_db(bp, &rxr->rx_db, ring_type, queue_index, ring->fw_ring_id,
+		    ring->ring_mask);
+	bnxt_db_write(&rxr->rx_db, rxr->rx_raw_prod);
 
 	return 0;
 }
@@ -551,11 +554,12 @@ static int bnxt_alloc_rx_agg_ring(struct bnxt *bp, int queue_index)
 	if (rc)
 		return rc;
 
-	rxr->ag_prod = 0;
+	rxr->ag_raw_prod = 0;
 	if (BNXT_HAS_RING_GRPS(bp))
 		bp->grp_info[queue_index].ag_fw_ring_id = ring->fw_ring_id;
-	bnxt_set_db(bp, &rxr->ag_db, ring_type, map_idx, ring->fw_ring_id);
-	bnxt_db_write(&rxr->ag_db, rxr->ag_prod);
+	bnxt_set_db(bp, &rxr->ag_db, ring_type, map_idx, ring->fw_ring_id,
+		    ring->ring_mask);
+	bnxt_db_write(&rxr->ag_db, rxr->ag_raw_prod);
 
 	return 0;
 }
@@ -604,8 +608,8 @@ int bnxt_alloc_hwrm_rx_ring(struct bnxt *bp, int queue_index)
 			rc = -ENOMEM;
 			goto err_out;
 		}
-		bnxt_db_write(&rxr->rx_db, rxr->rx_prod);
-		bnxt_db_write(&rxr->ag_db, rxr->ag_prod);
+		bnxt_db_write(&rxr->rx_db, rxr->rx_raw_prod);
+		bnxt_db_write(&rxr->ag_db, rxr->ag_raw_prod);
 	}
 	rxq->index = queue_index;
 #if defined(RTE_ARCH_X86) || defined(RTE_ARCH_ARM64)
@@ -710,8 +714,8 @@ int bnxt_alloc_hwrm_rings(struct bnxt *bp)
 			bnxt_rx_queue_release_op(rxq);
 			return -ENOMEM;
 		}
-		bnxt_db_write(&rxr->rx_db, rxr->rx_prod);
-		bnxt_db_write(&rxr->ag_db, rxr->ag_prod);
+		bnxt_db_write(&rxr->rx_db, rxr->rx_raw_prod);
+		bnxt_db_write(&rxr->ag_db, rxr->ag_raw_prod);
 		rxq->index = i;
 #if defined(RTE_ARCH_X86) || defined(RTE_ARCH_ARM64)
 		bnxt_rxq_vec_setup(rxq);
@@ -744,7 +748,8 @@ int bnxt_alloc_hwrm_rings(struct bnxt *bp)
 		if (rc)
 			goto err_out;
 
-		bnxt_set_db(bp, &txr->tx_db, ring_type, i, ring->fw_ring_id);
+		bnxt_set_db(bp, &txr->tx_db, ring_type, i, ring->fw_ring_id,
+			    ring->ring_mask);
 		txq->index = idx;
 		bnxt_hwrm_set_ring_coal(bp, &coal, cp_ring->fw_ring_id);
 	}
@@ -777,10 +782,10 @@ int bnxt_alloc_async_cp_ring(struct bnxt *bp)
 	if (rc)
 		return rc;
 
-	cpr->cp_cons = 0;
+	cpr->cp_raw_cons = 0;
 	cpr->valid = 0;
 	bnxt_set_db(bp, &cpr->cp_db, ring_type, 0,
-		    cp_ring->fw_ring_id);
+		    cp_ring->fw_ring_id, cp_ring->ring_mask);
 
 	if (BNXT_HAS_NQ(bp))
 		bnxt_db_nq(cpr);
diff --git a/drivers/net/bnxt/bnxt_ring.h b/drivers/net/bnxt/bnxt_ring.h
index 0a4685d16..49ae5c3c6 100644
--- a/drivers/net/bnxt/bnxt_ring.h
+++ b/drivers/net/bnxt/bnxt_ring.h
@@ -10,8 +10,9 @@
 
 #include <rte_memory.h>
 
-#define RING_ADV(ring, idx, n)		(((idx) + (n)) & (ring)->ring_mask)
-#define RING_NEXT(ring, idx)		RING_ADV(ring, idx, 1)
+#define RING_ADV(idx, n)		((idx) + (n))
+#define RING_NEXT(idx)			RING_ADV(idx, 1)
+#define RING_IDX(ring, idx)		((idx) & (ring)->ring_mask)
 
 #define DB_IDX_MASK						0xffffff
 #define DB_IDX_VALID						(0x1 << 26)
@@ -82,38 +83,51 @@ void bnxt_free_rxtx_nq_ring(struct bnxt *bp);
 
 static inline void bnxt_db_write(struct bnxt_db_info *db, uint32_t idx)
 {
-	if (db->db_64)
-		rte_write64(db->db_key64 | idx, db->doorbell);
-	else
-		rte_write32(db->db_key32 | idx, db->doorbell);
+	uint32_t db_idx = DB_RING_IDX(db, idx);
+	void *doorbell = db->doorbell;
+
+	if (db->db_64) {
+		uint64_t key_idx = db->db_key64 | db_idx;
+
+		rte_write64(key_idx, doorbell);
+	} else {
+		uint32_t key_idx = db->db_key32 | db_idx;
+
+		rte_write32(key_idx, doorbell);
+	}
 }
 
 /* Ring an NQ doorbell and disable interrupts for the ring. */
 static inline void bnxt_db_nq(struct bnxt_cp_ring_info *cpr)
 {
+	uint32_t db_idx = DB_RING_IDX(&cpr->cp_db, cpr->cp_raw_cons);
+	uint64_t key_idx = cpr->cp_db.db_key64 | DBR_TYPE_NQ | db_idx;
+	void *doorbell = cpr->cp_db.doorbell;
+
+
 	if (unlikely(!cpr->cp_db.db_64))
 		return;
 
-	rte_write64(cpr->cp_db.db_key64 | DBR_TYPE_NQ |
-		    RING_CMP(cpr->cp_ring_struct, cpr->cp_raw_cons),
-		    cpr->cp_db.doorbell);
+	rte_write64(key_idx, doorbell);
 }
 
 /* Ring an NQ doorbell and enable interrupts for the ring. */
 static inline void bnxt_db_nq_arm(struct bnxt_cp_ring_info *cpr)
 {
+	uint32_t db_idx = DB_RING_IDX(&cpr->cp_db, cpr->cp_raw_cons);
+	uint64_t key_idx = cpr->cp_db.db_key64 | DBR_TYPE_NQ_ARM | db_idx;
+	void *doorbell = cpr->cp_db.doorbell;
+
 	if (unlikely(!cpr->cp_db.db_64))
 		return;
 
-	rte_write64(cpr->cp_db.db_key64 | DBR_TYPE_NQ_ARM |
-		    RING_CMP(cpr->cp_ring_struct, cpr->cp_raw_cons),
-		    cpr->cp_db.doorbell);
+	rte_write64(key_idx, doorbell);
 }
 
 static inline void bnxt_db_cq(struct bnxt_cp_ring_info *cpr)
 {
 	struct bnxt_db_info *db = &cpr->cp_db;
-	uint32_t idx = RING_CMP(cpr->cp_ring_struct, cpr->cp_raw_cons);
+	uint32_t idx = DB_RING_IDX(&cpr->cp_db, cpr->cp_raw_cons);
 
 	if (db->db_64) {
 		uint64_t key_idx = db->db_key64 | idx;
diff --git a/drivers/net/bnxt/bnxt_rxr.c b/drivers/net/bnxt/bnxt_rxr.c
index e9c4fffed..445e6150d 100644
--- a/drivers/net/bnxt/bnxt_rxr.c
+++ b/drivers/net/bnxt/bnxt_rxr.c
@@ -39,12 +39,15 @@ static inline struct rte_mbuf *__bnxt_alloc_rx_data(struct rte_mempool *mb)
 
 static inline int bnxt_alloc_rx_data(struct bnxt_rx_queue *rxq,
 				     struct bnxt_rx_ring_info *rxr,
-				     uint16_t prod)
+				     uint16_t raw_prod)
 {
-	struct rx_prod_pkt_bd *rxbd = &rxr->rx_desc_ring[prod];
-	struct rte_mbuf **rx_buf = &rxr->rx_buf_ring[prod];
+	uint16_t prod = RING_IDX(rxr->rx_ring_struct, raw_prod);
+	struct rx_prod_pkt_bd *rxbd;
+	struct rte_mbuf **rx_buf;
 	struct rte_mbuf *mbuf;
 
+	rxbd = &rxr->rx_desc_ring[prod];
+	rx_buf = &rxr->rx_buf_ring[prod];
 	mbuf = __bnxt_alloc_rx_data(rxq->mb_pool);
 	if (!mbuf) {
 		rte_atomic64_inc(&rxq->rx_mbuf_alloc_fail);
@@ -61,12 +64,15 @@ static inline int bnxt_alloc_rx_data(struct bnxt_rx_queue *rxq,
 
 static inline int bnxt_alloc_ag_data(struct bnxt_rx_queue *rxq,
 				     struct bnxt_rx_ring_info *rxr,
-				     uint16_t prod)
+				     uint16_t raw_prod)
 {
-	struct rx_prod_pkt_bd *rxbd = &rxr->ag_desc_ring[prod];
-	struct rte_mbuf **rx_buf = &rxr->ag_buf_ring[prod];
+	uint16_t prod = RING_IDX(rxr->ag_ring_struct, raw_prod);
+	struct rx_prod_pkt_bd *rxbd;
+	struct rte_mbuf **rx_buf;
 	struct rte_mbuf *mbuf;
 
+	rxbd = &rxr->ag_desc_ring[prod];
+	rx_buf = &rxr->ag_buf_ring[prod];
 	if (rxbd == NULL) {
 		PMD_DRV_LOG(ERR, "Jumbo Frame. rxbd is NULL\n");
 		return -EINVAL;
@@ -94,10 +100,11 @@ static inline int bnxt_alloc_ag_data(struct bnxt_rx_queue *rxq,
 static inline void bnxt_reuse_rx_mbuf(struct bnxt_rx_ring_info *rxr,
 			       struct rte_mbuf *mbuf)
 {
-	uint16_t prod = RING_NEXT(rxr->rx_ring_struct, rxr->rx_prod);
+	uint16_t prod, raw_prod = RING_NEXT(rxr->rx_raw_prod);
 	struct rte_mbuf **prod_rx_buf;
 	struct rx_prod_pkt_bd *prod_bd;
 
+	prod = RING_IDX(rxr->rx_ring_struct, raw_prod);
 	prod_rx_buf = &rxr->rx_buf_ring[prod];
 
 	RTE_ASSERT(*prod_rx_buf == NULL);
@@ -109,7 +116,7 @@ static inline void bnxt_reuse_rx_mbuf(struct bnxt_rx_ring_info *rxr,
 
 	prod_bd->address = rte_cpu_to_le_64(rte_mbuf_data_iova_default(mbuf));
 
-	rxr->rx_prod = prod;
+	rxr->rx_raw_prod = raw_prod;
 }
 
 static inline
@@ -119,7 +126,7 @@ struct rte_mbuf *bnxt_consume_rx_buf(struct bnxt_rx_ring_info *rxr,
 	struct rte_mbuf **cons_rx_buf;
 	struct rte_mbuf *mbuf;
 
-	cons_rx_buf = &rxr->rx_buf_ring[cons];
+	cons_rx_buf = &rxr->rx_buf_ring[RING_IDX(rxr->rx_ring_struct, cons)];
 	RTE_ASSERT(*cons_rx_buf != NULL);
 	mbuf = *cons_rx_buf;
 	*cons_rx_buf = NULL;
@@ -175,7 +182,7 @@ static void bnxt_tpa_start(struct bnxt_rx_queue *rxq,
 		mbuf->ol_flags |= PKT_RX_L4_CKSUM_GOOD;
 
 	/* recycle next mbuf */
-	data_cons = RING_NEXT(rxr->rx_ring_struct, data_cons);
+	data_cons = RING_NEXT(data_cons);
 	bnxt_reuse_rx_mbuf(rxr, bnxt_consume_rx_buf(rxr, data_cons));
 }
 
@@ -198,18 +205,20 @@ static int bnxt_agg_bufs_valid(struct bnxt_cp_ring_info *cpr,
 static int bnxt_prod_ag_mbuf(struct bnxt_rx_queue *rxq)
 {
 	struct bnxt_rx_ring_info *rxr = rxq->rx_ring;
-	uint16_t next = RING_NEXT(rxr->ag_ring_struct, rxr->ag_prod);
+	uint16_t raw_next = RING_NEXT(rxr->ag_raw_prod);
+	uint16_t bmap_next = RING_IDX(rxr->ag_ring_struct, raw_next);
 
 	/* TODO batch allocation for better performance */
-	while (rte_bitmap_get(rxr->ag_bitmap, next)) {
-		if (unlikely(bnxt_alloc_ag_data(rxq, rxr, next))) {
-			PMD_DRV_LOG(ERR,
-				"agg mbuf alloc failed: prod=0x%x\n", next);
+	while (rte_bitmap_get(rxr->ag_bitmap, bmap_next)) {
+		if (unlikely(bnxt_alloc_ag_data(rxq, rxr, raw_next))) {
+			PMD_DRV_LOG(ERR, "agg mbuf alloc failed: prod=0x%x\n",
+				    raw_next);
 			break;
 		}
-		rte_bitmap_clear(rxr->ag_bitmap, next);
-		rxr->ag_prod = next;
-		next = RING_NEXT(rxr->ag_ring_struct, next);
+		rte_bitmap_clear(rxr->ag_bitmap, bmap_next);
+		rxr->ag_raw_prod = raw_next;
+		raw_next = RING_NEXT(raw_next);
+		bmap_next = RING_IDX(rxr->ag_ring_struct, raw_next);
 	}
 
 	return 0;
@@ -666,7 +675,7 @@ static int bnxt_rx_pkt(struct rte_mbuf **rx_pkt,
 	struct rx_pkt_cmpl *rxcmp;
 	struct rx_pkt_cmpl_hi *rxcmp1;
 	uint32_t tmp_raw_cons = *raw_cons;
-	uint16_t cons, prod, cp_cons =
+	uint16_t cons, raw_prod, cp_cons =
 	    RING_CMP(cpr->cp_ring_struct, tmp_raw_cons);
 	struct rte_mbuf *mbuf;
 	int rc = 0;
@@ -726,7 +735,7 @@ static int bnxt_rx_pkt(struct rte_mbuf **rx_pkt,
 	if (agg_buf && !bnxt_agg_bufs_valid(cpr, agg_buf, tmp_raw_cons))
 		return -EBUSY;
 
-	prod = rxr->rx_prod;
+	raw_prod = rxr->rx_raw_prod;
 
 	cons = rxcmp->opaque;
 	mbuf = bnxt_consume_rx_buf(rxr, cons);
@@ -786,13 +795,14 @@ static int bnxt_rx_pkt(struct rte_mbuf **rx_pkt,
 	 * calls in favour of a tight loop with the same function being called
 	 * in it.
 	 */
-	prod = RING_NEXT(rxr->rx_ring_struct, prod);
-	if (bnxt_alloc_rx_data(rxq, rxr, prod)) {
-		PMD_DRV_LOG(ERR, "mbuf alloc failed with prod=0x%x\n", prod);
+	raw_prod = RING_NEXT(raw_prod);
+	if (bnxt_alloc_rx_data(rxq, rxr, raw_prod)) {
+		PMD_DRV_LOG(ERR, "mbuf alloc failed with prod=0x%x\n",
+			    raw_prod);
 		rc = -ENOMEM;
 		goto rx;
 	}
-	rxr->rx_prod = prod;
+	rxr->rx_raw_prod = raw_prod;
 
 	if (BNXT_TRUFLOW_EN(bp) && (BNXT_VF_IS_TRUSTED(bp) || BNXT_PF(bp)) &&
 	    vfr_flag) {
@@ -826,13 +836,13 @@ uint16_t bnxt_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts,
 	struct bnxt_rx_queue *rxq = rx_queue;
 	struct bnxt_cp_ring_info *cpr = rxq->cp_ring;
 	struct bnxt_rx_ring_info *rxr = rxq->rx_ring;
+	uint16_t rx_raw_prod = rxr->rx_raw_prod;
+	uint16_t ag_raw_prod = rxr->ag_raw_prod;
 	uint32_t raw_cons = cpr->cp_raw_cons;
 	uint32_t cons;
 	int nb_rx_pkts = 0;
 	int nb_rep_rx_pkts = 0;
 	struct rx_pkt_cmpl *rxcmp;
-	uint16_t prod = rxr->rx_prod;
-	uint16_t ag_prod = rxr->ag_prod;
 	int rc = 0;
 	bool evt = false;
 
@@ -850,8 +860,8 @@ uint16_t bnxt_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts,
 	 */
 	while (unlikely(rxq->rxrearm_nb)) {
 		if (!bnxt_alloc_rx_data(rxq, rxr, rxq->rxrearm_start)) {
-			rxr->rx_prod = rxq->rxrearm_start;
-			bnxt_db_write(&rxr->rx_db, rxr->rx_prod);
+			rxr->rx_raw_prod = rxq->rxrearm_start;
+			bnxt_db_write(&rxr->rx_db, rxr->rx_raw_prod);
 			rxq->rxrearm_start++;
 			rxq->rxrearm_nb--;
 		} else {
@@ -895,7 +905,7 @@ uint16_t bnxt_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts,
 			break;
 		/* Post some Rx buf early in case of larger burst processing */
 		if (nb_rx_pkts == BNXT_RX_POST_THRESH)
-			bnxt_db_write(&rxr->rx_db, rxr->rx_prod);
+			bnxt_db_write(&rxr->rx_db, rxr->rx_raw_prod);
 	}
 
 	cpr->cp_raw_cons = raw_cons;
@@ -907,23 +917,27 @@ uint16_t bnxt_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts,
 		goto done;
 	}
 
-	if (prod != rxr->rx_prod)
-		bnxt_db_write(&rxr->rx_db, rxr->rx_prod);
+	rte_compiler_barrier();
+	if (rx_raw_prod != rxr->rx_raw_prod)
+		bnxt_db_write(&rxr->rx_db, rxr->rx_raw_prod);
 
+	rte_compiler_barrier();
 	/* Ring the AGG ring DB */
-	if (ag_prod != rxr->ag_prod)
-		bnxt_db_write(&rxr->ag_db, rxr->ag_prod);
+	if (ag_raw_prod != rxr->ag_raw_prod)
+		bnxt_db_write(&rxr->ag_db, rxr->ag_raw_prod);
 
 	bnxt_db_cq(cpr);
 
 	/* Attempt to alloc Rx buf in case of a previous allocation failure. */
 	if (rc == -ENOMEM) {
-		int i = RING_NEXT(rxr->rx_ring_struct, prod);
+		int i = RING_NEXT(rx_raw_prod);
 		int cnt = nb_rx_pkts;
 
-		for (; cnt;
-			i = RING_NEXT(rxr->rx_ring_struct, i), cnt--) {
-			struct rte_mbuf **rx_buf = &rxr->rx_buf_ring[i];
+		for (; nb_rx_pkts; i = RING_NEXT(i), cnt--) {
+			struct rte_mbuf **rx_buf;
+			uint16_t rx_raw_prod = RING_IDX(rxr->rx_ring_struct, i);
+
+			rx_buf = &rxr->rx_buf_ring[rx_raw_prod];
 
 			/* Buffer already allocated for this index. */
 			if (*rx_buf != NULL && *rx_buf != &rxq->fake_mbuf)
@@ -931,8 +945,8 @@ uint16_t bnxt_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts,
 
 			/* This slot is empty. Alloc buffer for Rx */
 			if (!bnxt_alloc_rx_data(rxq, rxr, i)) {
-				rxr->rx_prod = i;
-				bnxt_db_write(&rxr->rx_db, rxr->rx_prod);
+				rxr->rx_raw_prod = i;
+				bnxt_db_write(&rxr->rx_db, rxr->rx_raw_prod);
 			} else {
 				PMD_DRV_LOG(ERR, "Alloc  mbuf failed\n");
 				break;
@@ -1100,7 +1114,7 @@ int bnxt_init_one_rx_ring(struct bnxt_rx_queue *rxq)
 {
 	struct bnxt_rx_ring_info *rxr;
 	struct bnxt_ring *ring;
-	uint32_t prod, type;
+	uint32_t raw_prod, type;
 	unsigned int i;
 	uint16_t size;
 
@@ -1119,18 +1133,18 @@ int bnxt_init_one_rx_ring(struct bnxt_rx_queue *rxq)
 	ring = rxr->rx_ring_struct;
 	bnxt_init_rxbds(ring, type, size);
 
-	prod = rxr->rx_prod;
+	raw_prod = rxr->rx_raw_prod;
 	for (i = 0; i < ring->ring_size; i++) {
 		if (unlikely(!rxr->rx_buf_ring[i])) {
-			if (bnxt_alloc_rx_data(rxq, rxr, prod) != 0) {
+			if (bnxt_alloc_rx_data(rxq, rxr, raw_prod) != 0) {
 				PMD_DRV_LOG(WARNING,
 					    "init'ed rx ring %d with %d/%d mbufs only\n",
 					    rxq->queue_id, i, ring->ring_size);
 				break;
 			}
 		}
-		rxr->rx_prod = prod;
-		prod = RING_NEXT(rxr->rx_ring_struct, prod);
+		rxr->rx_raw_prod = raw_prod;
+		raw_prod = RING_NEXT(raw_prod);
 	}
 
 	/* Initialize dummy mbuf pointers for vector mode rx. */
@@ -1142,19 +1156,19 @@ int bnxt_init_one_rx_ring(struct bnxt_rx_queue *rxq)
 	ring = rxr->ag_ring_struct;
 	type = RX_PROD_AGG_BD_TYPE_RX_PROD_AGG;
 	bnxt_init_rxbds(ring, type, size);
-	prod = rxr->ag_prod;
+	raw_prod = rxr->ag_raw_prod;
 
 	for (i = 0; i < ring->ring_size; i++) {
 		if (unlikely(!rxr->ag_buf_ring[i])) {
-			if (bnxt_alloc_ag_data(rxq, rxr, prod) != 0) {
+			if (bnxt_alloc_ag_data(rxq, rxr, raw_prod) != 0) {
 				PMD_DRV_LOG(WARNING,
 					    "init'ed AG ring %d with %d/%d mbufs only\n",
 					    rxq->queue_id, i, ring->ring_size);
 				break;
 			}
 		}
-		rxr->ag_prod = prod;
-		prod = RING_NEXT(rxr->ag_ring_struct, prod);
+		rxr->ag_raw_prod = raw_prod;
+		raw_prod = RING_NEXT(raw_prod);
 	}
 	PMD_DRV_LOG(DEBUG, "AGG Done!\n");
 
diff --git a/drivers/net/bnxt/bnxt_rxr.h b/drivers/net/bnxt/bnxt_rxr.h
index 2a53cf87b..af6ff0972 100644
--- a/drivers/net/bnxt/bnxt_rxr.h
+++ b/drivers/net/bnxt/bnxt_rxr.h
@@ -50,8 +50,8 @@ struct bnxt_tpa_info {
 };
 
 struct bnxt_rx_ring_info {
-	uint16_t		rx_prod;
-	uint16_t		ag_prod;
+	uint16_t		rx_raw_prod;
+	uint16_t		ag_raw_prod;
 	uint16_t                rx_cons; /* Needed for representor */
 	struct bnxt_db_info     rx_db;
 	struct bnxt_db_info     ag_db;
diff --git a/drivers/net/bnxt/bnxt_rxtx_vec_common.h b/drivers/net/bnxt/bnxt_rxtx_vec_common.h
index d540e9eee..8a7772a7e 100644
--- a/drivers/net/bnxt/bnxt_rxtx_vec_common.h
+++ b/drivers/net/bnxt/bnxt_rxtx_vec_common.h
@@ -103,23 +103,23 @@ static inline void
 bnxt_tx_cmp_vec_fast(struct bnxt_tx_queue *txq, int nr_pkts)
 {
 	struct bnxt_tx_ring_info *txr = txq->tx_ring;
-	uint32_t ring_mask = txr->tx_ring_struct->ring_mask;
 	struct rte_mbuf **free = txq->free;
-	uint16_t cons = txr->tx_cons;
+	uint16_t cons, raw_cons = txr->tx_raw_cons;
 	unsigned int blk = 0;
+	uint32_t ring_mask = txr->tx_ring_struct->ring_mask;
 
 	while (nr_pkts--) {
 		struct bnxt_sw_tx_bd *tx_buf;
 
+		cons = raw_cons++ & ring_mask;
 		tx_buf = &txr->tx_buf_ring[cons];
-		cons = (cons + 1) & ring_mask;
 		free[blk++] = tx_buf->mbuf;
 		tx_buf->mbuf = NULL;
 	}
 	if (blk)
 		rte_mempool_put_bulk(free[0]->pool, (void **)free, blk);
 
-	txr->tx_cons = cons;
+	txr->tx_raw_cons = raw_cons;
 }
 
 static inline void
@@ -127,7 +127,7 @@ bnxt_tx_cmp_vec(struct bnxt_tx_queue *txq, int nr_pkts)
 {
 	struct bnxt_tx_ring_info *txr = txq->tx_ring;
 	struct rte_mbuf **free = txq->free;
-	uint16_t cons = txr->tx_cons;
+	uint16_t cons, raw_cons = txr->tx_raw_cons;
 	unsigned int blk = 0;
 	uint32_t ring_mask = txr->tx_ring_struct->ring_mask;
 
@@ -135,8 +135,8 @@ bnxt_tx_cmp_vec(struct bnxt_tx_queue *txq, int nr_pkts)
 		struct bnxt_sw_tx_bd *tx_buf;
 		struct rte_mbuf *mbuf;
 
+		cons = raw_cons++ & ring_mask;
 		tx_buf = &txr->tx_buf_ring[cons];
-		cons = (cons + 1) & ring_mask;
 		mbuf = rte_pktmbuf_prefree_seg(tx_buf->mbuf);
 		if (unlikely(mbuf == NULL))
 			continue;
@@ -151,6 +151,6 @@ bnxt_tx_cmp_vec(struct bnxt_tx_queue *txq, int nr_pkts)
 	if (blk)
 		rte_mempool_put_bulk(free[0]->pool, (void **)free, blk);
 
-	txr->tx_cons = cons;
+	txr->tx_raw_cons = raw_cons;
 }
 #endif /* _BNXT_RXTX_VEC_COMMON_H_ */
diff --git a/drivers/net/bnxt/bnxt_rxtx_vec_neon.c b/drivers/net/bnxt/bnxt_rxtx_vec_neon.c
index de1d96570..81f9a7da2 100644
--- a/drivers/net/bnxt/bnxt_rxtx_vec_neon.c
+++ b/drivers/net/bnxt/bnxt_rxtx_vec_neon.c
@@ -295,8 +295,7 @@ bnxt_recv_pkts_vec(void *rx_queue, struct rte_mbuf **rx_pkts,
 
 out:
 	if (nb_rx_pkts) {
-		rxr->rx_prod =
-			RING_ADV(rxr->rx_ring_struct, rxr->rx_prod, nb_rx_pkts);
+		rxr->rx_raw_prod = RING_ADV(rxr->rx_raw_prod, nb_rx_pkts);
 
 		rxq->rxrearm_nb += nb_rx_pkts;
 		cpr->cp_raw_cons += 2 * nb_rx_pkts;
@@ -353,7 +352,7 @@ bnxt_xmit_fixed_burst_vec(void *tx_queue, struct rte_mbuf **tx_pkts,
 {
 	struct bnxt_tx_queue *txq = tx_queue;
 	struct bnxt_tx_ring_info *txr = txq->tx_ring;
-	uint16_t prod = txr->tx_prod;
+	uint16_t tx_prod, tx_raw_prod = txr->tx_raw_prod;
 	struct rte_mbuf *tx_mbuf;
 	struct tx_bd_long *txbd = NULL;
 	struct bnxt_sw_tx_bd *tx_buf;
@@ -370,16 +369,17 @@ bnxt_xmit_fixed_burst_vec(void *tx_queue, struct rte_mbuf **tx_pkts,
 		tx_mbuf = *tx_pkts++;
 		rte_prefetch0(tx_mbuf);
 
-		tx_buf = &txr->tx_buf_ring[prod];
+		tx_prod = RING_IDX(txr->tx_ring_struct, tx_raw_prod);
+		tx_buf = &txr->tx_buf_ring[tx_prod];
 		tx_buf->mbuf = tx_mbuf;
 		tx_buf->nr_bds = 1;
 
-		txbd = &txr->tx_desc_ring[prod];
+		txbd = &txr->tx_desc_ring[tx_prod];
 		txbd->address = tx_mbuf->buf_iova + tx_mbuf->data_off;
 		txbd->len = tx_mbuf->data_len;
 		txbd->flags_type = bnxt_xmit_flags_len(tx_mbuf->data_len,
 						       TX_BD_FLAGS_NOCMPL);
-		prod = RING_NEXT(txr->tx_ring_struct, prod);
+		tx_raw_prod = RING_NEXT(tx_raw_prod);
 		to_send--;
 	}
 
@@ -390,9 +390,9 @@ bnxt_xmit_fixed_burst_vec(void *tx_queue, struct rte_mbuf **tx_pkts,
 	}
 
 	rte_compiler_barrier();
-	bnxt_db_write(&txr->tx_db, prod);
+	bnxt_db_write(&txr->tx_db, tx_raw_prod);
 
-	txr->tx_prod = prod;
+	txr->tx_raw_prod = tx_raw_prod;
 
 	return nb_pkts;
 }
diff --git a/drivers/net/bnxt/bnxt_rxtx_vec_sse.c b/drivers/net/bnxt/bnxt_rxtx_vec_sse.c
index e12bf8bb7..ce92629ab 100644
--- a/drivers/net/bnxt/bnxt_rxtx_vec_sse.c
+++ b/drivers/net/bnxt/bnxt_rxtx_vec_sse.c
@@ -277,8 +277,7 @@ bnxt_recv_pkts_vec(void *rx_queue, struct rte_mbuf **rx_pkts,
 
 out:
 	if (nb_rx_pkts) {
-		rxr->rx_prod =
-			RING_ADV(rxr->rx_ring_struct, rxr->rx_prod, nb_rx_pkts);
+		rxr->rx_raw_prod = RING_ADV(rxr->rx_raw_prod, nb_rx_pkts);
 
 		rxq->rxrearm_nb += nb_rx_pkts;
 		cpr->cp_raw_cons += 2 * nb_rx_pkts;
@@ -351,11 +350,12 @@ bnxt_xmit_fixed_burst_vec(struct bnxt_tx_queue *txq, struct rte_mbuf **tx_pkts,
 			  uint16_t nb_pkts)
 {
 	struct bnxt_tx_ring_info *txr = txq->tx_ring;
-	uint16_t tx_prod = txr->tx_prod;
+	uint16_t tx_prod, tx_raw_prod = txr->tx_raw_prod;
 	struct tx_bd_long *txbd;
 	struct bnxt_sw_tx_bd *tx_buf;
 	uint16_t to_send;
 
+	tx_prod = RING_IDX(txr->tx_ring_struct, tx_raw_prod);
 	txbd = &txr->tx_desc_ring[tx_prod];
 	tx_buf = &txr->tx_buf_ring[tx_prod];
 
@@ -395,10 +395,10 @@ bnxt_xmit_fixed_burst_vec(struct bnxt_tx_queue *txq, struct rte_mbuf **tx_pkts,
 	txbd[-1].opaque = nb_pkts;
 	txbd[-1].flags_type &= ~TX_BD_LONG_FLAGS_NO_CMPL;
 
-	tx_prod = RING_ADV(txr->tx_ring_struct, tx_prod, nb_pkts);
-	bnxt_db_write(&txr->tx_db, tx_prod);
+	tx_raw_prod += nb_pkts;
+	bnxt_db_write(&txr->tx_db, tx_raw_prod);
 
-	txr->tx_prod = tx_prod;
+	txr->tx_raw_prod = tx_raw_prod;
 
 	return nb_pkts;
 }
@@ -435,8 +435,8 @@ bnxt_xmit_pkts_vec(void *tx_queue, struct rte_mbuf **tx_pkts,
 		 * Ensure that a ring wrap does not occur within a call to
 		 * bnxt_xmit_fixed_burst_vec().
 		 */
-		num = RTE_MIN(num,
-			      ring_size - (txr->tx_prod & (ring_size - 1)));
+		num = RTE_MIN(num, ring_size -
+				   (txr->tx_raw_prod & (ring_size - 1)));
 		ret = bnxt_xmit_fixed_burst_vec(txq, &tx_pkts[nb_sent], num);
 		nb_sent += ret;
 		nb_pkts -= ret;
diff --git a/drivers/net/bnxt/bnxt_txr.c b/drivers/net/bnxt/bnxt_txr.c
index fb358d6f1..9cf0126d2 100644
--- a/drivers/net/bnxt/bnxt_txr.c
+++ b/drivers/net/bnxt/bnxt_txr.c
@@ -110,12 +110,14 @@ static uint16_t bnxt_start_xmit(struct rte_mbuf *tx_pkt,
 				struct tx_bd_long **last_txbd)
 {
 	struct bnxt_tx_ring_info *txr = txq->tx_ring;
+	struct bnxt_ring *ring = txr->tx_ring_struct;
 	uint32_t outer_tpid_bd = 0;
 	struct tx_bd_long *txbd;
 	struct tx_bd_long_hi *txbd1 = NULL;
 	uint32_t vlan_tag_flags;
 	bool long_bd = false;
 	unsigned short nr_bds = 0;
+	uint16_t prod;
 	struct rte_mbuf *m_seg;
 	struct bnxt_sw_tx_bd *tx_buf;
 	static const uint32_t lhint_arr[4] = {
@@ -168,11 +170,12 @@ static uint16_t bnxt_start_xmit(struct rte_mbuf *tx_pkt,
 	/* Check non zero data_len */
 	RTE_VERIFY(tx_pkt->data_len);
 
-	tx_buf = &txr->tx_buf_ring[txr->tx_prod];
+	prod = RING_IDX(ring, txr->tx_raw_prod);
+	tx_buf = &txr->tx_buf_ring[prod];
 	tx_buf->mbuf = tx_pkt;
 	tx_buf->nr_bds = nr_bds;
 
-	txbd = &txr->tx_desc_ring[txr->tx_prod];
+	txbd = &txr->tx_desc_ring[prod];
 	txbd->opaque = *coal_pkts;
 	txbd->flags_type = nr_bds << TX_BD_LONG_FLAGS_BD_CNT_SFT;
 	txbd->flags_type |= TX_BD_SHORT_FLAGS_COAL_NOW;
@@ -210,10 +213,10 @@ static uint16_t bnxt_start_xmit(struct rte_mbuf *tx_pkt,
 					TX_BD_LONG_CFA_META_VLAN_TPID_TPID8100;
 		}
 
-		txr->tx_prod = RING_NEXT(txr->tx_ring_struct, txr->tx_prod);
+		txr->tx_raw_prod = RING_NEXT(txr->tx_raw_prod);
 
-		txbd1 = (struct tx_bd_long_hi *)
-					&txr->tx_desc_ring[txr->tx_prod];
+		prod = RING_IDX(ring, txr->tx_raw_prod);
+		txbd1 = (struct tx_bd_long_hi *)&txr->tx_desc_ring[prod];
 		txbd1->lflags = 0;
 		txbd1->cfa_meta = vlan_tag_flags;
 		/* Legacy tx_bd_long_hi->mss =
@@ -318,11 +321,13 @@ static uint16_t bnxt_start_xmit(struct rte_mbuf *tx_pkt,
 	while (m_seg) {
 		/* Check non zero data_len */
 		RTE_VERIFY(m_seg->data_len);
-		txr->tx_prod = RING_NEXT(txr->tx_ring_struct, txr->tx_prod);
-		tx_buf = &txr->tx_buf_ring[txr->tx_prod];
+		txr->tx_raw_prod = RING_NEXT(txr->tx_raw_prod);
+
+		prod = RING_IDX(ring, txr->tx_raw_prod);
+		tx_buf = &txr->tx_buf_ring[prod];
 		tx_buf->mbuf = m_seg;
 
-		txbd = &txr->tx_desc_ring[txr->tx_prod];
+		txbd = &txr->tx_desc_ring[prod];
 		txbd->address = rte_cpu_to_le_64(rte_mbuf_data_iova(m_seg));
 		txbd->flags_type = TX_BD_SHORT_TYPE_TX_BD_SHORT;
 		txbd->len = m_seg->data_len;
@@ -332,7 +337,7 @@ static uint16_t bnxt_start_xmit(struct rte_mbuf *tx_pkt,
 
 	txbd->flags_type |= TX_BD_LONG_FLAGS_PACKET_END;
 
-	txr->tx_prod = RING_NEXT(txr->tx_ring_struct, txr->tx_prod);
+	txr->tx_raw_prod = RING_NEXT(txr->tx_raw_prod);
 
 	return 0;
 }
@@ -344,8 +349,9 @@ static uint16_t bnxt_start_xmit(struct rte_mbuf *tx_pkt,
 static void bnxt_tx_cmp_fast(struct bnxt_tx_queue *txq, int nr_pkts)
 {
 	struct bnxt_tx_ring_info *txr = txq->tx_ring;
+	struct bnxt_ring *ring = txr->tx_ring_struct;
 	struct rte_mbuf **free = txq->free;
-	uint16_t cons = txr->tx_cons;
+	uint16_t raw_cons = txr->tx_raw_cons;
 	unsigned int blk = 0;
 	int i, j;
 
@@ -353,7 +359,7 @@ static void bnxt_tx_cmp_fast(struct bnxt_tx_queue *txq, int nr_pkts)
 		struct bnxt_sw_tx_bd *tx_buf;
 		unsigned short nr_bds;
 
-		tx_buf = &txr->tx_buf_ring[cons];
+		tx_buf = &txr->tx_buf_ring[RING_IDX(ring, raw_cons)];
 		nr_bds = tx_buf->nr_bds;
 		for (j = 0; j < nr_bds; j++) {
 			if (tx_buf->mbuf) {
@@ -361,35 +367,38 @@ static void bnxt_tx_cmp_fast(struct bnxt_tx_queue *txq, int nr_pkts)
 				free[blk++] = tx_buf->mbuf;
 				tx_buf->mbuf = NULL;
 			}
-			cons = RING_NEXT(txr->tx_ring_struct, cons);
-			tx_buf = &txr->tx_buf_ring[cons];
+			raw_cons = RING_NEXT(raw_cons);
+			tx_buf = &txr->tx_buf_ring[RING_IDX(ring, raw_cons)];
 		}
 	}
 	if (blk)
 		rte_mempool_put_bulk(free[0]->pool, (void *)free, blk);
 
-	txr->tx_cons = cons;
+	txr->tx_raw_cons = raw_cons;
 }
 
 static void bnxt_tx_cmp(struct bnxt_tx_queue *txq, int nr_pkts)
 {
 	struct bnxt_tx_ring_info *txr = txq->tx_ring;
+	struct bnxt_ring *ring = txr->tx_ring_struct;
 	struct rte_mempool *pool = NULL;
 	struct rte_mbuf **free = txq->free;
-	uint16_t cons = txr->tx_cons;
+	uint16_t raw_cons = txr->tx_raw_cons;
 	unsigned int blk = 0;
 	int i, j;
 
 	for (i = 0; i < nr_pkts; i++) {
 		struct rte_mbuf *mbuf;
-		struct bnxt_sw_tx_bd *tx_buf = &txr->tx_buf_ring[cons];
-		unsigned short nr_bds = tx_buf->nr_bds;
+		struct bnxt_sw_tx_bd *tx_buf;
+		unsigned short nr_bds;
 
+		tx_buf = &txr->tx_buf_ring[RING_IDX(ring, raw_cons)];
+		nr_bds = tx_buf->nr_bds;
 		for (j = 0; j < nr_bds; j++) {
 			mbuf = tx_buf->mbuf;
 			tx_buf->mbuf = NULL;
-			cons = RING_NEXT(txr->tx_ring_struct, cons);
-			tx_buf = &txr->tx_buf_ring[cons];
+			raw_cons = RING_NEXT(raw_cons);
+			tx_buf = &txr->tx_buf_ring[RING_IDX(ring, raw_cons)];
 			if (!mbuf)	/* long_bd's tx_buf ? */
 				continue;
 
@@ -422,7 +431,7 @@ static void bnxt_tx_cmp(struct bnxt_tx_queue *txq, int nr_pkts)
 	if (blk)
 		rte_mempool_put_bulk(pool, (void *)free, blk);
 
-	txr->tx_cons = cons;
+	txr->tx_raw_cons = raw_cons;
 }
 
 static int bnxt_handle_tx_cp(struct bnxt_tx_queue *txq)
@@ -504,7 +513,7 @@ uint16_t bnxt_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
 	if (likely(nb_tx_pkts)) {
 		/* Request a completion on the last packet */
 		last_txbd->flags_type &= ~TX_BD_LONG_FLAGS_NO_CMPL;
-		bnxt_db_write(&txq->tx_ring->tx_db, txq->tx_ring->tx_prod);
+		bnxt_db_write(&txq->tx_ring->tx_db, txq->tx_ring->tx_raw_prod);
 	}
 
 	return nb_tx_pkts;
diff --git a/drivers/net/bnxt/bnxt_txr.h b/drivers/net/bnxt/bnxt_txr.h
index 3dfc8ef9b..447c68b7d 100644
--- a/drivers/net/bnxt/bnxt_txr.h
+++ b/drivers/net/bnxt/bnxt_txr.h
@@ -12,8 +12,8 @@
 #define BNXT_MIN_PKT_SIZE	52
 
 struct bnxt_tx_ring_info {
-	uint16_t		tx_prod;
-	uint16_t		tx_cons;
+	uint16_t		tx_raw_prod;
+	uint16_t		tx_raw_cons;
 	struct bnxt_db_info     tx_db;
 
 	struct tx_bd_long	*tx_desc_ring;
@@ -31,7 +31,7 @@ struct bnxt_sw_tx_bd {
 
 static inline uint32_t bnxt_tx_bds_in_hw(struct bnxt_tx_queue *txq)
 {
-	return ((txq->tx_ring->tx_prod - txq->tx_ring->tx_cons) &
+	return ((txq->tx_ring->tx_raw_prod - txq->tx_ring->tx_raw_cons) &
 		txq->tx_ring->tx_ring_struct->ring_mask);
 }
 
-- 
2.21.1 (Apple Git-122.3)


^ permalink raw reply	[flat|nested] 47+ messages in thread

* Re: [dpdk-dev] [PATCH v3 17/17] net/bnxt: modify ring index logic
  2020-12-09 23:53   ` [dpdk-dev] [PATCH v3 17/17] net/bnxt: modify ring index logic Ajit Khaparde
@ 2020-12-10 14:23     ` Lance Richardson
  0 siblings, 0 replies; 47+ messages in thread
From: Lance Richardson @ 2020-12-10 14:23 UTC (permalink / raw)
  To: Ajit Khaparde; +Cc: dev

On Wed, Dec 9, 2020 at 6:59 PM Ajit Khaparde <ajitkhaparde@gmail.com> wrote:
>
> Change the ring logic so that the index increments
> unbounded and mask it only when needed.
>
> Modify the existing macros so that the index is not masked.
> Add a new macro RING_IDX() to mask it only when needed.
> -
> v2->v3: Updated the index calculation in Tx completion processing.
>
> Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
> ---
>  drivers/net/bnxt/bnxt_cpr.h             |  10 ++-
>  drivers/net/bnxt/bnxt_hwrm.c            |   4 +-
>  drivers/net/bnxt/bnxt_reps.c            |   4 +-
>  drivers/net/bnxt/bnxt_ring.c            |  39 +++++----
>  drivers/net/bnxt/bnxt_ring.h            |  40 ++++++---
>  drivers/net/bnxt/bnxt_rxr.c             | 110 +++++++++++++-----------
>  drivers/net/bnxt/bnxt_rxr.h             |   4 +-
>  drivers/net/bnxt/bnxt_rxtx_vec_common.h |  14 +--
>  drivers/net/bnxt/bnxt_rxtx_vec_neon.c   |  16 ++--
>  drivers/net/bnxt/bnxt_rxtx_vec_sse.c    |  16 ++--
>  drivers/net/bnxt/bnxt_txr.c             |  51 ++++++-----
>  drivers/net/bnxt/bnxt_txr.h             |   6 +-
>  12 files changed, 179 insertions(+), 135 deletions(-)
>
Acked-by: Lance Richardson <lance.richardson@broadcom.com>

(Note: sending from a personal email account to avoid incompatible
footer forced by corporate policy. Ideally I would submit a patch to
add a mailmap entry with this email address, but we don't seem to
have a .mailmap file for this repository.)

^ permalink raw reply	[flat|nested] 47+ messages in thread

* Re: [dpdk-dev] [PATCH v3 03/17] net/bnxt: remove unused field
  2020-12-09 23:53   ` [dpdk-dev] [PATCH v3 03/17] net/bnxt: remove unused field Ajit Khaparde
@ 2020-12-10 15:23     ` Lance Richardson
  0 siblings, 0 replies; 47+ messages in thread
From: Lance Richardson @ 2020-12-10 15:23 UTC (permalink / raw)
  To: Ajit Khaparde; +Cc: dev

On Wed, Dec 9, 2020 at 6:55 PM Ajit Khaparde <ajitkhaparde@gmail.com> wrote:
>
> Remove flow_xstat from bnxt structure.
>
> Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
> ---
>  drivers/net/bnxt/bnxt.h | 1 -
>  1 file changed, 1 deletion(-)
>
> diff --git a/drivers/net/bnxt/bnxt.h b/drivers/net/bnxt/bnxt.h
> index 9bd4f1da9..f13d586d4 100644
> --- a/drivers/net/bnxt/bnxt.h
> +++ b/drivers/net/bnxt/bnxt.h
> @@ -818,7 +818,6 @@ struct bnxt {
>         struct bnxt_dmabuf_info dmabuf;
>         struct bnxt_ulp_context *ulp_ctx;
>         struct bnxt_flow_stat_info *flow_stat;
> -       uint8_t                 flow_xstat;
>         uint16_t                max_num_kflows;
>         uint16_t                tx_cfa_action;
>  };
> --
> 2.21.1 (Apple Git-122.3)
>

Acked-by: Lance Richardson <lance.richardson@broadcom.com>

^ permalink raw reply	[flat|nested] 47+ messages in thread

* Re: [dpdk-dev] [PATCH v3 05/17] net/bnxt: remove references to Thor
  2020-12-09 23:53   ` [dpdk-dev] [PATCH v3 05/17] net/bnxt: remove references to Thor Ajit Khaparde
@ 2020-12-10 15:28     ` Lance Richardson
  0 siblings, 0 replies; 47+ messages in thread
From: Lance Richardson @ 2020-12-10 15:28 UTC (permalink / raw)
  To: Ajit Khaparde; +Cc: dev

On Wed, Dec 9, 2020 at 6:55 PM Ajit Khaparde <ajitkhaparde@gmail.com> wrote:
>
> Refactor code to remove references to Thor.
> Instead use P5 as in phase 5 of development cycle since it is applicable
> to boards other than Thor as well.
>
> Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
> ---
>  drivers/net/bnxt/bnxt.h            | 20 +++++++-------
>  drivers/net/bnxt/bnxt_ethdev.c     | 43 +++++++++++++++--------------
>  drivers/net/bnxt/bnxt_hwrm.c       | 44 +++++++++++++++---------------
>  drivers/net/bnxt/bnxt_ring.c       |  8 +++---
>  drivers/net/bnxt/bnxt_rxq.c        |  4 +--
>  drivers/net/bnxt/bnxt_rxr.c        | 12 ++++----
>  drivers/net/bnxt/bnxt_rxr.h        |  2 +-
>  drivers/net/bnxt/bnxt_vnic.c       |  4 +--
>  drivers/net/bnxt/tf_ulp/bnxt_ulp.c |  2 +-
>  9 files changed, 70 insertions(+), 69 deletions(-)
>

Acked-by: Lance Richardson <lance.richardson@broadcom.com>

^ permalink raw reply	[flat|nested] 47+ messages in thread

* Re: [dpdk-dev] [PATCH v3 07/17] net/bnxt: fix cleanup on mutex init failure
  2020-12-09 23:53   ` [dpdk-dev] [PATCH v3 07/17] net/bnxt: fix cleanup on mutex init failure Ajit Khaparde
@ 2020-12-10 15:42     ` Lance Richardson
  0 siblings, 0 replies; 47+ messages in thread
From: Lance Richardson @ 2020-12-10 15:42 UTC (permalink / raw)
  To: Ajit Khaparde; +Cc: dev, stable

On Wed, Dec 9, 2020 at 6:56 PM Ajit Khaparde <ajitkhaparde@gmail.com> wrote:
>
> In case mutex init fails during initialization, start cleanup and
> fail the initialization process.
>
> Fixes: a73b8e939f10 ("net/bnxt: fix race between start and interrupt handler")
> Cc: stable@dpdk.org
>
> Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
> ---
>  drivers/net/bnxt/bnxt_ethdev.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c
> index 33358779b..0b14ca234 100644
> --- a/drivers/net/bnxt/bnxt_ethdev.c
> +++ b/drivers/net/bnxt/bnxt_ethdev.c
> @@ -4739,8 +4739,10 @@ bnxt_init_locks(struct bnxt *bp)
>         }
>
>         err = pthread_mutex_init(&bp->def_cp_lock, NULL);
> -       if (err)
> +       if (err) {
>                 PMD_DRV_LOG(ERR, "Unable to initialize def_cp_lock\n");
> +               return err;
> +       }
>
>         err = pthread_mutex_init(&bp->health_check_lock, NULL);
>         if (err)
> --
> 2.21.1 (Apple Git-122.3)
>
Acked-by: Lance Richardson <lance.richardson@broadcom.com>

^ permalink raw reply	[flat|nested] 47+ messages in thread

* Re: [dpdk-dev] [PATCH v3 08/17] net/bnxt: fix format specifier for unsigned int
  2020-12-09 23:53   ` [dpdk-dev] [PATCH v3 08/17] net/bnxt: fix format specifier for unsigned int Ajit Khaparde
@ 2020-12-10 15:54     ` Lance Richardson
  0 siblings, 0 replies; 47+ messages in thread
From: Lance Richardson @ 2020-12-10 15:54 UTC (permalink / raw)
  To: Ajit Khaparde; +Cc: dev, stable

On Wed, Dec 9, 2020 at 6:56 PM Ajit Khaparde <ajitkhaparde@gmail.com> wrote:
>
> &device requires the %u format specifer not the %d specifier, as
> &device is unsigned.
>
> Fixes: a46bbb57605b ("net/bnxt: update multi device design")
> Cc: stable@dpdk.org
>
> Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
> ---
>  drivers/net/bnxt/tf_core/tf_core.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/net/bnxt/tf_core/tf_core.c b/drivers/net/bnxt/tf_core/tf_core.c
> index 24d49096a..3409cbbce 100644
> --- a/drivers/net/bnxt/tf_core/tf_core.c
> +++ b/drivers/net/bnxt/tf_core/tf_core.c
> @@ -82,7 +82,7 @@ tf_open_session(struct tf *tfp,
>                 return rc;
>
>         TFP_DRV_LOG(INFO,
> -                   "domain:%d, bus:%d, device:%d\n",
> +                   "domain:%d, bus:%d, device:%u\n",
>                     parms->session_id.internal.domain,
>                     parms->session_id.internal.bus,
>                     parms->session_id.internal.device);
> --
> 2.21.1 (Apple Git-122.3)
>
Acked-by: Lance Richardson <lance.richardson@broadcom.com>

^ permalink raw reply	[flat|nested] 47+ messages in thread

* Re: [dpdk-dev] [PATCH v3 11/17] net/bnxt: use the right function to free mbuf
  2020-12-09 23:53   ` [dpdk-dev] [PATCH v3 11/17] net/bnxt: use the right function to free mbuf Ajit Khaparde
@ 2020-12-10 15:56     ` Lance Richardson
  0 siblings, 0 replies; 47+ messages in thread
From: Lance Richardson @ 2020-12-10 15:56 UTC (permalink / raw)
  To: Ajit Khaparde; +Cc: dev, Somnath Kotur

On Wed, Dec 9, 2020 at 6:57 PM Ajit Khaparde <ajitkhaparde@gmail.com> wrote:
>
> mbufs are being allocated using rte_mbuf_raw_alloc().
> Use corresponding rte_mbuf_raw_free() to free mbuf.
>
> Signed-off-by: Somnath Kotur <somnath.kotur@broadcom.com>
>
> Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
> ---
>  drivers/net/bnxt/bnxt_reps.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/net/bnxt/bnxt_reps.c b/drivers/net/bnxt/bnxt_reps.c
> index e5ba0909b..167c46ad4 100644
> --- a/drivers/net/bnxt/bnxt_reps.c
> +++ b/drivers/net/bnxt/bnxt_reps.c
> @@ -65,7 +65,7 @@ bnxt_vfr_recv(uint16_t port_id, uint16_t queue_id, struct rte_mbuf *mbuf)
>                 /* Representor Rx ring full, drop pkt */
>                 vfr_bp->rx_drop_bytes[que] += mbuf->pkt_len;
>                 vfr_bp->rx_drop_pkts[que]++;
> -               rte_pktmbuf_free(mbuf);
> +               rte_mbuf_raw_free(mbuf);
>         }
>
>         return 0;
> --
> 2.21.1 (Apple Git-122.3)
>
Acked-by: Lance Richardson <lance.richardson@broadcom.com>

^ permalink raw reply	[flat|nested] 47+ messages in thread

* Re: [dpdk-dev] [PATCH v3 12/17] net/bnxt: remove function declaration
  2020-12-09 23:53   ` [dpdk-dev] [PATCH v3 12/17] net/bnxt: remove function declaration Ajit Khaparde
@ 2020-12-10 15:57     ` Lance Richardson
  0 siblings, 0 replies; 47+ messages in thread
From: Lance Richardson @ 2020-12-10 15:57 UTC (permalink / raw)
  To: Ajit Khaparde; +Cc: dev

On Wed, Dec 9, 2020 at 6:58 PM Ajit Khaparde <ajitkhaparde@gmail.com> wrote:
>
> Remove an orphan function declaration.
> It has not been defined yet and hence not used anywhere.
>
> Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
> ---
>  drivers/net/bnxt/bnxt_hwrm.h | 2 --
>  1 file changed, 2 deletions(-)
>
> diff --git a/drivers/net/bnxt/bnxt_hwrm.h b/drivers/net/bnxt/bnxt_hwrm.h
> index 23ca6ab51..4b3290773 100644
> --- a/drivers/net/bnxt/bnxt_hwrm.h
> +++ b/drivers/net/bnxt/bnxt_hwrm.h
> @@ -288,8 +288,6 @@ int bnxt_hwrm_cfa_counter_qstats(struct bnxt *bp,
>                                  enum bnxt_flow_dir dir,
>                                  uint16_t cntr,
>                                  uint16_t num_entries);
> -int bnxt_hwrm_get_dflt_vnic_id(struct bnxt *bp, uint16_t fid,
> -                              uint16_t *vnic_id);
>  int bnxt_hwrm_get_dflt_vnic_svif(struct bnxt *bp, uint16_t fid,
>                                  uint16_t *vnic_id, uint16_t *svif);
>  int bnxt_hwrm_parent_pf_qcfg(struct bnxt *bp);
> --
> 2.21.1 (Apple Git-122.3)
>
Acked-by: Lance Richardson <lance.richardson@broadcom.com>

^ permalink raw reply	[flat|nested] 47+ messages in thread

* Re: [dpdk-dev] [PATCH v3 15/17] net/bnxt: changes to indentation and coding style
  2020-12-09 23:53   ` [dpdk-dev] [PATCH v3 15/17] net/bnxt: changes to indentation and coding style Ajit Khaparde
@ 2020-12-10 15:59     ` Lance Richardson
  0 siblings, 0 replies; 47+ messages in thread
From: Lance Richardson @ 2020-12-10 15:59 UTC (permalink / raw)
  To: Ajit Khaparde; +Cc: dev

On Wed, Dec 9, 2020 at 6:59 PM Ajit Khaparde <ajitkhaparde@gmail.com> wrote:
>
> Indentation and coding style fixes.
>
> Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
> ---
>  drivers/net/bnxt/bnxt.h        | 4 ++--
>  drivers/net/bnxt/bnxt_ethdev.c | 9 ++++-----
>  drivers/net/bnxt/bnxt_reps.c   | 2 +-
>  drivers/net/bnxt/bnxt_ring.c   | 3 +--
>  4 files changed, 8 insertions(+), 10 deletions(-)
>
> diff --git a/drivers/net/bnxt/bnxt.h b/drivers/net/bnxt/bnxt.h
> index 2a318efaf..556e99203 100644
> --- a/drivers/net/bnxt/bnxt.h
> +++ b/drivers/net/bnxt/bnxt.h
> @@ -127,9 +127,9 @@
>   */
>  #ifdef RTE_EXEC_ENV_FREEBSD
>  /* In FreeBSD OS, nic_uio driver does not support interrupts */
> -#define BNXT_NUM_ASYNC_CPR(bp) 0
> +#define BNXT_NUM_ASYNC_CPR(bp) 0U
>  #else
> -#define BNXT_NUM_ASYNC_CPR(bp) 1
> +#define BNXT_NUM_ASYNC_CPR(bp) 1U
>  #endif
>
>  #define BNXT_MISC_VEC_ID               RTE_INTR_VEC_ZERO_OFFSET
> diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c
> index 21d9e26ca..9d5c8aa0f 100644
> --- a/drivers/net/bnxt/bnxt_ethdev.c
> +++ b/drivers/net/bnxt/bnxt_ethdev.c
> @@ -1264,11 +1264,10 @@ static int bnxt_dev_start_op(struct rte_eth_dev *eth_dev)
>                 return -EINVAL;
>         }
>
> -       if (bp->rx_cp_nr_rings > RTE_ETHDEV_QUEUE_STAT_CNTRS) {
> +       if (bp->rx_cp_nr_rings > RTE_ETHDEV_QUEUE_STAT_CNTRS)
>                 PMD_DRV_LOG(ERR,
> -                       "RxQ cnt %d > RTE_ETHDEV_QUEUE_STAT_CNTRS %d\n",
> -                       bp->rx_cp_nr_rings, RTE_ETHDEV_QUEUE_STAT_CNTRS);
> -       }
> +                           "RxQ cnt %d > RTE_ETHDEV_QUEUE_STAT_CNTRS %d\n",
> +                           bp->rx_cp_nr_rings, RTE_ETHDEV_QUEUE_STAT_CNTRS);
>
>         do {
>                 rc = bnxt_hwrm_if_change(bp, true);
> @@ -1622,7 +1621,7 @@ int bnxt_link_update_op(struct rte_eth_dev *eth_dev, int wait_to_complete)
>  out:
>         /* Timed out or success */
>         if (new.link_status != eth_dev->data->dev_link.link_status ||
> -       new.link_speed != eth_dev->data->dev_link.link_speed) {
> +           new.link_speed != eth_dev->data->dev_link.link_speed) {
>                 rte_eth_linkstatus_set(eth_dev, &new);
>
>                 rte_eth_dev_callback_process(eth_dev,
> diff --git a/drivers/net/bnxt/bnxt_reps.c b/drivers/net/bnxt/bnxt_reps.c
> index 167c46ad4..12d677d32 100644
> --- a/drivers/net/bnxt/bnxt_reps.c
> +++ b/drivers/net/bnxt/bnxt_reps.c
> @@ -56,7 +56,7 @@ bnxt_vfr_recv(uint16_t port_id, uint16_t queue_id, struct rte_mbuf *mbuf)
>
>         /* Put this mbuf on the RxQ of the Representor */
>         prod_rx_buf = &rep_rxr->rx_buf_ring[rep_rxr->rx_prod & mask];
> -       if (!*prod_rx_buf) {
> +       if (*prod_rx_buf == NULL) {
>                 *prod_rx_buf = mbuf;
>                 vfr_bp->rx_bytes[que] += mbuf->pkt_len;
>                 vfr_bp->rx_pkts[que]++;
> diff --git a/drivers/net/bnxt/bnxt_ring.c b/drivers/net/bnxt/bnxt_ring.c
> index 579c48d8c..f83bcaba2 100644
> --- a/drivers/net/bnxt/bnxt_ring.c
> +++ b/drivers/net/bnxt/bnxt_ring.c
> @@ -599,8 +599,7 @@ int bnxt_alloc_hwrm_rx_ring(struct bnxt *bp, int queue_index)
>
>         if (rxq->rx_started) {
>                 if (bnxt_init_one_rx_ring(rxq)) {
> -                       PMD_DRV_LOG(ERR,
> -                               "bnxt_init_one_rx_ring failed!\n");
> +                       PMD_DRV_LOG(ERR, "bnxt_init_one_rx_ring failed!\n");
>                         bnxt_rx_queue_release_op(rxq);
>                         rc = -ENOMEM;
>                         goto err_out;
> --
> 2.21.1 (Apple Git-122.3)
>
Acked-by: Lance Richardson <lance.richardson@broadcom.com>

^ permalink raw reply	[flat|nested] 47+ messages in thread

* Re: [dpdk-dev] [PATCH v3 16/17] net/bnxt: add missing comments
  2020-12-09 23:53   ` [dpdk-dev] [PATCH v3 16/17] net/bnxt: add missing comments Ajit Khaparde
@ 2020-12-10 16:02     ` Lance Richardson
  0 siblings, 0 replies; 47+ messages in thread
From: Lance Richardson @ 2020-12-10 16:02 UTC (permalink / raw)
  To: Ajit Khaparde; +Cc: dev

On Wed, Dec 9, 2020 at 6:59 PM Ajit Khaparde <ajitkhaparde@gmail.com> wrote:
>
> Add and update some missing comments in the code.
>
> Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
> ---
>  drivers/net/bnxt/bnxt.h                         | 6 ++++++
>  drivers/net/bnxt/tf_ulp/ulp_template_db_act.c   | 5 +++++
>  drivers/net/bnxt/tf_ulp/ulp_template_db_class.c | 6 ++++++
>  3 files changed, 17 insertions(+)
>
> diff --git a/drivers/net/bnxt/bnxt.h b/drivers/net/bnxt/bnxt.h
> index 556e99203..07d39ee93 100644
> --- a/drivers/net/bnxt/bnxt.h
> +++ b/drivers/net/bnxt/bnxt.h
> @@ -724,7 +724,13 @@ struct bnxt {
>         void                            *hwrm_short_cmd_req_addr;
>         rte_iova_t                      hwrm_short_cmd_req_dma_addr;
>         rte_spinlock_t                  hwrm_lock;
> +       /* synchronize between dev_configure_op and int handler */
>         pthread_mutex_t                 def_cp_lock;
> +       /* synchronize between dev_start_op and async evt handler
> +        * Locking sequence in async evt handler will be
> +        * def_cp_lock
> +        * health_check_lock
> +        */
>         pthread_mutex_t                 health_check_lock;
>         uint16_t                        max_req_len;
>         uint16_t                        max_resp_len;
> diff --git a/drivers/net/bnxt/tf_ulp/ulp_template_db_act.c b/drivers/net/bnxt/tf_ulp/ulp_template_db_act.c
> index 00ada607a..509af7c58 100644
> --- a/drivers/net/bnxt/tf_ulp/ulp_template_db_act.c
> +++ b/drivers/net/bnxt/tf_ulp/ulp_template_db_act.c
> @@ -8,6 +8,10 @@
>  #include "ulp_template_struct.h"
>  #include "ulp_rte_parser.h"
>
> +/*
> + * Action signature table:
> + * maps hash id to ulp_act_match_list[] index
> + */
>  uint16_t ulp_act_sig_tbl[BNXT_ULP_ACT_SIG_TBL_MAX_SZ] = {
>         [BNXT_ULP_ACT_HID_015a] = 1,
>         [BNXT_ULP_ACT_HID_00eb] = 2,
> @@ -93,6 +97,7 @@ uint16_t ulp_act_sig_tbl[BNXT_ULP_ACT_SIG_TBL_MAX_SZ] = {
>         [BNXT_ULP_ACT_HID_0b4e] = 82
>  };
>
> +/* Array for the act matcher list */
>  struct bnxt_ulp_act_match_info ulp_act_match_list[] = {
>         [1] = {
>         .act_hid = BNXT_ULP_ACT_HID_015a,
> diff --git a/drivers/net/bnxt/tf_ulp/ulp_template_db_class.c b/drivers/net/bnxt/tf_ulp/ulp_template_db_class.c
> index fdb26da3e..d904a04cb 100644
> --- a/drivers/net/bnxt/tf_ulp/ulp_template_db_class.c
> +++ b/drivers/net/bnxt/tf_ulp/ulp_template_db_class.c
> @@ -8,6 +8,11 @@
>  #include "ulp_template_struct.h"
>  #include "ulp_rte_parser.h"
>
> +/* Define the template structures */
> +/*
> + * Classification signature table:
> + * maps hash id to ulp_class_match_list[] index
> + */
>  uint16_t ulp_class_sig_tbl[BNXT_ULP_CLASS_SIG_TBL_MAX_SZ] = {
>         [BNXT_ULP_CLASS_HID_0138] = 1,
>         [BNXT_ULP_CLASS_HID_03f0] = 2,
> @@ -227,6 +232,7 @@ uint16_t ulp_class_sig_tbl[BNXT_ULP_CLASS_SIG_TBL_MAX_SZ] = {
>         [BNXT_ULP_CLASS_HID_01b4] = 216
>  };
>
> +/* Array for the proto matcher list */
>  struct bnxt_ulp_class_match_info ulp_class_match_list[] = {
>         [1] = {
>         .class_hid = BNXT_ULP_CLASS_HID_0138,
> --
> 2.21.1 (Apple Git-122.3)
>
Acked-by: Lance Richardson <lance.richardson@broadcom.com>

^ permalink raw reply	[flat|nested] 47+ messages in thread

* Re: [dpdk-dev] [PATCH v3 00/17] fixes and refactoring changes for bnxt
  2020-12-09 23:53 ` [dpdk-dev] [PATCH v3 00/17] fixes and refactoring changes for bnxt Ajit Khaparde
                     ` (16 preceding siblings ...)
  2020-12-09 23:53   ` [dpdk-dev] [PATCH v3 17/17] net/bnxt: modify ring index logic Ajit Khaparde
@ 2020-12-11  2:42   ` Ajit Khaparde
  17 siblings, 0 replies; 47+ messages in thread
From: Ajit Khaparde @ 2020-12-11  2:42 UTC (permalink / raw)
  To: dev, Ajit Khaparde

On Wed, Dec 9, 2020 at 3:53 PM Ajit Khaparde <ajitkhaparde@gmail.com> wrote:
>
> Some fixes and refactoring changes for bnxt PMD.
>
> v1->v2: Resend without the legal signature/footer.
> v2->v3: Fix index calculation in patch 17/17.

Patchset applied to dpdk-next-net-brcm. Thanks

>
>
> Ajit Khaparde (9):
>   net/bnxt: remove unused field
>   net/bnxt: remove references to Thor
>   net/bnxt: fix cleanup on mutex init failure
>   net/bnxt: fix format specifier for unsigned int
>   net/bnxt: use the right function to free mbuf
>   net/bnxt: remove function declaration
>   net/bnxt: changes to indentation and coding style
>   net/bnxt: add missing comments
>   net/bnxt: modify ring index logic
>
> Kalesh AP (3):
>   net/bnxt: release hwrm lock in the error case
>   net/bnxt: fix to return error when fw command fails
>   net/bnxt: fix vnic RSS configure function
>
> Rahul Gupta (1):
>   net/bnxt: support for 236 queues in NS3
>
> Samik Gupta (2):
>   net/bnxt: fix RX rings in RSS redirection table
>   net/bnxt: fix VNIC config on Rx queue stop
>
> Somnath Kotur (1):
>   net/bnxt: fix PF resource query
>
> Sriharsha Basavapatna (1):
>   net/bnxt: fix max rings computation
>
>  drivers/net/bnxt/bnxt.h                       |  75 +++++++----
>  drivers/net/bnxt/bnxt_cpr.h                   |  10 +-
>  drivers/net/bnxt/bnxt_ethdev.c                |  78 ++++++-----
>  drivers/net/bnxt/bnxt_hwrm.c                  | 127 +++++++++++-------
>  drivers/net/bnxt/bnxt_hwrm.h                  |   2 -
>  drivers/net/bnxt/bnxt_reps.c                  |   8 +-
>  drivers/net/bnxt/bnxt_ring.c                  |  50 +++----
>  drivers/net/bnxt/bnxt_ring.h                  |  40 ++++--
>  drivers/net/bnxt/bnxt_rxq.c                   |  35 +++--
>  drivers/net/bnxt/bnxt_rxr.c                   | 122 +++++++++--------
>  drivers/net/bnxt/bnxt_rxr.h                   |   6 +-
>  drivers/net/bnxt/bnxt_rxtx_vec_common.h       |  14 +-
>  drivers/net/bnxt/bnxt_rxtx_vec_neon.c         |  16 +--
>  drivers/net/bnxt/bnxt_rxtx_vec_sse.c          |  16 +--
>  drivers/net/bnxt/bnxt_txq.c                   |   2 +-
>  drivers/net/bnxt/bnxt_txr.c                   |  51 ++++---
>  drivers/net/bnxt/bnxt_txr.h                   |   6 +-
>  drivers/net/bnxt/bnxt_vnic.c                  |   4 +-
>  drivers/net/bnxt/tf_core/tf_core.c            |   2 +-
>  drivers/net/bnxt/tf_ulp/bnxt_ulp.c            |   2 +-
>  drivers/net/bnxt/tf_ulp/ulp_template_db_act.c |   5 +
>  .../net/bnxt/tf_ulp/ulp_template_db_class.c   |   6 +
>  22 files changed, 402 insertions(+), 275 deletions(-)
>
> --
> 2.21.1 (Apple Git-122.3)
>


-- 
Ajit Khaparde

^ permalink raw reply	[flat|nested] 47+ messages in thread

end of thread, other threads:[~2020-12-11  2:42 UTC | newest]

Thread overview: 47+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-09 19:22 [dpdk-dev] [PATCH v2 00/17] fixes and refactoring changes for bnxt Ajit Khaparde
2020-12-09 19:22 ` [dpdk-dev] [PATCH v2 01/17] net/bnxt: fix RX rings in RSS redirection table Ajit Khaparde
2020-12-09 19:22 ` [dpdk-dev] [PATCH v2 02/17] net/bnxt: fix VNIC config on Rx queue stop Ajit Khaparde
2020-12-09 19:22 ` [dpdk-dev] [PATCH v2 03/17] net/bnxt: remove unused field Ajit Khaparde
2020-12-09 19:22 ` [dpdk-dev] [PATCH v2 04/17] net/bnxt: release hwrm lock in the error case Ajit Khaparde
2020-12-09 19:22 ` [dpdk-dev] [PATCH v2 05/17] net/bnxt: remove references to Thor Ajit Khaparde
2020-12-09 19:22 ` [dpdk-dev] [PATCH v2 06/17] net/bnxt: fix to return error when fw command fails Ajit Khaparde
2020-12-09 19:22 ` [dpdk-dev] [PATCH v2 07/17] net/bnxt: fix cleanup on mutex init failure Ajit Khaparde
2020-12-09 19:22 ` [dpdk-dev] [PATCH v2 08/17] net/bnxt: fix format specifier for unsigned int Ajit Khaparde
2020-12-09 19:22 ` [dpdk-dev] [PATCH v2 09/17] net/bnxt: fix max rings computation Ajit Khaparde
2020-12-09 19:22 ` [dpdk-dev] [PATCH v2 10/17] net/bnxt: support for 236 queues in NS3 Ajit Khaparde
2020-12-09 19:22 ` [dpdk-dev] [PATCH v2 11/17] net/bnxt: use the right function to free mbuf Ajit Khaparde
2020-12-09 19:22 ` [dpdk-dev] [PATCH v2 12/17] net/bnxt: remove function declaration Ajit Khaparde
2020-12-09 19:22 ` [dpdk-dev] [PATCH v2 13/17] net/bnxt: fix vnic RSS configure function Ajit Khaparde
2020-12-09 19:22 ` [dpdk-dev] [PATCH v2 14/17] net/bnxt: fix PF resource query Ajit Khaparde
2020-12-09 19:22 ` [dpdk-dev] [PATCH v2 15/17] net/bnxt: changes to indentation and coding style Ajit Khaparde
2020-12-09 19:22 ` [dpdk-dev] [PATCH v2 16/17] net/bnxt: add missing comments Ajit Khaparde
2020-12-09 19:22 ` [dpdk-dev] [PATCH v2 17/17] net/bnxt: modify ring index logic Ajit Khaparde
2020-12-09 20:49   ` Lance Richardson
2020-12-09 23:53 ` [dpdk-dev] [PATCH v3 00/17] fixes and refactoring changes for bnxt Ajit Khaparde
2020-12-09 23:53   ` [dpdk-dev] [PATCH v3 01/17] net/bnxt: fix RX rings in RSS redirection table Ajit Khaparde
2020-12-09 23:53   ` [dpdk-dev] [PATCH v3 02/17] net/bnxt: fix VNIC config on Rx queue stop Ajit Khaparde
2020-12-09 23:53   ` [dpdk-dev] [PATCH v3 03/17] net/bnxt: remove unused field Ajit Khaparde
2020-12-10 15:23     ` Lance Richardson
2020-12-09 23:53   ` [dpdk-dev] [PATCH v3 04/17] net/bnxt: release hwrm lock in the error case Ajit Khaparde
2020-12-09 23:53   ` [dpdk-dev] [PATCH v3 05/17] net/bnxt: remove references to Thor Ajit Khaparde
2020-12-10 15:28     ` Lance Richardson
2020-12-09 23:53   ` [dpdk-dev] [PATCH v3 06/17] net/bnxt: fix to return error when fw command fails Ajit Khaparde
2020-12-09 23:53   ` [dpdk-dev] [PATCH v3 07/17] net/bnxt: fix cleanup on mutex init failure Ajit Khaparde
2020-12-10 15:42     ` Lance Richardson
2020-12-09 23:53   ` [dpdk-dev] [PATCH v3 08/17] net/bnxt: fix format specifier for unsigned int Ajit Khaparde
2020-12-10 15:54     ` Lance Richardson
2020-12-09 23:53   ` [dpdk-dev] [PATCH v3 09/17] net/bnxt: fix max rings computation Ajit Khaparde
2020-12-09 23:53   ` [dpdk-dev] [PATCH v3 10/17] net/bnxt: support for 236 queues in NS3 Ajit Khaparde
2020-12-09 23:53   ` [dpdk-dev] [PATCH v3 11/17] net/bnxt: use the right function to free mbuf Ajit Khaparde
2020-12-10 15:56     ` Lance Richardson
2020-12-09 23:53   ` [dpdk-dev] [PATCH v3 12/17] net/bnxt: remove function declaration Ajit Khaparde
2020-12-10 15:57     ` Lance Richardson
2020-12-09 23:53   ` [dpdk-dev] [PATCH v3 13/17] net/bnxt: fix vnic RSS configure function Ajit Khaparde
2020-12-09 23:53   ` [dpdk-dev] [PATCH v3 14/17] net/bnxt: fix PF resource query Ajit Khaparde
2020-12-09 23:53   ` [dpdk-dev] [PATCH v3 15/17] net/bnxt: changes to indentation and coding style Ajit Khaparde
2020-12-10 15:59     ` Lance Richardson
2020-12-09 23:53   ` [dpdk-dev] [PATCH v3 16/17] net/bnxt: add missing comments Ajit Khaparde
2020-12-10 16:02     ` Lance Richardson
2020-12-09 23:53   ` [dpdk-dev] [PATCH v3 17/17] net/bnxt: modify ring index logic Ajit Khaparde
2020-12-10 14:23     ` Lance Richardson
2020-12-11  2:42   ` [dpdk-dev] [PATCH v3 00/17] fixes and refactoring changes for bnxt Ajit Khaparde

DPDK patches and discussions

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://inbox.dpdk.org/dev/0 dev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 dev dev/ https://inbox.dpdk.org/dev \
		dev@dpdk.org
	public-inbox-index dev

Example config snippet for mirrors.
Newsgroup available over NNTP:
	nntp://inbox.dpdk.org/inbox.dpdk.dev


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git