[PATCH 6/6] common/cnxk: flow aginig delaying app shutdown
Harman Kalra
hkalra at marvell.com
Mon Jun 24 09:48:21 CEST 2024
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.
Signed-off-by: Harman Kalra <hkalra at marvell.com>
Signed-off-by: Kiran Kumar K <kirankumark at 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.18.0
More information about the dev
mailing list