The check in mlx5_link_update_unlocked_gs() returns -EAGAIN if link
status does not correspond to link speed. If status is DOWN, the speed
is expected to be ETH_SPEED_NUM_NONE (0). But as the link speed is -1
on admin down, modify the check to account for this.

Fixes: cfee94752b8f ("net/mlx5: fix link status to use wait to complete")
Cc: NĂ©lio Laranjeiro <nelio.laranje...@6wind.com>

Signed-off-by: Mike Manning <mmann...@vyatta.att-mail.com>
---
 drivers/net/mlx5/mlx5_ethdev.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/mlx5/mlx5_ethdev.c b/drivers/net/mlx5/mlx5_ethdev.c
index d80ae458b..6ef2dfd74 100644
--- a/drivers/net/mlx5/mlx5_ethdev.c
+++ b/drivers/net/mlx5/mlx5_ethdev.c
@@ -1031,8 +1031,8 @@ mlx5_link_update_unlocked_gs(struct rte_eth_dev *dev,
                                ETH_LINK_HALF_DUPLEX : ETH_LINK_FULL_DUPLEX);
        dev_link.link_autoneg = !(dev->data->dev_conf.link_speeds &
                                  ETH_LINK_SPEED_FIXED);
-       if (((dev_link.link_speed && !dev_link.link_status) ||
-            (!dev_link.link_speed && dev_link.link_status))) {
+       if ((((int)dev_link.link_speed > 0 && !dev_link.link_status) ||
+            ((int)dev_link.link_speed <= 0 && dev_link.link_status))) {
                rte_errno = EAGAIN;
                return -rte_errno;
        }
-- 
2.11.0

Reply via email to