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 4F8C4470AE for ; Sun, 21 Dec 2025 16:04:13 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 4991B40612; Sun, 21 Dec 2025 16:04:13 +0100 (CET) Received: from SN4PR2101CU001.outbound.protection.outlook.com (mail-southcentralusazon11012043.outbound.protection.outlook.com [40.93.195.43]) by mails.dpdk.org (Postfix) with ESMTP id EF51C40612 for ; Sun, 21 Dec 2025 16:04:11 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=aFb3CfU/UZqwh0JXJqhBTyltha6dF3ZxZTcO/NpJdZOoNQhD7ScCuauGZPzq1zkcPvSR5inTVQQHwvJgrzMSLb/cjBYaZGSeZc5XA89/0LxNCSCTHoiKPvHAReGRBgPj2vHU2eK4HjS5EUDtw7WZOn94KEYTPzIZjpwtfIzjYudnzfqwuT71Ik5wGrX/Mz1y51BK5m8B3UiDp7/UfbrP0NWNc8th97nUMawo2dC6reHdjsdeP4ICCUlpkWzx2GGNGR7il8DsNs15dDe+pfG6zCAyzZqdSBn9L65xLfNk+udrxTjZB/QxGfcsomPXOJLMDlH+qc5eRa/xwTU/V/NA/w== 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=hnXtGUvnMY+ntapMLTcsL1wVr25bI0yrV1V9PG1F8vE=; b=KdSU/BdWTuj3n28fGWsI+mV9FR+G7kVil0809k096zy10JjkTTeHXN6UI+YbEn3CnYKwC6Ua2yvLEZTft9/K5FwcypBc5M3s/79uAeRCf/AqWpWqDUYRCQaXo8M7YmpYjnOsNTl2tdoKilMWbqj3nFkP4kRkSagTmzhKLDEnJiyU2YOb2dnU90s9gYWiyoD/mIfHA+I2mmnslmjBuQw5SCziUdGgfOaz2RWYbxKSIuBaqcXAg8MOdCrMawUexBpZ9R73l9sZFf80AQW9RYNNyYcSR/GOx48CWmmBoWLJe6WSI/dDbiuYRmuNtaDAwMKXF5bxA98ucmYzvp3wwSi/gQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.160) smtp.rcpttodomain=huawei.com 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=hnXtGUvnMY+ntapMLTcsL1wVr25bI0yrV1V9PG1F8vE=; b=hxSywcyB6xEnoxRN0kepAHL6PYucz3+lQeUBy6Yw8m5KM+KLGTK+p1INHf1F9O1rpim1LM3ISo470Ilp8ncJM1D5bPPg6GVpRBZppmWZGb6IN0nJlKQFyEd0493TKv0w2pTEBTbHcoPUTrttqLwTkiJmSd5slf2OlSuxDrL4TrEANnTSkc3KVHGUZKkxUgwRkXo+s2mCMxlKqA6g/uMM2A1K7PEktJVSfF/bTIVuzDbOkd2WXuI54KhMWxBtBWP2EORPohat5yd3CTm4cySePzmUipY5xftmD5Gq8zn/TdUuF2o8gtglmmXIfGjASRCR4ZHFqyjzP9dDbAbRf1HGvg== Received: from SJ0PR03CA0174.namprd03.prod.outlook.com (2603:10b6:a03:338::29) by IA0PR12MB7673.namprd12.prod.outlook.com (2603:10b6:208:435::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.9434.10; Sun, 21 Dec 2025 15:04:04 +0000 Received: from CO1PEPF000066E6.namprd05.prod.outlook.com (2603:10b6:a03:338:cafe::3b) by SJ0PR03CA0174.outlook.office365.com (2603:10b6:a03:338::29) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.9434.11 via Frontend Transport; Sun, 21 Dec 2025 15:03:58 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.117.160) 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.160 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.117.160; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.117.160) by CO1PEPF000066E6.mail.protection.outlook.com (10.167.249.4) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.9456.9 via Frontend Transport; Sun, 21 Dec 2025 15:04:02 +0000 Received: from rnnvmail203.nvidia.com (10.129.68.9) by mail.nvidia.com (10.129.200.66) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.2562.20; Sun, 21 Dec 2025 07:03:43 -0800 Received: from rnnvmail203.nvidia.com (10.129.68.9) by rnnvmail203.nvidia.com (10.129.68.9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.2562.20; Sun, 21 Dec 2025 07:03:43 -0800 Received: from nvidia.com (10.127.8.12) by mail.nvidia.com (10.129.68.9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.2562.20 via Frontend Transport; Sun, 21 Dec 2025 07:03:42 -0800 From: Shani Peretz To: Dengdui Huang CC: dpdk stable Subject: patch 'net/hns3: fix inconsistent lock' has been queued to stable release 23.11.6 Date: Sun, 21 Dec 2025 16:57:01 +0200 Message-ID: <20251221145746.763179-73-shperetz@nvidia.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20251221145746.763179-1-shperetz@nvidia.com> References: <20251221145746.763179-1-shperetz@nvidia.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-NV-OnPremToCloud: ExternallySecured X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CO1PEPF000066E6:EE_|IA0PR12MB7673:EE_ X-MS-Office365-Filtering-Correlation-Id: 889c6c55-6b2e-46cd-f46f-08de40a22d59 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|82310400026|376014|36860700013|1800799024|13003099007|7053199007; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?dayt5S/F50StsMf8sgQKAE6OvQmCbAuvFz1PFyZ55gT9pjNfJzGdoyCp6/6B?= =?us-ascii?Q?XGeXwtvK22V89apVZnCEGv1aRJUBJyH5MvUsghglkuylS19zT+LYiC7WjaBJ?= =?us-ascii?Q?DuFkvCqNcxYzYP/FoYEYGC+VY1GSUOqsp9u/loCgCK3pdvDDFF6TuS/Ny+g2?= =?us-ascii?Q?AKqc9coQARQLakAe/BQ2o7RFu3lQm6N0p9oysgtbLe9xXriShsFjr/8CGwew?= =?us-ascii?Q?yQHSvpzW/RPD1/7F+Quqf+lmUQtB/JhQXMFCIcq+HEcv5ue18+KQhXYVXA54?= =?us-ascii?Q?NlVx/jrcMJ7nJnUH2PEqrXHN2cyO04f8oaWZ9sjIZBBQg6qZMmoSTAAFDBOC?= =?us-ascii?Q?Ssv9hFDLhQceV/Jpt8YghzoN3kNAWd/9gPh4+2EmzwM4qV9bAnC12nWUSVbY?= =?us-ascii?Q?DcFEZt+fRPV0jrBQg8B3qZHSA7cXHDQKvImpL98ShwwQWLz2USn3sFztsJhh?= =?us-ascii?Q?OGxvo6TLb/56kl/0BI96I+31vlcsF91pRJVf40UNusraNnmWHpG/d8Vvkl//?= =?us-ascii?Q?uwbvjyqvS459kHYLeWp2/v6KSE9/nKMJtgMLN+t4MZ/jpOsBs/kb9RTDka/2?= =?us-ascii?Q?Lxx84Wn8x5158SkPVx0dZq9Zb/4j2ICsGSGK2O8V+97W0BYjpFVVGKPejwCr?= =?us-ascii?Q?nlMjjjcTpygEAivNrrbRupA6sQtBrXTx/HtNsJmkqgzyGGGRdyjXLq7MPx+t?= =?us-ascii?Q?BAl8OXoddLvJbVebol+CylSc84rziDs8DJmsa1hEYv5DfJJ/hBO0HCt67QUU?= =?us-ascii?Q?EYca1Cref8HEk1lm/ckKBODCbukx6A0v5CsjtKjRH39z6ewhX+otQFZhMP+l?= =?us-ascii?Q?n6kjHL3mVluvsOOTWFMbSxGAbcUlEjSZb13qIuHSwS3jnBhqqkoh7gg1ccih?= =?us-ascii?Q?1FhZmR+v5emT6LHVSDgnDM/LbemHsJBxPlfmldQ/i/k1jXxVUpFOHr5DpCA3?= =?us-ascii?Q?2bo++lxHxD+93I/eOPugHZq3YHlcmF1JiqvTer3xh2yWEUv3DMEgTcTl8yGx?= =?us-ascii?Q?wMngCRvSOHZ42dwlTPXO9rp6HtLwi7HocQsIIWvtHpg5wT0weJq3HDQ8cYw9?= =?us-ascii?Q?B34qNeWw5TxHfTnm+GqhdSNGMgjfaQHcrFQ75ZX+2qQe5wBjrrE+0UbKDmbs?= =?us-ascii?Q?O71hruzdQK8VDXyj2bmrA6wCDeOZVGpSSuRfM9D6xi5bvb3i5eJVPa4W6DiA?= =?us-ascii?Q?8baGfMvD2jhRtoCxgVMdcs43bjgMtg3OPwVIC2WEXV5r6mxkPuUOftvE6Iso?= =?us-ascii?Q?SHrikywpVgCkSjjLhP3wSFHTmCHTHVM+3NgBRo6JMMBXWAI7w9Loym2Nd9H0?= =?us-ascii?Q?54Czj/+SA68Z1r8zUrI360YpPnpjMV1L8wB/JPNfgOd56X6anvAiIBucFHUf?= =?us-ascii?Q?PY4S8Urmvvwqt/8idPxcUNC/a7eE/BnK/yuqwIP+4yM+JSYxXgLi0ekeJJ4s?= =?us-ascii?Q?XugoHheUEVr3S38GmbsFmCXLq7BHVDJ2GFSWXBDVH8uW/y2OPzEBuSUDLaru?= =?us-ascii?Q?3R3pWQDCndU5aLDkUCeH0+IZh+uzDCiLlCfa6vQNlDZca+bQTD4V7uZclODP?= =?us-ascii?Q?lxowuEpGH2KB9Uhnrs4N1C/lEHUiQxAfLmjrA5lV?= X-Forefront-Antispam-Report: CIP:216.228.117.160; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:dc6edge1.nvidia.com; CAT:NONE; SFS:(13230040)(82310400026)(376014)(36860700013)(1800799024)(13003099007)(7053199007); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Dec 2025 15:04:02.0332 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 889c6c55-6b2e-46cd-f46f-08de40a22d59 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.160]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: CO1PEPF000066E6.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: IA0PR12MB7673 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.6 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/26/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/shanipr/dpdk-stable This queued commit can be viewed at: https://github.com/shanipr/dpdk-stable/commit/35af6bfb998bf12395bfdc4df534f592434c6422 Thanks. Shani --- >From 35af6bfb998bf12395bfdc4df534f592434c6422 Mon Sep 17 00:00:00 2001 From: Dengdui Huang Date: Wed, 13 Aug 2025 15:33:15 +0800 Subject: [PATCH] net/hns3: fix inconsistent lock [ upstream commit d441169bd20415691ea86707e7bf852eb6fcda46 ] The hns3 driver supports configuring RSS through both ops API and rte_flow API. The ops API uses spin lock, while the rte_flow API uses pthread mutex. When concurrent calls occur, issues may arise. This patch replaces the lock in the flow API with spin lock. With the pthread mutex no longer needed, the pthread attributes can also be removed. Fixes: 1bdcca8006e4 ("net/hns3: fix flow director lock") Signed-off-by: Dengdui Huang --- drivers/net/hns3/hns3_ethdev.h | 2 -- drivers/net/hns3/hns3_fdir.c | 13 -------- drivers/net/hns3/hns3_flow.c | 60 +++++++++++++--------------------- 3 files changed, 22 insertions(+), 53 deletions(-) diff --git a/drivers/net/hns3/hns3_ethdev.h b/drivers/net/hns3/hns3_ethdev.h index 0ce4974da6..1b105dc5ca 100644 --- a/drivers/net/hns3/hns3_ethdev.h +++ b/drivers/net/hns3/hns3_ethdev.h @@ -5,7 +5,6 @@ #ifndef HNS3_ETHDEV_H #define HNS3_ETHDEV_H -#include #include #include #include @@ -680,7 +679,6 @@ struct hns3_hw { struct hns3_port_base_vlan_config port_base_vlan_cfg; - pthread_mutex_t flows_lock; /* rte_flow ops lock */ struct hns3_fdir_rule_list flow_fdir_list; /* flow fdir rule list */ struct hns3_rss_filter_list flow_rss_list; /* flow RSS rule list */ struct hns3_flow_mem_list flow_list; diff --git a/drivers/net/hns3/hns3_fdir.c b/drivers/net/hns3/hns3_fdir.c index 75a200c713..5a7d9192da 100644 --- a/drivers/net/hns3/hns3_fdir.c +++ b/drivers/net/hns3/hns3_fdir.c @@ -1076,17 +1076,6 @@ int hns3_restore_all_fdir_filter(struct hns3_adapter *hns) if (hns->is_vf) return 0; - /* - * This API is called in the reset recovery process, the parent function - * must hold hw->lock. - * There maybe deadlock if acquire hw->flows_lock directly because rte - * flow driver ops first acquire hw->flows_lock and then may acquire - * hw->lock. - * So here first release the hw->lock and then acquire the - * hw->flows_lock to avoid deadlock. - */ - rte_spinlock_unlock(&hw->lock); - pthread_mutex_lock(&hw->flows_lock); TAILQ_FOREACH(fdir_filter, &fdir_info->fdir_list, entries) { ret = hns3_config_action(hw, &fdir_filter->fdir_conf); if (!ret) @@ -1097,8 +1086,6 @@ int hns3_restore_all_fdir_filter(struct hns3_adapter *hns) break; } } - pthread_mutex_unlock(&hw->flows_lock); - rte_spinlock_lock(&hw->lock); if (err) { hns3_err(hw, "Fail to restore FDIR filter, ret = %d", ret); diff --git a/drivers/net/hns3/hns3_flow.c b/drivers/net/hns3/hns3_flow.c index b5a46e5ff1..f28ed48a7f 100644 --- a/drivers/net/hns3/hns3_flow.c +++ b/drivers/net/hns3/hns3_flow.c @@ -2032,18 +2032,6 @@ hns3_reconfig_all_rss_filter(struct hns3_hw *hw) return 0; } -static int -hns3_restore_rss_filter(struct hns3_hw *hw) -{ - int ret; - - pthread_mutex_lock(&hw->flows_lock); - ret = hns3_reconfig_all_rss_filter(hw); - pthread_mutex_unlock(&hw->flows_lock); - - return ret; -} - int hns3_restore_filter(struct hns3_adapter *hns) { @@ -2054,7 +2042,7 @@ hns3_restore_filter(struct hns3_adapter *hns) if (ret != 0) return ret; - return hns3_restore_rss_filter(hw); + return hns3_reconfig_all_rss_filter(hw); } static int @@ -2446,10 +2434,10 @@ hns3_flow_validate_wrap(struct rte_eth_dev *dev, struct hns3_filter_info filter_info = {0}; int ret; - pthread_mutex_lock(&hw->flows_lock); + rte_spinlock_lock(&hw->lock); ret = hns3_flow_validate(dev, attr, pattern, actions, error, &filter_info); - pthread_mutex_unlock(&hw->flows_lock); + rte_spinlock_unlock(&hw->lock); return ret; } @@ -2463,9 +2451,9 @@ hns3_flow_create_wrap(struct rte_eth_dev *dev, const struct rte_flow_attr *attr, struct hns3_hw *hw = HNS3_DEV_PRIVATE_TO_HW(dev->data->dev_private); struct rte_flow *flow; - pthread_mutex_lock(&hw->flows_lock); + rte_spinlock_lock(&hw->lock); flow = hns3_flow_create(dev, attr, pattern, actions, error); - pthread_mutex_unlock(&hw->flows_lock); + rte_spinlock_unlock(&hw->lock); return flow; } @@ -2477,9 +2465,9 @@ hns3_flow_destroy_wrap(struct rte_eth_dev *dev, struct rte_flow *flow, struct hns3_hw *hw = HNS3_DEV_PRIVATE_TO_HW(dev->data->dev_private); int ret; - pthread_mutex_lock(&hw->flows_lock); + rte_spinlock_lock(&hw->lock); ret = hns3_flow_destroy(dev, flow, error); - pthread_mutex_unlock(&hw->flows_lock); + rte_spinlock_unlock(&hw->lock); return ret; } @@ -2490,9 +2478,9 @@ hns3_flow_flush_wrap(struct rte_eth_dev *dev, struct rte_flow_error *error) struct hns3_hw *hw = HNS3_DEV_PRIVATE_TO_HW(dev->data->dev_private); int ret; - pthread_mutex_lock(&hw->flows_lock); + rte_spinlock_lock(&hw->lock); ret = hns3_flow_flush(dev, error); - pthread_mutex_unlock(&hw->flows_lock); + rte_spinlock_unlock(&hw->lock); return ret; } @@ -2505,9 +2493,9 @@ hns3_flow_query_wrap(struct rte_eth_dev *dev, struct rte_flow *flow, struct hns3_hw *hw = HNS3_DEV_PRIVATE_TO_HW(dev->data->dev_private); int ret; - pthread_mutex_lock(&hw->flows_lock); + rte_spinlock_lock(&hw->lock); ret = hns3_flow_query(dev, flow, actions, data, error); - pthread_mutex_unlock(&hw->flows_lock); + rte_spinlock_unlock(&hw->lock); return ret; } @@ -2555,7 +2543,7 @@ hns3_flow_action_create(struct rte_eth_dev *dev, if (hns3_check_indir_action(conf, action, error)) return NULL; - pthread_mutex_lock(&hw->flows_lock); + rte_spinlock_lock(&hw->lock); act_count = (const struct rte_flow_action_count *)action->conf; if (act_count->id >= pf->fdir.fd_cfg.cnt_num[HNS3_FD_STAGE_1]) { @@ -2580,11 +2568,11 @@ hns3_flow_action_create(struct rte_eth_dev *dev, handle.indirect_type = HNS3_INDIRECT_ACTION_TYPE_COUNT; handle.counter_id = counter->id; - pthread_mutex_unlock(&hw->flows_lock); + rte_spinlock_unlock(&hw->lock); return (struct rte_flow_action_handle *)handle.val64; err_exit: - pthread_mutex_unlock(&hw->flows_lock); + rte_spinlock_unlock(&hw->lock); return NULL; } @@ -2597,11 +2585,11 @@ hns3_flow_action_destroy(struct rte_eth_dev *dev, struct rte_flow_action_handle indir; struct hns3_flow_counter *counter; - pthread_mutex_lock(&hw->flows_lock); + rte_spinlock_lock(&hw->lock); indir.val64 = (uint64_t)handle; if (indir.indirect_type != HNS3_INDIRECT_ACTION_TYPE_COUNT) { - pthread_mutex_unlock(&hw->flows_lock); + rte_spinlock_unlock(&hw->lock); return rte_flow_error_set(error, EINVAL, RTE_FLOW_ERROR_TYPE_ACTION_CONF, handle, "Invalid indirect type"); @@ -2609,14 +2597,14 @@ hns3_flow_action_destroy(struct rte_eth_dev *dev, counter = hns3_counter_lookup(dev, indir.counter_id); if (counter == NULL) { - pthread_mutex_unlock(&hw->flows_lock); + rte_spinlock_unlock(&hw->lock); return rte_flow_error_set(error, EINVAL, RTE_FLOW_ERROR_TYPE_ACTION_CONF, handle, "Counter id not exist"); } if (counter->ref_cnt > 1) { - pthread_mutex_unlock(&hw->flows_lock); + rte_spinlock_unlock(&hw->lock); return rte_flow_error_set(error, EBUSY, RTE_FLOW_ERROR_TYPE_HANDLE, handle, "Counter id in use"); @@ -2624,7 +2612,7 @@ hns3_flow_action_destroy(struct rte_eth_dev *dev, (void)hns3_counter_release(dev, indir.counter_id); - pthread_mutex_unlock(&hw->flows_lock); + rte_spinlock_unlock(&hw->lock); return 0; } @@ -2639,11 +2627,11 @@ hns3_flow_action_query(struct rte_eth_dev *dev, struct rte_flow flow; int ret; - pthread_mutex_lock(&hw->flows_lock); + rte_spinlock_lock(&hw->lock); indir.val64 = (uint64_t)handle; if (indir.indirect_type != HNS3_INDIRECT_ACTION_TYPE_COUNT) { - pthread_mutex_unlock(&hw->flows_lock); + rte_spinlock_unlock(&hw->lock); return rte_flow_error_set(error, EINVAL, RTE_FLOW_ERROR_TYPE_ACTION_CONF, handle, "Invalid indirect type"); @@ -2653,7 +2641,7 @@ hns3_flow_action_query(struct rte_eth_dev *dev, flow.counter_id = indir.counter_id; ret = hns3_counter_query(dev, &flow, (struct rte_flow_query_count *)data, error); - pthread_mutex_unlock(&hw->flows_lock); + rte_spinlock_unlock(&hw->lock); return ret; } @@ -2687,14 +2675,10 @@ void hns3_flow_init(struct rte_eth_dev *dev) { struct hns3_hw *hw = HNS3_DEV_PRIVATE_TO_HW(dev->data->dev_private); - pthread_mutexattr_t attr; if (rte_eal_process_type() != RTE_PROC_PRIMARY) return; - pthread_mutexattr_init(&attr); - pthread_mutexattr_setpshared(&attr, PTHREAD_PROCESS_SHARED); - pthread_mutex_init(&hw->flows_lock, &attr); dev->data->dev_flags |= RTE_ETH_DEV_FLOW_OPS_THREAD_SAFE; TAILQ_INIT(&hw->flow_fdir_list); -- 2.43.0 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2025-12-21 16:54:20.842116218 +0200 +++ 0073-net-hns3-fix-inconsistent-lock.patch 2025-12-21 16:54:17.298026000 +0200 @@ -1 +1 @@ -From d441169bd20415691ea86707e7bf852eb6fcda46 Mon Sep 17 00:00:00 2001 +From 35af6bfb998bf12395bfdc4df534f592434c6422 Mon Sep 17 00:00:00 2001 @@ -5,0 +6,2 @@ +[ upstream commit d441169bd20415691ea86707e7bf852eb6fcda46 ] + @@ -15 +16,0 @@ -Cc: stable@dpdk.org @@ -25 +26 @@ -index d602bfa02f..f6bb1b5d43 100644 +index 0ce4974da6..1b105dc5ca 100644 @@ -36 +37 @@ -@@ -679,7 +678,6 @@ struct hns3_hw { +@@ -680,7 +679,6 @@ struct hns3_hw { @@ -45 +46 @@ -index aacad40e61..50572ae430 100644 +index 75a200c713..5a7d9192da 100644 @@ -48 +49 @@ -@@ -1145,17 +1145,6 @@ int hns3_restore_all_fdir_filter(struct hns3_adapter *hns) +@@ -1076,17 +1076,6 @@ int hns3_restore_all_fdir_filter(struct hns3_adapter *hns) @@ -66 +67 @@ -@@ -1166,8 +1155,6 @@ int hns3_restore_all_fdir_filter(struct hns3_adapter *hns) +@@ -1097,8 +1086,6 @@ int hns3_restore_all_fdir_filter(struct hns3_adapter *hns) @@ -76 +77 @@ -index c0238d2bfa..f2d1e4ec3a 100644 +index b5a46e5ff1..f28ed48a7f 100644 @@ -79 +80 @@ -@@ -2210,18 +2210,6 @@ hns3_reconfig_all_rss_filter(struct hns3_hw *hw) +@@ -2032,18 +2032,6 @@ hns3_reconfig_all_rss_filter(struct hns3_hw *hw) @@ -98 +99 @@ -@@ -2232,7 +2220,7 @@ hns3_restore_filter(struct hns3_adapter *hns) +@@ -2054,7 +2042,7 @@ hns3_restore_filter(struct hns3_adapter *hns) @@ -107 +108 @@ -@@ -2624,10 +2612,10 @@ hns3_flow_validate_wrap(struct rte_eth_dev *dev, +@@ -2446,10 +2434,10 @@ hns3_flow_validate_wrap(struct rte_eth_dev *dev, @@ -120 +121 @@ -@@ -2641,9 +2629,9 @@ hns3_flow_create_wrap(struct rte_eth_dev *dev, const struct rte_flow_attr *attr, +@@ -2463,9 +2451,9 @@ hns3_flow_create_wrap(struct rte_eth_dev *dev, const struct rte_flow_attr *attr, @@ -132 +133 @@ -@@ -2655,9 +2643,9 @@ hns3_flow_destroy_wrap(struct rte_eth_dev *dev, struct rte_flow *flow, +@@ -2477,9 +2465,9 @@ hns3_flow_destroy_wrap(struct rte_eth_dev *dev, struct rte_flow *flow, @@ -144 +145 @@ -@@ -2668,9 +2656,9 @@ hns3_flow_flush_wrap(struct rte_eth_dev *dev, struct rte_flow_error *error) +@@ -2490,9 +2478,9 @@ hns3_flow_flush_wrap(struct rte_eth_dev *dev, struct rte_flow_error *error) @@ -156 +157 @@ -@@ -2683,9 +2671,9 @@ hns3_flow_query_wrap(struct rte_eth_dev *dev, struct rte_flow *flow, +@@ -2505,9 +2493,9 @@ hns3_flow_query_wrap(struct rte_eth_dev *dev, struct rte_flow *flow, @@ -168 +169 @@ -@@ -2733,7 +2721,7 @@ hns3_flow_action_create(struct rte_eth_dev *dev, +@@ -2555,7 +2543,7 @@ hns3_flow_action_create(struct rte_eth_dev *dev, @@ -177 +178 @@ -@@ -2758,11 +2746,11 @@ hns3_flow_action_create(struct rte_eth_dev *dev, +@@ -2580,11 +2568,11 @@ hns3_flow_action_create(struct rte_eth_dev *dev, @@ -191 +192 @@ -@@ -2775,11 +2763,11 @@ hns3_flow_action_destroy(struct rte_eth_dev *dev, +@@ -2597,11 +2585,11 @@ hns3_flow_action_destroy(struct rte_eth_dev *dev, @@ -205 +206 @@ -@@ -2787,14 +2775,14 @@ hns3_flow_action_destroy(struct rte_eth_dev *dev, +@@ -2609,14 +2597,14 @@ hns3_flow_action_destroy(struct rte_eth_dev *dev, @@ -222 +223 @@ -@@ -2802,7 +2790,7 @@ hns3_flow_action_destroy(struct rte_eth_dev *dev, +@@ -2624,7 +2612,7 @@ hns3_flow_action_destroy(struct rte_eth_dev *dev, @@ -231 +232 @@ -@@ -2817,11 +2805,11 @@ hns3_flow_action_query(struct rte_eth_dev *dev, +@@ -2639,11 +2627,11 @@ hns3_flow_action_query(struct rte_eth_dev *dev, @@ -245 +246 @@ -@@ -2831,7 +2819,7 @@ hns3_flow_action_query(struct rte_eth_dev *dev, +@@ -2653,7 +2641,7 @@ hns3_flow_action_query(struct rte_eth_dev *dev, @@ -254 +255 @@ -@@ -2865,14 +2853,10 @@ void +@@ -2687,14 +2675,10 @@ void