Commit 5577352b authored by Li Tian's avatar Li Tian Committed by Jakub Kicinski
Browse files

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: 65a5d355 ("net/mlx5: Refactor link speed handling with mlx5_link_info struct")
Suggested-by: default avatarVitaly Kuznetsov <vkuznets@redhat.com>
Signed-off-by: default avatarLi Tian <litian@redhat.com>
Reviewed-by: default avatarTariq Toukan <tariqt@nvidia.com>
Link: https://patch.msgid.link/20250910003732.5973-1-litian@redhat.com


Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent 247981ee
Loading
Loading
Loading
Loading
+5 −1
Original line number Diff line number Diff line
@@ -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;