DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] net/mlx5: fix link speed
@ 2018-02-05 12:01 Yuanhan Liu
  2018-02-05 12:28 ` Nélio Laranjeiro
  0 siblings, 1 reply; 3+ messages in thread
From: Yuanhan Liu @ 2018-02-05 12:01 UTC (permalink / raw)
  To: dev
  Cc: Adrien Mazarguil, Nelio Laranjeiro, Yongseok Koh, Shahaf Shuler,
	Yuanhan Liu, stable

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@dpdk.org
Signed-off-by: Yuanhan Liu <yliu@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

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2018-02-05 13:39 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-02-05 12:01 [dpdk-dev] [PATCH] net/mlx5: fix link speed Yuanhan Liu
2018-02-05 12:28 ` Nélio Laranjeiro
2018-02-05 13:39   ` Shahaf Shuler

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).