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>,
Harman Kalra <hkalra@marvell.com>
Cc: <dev@dpdk.org>, <stable@dpdk.org>, Jerin Jacob <jerinj@marvell.com>
Subject: [dpdk-dev] [PATCH] common/cnxk: fix flow aging application exit
Date: Mon, 17 Jun 2024 16:57:54 +0530 [thread overview]
Message-ID: <20240617112754.4080314-1-psatheesh@marvell.com> (raw)
From: Kiran Kumar K <kirankumark@marvell.com>
If flow aging is enabled application termination may take time
equivalent to aging timeout. This is because on termination flow
thread uses a sleep call which is uninterruptible.
Fixes: 357f5ebc8a24 ("common/cnxk: support flow aging")
Cc: stable@dpdk.org
Signed-off-by: Kiran Kumar K <kirankumark@marvell.com>
Signed-off-by: Harman Kalra <hkalra@marvell.com>
Reviewed-by: Jerin Jacob <jerinj@marvell.com>
---
drivers/common/cnxk/roc_npc_aging.c | 17 ++++++++++++++++-
1 file changed, 16 insertions(+), 1 deletion(-)
diff --git a/drivers/common/cnxk/roc_npc_aging.c b/drivers/common/cnxk/roc_npc_aging.c
index 15f6e61d76..66c953135a 100644
--- a/drivers/common/cnxk/roc_npc_aging.c
+++ b/drivers/common/cnxk/roc_npc_aging.c
@@ -133,6 +133,21 @@ npc_mcam_get_hit_status(struct npc *npc, uint64_t *mcam_ids, uint16_t start_id,
return rc;
}
+static void
+npc_age_wait_until(struct roc_npc_flow_age *flow_age)
+{
+#define NPC_AGE_WAIT_TIMEOUT_MS 1000
+#define NPC_AGE_WAIT_TIMEOUT_US (NPC_AGE_WAIT_TIMEOUT_MS * NPC_AGE_WAIT_TIMEOUT_MS)
+ uint64_t timeout = 0;
+ uint64_t sleep = 10 * NPC_AGE_WAIT_TIMEOUT_MS;
+
+ do {
+ plt_delay_us(sleep);
+ timeout += sleep;
+ } while (!flow_age->aged_flows_get_thread_exit &&
+ (timeout < (flow_age->aging_poll_freq * NPC_AGE_WAIT_TIMEOUT_US)));
+}
+
uint32_t
npc_aged_flows_get(void *args)
{
@@ -197,7 +212,7 @@ npc_aged_flows_get(void *args)
plt_seqcount_write_end(&flow_age->seq_cnt);
lbl_sleep:
- sleep(flow_age->aging_poll_freq);
+ npc_age_wait_until(flow_age);
}
return 0;
--
2.39.2
next reply other threads:[~2024-06-17 11:28 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-06-17 11:27 psatheesh [this message]
2024-06-25 5:10 ` 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=20240617112754.4080314-1-psatheesh@marvell.com \
--to=psatheesh@marvell.com \
--cc=dev@dpdk.org \
--cc=hkalra@marvell.com \
--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).