From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 13A85427F6 for ; Tue, 21 Mar 2023 10:24:33 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id EEC3442D2F; Tue, 21 Mar 2023 10:24:30 +0100 (CET) Received: from szxga03-in.huawei.com (szxga03-in.huawei.com [45.249.212.189]) by mails.dpdk.org (Postfix) with ESMTP id 9F7DA410DF for ; Tue, 21 Mar 2023 10:24:28 +0100 (CET) Received: from kwepemm600004.china.huawei.com (unknown [172.30.72.54]) by szxga03-in.huawei.com (SkyGuard) with ESMTP id 4PgmPy3bPGz9vWB; Tue, 21 Mar 2023 17:24:06 +0800 (CST) Received: from localhost.localdomain (10.28.79.22) by kwepemm600004.china.huawei.com (7.193.23.242) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.21; Tue, 21 Mar 2023 17:24:26 +0800 From: Huisong Li To: , CC: , , , Subject: [PATCH 21.11 11/17] net/hns3: use new RSS rule to configure hardware Date: Tue, 21 Mar 2023 17:23:00 +0800 Message-ID: <20230321092306.16918-12-lihuisong@huawei.com> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20230321092306.16918-1-lihuisong@huawei.com> References: <20230321092306.16918-1-lihuisong@huawei.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [10.28.79.22] X-ClientProxiedBy: dggems702-chm.china.huawei.com (10.3.19.179) To kwepemm600004.china.huawei.com (7.193.23.242) X-CFilter-Loop: Reflected X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.29 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 [ upstream commit 218a119a08e01f203f92b46334b6b2f03ff9765d ] Remove redundant assignment and directly use new RSS rule to configure hardware. Additionally, considering that the new rule configuration may need to be modified, the 'const' of input parameter about it is removed. Signed-off-by: Huisong Li Signed-off-by: Dongdong Liu --- drivers/net/hns3/hns3_flow.c | 52 ++++++++++++++---------------------- 1 file changed, 20 insertions(+), 32 deletions(-) diff --git a/drivers/net/hns3/hns3_flow.c b/drivers/net/hns3/hns3_flow.c index 512ad6066d..f51e1439eb 100644 --- a/drivers/net/hns3/hns3_flow.c +++ b/drivers/net/hns3/hns3_flow.c @@ -1435,6 +1435,7 @@ hns3_hw_rss_hash_set(struct hns3_hw *hw, struct rte_flow_action_rss *rss_config) { uint8_t rss_key[HNS3_RSS_KEY_SIZE_MAX] = {0}; bool use_default_key = false; + uint64_t flow_types; uint8_t hash_algo; int ret; @@ -1454,10 +1455,18 @@ hns3_hw_rss_hash_set(struct hns3_hw *hw, struct rte_flow_action_rss *rss_config) hw->rss_key_size); if (ret) return ret; - hw->rss_info.rte_flow_hash_algo = hash_algo; - ret = hns3_set_rss_tuple_by_rss_hf(hw, rss_config->types); + /* Filter the unsupported flow types */ + flow_types = rss_config->types ? + rss_config->types & HNS3_ETH_RSS_SUPPORT : + hw->rss_info.rss_hf; + if (flow_types != rss_config->types) + hns3_warn(hw, "modified RSS types based on hardware support," + " requested:0x%" PRIx64 " configured:0x%" PRIx64, + rss_config->types, flow_types); + + ret = hns3_set_rss_tuple_by_rss_hf(hw, flow_types); if (ret) hns3_err(hw, "Update RSS tuples by rss hf failed %d", ret); @@ -1503,48 +1512,27 @@ hns3_reset_rss_filter(struct hns3_hw *hw, const struct hns3_rss_conf *conf) } static int -hns3_config_rss_filter(struct hns3_hw *hw, const struct hns3_rss_conf *conf) +hns3_config_rss_filter(struct hns3_hw *hw, struct hns3_rss_conf *conf) { - uint64_t flow_types; + struct rte_flow_action_rss *rss_act; uint16_t num; int ret; - struct rte_flow_action_rss rss_flow_conf = { - .func = conf->conf.func, - .level = conf->conf.level, - .types = conf->conf.types, - .key_len = conf->conf.key_len, - .queue_num = conf->conf.queue_num, - .key = conf->conf.key_len ? - (void *)(uintptr_t)conf->conf.key : NULL, - .queue = conf->conf.queue, - }; - + rss_act = &conf->conf; /* Set rx queues to use */ - num = RTE_MIN(hw->data->nb_rx_queues, rss_flow_conf.queue_num); - if (rss_flow_conf.queue_num > num) + num = RTE_MIN(hw->data->nb_rx_queues, rss_act->queue_num); + if (rss_act->queue_num > num) hns3_warn(hw, "Config queue numbers %u are beyond the scope of truncated", - rss_flow_conf.queue_num); + rss_act->queue_num); hns3_info(hw, "Max of contiguous %u PF queues are configured", num); if (num) { - ret = hns3_update_indir_table(hw, &rss_flow_conf, num); + ret = hns3_update_indir_table(hw, rss_act, num); if (ret) return ret; } - /* Filter the unsupported flow types */ - flow_types = conf->conf.types ? - rss_flow_conf.types & HNS3_ETH_RSS_SUPPORT : - hw->rss_info.rss_hf; - if (flow_types != rss_flow_conf.types) - hns3_warn(hw, "modified RSS types based on hardware support," - " requested:0x%" PRIx64 " configured:0x%" PRIx64, - rss_flow_conf.types, flow_types); - /* Update the useful flow types */ - rss_flow_conf.types = flow_types; - /* Set hash algorithm and flow types by the user's config */ - return hns3_hw_rss_hash_set(hw, &rss_flow_conf); + return hns3_hw_rss_hash_set(hw, rss_act); } static int @@ -1634,7 +1622,7 @@ hns3_rss_action_is_dup(struct hns3_hw *hw, } static int -hns3_flow_parse_rss(struct rte_eth_dev *dev, const struct hns3_rss_conf *conf) +hns3_flow_parse_rss(struct rte_eth_dev *dev, struct hns3_rss_conf *conf) { struct hns3_adapter *hns = dev->data->dev_private; struct hns3_hw *hw = &hns->hw; -- 2.22.0