diff options
| author | Matan Barak <matanb@mellanox.com> | 2017-04-04 06:31:47 -0400 |
|---|---|---|
| committer | Doug Ledford <dledford@redhat.com> | 2017-04-05 13:28:04 -0400 |
| commit | 1e7710f3f6563940bb6bbc94aa8eadfd344a86af (patch) | |
| tree | fcb76beff0bfd2e9c24e7962c5afa9c40fef25d6 /include/rdma | |
| parent | cf8966b3477d5e6545393bb4499f2051ea554c62 (diff) | |
IB/core: Change completion channel to use the reworked objects schema
This patch adds the standard fd based type - completion_channel.
The completion_channel is now prefixed with ib_uobject, similarly
to the rest of the uobjects.
This requires a few changes:
(1) We define a new completion channel fd based object type.
(2) completion_event and async_event are now two different types.
This means they use different fops.
(3) We release the completion_channel exactly as we release other
idr based objects.
(4) Since ib_uobjects are already kref-ed, we only add the kref to the
async event.
A fd object requires filling out several parameters. Its op pointer
should point to uverbs_fd_ops and its size should be at least the
size if ib_uobject. We use a macro to make the type declaration
easier.
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')
| -rw-r--r-- | include/rdma/uverbs_std_types.h | 1 | ||||
| -rw-r--r-- | include/rdma/uverbs_types.h | 9 |
2 files changed, 10 insertions, 0 deletions
diff --git a/include/rdma/uverbs_std_types.h b/include/rdma/uverbs_std_types.h index 88856642fdf5..7771ce966952 100644 --- a/include/rdma/uverbs_std_types.h +++ b/include/rdma/uverbs_std_types.h | |||
| @@ -35,6 +35,7 @@ | |||
| 35 | 35 | ||
| 36 | #include <rdma/uverbs_types.h> | 36 | #include <rdma/uverbs_types.h> |
| 37 | 37 | ||
| 38 | extern const struct uverbs_obj_fd_type uverbs_type_attrs_comp_channel; | ||
| 38 | extern const struct uverbs_obj_idr_type uverbs_type_attrs_cq; | 39 | extern const struct uverbs_obj_idr_type uverbs_type_attrs_cq; |
| 39 | extern const struct uverbs_obj_idr_type uverbs_type_attrs_qp; | 40 | extern const struct uverbs_obj_idr_type uverbs_type_attrs_qp; |
| 40 | extern const struct uverbs_obj_idr_type uverbs_type_attrs_rwq_ind_table; | 41 | extern const struct uverbs_obj_idr_type uverbs_type_attrs_rwq_ind_table; |
diff --git a/include/rdma/uverbs_types.h b/include/rdma/uverbs_types.h index 58674290fab0..a37692167a45 100644 --- a/include/rdma/uverbs_types.h +++ b/include/rdma/uverbs_types.h | |||
| @@ -146,9 +146,18 @@ struct uverbs_obj_fd_type { | |||
| 146 | }; | 146 | }; |
| 147 | 147 | ||
| 148 | extern const struct uverbs_obj_type_class uverbs_idr_class; | 148 | extern const struct uverbs_obj_type_class uverbs_idr_class; |
| 149 | extern const struct uverbs_obj_type_class uverbs_fd_class; | ||
| 149 | 150 | ||
| 150 | #define UVERBS_BUILD_BUG_ON(cond) (sizeof(char[1 - 2 * !!(cond)]) - \ | 151 | #define UVERBS_BUILD_BUG_ON(cond) (sizeof(char[1 - 2 * !!(cond)]) - \ |
| 151 | sizeof(char)) | 152 | sizeof(char)) |
| 153 | #define UVERBS_TYPE_ALLOC_FD(_size, _order) \ | ||
| 154 | { \ | ||
| 155 | .destroy_order = _order, \ | ||
| 156 | .type_class = &uverbs_fd_class, \ | ||
| 157 | .obj_size = (_size) + \ | ||
| 158 | UVERBS_BUILD_BUG_ON((_size) < \ | ||
| 159 | sizeof(struct ib_uobject_file)),\ | ||
| 160 | } | ||
| 152 | #define UVERBS_TYPE_ALLOC_IDR_SZ(_size, _order) \ | 161 | #define UVERBS_TYPE_ALLOC_IDR_SZ(_size, _order) \ |
| 153 | { \ | 162 | { \ |
| 154 | .destroy_order = _order, \ | 163 | .destroy_order = _order, \ |
