patches for DPDK stable branches
 help / color / mirror / Atom feed
From: Ankur Dwivedi <adwivedi@marvell.com>
To: <dev@dpdk.org>
Cc: <jerinj@marvell.com>, <ndabilpuram@marvell.com>,
	<kirankumark@marvell.com>, <skori@marvell.com>,
	<skoteshwar@marvell.com>, Ankur Dwivedi <adwivedi@marvell.com>,
	<stable@dpdk.org>
Subject: [PATCH v1] common/cnxk: fix aged flows bitmap alloc
Date: Thu, 2 Nov 2023 17:08:03 +0530	[thread overview]
Message-ID: <20231102113803.2173468-1-adwivedi@marvell.com> (raw)

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")
Cc: stable@dpdk.org

Signed-off-by: Ankur Dwivedi <adwivedi@marvell.com>
---
 drivers/common/cnxk/roc_npc.c       | 5 ++---
 drivers/common/cnxk/roc_npc_aging.c | 6 +++++-
 2 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/drivers/common/cnxk/roc_npc.c b/drivers/common/cnxk/roc_npc.c
index 7593466bc1..f2cf4d8a28 100644
--- a/drivers/common/cnxk/roc_npc.c
+++ b/drivers/common/cnxk/roc_npc.c
@@ -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:
diff --git a/drivers/common/cnxk/roc_npc_aging.c b/drivers/common/cnxk/roc_npc_aging.c
index a456d2b893..254dd2139b 100644
--- a/drivers/common/cnxk/roc_npc_aging.c
+++ b/drivers/common/cnxk/roc_npc_aging.c
@@ -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;
 		}
-- 
2.25.1


             reply	other threads:[~2023-11-02 23:25 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-02 11:38 Ankur Dwivedi [this message]
2023-11-07  6:54 ` Jerin Jacob

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20231102113803.2173468-1-adwivedi@marvell.com \
    --to=adwivedi@marvell.com \
    --cc=dev@dpdk.org \
    --cc=jerinj@marvell.com \
    --cc=kirankumark@marvell.com \
    --cc=ndabilpuram@marvell.com \
    --cc=skori@marvell.com \
    --cc=skoteshwar@marvell.com \
    --cc=stable@dpdk.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).