summaryrefslogtreecommitdiff
path: root/include/rdma/uverbs_ioctl.h
diff options
context:
space:
mode:
authorMatan Barak <matanb@mellanox.com>2017-08-03 16:06:59 +0300
committerDoug Ledford <dledford@redhat.com>2017-08-31 08:35:10 -0400
commit09e3ebf8c193d3f154c4ffb7cb18995df0243bc6 (patch)
tree7e69544add3462ad7e0b4f91b8f9ed961b066c03 /include/rdma/uverbs_ioctl.h
parent5009010fbf54bdc27e57baca490e1f9d6a4609e0 (diff)
downloadlinux-rt-09e3ebf8c193d3f154c4ffb7cb18995df0243bc6.tar.gz
IB/core: Add DEVICE object and root tree structure
This adds the DEVICE object. This object supports creating the context that all objects are created from. Moreover, it supports executing methods which are related to the device itself, such as QUERY_DEVICE. This is a singleton object (per file instance). All standard objects are put in the root structure. This root will later on be used in drivers as the source for their whole parsing tree. Later on, when new features are added, these drivers could mix this root with other customized objects. Signed-off-by: Matan Barak <matanb@mellanox.com> Reviewed-by: Yishai Hadas <yishaih@mellanox.com> Signed-off-by: Doug Ledford <dledford@redhat.com>
Diffstat (limited to 'include/rdma/uverbs_ioctl.h')
-rw-r--r--include/rdma/uverbs_ioctl.h35
1 files changed, 35 insertions, 0 deletions
diff --git a/include/rdma/uverbs_ioctl.h b/include/rdma/uverbs_ioctl.h
index 99130083615e..2e8925434d74 100644
--- a/include/rdma/uverbs_ioctl.h
+++ b/include/rdma/uverbs_ioctl.h
@@ -133,16 +133,51 @@ struct uverbs_root_spec {
* =======================================
*/
+struct uverbs_attr_def {
+ u16 id;
+ struct uverbs_attr_spec attr;
+};
+
+struct uverbs_method_def {
+ u16 id;
+ /* Combination of bits from enum UVERBS_ACTION_FLAG_XXXX */
+ u32 flags;
+ size_t num_attrs;
+ const struct uverbs_attr_def * const (*attrs)[];
+ int (*handler)(struct ib_device *ib_dev, struct ib_uverbs_file *ufile,
+ struct uverbs_attr_bundle *ctx);
+};
+
struct uverbs_object_def {
+ u16 id;
const struct uverbs_obj_type *type_attrs;
+ size_t num_methods;
+ const struct uverbs_method_def * const (*methods)[];
+};
+
+struct uverbs_object_tree_def {
+ size_t num_objects;
+ const struct uverbs_object_def * const (*objects)[];
};
#define _UVERBS_OBJECT(_id, _type_attrs, ...) \
((const struct uverbs_object_def) { \
+ .id = _id, \
.type_attrs = _type_attrs})
#define DECLARE_UVERBS_OBJECT(_name, _id, _type_attrs, ...) \
const struct uverbs_object_def _name = \
_UVERBS_OBJECT(_id, _type_attrs, ##__VA_ARGS__)
+#define _UVERBS_TREE_OBJECTS_SZ(...) \
+ (sizeof((const struct uverbs_object_def * const []){__VA_ARGS__}) / \
+ sizeof(const struct uverbs_object_def *))
+#define _UVERBS_OBJECT_TREE(...) \
+ ((const struct uverbs_object_tree_def) { \
+ .num_objects = _UVERBS_TREE_OBJECTS_SZ(__VA_ARGS__), \
+ .objects = &(const struct uverbs_object_def * const []){__VA_ARGS__} })
+#define DECLARE_UVERBS_OBJECT_TREE(_name, ...) \
+ const struct uverbs_object_tree_def _name = \
+ _UVERBS_OBJECT_TREE(__VA_ARGS__)
+
/* =================================================
* Parsing infrastructure
* =================================================