From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <dev-bounces@dpdk.org>
Received: from dpdk.org (dpdk.org [92.243.14.124])
	by inbox.dpdk.org (Postfix) with ESMTP id 5D3D3A04B0;
	Tue, 22 Sep 2020 14:06:44 +0200 (CEST)
Received: from [92.243.14.124] (localhost [127.0.0.1])
	by dpdk.org (Postfix) with ESMTP id EFE3A1DBF2;
	Tue, 22 Sep 2020 14:04:13 +0200 (CEST)
Received: from incedge.chinasoftinc.com (unknown [114.113.233.8])
 by dpdk.org (Postfix) with ESMTP id 39B991DADF
 for <dev@dpdk.org>; Tue, 22 Sep 2020 14:03:46 +0200 (CEST)
X-ASG-Debug-ID: 1600776225-149d111bae1ab940001-TfluYd
Received: from mail.chinasoftinc.com (inccas002.ito.icss [10.168.0.52]) by
 incedge.chinasoftinc.com with ESMTP id PfKBrQBy3kaTS3S6 (version=TLSv1
 cipher=ECDHE-RSA-AES256-SHA bits=256 verify=NO);
 Tue, 22 Sep 2020 20:03:45 +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:44 +0800
From: "Wei Hu (Xavier)" <huwei013@chinasoftinc.com>
X-Barracuda-RBL-Trusted-Forwarder: 10.168.0.60
To: <dev@dpdk.org>
CC: <xavier.huwei@huawei.com>
Date: Tue, 22 Sep 2020 20:03:28 +0800
X-ASG-Orig-Subj: [PATCH v2 16/17] net/hns3: fix configuring device with RSS is
 enabled
Message-ID: <20200922120329.21185-17-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
Content-Type: text/plain
X-Originating-IP: [120.133.139.157]
X-Barracuda-Connect: inccas002.ito.icss[10.168.0.52]
X-Barracuda-Start-Time: 1600776225
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: 2506
Subject: [dpdk-dev] [PATCH v2 16/17] net/hns3: fix configuring device with
	RSS is enabled
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: DPDK patches and discussions <dev.dpdk.org>
List-Unsubscribe: <https://mails.dpdk.org/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://mails.dpdk.org/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <https://mails.dpdk.org/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
Errors-To: dev-bounces@dpdk.org
Sender: "dev" <dev-bounces@dpdk.org>

From: "Wei Hu (Xavier)" <xavier.huwei@huawei.com>

Currently, when running the following commands in the CLI of testpmd
application, the driver reports an -EINVAL error when performing the No.3
step.
1) flow create 0 ingress pattern end actions rss key <key> func simple_xor
     types all end / end
2) flow flush 0
3) port config dcb vt off pfc off

The root cause as below:
In the No.2 step, when RSS rules is flushed, we set the the flag
hw->rss_dis_flag with true to indicate RSS id disabled. And in the No.3
step, calling rte_eth_dev_configure API function, the internal function
named hns3_dev_rss_hash_update check hw->rss_dis_flag is true and return
-EINVAL.

When user calls the rte_eth_dev_configure API function with the input
parameter dev_conf->rxmode.mq_mode having ETH_MQ_RX_RSS_FLAG to enable RSS,
driver should set internal flag hw->rss_dis_flag with false to indicate RSS
is enabled in the '.dev_configure' ops implementation function named
hns3_dev_configure and hns3vf_dev_configure.

Fixes: 5e782bc2570c ("net/hns3: fix configuring RSS hash when rules are flushed")
Cc: stable@dpdk.org

Signed-off-by: Lijun Ou <oulijun@huawei.com>
Signed-off-by: Wei Hu (Xavier) <xavier.huwei@huawei.com>
---
 drivers/net/hns3/hns3_ethdev.c    | 1 +
 drivers/net/hns3/hns3_ethdev_vf.c | 1 +
 2 files changed, 2 insertions(+)

diff --git a/drivers/net/hns3/hns3_ethdev.c b/drivers/net/hns3/hns3_ethdev.c
index 10cfc5d..99bcc7a 100644
--- a/drivers/net/hns3/hns3_ethdev.c
+++ b/drivers/net/hns3/hns3_ethdev.c
@@ -2326,6 +2326,7 @@ hns3_dev_configure(struct rte_eth_dev *dev)
 	if ((uint32_t)mq_mode & ETH_MQ_RX_RSS_FLAG) {
 		conf->rxmode.offloads |= DEV_RX_OFFLOAD_RSS_HASH;
 		rss_conf = conf->rx_adv_conf.rss_conf;
+		hw->rss_dis_flag = false;
 		if (rss_conf.rss_key == NULL) {
 			rss_conf.rss_key = rss_cfg->key;
 			rss_conf.rss_key_len = HNS3_RSS_KEY_SIZE;
diff --git a/drivers/net/hns3/hns3_ethdev_vf.c b/drivers/net/hns3/hns3_ethdev_vf.c
index cb2747b..4c73441 100644
--- a/drivers/net/hns3/hns3_ethdev_vf.c
+++ b/drivers/net/hns3/hns3_ethdev_vf.c
@@ -783,6 +783,7 @@ hns3vf_dev_configure(struct rte_eth_dev *dev)
 	/* When RSS is not configured, redirect the packet queue 0 */
 	if ((uint32_t)mq_mode & ETH_MQ_RX_RSS_FLAG) {
 		conf->rxmode.offloads |= DEV_RX_OFFLOAD_RSS_HASH;
+		hw->rss_dis_flag = false;
 		rss_conf = conf->rx_adv_conf.rss_conf;
 		if (rss_conf.rss_key == NULL) {
 			rss_conf.rss_key = rss_cfg->key;
-- 
2.9.5