Skip to contentSkip to conversation

net/mlx5: fix mlx5dr context release ordering

PATCH In review Maayan Kashani 2 participants 2 messages Mar 6, 2024 – Mar 13, 2024 Network drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 net/mlx5: fix mlx5dr context release ordering

Creating rules on group >0, creates a jump action on the group table. Non template code releases the group data under shared mlx5dr free code, And the mlx5dr context was already closed in HWS code.

Remove mlx5dr context release from hws resource release function.

Fixes b401400db24e ("net/mlx5: add port flow configuration")
---
 drivers/net/mlx5/mlx5.c         | 7 +++++++
 drivers/net/mlx5/mlx5_flow_hw.c | 2 --
 2 files changed, 7 insertions(+), 2 deletions(-)
drivers/net/mlx5/mlx5.c +7 -0
index 39dc1830d1..8b54843a43 100644
@@ -2355,6 +2355,7 @@ mlx5_dev_close(struct rte_eth_dev *dev)
 	mlx5_indirect_list_handles_release(dev);
 #ifdef HAVE_MLX5_HWS_SUPPORT
 	flow_hw_destroy_vport_action(dev);
+	/* dr context will be closed after mlx5_os_free_shared_dr. */
 	flow_hw_resource_release(dev);
 	flow_hw_clear_port_info(dev);
 	if (priv->tlv_options != NULL) {
@@ -2391,6 +2392,12 @@ mlx5_dev_close(struct rte_eth_dev *dev)
 		mlx5_hlist_destroy(priv->mreg_cp_tbl);
 	mlx5_mprq_free_mp(dev);
 	mlx5_os_free_shared_dr(priv);
+#ifdef HAVE_MLX5_HWS_SUPPORT
+	if (priv->dr_ctx) {
+		claim_zero(mlx5dr_context_close(priv->dr_ctx));
+		priv->dr_ctx = NULL;
+	}
+#endif
 	if (priv->rss_conf.rss_key != NULL)
 		mlx5_free(priv->rss_conf.rss_key);
 	if (priv->reta_idx != NULL)
drivers/net/mlx5/mlx5_flow_hw.c +0 -2
index 4216433c6e..f52093a59a 100644
@@ -10707,13 +10707,11 @@ flow_hw_resource_release(struct rte_eth_dev *dev)
 	}
 	mlx5_free(priv->hw_q);
 	priv->hw_q = NULL;
-	claim_zero(mlx5dr_context_close(priv->dr_ctx));
 	if (priv->shared_host) {
 		struct mlx5_priv *host_priv = priv->shared_host->data->dev_private;
 		__atomic_fetch_sub(&host_priv->shared_refcnt, 1, __ATOMIC_RELAXED);
 		priv->shared_host = NULL;
 	}
-	priv->dr_ctx = NULL;
 	mlx5_free(priv->hw_attr);
 	priv->hw_attr = NULL;
 	priv->nb_queue = 0;
Signature · 1 line
2.25.1
#1 lore raw

Hi,

Quoted 15 lines

-----Original Message-----
From: Maayan Kashani <[email protected]>
Sent: Wednesday, March 6, 2024 8:02 AM
To: [email protected]
Cc: Maayan Kashani <[email protected]>; Raslan Darawsheh <[email protected]>; [email protected]; Dariusz Sosnowski <[email protected]>; Slava Ovsiienko <[email protected]>; Ori Kam <[email protected]>; Suanming Mou <[email protected]>; Matan Azrad <[email protected]>
Subject: [PATCH] net/mlx5: fix mlx5dr context release ordering

Creating rules on group >0, creates a jump action on the group table. Non template code releases the group data under shared mlx5dr free code, And the mlx5dr context was already closed in HWS code.

Quoted 6 lines

Remove mlx5dr context release from hws resource release function.

Fixes b401400db24e ("net/mlx5: add port flow configuration")

Patch applied to next-net-mlx,

Kindest regards
Raslan Darawsheh