[PATCH v5 21/40] net/igc: check RSS hash algorithms

Ferruh Yigit ferruh.yigit at amd.com
Wed Oct 11 19:51:12 CEST 2023


On 10/11/2023 10:27 AM, Jie Hai wrote:
> A new field 'algorithm' has been added to rss_conf, check it
> in case of ignoring unsupported values.
> 
> Signed-off-by: Jie Hai <haijie1 at huawei.com>
> ---
>  drivers/net/igc/igc_ethdev.c | 4 ++++
>  drivers/net/igc/igc_txrx.c   | 5 +++++
>  2 files changed, 9 insertions(+)
> 
> diff --git a/drivers/net/igc/igc_ethdev.c b/drivers/net/igc/igc_ethdev.c
> index 58c4f8092772..11c0f5ff231b 100644
> --- a/drivers/net/igc/igc_ethdev.c
> +++ b/drivers/net/igc/igc_ethdev.c
> @@ -2442,6 +2442,10 @@ eth_igc_rss_hash_update(struct rte_eth_dev *dev,
>  			struct rte_eth_rss_conf *rss_conf)
>  {
>  	struct igc_hw *hw = IGC_DEV_PRIVATE_HW(dev);
> +
> +	if (rss_conf->algorithm != RTE_ETH_HASH_FUNCTION_DEFAULT)
> +		return -EINVAL;
> +
>  	igc_hw_rss_hash_set(hw, rss_conf);
>  	return 0;
>  }
> diff --git a/drivers/net/igc/igc_txrx.c b/drivers/net/igc/igc_txrx.c
> index 5c60e3e99709..5e62e00d2ad9 100644
> --- a/drivers/net/igc/igc_txrx.c
> +++ b/drivers/net/igc/igc_txrx.c
> @@ -818,6 +818,7 @@ igc_rss_configure(struct rte_eth_dev *dev)
>  	rss_conf = dev->data->dev_conf.rx_adv_conf.rss_conf;
>  	if (rss_conf.rss_key == NULL)
>  		rss_conf.rss_key = default_rss_key;
> +
>

unintended change

>  	igc_hw_rss_hash_set(hw, &rss_conf);
>  }
>  
> @@ -958,6 +959,10 @@ igc_dev_mq_rx_configure(struct rte_eth_dev *dev)
>  		return -EINVAL;
>  	}
>  
> +	if (dev->data->dev_conf.rx_adv_conf.rss_conf.algorithm !=
> +	    RTE_ETH_HASH_FUNCTION_DEFAULT)
> +		return -EINVAL;
> +
>  	switch (dev->data->dev_conf.rxmode.mq_mode) {
>  	case RTE_ETH_MQ_RX_RSS:
>  		igc_rss_configure(dev);



More information about the dev mailing list