patches for DPDK stable branches
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] common/cnxk: fix flow aging application exit
@ 2024-06-17 11:27 psatheesh
  2024-06-25  5:10 ` Jerin Jacob
  0 siblings, 1 reply; 2+ messages in thread
From: psatheesh @ 2024-06-17 11:27 UTC (permalink / raw)
  To: Nithin Dabilpuram, Kiran Kumar K, Sunil Kumar Kori, Satha Rao,
	Harman Kalra
  Cc: dev, stable, Jerin Jacob

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


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [dpdk-dev] [PATCH] common/cnxk: fix flow aging application exit
  2024-06-17 11:27 [dpdk-dev] [PATCH] common/cnxk: fix flow aging application exit psatheesh
@ 2024-06-25  5:10 ` Jerin Jacob
  0 siblings, 0 replies; 2+ messages in thread
From: Jerin Jacob @ 2024-06-25  5:10 UTC (permalink / raw)
  To: psatheesh
  Cc: Nithin Dabilpuram, Kiran Kumar K, Sunil Kumar Kori, Satha Rao,
	Harman Kalra, dev, stable, Jerin Jacob

On Mon, Jun 17, 2024 at 4:58 PM <psatheesh@marvell.com> wrote:
>
> 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>

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

    common/cnxk: fix flow aging handling on application exit

    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>


> ---
>  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
>

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2024-06-25  5:11 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-06-17 11:27 [dpdk-dev] [PATCH] common/cnxk: fix flow aging application exit psatheesh
2024-06-25  5:10 ` Jerin Jacob

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).