net/mlx5: fix reference count on detached indirect action
authorDariusz Sosnowski <dsosnowski@nvidia.com>
Tue, 23 Nov 2021 15:38:05 +0000 (17:38 +0200)
committerRaslan Darawsheh <rasland@nvidia.com>
Tue, 23 Nov 2021 16:57:19 +0000 (17:57 +0100)
commit8fbce96fbed60ac6fada000b30d5671e2136eeb5
tree6258b5d5e932b212a8d355cae86454a6fd5d14e5
parentfa4883456d86fef8364e6dd90c57f134f28d46bf
net/mlx5: fix reference count on detached indirect action

This patch fixes segfault which was triggered when port, with indirect
actions created, was closed. Segfault was occurring only when
RTE_LIBRTE_MLX5_DEBUG was defined. It was caused by redundant decrement
of RX queues refcount:

- refcount was decremented when port was stopped and indirect actions
were detached from RX queues (port stop),
- refcount was decremented when indirect actions objects were destroyed
(port close or destroying of indirect action).

This patch fixes behavior. Dereferencing Rx queues is done if and only
if indirect action is explicitly destroyed by the user or detached on
port stop. Dereferencing Rx queues on action destroy operation depends
on an argument to the wrapper of indirect action destroy operation,
introduced in this patch.

Fixes: ec4e11d41d12 ("net/mlx5: preserve indirect actions on restart")
Cc: stable@dpdk.org
Signed-off-by: Dariusz Sosnowski <dsosnowski@nvidia.com>
Acked-by: Matan Azrad <matan@nvidia.com>
drivers/net/mlx5/mlx5_flow_dv.c
drivers/net/mlx5/mlx5_rx.h
drivers/net/mlx5/mlx5_rxq.c