From: <psatheesh@marvell.com>
To: Nithin Dabilpuram <ndabilpuram@marvell.com>,
Kiran Kumar K <kirankumark@marvell.com>,
Sunil Kumar Kori <skori@marvell.com>,
Satha Rao <skoteshwar@marvell.com>
Cc: <dev@dpdk.org>, Satheesh Paul <psatheesh@marvell.com>, <stable@dpdk.org>
Subject: [dpdk-dev] [PATCH] net/cnxk: fix aged flows query
Date: Fri, 2 Feb 2024 10:51:37 +0530 [thread overview]
Message-ID: <20240202052137.1324084-1-psatheesh@marvell.com> (raw)
From: Satheesh Paul <psatheesh@marvell.com>
After all aged flows are destroyed, the aged_flows bitmap
is free-ed. Querying aged flows tries to access this bitmap
resulting in a segmentation fault. Fixing this by not accessing
the bitmap if no aged flows are present.
Fixes: 357f5ebc8a24 ("common/cnxk: support flow aging")
Cc: stable@dpdk.org
Signed-off-by: Satheesh Paul <psatheesh@marvell.com>
Reviewed-by: Kiran Kumar K <kirankumark@marvell.com>
---
drivers/common/cnxk/roc_npc_aging.c | 4 ++++
drivers/net/cnxk/cnxk_flow.c | 3 +++
2 files changed, 7 insertions(+)
diff --git a/drivers/common/cnxk/roc_npc_aging.c b/drivers/common/cnxk/roc_npc_aging.c
index 254dd2139b..e0f2dc2291 100644
--- a/drivers/common/cnxk/roc_npc_aging.c
+++ b/drivers/common/cnxk/roc_npc_aging.c
@@ -234,8 +234,11 @@ npc_age_flow_list_entry_delete(struct roc_npc *roc_npc,
{
struct npc *npc = roc_npc_to_npc_priv(roc_npc);
struct npc_age_flow_list_head *list;
+ struct roc_npc_flow_age *flow_age;
struct npc_age_flow_entry *curr;
+ flow_age = &roc_npc->flow_age;
+
list = &npc->age_flow_list;
curr = TAILQ_FIRST(list);
@@ -244,6 +247,7 @@ npc_age_flow_list_entry_delete(struct roc_npc *roc_npc,
while (curr) {
if (flow->mcam_id == curr->flow->mcam_id) {
+ plt_bitmap_clear(flow_age->aged_flows, flow->mcam_id);
TAILQ_REMOVE(list, curr, next);
plt_free(curr);
break;
diff --git a/drivers/net/cnxk/cnxk_flow.c b/drivers/net/cnxk/cnxk_flow.c
index a92b61c332..4deccd1a67 100644
--- a/drivers/net/cnxk/cnxk_flow.c
+++ b/drivers/net/cnxk/cnxk_flow.c
@@ -616,6 +616,9 @@ cnxk_flow_get_aged_flows(struct rte_eth_dev *eth_dev, void **context,
flow_age = &roc_npc->flow_age;
+ if (!flow_age->age_flow_refcnt)
+ return 0;
+
do {
sn = plt_seqcount_read_begin(&flow_age->seq_cnt);
--
2.39.2
next reply other threads:[~2024-02-02 5:21 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-02-02 5:21 psatheesh [this message]
2024-02-02 12:35 ` 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=20240202052137.1324084-1-psatheesh@marvell.com \
--to=psatheesh@marvell.com \
--cc=dev@dpdk.org \
--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).