Skip to contentSkip to conversation

common/cnxk: fix ROC naming convention

PATCH Applied [email protected] 2 participants 2 messages Aug 18, 2023 – Aug 21, 2023

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 common/cnxk: fix ROC naming convention

From: Satheesh Paul <[email protected]>

Fix ROC code naming convention.

Fixes d110c44d29e7 ("common/cnxk: support flow aging")
---
 drivers/common/cnxk/roc_npc.h       |  2 +-
 drivers/common/cnxk/roc_npc_aging.c | 14 +++++++++-----
 2 files changed, 10 insertions(+), 6 deletions(-)
drivers/common/cnxk/roc_npc.h +1 -1
index 2fb0aa7a4e..84c92f4c28 100644
@@ -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;
 };
 
drivers/common/cnxk/roc_npc_aging.c +9 -5
index 94126fe9fd..874a7cd4ff 100644
@@ -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;
Signature · 1 line
2.39.2
Applied
#1 lore raw
Quoted 9 lines · On Fri, Aug 18, 2023 at 9:31 AM <[email protected]> wrote:

From: Satheesh Paul <[email protected]>

Fix ROC code naming convention.

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

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

Quoted 67 lines
---
 drivers/common/cnxk/roc_npc.h       |  2 +-
 drivers/common/cnxk/roc_npc_aging.c | 14 +++++++++-----
 2 files changed, 10 insertions(+), 6 deletions(-)
drivers/common/cnxk/roc_npc.h +1 -1
index 2fb0aa7a4e..84c92f4c28 100644
@@ -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;
 };
 
drivers/common/cnxk/roc_npc_aging.c +9 -6
index 94126fe9fd..874a7cd4ff 100644
@@ -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