From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <dev-bounces@dpdk.org>
Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124])
	by inbox.dpdk.org (Postfix) with ESMTP id 26AFA4236B;
	Thu, 12 Oct 2023 04:21:54 +0200 (CEST)
Received: from mails.dpdk.org (localhost [127.0.0.1])
	by mails.dpdk.org (Postfix) with ESMTP id 13310402E6;
	Thu, 12 Oct 2023 04:21:54 +0200 (CEST)
Received: from szxga03-in.huawei.com (szxga03-in.huawei.com [45.249.212.189])
 by mails.dpdk.org (Postfix) with ESMTP id AEA13402E6
 for <dev@dpdk.org>; Thu, 12 Oct 2023 04:21:52 +0200 (CEST)
Received: from dggpeml100024.china.huawei.com (unknown [172.30.72.57])
 by szxga03-in.huawei.com (SkyGuard) with ESMTP id 4S5YFX6Xv3z1kv1Q;
 Thu, 12 Oct 2023 10:17:52 +0800 (CST)
Received: from [10.67.121.161] (10.67.121.161) by
 dggpeml100024.china.huawei.com (7.185.36.115) with Microsoft SMTP Server
 (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id
 15.1.2507.31; Thu, 12 Oct 2023 10:21:51 +0800
Subject: Re: [PATCH v5 02/40] ethdev: support setting and querying RSS
 algorithm
To: Stephen Hemminger <stephen@networkplumber.org>, Jie Hai
 <haijie1@huawei.com>
CC: <dev@dpdk.org>, Thomas Monjalon <thomas@monjalon.net>, Ferruh Yigit
 <ferruh.yigit@amd.com>, Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>, Ori
 Kam <orika@nvidia.com>, <lihuisong@huawei.com>, <liudongdong3@huawei.com>
References: <20230908080030.3837515-1-haijie1@huawei.com>
 <20231011092805.693171-1-haijie1@huawei.com>
 <20231011092805.693171-3-haijie1@huawei.com>
 <20231011103936.5ffcdd73@hermes.local>
From: fengchengwen <fengchengwen@huawei.com>
Message-ID: <c43e2c04-cf5b-a6f3-8c47-d8b77180fce5@huawei.com>
Date: Thu, 12 Oct 2023 10:21:51 +0800
User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:68.0) Gecko/20100101
 Thunderbird/68.11.0
MIME-Version: 1.0
In-Reply-To: <20231011103936.5ffcdd73@hermes.local>
Content-Type: text/plain; charset="utf-8"
Content-Language: en-US
Content-Transfer-Encoding: 7bit
X-Originating-IP: [10.67.121.161]
X-ClientProxiedBy: dggems705-chm.china.huawei.com (10.3.19.182) To
 dggpeml100024.china.huawei.com (7.185.36.115)
X-CFilter-Loop: Reflected
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.29
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



On 2023/10/12 1:39, Stephen Hemminger wrote:
> On Wed, 11 Oct 2023 17:27:27 +0800
> Jie Hai <haijie1@huawei.com> wrote:
> 
>> Currently, rte_eth_rss_conf supports configuring and querying
>> RSS hash functions, rss key and it's length, but not RSS hash
>> algorithm.
>>
>> The structure ``rte_eth_rss_conf`` is extended by adding a new
>> field "algorithm". This represents the RSS algorithms to apply.
>> The following API will be affected:
>> 	- rte_eth_dev_configure
>> 	- rte_eth_dev_rss_hash_update
>> 	- rte_eth_dev_rss_hash_conf_get
>>
>> If the value of "algorithm" used for configuration is a gibberish
>> value, report the error and return. Do the same for
>> rte_eth_dev_rss_hash_update and rte_eth_dev_configure.
>>
>> To check whether the drivers report valid "algorithm", it is set
>> to default value before querying.
>>
>> Signed-off-by: Jie Hai <haijie1@huawei.com>
>> Signed-off-by: Dongdong Liu <liudongdong3@huawei.com>
>> ---
>>  doc/guides/rel_notes/release_23_11.rst |  2 ++
>>  lib/ethdev/rte_ethdev.c                | 17 ++++++++++++++++
>>  lib/ethdev/rte_ethdev.h                | 27 +++++++++++++++++++++++++
>>  lib/ethdev/rte_flow.c                  |  1 -
>>  lib/ethdev/rte_flow.h                  | 28 ++------------------------
>>  5 files changed, 48 insertions(+), 27 deletions(-)
>>
>> diff --git a/doc/guides/rel_notes/release_23_11.rst b/doc/guides/rel_notes/release_23_11.rst
>> index e13d57728071..92a445ab2ed3 100644
>> --- a/doc/guides/rel_notes/release_23_11.rst
>> +++ b/doc/guides/rel_notes/release_23_11.rst
>> @@ -197,6 +197,8 @@ ABI Changes
>>    fields, to move ``rxq`` and ``txq`` fields, to change the size of
>>    ``reserved1`` and ``reserved2`` fields.
>>  
>> +* ethdev: Added "algorithm" field to ``rte_eth_rss_conf`` structure for RSS
>> +  hash algorithm.
>>  
>>  Known Issues
>>  ------------
>> diff --git a/lib/ethdev/rte_ethdev.c b/lib/ethdev/rte_ethdev.c
>> index 18a4b950b184..2eda1b8072e5 100644
>> --- a/lib/ethdev/rte_ethdev.c
>> +++ b/lib/ethdev/rte_ethdev.c
>> @@ -1464,6 +1464,14 @@ rte_eth_dev_configure(uint16_t port_id, uint16_t nb_rx_q, uint16_t nb_tx_q,
>>  		goto rollback;
>>  	}
>>  
>> +	if (dev_conf->rx_adv_conf.rss_conf.algorithm >= RTE_ETH_HASH_FUNCTION_MAX) {
>> +		RTE_ETHDEV_LOG(ERR,
>> +			"Ethdev port_id=%u invalid RSS algorithm: 0x%"PRIx64"\n",
>> +			port_id, dev_conf->rx_adv_conf.rss_conf.algorithm);
>> +		ret = -EINVAL;
>> +		goto rollback;
>> +	}
>> +
> 
> Rather than having every driver check the algorithm, why not handle this like
> other features in DPDK (which may mean API/ABI changes). 
> 
> Add a field rss_algo_capa which is bit field of available RSS functions.
> Then the check for algorithm can be done in generic code. There a couple
> of reserved fields that could be used.

+1 for add a field

But there are two ways to config rss: ethdev-ops, ethdev-rteflow-ops, should distinguish them ? or just define for ethdev-ops ?

> 
> It would mean updating all the drivers once with the capa field but
> would provide way for application to know what fields are possible.
> 
> It has proved to be a problem in later ABI changes if a maximum value
> is exposed. I.e don't expose RTE_ETH_HASH_FUNCTION_MAX.

+1

> 
> .
>