Skip to contentSkip to conversation

fixes and refactoring changes for bnxt

PATCH In review Ajit Khaparde 2 participants 20 messages Dec 8, 2020 Network drivers

lore
Share & tools
lore
#0 lore raw

cover fixes and refactoring changes for bnxt

Some fixes and refactoring changes for bnxt PMD.

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(-)
Signature · 15 lines
2.21.1 (Apple Git-122.3)


-- 
This electronic communication and the information and any files transmitted 
with it, or attached to it, are confidential and are intended solely for 
the use of the individual or entity to whom it is addressed and may contain 
information that is confidential, legally privileged, protected by privacy 
laws, or otherwise restricted from disclosure to anyone else. If you are 
not the intended recipient or the person responsible for delivering the 
e-mail to the intended recipient, you are hereby notified that any use, 
copying, distributing, dissemination, forwarding, printing, or copying of 
this e-mail is strictly prohibited. If you received this e-mail in error, 
please return the e-mail to the sender, delete it from your computer, and 
destroy any printed copy of it.
#1 lore raw

PATCH 1/17 net/bnxt: fix RX rings in RSS redirection table

From: Samik Gupta <[email protected]>

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")
---
 drivers/net/bnxt/bnxt.h        |  2 +-
 drivers/net/bnxt/bnxt_ethdev.c | 15 +++++++++++++--
 2 files changed, 14 insertions(+), 3 deletions(-)
drivers/net/bnxt/bnxt.h +1 -1
index 90ced972c..9bd4f1da9 100644
@@ -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)
drivers/net/bnxt/bnxt_ethdev.c +13 -2
index 81c8f8d79..c363c8427 100644
@@ -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);
Signature · 15 lines
2.21.1 (Apple Git-122.3)


-- 
This electronic communication and the information and any files transmitted 
with it, or attached to it, are confidential and are intended solely for 
the use of the individual or entity to whom it is addressed and may contain 
information that is confidential, legally privileged, protected by privacy 
laws, or otherwise restricted from disclosure to anyone else. If you are 
not the intended recipient or the person responsible for delivering the 
e-mail to the intended recipient, you are hereby notified that any use, 
copying, distributing, dissemination, forwarding, printing, or copying of 
this e-mail is strictly prohibited. If you received this e-mail in error, 
please return the e-mail to the sender, delete it from your computer, and 
destroy any printed copy of it.
#2 lore raw

PATCH 2/17 net/bnxt: fix VNIC config on Rx queue stop

In reply to Ajit Khaparde

From: Samik Gupta <[email protected]>

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")
---
 drivers/net/bnxt/bnxt_rxq.c | 26 +++++++++++++++++++++-----
 1 file changed, 21 insertions(+), 5 deletions(-)
drivers/net/bnxt/bnxt_rxq.c +21 -5
index e0ec34216..61196eba9 100644
@@ -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)
Signature · 15 lines
2.21.1 (Apple Git-122.3)


-- 
This electronic communication and the information and any files transmitted 
with it, or attached to it, are confidential and are intended solely for 
the use of the individual or entity to whom it is addressed and may contain 
information that is confidential, legally privileged, protected by privacy 
laws, or otherwise restricted from disclosure to anyone else. If you are 
not the intended recipient or the person responsible for delivering the 
e-mail to the intended recipient, you are hereby notified that any use, 
copying, distributing, dissemination, forwarding, printing, or copying of 
this e-mail is strictly prohibited. If you received this e-mail in error, 
please return the e-mail to the sender, delete it from your computer, and 
destroy any printed copy of it.
#3 lore raw

PATCH 3/17 net/bnxt: remove unused field

In reply to Ajit Khaparde

Remove flow_xstat from bnxt structure.

---
 drivers/net/bnxt/bnxt.h | 1 -
 1 file changed, 1 deletion(-)
drivers/net/bnxt/bnxt.h +0 -1
index 9bd4f1da9..f13d586d4 100644
@@ -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;
 };
Signature · 15 lines
2.21.1 (Apple Git-122.3)


-- 
This electronic communication and the information and any files transmitted 
with it, or attached to it, are confidential and are intended solely for 
the use of the individual or entity to whom it is addressed and may contain 
information that is confidential, legally privileged, protected by privacy 
laws, or otherwise restricted from disclosure to anyone else. If you are 
not the intended recipient or the person responsible for delivering the 
e-mail to the intended recipient, you are hereby notified that any use, 
copying, distributing, dissemination, forwarding, printing, or copying of 
this e-mail is strictly prohibited. If you received this e-mail in error, 
please return the e-mail to the sender, delete it from your computer, and 
destroy any printed copy of it.
#4 lore raw

PATCH 4/17 net/bnxt: release hwrm lock in the error case

In reply to Ajit Khaparde

From: Kalesh AP <[email protected]>

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")
---
 drivers/net/bnxt/bnxt_hwrm.c | 1 +
 1 file changed, 1 insertion(+)
drivers/net/bnxt/bnxt_hwrm.c +1 -0
index ebbf504c0..784e9778a 100644
@@ -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;
Signature · 15 lines
2.21.1 (Apple Git-122.3)


-- 
This electronic communication and the information and any files transmitted 
with it, or attached to it, are confidential and are intended solely for 
the use of the individual or entity to whom it is addressed and may contain 
information that is confidential, legally privileged, protected by privacy 
laws, or otherwise restricted from disclosure to anyone else. If you are 
not the intended recipient or the person responsible for delivering the 
e-mail to the intended recipient, you are hereby notified that any use, 
copying, distributing, dissemination, forwarding, printing, or copying of 
this e-mail is strictly prohibited. If you received this e-mail in error, 
please return the e-mail to the sender, delete it from your computer, and 
destroy any printed copy of it.
#5 lore raw

PATCH 5/17 net/bnxt: remove references to Thor

In reply to Ajit Khaparde

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.

---
 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(-)
drivers/net/bnxt/bnxt.h +10 -10
index f13d586d4..9c1c87489 100644
@@ -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)
drivers/net/bnxt/bnxt_ethdev.c +22 -21

128 lines not on this page · raw message

drivers/net/bnxt/bnxt_hwrm.c +22 -22

158 lines not on this page · raw message

drivers/net/bnxt/bnxt_ring.c +4 -4
index aeb6cb615..579c48d8c 100644
@@ -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 {
drivers/net/bnxt/bnxt_rxq.c +2 -2
index 61196eba9..328cc994d 100644
@@ -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
drivers/net/bnxt/bnxt_rxr.c +6 -6
index af1774844..e9c4fffed 100644
@@ -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
 
drivers/net/bnxt/bnxt_rxr.h +1 -1
index 3fc901fdf..2a53cf87b 100644
@@ -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);
drivers/net/bnxt/bnxt_vnic.c +2 -2
index 1602fb2b8..4d378eca4 100644
@@ -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);
drivers/net/bnxt/tf_ulp/bnxt_ulp.c +1 -1
index 26fd3009f..de47fde88 100644
@@ -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;
Signature · 15 lines
2.21.1 (Apple Git-122.3)


-- 
This electronic communication and the information and any files transmitted 
with it, or attached to it, are confidential and are intended solely for 
the use of the individual or entity to whom it is addressed and may contain 
information that is confidential, legally privileged, protected by privacy 
laws, or otherwise restricted from disclosure to anyone else. If you are 
not the intended recipient or the person responsible for delivering the 
e-mail to the intended recipient, you are hereby notified that any use, 
copying, distributing, dissemination, forwarding, printing, or copying of 
this e-mail is strictly prohibited. If you received this e-mail in error, 
please return the e-mail to the sender, delete it from your computer, and 
destroy any printed copy of it.
#6 lore raw

PATCH 6/17 net/bnxt: fix to return error when fw command fails

In reply to Ajit Khaparde

From: Kalesh AP <[email protected]>

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")
---
 drivers/net/bnxt/bnxt_ethdev.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/net/bnxt/bnxt_ethdev.c +4 -4
index 8047b0b5d..33358779b 100644
@@ -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,
Signature · 15 lines
2.21.1 (Apple Git-122.3)


-- 
This electronic communication and the information and any files transmitted 
with it, or attached to it, are confidential and are intended solely for 
the use of the individual or entity to whom it is addressed and may contain 
information that is confidential, legally privileged, protected by privacy 
laws, or otherwise restricted from disclosure to anyone else. If you are 
not the intended recipient or the person responsible for delivering the 
e-mail to the intended recipient, you are hereby notified that any use, 
copying, distributing, dissemination, forwarding, printing, or copying of 
this e-mail is strictly prohibited. If you received this e-mail in error, 
please return the e-mail to the sender, delete it from your computer, and 
destroy any printed copy of it.
#7 lore raw

PATCH 7/17 net/bnxt: fix cleanup on mutex init failure

In reply to Ajit Khaparde

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")
---
 drivers/net/bnxt/bnxt_ethdev.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/net/bnxt/bnxt_ethdev.c +3 -1
index 33358779b..0b14ca234 100644
@@ -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)
Signature · 15 lines
2.21.1 (Apple Git-122.3)


-- 
This electronic communication and the information and any files transmitted 
with it, or attached to it, are confidential and are intended solely for 
the use of the individual or entity to whom it is addressed and may contain 
information that is confidential, legally privileged, protected by privacy 
laws, or otherwise restricted from disclosure to anyone else. If you are 
not the intended recipient or the person responsible for delivering the 
e-mail to the intended recipient, you are hereby notified that any use, 
copying, distributing, dissemination, forwarding, printing, or copying of 
this e-mail is strictly prohibited. If you received this e-mail in error, 
please return the e-mail to the sender, delete it from your computer, and 
destroy any printed copy of it.
#8 lore raw

PATCH 8/17 net/bnxt: fix format specifier for unsigned int

In reply to Ajit Khaparde

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

Fixes a46bbb57605b ("net/bnxt: update multi device design")
---
 drivers/net/bnxt/tf_core/tf_core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/bnxt/tf_core/tf_core.c +1 -1
index 24d49096a..3409cbbce 100644
@@ -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);
Signature · 15 lines
2.21.1 (Apple Git-122.3)


-- 
This electronic communication and the information and any files transmitted 
with it, or attached to it, are confidential and are intended solely for 
the use of the individual or entity to whom it is addressed and may contain 
information that is confidential, legally privileged, protected by privacy 
laws, or otherwise restricted from disclosure to anyone else. If you are 
not the intended recipient or the person responsible for delivering the 
e-mail to the intended recipient, you are hereby notified that any use, 
copying, distributing, dissemination, forwarding, printing, or copying of 
this e-mail is strictly prohibited. If you received this e-mail in error, 
please return the e-mail to the sender, delete it from your computer, and 
destroy any printed copy of it.
#9 lore raw

PATCH 9/17 net/bnxt: fix max rings computation

In reply to Ajit Khaparde

From: Sriharsha Basavapatna <[email protected]>

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")
---
 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(-)
drivers/net/bnxt/bnxt.h +28 -13
index 9c1c87489..bc0935272 100644
@@ -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 */
 
 /**
drivers/net/bnxt/bnxt_ethdev.c +1 -1
index 0b14ca234..bf8963577 100644
@@ -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;
drivers/net/bnxt/bnxt_rxq.c +4 -3
index 328cc994d..19e11e47b 100644
@@ -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;
drivers/net/bnxt/bnxt_txq.c +1 -1
index c9792a2af..99a31cef2 100644
@@ -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);
Signature · 15 lines
2.21.1 (Apple Git-122.3)


-- 
This electronic communication and the information and any files transmitted 
with it, or attached to it, are confidential and are intended solely for 
the use of the individual or entity to whom it is addressed and may contain 
information that is confidential, legally privileged, protected by privacy 
laws, or otherwise restricted from disclosure to anyone else. If you are 
not the intended recipient or the person responsible for delivering the 
e-mail to the intended recipient, you are hereby notified that any use, 
copying, distributing, dissemination, forwarding, printing, or copying of 
this e-mail is strictly prohibited. If you received this e-mail in error, 
please return the e-mail to the sender, delete it from your computer, and 
destroy any printed copy of it.
#10 lore raw

PATCH 10/17 net/bnxt: support for 236 queues in NS3

In reply to Ajit Khaparde

From: Rahul Gupta <[email protected]>

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

---
 drivers/net/bnxt/bnxt.h | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/net/bnxt/bnxt.h +1 -2
index bc0935272..2a318efaf 100644
@@ -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;
Signature · 15 lines
2.21.1 (Apple Git-122.3)


-- 
This electronic communication and the information and any files transmitted 
with it, or attached to it, are confidential and are intended solely for 
the use of the individual or entity to whom it is addressed and may contain 
information that is confidential, legally privileged, protected by privacy 
laws, or otherwise restricted from disclosure to anyone else. If you are 
not the intended recipient or the person responsible for delivering the 
e-mail to the intended recipient, you are hereby notified that any use, 
copying, distributing, dissemination, forwarding, printing, or copying of 
this e-mail is strictly prohibited. If you received this e-mail in error, 
please return the e-mail to the sender, delete it from your computer, and 
destroy any printed copy of it.
#11 lore raw

PATCH 11/17 net/bnxt: use the right function to free mbuf

In reply to Ajit Khaparde

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

---
 drivers/net/bnxt/bnxt_reps.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/bnxt/bnxt_reps.c +1 -1
index e5ba0909b..167c46ad4 100644
@@ -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;
Signature · 15 lines
2.21.1 (Apple Git-122.3)


-- 
This electronic communication and the information and any files transmitted 
with it, or attached to it, are confidential and are intended solely for 
the use of the individual or entity to whom it is addressed and may contain 
information that is confidential, legally privileged, protected by privacy 
laws, or otherwise restricted from disclosure to anyone else. If you are 
not the intended recipient or the person responsible for delivering the 
e-mail to the intended recipient, you are hereby notified that any use, 
copying, distributing, dissemination, forwarding, printing, or copying of 
this e-mail is strictly prohibited. If you received this e-mail in error, 
please return the e-mail to the sender, delete it from your computer, and 
destroy any printed copy of it.
#12 lore raw

PATCH 12/17 net/bnxt: remove function declaration

In reply to Ajit Khaparde

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

---
 drivers/net/bnxt/bnxt_hwrm.h | 2 --
 1 file changed, 2 deletions(-)
drivers/net/bnxt/bnxt_hwrm.h +0 -2
index 23ca6ab51..4b3290773 100644
@@ -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);
Signature · 15 lines
2.21.1 (Apple Git-122.3)


-- 
This electronic communication and the information and any files transmitted 
with it, or attached to it, are confidential and are intended solely for 
the use of the individual or entity to whom it is addressed and may contain 
information that is confidential, legally privileged, protected by privacy 
laws, or otherwise restricted from disclosure to anyone else. If you are 
not the intended recipient or the person responsible for delivering the 
e-mail to the intended recipient, you are hereby notified that any use, 
copying, distributing, dissemination, forwarding, printing, or copying of 
this e-mail is strictly prohibited. If you received this e-mail in error, 
please return the e-mail to the sender, delete it from your computer, and 
destroy any printed copy of it.
#13 lore raw

Re: [dpdk-dev] [PATCH 12/17] net/bnxt: remove function declaration

These patches have a signature which is not compatible with submissions to open source mailing list. If we follow the exact legal wording then it conflicts with the meaning of Signed-Off-By.

Quoted 12 lines
Signature · 11 lines
This electronic communication and the information and any files transmitted 
with it, or attached to it, are confidential and are intended solely for 
the use of the individual or entity to whom it is addressed and may contain 
information that is confidential, legally privileged, protected by privacy 
laws, or otherwise restricted from disclosure to anyone else. If you are 
not the intended recipient or the person responsible for delivering the 
e-mail to the intended recipient, you are hereby notified that any use, 
copying, distributing, dissemination, forwarding, printing, or copying of 
this e-mail is strictly prohibited. If you received this e-mail in error, 
please return the e-mail to the sender, delete it from your computer, and 
destroy any printed copy of it.
#14 lore raw

Re: [dpdk-dev] [PATCH 12/17] net/bnxt: remove function declaration

Quoted 4 lines · Stephen Hemminger

These patches have a signature which is not compatible with submissions to open source mailing list. If we follow the exact legal wording then it conflicts with the meaning of Signed-Off-By.

Yikes!! Let me a fresh set without that legal stuff.

Quoted 13 lines
Quoted 13 lines

--
This electronic communication and the information and any files transmitted with it, or attached to it, are confidential and are intended solely for the use of the individual or entity to whom it is addressed and may contain information that is confidential, legally privileged, protected by privacy laws, or otherwise restricted from disclosure to anyone else. If you are not the intended recipient or the person responsible for delivering the e-mail to the intended recipient, you are hereby notified that any use, copying, distributing, dissemination, forwarding, printing, or copying of this e-mail is strictly prohibited. If you received this e-mail in error, please return the e-mail to the sender, delete it from your computer, and destroy any printed copy of it.

Signature · 11 lines
This electronic communication and the information and any files transmitted 
with it, or attached to it, are confidential and are intended solely for 
the use of the individual or entity to whom it is addressed and may contain 
information that is confidential, legally privileged, protected by privacy 
laws, or otherwise restricted from disclosure to anyone else. If you are 
not the intended recipient or the person responsible for delivering the 
e-mail to the intended recipient, you are hereby notified that any use, 
copying, distributing, dissemination, forwarding, printing, or copying of 
this e-mail is strictly prohibited. If you received this e-mail in error, 
please return the e-mail to the sender, delete it from your computer, and 
destroy any printed copy of it.
#15 lore raw

PATCH 13/17 net/bnxt: fix vnic RSS configure function

In reply to Ajit Khaparde

From: Kalesh AP <[email protected]>

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")
---
 drivers/net/bnxt/bnxt_hwrm.c | 42 +++++++++++++++++-------------------
 1 file changed, 20 insertions(+), 22 deletions(-)
drivers/net/bnxt/bnxt_hwrm.c +20 -22
index 6f5402070..cee2656c1 100644
@@ -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,
Signature · 15 lines
2.21.1 (Apple Git-122.3)


-- 
This electronic communication and the information and any files transmitted 
with it, or attached to it, are confidential and are intended solely for 
the use of the individual or entity to whom it is addressed and may contain 
information that is confidential, legally privileged, protected by privacy 
laws, or otherwise restricted from disclosure to anyone else. If you are 
not the intended recipient or the person responsible for delivering the 
e-mail to the intended recipient, you are hereby notified that any use, 
copying, distributing, dissemination, forwarding, printing, or copying of 
this e-mail is strictly prohibited. If you received this e-mail in error, 
please return the e-mail to the sender, delete it from your computer, and 
destroy any printed copy of it.
#16 lore raw

PATCH 14/17 net/bnxt: fix PF resource query

In reply to Ajit Khaparde

From: Somnath Kotur <[email protected]>

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")
---
 drivers/net/bnxt/bnxt_ethdev.c |  7 -------
 drivers/net/bnxt/bnxt_hwrm.c   | 36 +++++++++++++++++++++++++++++++++-
 2 files changed, 35 insertions(+), 8 deletions(-)
drivers/net/bnxt/bnxt_ethdev.c +0 -7
index bf8963577..21d9e26ca 100644
@@ -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 */
drivers/net/bnxt/bnxt_hwrm.c +35 -1
index cee2656c1..a3eb133c0 100644
@@ -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;
 }
 
Signature · 15 lines
2.21.1 (Apple Git-122.3)


-- 
This electronic communication and the information and any files transmitted 
with it, or attached to it, are confidential and are intended solely for 
the use of the individual or entity to whom it is addressed and may contain 
information that is confidential, legally privileged, protected by privacy 
laws, or otherwise restricted from disclosure to anyone else. If you are 
not the intended recipient or the person responsible for delivering the 
e-mail to the intended recipient, you are hereby notified that any use, 
copying, distributing, dissemination, forwarding, printing, or copying of 
this e-mail is strictly prohibited. If you received this e-mail in error, 
please return the e-mail to the sender, delete it from your computer, and 
destroy any printed copy of it.
#17 lore raw

PATCH 15/17 net/bnxt: changes to indentation and coding style

In reply to Ajit Khaparde

Indentation and coding style fixes.

---
 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(-)
drivers/net/bnxt/bnxt.h +2 -2
index 2a318efaf..556e99203 100644
@@ -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
drivers/net/bnxt/bnxt_ethdev.c +4 -5
index 21d9e26ca..9d5c8aa0f 100644
@@ -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,
drivers/net/bnxt/bnxt_reps.c +1 -1
index 167c46ad4..12d677d32 100644
@@ -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]++;
drivers/net/bnxt/bnxt_ring.c +1 -2
index 579c48d8c..f83bcaba2 100644
@@ -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;
Signature · 15 lines
2.21.1 (Apple Git-122.3)


-- 
This electronic communication and the information and any files transmitted 
with it, or attached to it, are confidential and are intended solely for 
the use of the individual or entity to whom it is addressed and may contain 
information that is confidential, legally privileged, protected by privacy 
laws, or otherwise restricted from disclosure to anyone else. If you are 
not the intended recipient or the person responsible for delivering the 
e-mail to the intended recipient, you are hereby notified that any use, 
copying, distributing, dissemination, forwarding, printing, or copying of 
this e-mail is strictly prohibited. If you received this e-mail in error, 
please return the e-mail to the sender, delete it from your computer, and 
destroy any printed copy of it.
#18 lore raw

PATCH 16/17 net/bnxt: add missing comments

In reply to Ajit Khaparde

Add and update some missing comments in the code.

---
 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(+)
drivers/net/bnxt/bnxt.h +6 -0
index 556e99203..07d39ee93 100644
@@ -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;
drivers/net/bnxt/tf_ulp/ulp_template_db_act.c +5 -0
index 00ada607a..509af7c58 100644
@@ -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,
drivers/net/bnxt/tf_ulp/ulp_template_db_class.c +6 -0
index fdb26da3e..d904a04cb 100644
@@ -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,
Signature · 15 lines
2.21.1 (Apple Git-122.3)


-- 
This electronic communication and the information and any files transmitted 
with it, or attached to it, are confidential and are intended solely for 
the use of the individual or entity to whom it is addressed and may contain 
information that is confidential, legally privileged, protected by privacy 
laws, or otherwise restricted from disclosure to anyone else. If you are 
not the intended recipient or the person responsible for delivering the 
e-mail to the intended recipient, you are hereby notified that any use, 
copying, distributing, dissemination, forwarding, printing, or copying of 
this e-mail is strictly prohibited. If you received this e-mail in error, 
please return the e-mail to the sender, delete it from your computer, and 
destroy any printed copy of it.
#19 lore raw

PATCH 17/17 net/bnxt: modify ring index logic

In reply to Ajit Khaparde

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.

---
 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(-)
drivers/net/bnxt/bnxt_cpr.h +6 -4
index ff9697f4c..a763f6006 100644
@@ -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;
 };
 
drivers/net/bnxt/bnxt_hwrm.c +2 -2
index a3eb133c0..73647fba8 100644
@@ -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);
drivers/net/bnxt/bnxt_reps.c +2 -2
index 12d677d32..f7bbf77d3 100644
@@ -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;
drivers/net/bnxt/bnxt_ring.c +22 -17
index f83bcaba2..adddf9bc4 100644
@@ -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);
drivers/net/bnxt/bnxt_ring.h +27 -13
index 0a4685d16..49ae5c3c6 100644
@@ -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;
drivers/net/bnxt/bnxt_rxr.c +62 -48

265 lines not on this page · raw message

drivers/net/bnxt/bnxt_rxr.h +2 -2
index 2a53cf87b..af6ff0972 100644
@@ -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;
drivers/net/bnxt/bnxt_rxtx_vec_common.h +8 -8
index d540e9eee..202291202 100644
@@ -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_ */
drivers/net/bnxt/bnxt_rxtx_vec_neon.c +8 -8
index de1d96570..81f9a7da2 100644
@@ -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;
 }
drivers/net/bnxt/bnxt_rxtx_vec_sse.c +8 -8
index e12bf8bb7..ce92629ab 100644
@@ -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;
drivers/net/bnxt/bnxt_txr.c +30 -21

145 lines not on this page · raw message

drivers/net/bnxt/bnxt_txr.h +3 -3
index 3dfc8ef9b..447c68b7d 100644
@@ -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);
 }
 
Signature · 15 lines
2.21.1 (Apple Git-122.3)


-- 
This electronic communication and the information and any files transmitted 
with it, or attached to it, are confidential and are intended solely for 
the use of the individual or entity to whom it is addressed and may contain 
information that is confidential, legally privileged, protected by privacy 
laws, or otherwise restricted from disclosure to anyone else. If you are 
not the intended recipient or the person responsible for delivering the 
e-mail to the intended recipient, you are hereby notified that any use, 
copying, distributing, dissemination, forwarding, printing, or copying of 
this e-mail is strictly prohibited. If you received this e-mail in error, 
please return the e-mail to the sender, delete it from your computer, and 
destroy any printed copy of it.