common/cnxk: fix ROC naming convention

Message ID 20230818040139.626967-1-psatheesh@marvell.com (mailing list archive)
State Accepted, archived
Delegated to: Jerin Jacob
Headers
Series common/cnxk: fix ROC naming convention |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/loongarch-compilation success Compilation OK
ci/loongarch-unit-testing success Unit Testing PASS
ci/iol-compile-amd64-testing success Testing PASS
ci/iol-sample-apps-testing success Testing PASS
ci/iol-unit-amd64-testing success Testing PASS
ci/iol-unit-arm64-testing success Testing PASS
ci/iol-compile-arm64-testing success Testing PASS
ci/iol-intel-Functional success Functional Testing PASS
ci/iol-broadcom-Performance success Performance Testing PASS
ci/iol-intel-Performance success Performance Testing PASS
ci/iol-broadcom-Functional success Functional Testing PASS
ci/Intel-compilation warning apply issues

Commit Message

Satheesh Paul Antonysamy Aug. 18, 2023, 4:01 a.m. UTC
  From: Satheesh Paul <psatheesh@marvell.com>

Fix ROC code naming convention.

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

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

Comments

Jerin Jacob Aug. 21, 2023, 3:29 p.m. UTC | #1
On Fri, Aug 18, 2023 at 9:31 AM <psatheesh@marvell.com> wrote:
>
> From: Satheesh Paul <psatheesh@marvell.com>
>
> Fix ROC code naming convention.
>
> Fixes: d110c44d29e7 ("common/cnxk: support flow aging")
>
> Signed-off-by: Satheesh Paul <psatheesh@marvell.com>
> Reviewed-by: Jerin Jacob <jerinj@marvell.com>

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


> ---
>  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
>
  

Patch

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;