Skip to content

Commit 18ea78e

Browse files
ohartoovrleon
authored andcommitted
IB/mlx5: Fix port speed query for representors
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: 27f9e0c ("net/mlx5: Lag, Add single RDMA device in multiport mode") Signed-off-by: Or Har-Toov <[email protected]> Reviewed-by: Mark Bloch <[email protected]> Signed-off-by: Edward Srouji <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Leon Romanovsky <[email protected]>
1 parent ebc2164 commit 18ea78e

1 file changed

Lines changed: 14 additions & 6 deletions

File tree

  • drivers/infiniband/hw/mlx5

drivers/infiniband/hw/mlx5/main.c

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -561,12 +561,20 @@ static int mlx5_query_port_roce(struct ib_device *device, u32 port_num,
561561
* of an error it will still be zeroed out.
562562
* Use native port in case of reps
563563
*/
564-
if (dev->is_rep)
565-
err = mlx5_query_port_ptys(mdev, out, sizeof(out), MLX5_PTYS_EN,
566-
1, 0);
567-
else
568-
err = mlx5_query_port_ptys(mdev, out, sizeof(out), MLX5_PTYS_EN,
569-
mdev_port_num, 0);
564+
if (dev->is_rep) {
565+
struct mlx5_eswitch_rep *rep;
566+
567+
rep = dev->port[port_num - 1].rep;
568+
if (rep) {
569+
mdev = mlx5_eswitch_get_core_dev(rep->esw);
570+
WARN_ON(!mdev);
571+
}
572+
mdev_port_num = 1;
573+
}
574+
575+
err = mlx5_query_port_ptys(mdev, out, sizeof(out), MLX5_PTYS_EN,
576+
mdev_port_num, 0);
577+
570578
if (err)
571579
goto out;
572580
ext = !!MLX5_GET_ETH_PROTO(ptys_reg, out, true, eth_proto_capability);

0 commit comments

Comments
 (0)