[dpdk-stable] [PATC 19.11] net/mlx5: fix flow split combined with counter
Christian Ehrhardt
christian.ehrhardt at canonical.com
Mon Jul 5 13:17:44 CEST 2021
On Mon, Jul 5, 2021 at 10:59 AM Viacheslav Ovsiienko
<viacheslavo at nvidia.com> wrote:
>
> From: Dekel Peled <dekelp at nvidia.com>
>
> [ upstream commit 63f4d5693ed8459f8867a23d0b87cf9c60983767 ]
Thanks, applied
> 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 at dpdk.org
>
> Signed-off-by: Dekel Peled <dekelp at nvidia.com>
> Acked-by: Matan Azrad <matan at 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
>
--
Christian Ehrhardt
Staff Engineer, Ubuntu Server
Canonical Ltd
More information about the stable
mailing list