patches for DPDK stable branches
 help / color / mirror / Atom feed
* [dpdk-stable] [PATC 19.11] net/mlx5: fix flow split combined with counter
@ 2021-07-05  8:58 Viacheslav Ovsiienko
  2021-07-05 11:17 ` Christian Ehrhardt
  0 siblings, 1 reply; 2+ messages in thread
From: Viacheslav Ovsiienko @ 2021-07-05  8:58 UTC (permalink / raw)
  To: stable
  Cc: christian.ehrhardt, xuemingl, rasland, matan, alialnu, michaelba,
	Dekel Peled

From: Dekel Peled <dekelp@nvidia.com>

[ upstream commit 63f4d5693ed8459f8867a23d0b87cf9c60983767 ]

Currently, for a flow containing a count action, if flow is split to
sub-flows, a new counter will be created for each sub-flow.
However only the counter created for the last sub-flow will be queried
on flow query and cleared on flow removal.

This behavior is wrong, causing a leak of resources.
Need to create just one counter per flow, and use it for all sub-flows.

This patch adds the required check to make sure a counter is
created just once per flow, and used by all sub-flows.

Fixes: fa2d01c87d2b ("net/mlx5: support flow aging")
Cc: stable@dpdk.org

Signed-off-by: Dekel Peled <dekelp@nvidia.com>
Acked-by: Matan Azrad <matan@nvidia.com>
---
 drivers/net/mlx5/mlx5_flow_dv.c | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/drivers/net/mlx5/mlx5_flow_dv.c b/drivers/net/mlx5/mlx5_flow_dv.c
index cea45a6d96..42ae1bbe2c 100644
--- a/drivers/net/mlx5/mlx5_flow_dv.c
+++ b/drivers/net/mlx5/mlx5_flow_dv.c
@@ -7377,12 +7377,13 @@ __flow_dv_translate(struct rte_eth_dev *dev,
 				rte_errno = ENOTSUP;
 				goto cnt_err;
 			}
-			flow->counter = flow_dv_counter_alloc(dev,
-							      count->shared,
-							      count->id,
-							      dev_flow->group);
-			if (flow->counter == NULL)
-				goto cnt_err;
+			if (!flow->counter) {
+				flow->counter =	flow_dv_counter_alloc
+						(dev, count->shared,
+						 count->id, dev_flow->group);
+				if (flow->counter == NULL)
+					goto cnt_err;
+			}
 			dev_flow->dv.actions[actions_n++] =
 				flow->counter->action;
 			action_flags |= MLX5_FLOW_ACTION_COUNT;
-- 
2.18.1


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

end of thread, other threads:[~2021-07-05 11:18 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-05  8:58 [dpdk-stable] [PATC 19.11] net/mlx5: fix flow split combined with counter Viacheslav Ovsiienko
2021-07-05 11:17 ` Christian Ehrhardt

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