From patchwork Fri May 7 09:08:14 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "humin (Q)" X-Patchwork-Id: 93039 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id D2F32A034F; Fri, 7 May 2021 11:08:42 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id E5CFD41117; Fri, 7 May 2021 11:08:28 +0200 (CEST) Received: from szxga04-in.huawei.com (szxga04-in.huawei.com [45.249.212.190]) by mails.dpdk.org (Postfix) with ESMTP id 549A740686 for ; Fri, 7 May 2021 11:08:24 +0200 (CEST) Received: from DGGEMS411-HUB.china.huawei.com (unknown [172.30.72.58]) by szxga04-in.huawei.com (SkyGuard) with ESMTP id 4Fc4KD1X7MzqT5t for ; Fri, 7 May 2021 17:05:04 +0800 (CST) Received: from localhost.localdomain (10.69.192.56) by DGGEMS411-HUB.china.huawei.com (10.3.19.211) with Microsoft SMTP Server id 14.3.498.0; Fri, 7 May 2021 17:08:16 +0800 From: "Min Hu (Connor)" To: CC: Date: Fri, 7 May 2021 17:08:14 +0800 Message-ID: <1620378499-5090-2-git-send-email-humin29@huawei.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1620378499-5090-1-git-send-email-humin29@huawei.com> References: <1620378499-5090-1-git-send-email-humin29@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.69.192.56] X-CFilter-Loop: Reflected Subject: [dpdk-dev] [PATCH 1/6] net/hns3: return code when PCI config space write fail X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" From: Chengwen Feng This patch returns error code when calling rte_pci_write_config() API. Fixes: 6dd32ded17d8 ("net/hns3: check PCI config space write") Cc: stable@dpdk.org Signed-off-by: Chengwen Feng Signed-off-by: Min Hu (Connor) --- drivers/net/hns3/hns3_ethdev_vf.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/net/hns3/hns3_ethdev_vf.c b/drivers/net/hns3/hns3_ethdev_vf.c index 6aa8a9b..71f3f95 100644 --- a/drivers/net/hns3/hns3_ethdev_vf.c +++ b/drivers/net/hns3/hns3_ethdev_vf.c @@ -156,9 +156,12 @@ hns3vf_enable_msix(const struct rte_pci_device *device, bool op) if (ret < 0) { PMD_INIT_LOG(ERR, "failed to write PCI offset 0x%x", (pos + PCI_MSIX_FLAGS)); + return -ENXIO; } + return 0; } + return -ENXIO; } From patchwork Fri May 7 09:08:15 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "humin (Q)" X-Patchwork-Id: 93038 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id C2514A034F; Fri, 7 May 2021 11:08:36 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id AF8BC4110B; Fri, 7 May 2021 11:08:27 +0200 (CEST) Received: from szxga04-in.huawei.com (szxga04-in.huawei.com [45.249.212.190]) by mails.dpdk.org (Postfix) with ESMTP id 503A640140 for ; Fri, 7 May 2021 11:08:24 +0200 (CEST) Received: from DGGEMS411-HUB.china.huawei.com (unknown [172.30.72.58]) by szxga04-in.huawei.com (SkyGuard) with ESMTP id 4Fc4KD1sbjzqT5w for ; Fri, 7 May 2021 17:05:04 +0800 (CST) Received: from localhost.localdomain (10.69.192.56) by DGGEMS411-HUB.china.huawei.com (10.3.19.211) with Microsoft SMTP Server id 14.3.498.0; Fri, 7 May 2021 17:08:17 +0800 From: "Min Hu (Connor)" To: CC: Date: Fri, 7 May 2021 17:08:15 +0800 Message-ID: <1620378499-5090-3-git-send-email-humin29@huawei.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1620378499-5090-1-git-send-email-humin29@huawei.com> References: <1620378499-5090-1-git-send-email-humin29@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.69.192.56] X-CFilter-Loop: Reflected Subject: [dpdk-dev] [PATCH 2/6] net/hns3: fix logging info when clear all FDIR rules X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" From: Chengwen Feng If clear FDIR rules fail, the error code was logged, but the error code was useless because it was the sum of all fail code. This patch fixes it by log the success cnt and fail cnt. Fixes: fcba820d9b9e ("net/hns3: support flow director") Fixes: 8eed8acc812e ("net/hns3: add error code to some logs") Cc: stable@dpdk.org Signed-off-by: Chengwen Feng Signed-off-by: Min Hu (Connor) --- drivers/net/hns3/hns3_fdir.c | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/drivers/net/hns3/hns3_fdir.c b/drivers/net/hns3/hns3_fdir.c index 0ef0938..e116d87 100644 --- a/drivers/net/hns3/hns3_fdir.c +++ b/drivers/net/hns3/hns3_fdir.c @@ -1026,6 +1026,8 @@ int hns3_clear_all_fdir_filter(struct hns3_adapter *hns) struct hns3_fdir_info *fdir_info = &pf->fdir; struct hns3_fdir_rule_ele *fdir_filter; struct hns3_hw *hw = &hns->hw; + int succ_cnt = 0; + int fail_cnt = 0; int ret = 0; /* flush flow director */ @@ -1034,17 +1036,23 @@ int hns3_clear_all_fdir_filter(struct hns3_adapter *hns) fdir_filter = TAILQ_FIRST(&fdir_info->fdir_list); while (fdir_filter) { TAILQ_REMOVE(&fdir_info->fdir_list, fdir_filter, entries); - ret += hns3_fd_tcam_config(hw, true, - fdir_filter->fdir_conf.location, - NULL, false); + ret = hns3_fd_tcam_config(hw, true, + fdir_filter->fdir_conf.location, + NULL, false); + if (ret == 0) + succ_cnt++; + else + fail_cnt++; rte_free(fdir_filter); fdir_filter = TAILQ_FIRST(&fdir_info->fdir_list); } - if (ret) { - hns3_err(hw, "Fail to delete FDIR filter, ret = %d", ret); + if (fail_cnt > 0) { + hns3_err(hw, "fail to delete all FDIR filter, success num = %d " + "fail num = %d", succ_cnt, fail_cnt); ret = -EIO; } + return ret; } From patchwork Fri May 7 09:08:16 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "humin (Q)" X-Patchwork-Id: 93037 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 9A01CA034F; Fri, 7 May 2021 11:08:30 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 7C501410FD; Fri, 7 May 2021 11:08:26 +0200 (CEST) Received: from szxga04-in.huawei.com (szxga04-in.huawei.com [45.249.212.190]) by mails.dpdk.org (Postfix) with ESMTP id 25E684013F for ; Fri, 7 May 2021 11:08:24 +0200 (CEST) Received: from DGGEMS411-HUB.china.huawei.com (unknown [172.30.72.58]) by szxga04-in.huawei.com (SkyGuard) with ESMTP id 4Fc4KD0pLWzqSq5 for ; Fri, 7 May 2021 17:05:04 +0800 (CST) Received: from localhost.localdomain (10.69.192.56) by DGGEMS411-HUB.china.huawei.com (10.3.19.211) with Microsoft SMTP Server id 14.3.498.0; Fri, 7 May 2021 17:08:17 +0800 From: "Min Hu (Connor)" To: CC: Date: Fri, 7 May 2021 17:08:16 +0800 Message-ID: <1620378499-5090-4-git-send-email-humin29@huawei.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1620378499-5090-1-git-send-email-humin29@huawei.com> References: <1620378499-5090-1-git-send-email-humin29@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.69.192.56] X-CFilter-Loop: Reflected Subject: [dpdk-dev] [PATCH 3/6] net/hns3: clear hash map when clear all FDIR rules X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" From: Chengwen Feng The fdir hash map hold the pointers of fdir rule elements, it needs to be set to NULL when clear all fdir rules. Fixes: fcba820d9b9e ("net/hns3: support flow director") Cc: stable@dpdk.org Signed-off-by: Chengwen Feng Signed-off-by: Min Hu (Connor) --- drivers/net/hns3/hns3_fdir.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/net/hns3/hns3_fdir.c b/drivers/net/hns3/hns3_fdir.c index e116d87..d043f57 100644 --- a/drivers/net/hns3/hns3_fdir.c +++ b/drivers/net/hns3/hns3_fdir.c @@ -1033,6 +1033,10 @@ int hns3_clear_all_fdir_filter(struct hns3_adapter *hns) /* flush flow director */ rte_hash_reset(fdir_info->hash_handle); + memset(fdir_info->hash_map, 0, + sizeof(struct hns3_fdir_rule_ele *) * + fdir_info->fd_cfg.rule_num[HNS3_FD_STAGE_1]); + fdir_filter = TAILQ_FIRST(&fdir_info->fdir_list); while (fdir_filter) { TAILQ_REMOVE(&fdir_info->fdir_list, fdir_filter, entries); From patchwork Fri May 7 09:08:17 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "humin (Q)" X-Patchwork-Id: 93042 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 80A14A034F; Fri, 7 May 2021 11:09:01 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id E976B41136; Fri, 7 May 2021 11:08:32 +0200 (CEST) Received: from szxga04-in.huawei.com (szxga04-in.huawei.com [45.249.212.190]) by mails.dpdk.org (Postfix) with ESMTP id 4D69F40686 for ; Fri, 7 May 2021 11:08:25 +0200 (CEST) Received: from DGGEMS411-HUB.china.huawei.com (unknown [172.30.72.58]) by szxga04-in.huawei.com (SkyGuard) with ESMTP id 4Fc4KD1jFfzqT5v for ; Fri, 7 May 2021 17:05:04 +0800 (CST) Received: from localhost.localdomain (10.69.192.56) by DGGEMS411-HUB.china.huawei.com (10.3.19.211) with Microsoft SMTP Server id 14.3.498.0; Fri, 7 May 2021 17:08:17 +0800 From: "Min Hu (Connor)" To: CC: Date: Fri, 7 May 2021 17:08:17 +0800 Message-ID: <1620378499-5090-5-git-send-email-humin29@huawei.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1620378499-5090-1-git-send-email-humin29@huawei.com> References: <1620378499-5090-1-git-send-email-humin29@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.69.192.56] X-CFilter-Loop: Reflected Subject: [dpdk-dev] [PATCH 4/6] net/hns3: fix VF setting alive order problem X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" From: HongBo Zheng Currently in the VF reset scenario, the VF performs the set alive operation before restoring the configuration completed, which may cause the hardware to work in an abnormal state. This patch fix this problem by set VF alive after restoring the configuration completed. Fixes: a5475d61fa34 ("net/hns3: support VF") Cc: stable@dpdk.org Signed-off-by: HongBo Zheng Signed-off-by: Min Hu (Connor) --- drivers/net/hns3/hns3_ethdev_vf.c | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/drivers/net/hns3/hns3_ethdev_vf.c b/drivers/net/hns3/hns3_ethdev_vf.c index 71f3f95..536ed46 100644 --- a/drivers/net/hns3/hns3_ethdev_vf.c +++ b/drivers/net/hns3/hns3_ethdev_vf.c @@ -1891,12 +1891,6 @@ hns3vf_init_hardware(struct hns3_adapter *hns) goto err_init_hardware; } - ret = hns3vf_set_alive(hw, true); - if (ret) { - PMD_INIT_LOG(ERR, "Failed to VF send alive to PF: %d", ret); - goto err_init_hardware; - } - return 0; err_init_hardware: @@ -1995,6 +1989,12 @@ hns3vf_init_vf(struct rte_eth_dev *eth_dev) hns3_rss_set_default_args(hw); + ret = hns3vf_set_alive(hw, true); + if (ret) { + PMD_INIT_LOG(ERR, "Failed to VF send alive to PF: %d", ret); + goto err_set_tc_queue; + } + return 0; err_set_tc_queue: @@ -2706,6 +2706,13 @@ hns3vf_restore_conf(struct hns3_adapter *hns) hns3_info(hw, "hns3vf dev restart successful!"); } else if (hw->adapter_state == HNS3_NIC_STOPPING) hw->adapter_state = HNS3_NIC_CONFIGURED; + + ret = hns3vf_set_alive(hw, true); + if (ret) { + hns3_err(hw, "failed to VF send alive to PF: %d", ret); + goto err_vlan_table; + } + return 0; err_vlan_table: From patchwork Fri May 7 09:08:18 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "humin (Q)" X-Patchwork-Id: 93036 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 5EFD3A034F; Fri, 7 May 2021 11:08:25 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 46A114013F; Fri, 7 May 2021 11:08:25 +0200 (CEST) Received: from szxga04-in.huawei.com (szxga04-in.huawei.com [45.249.212.190]) by mails.dpdk.org (Postfix) with ESMTP id 1ABD040040 for ; Fri, 7 May 2021 11:08:24 +0200 (CEST) Received: from DGGEMS411-HUB.china.huawei.com (unknown [172.30.72.58]) by szxga04-in.huawei.com (SkyGuard) with ESMTP id 4Fc4KD0zMpzqSvM for ; Fri, 7 May 2021 17:05:04 +0800 (CST) Received: from localhost.localdomain (10.69.192.56) by DGGEMS411-HUB.china.huawei.com (10.3.19.211) with Microsoft SMTP Server id 14.3.498.0; Fri, 7 May 2021 17:08:18 +0800 From: "Min Hu (Connor)" To: CC: Date: Fri, 7 May 2021 17:08:18 +0800 Message-ID: <1620378499-5090-6-git-send-email-humin29@huawei.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1620378499-5090-1-git-send-email-humin29@huawei.com> References: <1620378499-5090-1-git-send-email-humin29@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.69.192.56] X-CFilter-Loop: Reflected Subject: [dpdk-dev] [PATCH 5/6] net/hns3: fix out param not set when query FDIR counter X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" From: Chengwen Feng The hardware doesn't support counting the number of bytes that through the fdir rule. Therefore, the corresponding out parameters (e.g. bytes_set/bytes) is set to zero. Fixes: fcba820d9b9e ("net/hns3: support flow director") Cc: stable@dpdk.org Signed-off-by: Chengwen Feng Signed-off-by: Min Hu (Connor) --- drivers/net/hns3/hns3_flow.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/net/hns3/hns3_flow.c b/drivers/net/hns3/hns3_flow.c index 65c7f6e..82810e0 100644 --- a/drivers/net/hns3/hns3_flow.c +++ b/drivers/net/hns3/hns3_flow.c @@ -223,6 +223,8 @@ hns3_counter_query(struct rte_eth_dev *dev, struct rte_flow *flow, } qc->hits_set = 1; qc->hits = value; + qc->bytes_set = 0; + qc->bytes = 0; return 0; } From patchwork Fri May 7 09:08:19 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "humin (Q)" X-Patchwork-Id: 93041 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 9BC02A034F; Fri, 7 May 2021 11:08:55 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id B575441131; Fri, 7 May 2021 11:08:31 +0200 (CEST) Received: from szxga04-in.huawei.com (szxga04-in.huawei.com [45.249.212.190]) by mails.dpdk.org (Postfix) with ESMTP id 4D4F940140 for ; Fri, 7 May 2021 11:08:25 +0200 (CEST) Received: from DGGEMS411-HUB.china.huawei.com (unknown [172.30.72.58]) by szxga04-in.huawei.com (SkyGuard) with ESMTP id 4Fc4KD1Bb4zqT5p for ; Fri, 7 May 2021 17:05:04 +0800 (CST) Received: from localhost.localdomain (10.69.192.56) by DGGEMS411-HUB.china.huawei.com (10.3.19.211) with Microsoft SMTP Server id 14.3.498.0; Fri, 7 May 2021 17:08:18 +0800 From: "Min Hu (Connor)" To: CC: Date: Fri, 7 May 2021 17:08:19 +0800 Message-ID: <1620378499-5090-7-git-send-email-humin29@huawei.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1620378499-5090-1-git-send-email-humin29@huawei.com> References: <1620378499-5090-1-git-send-email-humin29@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.69.192.56] X-CFilter-Loop: Reflected Subject: [dpdk-dev] [PATCH 6/6] doc: add link status event pre-conditions X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" From: Chengwen Feng This patch adds link status event pre-conditions. Signed-off-by: Chengwen Feng Signed-off-by: Min Hu (Connor) --- doc/guides/nics/hns3.rst | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/doc/guides/nics/hns3.rst b/doc/guides/nics/hns3.rst index 4439df5..c3aded8 100644 --- a/doc/guides/nics/hns3.rst +++ b/doc/guides/nics/hns3.rst @@ -115,6 +115,16 @@ Runtime Config Options For example:: -a 0000:7d:00.0,dev_caps_mask=0xF +Link status event Pre-conditions +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +Firmware 1.8.0.0 and later versions support reporting link changes to the PF. +Therefore, to use the LSC for the PF driver, ensure that the firmware version +also supports reporting link changes. +If the VF driver needs to support LSC, special patch must be added: +``_. +Note: The patch has been uploaded to 5.13 of the Linux kernel mainline. + Driver compilation and testing ------------------------------