[dpdk-stable] [PATCH] net/mlx5: fix link speed
Yuanhan Liu
yliu at fridaylinux.org
Mon Feb 5 13:01:44 CET 2018
When the link is down, mlx5 kernel driver reports the link speed as -1
(UNKNOWN_SPEED). We need turn it to 0 for such case, otherwise, it
will be re-queried again due to the link_speed is not 0, due to following
code:
1201 if (((link->link_speed == 0) && link->link_status) ||
1202 ((link->link_speed != 0) && !link->link_status)) {
1203 /*
1204 * Inconsistent status. Event likely occurred before the
1205 * kernel netdevice exposes the new status.
1206 */
Fixes: 188408719888 ("net/mlx5: fix support for newer link speeds")
Cc: stable at dpdk.org
Signed-off-by: Yuanhan Liu <yliu at fridaylinux.org>
---
drivers/net/mlx5/mlx5_ethdev.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/drivers/net/mlx5/mlx5_ethdev.c b/drivers/net/mlx5/mlx5_ethdev.c
index 6665076..492ca07 100644
--- a/drivers/net/mlx5/mlx5_ethdev.c
+++ b/drivers/net/mlx5/mlx5_ethdev.c
@@ -808,6 +808,10 @@ mlx5_link_update_unlocked_gs(struct rte_eth_dev *dev, int wait_to_complete)
return -1;
}
dev_link.link_speed = ecmd->speed;
+ if (link_speed == -1)
+ dev_link.link_speed = 0;
+ else
+ dev_link.link_speed = link_speed;
sc = ecmd->link_mode_masks[0] |
((uint64_t)ecmd->link_mode_masks[1] << 32);
priv->link_speed_capa = 0;
--
2.7.4
More information about the stable
mailing list