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 A898DA04DD for ; Wed, 28 Oct 2020 11:50:17 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 9AADE4C90; Wed, 28 Oct 2020 11:50:16 +0100 (CET) Received: from mail-wr1-f42.google.com (mail-wr1-f42.google.com [209.85.221.42]) by dpdk.org (Postfix) with ESMTP id 83F762C2A for ; Wed, 28 Oct 2020 11:50:15 +0100 (CET) Received: by mail-wr1-f42.google.com with SMTP id i1so5189243wro.1 for ; Wed, 28 Oct 2020 03:50:15 -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=sWOSyoMG/WbC1HlkjZxAodD7T6QEoizuzMXONrSblX4=; b=B7rcE70inle4jbgyzlj9EHJgxkFDGsw9xO6dDnko57ayADI5lCdwHmS9YPAR0TuTt9 ncn9h8GjkstGuJPsxZa6pQPveIvyU+g4y7vkwc3x6z8CA9+MaSq0Pvu9k59PBLC8Xlq6 fXF93pVHOIYEbYuBEa7doke7i1XxthTwvpmjiGW58ytZgq/x34yHpFiimWnAy5sZTJaI tCw3U/WkACE1YLNLtJPCTS+BPwTKcW9y5r+wd/yxci/Xwe5yIwjKEy/3PoDvaFQR01pA 9nK8BR1Hy4XHwNbx/XXO9yUo2u0EP6WaXenHG9HzMpaeYAQa1Xlcs0jKpvOnaqrdB4L/ F8jQ== 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=sWOSyoMG/WbC1HlkjZxAodD7T6QEoizuzMXONrSblX4=; b=DsREoN2053zwZxLoT8LxsMHdpQO1ZiauQBo9+13khnW4JnaSXedOuAQuxnwVIrXSkB RaaE1GUZ1vLMmGhrurGzb/3UqRvFuLBI6TTGhyvmOkTzsOE22hhiBI9zHLoLTqER7mKM fbJv2i5Dpgm/V76EpV8hrBzzoyV2JXoZZaoGH8rHtSJCdQSLlF9uHBnTgtVURT7jn6st cxmjc2UtQrIA3E8NVJgoQYx2y9IsYPpEpl/FQukhFx11h4cGvcMBETTCNFWBvHaqAScZ 0leJ35c+oF2WAsh/cU6hffGNfHd8Bl0EWYGK1D4XGUrKlNki2SiklOLx5LWGQUPyaL8k sAfw== X-Gm-Message-State: AOAM532J+7Au1bLTeUDQr82y4r1onD5dr5PKkn50pu83sMelvrEilMXw lsod6yYiyykwAOcT5Dnto9qeId/O88hxQdBs X-Google-Smtp-Source: ABdhPJyWtG13oybTVsAMLZFW5Md0yhGsjtph1WikZas/K68+sT75tUkJ7++V2ELQe0vAQ+awmOb06g== X-Received: by 2002:a5d:6744:: with SMTP id l4mr8216609wrw.18.1603882214194; Wed, 28 Oct 2020 03:50:14 -0700 (PDT) Received: from localhost ([88.98.246.218]) by smtp.gmail.com with ESMTPSA id c8sm869337wrv.26.2020.10.28.03.50.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 28 Oct 2020 03:50:13 -0700 (PDT) From: luca.boccassi@gmail.com To: Lijun Ou Cc: Wei Hu , dpdk stable Date: Wed, 28 Oct 2020 10:43:56 +0000 Message-Id: <20201028104606.3504127-77-luca.boccassi@gmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20201028104606.3504127-1-luca.boccassi@gmail.com> References: <20201028104606.3504127-1-luca.boccassi@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-stable] patch 'net/hns3: fix config when creating RSS rule after flush' has been queued to stable release 19.11.6 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.6 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 10/30/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 7c8157cb3edfa02a1d710d454a896aab72ad3fa8 Mon Sep 17 00:00:00 2001 From: Lijun Ou Date: Tue, 22 Sep 2020 20:03:25 +0800 Subject: [PATCH] net/hns3: fix config when creating RSS rule after flush [ upstream commit eb158fc756a5c0c91ed05a676b2085927d76aa63 ] 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") 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 0301d6b169..94819bd42c 100644 --- a/drivers/net/hns3/hns3_flow.c +++ b/drivers/net/hns3/hns3_flow.c @@ -1198,10 +1198,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, @@ -1502,7 +1516,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; @@ -1564,6 +1590,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); } -- 2.20.1 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2020-10-28 10:35:14.167899994 +0000 +++ 0077-net-hns3-fix-config-when-creating-RSS-rule-after-flu.patch 2020-10-28 10:35:11.584831201 +0000 @@ -1,8 +1,10 @@ -From eb158fc756a5c0c91ed05a676b2085927d76aa63 Mon Sep 17 00:00:00 2001 +From 7c8157cb3edfa02a1d710d454a896aab72ad3fa8 Mon Sep 17 00:00:00 2001 From: Lijun Ou Date: Tue, 22 Sep 2020 20:03:25 +0800 Subject: [PATCH] net/hns3: fix config when creating RSS rule after flush +[ upstream commit eb158fc756a5c0c91ed05a676b2085927d76aa63 ] + 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 @@ -23,7 +25,6 @@ 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) @@ -32,10 +33,10 @@ 1 file changed, 35 insertions(+), 5 deletions(-) diff --git a/drivers/net/hns3/hns3_flow.c b/drivers/net/hns3/hns3_flow.c -index f4ea47aff4..6f2ff87496 100644 +index 0301d6b169..94819bd42c 100644 --- a/drivers/net/hns3/hns3_flow.c +++ b/drivers/net/hns3/hns3_flow.c -@@ -1293,10 +1293,24 @@ static bool +@@ -1198,10 +1198,24 @@ static bool hns3_action_rss_same(const struct rte_flow_action_rss *comp, const struct rte_flow_action_rss *with) { @@ -64,7 +65,7 @@ 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, +@@ -1502,7 +1516,19 @@ hns3_config_rss_filter(struct rte_eth_dev *dev, hns3_err(hw, "RSS disable failed(%d)", ret); return ret; } @@ -85,7 +86,7 @@ return 0; } return -EINVAL; -@@ -1651,6 +1677,10 @@ hns3_restore_rss_filter(struct rte_eth_dev *dev) +@@ -1564,6 +1590,10 @@ hns3_restore_rss_filter(struct rte_eth_dev *dev) if (hw->rss_info.conf.queue_num == 0) return 0;