From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 81D8548B59 for ; Thu, 20 Nov 2025 13:45:53 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 7D84040262; Thu, 20 Nov 2025 13:45:53 +0100 (CET) Received: from mail-wm1-f42.google.com (mail-wm1-f42.google.com [209.85.128.42]) by mails.dpdk.org (Postfix) with ESMTP id 4D02540262 for ; Thu, 20 Nov 2025 13:45:51 +0100 (CET) Received: by mail-wm1-f42.google.com with SMTP id 5b1f17b1804b1-47778b23f64so4947085e9.0 for ; Thu, 20 Nov 2025 04:45:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1763642751; x=1764247551; darn=dpdk.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=2pOhQUURWkY9A5ijU9mGWmew2bKto3vV3ax709Q+vi4=; b=YGYjNO0xXAlD3K4NMV3RGyBOc7vZwL7gS1fzbqLGJtOXw+bvaUDjvVuTV0mhzlEfjw Oq4mZxhmXkoc5sT1K35Z8W9q3ccG0P1Jh3aIAiczCqO/YzA+sfLzBP9scALi+8tOv0WA H9BemUce69e8L3nlAe7hmve1eEHIZx4h4FlIPFzgRMHqVdQ4UXoxyMBYWpM9dtZNaFz3 9cWQwjZoZHxG1D5k8M6T1MIyRbb0R7+sGoXUrWZPpZZA2GhtT006tA47UD8qghoGI2qH XRtmuLSlpw5WIEUdPfemTDNw9P/9dzWiRuBK2NAybvGp6gyWY/Uj2sEiFibuLJ4cjmd8 wQmQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1763642751; x=1764247551; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=2pOhQUURWkY9A5ijU9mGWmew2bKto3vV3ax709Q+vi4=; b=ne68z2C4FT0CXk9BVopwcNDFMXwT70s3ei5Qy0kIo4BI4hCDWkbM8mNjCpYfk4Aoyw 74xRMcVufgM16Cld9LOLoot+J5hJCRgdTxoN+B3n7IY+L3jHq4JakYMrk5HNRkBGoWUQ /DB2ME3V5Ccs7OUL8uHEHd8fP/hg9VNduhoT+zKcL0/XxwjYGjgAfx1vryL/IawCwxiq MtNPT8ydpbLcGuxnd3KgJNJF8ir9lAQPmwD6u9qZKykfc8oCiV5HUAEU9r0xMwvAHXYs 6yxbv5sryJkSZH0DuvUQHwxRE5i7Jk9gawS9FpzuOoUPum6VFY5+VT+x9wYO/vyDx6gj gGSg== X-Forwarded-Encrypted: i=1; AJvYcCXb88eAJ2iBJaHsirUYoyyPYYMyy3QUwx5/sp6m8fxIs0MKr2civtD4gfwnuZ86YRvJd48hw5k=@dpdk.org X-Gm-Message-State: AOJu0YzLq5ZiXKo3bKpcm6hQFgJurRYVAAYYelmOXAMbPbnYitS2hhVW E0MM68aAJmMRe5upVaQVPZra3e78q5DFLlLkA/3bo5IMdqNC6Pjs5TnU X-Gm-Gg: ASbGncuqcxgwMsHW+1COUu1iAQZPJDSzsAs2mlEtoPXjfdkE7dBIF+35Squl+y37RCr CqjnHFZ0LGOZXQOzfkU6LYRw1JACPwcN5NBiKYmpDhH/kzq2h3hwQEbCxDC4dfaZDiX229TsRdd OctRHNUU50SSBldIeLTNTFWdbfkzktjHo2NcyLFcewIbC3qIgofi2pB4Kd25PYj8A9Abxq0gPqU 9njtVR1oED+k3p10WJMjsApi+hLOnldQATrGzvlw4zfiWmGBTt8pvJ7/OA5HHkqain+pRa6Jo2f jL6tbwZBYU+BB8P+l9xwkVyYObRUJVVOH4BhRJj7tCqhPAOIX3wiNPT+2VgsTSYRXQ0/7iWNNVA R27pZRB1VoZ80f7FHMvBhxiRJfOZb53jJYohRNeII0La1k7J6ZDiTSEjn74jVoyHSubYXxoqThA +m+78m2W6Wwni8N6T1E/aklrgczqA= X-Google-Smtp-Source: AGHT+IHGz8PQqcPj++PtFS1NIoZpkffxtEFouYWUwE/5YvEaAmm0gVLYEwZxlkdjXc1ay8SnDfmgag== X-Received: by 2002:a5d:5d0a:0:b0:42b:41dc:1b58 with SMTP id ffacd0b85a97d-42cb9a63fa1mr2666771f8f.45.1763642750747; Thu, 20 Nov 2025 04:45:50 -0800 (PST) Received: from localhost ([2a01:4b00:d036:ae00:f372:8d1a:399f:e8a2]) by smtp.gmail.com with UTF8SMTPSA id ffacd0b85a97d-42cb7f2e432sm5201447f8f.9.2025.11.20.04.45.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 20 Nov 2025 04:45:50 -0800 (PST) From: luca.boccassi@gmail.com To: Gregory Etelson Cc: Dariusz Sosnowski , dpdk stable Subject: patch 'net/mlx5: fix send to kernel action resources release' has been queued to stable release 22.11.11 Date: Thu, 20 Nov 2025 12:44:44 +0000 Message-ID: <20251120124514.757933-12-luca.boccassi@gmail.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20251120124514.757933-1-luca.boccassi@gmail.com> References: <20251112165308.1618107-49-luca.boccassi@gmail.com> <20251120124514.757933-1-luca.boccassi@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org Hi, FYI, your patch has been queued to stable release 22.11.11 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 11/22/25. So please shout if anyone has objections. Also note that after the patch there's a diff of the upstream commit vs the patch applied to the branch. This will indicate if there was any rebasing needed to apply to the stable branch. If there were code changes for rebasing (ie: not only metadata diffs), please double check that the rebase was correctly done. Queued patches are on a temporary branch at: https://github.com/bluca/dpdk-stable This queued commit can be viewed at: https://github.com/bluca/dpdk-stable/commit/f3ede4f9c5bb71153557a7b0fc3687f0843e3ed6 Thanks. Luca Boccassi --- >From f3ede4f9c5bb71153557a7b0fc3687f0843e3ed6 Mon Sep 17 00:00:00 2001 From: Gregory Etelson Date: Wed, 12 Nov 2025 18:24:40 +0200 Subject: [PATCH] net/mlx5: fix send to kernel action resources release [ upstream commit 472b0994319198090e44a7c2de1e43f0a0e0a270 ] In the MLX5 PMD hierarchy a flow table is bound to a domain object. A domain object can be released if it does not reference any flow tables. When the PMD creates a send to kernel flow action, it also creates a dedicated flow table for that action. The PMD called for Rx, Tx and FDB domain destruction before it destroyed send to kernel resources - flow action and flow table. As a result, domain destruction could not be completed. The patch moves send to kernel actions and tables destruction before domain destruction. Fixes: f31a141e6478 ("net/mlx5: add send to kernel action resource holder") Signed-off-by: Gregory Etelson Acked-by: Dariusz Sosnowski --- drivers/net/mlx5/linux/mlx5_os.c | 82 ++++++++++++++++++-------------- 1 file changed, 45 insertions(+), 37 deletions(-) diff --git a/drivers/net/mlx5/linux/mlx5_os.c b/drivers/net/mlx5/linux/mlx5_os.c index 028b9adece..49f2653169 100644 --- a/drivers/net/mlx5/linux/mlx5_os.c +++ b/drivers/net/mlx5/linux/mlx5_os.c @@ -705,44 +705,10 @@ error: return err; } -/** - * Destroy DR related data within private structure. - * - * @param[in] priv - * Pointer to the private device data structure. - */ -void -mlx5_os_free_shared_dr(struct mlx5_priv *priv) -{ - struct mlx5_dev_ctx_shared *sh = priv->sh; - - MLX5_ASSERT(sh && sh->refcnt); - if (sh->refcnt > 1) - return; - MLX5_ASSERT(LIST_EMPTY(&sh->shared_rxqs)); #ifdef HAVE_MLX5DV_DR - if (sh->rx_domain) { - mlx5_glue->dr_destroy_domain(sh->rx_domain); - sh->rx_domain = NULL; - } - if (sh->tx_domain) { - mlx5_glue->dr_destroy_domain(sh->tx_domain); - sh->tx_domain = NULL; - } -#ifdef HAVE_MLX5DV_DR_ESWITCH - if (sh->fdb_domain) { - mlx5_glue->dr_destroy_domain(sh->fdb_domain); - sh->fdb_domain = NULL; - } - if (sh->dr_drop_action) { - mlx5_glue->destroy_flow_action(sh->dr_drop_action); - sh->dr_drop_action = NULL; - } -#endif - if (sh->pop_vlan_action) { - mlx5_glue->destroy_flow_action(sh->pop_vlan_action); - sh->pop_vlan_action = NULL; - } +static void +mlx5_destroy_send_to_kernel_action(struct mlx5_dev_ctx_shared *sh) +{ if (sh->send_to_kernel_action.action) { void *action = sh->send_to_kernel_action.action; @@ -756,6 +722,48 @@ mlx5_os_free_shared_dr(struct mlx5_priv *priv) flow_dv_tbl_resource_release(sh, tbl); sh->send_to_kernel_action.tbl = NULL; } +} +#endif /* HAVE_MLX5DV_DR */ + +/** + * Destroy DR related data within private structure. + * + * @param[in] priv + * Pointer to the private device data structure. + */ +void +mlx5_os_free_shared_dr(struct mlx5_priv *priv) +{ + struct mlx5_dev_ctx_shared *sh = priv->sh; + + MLX5_ASSERT(sh && sh->refcnt); + if (sh->refcnt > 1) + return; + MLX5_ASSERT(LIST_EMPTY(&sh->shared_rxqs)); +#ifdef HAVE_MLX5DV_DR + mlx5_destroy_send_to_kernel_action(sh); + if (sh->rx_domain) { + mlx5_glue->dr_destroy_domain(sh->rx_domain); + sh->rx_domain = NULL; + } + if (sh->tx_domain) { + mlx5_glue->dr_destroy_domain(sh->tx_domain); + sh->tx_domain = NULL; + } +#ifdef HAVE_MLX5DV_DR_ESWITCH + if (sh->fdb_domain) { + mlx5_glue->dr_destroy_domain(sh->fdb_domain); + sh->fdb_domain = NULL; + } + if (sh->dr_drop_action) { + mlx5_glue->destroy_flow_action(sh->dr_drop_action); + sh->dr_drop_action = NULL; + } +#endif + if (sh->pop_vlan_action) { + mlx5_glue->destroy_flow_action(sh->pop_vlan_action); + sh->pop_vlan_action = NULL; + } #endif /* HAVE_MLX5DV_DR */ if (sh->default_miss_action) mlx5_glue->destroy_flow_action -- 2.47.3 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2025-11-20 12:44:13.222369943 +0000 +++ 0012-net-mlx5-fix-send-to-kernel-action-resources-release.patch 2025-11-20 12:44:12.786088177 +0000 @@ -1 +1 @@ -From 472b0994319198090e44a7c2de1e43f0a0e0a270 Mon Sep 17 00:00:00 2001 +From f3ede4f9c5bb71153557a7b0fc3687f0843e3ed6 Mon Sep 17 00:00:00 2001 @@ -5,0 +6,2 @@ +[ upstream commit 472b0994319198090e44a7c2de1e43f0a0e0a270 ] + @@ -21 +22,0 @@ -Cc: stable@dpdk.org @@ -26,2 +27,2 @@ - drivers/net/mlx5/linux/mlx5_os.c | 40 ++++++++++++++++++++------------ - 1 file changed, 25 insertions(+), 15 deletions(-) + drivers/net/mlx5/linux/mlx5_os.c | 82 ++++++++++++++++++-------------- + 1 file changed, 45 insertions(+), 37 deletions(-) @@ -30 +31 @@ -index dba3b61b68..8026a68702 100644 +index 028b9adece..49f2653169 100644 @@ -33 +34 @@ -@@ -737,6 +737,30 @@ error: +@@ -705,44 +705,10 @@ error: @@ -37 +38,38 @@ -+#ifdef HAVE_MLX5DV_DR +-/** +- * Destroy DR related data within private structure. +- * +- * @param[in] priv +- * Pointer to the private device data structure. +- */ +-void +-mlx5_os_free_shared_dr(struct mlx5_priv *priv) +-{ +- struct mlx5_dev_ctx_shared *sh = priv->sh; +- +- MLX5_ASSERT(sh && sh->refcnt); +- if (sh->refcnt > 1) +- return; +- MLX5_ASSERT(LIST_EMPTY(&sh->shared_rxqs)); + #ifdef HAVE_MLX5DV_DR +- if (sh->rx_domain) { +- mlx5_glue->dr_destroy_domain(sh->rx_domain); +- sh->rx_domain = NULL; +- } +- if (sh->tx_domain) { +- mlx5_glue->dr_destroy_domain(sh->tx_domain); +- sh->tx_domain = NULL; +- } +-#ifdef HAVE_MLX5DV_DR_ESWITCH +- if (sh->fdb_domain) { +- mlx5_glue->dr_destroy_domain(sh->fdb_domain); +- sh->fdb_domain = NULL; +- } +- if (sh->dr_drop_action) { +- mlx5_glue->destroy_flow_action(sh->dr_drop_action); +- sh->dr_drop_action = NULL; +- } +-#endif +- if (sh->pop_vlan_action) { +- mlx5_glue->destroy_flow_action(sh->pop_vlan_action); +- sh->pop_vlan_action = NULL; +- } @@ -41,17 +79,7 @@ -+ int i; -+ -+ for (i = 0; i < MLX5DR_TABLE_TYPE_MAX; i++) { -+ if (sh->send_to_kernel_action[i].action) { -+ void *action = sh->send_to_kernel_action[i].action; -+ -+ mlx5_glue->destroy_flow_action(action); -+ sh->send_to_kernel_action[i].action = NULL; -+ } -+ if (sh->send_to_kernel_action[i].tbl) { -+ struct mlx5_flow_tbl_resource *tbl = -+ sh->send_to_kernel_action[i].tbl; -+ -+ flow_dv_tbl_resource_release(sh, tbl); -+ sh->send_to_kernel_action[i].tbl = NULL; -+ } -+ } + if (sh->send_to_kernel_action.action) { + void *action = sh->send_to_kernel_action.action; + +@@ -756,6 +722,48 @@ mlx5_os_free_shared_dr(struct mlx5_priv *priv) + flow_dv_tbl_resource_release(sh, tbl); + sh->send_to_kernel_action.tbl = NULL; + } @@ -61,7 +89,16 @@ - /** - * Destroy DR related data within private structure. - * -@@ -763,6 +787,7 @@ mlx5_os_free_shared_dr(struct mlx5_priv *priv) - priv->dev_data->port_id, i); - MLX5_ASSERT(LIST_EMPTY(&sh->shared_rxqs)); - #ifdef HAVE_MLX5DV_DR ++/** ++ * Destroy DR related data within private structure. ++ * ++ * @param[in] priv ++ * Pointer to the private device data structure. ++ */ ++void ++mlx5_os_free_shared_dr(struct mlx5_priv *priv) ++{ ++ struct mlx5_dev_ctx_shared *sh = priv->sh; ++ ++ MLX5_ASSERT(sh && sh->refcnt); ++ if (sh->refcnt > 1) ++ return; ++ MLX5_ASSERT(LIST_EMPTY(&sh->shared_rxqs)); ++#ifdef HAVE_MLX5DV_DR @@ -69,22 +106,22 @@ - if (sh->rx_domain) { - mlx5_glue->dr_destroy_domain(sh->rx_domain); - sh->rx_domain = NULL; -@@ -785,21 +810,6 @@ mlx5_os_free_shared_dr(struct mlx5_priv *priv) - mlx5_glue->destroy_flow_action(sh->pop_vlan_action); - sh->pop_vlan_action = NULL; - } -- for (i = 0; i < MLX5DR_TABLE_TYPE_MAX; i++) { -- if (sh->send_to_kernel_action[i].action) { -- void *action = sh->send_to_kernel_action[i].action; -- -- mlx5_glue->destroy_flow_action(action); -- sh->send_to_kernel_action[i].action = NULL; -- } -- if (sh->send_to_kernel_action[i].tbl) { -- struct mlx5_flow_tbl_resource *tbl = -- sh->send_to_kernel_action[i].tbl; -- -- flow_dv_tbl_resource_release(sh, tbl); -- sh->send_to_kernel_action[i].tbl = NULL; -- } -- } ++ if (sh->rx_domain) { ++ mlx5_glue->dr_destroy_domain(sh->rx_domain); ++ sh->rx_domain = NULL; ++ } ++ if (sh->tx_domain) { ++ mlx5_glue->dr_destroy_domain(sh->tx_domain); ++ sh->tx_domain = NULL; ++ } ++#ifdef HAVE_MLX5DV_DR_ESWITCH ++ if (sh->fdb_domain) { ++ mlx5_glue->dr_destroy_domain(sh->fdb_domain); ++ sh->fdb_domain = NULL; ++ } ++ if (sh->dr_drop_action) { ++ mlx5_glue->destroy_flow_action(sh->dr_drop_action); ++ sh->dr_drop_action = NULL; ++ } ++#endif ++ if (sh->pop_vlan_action) { ++ mlx5_glue->destroy_flow_action(sh->pop_vlan_action); ++ sh->pop_vlan_action = NULL; ++ }