[v5,05/40] net/bnx2x: check RSS hash algorithms

Message ID 20231011092805.693171-6-haijie1@huawei.com (mailing list archive)
State Changes Requested, archived
Delegated to: Ferruh Yigit
Headers
Series support setting and querying RSS algorithms |

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

Jie Hai Oct. 11, 2023, 9:27 a.m. UTC
  A new field 'algorithm' has been added to rss_conf, check it
in case of ignoring unsupported values.

Signed-off-by: Jie Hai <haijie1@huawei.com>
---
 drivers/net/bnx2x/bnx2x_ethdev.c | 4 ++++
 1 file changed, 4 insertions(+)
  

Comments

Ferruh Yigit Oct. 11, 2023, 5:02 p.m. UTC | #1
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@huawei.com>
> ---
>  drivers/net/bnx2x/bnx2x_ethdev.c | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/drivers/net/bnx2x/bnx2x_ethdev.c b/drivers/net/bnx2x/bnx2x_ethdev.c
> index 4448cf2de2d7..078d6db75d1b 100644
> --- a/drivers/net/bnx2x/bnx2x_ethdev.c
> +++ b/drivers/net/bnx2x/bnx2x_ethdev.c
> @@ -196,6 +196,10 @@ bnx2x_dev_configure(struct rte_eth_dev *dev)
>  	PMD_DRV_LOG(DEBUG, sc, "num_queues=%d, mtu=%d",
>  		       sc->num_queues, sc->mtu);
>  
> +	if (dev->data->dev_conf.rx_adv_conf.rss_conf.algorithm !=
> +	    RTE_ETH_HASH_FUNCTION_DEFAULT)
> +		return -EINVAL;
> +
>  	/* allocate ilt */
>  	if (bnx2x_alloc_ilt_mem(sc) != 0) {
>  		PMD_DRV_LOG(ERR, sc, "bnx2x_alloc_ilt_mem was failed");

bnx2x doesn't claim RSS support (doc/guides/nics/features/bnx2x.ini), so
I think it will be reasonable to drop this patch.
  

Patch

diff --git a/drivers/net/bnx2x/bnx2x_ethdev.c b/drivers/net/bnx2x/bnx2x_ethdev.c
index 4448cf2de2d7..078d6db75d1b 100644
--- a/drivers/net/bnx2x/bnx2x_ethdev.c
+++ b/drivers/net/bnx2x/bnx2x_ethdev.c
@@ -196,6 +196,10 @@  bnx2x_dev_configure(struct rte_eth_dev *dev)
 	PMD_DRV_LOG(DEBUG, sc, "num_queues=%d, mtu=%d",
 		       sc->num_queues, sc->mtu);
 
+	if (dev->data->dev_conf.rx_adv_conf.rss_conf.algorithm !=
+	    RTE_ETH_HASH_FUNCTION_DEFAULT)
+		return -EINVAL;
+
 	/* allocate ilt */
 	if (bnx2x_alloc_ilt_mem(sc) != 0) {
 		PMD_DRV_LOG(ERR, sc, "bnx2x_alloc_ilt_mem was failed");