[dpdk-dev] [PATCH] mlx5: fix get link settings call for speed and duplex values

Nélio Laranjeiro nelio.laranjeiro at 6wind.com
Mon Jul 24 14:09:08 CEST 2017


Hi Gowrishankar,

Sorry, it took me a little time to test this patch, nice catch.

Small format points, the title should be net/mlx5 and there is a
complain with checkpatch see below.

On Tue, Jul 18, 2017 at 11:58:34AM +0530, Gowrishankar wrote:
> From: Gowrishankar Muthukrishnan <gowrishankar.m at linux.vnet.ibm.com>
> 
> mlx5 pmd does not correctly retrieve link speed and duplex values
> in linksetting struct through ETHTOOL_GLINKSETTINGS ioctl call.

I would suggest to make it a little shorter by adding the following fact:

 This returns an inconsistent link status.

It does not only impact traffic generator but anything relying on the
link status.

> Due to which pktgen application could not correctly calculate tx/rx
> rate and hence, very few packets (of count 32) only sent all the time.
> 
> Link settings can be derived through ETHTOOL_GLINKSETTINGS ioctl
> only after updating ethtool_link_settings struct with appropriate
> link mode bitmask words returned by its kernel side implementation.
> With this patch, pktgen app is able to tx/rx packets on mlx5 ports.

As it is fixing an issue it should have the fixes tag line, in this case
add the following one:

 Fixes: 188408719888 ("net/mlx5: fix support for newer link speeds")
 Cc: stable at dpdk.org

> Signed-off-by: Gowrishankar Muthukrishnan <gowrishankar.m at linux.vnet.ibm.com>
> ---
>  drivers/net/mlx5/mlx5_ethdev.c | 27 +++++++++++++++++++--------
>  1 file changed, 19 insertions(+), 8 deletions(-)
> 
> diff --git a/drivers/net/mlx5/mlx5_ethdev.c b/drivers/net/mlx5/mlx5_ethdev.c
> index b70b7b9..003cef3 100644
> --- a/drivers/net/mlx5/mlx5_ethdev.c
> +++ b/drivers/net/mlx5/mlx5_ethdev.c
> @@ -119,6 +119,7 @@ struct ethtool_link_settings {
>  #define ETHTOOL_LINK_MODE_100000baseCR4_Full_BIT 38
>  #define ETHTOOL_LINK_MODE_100000baseLR4_ER4_Full_BIT 39
>  #endif
> +#define ETHTOOL_LINK_MODE_MASK_MAX_KERNEL_NU32	(SCHAR_MAX)
>  
>  /**
>   * Return private structure associated with an Ethernet device.
> @@ -807,9 +808,11 @@ struct priv *
>  mlx5_link_update_unlocked_gs(struct rte_eth_dev *dev, int wait_to_complete)
>  {
>  	struct priv *priv = mlx5_get_priv(dev);
> -	struct ethtool_link_settings edata = {
> -		.cmd = ETHTOOL_GLINKSETTINGS,
> -	};
> +	struct {
> +		struct ethtool_link_settings edata;
> +		__u32 link_mode_data[3 * ETHTOOL_LINK_MODE_MASK_MAX_KERNEL_NU32];

Checkpatch complains about the line size here.

Thanks,

-- 
Nélio Laranjeiro
6WIND


More information about the dev mailing list