summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorXiaoyu Min <jackmin@mellanox.com>2019-08-05 16:02:03 +0800
committerRaslan Darawsheh <rasland@mellanox.com>2019-08-06 17:42:12 +0200
commit6fd05da9efbd387d0f1fdd7824bc5298dff368fe (patch)
treebeb0fd3ea7005c5d3977f7a8820ac734a486a867
parentf32a3f5216a33839799932451dde305759082efb (diff)
downloaddpdk-6fd05da9efbd387d0f1fdd7824bc5298dff368fe.zip
dpdk-6fd05da9efbd387d0f1fdd7824bc5298dff368fe.tar.gz
dpdk-6fd05da9efbd387d0f1fdd7824bc5298dff368fe.tar.xz
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 <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 9629cfb..33a32fc 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;