All of lore.kernel.org
 help / color / mirror / Atom feed
From: Leon Romanovsky <leon@kernel.org>
To: Edward Srouji <edwards@nvidia.com>
Cc: Jason Gunthorpe <jgg@ziepe.ca>, Mark Bloch <mbloch@nvidia.com>,
	Saeed Mahameed <saeedm@nvidia.com>, Roi Dayan <roid@nvidia.com>,
	linux-rdma@vger.kernel.org, linux-kernel@vger.kernel.org,
	Or Har-Toov <ohartoov@nvidia.com>
Subject: Re: [PATCH rdma-next] IB/mlx5: Fix port speed query for representors
Date: Tue, 13 Jan 2026 16:15:25 +0200	[thread overview]
Message-ID: <20260113141525.GC179508@unreal> (raw)
In-Reply-To: <20260113-port-speed-query-fix-v1-1-234cacc991fa@nvidia.com>

On Tue, Jan 13, 2026 at 03:31:26PM +0200, Edward Srouji wrote:
> From: Or Har-Toov <ohartoov@nvidia.com>
> 
> When querying speed information for a representor in switchdev mode,
> the code previously used the first device in the eswitch, which may not
> match the device that actually owns the representor. In setups such as
> multi-port eswitch or LAG, this led to incorrect port attributes being
> reported.
> 
> Fix this by retrieving the correct core device from the representor's
> eswitch before querying its port attributes.
> 
> Fixes: 27f9e0ccb6da ("net/mlx5: Lag, Add single RDMA device in multiport mode")
> Signed-off-by: Or Har-Toov <ohartoov@nvidia.com>
> Reviewed-by: Mark Bloch <mbloch@nvidia.com>
> Signed-off-by: Edward Srouji <edwards@nvidia.com>
> ---
>  drivers/infiniband/hw/mlx5/main.c | 23 +++++++++++++++++------
>  1 file changed, 17 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/infiniband/hw/mlx5/main.c b/drivers/infiniband/hw/mlx5/main.c
> index e81080622283..d0c6648ee035 100644
> --- a/drivers/infiniband/hw/mlx5/main.c
> +++ b/drivers/infiniband/hw/mlx5/main.c
> @@ -561,12 +561,23 @@ static int mlx5_query_port_roce(struct ib_device *device, u32 port_num,
>  	 * of an error it will still be zeroed out.
>  	 * Use native port in case of reps
>  	 */
> -	if (dev->is_rep)
> -		err = mlx5_query_port_ptys(mdev, out, sizeof(out), MLX5_PTYS_EN,
> -					   1, 0);
> -	else
> -		err = mlx5_query_port_ptys(mdev, out, sizeof(out), MLX5_PTYS_EN,
> -					   mdev_port_num, 0);
> +	if (dev->is_rep) {
> +		struct mlx5_eswitch_rep *rep;
> +		struct mlx5_core_dev *esw_mdev;
> +
> +		rep = dev->port[port_num - 1].rep;
> +		if (rep) {
> +			esw_mdev = mlx5_eswitch_get_core_dev(rep->esw);
> +			if (esw_mdev)

When can this esw_mdev be NULL? We are in representor code, so
mlx5_esw_allowed() should evaluate to true in mlx5_eswitch_get_core_dev().
Is there any scenario where it wouldn't?

> +				mdev = esw_mdev;
> +		}
> +
> +		mdev_port_num = 1;
> +	}
> +
> +	err = mlx5_query_port_ptys(mdev, out, sizeof(out), MLX5_PTYS_EN,
> +				   mdev_port_num, 0);
> +
>  	if (err)
>  		goto out;
>  	ext = !!MLX5_GET_ETH_PROTO(ptys_reg, out, true, eth_proto_capability);
> 
> ---
> base-commit: 325e3b5431ddd27c5f93156b36838a351e3b2f72
> change-id: 20260113-port-speed-query-fix-592efa2b4e36
> 
> Best regards,
> -- 
> Edward Srouji <edwards@nvidia.com>
> 

      reply	other threads:[~2026-01-13 14:15 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-01-13 13:31 [PATCH rdma-next] IB/mlx5: Fix port speed query for representors Edward Srouji
2026-01-13 14:15 ` Leon Romanovsky [this message]

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=20260113141525.GC179508@unreal \
    --to=leon@kernel.org \
    --cc=edwards@nvidia.com \
    --cc=jgg@ziepe.ca \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rdma@vger.kernel.org \
    --cc=mbloch@nvidia.com \
    --cc=ohartoov@nvidia.com \
    --cc=roid@nvidia.com \
    --cc=saeedm@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.