Skip to contentSkip to conversation

bnxt bug fixes

PATCH In review Ajit Khaparde 1 participant 5 messages Jun 6, 2024 – Jun 7, 2024 Network drivers

lore
Share & tools
lore
#0 lore raw

cover bnxt bug fixes

Some bug fixes for the bnxt PMD.
Please apply.

Ajit Khaparde (2):
net/bnxt: fix vector mode for P7 devices
net/bnxt: fix backing store logging

Damodharam Ammepalli (1):
net/bnxt: refactor backing store qcaps v2

 drivers/net/bnxt/bnxt_hwrm.c            | 64 +++++++------------------
 drivers/net/bnxt/bnxt_ring.h            |  3 +-
 drivers/net/bnxt/bnxt_rxtx_vec_common.h |  6 ++-
 3 files changed, 24 insertions(+), 49 deletions(-)
Signature · 1 line
2.39.2 (Apple Git-143)
#1 lore raw

PATCH 1/3 net/bnxt: fix vector mode for P7 devices

Fix vector code to update the producer index correctly especially for P7 devices where the code needs to handle epoch bit indication correctly to the hardware.

Fixes 30656a1cace8 ("net/bnxt: refactor epoch setting")
---
 drivers/net/bnxt/bnxt_ring.h            | 3 ++-
 drivers/net/bnxt/bnxt_rxtx_vec_common.h | 6 +++++-
 2 files changed, 7 insertions(+), 2 deletions(-)
drivers/net/bnxt/bnxt_ring.h +2 -1
index 1bae4b33d9..b33fb75284 100644
@@ -89,7 +89,8 @@ static inline void bnxt_db_write(struct bnxt_db_info *db, uint32_t idx)
 	if (db->db_64) {
 		uint64_t key_idx = db->db_key64 | db_idx;
 
-		rte_write64(key_idx, doorbell);
+		rte_compiler_barrier();
+		rte_write64_relaxed(key_idx, doorbell);
 	} else {
 		uint32_t key_idx = db->db_key32 | db_idx;
 
drivers/net/bnxt/bnxt_rxtx_vec_common.h +5 -1
index 2294f0aa3c..f608b5152e 100644
@@ -88,7 +88,11 @@ bnxt_rxq_rearm(struct bnxt_rx_queue *rxq, struct bnxt_rx_ring_info *rxr)
 	}
 
 	rxq->rxrearm_start += nb;
-	bnxt_db_write(&rxr->rx_db, rxq->rxrearm_start - 1);
+	/*
+	 * We can pass rxq->rxrearm_star - 1 as well, but then the epoch
+	 * bit calculation is messed up.
+	 */
+	bnxt_db_write(&rxr->rx_db, rxr->rx_raw_prod);
 	if (rxq->rxrearm_start >= rxq->nb_rx_desc)
 		rxq->rxrearm_start = 0;
 
Signature · 1 line
2.39.2 (Apple Git-143)
#2 lore raw

PATCH 2/3 net/bnxt: refactor backing store qcaps v2

In reply to Ajit Khaparde

From: Damodharam Ammepalli <[email protected]>

During bnxt_hwrm_func_backing_store_types_count driver increments types only for valid type but not in bnxt_hwrm_func_backing_store_cfg_v2. Implement the same logic in store cfg also to prevent ctx types control loop exiting the loop prematurely while firmware still has valid types to return if queried.

Fixes fe2f715ca580 ("net/bnxt: support backing store v2")
---
 drivers/net/bnxt/bnxt_hwrm.c | 16 ++++++++++++----
 1 file changed, 12 insertions(+), 4 deletions(-)
drivers/net/bnxt/bnxt_hwrm.c +12 -4
index 6ea7089a3f..9ea5cc090f 100644
@@ -6352,11 +6352,14 @@ int bnxt_hwrm_func_backing_store_qcaps_v2(struct bnxt *bp)
 	uint16_t types, type;
 	int rc;
 
-	for (types = 0, type = 0; types < bp->ctx->types && type != BNXT_CTX_INV; types++) {
-		struct bnxt_ctx_mem *ctxm = &bp->ctx->ctx_arr[types];
+	types = 0;
+	type = 0;
+	do {
+		struct bnxt_ctx_mem *ctxm;
 		uint8_t init_val, init_off, i;
 		uint32_t *p;
 		uint32_t flags;
+		bool cnt = true;
 
 		HWRM_PREP(&req, HWRM_FUNC_BACKING_STORE_QCAPS_V2, BNXT_USE_CHIMP_MB);
 		req.type = rte_cpu_to_le_16(type);
@@ -6365,9 +6368,12 @@ int bnxt_hwrm_func_backing_store_qcaps_v2(struct bnxt *bp)
 
 		flags = rte_le_to_cpu_32(resp->flags);
 		type = rte_le_to_cpu_16(resp->next_valid_type);
-		if (!(flags & HWRM_FUNC_BACKING_STORE_QCAPS_V2_OUTPUT_FLAGS_TYPE_VALID))
+		if (!(flags & HWRM_FUNC_BACKING_STORE_QCAPS_V2_OUTPUT_FLAGS_TYPE_VALID)) {
+			cnt = false;
 			goto next;
+		}
 
+		ctxm = &bp->ctx->ctx_arr[types];
 		ctxm->type = rte_le_to_cpu_16(resp->type);
 
 		ctxm->flags = flags;
@@ -6404,8 +6410,10 @@ int bnxt_hwrm_func_backing_store_qcaps_v2(struct bnxt *bp)
 		last_valid_type = ctxm->type;
 		last_valid_idx = types;
 next:
+		if (cnt)
+			types++;
 		HWRM_UNLOCK();
-	}
+	} while (types < bp->ctx->types && type != BNXT_CTX_INV);
 	ctx->ctx_arr[last_valid_idx].last = true;
 	PMD_DRV_LOG(DEBUG, "Last valid type 0x%x\n", last_valid_type);
 
Signature · 1 line
2.39.2 (Apple Git-143)
#3 lore raw

PATCH 3/3 net/bnxt: fix backing store logging

In reply to Ajit Khaparde

Backing store type count can increase with newer firmware. So a static bnxt_backing_store_types can cause unnecessary faults. Instead of logging the string for the backing store type, just log the value provided by the firmware.

Fixes fe2f715ca580 ("net/bnxt: support backing store v2")
---
 drivers/net/bnxt/bnxt_hwrm.c | 48 ++++--------------------------------
 1 file changed, 5 insertions(+), 43 deletions(-)
drivers/net/bnxt/bnxt_hwrm.c +5 -43
index 9ea5cc090f..fc142672f6 100644
@@ -31,43 +31,6 @@ struct bnxt_plcmodes_cfg {
 	uint16_t	hds_threshold;
 };
 
-const char *bnxt_backing_store_types[] = {
-	"Queue pair",
-	"Shared receive queue",
-	"Completion queue",
-	"Virtual NIC",
-	"Statistic context",
-	"Slow-path TQM ring",
-	"Fast-path TQM ring",
-	"Unused",
-	"Unused",
-	"Unused",
-	"Unused",
-	"Unused",
-	"Unused",
-	"Unused",
-	"MR and MAV Context",
-	"TIM",
-	"Unused",
-	"Unused",
-	"Unused",
-	"Tx key context",
-	"Rx key context",
-	"Mid-path TQM ring",
-	"SQ Doorbell shadow region",
-	"RQ Doorbell shadow region",
-	"SRQ Doorbell shadow region",
-	"CQ Doorbell shadow region",
-	"QUIC Tx key context",
-	"QUIC Rx key context",
-	"Invalid type",
-	"Invalid type",
-	"Invalid type",
-	"Invalid type",
-	"Invalid type",
-	"Invalid type"
-};
-
 const char *media_type[] = { "Unknown", "Twisted Pair",
 	"Direct Attached Copper", "Fiber"
 };
@@ -6402,8 +6365,8 @@ int bnxt_hwrm_func_backing_store_qcaps_v2(struct bnxt *bp)
 			ctxm->split[i] = rte_le_to_cpu_32(*p);
 
 		PMD_DRV_LOG(DEBUG,
-			    "type:%s size:%d multiple:%d max:%d min:%d split:%d init_val:%d init_off:%d init:%d bmap:0x%x\n",
-			    bnxt_backing_store_types[ctxm->type], ctxm->entry_size,
+			    "type:0x%x size:%d multiple:%d max:%d min:%d split:%d init_val:%d init_off:%d init:%d bmap:0x%x\n",
+			    ctxm->type, ctxm->entry_size,
 			    ctxm->entry_multiple, ctxm->max_entries, ctxm->min_entries,
 			    ctxm->split_entry_cnt, init_val, init_off,
 			    BNXT_CTX_INIT_VALID(flags), ctxm->instance_bmap);
@@ -6446,8 +6409,7 @@ int bnxt_hwrm_func_backing_store_types_count(struct bnxt *bp)
 		HWRM_UNLOCK();
 
 		if (flags & HWRM_FUNC_BACKING_STORE_QCAPS_V2_OUTPUT_FLAGS_TYPE_VALID) {
-			PMD_DRV_LOG(DEBUG, "Valid types 0x%x - %s\n",
-				    req.type, bnxt_backing_store_types[req.type]);
+			PMD_DRV_LOG(DEBUG, "Valid types 0x%x\n", req.type);
 			types++;
 		}
 	} while (type != HWRM_FUNC_BACKING_STORE_QCAPS_V2_OUTPUT_TYPE_INVALID);
@@ -6625,8 +6587,8 @@ int bnxt_hwrm_func_backing_store_cfg_v2(struct bnxt *bp,
 				      &req.page_size_pbl_level,
 				      &req.page_dir);
 		PMD_DRV_LOG(DEBUG,
-			    "Backing store config V2 type:%s last %d, instance %d, hw %d\n",
-			    bnxt_backing_store_types[req.type], ctxm->last, j, w);
+			    "Backing store config V2 type:0x%x last %d, instance %d, hw %d\n",
+			    req.type, ctxm->last, j, w);
 		if (ctxm->last && i == (w - 1))
 			req.flags =
 			rte_cpu_to_le_32(BACKING_STORE_CFG_V2_IN_FLG_CFG_ALL_DONE);
Signature · 1 line
2.39.2 (Apple Git-143)
#4 lore raw
In reply to Ajit Khaparde
Quoted 3 lines · Ajit Khaparde

Some bug fixes for the bnxt PMD.
Please apply.

Patchset merged into dpdk-next-net-brcm.

Quoted 16 lines

Ajit Khaparde (2):
net/bnxt: fix vector mode for P7 devices
net/bnxt: fix backing store logging

Damodharam Ammepalli (1):
net/bnxt: refactor backing store qcaps v2

 drivers/net/bnxt/bnxt_hwrm.c            | 64 +++++++------------------
 drivers/net/bnxt/bnxt_ring.h            |  3 +-
 drivers/net/bnxt/bnxt_rxtx_vec_common.h |  6 ++-
 3 files changed, 24 insertions(+), 49 deletions(-)

--
2.39.2 (Apple Git-143)