RDMA: Cleanup undesired pd->uobject usage
Drivers should be using udata to determine if a method is invoked from user space or kernel space. A pd does not necessarily say a different objects is kernel or user. Transforming the tests to use udata eliminates a large number of uobject references from the drivers. Signed-off-by: Shamir Rabinovitch <shamir.rabinovitch@oracle.com> Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
This commit is contained in:

committed by
Jason Gunthorpe

parent
af8d70375d
commit
e00b64f7c5
@@ -1904,7 +1904,7 @@ static int create_qp_common(struct mlx5_ib_dev *dev, struct ib_pd *pd,
|
||||
qp->flags |= MLX5_IB_QP_CVLAN_STRIPPING;
|
||||
}
|
||||
|
||||
if (pd && pd->uobject) {
|
||||
if (udata) {
|
||||
if (ib_copy_from_udata(&ucmd, udata, sizeof(ucmd))) {
|
||||
mlx5_ib_dbg(dev, "copy failed\n");
|
||||
return -EFAULT;
|
||||
@@ -1986,14 +1986,14 @@ static int create_qp_common(struct mlx5_ib_dev *dev, struct ib_pd *pd,
|
||||
|
||||
qp->has_rq = qp_has_rq(init_attr);
|
||||
err = set_rq_size(dev, &init_attr->cap, qp->has_rq,
|
||||
qp, (pd && pd->uobject) ? &ucmd : NULL);
|
||||
qp, udata ? &ucmd : NULL);
|
||||
if (err) {
|
||||
mlx5_ib_dbg(dev, "err %d\n", err);
|
||||
return err;
|
||||
}
|
||||
|
||||
if (pd) {
|
||||
if (pd->uobject) {
|
||||
if (udata) {
|
||||
__u32 max_wqes =
|
||||
1 << MLX5_CAP_GEN(mdev, log_max_qp_sz);
|
||||
mlx5_ib_dbg(dev, "requested sq_wqe_count (%d)\n", ucmd.sq_wqe_count);
|
||||
@@ -2064,7 +2064,7 @@ static int create_qp_common(struct mlx5_ib_dev *dev, struct ib_pd *pd,
|
||||
if (qp->scat_cqe && is_connected(init_attr->qp_type)) {
|
||||
configure_responder_scat_cqe(init_attr, qpc);
|
||||
configure_requester_scat_cqe(dev, init_attr,
|
||||
(pd && pd->uobject) ? &ucmd : NULL,
|
||||
udata ? &ucmd : NULL,
|
||||
qpc);
|
||||
}
|
||||
|
||||
@@ -2504,7 +2504,7 @@ struct ib_qp *mlx5_ib_create_qp(struct ib_pd *pd,
|
||||
dev = to_mdev(pd->device);
|
||||
|
||||
if (init_attr->qp_type == IB_QPT_RAW_PACKET) {
|
||||
if (!pd->uobject) {
|
||||
if (!udata) {
|
||||
mlx5_ib_dbg(dev, "Raw Packet QP is not supported for kernel consumers\n");
|
||||
return ERR_PTR(-EINVAL);
|
||||
} else if (!to_mucontext(pd->uobject->context)->cqe_version) {
|
||||
|
@@ -260,14 +260,14 @@ struct ib_srq *mlx5_ib_create_srq(struct ib_pd *pd,
|
||||
}
|
||||
in.type = init_attr->srq_type;
|
||||
|
||||
if (pd->uobject)
|
||||
if (udata)
|
||||
err = create_srq_user(pd, srq, &in, udata, buf_size);
|
||||
else
|
||||
err = create_srq_kernel(dev, srq, &in, buf_size);
|
||||
|
||||
if (err) {
|
||||
mlx5_ib_warn(dev, "create srq %s failed, err %d\n",
|
||||
pd->uobject ? "user" : "kernel", err);
|
||||
udata ? "user" : "kernel", err);
|
||||
goto err_srq;
|
||||
}
|
||||
|
||||
@@ -312,7 +312,7 @@ struct ib_srq *mlx5_ib_create_srq(struct ib_pd *pd,
|
||||
srq->msrq.event = mlx5_ib_srq_event;
|
||||
srq->ibsrq.ext.xrc.srq_num = srq->msrq.srqn;
|
||||
|
||||
if (pd->uobject)
|
||||
if (udata)
|
||||
if (ib_copy_to_udata(udata, &srq->msrq.srqn, sizeof(__u32))) {
|
||||
mlx5_ib_dbg(dev, "copy to user failed\n");
|
||||
err = -EFAULT;
|
||||
@@ -327,7 +327,7 @@ err_core:
|
||||
mlx5_cmd_destroy_srq(dev, &srq->msrq);
|
||||
|
||||
err_usr_kern_srq:
|
||||
if (pd->uobject)
|
||||
if (udata)
|
||||
destroy_srq_user(pd, srq);
|
||||
else
|
||||
destroy_srq_kernel(dev, srq);
|
||||
|
Reference in New Issue
Block a user