DPDK patches and discussions
 help / color / mirror / Atom feed
* [PATCH] net/mlx5: fix refcount on detached indirect action
@ 2021-11-17 15:46 Dariusz Sosnowski
  2021-11-22 14:17 ` [PATCH v2] " Dariusz Sosnowski
  0 siblings, 1 reply; 6+ messages in thread
From: Dariusz Sosnowski @ 2021-11-17 15:46 UTC (permalink / raw)
  To: Matan Azrad, Viacheslav Ovsiienko, Dmitry Kozlyuk; +Cc: dev

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).

With this patch RX queues refcounts are decremented if and only if
indirect actions object is detached or indirect actions object is
destroyed.

Fixes: ec4e11d41d12 ("net/mlx5: preserve indirect actions on restart")
Cc: dkozlyuk@nvidia.com

Signed-off-by: Dariusz Sosnowski <dsosnowski@nvidia.com>
Acked-by: Dmitry Kozlyuk <dkozlyuk@nvidia.com>
---
 drivers/net/mlx5/mlx5_rxq.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/drivers/net/mlx5/mlx5_rxq.c b/drivers/net/mlx5/mlx5_rxq.c
index 52b95d7070..b7af60df38 100644
--- a/drivers/net/mlx5/mlx5_rxq.c
+++ b/drivers/net/mlx5/mlx5_rxq.c
@@ -2214,8 +2214,15 @@ mlx5_ind_table_obj_release(struct rte_eth_dev *dev,
 	if (ret)
 		return 1;
 	priv->obj_ops.ind_table_destroy(ind_tbl);
-	for (i = 0; i != ind_tbl->queues_n; ++i)
-		claim_nonzero(mlx5_rxq_deref(dev, ind_tbl->queues[i]));
+	/*
+	 * Refcounts on RX queues are decremented if and only if indirection
+	 * table was attached to RX queues. It will not be the case after
+	 * calling mlx5_dev_stop.
+	 */
+	if (priv->dev_data->dev_started) {
+		for (i = 0; i != ind_tbl->queues_n; ++i)
+			claim_nonzero(mlx5_rxq_deref(dev, ind_tbl->queues[i]));
+	}
 	mlx5_free(ind_tbl);
 	return 0;
 }
-- 
2.25.1


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2021-11-23 20:35 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-17 15:46 [PATCH] net/mlx5: fix refcount on detached indirect action Dariusz Sosnowski
2021-11-22 14:17 ` [PATCH v2] " Dariusz Sosnowski
2021-11-22 17:09   ` [PATCH v3] " Dariusz Sosnowski
2021-11-23 13:26     ` Slava Ovsiienko
2021-11-23 15:38     ` [PATCH v4] " Dariusz Sosnowski
2021-11-23 20:35       ` Raslan Darawsheh

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).