forked from Minki/linux
IB/mlx5: Allow XRC usage via verbs in DEVX context
Allows XRC usage from the verbs flow in a DEVX context. As XRCD is some shared kernel resource between processes it should be created with UID=0 to point on that. As a result once XRC QP/SRQ are created they must be used as well with UID=0 so that firmware will allow the XRCD usage. Signed-off-by: Yishai Hadas <yishaih@mellanox.com> Reviewed-by: Artemy Kovalyov <artemyko@mellanox.com> Signed-off-by: Leon Romanovsky <leonro@mellanox.com> Signed-off-by: Doug Ledford <dledford@redhat.com>
This commit is contained in:
parent
719598c98d
commit
5aa3771ded
@ -543,7 +543,6 @@ struct mlx5_ib_srq {
|
||||
struct mlx5_ib_xrcd {
|
||||
struct ib_xrcd ibxrcd;
|
||||
u32 xrcdn;
|
||||
u16 uid;
|
||||
};
|
||||
|
||||
enum mlx5_ib_mtt_access_flags {
|
||||
|
@ -775,6 +775,7 @@ static int create_user_qp(struct mlx5_ib_dev *dev, struct ib_pd *pd,
|
||||
__be64 *pas;
|
||||
void *qpc;
|
||||
int err;
|
||||
u16 uid;
|
||||
|
||||
err = ib_copy_from_udata(&ucmd, udata, sizeof(ucmd));
|
||||
if (err) {
|
||||
@ -836,7 +837,8 @@ static int create_user_qp(struct mlx5_ib_dev *dev, struct ib_pd *pd,
|
||||
goto err_umem;
|
||||
}
|
||||
|
||||
MLX5_SET(create_qp_in, *in, uid, to_mpd(pd)->uid);
|
||||
uid = (attr->qp_type != IB_QPT_XRC_TGT) ? to_mpd(pd)->uid : 0;
|
||||
MLX5_SET(create_qp_in, *in, uid, uid);
|
||||
pas = (__be64 *)MLX5_ADDR_OF(create_qp_in, *in, pas);
|
||||
if (ubuffer->umem)
|
||||
mlx5_ib_populate_pas(dev, ubuffer->umem, page_shift, pas, 0);
|
||||
@ -5514,7 +5516,6 @@ struct ib_xrcd *mlx5_ib_alloc_xrcd(struct ib_device *ibdev,
|
||||
struct mlx5_ib_dev *dev = to_mdev(ibdev);
|
||||
struct mlx5_ib_xrcd *xrcd;
|
||||
int err;
|
||||
u16 uid;
|
||||
|
||||
if (!MLX5_CAP_GEN(dev->mdev, xrc))
|
||||
return ERR_PTR(-ENOSYS);
|
||||
@ -5523,14 +5524,12 @@ struct ib_xrcd *mlx5_ib_alloc_xrcd(struct ib_device *ibdev,
|
||||
if (!xrcd)
|
||||
return ERR_PTR(-ENOMEM);
|
||||
|
||||
uid = context ? to_mucontext(context)->devx_uid : 0;
|
||||
err = mlx5_cmd_xrcd_alloc(dev->mdev, &xrcd->xrcdn, uid);
|
||||
err = mlx5_cmd_xrcd_alloc(dev->mdev, &xrcd->xrcdn, 0);
|
||||
if (err) {
|
||||
kfree(xrcd);
|
||||
return ERR_PTR(-ENOMEM);
|
||||
}
|
||||
|
||||
xrcd->uid = uid;
|
||||
return &xrcd->ibxrcd;
|
||||
}
|
||||
|
||||
@ -5538,10 +5537,9 @@ int mlx5_ib_dealloc_xrcd(struct ib_xrcd *xrcd)
|
||||
{
|
||||
struct mlx5_ib_dev *dev = to_mdev(xrcd->device);
|
||||
u32 xrcdn = to_mxrcd(xrcd)->xrcdn;
|
||||
u16 uid = to_mxrcd(xrcd)->uid;
|
||||
int err;
|
||||
|
||||
err = mlx5_cmd_xrcd_dealloc(dev->mdev, xrcdn, uid);
|
||||
err = mlx5_cmd_xrcd_dealloc(dev->mdev, xrcdn, 0);
|
||||
if (err)
|
||||
mlx5_ib_warn(dev, "failed to dealloc xrcdn 0x%x\n", xrcdn);
|
||||
|
||||
|
@ -113,7 +113,7 @@ static int create_srq_user(struct ib_pd *pd, struct mlx5_ib_srq *srq,
|
||||
|
||||
in->log_page_size = page_shift - MLX5_ADAPTER_PAGE_SHIFT;
|
||||
in->page_offset = offset;
|
||||
in->uid = to_mpd(pd)->uid;
|
||||
in->uid = (in->type != IB_SRQT_XRC) ? to_mpd(pd)->uid : 0;
|
||||
if (MLX5_CAP_GEN(dev->mdev, cqe_version) == MLX5_CQE_VERSION_V1 &&
|
||||
in->type != IB_SRQT_BASIC)
|
||||
in->user_index = uidx;
|
||||
|
Loading…
Reference in New Issue
Block a user