Debian Codegraph @

libibverbs/man/ibv_alloc_parent_domain.3

raw
1 .\" -*- nroff -*-
2 .\" Licensed under the OpenIB.org BSD license (FreeBSD Variant) - See COPYING.md
3 .\"
4 .TH IBV_ALLOC_PARENT_DOMAIN 3 2017-11-06 libibverbs "Libibverbs Programmer's Manual"
5 .SH "NAME"
6 ibv_alloc_parent_domain(), ibv_dealloc_pd() \- allocate and deallocate the parent domain object
7 .SH "SYNOPSIS"
8 .nf
9 .B #include <infiniband/verbs.h>
10 .sp
11 .BI "struct ibv_pd *ibv_alloc_parent_domain(struct ibv_context " "*context" ", struct ibv_parent_domain_init_attr " "*attr");
12 .sp
13 .SH "DESCRIPTION"
14 .B ibv_alloc_parent_domain()
15 allocates a parent domain object for the RDMA device context
16 .I context\fR.
17 .sp
18 The parent domain object extends the normal protection domain with additional
19 objects, such as a thread domain.
20 .sp
21 A parent domain is completely interchangeable with the
22 .I
23 struct ibv_pd
24 used to create it, and can be used as an input argument to any function accepting a
25 .I
26 struct ibv_pd.
27 .sp
28 The behavior of each verb may be different if the verb is passed a parent
29 domain
30 .I
31 struct ibv_pd
32 that contains a
33 .I
34 struct ibv_td pointer\fR.
35 For instance the verb may choose to share resources
36 between objects using the same thread domain. The exact behavior is provider
37 dependent.
38 .sp
39 The
40 .I attr
41 argument specifies the following:
42 .PP
43 .nf
44 enum ibv_parent_domain_init_attr_mask {
45 .in +8
46 IBV_PARENT_DOMAIN_INIT_ATTR_ALLOCATORS = 1 << 0,
47 IBV_PARENT_DOMAIN_INIT_ATTR_PD_CONTEXT = 1 << 1,
48 .in -8
49 };
50
51 struct ibv_parent_domain_init_attr {
52 .in +8
53 struct ibv_pd *pd; /* reference to a protection domain, can't be NULL */
54 struct ibv_td *td; /* reference to a thread domain, or NULL */
55 uint32_t comp_mask;
56 void *(*alloc)(struct ibv_pd *pd, void *pd_context, size_t size,
57 size_t alignment, uint64_t resource_type);
58 void (*free)(struct ibv_pd *pd, void *pd_context, void *ptr,
59 uint64_t resource_type);
60 void *pd_context;
61 .in -8
62 };
63 .fi
64 .PP
65 .sp
66 .B ibv_dealloc_pd()
67 will deallocate the parent domain as its exposed as an ibv_pd
68 .I pd\fR.
69 All resources created with the parent domain
70 should be destroyed prior to deallocating the parent domain\fR.
71 .SH "ARGUMENTS"
72 .B pd
73 Reference to the protection domain that this parent domain uses.
74 .PP
75 .B td
76 An optional thread domain that the parent domain uses.
77 .PP
78 .B comp_mask
79 Bit-mask of optional fields in the ibv_parent_domain_init_attr struct.
80 .PP
81 .B alloc
82 Custom memory allocation function for this parent domain. Provider
83 memory allocations will use this function to allocate the needed memory.
84 The allocation function is passed the parent domain
85 .B pd
86 and the user-specified context
87 .B pd_context.
88 In addition, the callback receives the
89 .B size
90 and the
91 .B alignment
92 of the requested buffer, as well a vendor-specific
93 .B resource_type
94 , which is derived from the rdma_driver_id enum (upper 32 bits) and a vendor
95 specific resource code.
96 The function returns the pointer to the allocated buffer, or NULL to
97 designate an error. It may also return
98 .B IBV_ALLOCATOR_USE_DEFAULT
99 asking the callee to allocate the buffer using the default allocator.
100
101 The callback makes sure the allocated buffer is initialized with zeros. It is
102 also the responsibility of the callback to make sure the memory cannot be
103 COWed, e.g. by using madvise(MADV_DONTFORK) or by allocating anonymous shared
104 memory.
105 .PP
106 .B free
107 Callback to free memory buffers that were allocated using a successful
108 alloc().
109 .PP
110 .B pd_context
111 A pointer for additional user-specific data to be associated with this
112 parent domain. The pointer is passed back to the custom allocator functions.
113 .SH "RETURN VALUE"
114 .B ibv_alloc_parent_domain()
115 returns a pointer to the allocated struct
116 .I ibv_pd
117 object, or NULL if the request fails (and sets errno to indicate the failure reason).
118 .sp
119 .SH "SEE ALSO"
120 .BR ibv_alloc_parent_domain (3),
121 .BR ibv_dealloc_pd (3),
122 .BR ibv_alloc_pd (3),
123 .BR ibv_alloc_td (3)
124 .SH "AUTHORS"
125 .TP
126 Alex Rosenbaum <[email protected]>
127 .TP
128 Yishai Hadas <[email protected]>