* [PATCH net] net/mlx5: Not returning mlx5_link_info table when speed is unknown
@ 2025-09-08 8:53 Li Tian
2025-09-08 9:58 ` Vitaly Kuznetsov
0 siblings, 1 reply; 3+ messages in thread
From: Li Tian @ 2025-09-08 8:53 UTC (permalink / raw)
To: netdev, linux-hyperv
Cc: Saeed Mahameed, Tariq Toukan, Mark Bloch, Leon Romanovsky,
Haiyang Zhang, Benjamin Poirier, Vitaly Kuznetsov
Because mlx5e_link_mode is sparse e.g. Azure mlx5 reports PTYS 19.
Do not return it when speed unless retrieved successfully.
Fixes: 65a5d35571849 ("net/mlx5: Refactor link speed handling with mlx5_link_info struct")
Suggested-by: Vitaly Kuznetsov <vkuznets@redhat.com>
Signed-off-by: Li Tian <litian@redhat.com>
---
drivers/net/ethernet/mellanox/mlx5/core/port.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/port.c b/drivers/net/ethernet/mellanox/mlx5/core/port.c
index 2d7adf7444ba..a69c83da2542 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/port.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/port.c
@@ -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_mode is sparse. Check speed
+ * is non-zero as indication of a hole.
+ */
+ if (i < max_size && table[i].speed)
return &table[i];
return NULL;
--
2.50.0
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH net] net/mlx5: Not returning mlx5_link_info table when speed is unknown
2025-09-08 8:53 [PATCH net] net/mlx5: Not returning mlx5_link_info table when speed is unknown Li Tian
@ 2025-09-08 9:58 ` Vitaly Kuznetsov
2025-09-08 12:43 ` Tariq Toukan
0 siblings, 1 reply; 3+ messages in thread
From: Vitaly Kuznetsov @ 2025-09-08 9:58 UTC (permalink / raw)
To: Li Tian, netdev, linux-hyperv
Cc: Saeed Mahameed, Tariq Toukan, Mark Bloch, Leon Romanovsky,
Haiyang Zhang, Benjamin Poirier
Li Tian <litian@redhat.com> writes:
> Because mlx5e_link_mode is sparse e.g. Azure mlx5 reports PTYS 19.
> Do not return it when speed unless retrieved successfully.
>
> Fixes: 65a5d35571849 ("net/mlx5: Refactor link speed handling with mlx5_link_info struct")
> Suggested-by: Vitaly Kuznetsov <vkuznets@redhat.com>
> Signed-off-by: Li Tian <litian@redhat.com>
> ---
> drivers/net/ethernet/mellanox/mlx5/core/port.c | 6 +++++-
> 1 file changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/net/ethernet/mellanox/mlx5/core/port.c b/drivers/net/ethernet/mellanox/mlx5/core/port.c
> index 2d7adf7444ba..a69c83da2542 100644
> --- a/drivers/net/ethernet/mellanox/mlx5/core/port.c
> +++ b/drivers/net/ethernet/mellanox/mlx5/core/port.c
> @@ -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_mode is sparse. Check speed
The array is either 'mlx5e_link_mode' or 'mlx5e_ext_link_info' but both
have holes in them.
> + * is non-zero as indication of a hole.
> + */
> + if (i < max_size && table[i].speed)
> return &table[i];
>
> return NULL;
--
Vitaly
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH net] net/mlx5: Not returning mlx5_link_info table when speed is unknown
2025-09-08 9:58 ` Vitaly Kuznetsov
@ 2025-09-08 12:43 ` Tariq Toukan
0 siblings, 0 replies; 3+ messages in thread
From: Tariq Toukan @ 2025-09-08 12:43 UTC (permalink / raw)
To: Vitaly Kuznetsov, Li Tian, netdev, linux-hyperv
Cc: Saeed Mahameed, Tariq Toukan, Mark Bloch, Leon Romanovsky,
Haiyang Zhang, Benjamin Poirier, Carolina Jubran, Shahar Shitrit
On 08/09/2025 12:58, Vitaly Kuznetsov wrote:
> Li Tian <litian@redhat.com> writes:
>
>> Because mlx5e_link_mode is sparse e.g. Azure mlx5 reports PTYS 19.
>> Do not return it when speed unless retrieved successfully.
>>
>> Fixes: 65a5d35571849 ("net/mlx5: Refactor link speed handling with mlx5_link_info struct")
++
Adding author and reviewer of offending patch.
>> Suggested-by: Vitaly Kuznetsov <vkuznets@redhat.com>
>> Signed-off-by: Li Tian <litian@redhat.com>
>> ---
>> drivers/net/ethernet/mellanox/mlx5/core/port.c | 6 +++++-
>> 1 file changed, 5 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/net/ethernet/mellanox/mlx5/core/port.c b/drivers/net/ethernet/mellanox/mlx5/core/port.c
>> index 2d7adf7444ba..a69c83da2542 100644
>> --- a/drivers/net/ethernet/mellanox/mlx5/core/port.c
>> +++ b/drivers/net/ethernet/mellanox/mlx5/core/port.c
>> @@ -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)
Keep an empty line before comment.
>> + /*
Can have the comment text starting from the first line.
>> + * mlx5e_link_mode is sparse. Check speed
>
> The array is either 'mlx5e_link_mode' or 'mlx5e_ext_link_info' but both
> have holes in them.
>
You mean 'mlx5e_link_info' and 'mlx5e_ext_link_info'.
I wouldn't say they are sparse. They have holes indeed.
>> + * is non-zero as indication of a hole.
>> + */
>> + if (i < max_size && table[i].speed)
>> return &table[i];
>>
>> return NULL;
>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2025-09-08 12:43 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-09-08 8:53 [PATCH net] net/mlx5: Not returning mlx5_link_info table when speed is unknown Li Tian
2025-09-08 9:58 ` Vitaly Kuznetsov
2025-09-08 12:43 ` Tariq Toukan
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).