From patchwork Sat Dec 21 10:32:49 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Wei Hu (Xavier)" X-Patchwork-Id: 64105 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 33424A04B3; Sat, 21 Dec 2019 11:34:32 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 58AF81BF93; Sat, 21 Dec 2019 11:33:21 +0100 (CET) Received: from incedge.chinasoftinc.com (unknown [114.113.233.8]) by dpdk.org (Postfix) with ESMTP id B52454CBD for ; Sat, 21 Dec 2019 11:33:06 +0100 (CET) X-ASG-Debug-ID: 1576924379-0a3dd11b2f40d90006-TfluYd Received: from mail.chinasoftinc.com (inccas002.ito.icss [10.168.0.52]) by incedge.chinasoftinc.com with ESMTP id AkCy1WlTMsH6eZ34 (version=TLSv1 cipher=ECDHE-RSA-AES256-SHA bits=256 verify=NO) for ; Sat, 21 Dec 2019 18:33:01 +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 (114.119.4.74) by INCCAS002.ito.icss (10.168.0.60) with Microsoft SMTP Server id 14.3.439.0; Sat, 21 Dec 2019 18:33:01 +0800 From: "Wei Hu (Xavier)" X-Barracuda-RBL-Trusted-Forwarder: 10.168.0.60 To: Date: Sat, 21 Dec 2019 18:32:49 +0800 X-ASG-Orig-Subj: [PATCH v3 5/9] net/hns3: optimize RSS's default algorithm Message-ID: <20191221103253.30746-6-huwei013@chinasoftinc.com> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20191221103253.30746-1-huwei013@chinasoftinc.com> References: <20191221103253.30746-1-huwei013@chinasoftinc.com> MIME-Version: 1.0 X-Originating-IP: [114.119.4.74] X-Barracuda-Connect: inccas002.ito.icss[10.168.0.52] X-Barracuda-Start-Time: 1576924381 X-Barracuda-Encrypted: ECDHE-RSA-AES256-SHA X-Barracuda-URL: https://spam.chinasoftinc.com:443/cgi-mod/mark.cgi X-Virus-Scanned: by bsmtpd at chinasoftinc.com X-Barracuda-Scan-Msg-Size: 2117 Subject: [dpdk-dev] [PATCH v3 5/9] net/hns3: optimize RSS's default algorithm 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: Hao Chen This patch changed the default algorithm of RSS from simle_xor to toeplitz because toeplitz is used more frequently by upper applications such as ceph. Signed-off-by: Hao Chen Signed-off-by: Wei Hu (Xavier) --- drivers/net/hns3/hns3_rss.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/drivers/net/hns3/hns3_rss.c b/drivers/net/hns3/hns3_rss.c index b8c20e6d9..dfc42f840 100644 --- a/drivers/net/hns3/hns3_rss.c +++ b/drivers/net/hns3/hns3_rss.c @@ -211,7 +211,11 @@ hns3_set_rss_tuple_by_rss_hf(struct hns3_hw *hw, req->ipv6_fragment_en |= HNS3_IP_OTHER_BIT_MASK; break; default: - /* Other unsupported flow types won't change tuples */ + /* + * rss_hf doesn't include unsupported flow types + * because the API framework has checked it, and + * this branch will never go unless rss_hf is zero. + */ break; } } @@ -251,8 +255,8 @@ hns3_dev_rss_hash_update(struct rte_eth_dev *dev, struct hns3_hw *hw = &hns->hw; struct hns3_rss_tuple_cfg *tuple = &hw->rss_info.rss_tuple_sets; struct hns3_rss_conf *rss_cfg = &hw->rss_info; - uint8_t algo = rss_cfg->conf.func; uint8_t key_len = rss_conf->rss_key_len; + uint8_t algo; uint64_t rss_hf = rss_conf->rss_hf; uint8_t *key = rss_conf->rss_key; int ret; @@ -285,6 +289,8 @@ hns3_dev_rss_hash_update(struct rte_eth_dev *dev, ret = -EINVAL; goto conf_err; } + algo = rss_cfg->conf.func == RTE_ETH_HASH_FUNCTION_SIMPLE_XOR ? + HNS3_RSS_HASH_ALGO_SIMPLE : HNS3_RSS_HASH_ALGO_TOEPLITZ; ret = hns3_set_rss_algo_key(hw, algo, key); if (ret) goto conf_err; @@ -500,7 +506,9 @@ hns3_set_default_rss_args(struct hns3_hw *hw) int i; /* Default hash algorithm */ - rss_cfg->conf.func = RTE_ETH_HASH_FUNCTION_SIMPLE_XOR; + rss_cfg->conf.func = RTE_ETH_HASH_FUNCTION_TOEPLITZ; + + /* Default RSS key */ memcpy(rss_cfg->key, hns3_hash_key, HNS3_RSS_KEY_SIZE); /* Initialize RSS indirection table */