Skip to contentSkip to conversation

common/cnxk: fix aged flows bitmap alloc

PATCH Applied Ankur Dwivedi 2 participants 2 messages Nov 2, 2023 – Nov 7, 2023

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 common/cnxk: fix aged flows bitmap alloc

The allocation of bitmap for aged flows should be done in npc_aging_ctrl_thread_create() instead of roc_npc_init(), as the bitmap free is being done in npc_aging_ctrl_thread_destroy().

Fixes 357f5ebc8a24 ("common/cnxk: support flow aging")
---
 drivers/common/cnxk/roc_npc.c       | 5 ++---
 drivers/common/cnxk/roc_npc_aging.c | 6 +++++-
 2 files changed, 7 insertions(+), 4 deletions(-)
drivers/common/cnxk/roc_npc.c +2 -3
index 7593466bc1..f2cf4d8a28 100644
@@ -331,9 +331,8 @@ roc_npc_init(struct roc_npc *roc_npc)
 	 */
 	plt_bitmap_set(npc->rss_grp_entries, 0);
 
-	rc = npc_aged_flows_bitmap_alloc(roc_npc);
-	if (rc != 0)
-		goto done;
+	roc_npc->flow_age.age_flow_refcnt = 0;
+
 	return rc;
 
 done:
drivers/common/cnxk/roc_npc_aging.c +5 -1
index a456d2b893..254dd2139b 100644
@@ -33,7 +33,6 @@ npc_aged_flows_bitmap_alloc(struct roc_npc *roc_npc)
 		goto done;
 	}
 
-	flow_age->age_flow_refcnt = 0;
 done:
 	return rc;
 }
@@ -276,11 +275,16 @@ npc_aging_ctrl_thread_create(struct roc_npc *roc_npc,
 	flow->has_age_action = true;
 
 	if (flow_age->age_flow_refcnt == 0) {
+		errcode = npc_aged_flows_bitmap_alloc(roc_npc);
+		if (errcode != 0)
+			goto done;
+
 		flow_age->aged_flows_get_thread_exit = false;
 		if (plt_thread_create_control(&flow_age->aged_flows_poll_thread,
 					   "Aged Flows Get Ctrl Thread",
 					   npc_aged_flows_get, roc_npc) != 0) {
 			plt_err("Failed to create thread for age flows");
+			npc_aged_flows_bitmap_free(roc_npc);
 			errcode = NPC_ERR_ACTION_NOTSUP;
 			goto done;
 		}
Signature · 1 line
2.25.1
Applied
#1 lore raw
Quoted 9 lines · Ankur Dwivedi

The allocation of bitmap for aged flows should be done in npc_aging_ctrl_thread_create() instead of roc_npc_init(), as the bitmap free is being done in npc_aging_ctrl_thread_destroy().

Fixes 357f5ebc8a24 ("common/cnxk: support flow aging")

Applied to dpdk-next-net-mrvl/for-next-net. Thanks