]> git.proxmox.com Git - mirror_ubuntu-hirsute-kernel.git/commitdiff
IB/core: Enable getting an object type from a given uobject
authorYishai Hadas <yishaih@mellanox.com>
Mon, 26 Nov 2018 06:28:34 +0000 (08:28 +0200)
committerDoug Ledford <dledford@redhat.com>
Tue, 4 Dec 2018 18:46:41 +0000 (13:46 -0500)
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>
drivers/infiniband/core/rdma_core.h
drivers/infiniband/core/uverbs_uapi.c
include/rdma/uverbs_std_types.h

index 8aec28037c4833061c765caaf93ec862276ca531..b3ca7457ac42669929bc766f37ad75d0e9b23a5a 100644 (file)
@@ -118,11 +118,6 @@ void release_ufile_idr_uobject(struct ib_uverbs_file *ufile);
  * Depending on ID the slot pointer in the radix tree points at one of these
  * structs.
  */
-struct uverbs_api_object {
-       const struct uverbs_obj_type *type_attrs;
-       const struct uverbs_obj_type_class *type_class;
-       u8 disabled:1;
-};
 
 struct uverbs_api_ioctl_method {
        int(__rcu *handler)(struct uverbs_attr_bundle *attrs);
index faac225184a66f1339d64589891022b78d965b25..0136c1d78a0f53d9f6ce68edb202cf315349030a 100644 (file)
@@ -184,6 +184,7 @@ static int uapi_merge_obj_tree(struct uverbs_api *uapi,
                if (WARN_ON(obj_elm->type_attrs))
                        return -EINVAL;
 
+               obj_elm->id = obj->id;
                obj_elm->type_attrs = obj->type_attrs;
                obj_elm->type_class = obj->type_attrs->type_class;
                /*
index df878ce02c94655cd3af6e6fb2c0563618b068b8..883abcf6d36eee2e2ca87a8b14cca0397db35915 100644 (file)
@@ -182,5 +182,17 @@ static inline void ib_set_flow(struct ib_uobject *uobj, struct ib_flow *ibflow,
        uflow->resources = uflow_res;
 }
 
+struct uverbs_api_object {
+       const struct uverbs_obj_type *type_attrs;
+       const struct uverbs_obj_type_class *type_class;
+       u8 disabled:1;
+       u32 id;
+};
+
+static inline u32 uobj_get_object_id(struct ib_uobject *uobj)
+{
+       return uobj->uapi_object->id;
+}
+
 #endif