Skip to content

Commit 04ca16c

Browse files
yishaihdledford
authored andcommitted
IB/core: Enable getting an object type from a given uobject
Enable getting an object type from a given uobject, the type is saved upon tree merging and is returned as part of some helper function. Signed-off-by: Yishai Hadas <yishaih@mellanox.com> Signed-off-by: Leon Romanovsky <leonro@mellanox.com> Signed-off-by: Doug Ledford <dledford@redhat.com>
1 parent 4d7e8cc commit 04ca16c

3 files changed

Lines changed: 13 additions & 5 deletions

File tree

‎drivers/infiniband/core/rdma_core.h‎

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -118,11 +118,6 @@ void release_ufile_idr_uobject(struct ib_uverbs_file *ufile);
118118
* Depending on ID the slot pointer in the radix tree points at one of these
119119
* structs.
120120
*/
121-
struct uverbs_api_object {
122-
const struct uverbs_obj_type *type_attrs;
123-
const struct uverbs_obj_type_class *type_class;
124-
u8 disabled:1;
125-
};
126121

127122
struct uverbs_api_ioctl_method {
128123
int(__rcu *handler)(struct uverbs_attr_bundle *attrs);

‎drivers/infiniband/core/uverbs_uapi.c‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,7 @@ static int uapi_merge_obj_tree(struct uverbs_api *uapi,
184184
if (WARN_ON(obj_elm->type_attrs))
185185
return -EINVAL;
186186

187+
obj_elm->id = obj->id;
187188
obj_elm->type_attrs = obj->type_attrs;
188189
obj_elm->type_class = obj->type_attrs->type_class;
189190
/*

‎include/rdma/uverbs_std_types.h‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,5 +182,17 @@ static inline void ib_set_flow(struct ib_uobject *uobj, struct ib_flow *ibflow,
182182
uflow->resources = uflow_res;
183183
}
184184

185+
struct uverbs_api_object {
186+
const struct uverbs_obj_type *type_attrs;
187+
const struct uverbs_obj_type_class *type_class;
188+
u8 disabled:1;
189+
u32 id;
190+
};
191+
192+
static inline u32 uobj_get_object_id(struct ib_uobject *uobj)
193+
{
194+
return uobj->uapi_object->id;
195+
}
196+
185197
#endif
186198

0 commit comments

Comments
 (0)