[v1] common/cnxk: fix initialization of MCAM ID

Message ID 20230921074637.4043468-1-adwivedi@marvell.com (mailing list archive)
State Accepted, archived
Delegated to: Jerin Jacob
Headers
Series [v1] common/cnxk: fix initialization of MCAM ID |

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/Intel-compilation success Compilation OK
ci/intel-Testing success Testing PASS
ci/iol-mellanox-Performance success Performance Testing PASS
ci/iol-intel-Performance success Performance Testing PASS
ci/iol-unit-arm64-testing success Testing PASS
ci/iol-sample-apps-testing success Testing PASS
ci/intel-Functional success Functional PASS
ci/iol-compile-amd64-testing success Testing PASS
ci/iol-unit-amd64-testing success Testing PASS
ci/iol-compile-arm64-testing success Testing PASS
ci/iol-broadcom-Performance success Performance Testing PASS
ci/iol-intel-Functional success Functional Testing PASS
ci/iol-broadcom-Functional success Functional Testing PASS

Commit Message

Ankur Dwivedi Sept. 21, 2023, 7:46 a.m. UTC
  The start and end mcam id is initialized when aged_flows_cnt is 0. The
boolean variable aging_enabled is not needed.

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

Signed-off-by: Ankur Dwivedi <adwivedi@marvell.com>
---
 drivers/common/cnxk/roc_npc_aging.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
  

Comments

Jerin Jacob Sept. 27, 2023, 3:44 p.m. UTC | #1
On Thu, Sep 21, 2023 at 1:16 PM Ankur Dwivedi <adwivedi@marvell.com> wrote:
>
> The start and end mcam id is initialized when aged_flows_cnt is 0. The
> boolean variable aging_enabled is not needed.
>
> Fixes: d110c44d29e7 ("common/cnxk: support flow aging")
>
> Signed-off-by: Ankur Dwivedi <adwivedi@marvell.com>

Updated the git commit as follows and applied to
dpdk-next-net-mrvl/for-next-net. Thanks

    common/cnxk: fix aging initialization

    The start and end mcam id is initialized when aged_flows_cnt is 0.
    The boolean variable aging_enabled is not needed.

    Fixes: d110c44d29e7 ("common/cnxk: support flow aging")
    Cc: stable@dpdk.org

    Signed-off-by: Ankur Dwivedi <adwivedi@marvell.com>



> ---
>  drivers/common/cnxk/roc_npc_aging.c | 4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)
>
> diff --git a/drivers/common/cnxk/roc_npc_aging.c b/drivers/common/cnxk/roc_npc_aging.c
> index 874a7cd4ff..4b845954b4 100644
> --- a/drivers/common/cnxk/roc_npc_aging.c
> +++ b/drivers/common/cnxk/roc_npc_aging.c
> @@ -56,7 +56,6 @@ check_timeout_cycles(struct roc_npc *roc_npc, uint32_t mcam_id)
>         struct npc_age_flow_list_head *list;
>         struct npc_age_flow_entry *fl_iter;
>         struct roc_npc_flow_age *flow_age;
> -       bool aging_enabled = false;
>
>         flow_age = &roc_npc->flow_age;
>         list = &npc->age_flow_list;
> @@ -65,10 +64,9 @@ check_timeout_cycles(struct roc_npc *roc_npc, uint32_t mcam_id)
>                     fl_iter->flow->timeout_cycles < plt_tsc_cycles()) {
>                         /* update bitmap */
>                         plt_bitmap_set(flow_age->aged_flows, mcam_id);
> -                       if (!aging_enabled) {
> +                       if (flow_age->aged_flows_cnt == 0) {
>                                 flow_age->start_id = mcam_id;
>                                 flow_age->end_id = mcam_id;
> -                               aging_enabled = true;
>                         }
>                         if (flow_age->start_id > mcam_id)
>                                 flow_age->start_id = mcam_id;
> --
> 2.25.1
>
  

Patch

diff --git a/drivers/common/cnxk/roc_npc_aging.c b/drivers/common/cnxk/roc_npc_aging.c
index 874a7cd4ff..4b845954b4 100644
--- a/drivers/common/cnxk/roc_npc_aging.c
+++ b/drivers/common/cnxk/roc_npc_aging.c
@@ -56,7 +56,6 @@  check_timeout_cycles(struct roc_npc *roc_npc, uint32_t mcam_id)
 	struct npc_age_flow_list_head *list;
 	struct npc_age_flow_entry *fl_iter;
 	struct roc_npc_flow_age *flow_age;
-	bool aging_enabled = false;
 
 	flow_age = &roc_npc->flow_age;
 	list = &npc->age_flow_list;
@@ -65,10 +64,9 @@  check_timeout_cycles(struct roc_npc *roc_npc, uint32_t mcam_id)
 		    fl_iter->flow->timeout_cycles < plt_tsc_cycles()) {
 			/* update bitmap */
 			plt_bitmap_set(flow_age->aged_flows, mcam_id);
-			if (!aging_enabled) {
+			if (flow_age->aged_flows_cnt == 0) {
 				flow_age->start_id = mcam_id;
 				flow_age->end_id = mcam_id;
-				aging_enabled = true;
 			}
 			if (flow_age->start_id > mcam_id)
 				flow_age->start_id = mcam_id;