[dpdk-dev] [PATCH] net/mlx5: fix link speed info when link is down

Raslan Darawsheh rasland at mellanox.com
Mon Aug 5 17:16:47 CEST 2019


Hi,

> -----Original Message-----
> From: dev <dev-bounces at dpdk.org> On Behalf Of Xiaoyu Min
> Sent: Monday, August 5, 2019 11:02 AM
> To: Shahaf Shuler <shahafs at mellanox.com>; Yongseok Koh
> <yskoh at mellanox.com>; Slava Ovsiienko <viacheslavo at mellanox.com>
> Cc: dev at dpdk.org; stable at dpdk.org
> Subject: [dpdk-dev] [PATCH] net/mlx5: fix link speed info when link is down
> 
> When the link is down, the link speed returned by ethtool is
> UINT32_MAX and the link status is 0.
> 
> In this case, the DPDK ethdev link speed should be set to
> ETH_SPEED_NUM_NONE.
> Otherwise since link speed is non-zero but link status is zero, this
> is an inconsistent situation and -EAGAIN is returned, which is not right.
> 
> Fixes: 188408719888 ("net/mlx5: fix support for newer link speeds")
> Cc: stable at dpdk.org
> 
> Signed-off-by: Xiaoyu Min <jackmin at mellanox.com>
> ---
>  drivers/net/mlx5/mlx5_ethdev.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/net/mlx5/mlx5_ethdev.c
> b/drivers/net/mlx5/mlx5_ethdev.c
> index 9629cfb333..33a32fc2fa 100644
> --- a/drivers/net/mlx5/mlx5_ethdev.c
> +++ b/drivers/net/mlx5/mlx5_ethdev.c
> @@ -908,7 +908,8 @@ mlx5_link_update_unlocked_gs(struct rte_eth_dev
> *dev,
>  			dev->data->port_id, strerror(rte_errno));
>  		return ret;
>  	}
> -	dev_link.link_speed = ecmd->speed;
> +	dev_link.link_speed = (ecmd->speed == UINT32_MAX) ?
> ETH_SPEED_NUM_NONE :
> +							    ecmd->speed;
>  	sc = ecmd->link_mode_masks[0] |
>  		((uint64_t)ecmd->link_mode_masks[1] << 32);
>  	priv->link_speed_capa = 0;
> --
> 2.21.0

Patch applied to next-net-mlx,

Kindest regards,
Raslan Darawsheh


More information about the dev mailing list