From: Vitaly Kuznetsov <vkuznets@redhat.com>
To: Li Tian <litian@redhat.com>,
netdev@vger.kernel.org, linux-hyperv@vger.kernel.org
Cc: Saeed Mahameed <saeedm@nvidia.com>,
Tariq Toukan <tariqt@nvidia.com>, Mark Bloch <mbloch@nvidia.com>,
Leon Romanovsky <leon@kernel.org>,
Haiyang Zhang <haiyangz@microsoft.com>,
Benjamin Poirier <bpoirier@redhat.com>
Subject: Re: [PATCH net] net/mlx5: Not returning mlx5_link_info table when speed is unknown
Date: Mon, 08 Sep 2025 12:58:49 +0300 [thread overview]
Message-ID: <877by9fep2.fsf@redhat.com> (raw)
In-Reply-To: <20250908085313.18768-1-litian@redhat.com>
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
next prev parent reply other threads:[~2025-09-08 9:58 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
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 [this message]
2025-09-08 12:43 ` Tariq Toukan
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=877by9fep2.fsf@redhat.com \
--to=vkuznets@redhat.com \
--cc=bpoirier@redhat.com \
--cc=haiyangz@microsoft.com \
--cc=leon@kernel.org \
--cc=linux-hyperv@vger.kernel.org \
--cc=litian@redhat.com \
--cc=mbloch@nvidia.com \
--cc=netdev@vger.kernel.org \
--cc=saeedm@nvidia.com \
--cc=tariqt@nvidia.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.