summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorXiaoyu Min <jackmin@mellanox.com>2019-08-05 16:02:03 +0800
committerKevin Traynor <ktraynor@redhat.com>2019-09-13 10:37:20 +0100
commitd72296ec9756c07add4805e6344c6966d6495726 (patch)
tree8c3e6ed3e08ea2b1d0a444ea31c15b84552ef669
parent0a2cd71d461862ea38e693b1b53163157265f991 (diff)
downloaddpdk-stable-d72296ec9756c07add4805e6344c6966d6495726.zip
dpdk-stable-d72296ec9756c07add4805e6344c6966d6495726.tar.gz
dpdk-stable-d72296ec9756c07add4805e6344c6966d6495726.tar.xz
net/mlx5: fix link speed info when link is down
[ upstream commit 6fd05da9efbd387d0f1fdd7824bc5298dff368fe ] 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") Signed-off-by: Xiaoyu Min <jackmin@mellanox.com> Acked-by: Viacheslav Ovsiienko <viacheslavo@mellanox.com>
-rw-r--r--drivers/net/mlx5/mlx5_ethdev.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/net/mlx5/mlx5_ethdev.c b/drivers/net/mlx5/mlx5_ethdev.c
index 6a5bef1..9c7fc6b 100644
--- a/drivers/net/mlx5/mlx5_ethdev.c
+++ b/drivers/net/mlx5/mlx5_ethdev.c
@@ -730,7 +730,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;