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 7E88EA0C3F for ; Sat, 12 Jun 2021 01:20:48 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 6FC7941104; Sat, 12 Jun 2021 01:20:48 +0200 (CEST) Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11on2055.outbound.protection.outlook.com [40.107.223.55]) by mails.dpdk.org (Postfix) with ESMTP id 32F004003F for ; Sat, 12 Jun 2021 01:20:47 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=hEQh8xZKRXyOAB9jN3/tZwl3iv7CpxTqtGHhl8iFNo6eGz1cnN9cR67eOh9TQI6x38ez64qh/uFIoutp7NL2ZqhtdoLHBnrv59Q34+8AgfQDV1dNxWPI14VyPjyYr+ULX3DUfelsaj0y2NNDqyeqQFkC26eD2YzJx7QHEiNIHoIKtz+sVc09WIb+NaaDYXq5CnMMz185KP0+xU/CR1Gf5QiMjky7CJqoKPfHCSMjOkRlFOE3T9nUqtdEkBzmz7pKQjNDtnzflzce0LUVdrw1wpmfMS1wvqkShjtWlNK4MkSZdju7Z7FJrhsAZS6DX6XLl+uG5vavR+Kaklvd5hjsIg== 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=b6cyp+Zi2+gUKzhZBNXys5IGHlZchIax1pmSU6NV/fo=; b=lJstfNKB6qwxC8zfdFlkneakAtcVANJeIImK9RiDaLxAWrYGh6lkarMcahbAJDVG9FpE8LfHDck22xUVlrVjLwEpYGpOT4+dN+N77SQtiLuPTT9bUJRtyr5wax5J1WBTGq1mTPmv3jhBseXXeczDC/u/UlMcVKpRsvoOXw4/RUDuf6n3+PCz0Vs0iG/dNxCPq6Nzbdcr7p7Pzeqf9BRicjCUR61Z2CCU6O2jX7oztVzmb0tUU7yqFx4sOjlu62nreNUeMzYUPFJXL3JyW8pgN333A4gh5BSdM63bBW0mfiRTGGx6W8WZPncc62oQk+HdVySak5jfYmgb5yHwOStNzg== 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=b6cyp+Zi2+gUKzhZBNXys5IGHlZchIax1pmSU6NV/fo=; b=KHaRUFjbz9b/0KIXCe3hBWBPx851OOJFqaJ6rtFgSM+ITpOjHMeZwP0zIBTFplnw0as19dUjFjxXIVangPVXf212H1jM4ZMl6fMK5fUTmagaIuHv3vjbMmlLBEHk/4dusi8r+duLP/v59Yh1dcBmPqLtFdP5yl4wdUBtCPLGh02YXjRD1L/ujfWHocaJuuqCbfO/3v9X87o/8IsBi6j94UJD4wr7IPRF3fHsgks0CY6CykZB3Qbv2TTM8hWcqTsvF/gKHBkaEUs12msu/0SbwN/ZaH/A9HKtDj2yP3Up4DqYKwpU+XGgrNKndRYT/v7OTESGKzyEHNI3NuORJYjEvA== Received: from DM6PR07CA0048.namprd07.prod.outlook.com (2603:10b6:5:74::25) by BN9PR12MB5382.namprd12.prod.outlook.com (2603:10b6:408:103::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4219.22; Fri, 11 Jun 2021 23:20:45 +0000 Received: from DM6NAM11FT027.eop-nam11.prod.protection.outlook.com (2603:10b6:5:74:cafe::59) by DM6PR07CA0048.outlook.office365.com (2603:10b6:5:74::25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4219.21 via Frontend Transport; Fri, 11 Jun 2021 23:20:45 +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 DM6NAM11FT027.mail.protection.outlook.com (10.13.172.205) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.4219.21 via Frontend Transport; Fri, 11 Jun 2021 23:20:45 +0000 Received: from nvidia.com (172.20.187.5) by HQMAIL107.nvidia.com (172.20.187.13) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Fri, 11 Jun 2021 23:20:43 +0000 From: Xueming Li To: Huisong Li CC: Luca Boccassi , Min Hu , dpdk stable Date: Sat, 12 Jun 2021 07:04:22 +0800 Message-ID: <20210611230433.8208-168-xuemingl@nvidia.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210611230433.8208-1-xuemingl@nvidia.com> References: <20210510160258.30982-229-xuemingl@nvidia.com> <20210611230433.8208-1-xuemingl@nvidia.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [172.20.187.5] X-ClientProxiedBy: HQMAIL105.nvidia.com (172.20.187.12) To HQMAIL107.nvidia.com (172.20.187.13) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 18d45636-adae-4b1f-0091-08d92d2f8a22 X-MS-TrafficTypeDiagnostic: BN9PR12MB5382: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:10000; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: evCe3NQ5PAqgpoQyGpxU1P7KBPSAvxIxkFJr/7eYM2xeZzG910BwOjx90JPbvRfuM+afNPsAyOxxjB6YPmQSIUTMg61xLtneYJl3V6A4jTCz8/pcabPm9M78sxMO44pHnRIOGc8cG+1Prl6Xvfb6/0CPbE18jleP4QOU1nFqlgMNKB8QZT2o+JQgBdtsPVtGuuZKLlGAKoiyxWNREis8SYR0kXy0+VlVWd/8PGHbS5NyMcN00cfn1vwPByzcPUxbWQlhoYWjBK1EZ//J0L0MXMZNXFfn31x1Verj+cj7MtOit8Yk4xfydq6U5Dcle8JL+P7CreQjhyv1yl1jgntSGeTI09baYevWW1O6JajK0QKRZRydKCJ2LLfZMAuw5EHwQ2erPvJOJ5k+HrU/dus44W0VO55OYtF15zbqShgZke+wFE8mXAjAKqwU/yyRJoPnOI76ovQFXBJWaS3eh7ZbvXNkFjl6nJJcWV1FBov7AhFWtLOERpyOHOwUAYoab73DhL/X8WWMOfcdu1FvY2XhY/Ld0wuv7M73lrHtH08OhBT47IUHuUoJMv2WVZQVDLCvLB8Va5p9XVyfHSW5r/piHQ8BSLas9G+I10j2G4sGz2sc/jrDxTkYg6B8v8j4xHiVuYkqQ3JZl6xAPbhucoSs+R1punkBZoy5YWS5t3tbAufho5eHw1BY0Nte194DtrWf8fzfFsxrtPMx5QZgObibonJtDWt2wJCHyc5Qq6FUDS/XwBgP4sULypAWjjdFCG4MNrDCt/q1f9tURA8aZmqzhM25GqBY8TCBVwq6TXqaFxRNtKaawfi2yMMWNwAz0zd3 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)(136003)(39860400002)(376002)(396003)(346002)(36840700001)(46966006)(55016002)(83380400001)(82740400003)(36860700001)(6286002)(6666004)(7636003)(36906005)(26005)(7696005)(82310400003)(2906002)(47076005)(8936002)(2616005)(4326008)(36756003)(1076003)(8676002)(86362001)(316002)(53546011)(336012)(478600001)(16526019)(186003)(426003)(966005)(6916009)(5660300002)(54906003)(356005)(70586007)(70206006); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Jun 2021 23:20:45.2443 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 18d45636-adae-4b1f-0091-08d92d2f8a22 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: DM6NAM11FT027.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN9PR12MB5382 Subject: [dpdk-stable] patch 'net/hns3: fix requested FC mode rollback' 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 06/14/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/47af5229ce0a272be51ae904dc65b944b6f47d19 Thanks. Xueming Li --- >From 47af5229ce0a272be51ae904dc65b944b6f47d19 Mon Sep 17 00:00:00 2001 From: Huisong Li Date: Sat, 15 May 2021 08:52:34 +0800 Subject: [PATCH] net/hns3: fix requested FC mode rollback Cc: Luca Boccassi [ upstream commit 19603f63fbb77f6ceddce9d36d20a6f5d7cdd4cf ] Currently, the "requested_fc_mode" lacks rollback when enabling link FC or PFC fails. For example, this may result an incorrect FC mode after a reset. Fixes: d4fdb71a0e7b ("net/hns3: fix flow control mode") Fixes: 62e3ccc2b94c ("net/hns3: support flow control") Signed-off-by: Huisong Li Signed-off-by: Min Hu (Connor) --- drivers/net/hns3/hns3_dcb.c | 30 ++++++++++++++++++++++++++++++ drivers/net/hns3/hns3_ethdev.c | 28 ---------------------------- 2 files changed, 30 insertions(+), 28 deletions(-) diff --git a/drivers/net/hns3/hns3_dcb.c b/drivers/net/hns3/hns3_dcb.c index cbfcb11ed0..e5b6915d17 100644 --- a/drivers/net/hns3/hns3_dcb.c +++ b/drivers/net/hns3/hns3_dcb.c @@ -1717,6 +1717,30 @@ hns3_dcb_cfg_update(struct hns3_adapter *hns) return ret; } +static void +hns3_get_fc_mode(struct hns3_hw *hw, enum rte_eth_fc_mode mode) +{ + switch (mode) { + case RTE_FC_NONE: + hw->requested_fc_mode = HNS3_FC_NONE; + break; + case RTE_FC_RX_PAUSE: + hw->requested_fc_mode = HNS3_FC_RX_PAUSE; + break; + case RTE_FC_TX_PAUSE: + hw->requested_fc_mode = HNS3_FC_TX_PAUSE; + break; + case RTE_FC_FULL: + hw->requested_fc_mode = HNS3_FC_FULL; + break; + default: + hw->requested_fc_mode = HNS3_FC_NONE; + hns3_warn(hw, "fc_mode(%u) exceeds member scope and is " + "configured to RTE_FC_NONE", mode); + break; + } +} + /* * hns3_dcb_pfc_enable - Enable priority flow control * @dev: pointer to ethernet device @@ -1729,6 +1753,7 @@ hns3_dcb_pfc_enable(struct rte_eth_dev *dev, struct rte_eth_pfc_conf *pfc_conf) struct hns3_hw *hw = HNS3_DEV_PRIVATE_TO_HW(dev->data->dev_private); struct hns3_pf *pf = HNS3_DEV_PRIVATE_TO_PF(dev->data->dev_private); enum hns3_fc_status fc_status = hw->current_fc_status; + enum hns3_fc_mode old_fc_mode = hw->requested_fc_mode; uint8_t hw_pfc_map = hw->dcb_info.hw_pfc_map; uint8_t pfc_en = hw->dcb_info.pfc_en; uint8_t priority = pfc_conf->priority; @@ -1736,6 +1761,7 @@ hns3_dcb_pfc_enable(struct rte_eth_dev *dev, struct rte_eth_pfc_conf *pfc_conf) int ret, status; pf->pause_time = pfc_conf->fc.pause_time; + hns3_get_fc_mode(hw, pfc_conf->fc.mode); hw->current_fc_status = HNS3_FC_STATUS_PFC; hw->dcb_info.pfc_en |= BIT(priority); hw->dcb_info.hw_pfc_map = @@ -1757,6 +1783,7 @@ hns3_dcb_pfc_enable(struct rte_eth_dev *dev, struct rte_eth_pfc_conf *pfc_conf) return 0; pfc_setup_fail: + hw->requested_fc_mode = old_fc_mode; hw->current_fc_status = fc_status; pf->pause_time = pause_time; hw->dcb_info.pfc_en = pfc_en; @@ -1779,11 +1806,13 @@ hns3_fc_enable(struct rte_eth_dev *dev, struct rte_eth_fc_conf *fc_conf) { struct hns3_hw *hw = HNS3_DEV_PRIVATE_TO_HW(dev->data->dev_private); struct hns3_pf *pf = HNS3_DEV_PRIVATE_TO_PF(dev->data->dev_private); + enum hns3_fc_mode old_fc_mode = hw->requested_fc_mode; enum hns3_fc_status fc_status = hw->current_fc_status; uint16_t pause_time = pf->pause_time; int ret; pf->pause_time = fc_conf->pause_time; + hns3_get_fc_mode(hw, fc_conf->mode); /* * In fact, current_fc_status is HNS3_FC_STATUS_NONE when mode @@ -1803,6 +1832,7 @@ hns3_fc_enable(struct rte_eth_dev *dev, struct rte_eth_fc_conf *fc_conf) return 0; setup_fc_fail: + hw->requested_fc_mode = old_fc_mode; hw->current_fc_status = fc_status; pf->pause_time = pause_time; diff --git a/drivers/net/hns3/hns3_ethdev.c b/drivers/net/hns3/hns3_ethdev.c index 5716e399c9..907fa43257 100644 --- a/drivers/net/hns3/hns3_ethdev.c +++ b/drivers/net/hns3/hns3_ethdev.c @@ -5241,30 +5241,6 @@ hns3_flow_ctrl_get(struct rte_eth_dev *dev, struct rte_eth_fc_conf *fc_conf) return 0; } -static void -hns3_get_fc_mode(struct hns3_hw *hw, enum rte_eth_fc_mode mode) -{ - switch (mode) { - case RTE_FC_NONE: - hw->requested_fc_mode = HNS3_FC_NONE; - break; - case RTE_FC_RX_PAUSE: - hw->requested_fc_mode = HNS3_FC_RX_PAUSE; - break; - case RTE_FC_TX_PAUSE: - hw->requested_fc_mode = HNS3_FC_TX_PAUSE; - break; - case RTE_FC_FULL: - hw->requested_fc_mode = HNS3_FC_FULL; - break; - default: - hw->requested_fc_mode = HNS3_FC_NONE; - hns3_warn(hw, "fc_mode(%u) exceeds member scope and is " - "configured to RTE_FC_NONE", mode); - break; - } -} - static int hns3_flow_ctrl_set(struct rte_eth_dev *dev, struct rte_eth_fc_conf *fc_conf) { @@ -5302,8 +5278,6 @@ hns3_flow_ctrl_set(struct rte_eth_dev *dev, struct rte_eth_fc_conf *fc_conf) return -EOPNOTSUPP; } - hns3_get_fc_mode(hw, fc_conf->mode); - rte_spinlock_lock(&hw->lock); ret = hns3_fc_enable(dev, fc_conf); rte_spinlock_unlock(&hw->lock); @@ -5350,8 +5324,6 @@ hns3_priority_flow_ctrl_set(struct rte_eth_dev *dev, return -EOPNOTSUPP; } - hns3_get_fc_mode(hw, pfc_conf->fc.mode); - rte_spinlock_lock(&hw->lock); ret = hns3_dcb_pfc_enable(dev, pfc_conf); rte_spinlock_unlock(&hw->lock); -- 2.25.1 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2021-06-12 06:54:00.796482100 +0800 +++ 0168-net-hns3-fix-requested-FC-mode-rollback.patch 2021-06-12 06:53:56.660000000 +0800 @@ -1 +1 @@ -From 19603f63fbb77f6ceddce9d36d20a6f5d7cdd4cf Mon Sep 17 00:00:00 2001 +From 47af5229ce0a272be51ae904dc65b944b6f47d19 Mon Sep 17 00:00:00 2001 @@ -4,0 +5,3 @@ +Cc: Luca Boccassi + +[ upstream commit 19603f63fbb77f6ceddce9d36d20a6f5d7cdd4cf ] @@ -12 +14,0 @@ -Cc: stable@dpdk.org @@ -22 +24 @@ -index ab307f1f54..bea41156a4 100644 +index cbfcb11ed0..e5b6915d17 100644 @@ -25 +27 @@ -@@ -1760,6 +1760,30 @@ hns3_dcb_cfg_update(struct hns3_adapter *hns) +@@ -1717,6 +1717,30 @@ hns3_dcb_cfg_update(struct hns3_adapter *hns) @@ -56 +58 @@ -@@ -1772,6 +1796,7 @@ hns3_dcb_pfc_enable(struct rte_eth_dev *dev, struct rte_eth_pfc_conf *pfc_conf) +@@ -1729,6 +1753,7 @@ hns3_dcb_pfc_enable(struct rte_eth_dev *dev, struct rte_eth_pfc_conf *pfc_conf) @@ -64 +66 @@ -@@ -1779,6 +1804,7 @@ hns3_dcb_pfc_enable(struct rte_eth_dev *dev, struct rte_eth_pfc_conf *pfc_conf) +@@ -1736,6 +1761,7 @@ hns3_dcb_pfc_enable(struct rte_eth_dev *dev, struct rte_eth_pfc_conf *pfc_conf) @@ -72 +74 @@ -@@ -1800,6 +1826,7 @@ hns3_dcb_pfc_enable(struct rte_eth_dev *dev, struct rte_eth_pfc_conf *pfc_conf) +@@ -1757,6 +1783,7 @@ hns3_dcb_pfc_enable(struct rte_eth_dev *dev, struct rte_eth_pfc_conf *pfc_conf) @@ -80 +82 @@ -@@ -1822,11 +1849,13 @@ hns3_fc_enable(struct rte_eth_dev *dev, struct rte_eth_fc_conf *fc_conf) +@@ -1779,11 +1806,13 @@ hns3_fc_enable(struct rte_eth_dev *dev, struct rte_eth_fc_conf *fc_conf) @@ -94 +96 @@ -@@ -1846,6 +1875,7 @@ hns3_fc_enable(struct rte_eth_dev *dev, struct rte_eth_fc_conf *fc_conf) +@@ -1803,6 +1832,7 @@ hns3_fc_enable(struct rte_eth_dev *dev, struct rte_eth_fc_conf *fc_conf) @@ -103 +105 @@ -index 0589e3f10a..f49f220062 100644 +index 5716e399c9..907fa43257 100644 @@ -106 +108 @@ -@@ -6059,30 +6059,6 @@ hns3_flow_ctrl_get(struct rte_eth_dev *dev, struct rte_eth_fc_conf *fc_conf) +@@ -5241,30 +5241,6 @@ hns3_flow_ctrl_get(struct rte_eth_dev *dev, struct rte_eth_fc_conf *fc_conf) @@ -135 +137 @@ - hns3_check_fc_autoneg_valid(struct hns3_hw *hw, uint8_t autoneg) + hns3_flow_ctrl_set(struct rte_eth_dev *dev, struct rte_eth_fc_conf *fc_conf) @@ -137 +139 @@ -@@ -6156,8 +6132,6 @@ hns3_flow_ctrl_set(struct rte_eth_dev *dev, struct rte_eth_fc_conf *fc_conf) +@@ -5302,8 +5278,6 @@ hns3_flow_ctrl_set(struct rte_eth_dev *dev, struct rte_eth_fc_conf *fc_conf) @@ -146 +148 @@ -@@ -6204,8 +6178,6 @@ hns3_priority_flow_ctrl_set(struct rte_eth_dev *dev, +@@ -5350,8 +5324,6 @@ hns3_priority_flow_ctrl_set(struct rte_eth_dev *dev,