Skip to contentSkip to conversation

net/mlx5: fix atomic API update

PATCH In review Matan Azrad 3 participants 3 messages Nov 3, 2020 – Nov 5, 2020 Network drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 net/mlx5: fix atomic API update

The Txq refcnt 1 value means that there is not real reference to the queue and only the control configuration 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 a02d6dd9e61f ("net/mlx5: use C11 atomics for RxQ/TxQ refcounts")
---
 drivers/net/mlx5/mlx5_txq.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/mlx5/mlx5_txq.c +1 -1
index 6390cd0..cdd1022 100644
@@ -1234,7 +1234,7 @@ struct mlx5_txq_ctrl *
 	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);
Signature · 1 line
1.8.3.1
Acked-by on v1 1/1
#1 lore raw
Quoted 11 lines

-----Original Message-----
From: Matan Azrad <[email protected]>
Sent: Tuesday, November 3, 2020 8:48
To: Slava Ovsiienko <[email protected]>
Cc: [email protected]
Subject: [PATCH] net/mlx5: fix atomic API update

The Txq refcnt 1 value means that there is not real reference to the queue and only the control configuration are saved in the struct.

Quoted 8 lines

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 a02d6dd9e61f ("net/mlx5: use C11 atomics for RxQ/TxQ refcounts")
#2 lore raw
In reply to Matan Azrad

Hi,

Quoted 13 lines

-----Original Message-----
From: dev <[email protected]> On Behalf Of Matan Azrad
Sent: Tuesday, November 3, 2020 8:48 AM
To: Slava Ovsiienko <[email protected]>
Cc: [email protected]
Subject: [dpdk-dev] [PATCH] net/mlx5: fix atomic API update

The Txq refcnt 1 value means that there is not real reference to the queue and only the control configuration are saved in the struct.

The patch below wrongly didn't consider it and caused a leak in the Txq object resource.

Quoted 9 lines

Revert the specific update in the refcnt.

Fixes a02d6dd9e61f ("net/mlx5: use C11 atomics for RxQ/TxQ refcounts")
---
 drivers/net/mlx5/mlx5_txq.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Patch applied to next-net-mlx,

Kindest regards,
Raslan Darawsheh