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 B8841A0A0E for ; Mon, 10 May 2021 18:13:57 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id B26C640140; Mon, 10 May 2021 18:13:57 +0200 (CEST) Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11on2065.outbound.protection.outlook.com [40.107.223.65]) by mails.dpdk.org (Postfix) with ESMTP id 9CCB540395 for ; Mon, 10 May 2021 18:13:55 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=mz/NktEIZKBVDAqljtmcoydg5hMyzaIonzW5M1BTwdcnMM1r3+7bPDWP24C/bcaojOl6sFz4LYGNMRj1TdnJ2J6NWM4JkL5g+w8kbOYHXsJBkY6MqJ1MVkl9Fo8hzqU/B5Wm7gdxAbpGveT4SuwMI+XS5WV8p6L3MLLQheo48rZwTmEEhzZ71Yo3ZVU6LgblUa3N6tU8OWk+S6tph1uC3xSNhHv+lVNfH4wcM9NkinXQdO5L8GF/psDAmiw2BdCDmjEd37k+wjMMasAA3OGdkbIevCSADbk2mH1zzjK0UIVtT037c1l+WXyxdiSZfCy/lTxIEwVqitVp15ix7xGS0Q== 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-SenderADCheck; bh=RFFmouWKo0z6nrgJ+DOE9m+Td8PcNOm6ZMWc54CfLu4=; b=lbxBekY2RcxepGm/x6dWilAtiWpe4jCtB8FjVxfCa6RTEBuInP16Hw8apbBcsQaZFIB4xA8WUo01usAZXS2o6EN3VcCXhHO2sD1HQy9SEAh5lPbqOrMsA9f4eGVNRmQwNIo5VvnwQxn5oWfrYX6JMsty5jmk5+KfGX4/jm+Le/nJhYwp74DVbJGKyGk+gRsOGRq3kyAFd2qRbpu2wlUGzAqlRZNNlTVn0M3cl9x3g5OYJ28+dm6jkL3HrqEbGj5KK5bKT1jq3sHXHXEXbNQw8hYU6FBLm9SCxK6G7p5oW4VO1IqLAgTZytbFKtyA8TGZoYbqTK5/0q5Leh/mPEF7eg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.112.34) smtp.rcpttodomain=huawei.com smtp.mailfrom=nvidia.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none 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=RFFmouWKo0z6nrgJ+DOE9m+Td8PcNOm6ZMWc54CfLu4=; b=DZNPHxGP4TJ0N1nr18VPiYuKwM6L9CN2GHQ11rrWKbIwZFLnP3uGFd7Wa5Pe/kR7AFUYVewRVNyXjEN1CIAvmqa6mUFyDOPs6O2Rr20HQAZzVUqh44RRFu9b3tCKgqPmFm55eDk2f3JNt7Hx586uxMcHA50DN/zvqYG0I5UV8ydcGUXLhfgrk6DqC+5DjxZcODNygyPbyK+bXlf1YfjVRsMTUaMfSJXy362bZtP4N/iQXbvuJGBRrOf1vjdvGTRGRSVM4Ckyeo23YFAm0jlYe4/RA927zFWX7v68DYYE4IcAfK88k8hnTPl1t3Mh+hCDNSkLfaIpg1w8OxizTGAXRg== Received: from MWHPR01CA0032.prod.exchangelabs.com (2603:10b6:300:101::18) by CH2PR12MB4120.namprd12.prod.outlook.com (2603:10b6:610:7b::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4108.26; Mon, 10 May 2021 16:13:54 +0000 Received: from CO1NAM11FT051.eop-nam11.prod.protection.outlook.com (2603:10b6:300:101:cafe::3c) by MWHPR01CA0032.outlook.office365.com (2603:10b6:300:101::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4108.25 via Frontend Transport; Mon, 10 May 2021 16:13:54 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.112.34) smtp.mailfrom=nvidia.com; huawei.com; dkim=none (message not signed) header.d=none;huawei.com; dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.112.34 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.112.34; helo=mail.nvidia.com; Received: from mail.nvidia.com (216.228.112.34) by CO1NAM11FT051.mail.protection.outlook.com (10.13.174.114) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.4108.25 via Frontend Transport; Mon, 10 May 2021 16:13:52 +0000 Received: from nvidia.com (172.20.145.6) by HQMAIL107.nvidia.com (172.20.187.13) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Mon, 10 May 2021 16:13:50 +0000 From: Xueming Li To: Huisong Li CC: Luca Boccassi , Min Hu , dpdk stable Date: Tue, 11 May 2021 00:00:56 +0800 Message-ID: <20210510160258.30982-107-xuemingl@nvidia.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210510160258.30982-1-xuemingl@nvidia.com> References: <20210510160258.30982-1-xuemingl@nvidia.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [172.20.145.6] X-ClientProxiedBy: HQMAIL111.nvidia.com (172.20.187.18) To HQMAIL107.nvidia.com (172.20.187.13) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 30e3b4f2-56e9-48d6-6548-08d913ce9aaa X-MS-TrafficTypeDiagnostic: CH2PR12MB4120: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:8882; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: UkgipX5A2fY+WgQAL/dxIJ7Bu1lLb2dG00T0S4wrXHd8YLEdiO1/XxcD1YlQkw8+11VaYFvZ3zyzdclqQnIv+aajtm61pLudaI6euL8SOqFOnk/+oxgw2pkRRzbMc6doll8L4qcNscg0VO5/kdxvApHybHadGC+4cKr2o9ThYM5jQTs7CsTp9FH5yjmin4zXvw+rEh73F6pKQs3VwRG86/zpQa1Q+wCibQjzVHAn9G4pH9MG1NOsQ5AuVfnVDxNcQyC9AMDNYj/T4Oi1/TTRT9wPV24F3PEjrzKEVVile2vC/tmO5VyQ8qWpnYLCB1kX6ULZGdB6XdCsLDpoqn86F2Vvdi/S10aBqCOrkvJzZeyrogXYVmqUc+hbneULLfEtk052z9TYkfFugQn8Dy/V9wfM1Qhg2L/WBaYN87+rfou2RFWdy8VcJgYzTIlh5gP3bntpdlya5nxa+zHc6MpChupPIsncp09aOyn2/dQ5cuNiSZfdKx6m9o8cl5lEp2ZQFR2kgIDIAd4OAQ4s0XFDlBK/RJMVGHNeyaGprnfQTl5HYZP/z8KBExidzXfVdywTgv2n0+Ar4Rzq+g7UfwwBMvJh7n2k3a1+wLQnq7eS5n3bsn5PjZv9heIGvM5pW5LaUsaQR4RGI7oYKgCi/sn6nrsbKkuAcx3JZ38HBskaGM3Ebx6soAEv87li/xqblXWmLfQnJqYMFtnnopRDkWOzGbghBNZbVKXsZhr+0MZ12wt9+1vDgN8xeDU/NGnan19e4du4/euhGTWOcRXmeyZZFg== X-Forefront-Antispam-Report: CIP:216.228.112.34; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:schybrid03.nvidia.com; CAT:NONE; SFS:(4636009)(39860400002)(376002)(346002)(136003)(396003)(46966006)(36840700001)(82740400003)(6286002)(2616005)(426003)(36860700001)(966005)(186003)(336012)(1076003)(47076005)(6916009)(7696005)(4326008)(7636003)(26005)(16526019)(478600001)(5660300002)(70206006)(54906003)(2906002)(8676002)(83380400001)(36756003)(55016002)(36906005)(316002)(53546011)(70586007)(8936002)(82310400003)(86362001)(356005)(15650500001); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 May 2021 16:13:52.7655 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 30e3b4f2-56e9-48d6-6548-08d913ce9aaa X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a; Ip=[216.228.112.34]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: CO1NAM11FT051.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH2PR12MB4120 Subject: [dpdk-stable] patch 'net/hns3: fix link update when failed to get link info' has been queued to stable release 20.11.2 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 Sender: "stable" Hi, FYI, your patch has been queued to stable release 20.11.2 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 05/12/21. 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/steevenlee/dpdk This queued commit can be viewed at: https://github.com/steevenlee/dpdk/commit/15b6974306cc12c09731e313f9b0f2be369fc84b Thanks. Xueming Li --- >From 15b6974306cc12c09731e313f9b0f2be369fc84b Mon Sep 17 00:00:00 2001 From: Huisong Li Date: Tue, 23 Mar 2021 21:45:55 +0800 Subject: [PATCH] net/hns3: fix link update when failed to get link info Cc: Luca Boccassi [ upstream commit 398ee80192b1d44026bcf02a27dd62a6d3df236d ] In the "hns3_dev_link_update" API, the link information of the port is obtained first, and then 'dev_link' in dev->data is updated. When the driver is resetting or fails to obtain link info, the current driver still reports the previous link info to the user. This may cause that the dev->data->dev_link may be inconsistent with the hw link status. Therefore, the link status consistency between the hardware, driver, and framework can be ensured in this interface regardless of whether the driver is normal or abnormal. Fixes: 109e4dd1bd7a ("net/hns3: get link state change through mailbox") Signed-off-by: Huisong Li Signed-off-by: Min Hu (Connor) --- drivers/net/hns3/hns3_ethdev.c | 55 +++++++++++++++++++++++----------- 1 file changed, 38 insertions(+), 17 deletions(-) diff --git a/drivers/net/hns3/hns3_ethdev.c b/drivers/net/hns3/hns3_ethdev.c index ab4fb2519a..ba26230829 100644 --- a/drivers/net/hns3/hns3_ethdev.c +++ b/drivers/net/hns3/hns3_ethdev.c @@ -2631,20 +2631,22 @@ hns3_fw_version_get(struct rte_eth_dev *eth_dev, char *fw_version, } static int -hns3_dev_link_update(struct rte_eth_dev *eth_dev, - __rte_unused int wait_to_complete) +hns3_update_port_link_info(struct rte_eth_dev *eth_dev) { - struct hns3_adapter *hns = eth_dev->data->dev_private; - struct hns3_hw *hw = &hns->hw; - struct hns3_mac *mac = &hw->mac; - struct rte_eth_link new_link; + struct hns3_hw *hw = HNS3_DEV_PRIVATE_TO_HW(eth_dev->data->dev_private); - if (!hns3_is_reset_pending(hns)) { - hns3_update_link_status(hw); - hns3_update_link_info(eth_dev); - } + (void)hns3_update_link_status(hw); + + return hns3_update_link_info(eth_dev); +} + +static void +hns3_setup_linkstatus(struct rte_eth_dev *eth_dev, + struct rte_eth_link *new_link) +{ + struct hns3_hw *hw = HNS3_DEV_PRIVATE_TO_HW(eth_dev->data->dev_private); + struct hns3_mac *mac = &hw->mac; - memset(&new_link, 0, sizeof(new_link)); switch (mac->link_speed) { case ETH_SPEED_NUM_10M: case ETH_SPEED_NUM_100M: @@ -2655,20 +2657,39 @@ hns3_dev_link_update(struct rte_eth_dev *eth_dev, case ETH_SPEED_NUM_50G: case ETH_SPEED_NUM_100G: case ETH_SPEED_NUM_200G: - new_link.link_speed = mac->link_speed; + new_link->link_speed = mac->link_speed; break; default: if (mac->link_status) - new_link.link_speed = ETH_SPEED_NUM_UNKNOWN; + new_link->link_speed = ETH_SPEED_NUM_UNKNOWN; else - new_link.link_speed = ETH_SPEED_NUM_NONE; + new_link->link_speed = ETH_SPEED_NUM_NONE; break; } - new_link.link_duplex = mac->link_duplex; - new_link.link_status = mac->link_status ? ETH_LINK_UP : ETH_LINK_DOWN; - new_link.link_autoneg = + new_link->link_duplex = mac->link_duplex; + new_link->link_status = mac->link_status ? ETH_LINK_UP : ETH_LINK_DOWN; + new_link->link_autoneg = !(eth_dev->data->dev_conf.link_speeds & ETH_LINK_SPEED_FIXED); +} + +static int +hns3_dev_link_update(struct rte_eth_dev *eth_dev, + __rte_unused int wait_to_complete) +{ + struct hns3_hw *hw = HNS3_DEV_PRIVATE_TO_HW(eth_dev->data->dev_private); + struct hns3_mac *mac = &hw->mac; + struct rte_eth_link new_link; + int ret; + + ret = hns3_update_port_link_info(eth_dev); + if (ret) { + mac->link_status = ETH_LINK_DOWN; + hns3_err(hw, "failed to get port link info, ret = %d.", ret); + } + + memset(&new_link, 0, sizeof(new_link)); + hns3_setup_linkstatus(eth_dev, &new_link); return rte_eth_linkstatus_set(eth_dev, &new_link); } -- 2.25.1 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2021-05-10 23:59:29.399467100 +0800 +++ 0108-net-hns3-fix-link-update-when-failed-to-get-link-inf.patch 2021-05-10 23:59:26.500000000 +0800 @@ -1 +1 @@ -From 398ee80192b1d44026bcf02a27dd62a6d3df236d Mon Sep 17 00:00:00 2001 +From 15b6974306cc12c09731e313f9b0f2be369fc84b Mon Sep 17 00:00:00 2001 @@ -4,0 +5,3 @@ +Cc: Luca Boccassi + +[ upstream commit 398ee80192b1d44026bcf02a27dd62a6d3df236d ] @@ -17 +19,0 @@ -Cc: stable@dpdk.org @@ -26 +28 @@ -index 9a57cc6b62..9c718082b0 100644 +index ab4fb2519a..ba26230829 100644 @@ -29 +31 @@ -@@ -2698,20 +2698,22 @@ hns3_fw_version_get(struct rte_eth_dev *eth_dev, char *fw_version, +@@ -2631,20 +2631,22 @@ hns3_fw_version_get(struct rte_eth_dev *eth_dev, char *fw_version, @@ -63 +65 @@ -@@ -2722,20 +2724,39 @@ hns3_dev_link_update(struct rte_eth_dev *eth_dev, +@@ -2655,20 +2657,39 @@ hns3_dev_link_update(struct rte_eth_dev *eth_dev,