net/mlx5: fix Rx queue reference count for indirect RSS
authorDmitry Kozlyuk <dkozlyuk@nvidia.com>
Wed, 24 Nov 2021 09:40:30 +0000 (11:40 +0200)
committerRaslan Darawsheh <rasland@nvidia.com>
Wed, 24 Nov 2021 16:25:35 +0000 (17:25 +0100)
commitec9b812b6cdd4bd82325849cc4ff508e2f66ed21
treec9df61cce3abfd5c544485a63552e7b97664ff71
parentc65d6844970a762c907f2de1763e0c71a3c65c66
net/mlx5: fix Rx queue reference count for indirect RSS

mlx5_ind_table_obj_modify() was not changing the reference counters
of neither the new set of RxQs, nor the old set of RxQs.
On the other hand, creation of the RSS incremented the RxQ refcnt.
If an RxQ was present in both the initial and the modified set,
its reference counter was incremented one extra time
compared to the queues that were only present in the new set.
This prevented releasing said RxQ resources on port stop:

    flow indirect_action 0 create action_id 1 \
        action rss queues 0 1 end / end
    flow indirect_action 0 update 1 \
        action rss queues 2 3 end / end
    quit
    ...
    mlx5_net: mlx5.c:1622: mlx5_dev_close():
        port 0 some Rx queue objects still remain
    mlx5_net: mlx5.c:1626: mlx5_dev_close():
        port 0 some Rx queues still remain

Increment reference counters for the new set of RxQs
and decrement them for the old set of RxQs when needed.
Remove explicit referencing of RxQ from mlx5_ind_table_obj_attach()
because it reuses mlx5_ind_table_obj_modify() code doing this.

Fixes: ec4e11d41d12 ("net/mlx5: preserve indirect actions on restart")
Cc: stable@dpdk.org
Signed-off-by: Dmitry Kozlyuk <dkozlyuk@nvidia.com>
Reviewed-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