diff options
| author | Jason Gunthorpe <jgg@mellanox.com> | 2018-11-12 22:59:56 +0200 |
|---|---|---|
| committer | Jason Gunthorpe <jgg@mellanox.com> | 2018-11-22 11:57:33 -0700 |
| commit | d120c3c91871650699ac8e71795925cc98358c3d (patch) | |
| tree | 8d832e280cfa22621426598d003eff806280f2cc /drivers/infiniband/core/rdma_core.h | |
| parent | 6884c6c4bd09fb35b79a3967d15821cdfcbe77a3 (diff) | |
| download | linux-d120c3c91871650699ac8e71795925cc98358c3d.tar.gz linux-d120c3c91871650699ac8e71795925cc98358c3d.tar.bz2 linux-d120c3c91871650699ac8e71795925cc98358c3d.zip | |
RDMA/uverbs: Convert the write interface to use uverbs_api
This organizes the write commands into objects and links them to the
uverbs_api data structure. The command path is reworked to use uapi
instead of its internal structures.
The command mask is moved from a runtime check to a registration time
check in the uapi.
Since the write interface does not have the object ID as part of the
command, the radix bins are converted into linear lists to support the
lookup.
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
Diffstat (limited to 'drivers/infiniband/core/rdma_core.h')
| -rw-r--r-- | drivers/infiniband/core/rdma_core.h | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/drivers/infiniband/core/rdma_core.h b/drivers/infiniband/core/rdma_core.h index d36a0573c5e4..f9039cfb28b4 100644 --- a/drivers/infiniband/core/rdma_core.h +++ b/drivers/infiniband/core/rdma_core.h @@ -182,5 +182,26 @@ extern const struct uapi_definition uverbs_def_obj_dm[]; extern const struct uapi_definition uverbs_def_obj_flow_action[]; extern const struct uapi_definition uverbs_def_obj_intf[]; extern const struct uapi_definition uverbs_def_obj_mr[]; +extern const struct uapi_definition uverbs_def_write_intf[]; + +static inline const struct uverbs_api_write_method * +uapi_get_method(const struct uverbs_api *uapi, u32 command) +{ + u32 cmd_idx = command & IB_USER_VERBS_CMD_COMMAND_MASK; + + if (command & ~(u32)(IB_USER_VERBS_CMD_FLAG_EXTENDED | + IB_USER_VERBS_CMD_COMMAND_MASK)) + return ERR_PTR(-EINVAL); + + if (command & IB_USER_VERBS_CMD_FLAG_EXTENDED) { + if (cmd_idx >= uapi->num_write_ex) + return ERR_PTR(-EOPNOTSUPP); + return uapi->write_ex_methods[cmd_idx]; + } + + if (cmd_idx >= uapi->num_write) + return ERR_PTR(-EOPNOTSUPP); + return uapi->write_methods[cmd_idx]; +} #endif /* RDMA_CORE_H */ |
