From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 02FE8A0093 for ; Tue, 19 May 2020 15:06:18 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id EF2E41D603; Tue, 19 May 2020 15:06:17 +0200 (CEST) Received: from mail-wr1-f68.google.com (mail-wr1-f68.google.com [209.85.221.68]) by dpdk.org (Postfix) with ESMTP id 91AA11D62D for ; Tue, 19 May 2020 15:06:16 +0200 (CEST) Received: by mail-wr1-f68.google.com with SMTP id 50so15785054wrc.11 for ; Tue, 19 May 2020 06:06:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=HiqQiybS1vXlRwUeZy5ydDMRDgMYIK9oSvNb8VXjA0Q=; b=kbNRWHN9EcAUxAoBFOCQPErKQEOVHpfj0kYdI4pKsRVhgYOmPDeaA3dM6/NAZ6hjqD qj4B6db22GSo/adqoDsIRNlfqZmM/m1GpUv++9v6fYEtJ9RB4v9eyhzf92KHbDYjT72w mewzhv9spjT1QPgZi38CYroYzsuFG/X7XSXV3MNhrnof2Gm+bH3Mmj4kty2hRShYSQnu FkxBniT4AEKWRb6QXP49bEp/wY9CTXVjjdukbnjxlFhpUQRveFvUalbV4O59eILfYPyr vxEjUiGkS7WSmSLPcK5UGLjhBLTFyaI8BUCe19Cmy3RNBfY1lZPB4Fe8kispjsN3Ib2w So1A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=HiqQiybS1vXlRwUeZy5ydDMRDgMYIK9oSvNb8VXjA0Q=; b=dDD2ee/a937nWR0CE8p1TKnNWl2MqJV9WG5OP28smfsd1D8yNGDTaMY/NCyPAq1msz 05M2+lsQmEJPRh0qikxza8p87uhBxaHeLN3Bj8MhcbelzSEG7fcn4laF1eU4Dirp2kxu bVomFFfYSD1Db7gVKL7OT+KLtoiJ3/Rmo351OwDul8jssSHW4ClR4Q076H7ZxitogXR0 bJjzdzsx7dmnGdsfId7IWbYfHCcGfzpJTe/CXXFy/eZ+odGd2KgC1OChJu2PBHySdfgq wels8M4huW16Kew9iGxUW0ZvYPaHNrlARlYIjRh9Z3q/6r/yZ5oYuVtr03NTNH/kv1vG 9fmQ== X-Gm-Message-State: AOAM532s4BdkIzUwGn+vKUx0FVk5FRRW0klZLiMEe/n+IVZkWFS4J4Y6 5TM/eM8TT1ASVb+/3yF25dg6MO187Bw5px3N X-Google-Smtp-Source: ABdhPJya1HjfKifDcGaOeaKNA+u9OMH/zFVOdEIbxo/aKgwN6awjCU/wwcCIRE/oDcipKW8/UAvMVg== X-Received: by 2002:adf:9264:: with SMTP id 91mr25552704wrj.362.1589893576300; Tue, 19 May 2020 06:06:16 -0700 (PDT) Received: from localhost ([88.98.246.218]) by smtp.gmail.com with ESMTPSA id l19sm3993210wmj.14.2020.05.19.06.06.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 May 2020 06:06:15 -0700 (PDT) From: luca.boccassi@gmail.com To: "Wei Hu (Xavier)" Cc: Hongbo Zheng , Chunsong Feng , dpdk stable Date: Tue, 19 May 2020 14:02:23 +0100 Message-Id: <20200519130549.112823-8-luca.boccassi@gmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200519130549.112823-1-luca.boccassi@gmail.com> References: <20200519125804.104349-1-luca.boccassi@gmail.com> <20200519130549.112823-1-luca.boccassi@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-stable] patch 'net/hns3: fix status after repeated resets' has been queued to stable release 19.11.3 X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.15 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 19.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 05/21/20. 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. Thanks. Luca Boccassi --- >From 7caa43cc2266a8110cb1a5ac876ad30f6d4990e6 Mon Sep 17 00:00:00 2001 From: "Wei Hu (Xavier)" Date: Tue, 17 Mar 2020 17:12:06 +0800 Subject: [PATCH] net/hns3: fix status after repeated resets [ upstream commit 25d257facdbc79ef0f99ee3505f3a233e1bbfeac ] Currently, when performing the following test case: 1. Run testpmd application based on hns3 PF device. 2. Inject reset(global/IMP reset) repeatedly. After the reset, the network port can't link up. In the RESET_STAGE_DEV_INIT stage of the reset process, the driver will reinitialize the hardware. If global/IMP reset occurs at this time again, the operation of reinitialize the hardware will fail because that firmware don't respond to the configuration commands issued by driver. In current driver, when failed to reinitialize the hardware, rollback operation is done, such as clearing the relevant configuration of the command queue registers. If firmware detects that the function's command queue register is not configured correctly, it will not complete the reset related hardware configuration for this function, resulting in that driver can't detect that the hardware reset has been completed. And then the reset process of the driver exit abnormally, the hardware can not work normally after reset. This patch fixes it by avoid clearing the command queue related registers when failed to reinitialize the hardware in the RESET_STAGE_DEV_INIT stage of the reset process. Fixes: 2790c6464725 ("net/hns3: support device reset") Signed-off-by: Hongbo Zheng Signed-off-by: Wei Hu (Xavier) Signed-off-by: Chunsong Feng --- drivers/net/hns3/hns3_cmd.c | 2 +- drivers/net/hns3/hns3_ethdev.c | 18 ++++-------------- drivers/net/hns3/hns3_ethdev_vf.c | 16 ++++------------ 3 files changed, 9 insertions(+), 27 deletions(-) diff --git a/drivers/net/hns3/hns3_cmd.c b/drivers/net/hns3/hns3_cmd.c index c85168b319..c7993634e3 100644 --- a/drivers/net/hns3/hns3_cmd.c +++ b/drivers/net/hns3/hns3_cmd.c @@ -529,7 +529,7 @@ hns3_cmd_init(struct hns3_hw *hw) return 0; err_cmd_init: - hns3_cmd_uninit(hw); + rte_atomic16_set(&hw->reset.disable_cmd, 1); return ret; } diff --git a/drivers/net/hns3/hns3_ethdev.c b/drivers/net/hns3/hns3_ethdev.c index 688227e0eb..7c4c2e42c0 100644 --- a/drivers/net/hns3/hns3_ethdev.c +++ b/drivers/net/hns3/hns3_ethdev.c @@ -3992,13 +3992,10 @@ err_get_config: rte_intr_disable(&pci_dev->intr_handle); hns3_intr_unregister(&pci_dev->intr_handle, hns3_interrupt_handler, eth_dev); - err_intr_callback_register: - hns3_cmd_uninit(hw); - err_cmd_init: + hns3_cmd_uninit(hw); hns3_cmd_destroy_queue(hw); - err_cmd_init_queue: hw->io_base = NULL; @@ -4367,31 +4364,24 @@ hns3_reinit_dev(struct hns3_adapter *hns) ret = hns3_reset_all_queues(hns); if (ret) { hns3_err(hw, "Failed to reset all queues: %d", ret); - goto err_init; + return ret; } ret = hns3_init_hardware(hns); if (ret) { hns3_err(hw, "Failed to init hardware: %d", ret); - goto err_init; + return ret; } ret = hns3_enable_hw_error_intr(hns, true); if (ret) { hns3_err(hw, "fail to enable hw error interrupts: %d", ret); - goto err_mac_init; + return ret; } hns3_info(hw, "Reset done, driver initialization finished."); return 0; - -err_mac_init: - hns3_uninit_umv_space(hw); -err_init: - hns3_cmd_uninit(hw); - - return ret; } static bool diff --git a/drivers/net/hns3/hns3_ethdev_vf.c b/drivers/net/hns3/hns3_ethdev_vf.c index 2c792b1761..2096ad6fcd 100644 --- a/drivers/net/hns3/hns3_ethdev_vf.c +++ b/drivers/net/hns3/hns3_ethdev_vf.c @@ -1176,11 +1176,9 @@ err_get_config: hns3_intr_unregister(&pci_dev->intr_handle, hns3vf_interrupt_handler, eth_dev); err_intr_callback_register: - hns3_cmd_uninit(hw); - err_cmd_init: + hns3_cmd_uninit(hw); hns3_cmd_destroy_queue(hw); - err_cmd_init_queue: hw->io_base = NULL; @@ -1633,7 +1631,7 @@ hns3vf_reinit_dev(struct hns3_adapter *hns) ret = hns3_cmd_init(hw); if (ret) { hns3_err(hw, "Failed to init cmd: %d", ret); - goto err_cmd_init; + return ret; } if (hw->reset.level == HNS3_VF_FULL_RESET) { @@ -1653,22 +1651,16 @@ hns3vf_reinit_dev(struct hns3_adapter *hns) ret = hns3_reset_all_queues(hns); if (ret) { hns3_err(hw, "Failed to reset all queues: %d", ret); - goto err_init; + return ret; } ret = hns3vf_init_hardware(hns); if (ret) { hns3_err(hw, "Failed to init hardware: %d", ret); - goto err_init; + return ret; } return 0; - -err_cmd_init: - hns3vf_set_bus_master(pci_dev, false); -err_init: - hns3_cmd_uninit(hw); - return ret; } static const struct eth_dev_ops hns3vf_eth_dev_ops = { -- 2.20.1 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2020-05-19 14:04:44.919193988 +0100 +++ 0008-net-hns3-fix-status-after-repeated-resets.patch 2020-05-19 14:04:44.060645545 +0100 @@ -1,8 +1,10 @@ -From 25d257facdbc79ef0f99ee3505f3a233e1bbfeac Mon Sep 17 00:00:00 2001 +From 7caa43cc2266a8110cb1a5ac876ad30f6d4990e6 Mon Sep 17 00:00:00 2001 From: "Wei Hu (Xavier)" Date: Tue, 17 Mar 2020 17:12:06 +0800 Subject: [PATCH] net/hns3: fix status after repeated resets +[ upstream commit 25d257facdbc79ef0f99ee3505f3a233e1bbfeac ] + Currently, when performing the following test case: 1. Run testpmd application based on hns3 PF device. 2. Inject reset(global/IMP reset) repeatedly. @@ -28,7 +30,6 @@ RESET_STAGE_DEV_INIT stage of the reset process. Fixes: 2790c6464725 ("net/hns3: support device reset") -Cc: stable@dpdk.org Signed-off-by: Hongbo Zheng Signed-off-by: Wei Hu (Xavier) @@ -53,10 +54,10 @@ } diff --git a/drivers/net/hns3/hns3_ethdev.c b/drivers/net/hns3/hns3_ethdev.c -index a715354573..94e8b8ab98 100644 +index 688227e0eb..7c4c2e42c0 100644 --- a/drivers/net/hns3/hns3_ethdev.c +++ b/drivers/net/hns3/hns3_ethdev.c -@@ -4126,13 +4126,10 @@ err_get_config: +@@ -3992,13 +3992,10 @@ err_get_config: rte_intr_disable(&pci_dev->intr_handle); hns3_intr_unregister(&pci_dev->intr_handle, hns3_interrupt_handler, eth_dev); @@ -71,7 +72,7 @@ err_cmd_init_queue: hw->io_base = NULL; -@@ -4610,31 +4607,24 @@ hns3_reinit_dev(struct hns3_adapter *hns) +@@ -4367,31 +4364,24 @@ hns3_reinit_dev(struct hns3_adapter *hns) ret = hns3_reset_all_queues(hns); if (ret) { hns3_err(hw, "Failed to reset all queues: %d", ret); @@ -107,10 +108,10 @@ static bool diff --git a/drivers/net/hns3/hns3_ethdev_vf.c b/drivers/net/hns3/hns3_ethdev_vf.c -index febce865bd..e7e2cba824 100644 +index 2c792b1761..2096ad6fcd 100644 --- a/drivers/net/hns3/hns3_ethdev_vf.c +++ b/drivers/net/hns3/hns3_ethdev_vf.c -@@ -1486,11 +1486,9 @@ err_get_config: +@@ -1176,11 +1176,9 @@ err_get_config: hns3_intr_unregister(&pci_dev->intr_handle, hns3vf_interrupt_handler, eth_dev); err_intr_callback_register: @@ -123,7 +124,7 @@ err_cmd_init_queue: hw->io_base = NULL; -@@ -2104,7 +2102,7 @@ hns3vf_reinit_dev(struct hns3_adapter *hns) +@@ -1633,7 +1631,7 @@ hns3vf_reinit_dev(struct hns3_adapter *hns) ret = hns3_cmd_init(hw); if (ret) { hns3_err(hw, "Failed to init cmd: %d", ret); @@ -132,7 +133,7 @@ } if (hw->reset.level == HNS3_VF_FULL_RESET) { -@@ -2124,22 +2122,16 @@ hns3vf_reinit_dev(struct hns3_adapter *hns) +@@ -1653,22 +1651,16 @@ hns3vf_reinit_dev(struct hns3_adapter *hns) ret = hns3_reset_all_queues(hns); if (ret) { hns3_err(hw, "Failed to reset all queues: %d", ret);