mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-05-07 17:27:11 -04:00
RDMA/mlx5: Expose vhca id for all ports in multiport mode
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 <mbloch@nvidia.com> Reviewed-by: Maor Gottlieb <maorg@nvidia.com> Link: https://patch.msgid.link/41dea83aa51843aa4c067b4f73f28d64e51bd53c.1722331101.git.leon@kernel.org Signed-off-by: Leon Romanovsky <leon@kernel.org>
This commit is contained in:
committed by
Leon Romanovsky
parent
df6d27a309
commit
0ea4ffb2bc
@@ -111,6 +111,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)
|
||||
{
|
||||
@@ -177,6 +194,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,
|
||||
|
||||
Reference in New Issue
Block a user