* [PATCH 20.11] net/mlx5: fix flow shared age action reference counting
@ 2021-12-03 20:11 Dmitry Kozlyuk
2021-12-06 5:55 ` Xueming(Steven) Li
0 siblings, 1 reply; 2+ messages in thread
From: Dmitry Kozlyuk @ 2021-12-03 20:11 UTC (permalink / raw)
To: stable; +Cc: Xueming Li, Matan Azrad, Viacheslav Ovsiienko
[ 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@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;
--
2.25.1
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH 20.11] net/mlx5: fix flow shared age action reference counting
2021-12-03 20:11 [PATCH 20.11] net/mlx5: fix flow shared age action reference counting Dmitry Kozlyuk
@ 2021-12-06 5:55 ` Xueming(Steven) Li
0 siblings, 0 replies; 2+ messages in thread
From: Xueming(Steven) Li @ 2021-12-06 5:55 UTC (permalink / raw)
To: Dmitry Kozlyuk, stable; +Cc: Matan Azrad, Slava Ovsiienko
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@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;
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2021-12-06 5:55 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-03 20:11 [PATCH 20.11] net/mlx5: fix flow shared age action reference counting Dmitry Kozlyuk
2021-12-06 5:55 ` Xueming(Steven) Li
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).