linux/include/uapi/rdma
Matan Barak fac9658cab IB/core: Add new ioctl interface
In this ioctl interface, processing the command starts from
properties of the command and fetching the appropriate user objects
before calling the handler.

Parsing and validation is done according to a specifier declared by
the driver's code. In the driver, all supported objects are declared.
These objects are separated to different object namepsaces. Dividing
objects to namespaces is done at initialization by using the higher
bits of the object ids. This initialization can mix objects declared
in different places to one parsing tree using in this ioctl interface.

For each object we list all supported methods. Similarly to objects,
methods are separated to method namespaces too. Namespacing is done
similarly to the objects case. This could be used in order to add
methods to an existing object.

Each method has a specific handler, which could be either a default
handler or a driver specific handler.
Along with the handler, a bunch of attributes are specified as well.
Similarly to objects and method, attributes are namespaced and hashed
by their ids at initialization too. All supported attributes are
subject to automatic fetching and validation. These attributes include
the command, response and the method's related objects' ids.

When these entities (objects, methods and attributes) are used, the
high bits of the entities ids are used in order to calculate the hash
bucket index. Then, these high bits are masked out in order to have a
zero based index. Since we use these high bits for both bucketing and
namespacing, we get a compact representation and O(1) array access.
This is mandatory for efficient dispatching.

Each attribute has a type (PTR_IN, PTR_OUT, IDR and FD) and a length.
Attributes could be validated through some attributes, like:
(*) Minimum size / Exact size
(*) Fops for FD
(*) Object type for IDR

If an IDR/fd attribute is specified, the kernel also states the object
type and the required access (NEW, WRITE, READ or DESTROY).
All uobject/fd management is done automatically by the infrastructure,
meaning - the infrastructure will fail concurrent commands that at
least one of them requires concurrent access (WRITE/DESTROY),
synchronize actions with device removals (dissociate context events)
and take care of reference counting (increase/decrease) for concurrent
actions invocation. The reference counts on the actual kernel objects
shall be handled by the handlers.

 objects
+--------+
|        |
|        |   methods                                                                +--------+
|        |   ns         method      method_spec                           +-----+   |len     |
+--------+  +------+[d]+-------+   +----------------+[d]+------------+    |attr1+-> |type    |
| object +> |method+-> | spec  +-> +  attr_buckets  +-> |default_chain+--> +-----+   |idr_type|
+--------+  +------+   |handler|   |                |   +------------+    |attr2|   |access  |
|        |  |      |   +-------+   +----------------+   |driver chain|    +-----+   +--------+
|        |  |      |                                    +------------+
|        |  +------+
|        |
|        |
|        |
|        |
|        |
|        |
|        |
|        |
|        |
|        |
+--------+

[d] = Hash ids to groups using the high order bits

The right types table is also chosen by using the high bits from
the ids. Currently we have either default or driver specific groups.

Once validation and object fetching (or creation) completed, we call
the handler:
int (*handler)(struct ib_device *ib_dev, struct ib_uverbs_file *ufile,
               struct uverbs_attr_bundle *ctx);

ctx bundles attributes of different namespaces. Each element there
is an array of attributes which corresponds to one namespaces of
attributes. For example, in the usually used case:

 ctx                               core
+----------------------------+     +------------+
| core:                      +---> | valid      |
+----------------------------+     | cmd_attr   |
| driver:                    |     +------------+
|----------------------------+--+  | valid      |
                                |  | cmd_attr   |
                                |  +------------+
                                |  | valid      |
                                |  | obj_attr   |
                                |  +------------+
                                |
                                |  drivers
                                |  +------------+
                                +> | valid      |
                                   | cmd_attr   |
                                   +------------+
                                   | valid      |
                                   | cmd_attr   |
                                   +------------+
                                   | valid      |
                                   | obj_attr   |
                                   +------------+

Signed-off-by: Matan Barak <matanb@mellanox.com>
Reviewed-by: Yishai Hadas <yishaih@mellanox.com>
Signed-off-by: Doug Ledford <dledford@redhat.com>
2017-08-31 08:35:09 -04:00
..
hfi uapi: export all headers under uapi directories 2017-05-11 00:21:54 +09:00
bnxt_re-abi.h uapi: includes linux/types.h before exporting files 2017-05-11 00:18:38 +09:00
cxgb3-abi.h IB/cxgb3: fix misspelling in header guard 2017-01-24 12:20:23 -05:00
cxgb4-abi.h IB/cxgb4: Move user vendor structures 2016-10-07 16:54:35 -04:00
hns-abi.h IB/hns: Move HNS RoCE user vendor structures 2016-12-03 14:23:14 -05:00
ib_user_cm.h
ib_user_mad.h RDMA/core: Move legacy MAD IOCTL declarations to common file 2017-01-10 12:41:40 -05:00
ib_user_sa.h
ib_user_verbs.h IB/uverbs: Expose XRQ capabilities 2017-08-29 08:30:18 -04:00
mlx4-abi.h IB/mlx4: Remove redundant attribute in mlx4_ib_create_qp_rss struct 2017-08-24 16:27:11 -04:00
mlx5-abi.h IB/mlx5: Report mlx5 enhanced multi packet WQE capability 2017-08-24 17:47:35 -04:00
mthca-abi.h IB/mthca: Move user vendor structures 2016-10-07 16:54:37 -04:00
nes-abi.h IB/nes: Move user vendor structures 2016-10-07 16:54:37 -04:00
ocrdma-abi.h IB/ocrdma: Move user vendor structures 2016-10-07 16:54:36 -04:00
qedr-abi.h RDMA/qedr: notify user application of supported WIDs 2017-07-27 08:59:52 -04:00
rdma_netlink.h RDMA/netlink: Export node_type 2017-08-10 13:28:14 +03:00
rdma_user_cm.h rdma UAPI: Use __kernel_sockaddr_storage 2016-12-14 11:42:39 -05:00
rdma_user_ioctl.h IB/core: Add new ioctl interface 2017-08-31 08:35:09 -04:00
rdma_user_rxe.h Soft RoCE driver 2016-08-04 11:13:12 -04:00
vmw_pvrdma-abi.h RDMA/vmw_pvrdma: Report network header type in WC 2017-08-31 08:35:08 -04:00