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 709CE41E3A; Fri, 10 Mar 2023 10:37:46 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id DEA3A42D69; Fri, 10 Mar 2023 10:36:44 +0100 (CET) Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by mails.dpdk.org (Postfix) with ESMTP id 199AA42D17; Fri, 10 Mar 2023 10:36:40 +0100 (CET) Received: from kwepemi500017.china.huawei.com (unknown [172.30.72.53]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4PY18C2Y5YznWrc; Fri, 10 Mar 2023 17:33:47 +0800 (CST) Received: from localhost.localdomain (10.28.79.22) by kwepemi500017.china.huawei.com (7.221.188.110) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.21; Fri, 10 Mar 2023 17:36:38 +0800 From: Dongdong Liu To: , , , CC: , , , Subject: [PATCH 11/16] net/hns3: use new RSS rule to configure hardware Date: Fri, 10 Mar 2023 17:35:13 +0800 Message-ID: <20230310093518.5198-12-liudongdong3@huawei.com> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20230310093518.5198-1-liudongdong3@huawei.com> References: <20230310093518.5198-1-liudongdong3@huawei.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [10.28.79.22] X-ClientProxiedBy: dggems706-chm.china.huawei.com (10.3.19.183) To kwepemi500017.china.huawei.com (7.221.188.110) X-CFilter-Loop: Reflected X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org From: Huisong Li 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. Cc: stable@dpdk.org 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 4da98d7adc..3700d073b1 100644 --- a/drivers/net/hns3/hns3_flow.c +++ b/drivers/net/hns3/hns3_flow.c @@ -1482,6 +1482,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; @@ -1501,10 +1502,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); @@ -1550,48 +1559,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 @@ -1680,7 +1668,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