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 126EF427F6 for ; Tue, 21 Mar 2023 10:24:34 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 699D742C24; Tue, 21 Mar 2023 10:24:33 +0100 (CET) Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by mails.dpdk.org (Postfix) with ESMTP id D1EB342B7E for ; Tue, 21 Mar 2023 10:24:29 +0100 (CET) Received: from kwepemm600004.china.huawei.com (unknown [172.30.72.56]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4PgmMm31h8zKsgc; Tue, 21 Mar 2023 17:22:12 +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:28 +0800 From: Huisong Li To: , CC: , , , Subject: [PATCH 21.11 15/17] net/hns3: separate flow RSS config from RSS conf Date: Tue, 21 Mar 2023 17:23:04 +0800 Message-ID: <20230321092306.16918-16-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 b93ad0cc7677881911e5fc3baa89e0a0bbd73c48 ] Some RSS fields in struct hns3_rss_conf (e.g. conf, queue, valid) are only used when create RSS flow rule, which is unnecessary for RSS configuration information from ethdev ops. This patch removes these fields from hns3_rss_conf and add a new struct hns3_flow_rss_conf as rte flow RSS filter list node element. Signed-off-by: Huisong Li Signed-off-by: Dongdong Liu --- drivers/net/hns3/hns3_flow.c | 23 ++++++++++++----------- drivers/net/hns3/hns3_flow.h | 10 +++++++++- drivers/net/hns3/hns3_rss.h | 5 ----- 3 files changed, 21 insertions(+), 17 deletions(-) diff --git a/drivers/net/hns3/hns3_flow.c b/drivers/net/hns3/hns3_flow.c index ce5e39b694..af5d2a5767 100644 --- a/drivers/net/hns3/hns3_flow.c +++ b/drivers/net/hns3/hns3_flow.c @@ -1312,7 +1312,6 @@ hns3_parse_rss_filter(struct rte_eth_dev *dev, { struct hns3_adapter *hns = dev->data->dev_private; struct hns3_hw *hw = &hns->hw; - struct hns3_rss_conf *rss_conf = &hw->rss_info; const struct rte_flow_action_rss *rss; const struct rte_flow_action *act; uint32_t act_index = 0; @@ -1327,7 +1326,7 @@ hns3_parse_rss_filter(struct rte_eth_dev *dev, act, "no valid queues"); } - if (rss->queue_num > RTE_DIM(rss_conf->queue)) + if (rss->queue_num > HNS3_RSS_QUEUES_BUFFER_NUM) return rte_flow_error_set(error, ENOTSUP, RTE_FLOW_ERROR_TYPE_ACTION_CONF, act, "queue number configured exceeds " @@ -1392,7 +1391,7 @@ hns3_disable_rss(struct hns3_hw *hw) } static int -hns3_parse_rss_algorithm(struct hns3_hw *hw, struct hns3_rss_conf *rss_conf, +hns3_parse_rss_algorithm(struct hns3_hw *hw, struct hns3_flow_rss_conf *rss_conf, uint8_t *hash_algo) { const uint8_t hash_func_map[] = { @@ -1419,8 +1418,8 @@ hns3_parse_rss_algorithm(struct hns3_hw *hw, struct hns3_rss_conf *rss_conf, * rte_flow_hash_algo) when this rule is delivered. */ if (__atomic_load_n(&hw->reset.resetting, __ATOMIC_RELAXED) && - *hash_algo != rss_conf->rte_flow_hash_algo) - *hash_algo = rss_conf->rte_flow_hash_algo; + *hash_algo != rss_conf->hash_algo) + *hash_algo = rss_conf->hash_algo; return 0; } @@ -1431,7 +1430,7 @@ hns3_parse_rss_algorithm(struct hns3_hw *hw, struct hns3_rss_conf *rss_conf, } static int -hns3_hw_rss_hash_set(struct hns3_hw *hw, struct hns3_rss_conf *conf) +hns3_hw_rss_hash_set(struct hns3_hw *hw, struct hns3_flow_rss_conf *conf) { struct rte_flow_action_rss *rss_config = &conf->conf; uint8_t rss_key[HNS3_RSS_KEY_SIZE_MAX] = {0}; @@ -1456,7 +1455,7 @@ hns3_hw_rss_hash_set(struct hns3_hw *hw, struct hns3_rss_conf *conf) hw->rss_key_size); if (ret) return ret; - conf->rte_flow_hash_algo = hash_algo; + conf->hash_algo = hash_algo; /* Filter the unsupported flow types */ flow_types = rss_config->types ? @@ -1498,7 +1497,8 @@ hns3_update_indir_table(struct hns3_hw *hw, } static int -hns3_reset_rss_filter(struct hns3_hw *hw, const struct hns3_rss_conf *conf) +hns3_reset_rss_filter(struct hns3_hw *hw, + const struct hns3_flow_rss_conf *conf) { int ret; @@ -1513,7 +1513,7 @@ hns3_reset_rss_filter(struct hns3_hw *hw, const struct hns3_rss_conf *conf) } static int -hns3_config_rss_filter(struct hns3_hw *hw, struct hns3_rss_conf *conf) +hns3_config_rss_filter(struct hns3_hw *hw, struct hns3_flow_rss_conf *conf) { struct rte_flow_action_rss *rss_act; uint16_t num; @@ -1623,7 +1623,8 @@ hns3_rss_action_is_dup(struct hns3_hw *hw, } static int -hns3_flow_parse_rss(struct rte_eth_dev *dev, struct hns3_rss_conf *conf) +hns3_flow_parse_rss(struct rte_eth_dev *dev, + struct hns3_flow_rss_conf *conf) { struct hns3_adapter *hns = dev->data->dev_private; struct hns3_hw *hw = &hns->hw; @@ -1693,8 +1694,8 @@ hns3_flow_create_rss_rule(struct rte_eth_dev *dev, struct hns3_hw *hw = HNS3_DEV_PRIVATE_TO_HW(dev->data->dev_private); const struct rte_flow_action_rss *rss_act; struct hns3_rss_conf_ele *rss_filter_ptr; + struct hns3_flow_rss_conf *new_conf; struct hns3_rss_conf_ele *filter_ptr; - struct hns3_rss_conf *new_conf; int ret; rss_filter_ptr = rte_zmalloc("hns3 rss filter", diff --git a/drivers/net/hns3/hns3_flow.h b/drivers/net/hns3/hns3_flow.h index e90d2211e4..e6a8a425d8 100644 --- a/drivers/net/hns3/hns3_flow.h +++ b/drivers/net/hns3/hns3_flow.h @@ -21,10 +21,18 @@ struct rte_flow { uint32_t counter_id; }; +struct hns3_flow_rss_conf { + struct rte_flow_action_rss conf; + uint8_t hash_algo; + uint8_t key[HNS3_RSS_KEY_SIZE_MAX]; /* Hash key */ + uint16_t queue[HNS3_RSS_QUEUES_BUFFER_NUM]; /* Queues indices to use */ + bool valid; /* check if RSS rule is valid */ +}; + /* rss filter list structure */ struct hns3_rss_conf_ele { TAILQ_ENTRY(hns3_rss_conf_ele) entries; - struct hns3_rss_conf filter_info; + struct hns3_flow_rss_conf filter_info; }; /* hns3_flow memory list structure */ diff --git a/drivers/net/hns3/hns3_rss.h b/drivers/net/hns3/hns3_rss.h index 5af2eb21b5..07f6db2652 100644 --- a/drivers/net/hns3/hns3_rss.h +++ b/drivers/net/hns3/hns3_rss.h @@ -39,15 +39,10 @@ /* Same as the Max queue num under TC */ #define HNS3_RSS_QUEUES_BUFFER_NUM 512 struct hns3_rss_conf { - /* RSS parameters :algorithm, flow_types, key, queue */ - struct rte_flow_action_rss conf; uint64_t rss_hf; uint8_t hash_algo; /* hash function type defined by hardware */ - uint8_t rte_flow_hash_algo; uint8_t key[HNS3_RSS_KEY_SIZE_MAX]; /* Hash key */ uint16_t rss_indirection_tbl[HNS3_RSS_IND_TBL_SIZE_MAX]; - uint16_t queue[HNS3_RSS_QUEUES_BUFFER_NUM]; /* Queues indices to use */ - bool valid; /* check if RSS rule is valid */ /* * For IPv6 SCTP packets type, check whether the NIC hardware support * RSS hash using the src/dst port as the input tuple. For Kunpeng920 -- 2.22.0