IB/{core,hw}: Have ib_umem_get extract the ib_ucontext from ib_udata

ib_umem_get() can only be called in a method callback, which always has a
udata parameter. This allows ib_umem_get() to derive the ucontext pointer
directly from the udata without requiring the drivers to find it in some
way or another.

Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
Signed-off-by: Shamir Rabinovitch <shamir.rabinovitch@oracle.com>
这个提交包含在:
Jason Gunthorpe
2019-01-09 11:15:16 +02:00
父节点 6fa8f1afd3
当前提交 b0ea0fa543
修改 38 个文件,包含 168 行新增147 行删除

查看文件

@@ -1015,9 +1015,11 @@ static int create_qp_common(struct mlx4_ib_dev *dev, struct ib_pd *pd,
(qp->sq.wqe_cnt << qp->sq.wqe_shift);
}
qp->umem = ib_umem_get(pd->uobject->context,
(src == MLX4_IB_QP_SRC) ? ucmd.qp.buf_addr :
ucmd.wq.buf_addr, qp->buf_size, 0, 0);
qp->umem =
ib_umem_get(udata,
(src == MLX4_IB_QP_SRC) ? ucmd.qp.buf_addr :
ucmd.wq.buf_addr,
qp->buf_size, 0, 0);
if (IS_ERR(qp->umem)) {
err = PTR_ERR(qp->umem);
goto err;
@@ -1035,9 +1037,11 @@ static int create_qp_common(struct mlx4_ib_dev *dev, struct ib_pd *pd,
goto err_mtt;
if (qp_has_rq(init_attr)) {
err = mlx4_ib_db_map_user(to_mucontext(pd->uobject->context),
err = mlx4_ib_db_map_user(
to_mucontext(pd->uobject->context), udata,
(src == MLX4_IB_QP_SRC) ? ucmd.qp.db_addr :
ucmd.wq.db_addr, &qp->db);
ucmd.wq.db_addr,
&qp->db);
if (err)
goto err_mtt;
}