IB/mlx5: Introduce driver create and destroy flow methods
Introduce driver create and destroy flow methods on the uverbs flow object. This allows the driver to get its specific device attributes to match the underlay specification while still using the generic ib_flow object for cleanup and code sharing. The IB object's attributes are set via the ib_set_flow() helper function. The specific implementation for the given specification is added in downstream patches. Signed-off-by: Yishai Hadas <yishaih@mellanox.com> Signed-off-by: Leon Romanovsky <leonro@mellanox.com> Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
This commit is contained in:

committed by
Jason Gunthorpe

parent
6cd080a674
commit
3226944124
@@ -4134,6 +4134,20 @@ ib_get_vector_affinity(struct ib_device *device, int comp_vector)
|
||||
|
||||
}
|
||||
|
||||
static inline void ib_set_flow(struct ib_uobject *uobj, struct ib_flow *ibflow,
|
||||
struct ib_qp *qp, struct ib_device *device)
|
||||
{
|
||||
uobj->object = ibflow;
|
||||
ibflow->uobject = uobj;
|
||||
|
||||
if (qp) {
|
||||
atomic_inc(&qp->usecnt);
|
||||
ibflow->qp = qp;
|
||||
}
|
||||
|
||||
ibflow->device = device;
|
||||
}
|
||||
|
||||
/**
|
||||
* rdma_roce_rescan_device - Rescan all of the network devices in the system
|
||||
* and add their gids, as needed, to the relevant RoCE devices.
|
||||
|
@@ -97,6 +97,24 @@
|
||||
.methods = &UVERBS_OBJECT_METHODS(_object_id) \
|
||||
}
|
||||
|
||||
/* Used by drivers to declare a complete parsing tree for new methods
|
||||
*/
|
||||
#define ADD_UVERBS_METHODS(_name, _object_id, ...) \
|
||||
static const struct uverbs_method_def *const UVERBS_OBJECT_METHODS( \
|
||||
_object_id)[] = { __VA_ARGS__ }; \
|
||||
static const struct uverbs_object_def _name##_struct = { \
|
||||
.id = _object_id, \
|
||||
.num_methods = ARRAY_SIZE(UVERBS_OBJECT_METHODS(_object_id)), \
|
||||
.methods = &UVERBS_OBJECT_METHODS(_object_id) \
|
||||
}; \
|
||||
static const struct uverbs_object_def *const _name##_ptrs[] = { \
|
||||
&_name##_struct, \
|
||||
}; \
|
||||
static const struct uverbs_object_tree_def _name = { \
|
||||
.num_objects = 1, \
|
||||
.objects = &_name##_ptrs, \
|
||||
}
|
||||
|
||||
/* Used by drivers to declare a complete parsing tree for a single method that
|
||||
* differs only in having additional driver specific attributes.
|
||||
*/
|
||||
@@ -108,19 +126,6 @@
|
||||
.num_attrs = ARRAY_SIZE(UVERBS_METHOD_ATTRS(_method_id)), \
|
||||
.attrs = &UVERBS_METHOD_ATTRS(_method_id), \
|
||||
}; \
|
||||
static const struct uverbs_method_def *const UVERBS_OBJECT_METHODS( \
|
||||
_object_id)[] = { &UVERBS_METHOD(_method_id) }; \
|
||||
static const struct uverbs_object_def _name##_struct = { \
|
||||
.id = _object_id, \
|
||||
.num_methods = 1, \
|
||||
.methods = &UVERBS_OBJECT_METHODS(_object_id) \
|
||||
}; \
|
||||
static const struct uverbs_object_def *const _name##_ptrs[] = { \
|
||||
&_name##_struct, \
|
||||
}; \
|
||||
static const struct uverbs_object_tree_def _name = { \
|
||||
.num_objects = 1, \
|
||||
.objects = &_name##_ptrs, \
|
||||
}
|
||||
ADD_UVERBS_METHODS(_name, _object_id, &UVERBS_METHOD(_method_id))
|
||||
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user