[PATCH v9 2/9] ethdev: support setting and querying RSS algorithm
Ferruh Yigit
ferruh.yigit at amd.com
Fri Nov 3 16:52:53 CET 2023
On 11/2/2023 8:20 AM, Jie Hai 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_dev_info`` is extended by adding a new
> field "rss_algo_capa". Drivers are responsible for reporting this
> capa and configurations of RSS hash algorithm can be verified based
> on the capability. The default value of "rss_algo_capa" is
> RTE_ETH_HASH_ALGO_CAPA_MASK(DEFAULT) if drivers do not report it.
>
> The structure ``rte_eth_rss_conf`` is extended by adding a new
> field "algorithm". This represents the RSS algorithms to apply.
> If the value of "algorithm" used for configuration is a gibberish
> value, drivers should report the error.
>
> To check whether the drivers report valid "algorithm", it is set
> to default value before querying in rte_eth_dev_rss_hash_conf_get().
>
> Signed-off-by: Jie Hai <haijie1 at huawei.com>
> Signed-off-by: Dongdong Liu <liudongdong3 at huawei.com>
> Acked-by: Huisong Li <lihuisong at huawei.com>
> Acked-by: Chengwen Feng <fengchengwen at huawei.com>
<...>
> --- a/lib/ethdev/rte_ethdev.c
> +++ b/lib/ethdev/rte_ethdev.c
> @@ -1269,6 +1269,7 @@ int
> rte_eth_dev_configure(uint16_t port_id, uint16_t nb_rx_q, uint16_t nb_tx_q,
> const struct rte_eth_conf *dev_conf)
> {
> + enum rte_eth_hash_function algorithm;
> struct rte_eth_dev *dev;
> struct rte_eth_dev_info dev_info;
> struct rte_eth_conf orig_conf;
> @@ -1510,6 +1511,17 @@ rte_eth_dev_configure(uint16_t port_id, uint16_t nb_rx_q, uint16_t nb_tx_q,
> goto rollback;
> }
>
> + algorithm = dev_conf->rx_adv_conf.rss_conf.algorithm;
> + if (algorithm >= CHAR_BIT * sizeof(dev_info.rss_algo_capa) ||
>
This cause build error [1] on Windows Server 2019 [2], will fix in
next-net [3].
[1]
../lib/ethdev/rte_ethdev.c:1526:16: error: comparison of integers of
different signs: 'enum rte_eth_hash_function' and 'unsigned long long'
[-Werror,-Wsign-compare]
if (algorithm >= CHAR_BIT * sizeof(dev_info.rss_algo_capa) ||
~~~~~~~~~ ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../lib/ethdev/rte_ethdev.c:4743:26: error: comparison of integers of
different signs: 'enum rte_eth_hash_function' and 'unsigned long long'
[-Werror,-Wsign-compare]
if (rss_conf->algorithm >= CHAR_BIT * sizeof(dev_info.rss_algo_capa) ||
~~~~~~~~~~~~~~~~~~~ ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[2]
https://mails.dpdk.org/archives/test-report/2023-November/499757.html
[3]
@@ -1523,7 +1523,7 @@ rte_eth_dev_configure(uint16_t port_id, uint16_t
nb_rx_q, uint16_t nb_tx_q,
}
algorithm = dev_conf->rx_adv_conf.rss_conf.algorithm;
- if (algorithm >= CHAR_BIT * sizeof(dev_info.rss_algo_capa) ||
+ if ((size_t)algorithm >= CHAR_BIT *
sizeof(dev_info.rss_algo_capa) ||
(dev_info.rss_algo_capa &
RTE_ETH_HASH_ALGO_TO_CAPA(algorithm)) == 0) {
RTE_ETHDEV_LOG(ERR,
"Ethdev port_id=%u configured RSS hash
algorithm (%u)"
@@ -4748,7 +4748,7 @@ rte_eth_dev_rss_hash_update(uint16_t port_id,
return -EINVAL;
}
- if (rss_conf->algorithm >= CHAR_BIT *
sizeof(dev_info.rss_algo_capa) ||
+ if ((size_t)rss_conf->algorithm >= CHAR_BIT *
sizeof(dev_info.rss_algo_capa) ||
(dev_info.rss_algo_capa &
RTE_ETH_HASH_ALGO_TO_CAPA(rss_conf->algorithm)) == 0) {
RTE_ETHDEV_LOG(ERR,
More information about the dev
mailing list