1IBV_ALLOC_PARENT_DOMAIN(3L)ibibverbs Programmer's ManuaIlBV_ALLOC_PARENT_DOMAIN(3)
2
3
4
6 ibv_alloc_parent_domain(), ibv_dealloc_pd() - allocate and deallocate
7 the parent domain object
8
10 #include <infiniband/verbs.h>
11
12 struct ibv_pd *ibv_alloc_parent_domain(struct ibv_context *context", struct ibv_parent_domain_init_attr *attr);
13
14
16 ibv_alloc_parent_domain() allocates a parent domain object for the RDMA
17 device context context.
18
19 The parent domain object extends the normal protection domain with
20 additional objects, such as a thread domain.
21
22 A parent domain is completely interchangeable with the struct ibv_pd
23 used to create it, and can be used as an input argument to any function
24 accepting a struct ibv_pd.
25
26 The behavior of each verb may be different if the verb is passed a par‐
27 ent domain struct ibv_pd that contains a struct ibv_td pointer. For
28 instance the verb may choose to share resources between objects using
29 the same thread domain. The exact behavior is provider dependent.
30
31 The attr argument specifies the following:
32
33 enum ibv_parent_domain_init_attr_mask {
34 IBV_PARENT_DOMAIN_INIT_ATTR_ALLOCATORS = 1 << 0,
35 IBV_PARENT_DOMAIN_INIT_ATTR_PD_CONTEXT = 1 << 1,
36 };
37
38 struct ibv_parent_domain_init_attr {
39 struct ibv_pd *pd; /* reference to a protection domain, can't be NULL */
40 struct ibv_td *td; /* reference to a thread domain, or NULL */
41 uint32_t comp_mask;
42 void *(*alloc)(struct ibv_pd *pd, void *pd_context, size_t size,
43 size_t alignment, uint64_t resource_type);
44 void (*free)(struct ibv_pd *pd, void *pd_context, void *ptr,
45 uint64_t resource_type);
46 void *pd_context;
47 };
48
49 ibv_dealloc_pd() will deallocate the parent domain as its exposed as an
50 ibv_pd pd. All resources created with the parent domain should be
51 destroyed prior to deallocating the parent domain.
52
54 pd Reference to the protection domain that this parent domain uses.
55
56 td An optional thread domain that the parent domain uses.
57
58 comp_mask Bit-mask of optional fields in the ibv_par‐
59 ent_domain_init_attr struct.
60
61 alloc Custom memory allocation function for this parent domain.
62 Provider memory allocations will use this function to allocate the
63 needed memory. The allocation function is passed the parent domain pd
64 and the user-specified context pd_context. In addition, the callback
65 receives the size and the alignment of the requested buffer, as well a
66 vendor-specific resource_type , which is derived from the
67 rdma_driver_id enum (upper 32 bits) and a vendor specific resource
68 code. The function returns the pointer to the allocated buffer, or
69 NULL to designate an error. It may also return IBV_ALLOCA‐
70 TOR_USE_DEFAULT asking the callee to allocate the buffer using the
71 default allocator.
72
73 The callback makes sure the allocated buffer is initialized with zeros.
74 It is also the responsibility of the callback to make sure the memory
75 cannot be COWed, e.g. by using madvise(MADV_DONTFORK) or by allocating
76 anonymous shared memory.
77
78 free Callback to free memory buffers that were allocated using a suc‐
79 cessful alloc().
80
81 pd_context A pointer for additional user-specific data to be associated
82 with this parent domain. The pointer is passed back to the custom allo‐
83 cator functions.
84
86 ibv_alloc_parent_domain() returns a pointer to the allocated struct
87 ibv_pd object, or NULL if the request fails (and sets errno to indicate
88 the failure reason).
89
90
92 ibv_alloc_parent_domain(3), ibv_dealloc_pd(3), ibv_alloc_pd(3),
93 ibv_alloc_td(3)
94
96 Alex Rosenbaum <alexr@mellanox.com>
97
98 Yishai Hadas <yishaih@mellanox.com>
99
100
101
102libibverbs 2017-11-06 IBV_ALLOC_PARENT_DOMAIN(3)