Commit feec576a authored by Jason Gunthorpe's avatar Jason Gunthorpe

IB: When attrs.udata/ufile is available use that instead of uobject

The ucontext and ufile should not be accessed via the uobject, all these
cases have an attrs so use that instead.
Signed-off-by: default avatarJason Gunthorpe <jgg@mellanox.com>
parent e79c9c60
...@@ -128,7 +128,7 @@ static int uverbs_destroy_uobject(struct ib_uobject *uobj, ...@@ -128,7 +128,7 @@ static int uverbs_destroy_uobject(struct ib_uobject *uobj,
enum rdma_remove_reason reason, enum rdma_remove_reason reason,
struct uverbs_attr_bundle *attrs) struct uverbs_attr_bundle *attrs)
{ {
struct ib_uverbs_file *ufile = uobj->ufile; struct ib_uverbs_file *ufile = attrs->ufile;
unsigned long flags; unsigned long flags;
int ret; int ret;
...@@ -200,7 +200,7 @@ static int uverbs_destroy_uobject(struct ib_uobject *uobj, ...@@ -200,7 +200,7 @@ static int uverbs_destroy_uobject(struct ib_uobject *uobj,
*/ */
int uobj_destroy(struct ib_uobject *uobj, struct uverbs_attr_bundle *attrs) int uobj_destroy(struct ib_uobject *uobj, struct uverbs_attr_bundle *attrs)
{ {
struct ib_uverbs_file *ufile = uobj->ufile; struct ib_uverbs_file *ufile = attrs->ufile;
int ret; int ret;
down_read(&ufile->hw_destroy_rwsem); down_read(&ufile->hw_destroy_rwsem);
...@@ -655,7 +655,7 @@ static int alloc_commit_fd_uobject(struct ib_uobject *uobj) ...@@ -655,7 +655,7 @@ static int alloc_commit_fd_uobject(struct ib_uobject *uobj)
int __must_check rdma_alloc_commit_uobject(struct ib_uobject *uobj, int __must_check rdma_alloc_commit_uobject(struct ib_uobject *uobj,
struct uverbs_attr_bundle *attrs) struct uverbs_attr_bundle *attrs)
{ {
struct ib_uverbs_file *ufile = uobj->ufile; struct ib_uverbs_file *ufile = attrs->ufile;
int ret; int ret;
/* alloc_commit consumes the uobj kref */ /* alloc_commit consumes the uobj kref */
......
...@@ -54,7 +54,7 @@ static int UVERBS_HANDLER(UVERBS_METHOD_COUNTERS_CREATE)( ...@@ -54,7 +54,7 @@ static int UVERBS_HANDLER(UVERBS_METHOD_COUNTERS_CREATE)(
{ {
struct ib_uobject *uobj = uverbs_attr_get_uobject( struct ib_uobject *uobj = uverbs_attr_get_uobject(
attrs, UVERBS_ATTR_CREATE_COUNTERS_HANDLE); attrs, UVERBS_ATTR_CREATE_COUNTERS_HANDLE);
struct ib_device *ib_dev = uobj->context->device; struct ib_device *ib_dev = attrs->context->device;
struct ib_counters *counters; struct ib_counters *counters;
int ret; int ret;
......
...@@ -64,7 +64,7 @@ static int UVERBS_HANDLER(UVERBS_METHOD_CQ_CREATE)( ...@@ -64,7 +64,7 @@ static int UVERBS_HANDLER(UVERBS_METHOD_CQ_CREATE)(
struct ib_ucq_object *obj = container_of( struct ib_ucq_object *obj = container_of(
uverbs_attr_get_uobject(attrs, UVERBS_ATTR_CREATE_CQ_HANDLE), uverbs_attr_get_uobject(attrs, UVERBS_ATTR_CREATE_CQ_HANDLE),
typeof(*obj), uobject); typeof(*obj), uobject);
struct ib_device *ib_dev = obj->uobject.context->device; struct ib_device *ib_dev = attrs->context->device;
int ret; int ret;
u64 user_handle; u64 user_handle;
struct ib_cq_init_attr attr = {}; struct ib_cq_init_attr attr = {};
......
...@@ -55,7 +55,7 @@ static int UVERBS_HANDLER(UVERBS_METHOD_DM_ALLOC)( ...@@ -55,7 +55,7 @@ static int UVERBS_HANDLER(UVERBS_METHOD_DM_ALLOC)(
struct ib_uobject *uobj = struct ib_uobject *uobj =
uverbs_attr_get(attrs, UVERBS_ATTR_ALLOC_DM_HANDLE) uverbs_attr_get(attrs, UVERBS_ATTR_ALLOC_DM_HANDLE)
->obj_attr.uobject; ->obj_attr.uobject;
struct ib_device *ib_dev = uobj->context->device; struct ib_device *ib_dev = attrs->context->device;
struct ib_dm *dm; struct ib_dm *dm;
int ret; int ret;
...@@ -72,7 +72,7 @@ static int UVERBS_HANDLER(UVERBS_METHOD_DM_ALLOC)( ...@@ -72,7 +72,7 @@ static int UVERBS_HANDLER(UVERBS_METHOD_DM_ALLOC)(
if (ret) if (ret)
return ret; return ret;
dm = ib_dev->ops.alloc_dm(ib_dev, uobj->context, &attr, attrs); dm = ib_dev->ops.alloc_dm(ib_dev, attrs->context, &attr, attrs);
if (IS_ERR(dm)) if (IS_ERR(dm))
return PTR_ERR(dm); return PTR_ERR(dm);
......
...@@ -310,7 +310,7 @@ static int UVERBS_HANDLER(UVERBS_METHOD_FLOW_ACTION_ESP_CREATE)( ...@@ -310,7 +310,7 @@ static int UVERBS_HANDLER(UVERBS_METHOD_FLOW_ACTION_ESP_CREATE)(
{ {
struct ib_uobject *uobj = uverbs_attr_get_uobject( struct ib_uobject *uobj = uverbs_attr_get_uobject(
attrs, UVERBS_ATTR_CREATE_FLOW_ACTION_ESP_HANDLE); attrs, UVERBS_ATTR_CREATE_FLOW_ACTION_ESP_HANDLE);
struct ib_device *ib_dev = uobj->context->device; struct ib_device *ib_dev = attrs->context->device;
int ret; int ret;
struct ib_flow_action *action; struct ib_flow_action *action;
struct ib_flow_action_esp_attr esp_attr = {}; struct ib_flow_action_esp_attr esp_attr = {};
......
...@@ -128,7 +128,7 @@ __uobj_alloc(const struct uverbs_api_object *obj, ...@@ -128,7 +128,7 @@ __uobj_alloc(const struct uverbs_api_object *obj,
rdma_alloc_begin_uobject(obj, attrs->ufile, attrs); rdma_alloc_begin_uobject(obj, attrs->ufile, attrs);
if (!IS_ERR(uobj)) if (!IS_ERR(uobj))
*ib_dev = uobj->context->device; *ib_dev = attrs->context->device;
return uobj; return uobj;
} }
......
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