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 95E4CA0518 for ; Fri, 24 Jul 2020 14:00:39 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 8D6AF1BFE3; Fri, 24 Jul 2020 14:00:39 +0200 (CEST) Received: from mail-wm1-f65.google.com (mail-wm1-f65.google.com [209.85.128.65]) by dpdk.org (Postfix) with ESMTP id BA8941BFE3 for ; Fri, 24 Jul 2020 14:00:38 +0200 (CEST) Received: by mail-wm1-f65.google.com with SMTP id j18so7725241wmi.3 for ; Fri, 24 Jul 2020 05:00:38 -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=JINiS3aKykPZz+YfDFN3aqN6DKKh2da+pNDMiCkFC7U=; b=cEDWUCKKoUEVnYbp4mscDI99ohQtqt0Z5lUMwvBXVmh0lvUBLDl71lGJMQWHiQgv6Y /5DWttiLeuvSxOSvin/xxywiNGb8fvZvLks97dRG7MfDU4ql44LL8CgYV10i4GQ95qvz rbPhjf7T/w+D4CXyyavkG2sZL1VyyKP+Jn3TzrhvlRVfuxcqlHXzFfXOGziuC5jc5+0Y cK3/LIOkj8Q3pOO6tbapS2SnwsX/JXegwsLDFIqIpFfqYWe306z8WqEWOgNMm/W5/ZUV VvhptftfFcG62sJ/s7DaFkDssdcS/MrFsOD2X1eKX75o/G7jMafMiz5pkh578/kzqpFj 6+Qg== 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=JINiS3aKykPZz+YfDFN3aqN6DKKh2da+pNDMiCkFC7U=; b=OUDH+5yT/QG6kswzAC6exdzLrPIW1WbozTEgvqnB1cjuWGr12zzqAdD2Vpdex58YnS Rp6ozsA+gtUR8vtJxXFV68aUsjRveHlvZ0nDl7OkDIo6aym4ouJeFCjJYb4Vd+LFJH8M bJLTrIadY4PQfGpCuFmcmzkaOQXrkLrY22QgVX8sj54MWn3LY6oKSyGXthfpopihh9mr h7rTj8I5vU/NdxaU0toEdpfunuiIMi5VadZQ7gGN2h8z9/5KJIlOsJFSLBwyQToQUE+G hnLBKUxYH9EzccxmTBzv5oCGxJeGM3SEDXkeaXslPpxvU76ZFBguf5WOt0m3k9QAQEKt mGrw== X-Gm-Message-State: AOAM53113QBLParll0iYqdIfD32aOfxIMPuBeOjdM6ZMOEUJvye+qD08 Ynw6fXQMQsAdfV/RKrcX49U= X-Google-Smtp-Source: ABdhPJwvwhbjx89ACc19U/wk4z1li/mI1MEFHXY1e9PjplZswqJ/fUcTtMyOoIM5znv4MVktFy112w== X-Received: by 2002:a7b:ce04:: with SMTP id m4mr8325676wmc.1.1595592038427; Fri, 24 Jul 2020 05:00:38 -0700 (PDT) Received: from localhost ([88.98.246.218]) by smtp.gmail.com with ESMTPSA id k62sm5799834wmb.16.2020.07.24.05.00.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 Jul 2020 05:00:37 -0700 (PDT) From: luca.boccassi@gmail.com To: Chengchang Tang Cc: Wei Hu , dpdk stable Date: Fri, 24 Jul 2020 12:57:21 +0100 Message-Id: <20200724120030.1863487-3-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 promiscuous on PF uninit' 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 3bf5b201399a507b0468326864be8b1e4870c88f Mon Sep 17 00:00:00 2001 From: Chengchang Tang Date: Fri, 22 May 2020 17:21:15 +0800 Subject: [PATCH] net/hns3: clear promiscuous on PF uninit [ upstream commit 3f28ec4a88abc319d63c652141d716720d93dc47 ] Currently, promiscuous mode configuration are not cleared during uninstallation based on hns3 PF device. The residual entries may cause unnecessary bandwidth usage. So, we need clear the PF's promisc mode status during the uninit. Fixes: a45fd0aa0ea1 ("net/hns3: fix Rx queue search with broadcast packet") Fixes: d51867db65c1 ("net/hns3: add initialization") Signed-off-by: Chengchang Tang Signed-off-by: Wei Hu (Xavier) --- drivers/net/hns3/hns3_ethdev.c | 53 +++++++++++++++++++++++++++------- 1 file changed, 43 insertions(+), 10 deletions(-) diff --git a/drivers/net/hns3/hns3_ethdev.c b/drivers/net/hns3/hns3_ethdev.c index 3271b61fc..dbe747f9d 100644 --- a/drivers/net/hns3/hns3_ethdev.c +++ b/drivers/net/hns3/hns3_ethdev.c @@ -3733,7 +3733,7 @@ hns3_set_promisc_mode(struct hns3_hw *hw, bool en_uc_pmc, bool en_mc_pmc) } static int -hns3_clear_all_vfs_promisc_mode(struct hns3_hw *hw) +hns3_promisc_init(struct hns3_hw *hw) { struct hns3_adapter *hns = HNS3_DEV_HW_TO_ADAPTER(hw); struct hns3_pf *pf = &hns->pf; @@ -3741,17 +3741,55 @@ hns3_clear_all_vfs_promisc_mode(struct hns3_hw *hw) uint16_t func_id; int ret; + ret = hns3_set_promisc_mode(hw, false, false); + if (ret) { + PMD_INIT_LOG(ERR, "failed to set promisc mode, ret = %d", ret); + return ret; + } + + /* + * In current version VFs are not supported when PF is driven by DPDK + * driver. After PF has been taken over by DPDK, the original VF will + * be invalid. So, there is a possibility of entry residues. It should + * clear VFs's promisc mode to avoid unnecessary bandwidth usage + * during init. + */ /* func_id 0 is denoted PF, the VFs start from 1 */ for (func_id = 1; func_id < pf->func_num; func_id++) { hns3_promisc_param_init(¶m, false, false, false, func_id); ret = hns3_cmd_set_promisc_mode(hw, ¶m); - if (ret) + if (ret) { + PMD_INIT_LOG(ERR, "failed to clear vf:%d promisc mode," + " ret = %d", func_id, ret); return ret; + } } return 0; } +static void +hns3_promisc_uninit(struct hns3_hw *hw) +{ + struct hns3_promisc_param param; + uint16_t func_id; + int ret; + + func_id = 0; + + /* + * In current version VFs are not supported when PF is driven by + * DPDK driver, and VFs' promisc mode status has been cleared during + * init and their status will not change. So just clear PF's promisc + * mode status during uninit. + */ + hns3_promisc_param_init(¶m, false, false, false, func_id); + ret = hns3_cmd_set_promisc_mode(hw, ¶m); + if (ret) + PMD_INIT_LOG(ERR, "failed to clear promisc status during" + " uninit, ret = %d", ret); +} + static int hns3_dev_promiscuous_enable(struct rte_eth_dev *dev) { @@ -4092,15 +4130,9 @@ hns3_init_hardware(struct hns3_adapter *hns) goto err_mac_init; } - ret = hns3_set_promisc_mode(hw, false, false); + ret = hns3_promisc_init(hw); if (ret) { - PMD_INIT_LOG(ERR, "Failed to set promisc mode: %d", ret); - goto err_mac_init; - } - - ret = hns3_clear_all_vfs_promisc_mode(hw); - if (ret) { - PMD_INIT_LOG(ERR, "Failed to clear all vfs promisc mode: %d", + PMD_INIT_LOG(ERR, "Failed to init promisc: %d", ret); goto err_mac_init; } @@ -4259,6 +4291,7 @@ hns3_uninit_pf(struct rte_eth_dev *eth_dev) hns3_enable_hw_error_intr(hns, false); hns3_rss_uninit(hns); + hns3_promisc_uninit(hw); hns3_fdir_filter_uninit(hns); hns3_uninit_umv_space(hw); hns3_pf_disable_irq0(hw); -- 2.20.1 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2020-07-24 12:53:48.705432454 +0100 +++ 0003-net-hns3-clear-promiscuous-on-PF-uninit.patch 2020-07-24 12:53:48.143003777 +0100 @@ -1,8 +1,10 @@ -From 3f28ec4a88abc319d63c652141d716720d93dc47 Mon Sep 17 00:00:00 2001 +From 3bf5b201399a507b0468326864be8b1e4870c88f Mon Sep 17 00:00:00 2001 From: Chengchang Tang Date: Fri, 22 May 2020 17:21:15 +0800 Subject: [PATCH] net/hns3: clear promiscuous on PF uninit +[ upstream commit 3f28ec4a88abc319d63c652141d716720d93dc47 ] + Currently, promiscuous mode configuration are not cleared during uninstallation based on hns3 PF device. The residual entries may cause unnecessary bandwidth usage. @@ -11,7 +13,6 @@ Fixes: a45fd0aa0ea1 ("net/hns3: fix Rx queue search with broadcast packet") Fixes: d51867db65c1 ("net/hns3: add initialization") -Cc: stable@dpdk.org Signed-off-by: Chengchang Tang Signed-off-by: Wei Hu (Xavier) @@ -20,10 +21,10 @@ 1 file changed, 43 insertions(+), 10 deletions(-) diff --git a/drivers/net/hns3/hns3_ethdev.c b/drivers/net/hns3/hns3_ethdev.c -index 06c488659..1c06b8ff1 100644 +index 3271b61fc..dbe747f9d 100644 --- a/drivers/net/hns3/hns3_ethdev.c +++ b/drivers/net/hns3/hns3_ethdev.c -@@ -3826,7 +3826,7 @@ hns3_set_promisc_mode(struct hns3_hw *hw, bool en_uc_pmc, bool en_mc_pmc) +@@ -3733,7 +3733,7 @@ hns3_set_promisc_mode(struct hns3_hw *hw, bool en_uc_pmc, bool en_mc_pmc) } static int @@ -32,7 +33,7 @@ { struct hns3_adapter *hns = HNS3_DEV_HW_TO_ADAPTER(hw); struct hns3_pf *pf = &hns->pf; -@@ -3834,16 +3834,54 @@ hns3_clear_all_vfs_promisc_mode(struct hns3_hw *hw) +@@ -3741,17 +3741,55 @@ hns3_clear_all_vfs_promisc_mode(struct hns3_hw *hw) uint16_t func_id; int ret; @@ -49,7 +50,8 @@ + * clear VFs's promisc mode to avoid unnecessary bandwidth usage + * during init. + */ - for (func_id = HNS3_1ST_VF_FUNC_ID; func_id < pf->func_num; func_id++) { + /* func_id 0 is denoted PF, the VFs start from 1 */ + for (func_id = 1; func_id < pf->func_num; func_id++) { hns3_promisc_param_init(¶m, false, false, false, func_id); ret = hns3_cmd_set_promisc_mode(hw, ¶m); - if (ret) @@ -70,7 +72,7 @@ + uint16_t func_id; + int ret; + -+ func_id = HNS3_PF_FUNC_ID; ++ func_id = 0; + + /* + * In current version VFs are not supported when PF is driven by @@ -88,7 +90,7 @@ static int hns3_dev_promiscuous_enable(struct rte_eth_dev *dev) { -@@ -4186,15 +4224,9 @@ hns3_init_hardware(struct hns3_adapter *hns) +@@ -4092,15 +4130,9 @@ hns3_init_hardware(struct hns3_adapter *hns) goto err_mac_init; } @@ -106,7 +108,7 @@ ret); goto err_mac_init; } -@@ -4353,6 +4385,7 @@ hns3_uninit_pf(struct rte_eth_dev *eth_dev) +@@ -4259,6 +4291,7 @@ hns3_uninit_pf(struct rte_eth_dev *eth_dev) hns3_enable_hw_error_intr(hns, false); hns3_rss_uninit(hns);