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 36FBC43B86 for ; Tue, 5 Mar 2024 10:49:39 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 2CC6F4026B; Tue, 5 Mar 2024 10:49:39 +0100 (CET) Received: from NAM10-DM6-obe.outbound.protection.outlook.com (mail-dm6nam10on2062.outbound.protection.outlook.com [40.107.93.62]) by mails.dpdk.org (Postfix) with ESMTP id EA4AC4014F for ; Tue, 5 Mar 2024 10:49:37 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=DHSmVrH7pDWwfxBwczRC1qMuQ1CT+QXkmnkBHghBOCuFoCU+MmEJyD0BiJ12lGypNmS8UKtVVyN/y+2SDGpzXEOUvCynaQYcM250RGt5y6ZHtKoLyx90/R3cTJV9voZ2WspWFZsZmlwT1A32/iOSujSAHwoABeTD0STD8SIAo5/1vPNxubS379CZeBnB6qdsmHDmoAVsrTf3rzuF/TewqqgzoaZmaJjJhxYrc6XmEDads+kngnneH+IkvTVIw7r4qLRQAZidC4VpiiZ/eg/ujdTLkKQmGEuDfE1ZEr8+uZTluPuwe7bsZ6r2eYrVSrUMIpR/tR38uXkraD3XPYJSBw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; 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=rxf+yVV2fvsDC1U38QIX43npSSp3SfA/r8Yw6ojf5ls=; b=ZczKPWQde4qlGTsWivzt7B3Jnh4kTy6+H2NcpizmXfRNg9dc4+twXT0O+wjJxP1Q6KdOZeQxIjeIWQRXFwtgQvaZz7TB3QGyQZYL7HYK1sF7O+23jWXoLCY/yK21BlUPAi809SqP7okXtTklZJdk7ReUTYvsQj6INGx1u0Cy3/40jJ/IaFWqMx5ux6LEfOnsg2kVpUkE2W4oD3F9XpI85a1ui0dbrIeD0CqMRV4PxfnD8rDOSJvBzN72AKzDxVR3fvppRIYQu7A8ZVoXbd47kZYIRYOa2I4tS31ID3d5jQHvOe68Ex2uLnXysEqmOC6rUKPyMiC/38IXXUNnWkxNUA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.161) smtp.rcpttodomain=intel.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=rxf+yVV2fvsDC1U38QIX43npSSp3SfA/r8Yw6ojf5ls=; b=jA5QzYGlJRvmPIbZGx/6aIdYr1PiBlWfh1wfbIN74C+KUzCE6Y7d7RSXVzJsACjovZs2uga4UMSFTKzKtRE04RaxPAULw/A6J4sgoAoFXOK85jQf5JA1IXjmcfW7y52sCpPE1eu8OrzAsCwSiUUNnv8KE4pU0AkbNli+ooJgAfmssnamZ0daChHWzNDH7qGUx+Ihdx/yP81IafcntFlEAMT1lQAPEy4KBLRCAhwo9vJjyjNMpGKO5ApL8DJwWE9XEMlWimNcwvP59nuzggR6cU59sUGvgT4ztjn9Eyuhw+ztBXRNkD9UNElaqEqomOPRWS+HTRwidZS/c5AlGgL0zw== Received: from CH0PR03CA0441.namprd03.prod.outlook.com (2603:10b6:610:10e::34) by BY5PR12MB4033.namprd12.prod.outlook.com (2603:10b6:a03:213::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7339.39; Tue, 5 Mar 2024 09:49:32 +0000 Received: from SN1PEPF0002BA50.namprd03.prod.outlook.com (2603:10b6:610:10e:cafe::61) by CH0PR03CA0441.outlook.office365.com (2603:10b6:610:10e::34) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7339.38 via Frontend Transport; Tue, 5 Mar 2024 09:49:32 +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 SN1PEPF0002BA50.mail.protection.outlook.com (10.167.242.73) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7362.11 via Frontend Transport; Tue, 5 Mar 2024 09:49:31 +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.986.41; Tue, 5 Mar 2024 01:49:13 -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.1258.12; Tue, 5 Mar 2024 01:49:12 -0800 From: Xueming Li To: Qi Zhang CC: Qiming Yang , dpdk stable Subject: patch 'net/ice: fix link update' has been queued to stable release 23.11.1 Date: Tue, 5 Mar 2024 17:45:53 +0800 Message-ID: <20240305094757.439387-13-xuemingl@nvidia.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240305094757.439387-1-xuemingl@nvidia.com> References: <20240305094757.439387-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: rnnvmail202.nvidia.com (10.129.68.7) To rnnvmail201.nvidia.com (10.129.68.8) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SN1PEPF0002BA50:EE_|BY5PR12MB4033:EE_ X-MS-Office365-Filtering-Correlation-Id: 23c89173-ec19-40fc-64ec-08dc3cf98ed8 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: SffFKYl4sY0DnvSwv7hnZOjd4ZEwj0YSOKP4m6fnmiZXVOXmn0VzashD/LZ8aN/GLssyFWppOoieSOVGXXKIxgnWkiVQvBnGnNgo611rsnFT7AYPgLEwaVkNg5YugjKsQlyUW5Ap0xs0VcytK7rYnxn7no3W9aRIuC3BaAB3lsO+Mv1DBlVTb8HrcuDjVCqkaVCNzAKYO3+i7E6Nu+tewcxKynGYRapu9Vj5nzSufJf5sMwLK4hY5lYNm76jGJTzXTe7ubnbIXgt5axrNdwMHqTWM+Ekf+a2d54S+q4Qv2XjCK05t0whfMpIDVttLS7R1NB1cbdqDam32qE0WxxwyenwUWkqrXbInE9cTV1F8eBZWone7BXXVDS0j4eU9aCYzZjkoiyCYUybRq+NmCdn+DnlgKRTH0EYr+MudMYFojaCx6h5G1Q7zyd4HsLvxgMzJCax537gjcsibxt54sCc4lRJxuDq3w6zIYWH/xEmZ6oJkkAQUEVTKmMoCjCDfe7uuaAvdStE4SKBicioJWVPkegVksXC3y7JltadxD8eVUHCl6/P4MYr74lPNvIVWhUJ1cOBdK4Tbh1I3VumOpl+3pm19R78vTKn7DOuwxPwEDBncuMQegLN+QJ9OO3Y02tgZdQgypY/2eESJQIuR1xm5ze+uSR6AwRu56GRzM/6LCGLZ+uqIPHMtnM1u26rl9/dz56DXMfYazXYWLF1ljOIjKiuM2bZ8zw7GbaioOIx37gJkTppWotkEkUcB4FcgDIy 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:(13230031)(36860700004)(376005)(82310400014); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Mar 2024 09:49:31.9431 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 23c89173-ec19-40fc-64ec-08dc3cf98ed8 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: SN1PEPF0002BA50.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY5PR12MB4033 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.1 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 03/31/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=48efa16873357fdac7264853cc6423ad1585a790 Thanks. Xueming Li --- >From 48efa16873357fdac7264853cc6423ad1585a790 Mon Sep 17 00:00:00 2001 From: Qi Zhang Date: Thu, 14 Dec 2023 03:40:54 -0500 Subject: [PATCH] net/ice: fix link update Cc: Xueming Li [ upstream commit 4e5dc111464e83e9a55fa466d8f682f0027b721e ] The ice_aq_get_link_info function is not thread-safe. However, it is possible to simultaneous invocations during both the dev_start and the LSC interrupt handler, potentially leading to unexpected adminq errors. This patch addresses the issue by introducing a thread-safe wrapper that utilizes a spinlock. Fixes: cf911d90e366 ("net/ice: support link update") Signed-off-by: Qi Zhang Acked-by: Qiming Yang --- drivers/net/ice/ice_ethdev.c | 26 ++++++++++++++++++++------ drivers/net/ice/ice_ethdev.h | 4 ++++ 2 files changed, 24 insertions(+), 6 deletions(-) diff --git a/drivers/net/ice/ice_ethdev.c b/drivers/net/ice/ice_ethdev.c index 3ccba4db80..1f8ab5158a 100644 --- a/drivers/net/ice/ice_ethdev.c +++ b/drivers/net/ice/ice_ethdev.c @@ -1804,6 +1804,7 @@ ice_pf_setup(struct ice_pf *pf) } pf->main_vsi = vsi; + rte_spinlock_init(&pf->link_lock); return 0; } @@ -3621,17 +3622,31 @@ ice_rxq_intr_setup(struct rte_eth_dev *dev) return 0; } +static enum ice_status +ice_get_link_info_safe(struct ice_pf *pf, bool ena_lse, + struct ice_link_status *link) +{ + struct ice_hw *hw = ICE_PF_TO_HW(pf); + int ret; + + rte_spinlock_lock(&pf->link_lock); + + ret = ice_aq_get_link_info(hw->port_info, ena_lse, link, NULL); + + rte_spinlock_unlock(&pf->link_lock); + + return ret; +} + static void ice_get_init_link_status(struct rte_eth_dev *dev) { - struct ice_hw *hw = ICE_DEV_PRIVATE_TO_HW(dev->data->dev_private); struct ice_pf *pf = ICE_DEV_PRIVATE_TO_PF(dev->data->dev_private); bool enable_lse = dev->data->dev_conf.intr_conf.lsc ? true : false; struct ice_link_status link_status; int ret; - ret = ice_aq_get_link_info(hw->port_info, enable_lse, - &link_status, NULL); + ret = ice_get_link_info_safe(pf, enable_lse, &link_status); if (ret != ICE_SUCCESS) { PMD_DRV_LOG(ERR, "Failed to get link info"); pf->init_link_up = false; @@ -3996,7 +4011,7 @@ ice_link_update(struct rte_eth_dev *dev, int wait_to_complete) { #define CHECK_INTERVAL 50 /* 50ms */ #define MAX_REPEAT_TIME 40 /* 2s (40 * 50ms) in total */ - struct ice_hw *hw = ICE_DEV_PRIVATE_TO_HW(dev->data->dev_private); + struct ice_pf *pf = ICE_DEV_PRIVATE_TO_PF(dev->data->dev_private); struct ice_link_status link_status; struct rte_eth_link link, old; int status; @@ -4010,8 +4025,7 @@ ice_link_update(struct rte_eth_dev *dev, int wait_to_complete) do { /* Get link status information from hardware */ - status = ice_aq_get_link_info(hw->port_info, enable_lse, - &link_status, NULL); + status = ice_get_link_info_safe(pf, enable_lse, &link_status); if (status != ICE_SUCCESS) { link.link_speed = RTE_ETH_SPEED_NUM_100M; link.link_duplex = RTE_ETH_LINK_FULL_DUPLEX; diff --git a/drivers/net/ice/ice_ethdev.h b/drivers/net/ice/ice_ethdev.h index abe6dcdc23..d607f028e0 100644 --- a/drivers/net/ice/ice_ethdev.h +++ b/drivers/net/ice/ice_ethdev.h @@ -548,6 +548,10 @@ struct ice_pf { uint64_t rss_hf; struct ice_tm_conf tm_conf; uint16_t outer_ethertype; + /* lock prevent race condition between lsc interrupt handler + * and link status update during dev_start. + */ + rte_spinlock_t link_lock; }; #define ICE_MAX_QUEUE_NUM 2048 -- 2.34.1 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2024-03-05 17:39:31.481020117 +0800 +++ 0012-net-ice-fix-link-update.patch 2024-03-05 17:39:30.673566490 +0800 @@ -1 +1 @@ -From 4e5dc111464e83e9a55fa466d8f682f0027b721e Mon Sep 17 00:00:00 2001 +From 48efa16873357fdac7264853cc6423ad1585a790 Mon Sep 17 00:00:00 2001 @@ -4,0 +5,3 @@ +Cc: Xueming Li + +[ upstream commit 4e5dc111464e83e9a55fa466d8f682f0027b721e ] @@ -13 +15,0 @@ -Cc: stable@dpdk.org