patches for DPDK stable branches
 help / color / mirror / Atom feed
* [PATCH v1] common/cnxk: fix flow add in age flow list
@ 2023-10-17 11:18 Ankur Dwivedi
  2023-10-18  7:18 ` Jerin Jacob
  0 siblings, 1 reply; 2+ messages in thread
From: Ankur Dwivedi @ 2023-10-17 11:18 UTC (permalink / raw)
  To: dev
  Cc: jerinj, ndabilpuram, kirankumark, skori, skoteshwar,
	Ankur Dwivedi, stable

While adding flow in npc_flow_list, the flow can be added before the
current flow iterator. The function returns after adding this flow.
This prevents flow to be added in age flow list correctly. This patch moves
the addition of age flow list before npc_flow_list add to prevent the
error. Also the flow is added or deleted to/from age flow list if the flow
has age action.

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       | 9 ++++++---
 drivers/common/cnxk/roc_npc.h       | 1 +
 drivers/common/cnxk/roc_npc_aging.c | 1 +
 3 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/drivers/common/cnxk/roc_npc.c b/drivers/common/cnxk/roc_npc.c
index f36f5e42c8..7593466bc1 100644
--- a/drivers/common/cnxk/roc_npc.c
+++ b/drivers/common/cnxk/roc_npc.c
@@ -1510,6 +1510,9 @@ roc_npc_flow_create(struct roc_npc *roc_npc, const struct roc_npc_attr *attr,
 		goto set_rss_failed;
 	}
 
+	if (flow->has_age_action)
+		npc_age_flow_list_entry_add(roc_npc, flow);
+
 	if (flow->use_pre_alloc == 0)
 		list = &npc->flow_list[flow->priority];
 	else
@@ -1523,8 +1526,6 @@ roc_npc_flow_create(struct roc_npc *roc_npc, const struct roc_npc_attr *attr,
 	}
 	TAILQ_INSERT_TAIL(list, flow, next);
 
-	npc_age_flow_list_entry_add(roc_npc, flow);
-
 	return flow;
 
 set_rss_failed:
@@ -1622,7 +1623,9 @@ roc_npc_flow_destroy(struct roc_npc *roc_npc, struct roc_npc_flow *flow)
 
 	npc_delete_prio_list_entry(npc, flow);
 
-	npc_age_flow_list_entry_delete(roc_npc, flow);
+	if (flow->has_age_action)
+		npc_age_flow_list_entry_delete(roc_npc, flow);
+
 	if (roc_npc->flow_age.age_flow_refcnt == 0 &&
 		plt_thread_is_valid(roc_npc->flow_age.aged_flows_poll_thread))
 		npc_aging_ctrl_thread_destroy(roc_npc);
diff --git a/drivers/common/cnxk/roc_npc.h b/drivers/common/cnxk/roc_npc.h
index cf7e6c9548..4b387f2a6b 100644
--- a/drivers/common/cnxk/roc_npc.h
+++ b/drivers/common/cnxk/roc_npc.h
@@ -320,6 +320,7 @@ struct roc_npc_flow {
 	uint64_t timeout_cycles;
 	void *age_context;
 	uint32_t timeout;
+	bool has_age_action;
 
 	TAILQ_ENTRY(roc_npc_flow) next;
 };
diff --git a/drivers/common/cnxk/roc_npc_aging.c b/drivers/common/cnxk/roc_npc_aging.c
index 74543f227b..a456d2b893 100644
--- a/drivers/common/cnxk/roc_npc_aging.c
+++ b/drivers/common/cnxk/roc_npc_aging.c
@@ -273,6 +273,7 @@ npc_aging_ctrl_thread_create(struct roc_npc *roc_npc,
 	flow->age_context = age->context == NULL ? flow : age->context;
 	flow->timeout = age->timeout;
 	flow->timeout_cycles = plt_tsc_cycles() + age->timeout * plt_tsc_hz();
+	flow->has_age_action = true;
 
 	if (flow_age->age_flow_refcnt == 0) {
 		flow_age->aged_flows_get_thread_exit = false;
-- 
2.25.1


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

* Re: [PATCH v1] common/cnxk: fix flow add in age flow list
  2023-10-17 11:18 [PATCH v1] common/cnxk: fix flow add in age flow list Ankur Dwivedi
@ 2023-10-18  7:18 ` Jerin Jacob
  0 siblings, 0 replies; 2+ messages in thread
From: Jerin Jacob @ 2023-10-18  7:18 UTC (permalink / raw)
  To: Ankur Dwivedi
  Cc: dev, jerinj, ndabilpuram, kirankumark, skori, skoteshwar, stable

On Tue, Oct 17, 2023 at 4:48 PM Ankur Dwivedi <adwivedi@marvell.com> wrote:
>
> While adding flow in npc_flow_list, the flow can be added before the
> current flow iterator. The function returns after adding this flow.
> This prevents flow to be added in age flow list correctly. This patch moves
> the addition of age flow list before npc_flow_list add to prevent the
> error. Also the flow is added or deleted to/from age flow list if the flow
> has age action.
>
> Fixes: 357f5ebc8a24 ("common/cnxk: support flow aging")
> Cc: stable@dpdk.org
>
> Signed-off-by: Ankur Dwivedi <adwivedi@marvell.com>

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


    common/cnxk: fix age flow list update

    While adding flow in npc_flow_list, the flow can be added before the
    current flow iterator. The function returns after adding this flow.
    This prevents flow to be added in age flow list correctly. This patch moves
    the addition of age flow list before npc_flow_list add to prevent the
    error. Also the flow is added or deleted to/from age flow list if the flow
    has age action.

    Fixes: 357f5ebc8a24 ("common/cnxk: support flow aging")
    Cc: stable@dpdk.org

    Signed-off-by: Ankur Dwivedi <adwivedi@marvell.com>

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

end of thread, other threads:[~2023-10-18  7:18 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-10-17 11:18 [PATCH v1] common/cnxk: fix flow add in age flow list Ankur Dwivedi
2023-10-18  7:18 ` 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).