Commit 6aeb16a1 authored by Mark Bloch's avatar Mark Bloch Committed by Saeed Mahameed

RDMA/mlx5: Fill port info based on the relevant eswitch

In shared FDB a single RDMA device can have representors that are
connected to two different eswitches. Use the right eswitch when
preparing the response to userspace.
Signed-off-by: default avatarMark Bloch <mbloch@nvidia.com>
Reviewed-by: default avatarMark Zhang <markzhang@nvidia.com>
Signed-off-by: default avatarSaeed Mahameed <saeedm@nvidia.com>
parent af8c0e25
...@@ -114,14 +114,18 @@ static int fill_vport_vhca_id(struct mlx5_core_dev *mdev, u16 vport, ...@@ -114,14 +114,18 @@ static int fill_vport_vhca_id(struct mlx5_core_dev *mdev, u16 vport,
static int fill_switchdev_info(struct mlx5_ib_dev *dev, u32 port_num, static int fill_switchdev_info(struct mlx5_ib_dev *dev, u32 port_num,
struct mlx5_ib_uapi_query_port *info) struct mlx5_ib_uapi_query_port *info)
{ {
struct mlx5_core_dev *mdev = dev->mdev;
struct mlx5_eswitch_rep *rep; struct mlx5_eswitch_rep *rep;
struct mlx5_core_dev *mdev;
int err; int err;
rep = dev->port[port_num - 1].rep; rep = dev->port[port_num - 1].rep;
if (!rep) if (!rep)
return -EOPNOTSUPP; return -EOPNOTSUPP;
mdev = mlx5_eswitch_get_core_dev(rep->esw);
if (!mdev)
return -EINVAL;
info->vport = rep->vport; info->vport = rep->vport;
info->flags |= MLX5_IB_UAPI_QUERY_PORT_VPORT; info->flags |= MLX5_IB_UAPI_QUERY_PORT_VPORT;
...@@ -138,9 +142,9 @@ static int fill_switchdev_info(struct mlx5_ib_dev *dev, u32 port_num, ...@@ -138,9 +142,9 @@ static int fill_switchdev_info(struct mlx5_ib_dev *dev, u32 port_num,
if (err) if (err)
return err; return err;
if (mlx5_eswitch_vport_match_metadata_enabled(mdev->priv.eswitch)) { if (mlx5_eswitch_vport_match_metadata_enabled(rep->esw)) {
info->reg_c0.value = mlx5_eswitch_get_vport_metadata_for_match( info->reg_c0.value = mlx5_eswitch_get_vport_metadata_for_match(
mdev->priv.eswitch, rep->vport); rep->esw, rep->vport);
info->reg_c0.mask = mlx5_eswitch_get_vport_metadata_mask(); info->reg_c0.mask = mlx5_eswitch_get_vport_metadata_mask();
info->flags |= MLX5_IB_UAPI_QUERY_PORT_VPORT_REG_C0; info->flags |= MLX5_IB_UAPI_QUERY_PORT_VPORT_REG_C0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment