[dpdk-dev] [PATCH ] common/cnxk: fix ROC naming convention

psatheesh at marvell.com psatheesh at marvell.com
Fri Aug 18 06:01:39 CEST 2023


From: Satheesh Paul <psatheesh at marvell.com>

Fix ROC code naming convention.

Fixes: d110c44d29e7 ("common/cnxk: support flow aging")

Signed-off-by: Satheesh Paul <psatheesh at marvell.com>
Reviewed-by: Jerin Jacob <jerinj at marvell.com>
---
 drivers/common/cnxk/roc_npc.h       |  2 +-
 drivers/common/cnxk/roc_npc_aging.c | 14 +++++++++-----
 2 files changed, 10 insertions(+), 6 deletions(-)

diff --git a/drivers/common/cnxk/roc_npc.h b/drivers/common/cnxk/roc_npc.h
index 2fb0aa7a4e..84c92f4c28 100644
--- a/drivers/common/cnxk/roc_npc.h
+++ b/drivers/common/cnxk/roc_npc.h
@@ -224,7 +224,7 @@ struct roc_npc_action_port_id {
 struct roc_npc_action_age {
 	uint32_t timeout : 24; /**< Time in seconds. */
 	uint32_t reserved : 8; /**< Reserved, must be zero. */
-	/** The user flow context, NULL means the rte_flow pointer. */
+	/** The user flow context, NULL means the flow pointer. */
 	void *context;
 };
 
diff --git a/drivers/common/cnxk/roc_npc_aging.c b/drivers/common/cnxk/roc_npc_aging.c
index 94126fe9fd..874a7cd4ff 100644
--- a/drivers/common/cnxk/roc_npc_aging.c
+++ b/drivers/common/cnxk/roc_npc_aging.c
@@ -62,7 +62,7 @@ check_timeout_cycles(struct roc_npc *roc_npc, uint32_t mcam_id)
 	list = &npc->age_flow_list;
 	TAILQ_FOREACH(fl_iter, list, next) {
 		if (fl_iter->flow->mcam_id == mcam_id &&
-		    fl_iter->flow->timeout_cycles < rte_get_timer_cycles()) {
+		    fl_iter->flow->timeout_cycles < plt_tsc_cycles()) {
 			/* update bitmap */
 			plt_bitmap_set(flow_age->aged_flows, mcam_id);
 			if (!aging_enabled) {
@@ -90,8 +90,8 @@ update_timeout_cycles(struct roc_npc *roc_npc, uint32_t mcam_id)
 	list = &npc->age_flow_list;
 	TAILQ_FOREACH(fl_iter, list, next) {
 		if (fl_iter->flow->mcam_id == mcam_id) {
-			fl_iter->flow->timeout_cycles = rte_get_timer_cycles() +
-				fl_iter->flow->timeout * rte_get_timer_hz();
+			fl_iter->flow->timeout_cycles = plt_tsc_cycles() +
+				fl_iter->flow->timeout * plt_tsc_hz();
 			break;
 		}
 	}
@@ -214,6 +214,11 @@ npc_age_flow_list_entry_add(struct roc_npc *roc_npc, struct roc_npc_flow *flow)
 	struct npc_age_flow_entry *new_entry;
 
 	new_entry = plt_zmalloc(sizeof(*new_entry), 0);
+	if (new_entry == NULL) {
+		plt_err("flow entry alloc failed");
+		return;
+	}
+
 	new_entry->flow = flow;
 	roc_npc->flow_age.age_flow_refcnt++;
 	/* List in ascending order of mcam entries */
@@ -269,8 +274,7 @@ npc_aging_ctrl_thread_create(struct roc_npc *roc_npc,
 
 	flow->age_context = age->context == NULL ? flow : age->context;
 	flow->timeout = age->timeout;
-	flow->timeout_cycles = rte_get_timer_cycles() + age->timeout *
-			       rte_get_timer_hz();
+	flow->timeout_cycles = plt_tsc_cycles() + age->timeout * plt_tsc_hz();
 
 	if (flow_age->age_flow_refcnt == 0) {
 		flow_age->aged_flows_get_thread_exit = false;
-- 
2.39.2



More information about the dev mailing list