[PATCH 20.11] net/mlx5: fix flow shared age action reference counting
Xueming(Steven) Li
xuemingl at nvidia.com
Mon Dec 6 06:55:14 CET 2021
Thanks, applied.
On Fri, 2021-12-03 at 22:11 +0200, Dmitry Kozlyuk wrote:
> [ upstream commit b09c65fa4f8bb55880b6b36c849e4ed1bb815227 ]
>
> When an shared AGE action is used in a flow rule with a pattern that
> causes RSS expansion, each device flow generated by the expansion
> incremented the reference counter of the action. When such a flow was
> destroyed, its action reference counter had been decremented only once.
> The action remained marked as being used and could not be destroyed.
> The error was only visible with --log-level=pmd.net.mlx5:debug
> ("...references 1" is not an error):
>
> mlx5_pci: Shared age action 65536 was released with references 4.
>
> Increment action counter only once for the original flow rule.
>
> Fixes: 81073e1f8ce1 ("net/mlx5: support shared age action")
>
> Signed-off-by: Dmitry Kozlyuk <dkozlyuk at nvidia.com>
> ---
> drivers/net/mlx5/mlx5_flow_dv.c | 12 ++++++++----
> 1 file changed, 8 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/net/mlx5/mlx5_flow_dv.c b/drivers/net/mlx5/mlx5_flow_dv.c
> index 1793683421..66732cbdd4 100644
> --- a/drivers/net/mlx5/mlx5_flow_dv.c
> +++ b/drivers/net/mlx5/mlx5_flow_dv.c
> @@ -9812,6 +9812,7 @@ flow_dv_translate(struct rte_eth_dev *dev,
> const struct rte_flow_action_meter *mtr;
> struct mlx5_flow_tbl_resource *tbl;
> struct mlx5_aso_age_action *age_act;
> + uint32_t owner_idx;
> uint32_t port_id = 0;
> struct mlx5_flow_dv_port_id_action_resource port_id_resource;
> int action_type = actions->type;
> @@ -9951,10 +9952,13 @@ flow_dv_translate(struct rte_eth_dev *dev,
> MLX5_FLOW_FATE_QUEUE;
> break;
> case MLX5_RTE_FLOW_ACTION_TYPE_AGE:
> - flow->age = (uint32_t)(uintptr_t)(action->conf);
> - age_act = flow_aso_age_get_by_idx(dev, flow->age);
> - __atomic_fetch_add(&age_act->refcnt, 1,
> - __ATOMIC_RELAXED);
> + owner_idx = (uint32_t)(uintptr_t)action->conf;
> + age_act = flow_aso_age_get_by_idx(dev, owner_idx);
> + if (flow->age == 0) {
> + flow->age = owner_idx;
> + __atomic_fetch_add(&age_act->refcnt, 1,
> + __ATOMIC_RELAXED);
> + }
> dev_flow->dv.actions[actions_n++] = age_act->dr_action;
> action_flags |= MLX5_FLOW_ACTION_AGE;
> break;
More information about the stable
mailing list