From: Xiaoyu Min Date: Mon, 5 Aug 2019 08:02:03 +0000 (+0800) Subject: net/mlx5: fix link speed info when link is down X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=6fd05da9efbd387d0f1fdd7824bc5298dff368fe;p=dpdk.git 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@dpdk.org Signed-off-by: Xiaoyu Min Acked-by: Viacheslav Ovsiienko --- 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;