Skip to contentSkip to conversation

net/bnxt: fix context memory allocation

PATCH Applied Lance Richardson 2 participants 2 messages Jul 29, 2019 – Jul 30, 2019 Network drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 net/bnxt: fix context memory allocation

From: Kalesh AP <[email protected]>

There is a bug in context memory allocation because of which it results in reusing the context memory allocated for the first port while allocating memory for next ports.

Fix it by passing the port id in the name field while allocating context memory.

Fixes f8168ca0e690 ("net/bnxt: support thor controller")
---
 drivers/net/bnxt/bnxt_ethdev.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)
drivers/net/bnxt/bnxt_ethdev.c +5 -3
index 2a8b50296..6685ee7d9 100644
@@ -3399,8 +3399,9 @@ static int bnxt_alloc_ctx_mem_blk(__rte_unused struct bnxt *bp,
 	valid_bits = PTU_PTE_VALID;
 
 	if (rmem->nr_pages > 1) {
-		snprintf(mz_name, RTE_MEMZONE_NAMESIZE, "bnxt_ctx_pg_tbl%s_%x",
-			 suffix, idx);
+		snprintf(mz_name, RTE_MEMZONE_NAMESIZE,
+			 "bnxt_ctx_pg_tbl%s_%x_%d",
+			 suffix, idx, bp->eth_dev->data->port_id);
 		mz_name[RTE_MEMZONE_NAMESIZE - 1] = 0;
 		mz = rte_memzone_lookup(mz_name);
 		if (!mz) {
@@ -3436,7 +3437,8 @@ static int bnxt_alloc_ctx_mem_blk(__rte_unused struct bnxt *bp,
 		rmem->pg_tbl_mz = mz;
 	}
 
-	snprintf(mz_name, RTE_MEMZONE_NAMESIZE, "bnxt_ctx_%s_%x", suffix, idx);
+	snprintf(mz_name, RTE_MEMZONE_NAMESIZE, "bnxt_ctx_%s_%x_%d",
+		 suffix, idx, bp->eth_dev->data->port_id);
 	mz = rte_memzone_lookup(mz_name);
 	if (!mz) {
 		mz = rte_memzone_reserve_aligned(mz_name,
Signature · 1 line
2.17.1
Applied
#1 lore raw
Quoted 6 lines · Lance Richardson

From: Kalesh AP <[email protected]>

There is a bug in context memory allocation because of which it results in reusing the context memory allocated for the first port while allocating memory for next ports.

Quoted 8 lines

Fix it by passing the port id in the name field while allocating context memory.

Fixes f8168ca0e690 ("net/bnxt: support thor controller")

Applied to dpdk-next-net/master, thanks.