net/mlx5: fix queue leaking in hairpin auto bind check
authorBing Zhao <bingz@nvidia.com>
Sat, 24 Jul 2021 13:27:11 +0000 (16:27 +0300)
committerRaslan Darawsheh <rasland@nvidia.com>
Thu, 29 Jul 2021 16:01:19 +0000 (18:01 +0200)
commit75f166c20ffca1dd28184f8196fbfe90ebafb6ac
treea6a97f708fbbb39d4493cbe66260d4e6e932d0fa
parent494d6863c2464838e8ee65b9a7d3d108145ae08d
net/mlx5: fix queue leaking in hairpin auto bind check

During the start up stage, the hairpin auto bind was executed for
each port. All the Tx and Rx queues configured for this port should
be checked to confirm if the auto bind of hairpin is needed.
1. The queue is hairpin queue.
2. The peer port is the same one and the peer queue should also be
   with hairpin type.
3. The manual bind attribute is not set for this queue.

If the queue is not a hairpin queue or it doesn't need to be bound
automatically, the reference count should be decreased by 1 since
the count was increased when calling the mlx5_*xq_get().
When the peer port is not the same, it means that no auto bind is
supported and the mlx5_*xq_release() was missed in the current
implementation.

By calling the release function before continue, the count is
correct when calling the device close.

Fixes: aa8bea0e3455 ("net/mlx5: add conditional hairpin auto bind")
Cc: stable@dpdk.org
Signed-off-by: Bing Zhao <bingz@nvidia.com>
Acked-by: Viacheslav Ovsiienko <viacheslavo@nvidia.com>
drivers/net/mlx5/mlx5_trigger.c