RDMA/mlx5: Expose vhca id for all ports in multiport mode
Subsystems (2)
PATCH 1/1 RDMA/mlx5: Expose vhca id for all ports in multiport mode
From: Mark Bloch <[email protected]>
In multiport mode, RDMA devices make it impossible for userspace to use DEVX to discover vhca id values for ports beyond port 1. This patch addresses the issue by exposing the vhca id of all ports.
Signed-off-by Mark Bloch <[email protected]>
Reviewed-by Maor Gottlieb <[email protected]>
Signed-off-by Leon Romanovsky <[email protected]>
--- drivers/infiniband/hw/mlx5/std_types.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+)
drivers/infiniband/hw/mlx5/std_types.c +21 -0
@@ -112,6 +112,23 @@ static int fill_vport_vhca_id(struct mlx5_core_dev *mdev, u16 vport,return err; } +static int fill_multiport_info (struct mlx5_ib_dev *dev,u32 port_num, +struct mlx5_ib_uapi_query_port *info) +{ +struct mlx5_core_dev *mdev; + + mdev =mlx5_ib_get_native_port_mdev (dev, port_num,NULL ); +if (!mdev) +return -EINVAL ; + + info->vport_vhca_id =MLX5_CAP_GEN (mdev, vhca_id); + info->flags |=MLX5_IB_UAPI_QUERY_PORT_VPORT_VHCA_ID ; + +mlx5_ib_put_native_port_mdev (dev, port_num); + +return 0 ; +} +static int fill_switchdev_info (struct mlx5_ib_dev *dev,u32 port_num,struct mlx5_ib_uapi_query_port *info) {
@@ -178,6 +195,10 @@ static int UVERBS_HANDLER(MLX5_IB_METHOD_QUERY_PORT)( ret =fill_switchdev_info (dev, port_num, &info);if (ret)return ret; + }else if (mlx5_core_mp_enabled (dev->mdev)) { + ret =fill_multiport_info (dev, port_num, &info); +if (ret) +return ret; } return uverbs_copy_to_struct_or_zero(attrs, MLX5_IB_ATTR_QUERY_PORT, &info,
Signature · 1 line
2.45.2
Leon Romanovsky
AppliedQuoted 5 lines · Leon Romanovsky
In multiport mode, RDMA devices make it impossible for userspace to use DEVX to discover vhca id values for ports beyond port 1. This patch addresses the issue by exposing the vhca id of all ports.
Applied, thanks!
[1/1] RDMA/mlx5: Expose vhca id for all ports in multiport mode
https://git.kernel.org/rdma/rdma/c/d29d64e8d65960
Best regards,
Signature · 1 line
Leon Romanovsky <[email protected]>