Skip to contentSkip to conversation

net/mlx5: Not returning mlx5_link_info table when speed is unknown

PATCH Applied Li Tian 3 participants 3 messages Sep 10, 2025 – Sep 12, 2025

Subsystems (5)
lore
Share & tools
lore

Li Tian

author
#0 lore raw

PATCH v2 1/1 net/mlx5: Not returning mlx5_link_info table when speed is unknown

Because mlx5e_link_info and mlx5e_ext_link_info have holes e.g. Azure mlx5 reports PTYS 19. Do not return it unless speed is retrieved successfully.

Fixes 65a5d35571849 ("net/mlx5: Refactor link speed handling with mlx5_link_info struct")

---
v2:
- Fix indentation and spacing only.
v1: https://lore.kernel.org/netdev/[email protected]

---
 drivers/net/ethernet/mellanox/mlx5/core/port.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/net/ethernet/mellanox/mlx5/core/port.c +5 -1
index 2d7adf7444ba..aa9f2b0a77d3 100644
@@ -1170,7 +1170,11 @@ const struct mlx5_link_info *mlx5_port_ptys2info(struct mlx5_core_dev *mdev,
 	mlx5e_port_get_link_mode_info_arr(mdev, &table, &max_size,
 					  force_legacy);
 	i = find_first_bit(&temp, max_size);
-	if (i < max_size)
+
+	/* mlx5e_link_info has holes. Check speed
+	 * is not zero as indication of one.
+	 */
+	if (i < max_size && table[i].speed)
 		return &table[i];
 
 	return NULL;
Signature · 1 line
2.50.0
Reviewed-by on v2 1/1
#1 lore raw
Quoted 22 lines · Li Tian

Because mlx5e_link_info and mlx5e_ext_link_info have holes e.g. Azure mlx5 reports PTYS 19. Do not return it unless speed is retrieved successfully.

Fixes 65a5d35571849 ("net/mlx5: Refactor link speed handling with mlx5_link_info struct")

---
v2:
- Fix indentation and spacing only.
v1: https://lore.kernel.org/netdev/[email protected]

---
  drivers/net/ethernet/mellanox/mlx5/core/port.c | 6 +++++-
  1 file changed, 5 insertions(+), 1 deletion(-)
drivers/net/ethernet/mellanox/mlx5/core/port.c +0 -0
index 2d7adf7444ba..aa9f2b0a77d3 100644
@@ -1170,7 +1170,11 @@ const struct mlx5_link_info *mlx5_port_ptys2info(struct mlx5_core_dev *mdev,
  	mlx5e_port_get_link_mode_info_arr(mdev, &table, &max_size,
  					  force_legacy);

drivers/net/ethernet/mellanox/mlx5/core/port.c const struct mlx5_link_info *mlx5_port_ptys2info(struct mlx5_core_dev *mdev, · line 1180

Quoted 10 lines
drivers/net/ethernet/mellanox/mlx5/core/port.c +5 -1
  	i = find_first_bit(&temp, max_size);
-	if (i < max_size)
+
+	/* mlx5e_link_info has holes. Check speed
+	 * is not zero as indication of one.
+	 */
+	if (i < max_size && table[i].speed)
  		return &table[i];
 
  	return NULL;

Thanks.

#2 lore raw
In reply to Li Tian
This patch was applied to netdev/net.git (main) by Jakub Kicinski <[email protected]>:

Hello:

This patch was applied to netdev/net.git (main)
by Jakub Kicinski <[email protected]>:

Quoted 9 lines · On Wed, 10 Sep 2025 08:37:32 +0800 you wrote:

Because mlx5e_link_info and mlx5e_ext_link_info have holes e.g. Azure mlx5 reports PTYS 19. Do not return it unless speed is retrieved successfully.

Fixes 65a5d35571849 ("net/mlx5: Refactor link speed handling with mlx5_link_info struct")

[...]

Here is the summary with links:
- [net,v2] net/mlx5: Not returning mlx5_link_info table when speed is unknown

    https://git.kernel.org/netdev/net/c/5577352b5583

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html