Skip to contentSkip to conversation

net/mlx5: fix link speed

PATCH In review Yuanhan Liu 3 participants 3 messages Feb 5, 2018 Network drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 net/mlx5: fix link speed

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")
---
 drivers/net/mlx5/mlx5_ethdev.c | 4 ++++
 1 file changed, 4 insertions(+)
drivers/net/mlx5/mlx5_ethdev.c +4 -0
index 6665076..492ca07 100644
@@ -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;
Signature · 1 line
2.7.4
Acked-by on v1 1/1
#1 lore raw
Quoted 8 lines · Yuanhan Liu

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 /*

Quoted 8 lines
  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")
Quoted 22 lines
---
 drivers/net/mlx5/mlx5_ethdev.c | 4 ++++
 1 file changed, 4 insertions(+)
drivers/net/mlx5/mlx5_ethdev.c +4 -0
index 6665076..492ca07 100644
@@ -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;
Signature · 1 line
2.7.4

Thanks,

Signature · 2 lines
Nélio Laranjeiro
6WIND
#2 lore raw

Monday, February 5, 2018 2:29 PM, Nélio Laranjeiro:

Quoted 33 lines

Subject: Re: [PATCH] net/mlx5: fix link speed

Quoted 9 lines · Yuanhan Liu

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 /*

Quoted 8 lines
  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")

drivers/net/mlx5/mlx5_ethdev.c mlx5_link_update_unlocked_gs(struct

Quoted 9 lines
---
 drivers/net/mlx5/mlx5_ethdev.c | 4 ++++
 1 file changed, 4 insertions(+)
(quoted diff) +0 -0

b/drivers/net/mlx5/mlx5_ethdev.c index 6665076..492ca07 100644

drivers/net/mlx5/mlx5_ethdev.c +0 -0
@@ -808,6 +808,10 @@ mlx5_link_update_unlocked_gs(struct

rte_eth_dev *dev, int wait_to_complete)

Quoted 4 lines

drivers/net/mlx5/mlx5_ethdev.c mlx5_link_update_unlocked_gs(struct rte_eth_dev *dev, int wait_to_complete) · line 811

Quoted 4 lines
drivers/net/mlx5/mlx5_ethdev.c +1 -0
 		return -1;
 	}
 	dev_link.link_speed = ecmd->speed;
+	if (link_speed == -1)

Looks like link_speed is not defined (code is not compiling).

Quoted 15 lines
Quoted 9 lines
drivers/net/mlx5/mlx5_ethdev.c +3 -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

Thanks,

--
Nélio Laranjeiro
6WIND