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 7493045E41 for ; Sat, 7 Dec 2024 09:08:21 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 6D94840281; Sat, 7 Dec 2024 09:08:21 +0100 (CET) Received: from NAM04-MW2-obe.outbound.protection.outlook.com (mail-mw2nam04on2077.outbound.protection.outlook.com [40.107.101.77]) by mails.dpdk.org (Postfix) with ESMTP id 0F6CB40281 for ; Sat, 7 Dec 2024 09:08:20 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=OYxHTeqbmE1Mt2Dw8aBiz4u47TX1SXtwoI+Z+ZE1CLKW2R7sh7TFGz2qxgRjLFwn6E216rIBwIjHALSvwccRBx/1wkHn60KxGvI2g9hezrvh0wtL+uhyTSB8jh3EBiPuvfLl7CexVtoU4MFa4dkxx8cGVVXAPoMNDAHepjtfY4WLovEHsJB2O59eOQVVTjVG5qS63IgPmwU+PB7pDIYLo/kpxxrrr+qRbpc8RIIeZ4jKd0V/zDB3hdwK9VZ9hULis9d8k6gFoANtrGemsrULOEjvjPkHg0BH2BfUGEpUHuozTXmTBIMNISqYLkrtN9TXAfjdpeYGLtOxSx1c5X8acQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=4yN2vN8Php03NHJ5i+enT3N26Iee/0Qwwb0q8lNMiMo=; b=y361rBRBsY5p9CoX3hxErAZv4iUsdr6bKFH7zovz+bwdqqhJE+6XB/4+T7nEGUGVtEqXT1grgCBqJuP1Ha4PEO01hfoO0IAma1GX++/iP/TCuqxhKSlu2S2DtbKo3Wc33943TiXnCBk1mqdR+My7PW4Z8xeYhJBnCq+JMpfceG9IR0MQvicZu9+6SLJyQ9bZCkUxGpfMS4BcA5wXGP+20ZMoQR7A8DnzVnmT7FDCeCPUA3c6QeazeYKdaCVncli8tYQBe8oKwxU4UF+BpIerl8iIHaRDazWP4P7rWrcAkVmFndxGjViUm7o2pufMreVUwVp1jypcpeTOI6QCWrXtaw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.161) smtp.rcpttodomain=dpdk.org smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=4yN2vN8Php03NHJ5i+enT3N26Iee/0Qwwb0q8lNMiMo=; b=KFpj/r7ElPhxAApR0KzQtgjpptcKeHqIK9tviv+vK4xmhem2Un5QNTbXNB9nZ2urH920HMVtSGOKGSFFRZsWowKD0SZWjXn6OcNAMIfh+3koysG60f5gnoZb8FcGZPBGm5OQNUW3Vs1qaWSl8CJm/PWqqpGXVJf8bzFTXbAbFqCr9m6Dl0NBcU4bUwx5P9ooEDOE920qiI9HHXwc7Sd39IOaQ6qFOmGJx1bCkF7fNchwAXhWYau1EE35K/wo+c3h/eLxXJGdCSNoynnnv6Qkl8M8tvKi56DKRn4SkUiPMPp+NtJc1hYkZOHNjfGDf0NJet8v8ZvMise2IFppZEOIuA== Received: from BN0PR04CA0066.namprd04.prod.outlook.com (2603:10b6:408:ea::11) by PH8PR12MB6866.namprd12.prod.outlook.com (2603:10b6:510:1c9::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8207.18; Sat, 7 Dec 2024 08:08:12 +0000 Received: from BL02EPF00021F6D.namprd02.prod.outlook.com (2603:10b6:408:ea:cafe::4c) by BN0PR04CA0066.outlook.office365.com (2603:10b6:408:ea::11) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8207.23 via Frontend Transport; Sat, 7 Dec 2024 08:08:12 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.117.161) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.117.161 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.117.161; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.117.161) by BL02EPF00021F6D.mail.protection.outlook.com (10.167.249.9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8230.7 via Frontend Transport; Sat, 7 Dec 2024 08:08:12 +0000 Received: from rnnvmail201.nvidia.com (10.129.68.8) by mail.nvidia.com (10.129.200.67) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Sat, 7 Dec 2024 00:07:59 -0800 Received: from nvidia.com (10.126.231.35) by rnnvmail201.nvidia.com (10.129.68.8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Sat, 7 Dec 2024 00:07:58 -0800 From: Xueming Li To: Bing Zhao CC: Xueming Li , Dariusz Sosnowski , dpdk stable Subject: patch 'net/mlx5: fix Rx queue reference count in flushing flows' has been queued to stable release 23.11.3 Date: Sat, 7 Dec 2024 16:00:32 +0800 Message-ID: <20241207080055.488538-75-xuemingl@nvidia.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241207080055.488538-1-xuemingl@nvidia.com> References: <20241111062847.216344-122-xuemingl@nvidia.com> <20241207080055.488538-1-xuemingl@nvidia.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [10.126.231.35] X-ClientProxiedBy: rnnvmail201.nvidia.com (10.129.68.8) To rnnvmail201.nvidia.com (10.129.68.8) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BL02EPF00021F6D:EE_|PH8PR12MB6866:EE_ X-MS-Office365-Filtering-Correlation-Id: eef84b34-0eed-4027-b9d0-08dd16964b8b X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|376014|36860700013|1800799024|82310400026; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?2KPkJd6Iq27Xwq0BHOb6QZmWGwa+ljxQiDUGbFgrsS/47IHRYs01MHtFchfe?= =?us-ascii?Q?AK/5QoRyyKsXjI2o6NUh4smiMmSV3xkSPc+Dk+xWwo/9FUrdKTjNeI2DU+Cr?= =?us-ascii?Q?EjT53dNBrHQx4X665jtXvNLasRnHWbcWS6TlQy24ExagWxJ21qI4/qEUosM/?= =?us-ascii?Q?9GFDD4B3zpWESFvD3YV+zw0IpV3pAJhXsfWkQ/CweJobqbaHwrTM+KD8rYw9?= =?us-ascii?Q?O5sXFmdvNVdPtDQTCZnXmvt76CAVZ94iyzPuN7QJMT0lTvOOJuP9P93NYtlJ?= =?us-ascii?Q?rAAfn9Lc/5TomKZSwJS3/GvNREH0jfGmgvwQuYePC6yKpiPapoRjlUjY+0cL?= =?us-ascii?Q?sawcOkTQG9620f6Uf0MSZXKZ6r18cWA7R/DuVJChYIxFJeLk4Dz5UPHApW65?= =?us-ascii?Q?nFqTRw46e1iIs7gv2fnp3hoPELg8htuA07pB2Fppy84pqcE8aIN1ZGp780mK?= =?us-ascii?Q?H6xLsolFIHhwJDBTSHiTBCuexui8DyYiBpyFqjmVcWf1zTgKHG6732qFR6jH?= =?us-ascii?Q?xxVYi+0JCbFT1RodMpo7ou4xyg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q?r+obV98h2lCBiukdO3jVf4Lb+w0QN8jI?= X-Forefront-Antispam-Report: CIP:216.228.117.161; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:dc6edge2.nvidia.com; CAT:NONE; SFS:(13230040)(376014)(36860700013)(1800799024)(82310400026); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Dec 2024 08:08:12.2800 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: eef84b34-0eed-4027-b9d0-08dd16964b8b X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a; Ip=[216.228.117.161]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: BL02EPF00021F6D.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH8PR12MB6866 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 23.11.3 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 12/10/24. 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://git.dpdk.org/dpdk-stable/log/?h=23.11-staging This queued commit can be viewed at: https://git.dpdk.org/dpdk-stable/commit/?h=23.11-staging&id=95cad5da69983fed51d4ff6b2636bface18c53c8 Thanks. Xueming Li --- >From 95cad5da69983fed51d4ff6b2636bface18c53c8 Mon Sep 17 00:00:00 2001 From: Bing Zhao Date: Wed, 13 Nov 2024 09:22:44 +0200 Subject: [PATCH] net/mlx5: fix Rx queue reference count in flushing flows Cc: Xueming Li [ upstream commit 1ea333d2de220d5bad600ed50b43f91f7703c123 ] Some indirect table and hrxq is created in the rule creation with QUEUE or RSS action. When stopping a port, the 'dev_started' is set to 0 in the beginning. The mlx5_ind_table_obj_release() should still do the dereference of the queue(s) when it is called in the polling of flow rule deletion, due to the fact that a flow with Q/RSS action is always referring to the active Rx queues. The callback now can only pass one input parameter. Using a global flag per device to indicate that the user flows flushing is in progress. Then the reference count of the queue(s) should be decreased. Fixes: 3a2f674b6aa8 ("net/mlx5: add queue and RSS HW steering action") Signed-off-by: Bing Zhao Acked-by: Dariusz Sosnowski --- drivers/net/mlx5/mlx5.h | 1 + drivers/net/mlx5/mlx5_flow.c | 2 ++ drivers/net/mlx5/mlx5_rxq.c | 8 +++++--- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/drivers/net/mlx5/mlx5.h b/drivers/net/mlx5/mlx5.h index 9a6bd976c2..55c29e31a2 100644 --- a/drivers/net/mlx5/mlx5.h +++ b/drivers/net/mlx5/mlx5.h @@ -1938,6 +1938,7 @@ struct mlx5_priv { uint32_t hws_mark_refcnt; /* HWS mark action reference counter. */ struct rte_pmd_mlx5_flow_engine_mode_info mode_info; /* Process set flow engine info. */ struct mlx5_flow_hw_attr *hw_attr; /* HW Steering port configuration. */ + bool hws_rule_flushing; /**< Whether this port is in rules flushing stage. */ #if defined(HAVE_IBV_FLOW_DV_SUPPORT) || !defined(HAVE_INFINIBAND_VERBS_H) /* Item template list. */ LIST_HEAD(flow_hw_itt, rte_flow_pattern_template) flow_hw_itt; diff --git a/drivers/net/mlx5/mlx5_flow.c b/drivers/net/mlx5/mlx5_flow.c index 6286eef010..1e9484f372 100644 --- a/drivers/net/mlx5/mlx5_flow.c +++ b/drivers/net/mlx5/mlx5_flow.c @@ -8101,7 +8101,9 @@ mlx5_flow_list_flush(struct rte_eth_dev *dev, enum mlx5_flow_type type, #ifdef HAVE_IBV_FLOW_DV_SUPPORT if (priv->sh->config.dv_flow_en == 2 && type == MLX5_FLOW_TYPE_GEN) { + priv->hws_rule_flushing = true; flow_hw_q_flow_flush(dev, NULL); + priv->hws_rule_flushing = false; return; } #endif diff --git a/drivers/net/mlx5/mlx5_rxq.c b/drivers/net/mlx5/mlx5_rxq.c index aa2e8fd9e3..6d28bcb57c 100644 --- a/drivers/net/mlx5/mlx5_rxq.c +++ b/drivers/net/mlx5/mlx5_rxq.c @@ -2895,6 +2895,7 @@ static void __mlx5_hrxq_remove(struct rte_eth_dev *dev, struct mlx5_hrxq *hrxq) { struct mlx5_priv *priv = dev->data->dev_private; + bool deref_rxqs = true; #ifdef HAVE_IBV_FLOW_DV_SUPPORT if (hrxq->hws_flags) @@ -2904,9 +2905,10 @@ __mlx5_hrxq_remove(struct rte_eth_dev *dev, struct mlx5_hrxq *hrxq) #endif priv->obj_ops.hrxq_destroy(hrxq); if (!hrxq->standalone) { - mlx5_ind_table_obj_release(dev, hrxq->ind_table, - hrxq->hws_flags ? - (!!dev->data->dev_started) : true); + if (!dev->data->dev_started && hrxq->hws_flags && + !priv->hws_rule_flushing) + deref_rxqs = false; + mlx5_ind_table_obj_release(dev, hrxq->ind_table, deref_rxqs); } mlx5_ipool_free(priv->sh->ipool[MLX5_IPOOL_HRXQ], hrxq->idx); } -- 2.34.1 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2024-12-06 23:26:46.579902802 +0800 +++ 0074-net-mlx5-fix-Rx-queue-reference-count-in-flushing-fl.patch 2024-12-06 23:26:44.073044826 +0800 @@ -1 +1 @@ -From 1ea333d2de220d5bad600ed50b43f91f7703c123 Mon Sep 17 00:00:00 2001 +From 95cad5da69983fed51d4ff6b2636bface18c53c8 Mon Sep 17 00:00:00 2001 @@ -4,0 +5,3 @@ +Cc: Xueming Li + +[ upstream commit 1ea333d2de220d5bad600ed50b43f91f7703c123 ] @@ -19 +21,0 @@ -Cc: stable@dpdk.org @@ -25 +27 @@ - drivers/net/mlx5/mlx5_flow.c | 3 +++ + drivers/net/mlx5/mlx5_flow.c | 2 ++ @@ -27 +29 @@ - 3 files changed, 9 insertions(+), 3 deletions(-) + 3 files changed, 8 insertions(+), 3 deletions(-) @@ -30 +32 @@ -index 6e8295110e..89d277b523 100644 +index 9a6bd976c2..55c29e31a2 100644 @@ -33,2 +35,2 @@ -@@ -2060,6 +2060,7 @@ struct mlx5_priv { - RTE_ATOMIC(uint32_t) hws_mark_refcnt; /* HWS mark action reference counter. */ +@@ -1938,6 +1938,7 @@ struct mlx5_priv { + uint32_t hws_mark_refcnt; /* HWS mark action reference counter. */ @@ -42 +44 @@ -index d631ed150c..16ddd05448 100644 +index 6286eef010..1e9484f372 100644 @@ -45 +47 @@ -@@ -8118,7 +8118,10 @@ mlx5_flow_list_flush(struct rte_eth_dev *dev, enum mlx5_flow_type type, +@@ -8101,7 +8101,9 @@ mlx5_flow_list_flush(struct rte_eth_dev *dev, enum mlx5_flow_type type, @@ -52 +54 @@ -+ return; + return; @@ -55 +56,0 @@ - MLX5_IPOOL_FOREACH(priv->flows[type], fidx, flow) { @@ -57 +58 @@ -index d437835b73..0737f60272 100644 +index aa2e8fd9e3..6d28bcb57c 100644 @@ -60 +61 @@ -@@ -2894,6 +2894,7 @@ static void +@@ -2895,6 +2895,7 @@ static void @@ -68 +69 @@ -@@ -2903,9 +2904,10 @@ __mlx5_hrxq_remove(struct rte_eth_dev *dev, struct mlx5_hrxq *hrxq) +@@ -2904,9 +2905,10 @@ __mlx5_hrxq_remove(struct rte_eth_dev *dev, struct mlx5_hrxq *hrxq)