From patchwork Tue Sep 22 12:03:25 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Wei Hu (Xavier)" X-Patchwork-Id: 78406 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id C7E57A04B0; Tue, 22 Sep 2020 14:05:28 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 3E8A01DB7F; Tue, 22 Sep 2020 14:03:58 +0200 (CEST) Received: from incedge.chinasoftinc.com (unknown [114.113.233.8]) by dpdk.org (Postfix) with ESMTP id 0AADC1DADD for ; Tue, 22 Sep 2020 14:03:45 +0200 (CEST) X-ASG-Debug-ID: 1600776224-149d111baf1ab930001-TfluYd Received: from mail.chinasoftinc.com (inccas002.ito.icss [10.168.0.52]) by incedge.chinasoftinc.com with ESMTP id eQZO4zuQhhAHZeiF (version=TLSv1 cipher=ECDHE-RSA-AES256-SHA bits=256 verify=NO); Tue, 22 Sep 2020 20:03:44 +0800 (CST) X-Barracuda-Envelope-From: huwei013@chinasoftinc.com X-Barracuda-RBL-Trusted-Forwarder: 10.168.0.52 X-ASG-Whitelist: Client Received: from localhost.localdomain (120.133.139.157) by INCCAS002.ito.icss (10.168.0.60) with Microsoft SMTP Server id 14.3.487.0; Tue, 22 Sep 2020 20:03:43 +0800 From: "Wei Hu (Xavier)" X-Barracuda-RBL-Trusted-Forwarder: 10.168.0.60 To: CC: Date: Tue, 22 Sep 2020 20:03:25 +0800 X-ASG-Orig-Subj: [PATCH v2 13/17] net/hns3: fix config when creating RSS rule after flush Message-ID: <20200922120329.21185-14-huwei013@chinasoftinc.com> X-Mailer: git-send-email 2.9.5 In-Reply-To: <20200922120329.21185-1-huwei013@chinasoftinc.com> References: <20200922085401.12272-1-huwei013@chinasoftinc.com> <20200922120329.21185-1-huwei013@chinasoftinc.com> MIME-Version: 1.0 X-Originating-IP: [120.133.139.157] X-Barracuda-Connect: inccas002.ito.icss[10.168.0.52] X-Barracuda-Start-Time: 1600776224 X-Barracuda-Encrypted: ECDHE-RSA-AES256-SHA X-Barracuda-URL: https://incspam.chinasofti.com:443/cgi-mod/mark.cgi X-Virus-Scanned: by bsmtpd at chinasoftinc.com X-Barracuda-Scan-Msg-Size: 3678 Subject: [dpdk-dev] [PATCH v2 13/17] net/hns3: fix config when creating RSS rule after flush X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 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: Lijun Ou Currnetly, when user create a flow RSS rule and then flush the rule, driver will set 0 for the internal structure of hw->rss_info maintained in driver. And then user create a flow RSS rule without specified RSS hash key, driver configure a validate RSS hash key into hardware network engine and will cause an RSS error. The related steps when using testpmd as follows: flow 0 action rss xx end / end flow flush 0 flow 0 action rss queues 0 1 end / end To slove the preceding problem, the flow flush processing is modified. it don't clear all RSS configurations for hw->rss_info. Actually the RSS key information in the hardware is not cleared, therefore, the hw->rss_info.key is kept consistent with the value in the hardware. In addition, because reset the redirection table, we need to set queues NULL and queue_num for zero that indicate the corresponding parameters in the hardware is unavailable. Also we set hw->rss_info.func to RTE_ETH_HASH_FUNCTION_MAX that indicate it is invalid. Fixes: c37ca66f2b27 ("net/hns3: support RSS") Cc: stable@dpdk.org Signed-off-by: Lijun Ou Signed-off-by: Wei Hu (Xavier) --- drivers/net/hns3/hns3_flow.c | 40 +++++++++++++++++++++++++++++++++++----- 1 file changed, 35 insertions(+), 5 deletions(-) diff --git a/drivers/net/hns3/hns3_flow.c b/drivers/net/hns3/hns3_flow.c index f4ea47a..6f2ff87 100644 --- a/drivers/net/hns3/hns3_flow.c +++ b/drivers/net/hns3/hns3_flow.c @@ -1293,10 +1293,24 @@ static bool hns3_action_rss_same(const struct rte_flow_action_rss *comp, const struct rte_flow_action_rss *with) { - return (comp->func == with->func && - comp->level == with->level && - comp->types == with->types && - comp->key_len == with->key_len && + bool func_is_same; + + /* + * When user flush all RSS rule, RSS func is set invalid with + * RTE_ETH_HASH_FUNCTION_MAX. Then the user create a flow after + * flushed, any validate RSS func is different with it before + * flushed. Others, when user create an action RSS with RSS func + * specified RTE_ETH_HASH_FUNCTION_DEFAULT, the func is the same + * between continuous RSS flow. + */ + if (comp->func == RTE_ETH_HASH_FUNCTION_MAX) + func_is_same = false; + else + func_is_same = (with->func ? (comp->func == with->func) : true); + + return (func_is_same && + comp->types == (with->types & HNS3_ETH_RSS_SUPPORT) && + comp->level == with->level && comp->key_len == with->key_len && comp->queue_num == with->queue_num && !memcmp(comp->key, with->key, with->key_len) && !memcmp(comp->queue, with->queue, @@ -1589,7 +1603,19 @@ hns3_config_rss_filter(struct rte_eth_dev *dev, hns3_err(hw, "RSS disable failed(%d)", ret); return ret; } - memset(rss_info, 0, sizeof(struct hns3_rss_conf)); + + if (rss_flow_conf.queue_num) { + /* + * Due the content of queue pointer have been + * reset to 0, the rss_info->conf.queue should + * be set NULL. + */ + rss_info->conf.queue = NULL; + rss_info->conf.queue_num = 0; + } + + /* set RSS func invalid after flushed */ + rss_info->conf.func = RTE_ETH_HASH_FUNCTION_MAX; return 0; } return -EINVAL; @@ -1651,6 +1677,10 @@ hns3_restore_rss_filter(struct rte_eth_dev *dev) if (hw->rss_info.conf.queue_num == 0) return 0; + /* When user flush all rules, it doesn't need to restore RSS rule */ + if (hw->rss_info.conf.func == RTE_ETH_HASH_FUNCTION_MAX) + return 0; + return hns3_config_rss_filter(dev, &hw->rss_info, true); }