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 46CDEA0518 for ; Fri, 24 Jul 2020 14:08:08 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 3DC811BFE7; Fri, 24 Jul 2020 14:08:08 +0200 (CEST) Received: from mail-wm1-f68.google.com (mail-wm1-f68.google.com [209.85.128.68]) by dpdk.org (Postfix) with ESMTP id ECBAD1BFE7 for ; Fri, 24 Jul 2020 14:08:06 +0200 (CEST) Received: by mail-wm1-f68.google.com with SMTP id p14so7387882wmg.1 for ; Fri, 24 Jul 2020 05:08:06 -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=631P1+Uyke0SeEyGU+nF5XnmMdFz+iltE3zwAb90fb0=; b=GfughZxAAviR5xZ+winyc4MmAIJKFAzselg74kmpIWJfjuzK4jSrPTgFBtRhRbJMNC iAG1I0o+zt86OfLj0Qw0IYqmq8tjKAPfMgEXq3XOB2Xtw+mo/7AEPHrfgztXRY6zASeZ p/0lV5X0ldTToXjm/uYJuOzVqHXF619wCNWFChyFFLWqGuOKD47ASBZ9hZRfOv80FfC/ B9eTz2s0dyJfrrVaQYKn3PQfuqxmRpzH0hFOkFuHpNZ54LsHxo7/IB8fCEhVE74yYOAk Suy/fymiFyM9jxfM7UjAl+T0gxE79f8gkQX8D65mgTaCjjyBDf+H4YF3usD6ZNbbap9Z sjxQ== 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=631P1+Uyke0SeEyGU+nF5XnmMdFz+iltE3zwAb90fb0=; b=cpyyVrjrRVfWuWEKuaxAdiZZeDg2PF5O/1Uacj9hYUyAuud5OxvZnhnvZ8n6CX4lL4 Kua+l3XnGtzLZsKe+E7KtvsQuPst4ctrtyQiW61HEB+CHzldgiu8WihTutcVDxbyQfKA cWjOKZcFovnxjr8RamLwu5eCk9tUgYPd0qmu/L1xYJYu51E5P4gal9nVqcZNF7kUEUyN PrrPrn1oiZAe+eXl8Cd10H097yeqBs6rlMWNR0wub3NNZja94/S1S4reY5pMDbfaPBUx pFFhnbRy/SwUNweOkZ9sB4HU1oZWmXd4IzQTCQ3VYkmwXdJyv6xofwBvBauJ65/EQ7L9 00tQ== X-Gm-Message-State: AOAM531V2Yp2cAioKCwVPhGJG6uihqjCFI1fiR+2wyxwwYSrsO5H6b1x FW1b9aF9k92KfMxbRZVwN40= X-Google-Smtp-Source: ABdhPJy+wmQag2Nd5pioMwB1IEvqxTDMyWekzo7ydtuqEDdBLPnHLp1VMi//FpaDNUTzTJWfqZgB9Q== X-Received: by 2002:a05:600c:2209:: with SMTP id z9mr8299545wml.70.1595592486709; Fri, 24 Jul 2020 05:08:06 -0700 (PDT) Received: from localhost ([88.98.246.218]) by smtp.gmail.com with ESMTPSA id f15sm1046869wrx.91.2020.07.24.05.08.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 Jul 2020 05:08:05 -0700 (PDT) From: luca.boccassi@gmail.com To: Hongbo Zheng Cc: Wei Hu , Chengwen Feng , dpdk stable Date: Fri, 24 Jul 2020 12:59:09 +0100 Message-Id: <20200724120030.1863487-111-luca.boccassi@gmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200724120030.1863487-1-luca.boccassi@gmail.com> References: <20200724120030.1863487-1-luca.boccassi@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-stable] patch 'net/hns3: clear residual hardware configurations on init' has been queued to stable release 19.11.4 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.4 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 07/26/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 aaf0005929b0723a19ff3f49f8da325523d91d57 Mon Sep 17 00:00:00 2001 From: Hongbo Zheng Date: Wed, 1 Jul 2020 19:54:38 +0800 Subject: [PATCH] net/hns3: clear residual hardware configurations on init [ upstream commit 223d9eceaeeeb4d5156d4c96eec1a34434d6ecab ] When the last driver exits abnormally, for example, it is killed by 'kill -9', it may be too late to clear the configuration and cause the configuration to remain. Therefore, to ensure that the hardware environment is clean during initialization, the PF driver actively clear the hardware environment during initialization, including PF and corresponding VFs' vlan, mac, flow table configurations, etc. Fixes: d51867db65c1 ("net/hns3: add initialization") Signed-off-by: Hongbo Zheng Signed-off-by: Wei Hu (Xavier) Signed-off-by: Chengwen Feng --- drivers/net/hns3/hns3_cmd.h | 3 +++ drivers/net/hns3/hns3_ethdev.c | 27 +++++++++++++++++++++++++++ 2 files changed, 30 insertions(+) diff --git a/drivers/net/hns3/hns3_cmd.h b/drivers/net/hns3/hns3_cmd.h index 26d410396..ab16b07a6 100644 --- a/drivers/net/hns3/hns3_cmd.h +++ b/drivers/net/hns3/hns3_cmd.h @@ -207,6 +207,9 @@ enum hns3_opcode_type { HNS3_OPC_FD_AD_OP = 0x1204, HNS3_OPC_FD_COUNTER_OP = 0x1205, + /* Clear hardware state command */ + HNS3_OPC_CLEAR_HW_STATE = 0x700A, + /* SFP command */ HNS3_OPC_SFP_GET_SPEED = 0x7104, diff --git a/drivers/net/hns3/hns3_ethdev.c b/drivers/net/hns3/hns3_ethdev.c index f1066c079..4a1bb174c 100644 --- a/drivers/net/hns3/hns3_ethdev.c +++ b/drivers/net/hns3/hns3_ethdev.c @@ -4180,6 +4180,21 @@ err_mac_init: return ret; } +static int +hns3_clear_hw(struct hns3_hw *hw) +{ + struct hns3_cmd_desc desc; + int ret; + + hns3_cmd_setup_basic_desc(&desc, HNS3_OPC_CLEAR_HW_STATE, false); + + ret = hns3_cmd_send(hw, &desc, 1); + if (ret && ret != -EOPNOTSUPP) + return ret; + + return 0; +} + static int hns3_init_pf(struct rte_eth_dev *eth_dev) { @@ -4210,6 +4225,18 @@ hns3_init_pf(struct rte_eth_dev *eth_dev) goto err_cmd_init; } + /* + * To ensure that the hardware environment is clean during + * initialization, the driver actively clear the hardware environment + * during initialization, including PF and corresponding VFs' vlan, mac, + * flow table configurations, etc. + */ + ret = hns3_clear_hw(hw); + if (ret) { + PMD_INIT_LOG(ERR, "failed to clear hardware: %d", ret); + goto err_cmd_init; + } + ret = rte_intr_callback_register(&pci_dev->intr_handle, hns3_interrupt_handler, eth_dev); -- 2.20.1 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2020-07-24 12:53:52.817439222 +0100 +++ 0111-net-hns3-clear-residual-hardware-configurations-on-i.patch 2020-07-24 12:53:48.367007950 +0100 @@ -1,8 +1,10 @@ -From 223d9eceaeeeb4d5156d4c96eec1a34434d6ecab Mon Sep 17 00:00:00 2001 +From aaf0005929b0723a19ff3f49f8da325523d91d57 Mon Sep 17 00:00:00 2001 From: Hongbo Zheng Date: Wed, 1 Jul 2020 19:54:38 +0800 Subject: [PATCH] net/hns3: clear residual hardware configurations on init +[ upstream commit 223d9eceaeeeb4d5156d4c96eec1a34434d6ecab ] + When the last driver exits abnormally, for example, it is killed by 'kill -9', it may be too late to clear the configuration and cause the configuration to remain. Therefore, to ensure that the hardware @@ -11,7 +13,6 @@ corresponding VFs' vlan, mac, flow table configurations, etc. Fixes: d51867db65c1 ("net/hns3: add initialization") -Cc: stable@dpdk.org Signed-off-by: Hongbo Zheng Signed-off-by: Wei Hu (Xavier) @@ -22,7 +23,7 @@ 2 files changed, 30 insertions(+) diff --git a/drivers/net/hns3/hns3_cmd.h b/drivers/net/hns3/hns3_cmd.h -index da770ac95..b203e663e 100644 +index 26d410396..ab16b07a6 100644 --- a/drivers/net/hns3/hns3_cmd.h +++ b/drivers/net/hns3/hns3_cmd.h @@ -207,6 +207,9 @@ enum hns3_opcode_type { @@ -36,10 +37,10 @@ HNS3_OPC_SFP_GET_SPEED = 0x7104, diff --git a/drivers/net/hns3/hns3_ethdev.c b/drivers/net/hns3/hns3_ethdev.c -index 4afee5d47..8b18b47d4 100644 +index f1066c079..4a1bb174c 100644 --- a/drivers/net/hns3/hns3_ethdev.c +++ b/drivers/net/hns3/hns3_ethdev.c -@@ -4318,6 +4318,21 @@ err_mac_init: +@@ -4180,6 +4180,21 @@ err_mac_init: return ret; } @@ -61,7 +62,7 @@ static int hns3_init_pf(struct rte_eth_dev *eth_dev) { -@@ -4348,6 +4363,18 @@ hns3_init_pf(struct rte_eth_dev *eth_dev) +@@ -4210,6 +4225,18 @@ hns3_init_pf(struct rte_eth_dev *eth_dev) goto err_cmd_init; }