Commit e04dd131 authored by Jason Gunthorpe's avatar Jason Gunthorpe

RDMA/core: Do not erase the type of ib_wq.uobject

This is a struct ib_uwq_object pointer, instead of using container_of()
all over the place just store it with its actual type.

Link: https://lore.kernel.org/r/1578504126-9400-10-git-send-email-yishaih@mellanox.comSigned-off-by: default avatarYishai Hadas <yishaih@mellanox.com>
Signed-off-by: default avatarJason Gunthorpe <jgg@mellanox.com>
parent 9fbe334c
...@@ -2971,7 +2971,7 @@ static int ib_uverbs_ex_create_wq(struct uverbs_attr_bundle *attrs) ...@@ -2971,7 +2971,7 @@ static int ib_uverbs_ex_create_wq(struct uverbs_attr_bundle *attrs)
goto err_put_cq; goto err_put_cq;
} }
wq->uobject = &obj->uevent.uobject; wq->uobject = obj;
obj->uevent.uobject.object = wq; obj->uevent.uobject.object = wq;
wq->wq_type = wq_init_attr.wq_type; wq->wq_type = wq_init_attr.wq_type;
wq->cq = cq; wq->cq = cq;
...@@ -2981,7 +2981,7 @@ static int ib_uverbs_ex_create_wq(struct uverbs_attr_bundle *attrs) ...@@ -2981,7 +2981,7 @@ static int ib_uverbs_ex_create_wq(struct uverbs_attr_bundle *attrs)
atomic_set(&wq->usecnt, 0); atomic_set(&wq->usecnt, 0);
atomic_inc(&pd->usecnt); atomic_inc(&pd->usecnt);
atomic_inc(&cq->usecnt); atomic_inc(&cq->usecnt);
wq->uobject = &obj->uevent.uobject; wq->uobject = obj;
obj->uevent.uobject.object = wq; obj->uevent.uobject.object = wq;
memset(&resp, 0, sizeof(resp)); memset(&resp, 0, sizeof(resp));
...@@ -3070,7 +3070,8 @@ static int ib_uverbs_ex_modify_wq(struct uverbs_attr_bundle *attrs) ...@@ -3070,7 +3070,8 @@ static int ib_uverbs_ex_modify_wq(struct uverbs_attr_bundle *attrs)
} }
ret = wq->device->ops.modify_wq(wq, &wq_attr, cmd.attr_mask, ret = wq->device->ops.modify_wq(wq, &wq_attr, cmd.attr_mask,
&attrs->driver_udata); &attrs->driver_udata);
uobj_put_obj_read(wq); rdma_lookup_put_uobject(&wq->uobject->uevent.uobject,
UVERBS_LOOKUP_READ);
return ret; return ret;
} }
...@@ -3171,7 +3172,8 @@ static int ib_uverbs_ex_create_rwq_ind_table(struct uverbs_attr_bundle *attrs) ...@@ -3171,7 +3172,8 @@ static int ib_uverbs_ex_create_rwq_ind_table(struct uverbs_attr_bundle *attrs)
kfree(wqs_handles); kfree(wqs_handles);
for (j = 0; j < num_read_wqs; j++) for (j = 0; j < num_read_wqs; j++)
uobj_put_obj_read(wqs[j]); rdma_lookup_put_uobject(&wqs[j]->uobject->uevent.uobject,
UVERBS_LOOKUP_READ);
rdma_alloc_commit_uobject(uobj, attrs); rdma_alloc_commit_uobject(uobj, attrs);
return 0; return 0;
...@@ -3182,7 +3184,8 @@ static int ib_uverbs_ex_create_rwq_ind_table(struct uverbs_attr_bundle *attrs) ...@@ -3182,7 +3184,8 @@ static int ib_uverbs_ex_create_rwq_ind_table(struct uverbs_attr_bundle *attrs)
uobj_alloc_abort(uobj, attrs); uobj_alloc_abort(uobj, attrs);
put_wqs: put_wqs:
for (j = 0; j < num_read_wqs; j++) for (j = 0; j < num_read_wqs; j++)
uobj_put_obj_read(wqs[j]); rdma_lookup_put_uobject(&wqs[j]->uobject->uevent.uobject,
UVERBS_LOOKUP_READ);
err_free: err_free:
kfree(wqs_handles); kfree(wqs_handles);
kfree(wqs); kfree(wqs);
......
...@@ -481,8 +481,7 @@ void ib_uverbs_qp_event_handler(struct ib_event *event, void *context_ptr) ...@@ -481,8 +481,7 @@ void ib_uverbs_qp_event_handler(struct ib_event *event, void *context_ptr)
void ib_uverbs_wq_event_handler(struct ib_event *event, void *context_ptr) void ib_uverbs_wq_event_handler(struct ib_event *event, void *context_ptr)
{ {
struct ib_uevent_object *uobj = container_of(event->element.wq->uobject, struct ib_uevent_object *uobj = &event->element.wq->uobject->uevent;
struct ib_uevent_object, uobject);
ib_uverbs_async_handler(context_ptr, uobj->uobject.user_handle, ib_uverbs_async_handler(context_ptr, uobj->uobject.user_handle,
event->event, &uobj->event_list, event->event, &uobj->event_list,
......
...@@ -74,6 +74,7 @@ ...@@ -74,6 +74,7 @@
struct ib_umem_odp; struct ib_umem_odp;
struct ib_uqp_object; struct ib_uqp_object;
struct ib_usrq_object; struct ib_usrq_object;
struct ib_uwq_object;
extern struct workqueue_struct *ib_wq; extern struct workqueue_struct *ib_wq;
extern struct workqueue_struct *ib_comp_wq; extern struct workqueue_struct *ib_comp_wq;
...@@ -1621,7 +1622,7 @@ enum ib_wq_state { ...@@ -1621,7 +1622,7 @@ enum ib_wq_state {
struct ib_wq { struct ib_wq {
struct ib_device *device; struct ib_device *device;
struct ib_uobject *uobject; struct ib_uwq_object *uobject;
void *wq_context; void *wq_context;
void (*event_handler)(struct ib_event *, void *); void (*event_handler)(struct ib_event *, void *);
struct ib_pd *pd; struct ib_pd *pd;
......
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