@@ -352,6 +352,11 @@ struct mlx5_pd {
struct mlx5_parent_domain {
struct mlx5_pd mpd;
struct mlx5_td *mtd;
+ void *(*alloc)(struct ibv_pd *pd, void *pd_context, size_t size,
+ size_t alignment, uint64_t resource_type);
+ void (*free)(struct ibv_pd *pd, void *pd_context, void *ptr,
+ uint64_t resource_type);
+ void *pd_context;
};
enum {
@@ -326,7 +326,9 @@ mlx5_alloc_parent_domain(struct ibv_context *context,
if (ibv_check_alloc_parent_domain(attr))
return NULL;
- if (attr->comp_mask) {
+ if (!check_comp_mask(attr->comp_mask,
+ IBV_PARENT_DOMAIN_INIT_ATTR_ALLOCATORS |
+ IBV_PARENT_DOMAIN_INIT_ATTR_PD_CONTEXT)) {
errno = EINVAL;
return NULL;
}
@@ -350,6 +352,14 @@ mlx5_alloc_parent_domain(struct ibv_context *context,
&mparent_domain->mpd.ibv_pd,
&mparent_domain->mpd.mprotection_domain->ibv_pd);
+ if (attr->comp_mask & IBV_PARENT_DOMAIN_INIT_ATTR_ALLOCATORS) {
+ mparent_domain->alloc = attr->alloc;
+ mparent_domain->free = attr->free;
+ }
+
+ if (attr->comp_mask & IBV_PARENT_DOMAIN_INIT_ATTR_PD_CONTEXT)
+ mparent_domain->pd_context = attr->pd_context;
+
return &mparent_domain->mpd.ibv_pd;
}
Extend mlx5_alloc_parent_domain() to support custom allocator, downstream patches from this series will use this functionality. Signed-off-by: Yishai Hadas <yishaih@mellanox.com> --- providers/mlx5/mlx5.h | 5 +++++ providers/mlx5/verbs.c | 12 +++++++++++- 2 files changed, 16 insertions(+), 1 deletion(-)