From 95940894f36a87dde7e9ffea5ee37a1324191d05 Mon Sep 17 00:00:00 2001 From: Matan Azrad Date: Tue, 3 Nov 2020 06:47:44 +0000 Subject: [PATCH] net/mlx5: fix Tx queue reference count check The Txq refcnt 1 value means that there is no real reference to the queue and only the control configurations are saved in the struct. The patch below wrongly didn't consider it and caused a leak in the Txq object resource. Revert the specific update in the refcnt. Fixes: b5c8b3e70cdf ("net/mlx5: use C11 atomics for RxQ/TxQ refcounts") Signed-off-by: Matan Azrad Acked-by: Viacheslav Ovsiienko --- drivers/net/mlx5/mlx5_txq.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/mlx5/mlx5_txq.c b/drivers/net/mlx5/mlx5_txq.c index 0f30a5d529..fcbc84b299 100644 --- a/drivers/net/mlx5/mlx5_txq.c +++ b/drivers/net/mlx5/mlx5_txq.c @@ -1235,7 +1235,7 @@ mlx5_txq_release(struct rte_eth_dev *dev, uint16_t idx) if (!(*priv->txqs)[idx]) return 0; txq_ctrl = container_of((*priv->txqs)[idx], struct mlx5_txq_ctrl, txq); - if (__atomic_sub_fetch(&txq_ctrl->refcnt, 1, __ATOMIC_RELAXED) != 0) + if (__atomic_sub_fetch(&txq_ctrl->refcnt, 1, __ATOMIC_RELAXED) > 1) return 1; if (txq_ctrl->obj) { priv->obj_ops.txq_obj_release(txq_ctrl->obj); -- 2.20.1