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>
This commit is contained in:

committed by
Doug Ledford

parent
cf8966b347
commit
1e7710f3f6
@@ -35,6 +35,7 @@
|
||||
|
||||
#include <rdma/uverbs_types.h>
|
||||
|
||||
extern const struct uverbs_obj_fd_type uverbs_type_attrs_comp_channel;
|
||||
extern const struct uverbs_obj_idr_type uverbs_type_attrs_cq;
|
||||
extern const struct uverbs_obj_idr_type uverbs_type_attrs_qp;
|
||||
extern const struct uverbs_obj_idr_type uverbs_type_attrs_rwq_ind_table;
|
||||
|
@@ -146,9 +146,18 @@ struct uverbs_obj_fd_type {
|
||||
};
|
||||
|
||||
extern const struct uverbs_obj_type_class uverbs_idr_class;
|
||||
extern const struct uverbs_obj_type_class uverbs_fd_class;
|
||||
|
||||
#define UVERBS_BUILD_BUG_ON(cond) (sizeof(char[1 - 2 * !!(cond)]) - \
|
||||
sizeof(char))
|
||||
#define UVERBS_TYPE_ALLOC_FD(_size, _order) \
|
||||
{ \
|
||||
.destroy_order = _order, \
|
||||
.type_class = &uverbs_fd_class, \
|
||||
.obj_size = (_size) + \
|
||||
UVERBS_BUILD_BUG_ON((_size) < \
|
||||
sizeof(struct ib_uobject_file)),\
|
||||
}
|
||||
#define UVERBS_TYPE_ALLOC_IDR_SZ(_size, _order) \
|
||||
{ \
|
||||
.destroy_order = _order, \
|
||||
|
Reference in New Issue
Block a user