Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ff23dfa1 authored by Shamir Rabinovitch's avatar Shamir Rabinovitch Committed by Jason Gunthorpe
Browse files

IB: Pass only ib_udata in function prototypes



Now when ib_udata is passed to all the driver's object create/destroy APIs
the ib_udata will carry the ib_ucontext for every user command. There is
no need to also pass the ib_ucontext via the functions prototypes.

Make ib_udata the only argument psssed.

Signed-off-by: default avatarShamir Rabinovitch <shamir.rabinovitch@oracle.com>
Signed-off-by: default avatarJason Gunthorpe <jgg@mellanox.com>
parent bdeacabd
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -147,7 +147,7 @@ struct ib_cq *__ib_alloc_cq_user(struct ib_device *dev, void *private,
	struct ib_cq *cq;
	int ret = -ENOMEM;

	cq = dev->ops.create_cq(dev, &cq_attr, NULL, NULL);
	cq = dev->ops.create_cq(dev, &cq_attr, NULL);
	if (IS_ERR(cq))
		return cq;

+3 −5
Original line number Diff line number Diff line
@@ -423,7 +423,7 @@ static int ib_uverbs_alloc_pd(struct uverbs_attr_bundle *attrs)
	atomic_set(&pd->usecnt, 0);
	pd->res.type = RDMA_RESTRACK_PD;

	ret = ib_dev->ops.alloc_pd(pd, uobj->context, &attrs->driver_udata);
	ret = ib_dev->ops.alloc_pd(pd, &attrs->driver_udata);
	if (ret)
		goto err_alloc;

@@ -594,8 +594,7 @@ static int ib_uverbs_open_xrcd(struct uverbs_attr_bundle *attrs)
	}

	if (!xrcd) {
		xrcd = ib_dev->ops.alloc_xrcd(ib_dev, obj->uobject.context,
					      &attrs->driver_udata);
		xrcd = ib_dev->ops.alloc_xrcd(ib_dev, &attrs->driver_udata);
		if (IS_ERR(xrcd)) {
			ret = PTR_ERR(xrcd);
			goto err;
@@ -1009,8 +1008,7 @@ static struct ib_ucq_object *create_cq(struct uverbs_attr_bundle *attrs,
	attr.comp_vector = cmd->comp_vector;
	attr.flags = cmd->flags;

	cq = ib_dev->ops.create_cq(ib_dev, &attr, obj->uobject.context,
				   &attrs->driver_udata);
	cq = ib_dev->ops.create_cq(ib_dev, &attr, &attrs->driver_udata);
	if (IS_ERR(cq)) {
		ret = PTR_ERR(cq);
		goto err_file;
+1 −2
Original line number Diff line number Diff line
@@ -111,8 +111,7 @@ static int UVERBS_HANDLER(UVERBS_METHOD_CQ_CREATE)(
	INIT_LIST_HEAD(&obj->comp_list);
	INIT_LIST_HEAD(&obj->async_list);

	cq = ib_dev->ops.create_cq(ib_dev, &attr, obj->uobject.context,
				   &attrs->driver_udata);
	cq = ib_dev->ops.create_cq(ib_dev, &attr, &attrs->driver_udata);
	if (IS_ERR(cq)) {
		ret = PTR_ERR(cq);
		goto err_event_file;
+3 −3
Original line number Diff line number Diff line
@@ -269,7 +269,7 @@ struct ib_pd *__ib_alloc_pd(struct ib_device *device, unsigned int flags,
	pd->res.type = RDMA_RESTRACK_PD;
	rdma_restrack_set_task(&pd->res, caller);

	ret = device->ops.alloc_pd(pd, NULL, NULL);
	ret = device->ops.alloc_pd(pd, NULL);
	if (ret) {
		kfree(pd);
		return ERR_PTR(ret);
@@ -1911,7 +1911,7 @@ struct ib_cq *__ib_create_cq(struct ib_device *device,
{
	struct ib_cq *cq;

	cq = device->ops.create_cq(device, cq_attr, NULL, NULL);
	cq = device->ops.create_cq(device, cq_attr, NULL);

	if (!IS_ERR(cq)) {
		cq->device        = device;
@@ -2142,7 +2142,7 @@ struct ib_xrcd *__ib_alloc_xrcd(struct ib_device *device, const char *caller)
	if (!device->ops.alloc_xrcd)
		return ERR_PTR(-EOPNOTSUPP);

	xrcd = device->ops.alloc_xrcd(device, NULL, NULL);
	xrcd = device->ops.alloc_xrcd(device, NULL);
	if (!IS_ERR(xrcd)) {
		xrcd->device = device;
		xrcd->inode = NULL;
+8 −13
Original line number Diff line number Diff line
@@ -576,14 +576,12 @@ void bnxt_re_dealloc_pd(struct ib_pd *ib_pd, struct ib_udata *udata)
				      &pd->qplib_pd);
}

int bnxt_re_alloc_pd(struct ib_pd *ibpd, struct ib_ucontext *ucontext,
		     struct ib_udata *udata)
int bnxt_re_alloc_pd(struct ib_pd *ibpd, struct ib_udata *udata)
{
	struct ib_device *ibdev = ibpd->device;
	struct bnxt_re_dev *rdev = to_bnxt_re_dev(ibdev, ibdev);
	struct bnxt_re_ucontext *ucntx = container_of(ucontext,
						      struct bnxt_re_ucontext,
						      ib_uctx);
	struct bnxt_re_ucontext *ucntx = rdma_udata_to_drv_context(
		udata, struct bnxt_re_ucontext, ib_uctx);
	struct bnxt_re_pd *pd = container_of(ibpd, struct bnxt_re_pd, ib_pd);
	int rc;

@@ -2589,7 +2587,6 @@ int bnxt_re_destroy_cq(struct ib_cq *ib_cq, struct ib_udata *udata)

struct ib_cq *bnxt_re_create_cq(struct ib_device *ibdev,
				const struct ib_cq_init_attr *attr,
				struct ib_ucontext *context,
				struct ib_udata *udata)
{
	struct bnxt_re_dev *rdev = to_bnxt_re_dev(ibdev, ibdev);
@@ -2616,12 +2613,10 @@ struct ib_cq *bnxt_re_create_cq(struct ib_device *ibdev,
	if (entries > dev_attr->max_cq_wqes + 1)
		entries = dev_attr->max_cq_wqes + 1;

	if (context) {
	if (udata) {
		struct bnxt_re_cq_req req;
		struct bnxt_re_ucontext *uctx = container_of
						(context,
						 struct bnxt_re_ucontext,
						 ib_uctx);
		struct bnxt_re_ucontext *uctx = rdma_udata_to_drv_context(
			udata, struct bnxt_re_ucontext, ib_uctx);
		if (ib_copy_from_udata(&req, udata, sizeof(req))) {
			rc = -EFAULT;
			goto fail;
@@ -2672,7 +2667,7 @@ struct ib_cq *bnxt_re_create_cq(struct ib_device *ibdev,
	atomic_inc(&rdev->cq_count);
	spin_lock_init(&cq->cq_lock);

	if (context) {
	if (udata) {
		struct bnxt_re_cq_resp resp;

		resp.cqid = cq->qplib_cq.id;
@@ -2690,7 +2685,7 @@ struct ib_cq *bnxt_re_create_cq(struct ib_device *ibdev,
	return &cq->ib_cq;

c2fail:
	if (context)
	if (udata)
		ib_umem_release(cq->umem);
fail:
	kfree(cq->cql);
Loading