[dpdk-dev] net/mlx5: add supported hash function check

Message ID 20180318073720.84176-1-xuemingl@mellanox.com (mailing list archive)
State Superseded, archived
Delegated to: Shahaf Shuler
Headers

Checks

Context Check Description
ci/checkpatch warning coding style issues
ci/Intel-compilation success Compilation OK

Commit Message

Xueming Li March 18, 2018, 7:37 a.m. UTC
  Add supported RSS hash function check in device configuration to
have better error verbosity for application developers.

Signed-off-by: Xueming Li <xuemingl@mellanox.com>
---
 drivers/net/mlx5/mlx5_ethdev.c | 8 ++++++++
 1 file changed, 8 insertions(+)
  

Comments

Nélio Laranjeiro March 19, 2018, 8:29 a.m. UTC | #1
On Sun, Mar 18, 2018 at 03:37:20PM +0800, Xueming Li wrote:
> Add supported RSS hash function check in device configuration to
> have better error verbosity for application developers.
>
> Signed-off-by: Xueming Li <xuemingl@mellanox.com>
> ---
>  drivers/net/mlx5/mlx5_ethdev.c | 8 ++++++++
>  1 file changed, 8 insertions(+)
> 
> diff --git a/drivers/net/mlx5/mlx5_ethdev.c b/drivers/net/mlx5/mlx5_ethdev.c
> index b73cb53..175a1ff 100644
> --- a/drivers/net/mlx5/mlx5_ethdev.c
> +++ b/drivers/net/mlx5/mlx5_ethdev.c
> @@ -346,6 +346,14 @@ struct ethtool_link_settings {
>  		      rx_offloads, supp_rx_offloads);
>  		return ENOTSUP;
>  	}
> +	if (dev->data->dev_conf.rx_adv_conf.rss_conf.rss_hf &
> +	    MLX5_RSS_HF_MASK) {
> +		ERROR("Some RSS hash function not supported "
> +		      "requested 0x%" PRIx64 " supported 0x%" PRIx64,
> +		      dev->data->dev_conf.rx_adv_conf.rss_conf.rss_hf,
> +		      (uint64_t)(~MLX5_RSS_HF_MASK));
> +		return ENOTSUP;
> +	}
>  	if (use_app_rss_key &&
>  	    (dev->data->dev_conf.rx_adv_conf.rss_conf.rss_key_len !=
>  	     rss_hash_default_key_len)) {
> -- 
> 1.8.3.1
> 

I would answer than an application should not try to configure something
not advertise by the device. 
This information is present in struct rte_eth_dev_info returned by
mlx5_dev_infos_get() and thus the devops of the device.

Seems rte_eth_dev_configure() should be fixed to avoid configuring wrong
values.

Regards,
  
Xueming Li March 22, 2018, 10:42 a.m. UTC | #2
Just remind, denying unsupported hash function in rte_eth_dev_configure() might
impact some user app using PMD that simply ignoring them silently.

Testpmd command "port config <port> rss all" should be updated as well 
to 'all' supported values from rte_eth_dev_info, I'll include this change in 
next version.

> -----Original Message-----

> From: Nélio Laranjeiro [mailto:nelio.laranjeiro@6wind.com]

> Sent: Monday, March 19, 2018 4:30 PM

> To: Xueming(Steven) Li <xuemingl@mellanox.com>

> Cc: Adrien Mazarguil <adrien.mazarguil@6wind.com>; Shahaf Shuler

> <shahafs@mellanox.com>; dev@dpdk.org

> Subject: Re: [PATCH] net/mlx5: add supported hash function check

> 

> On Sun, Mar 18, 2018 at 03:37:20PM +0800, Xueming Li wrote:

> > Add supported RSS hash function check in device configuration to have

> > better error verbosity for application developers.

> >

> > Signed-off-by: Xueming Li <xuemingl@mellanox.com>

> > ---

> >  drivers/net/mlx5/mlx5_ethdev.c | 8 ++++++++

> >  1 file changed, 8 insertions(+)

> >

> > diff --git a/drivers/net/mlx5/mlx5_ethdev.c

> > b/drivers/net/mlx5/mlx5_ethdev.c index b73cb53..175a1ff 100644

> > --- a/drivers/net/mlx5/mlx5_ethdev.c

> > +++ b/drivers/net/mlx5/mlx5_ethdev.c

> > @@ -346,6 +346,14 @@ struct ethtool_link_settings {

> >  		      rx_offloads, supp_rx_offloads);

> >  		return ENOTSUP;

> >  	}

> > +	if (dev->data->dev_conf.rx_adv_conf.rss_conf.rss_hf &

> > +	    MLX5_RSS_HF_MASK) {

> > +		ERROR("Some RSS hash function not supported "

> > +		      "requested 0x%" PRIx64 " supported 0x%" PRIx64,

> > +		      dev->data->dev_conf.rx_adv_conf.rss_conf.rss_hf,

> > +		      (uint64_t)(~MLX5_RSS_HF_MASK));

> > +		return ENOTSUP;

> > +	}

> >  	if (use_app_rss_key &&

> >  	    (dev->data->dev_conf.rx_adv_conf.rss_conf.rss_key_len !=

> >  	     rss_hash_default_key_len)) {

> > --

> > 1.8.3.1

> >

> 

> I would answer than an application should not try to configure something

> not advertise by the device.

> This information is present in struct rte_eth_dev_info returned by

> mlx5_dev_infos_get() and thus the devops of the device.

> 

> Seems rte_eth_dev_configure() should be fixed to avoid configuring wrong

> values.

> 

> Regards,

> 

> --

> Nélio Laranjeiro

> 6WIND
  
Nélio Laranjeiro March 26, 2018, 11:39 a.m. UTC | #3
On Thu, Mar 22, 2018 at 10:42:44AM +0000, Xueming(Steven) Li wrote:
> Just remind, denying unsupported hash function in rte_eth_dev_configure() might
> impact some user app using PMD that simply ignoring them silently.

If the default behavior from other devices is to use only possible
values, this device should to the same instead of refusing it.

> Testpmd command "port config <port> rss all" should be updated as well 
> to 'all' supported values from rte_eth_dev_info, I'll include this change in 
> next version.
>
> > -----Original Message-----
> > From: Nélio Laranjeiro [mailto:nelio.laranjeiro@6wind.com]
> > Sent: Monday, March 19, 2018 4:30 PM
> > To: Xueming(Steven) Li <xuemingl@mellanox.com>
> > Cc: Adrien Mazarguil <adrien.mazarguil@6wind.com>; Shahaf Shuler
> > <shahafs@mellanox.com>; dev@dpdk.org
> > Subject: Re: [PATCH] net/mlx5: add supported hash function check
> > 
> > On Sun, Mar 18, 2018 at 03:37:20PM +0800, Xueming Li wrote:
> > > Add supported RSS hash function check in device configuration to have
> > > better error verbosity for application developers.
> > >
> > > Signed-off-by: Xueming Li <xuemingl@mellanox.com>
> > > ---
> > >  drivers/net/mlx5/mlx5_ethdev.c | 8 ++++++++
> > >  1 file changed, 8 insertions(+)
> > >
> > > diff --git a/drivers/net/mlx5/mlx5_ethdev.c
> > > b/drivers/net/mlx5/mlx5_ethdev.c index b73cb53..175a1ff 100644
> > > --- a/drivers/net/mlx5/mlx5_ethdev.c
> > > +++ b/drivers/net/mlx5/mlx5_ethdev.c
> > > @@ -346,6 +346,14 @@ struct ethtool_link_settings {
> > >  		      rx_offloads, supp_rx_offloads);
> > >  		return ENOTSUP;
> > >  	}
> > > +	if (dev->data->dev_conf.rx_adv_conf.rss_conf.rss_hf &
> > > +	    MLX5_RSS_HF_MASK) {
> > > +		ERROR("Some RSS hash function not supported "
> > > +		      "requested 0x%" PRIx64 " supported 0x%" PRIx64,
> > > +		      dev->data->dev_conf.rx_adv_conf.rss_conf.rss_hf,
> > > +		      (uint64_t)(~MLX5_RSS_HF_MASK));
> > > +		return ENOTSUP;
> > > +	}
> > >  	if (use_app_rss_key &&
> > >  	    (dev->data->dev_conf.rx_adv_conf.rss_conf.rss_key_len !=
> > >  	     rss_hash_default_key_len)) {
> > > --
> > > 1.8.3.1
> > >
> > 
> > I would answer than an application should not try to configure something
> > not advertise by the device.
> > This information is present in struct rte_eth_dev_info returned by
> > mlx5_dev_infos_get() and thus the devops of the device.
> > 
> > Seems rte_eth_dev_configure() should be fixed to avoid configuring wrong
> > values.
> > 
> > Regards,
> > 
> > --
> > Nélio Laranjeiro
> > 6WIND
  
Xueming Li April 2, 2018, 12:41 p.m. UTC | #4
> this device should to the same instead of refusing it


Just double confirm, is it "do the same"? are you suggesting not denying
unsupported hash function in rte_eth_dev_configure()? 

From quick view of ixgbe code, kind of try best, would like to hear from 
other PMDs on how this interpreted. 

> -----Original Message-----

> From: Nélio Laranjeiro [mailto:nelio.laranjeiro@6wind.com]

> Sent: Monday, March 26, 2018 7:40 PM

> To: Xueming(Steven) Li <xuemingl@mellanox.com>

> Cc: Adrien Mazarguil <adrien.mazarguil@6wind.com>; Shahaf Shuler

> <shahafs@mellanox.com>; dev@dpdk.org

> Subject: Re: [PATCH] net/mlx5: add supported hash function check

> 

> On Thu, Mar 22, 2018 at 10:42:44AM +0000, Xueming(Steven) Li wrote:

> > Just remind, denying unsupported hash function in

> > rte_eth_dev_configure() might impact some user app using PMD that simply

> ignoring them silently.

> 

> If the default behavior from other devices is to use only possible values,

> this device should to the same instead of refusing it.

> 

> > Testpmd command "port config <port> rss all" should be updated as well

> > to 'all' supported values from rte_eth_dev_info, I'll include this

> > change in next version.

> >

> > > -----Original Message-----

> > > From: Nélio Laranjeiro [mailto:nelio.laranjeiro@6wind.com]

> > > Sent: Monday, March 19, 2018 4:30 PM

> > > To: Xueming(Steven) Li <xuemingl@mellanox.com>

> > > Cc: Adrien Mazarguil <adrien.mazarguil@6wind.com>; Shahaf Shuler

> > > <shahafs@mellanox.com>; dev@dpdk.org

> > > Subject: Re: [PATCH] net/mlx5: add supported hash function check

> > >

> > > On Sun, Mar 18, 2018 at 03:37:20PM +0800, Xueming Li wrote:

> > > > Add supported RSS hash function check in device configuration to

> > > > have better error verbosity for application developers.

> > > >

> > > > Signed-off-by: Xueming Li <xuemingl@mellanox.com>

> > > > ---

> > > >  drivers/net/mlx5/mlx5_ethdev.c | 8 ++++++++

> > > >  1 file changed, 8 insertions(+)

> > > >

> > > > diff --git a/drivers/net/mlx5/mlx5_ethdev.c

> > > > b/drivers/net/mlx5/mlx5_ethdev.c index b73cb53..175a1ff 100644

> > > > --- a/drivers/net/mlx5/mlx5_ethdev.c

> > > > +++ b/drivers/net/mlx5/mlx5_ethdev.c

> > > > @@ -346,6 +346,14 @@ struct ethtool_link_settings {

> > > >  		      rx_offloads, supp_rx_offloads);

> > > >  		return ENOTSUP;

> > > >  	}

> > > > +	if (dev->data->dev_conf.rx_adv_conf.rss_conf.rss_hf &

> > > > +	    MLX5_RSS_HF_MASK) {

> > > > +		ERROR("Some RSS hash function not supported "

> > > > +		      "requested 0x%" PRIx64 " supported 0x%" PRIx64,

> > > > +		      dev->data->dev_conf.rx_adv_conf.rss_conf.rss_hf,

> > > > +		      (uint64_t)(~MLX5_RSS_HF_MASK));

> > > > +		return ENOTSUP;

> > > > +	}

> > > >  	if (use_app_rss_key &&

> > > >  	    (dev->data->dev_conf.rx_adv_conf.rss_conf.rss_key_len !=

> > > >  	     rss_hash_default_key_len)) {

> > > > --

> > > > 1.8.3.1

> > > >

> > >

> > > I would answer than an application should not try to configure

> > > something not advertise by the device.

> > > This information is present in struct rte_eth_dev_info returned by

> > > mlx5_dev_infos_get() and thus the devops of the device.

> > >

> > > Seems rte_eth_dev_configure() should be fixed to avoid configuring

> > > wrong values.

> > >

> > > Regards,

> > >

> > > --

> > > Nélio Laranjeiro

> > > 6WIND

> 

> --

> Nélio Laranjeiro

> 6WIND
  
Nélio Laranjeiro April 4, 2018, 7:35 a.m. UTC | #5
On Mon, Apr 02, 2018 at 12:41:33PM +0000, Xueming(Steven) Li wrote:
> > this device should to the same instead of refusing it
> 
> Just double confirm, is it "do the same"? are you suggesting not denying
> unsupported hash function in rte_eth_dev_configure()?

I mean, if others PMD are ignoring non supported values, but only using
what they support, this PMD should do the same.

> From quick view of ixgbe code, kind of try best, would like to hear from 
> other PMDs on how this interpreted.

Don't expect other maintainers to answer you if you don't ask them
directly.

> > -----Original Message-----
> > From: Nélio Laranjeiro [mailto:nelio.laranjeiro@6wind.com]
> > Sent: Monday, March 26, 2018 7:40 PM
> > To: Xueming(Steven) Li <xuemingl@mellanox.com>
> > Cc: Adrien Mazarguil <adrien.mazarguil@6wind.com>; Shahaf Shuler
> > <shahafs@mellanox.com>; dev@dpdk.org
> > Subject: Re: [PATCH] net/mlx5: add supported hash function check
> > 
> > On Thu, Mar 22, 2018 at 10:42:44AM +0000, Xueming(Steven) Li wrote:
> > > Just remind, denying unsupported hash function in
> > > rte_eth_dev_configure() might impact some user app using PMD that simply
> > ignoring them silently.
> > 
> > If the default behavior from other devices is to use only possible values,
> > this device should to the same instead of refusing it.
> > 
> > > Testpmd command "port config <port> rss all" should be updated as well
> > > to 'all' supported values from rte_eth_dev_info, I'll include this
> > > change in next version.
> > >
> > > > -----Original Message-----
> > > > From: Nélio Laranjeiro [mailto:nelio.laranjeiro@6wind.com]
> > > > Sent: Monday, March 19, 2018 4:30 PM
> > > > To: Xueming(Steven) Li <xuemingl@mellanox.com>
> > > > Cc: Adrien Mazarguil <adrien.mazarguil@6wind.com>; Shahaf Shuler
> > > > <shahafs@mellanox.com>; dev@dpdk.org
> > > > Subject: Re: [PATCH] net/mlx5: add supported hash function check
> > > >
> > > > On Sun, Mar 18, 2018 at 03:37:20PM +0800, Xueming Li wrote:
> > > > > Add supported RSS hash function check in device configuration to
> > > > > have better error verbosity for application developers.
> > > > >
> > > > > Signed-off-by: Xueming Li <xuemingl@mellanox.com>
> > > > > ---
> > > > >  drivers/net/mlx5/mlx5_ethdev.c | 8 ++++++++
> > > > >  1 file changed, 8 insertions(+)
> > > > >
> > > > > diff --git a/drivers/net/mlx5/mlx5_ethdev.c
> > > > > b/drivers/net/mlx5/mlx5_ethdev.c index b73cb53..175a1ff 100644
> > > > > --- a/drivers/net/mlx5/mlx5_ethdev.c
> > > > > +++ b/drivers/net/mlx5/mlx5_ethdev.c
> > > > > @@ -346,6 +346,14 @@ struct ethtool_link_settings {
> > > > >  		      rx_offloads, supp_rx_offloads);
> > > > >  		return ENOTSUP;
> > > > >  	}
> > > > > +	if (dev->data->dev_conf.rx_adv_conf.rss_conf.rss_hf &
> > > > > +	    MLX5_RSS_HF_MASK) {
> > > > > +		ERROR("Some RSS hash function not supported "
> > > > > +		      "requested 0x%" PRIx64 " supported 0x%" PRIx64,
> > > > > +		      dev->data->dev_conf.rx_adv_conf.rss_conf.rss_hf,
> > > > > +		      (uint64_t)(~MLX5_RSS_HF_MASK));
> > > > > +		return ENOTSUP;
> > > > > +	}
> > > > >  	if (use_app_rss_key &&
> > > > >  	    (dev->data->dev_conf.rx_adv_conf.rss_conf.rss_key_len !=
> > > > >  	     rss_hash_default_key_len)) {
> > > > > --
> > > > > 1.8.3.1
> > > > >
> > > >
> > > > I would answer than an application should not try to configure
> > > > something not advertise by the device.
> > > > This information is present in struct rte_eth_dev_info returned by
> > > > mlx5_dev_infos_get() and thus the devops of the device.
> > > >
> > > > Seems rte_eth_dev_configure() should be fixed to avoid configuring
> > > > wrong values.
> > > >
> > > > Regards,
> > > >
> > > > --
> > > > Nélio Laranjeiro
> > > > 6WIND
> > 
> > --
> > Nélio Laranjeiro
> > 6WIND
  

Patch

diff --git a/drivers/net/mlx5/mlx5_ethdev.c b/drivers/net/mlx5/mlx5_ethdev.c
index b73cb53..175a1ff 100644
--- a/drivers/net/mlx5/mlx5_ethdev.c
+++ b/drivers/net/mlx5/mlx5_ethdev.c
@@ -346,6 +346,14 @@  struct ethtool_link_settings {
 		      rx_offloads, supp_rx_offloads);
 		return ENOTSUP;
 	}
+	if (dev->data->dev_conf.rx_adv_conf.rss_conf.rss_hf &
+	    MLX5_RSS_HF_MASK) {
+		ERROR("Some RSS hash function not supported "
+		      "requested 0x%" PRIx64 " supported 0x%" PRIx64,
+		      dev->data->dev_conf.rx_adv_conf.rss_conf.rss_hf,
+		      (uint64_t)(~MLX5_RSS_HF_MASK));
+		return ENOTSUP;
+	}
 	if (use_app_rss_key &&
 	    (dev->data->dev_conf.rx_adv_conf.rss_conf.rss_key_len !=
 	     rss_hash_default_key_len)) {