Debian Codegraph @

libibverbs/man/ibv_reg_mr.3

raw
1 .\" -*- nroff -*-
2 .\" Licensed under the OpenIB.org BSD license (FreeBSD Variant) - See COPYING.md
3 .\"
4 .TH IBV_REG_MR 3 2006-10-31 libibverbs "Libibverbs Programmer's Manual"
5 .SH "NAME"
6 ibv_reg_mr, ibv_reg_mr_iova, ibv_reg_dmabuf_mr, ibv_reg_mr_ex, ibv_dereg_mr \- register or deregister a memory region (MR)
7 .SH "SYNOPSIS"
8 .nf
9 .B #include <infiniband/verbs.h>
10 .sp
11 .BI "struct ibv_mr *ibv_reg_mr(struct ibv_pd " "*pd" ", void " "*addr" ,
12 .BI " size_t " "length" ", int " "access" );
13 .sp
14 .BI "struct ibv_mr *ibv_reg_mr_iova(struct ibv_pd " "*pd" ", void " "*addr" ,
15 .BI " size_t " "length" ", uint64_t " "hca_va" ,
16 .BI " int " "access" );
17 .sp
18 .BI "struct ibv_mr *ibv_reg_dmabuf_mr(struct ibv_pd " "*pd" ", uint64_t " "offset" ,
19 .BI " size_t " "length" ", uint64_t " "iova" ,
20 .BI " int " "fd" ", int " "access" );
21 .sp
22 .BI "struct ibv_mr *ibv_reg_mr_ex(struct ibv_pd " "*pd" ", struct ibv_mr_init_attr "*mr_init_attr" );
23 .sp
24 .BI "int ibv_dereg_mr(struct ibv_mr " "*mr" );
25 .fi
26 .SH "DESCRIPTION"
27 .B ibv_reg_mr()
28 registers a memory region (MR) associated with the protection domain
29 .I pd\fR.
30 The MR's starting address is
31 .I addr
32 and its size is
33 .I length\fR.
34 The argument
35 .I access
36 describes the desired memory protection attributes; it is either 0 or the bitwise OR of one or more of the following flags:
37 .PP
38 .TP
39 .B IBV_ACCESS_LOCAL_WRITE \fR
40 Enable Local Write Access
41 .TP
42 .B IBV_ACCESS_REMOTE_WRITE \fR
43 Enable Remote Write Access
44 .TP
45 .B IBV_ACCESS_REMOTE_READ\fR
46 Enable Remote Read Access
47 .TP
48 .B IBV_ACCESS_REMOTE_ATOMIC\fR
49 Enable Remote Atomic Operation Access (if supported)
50 .TP
51 .B IBV_ACCESS_FLUSH_GLOBAL\fR
52 Enable Remote Flush Operation with global visibility placement type (if supported)
53 .TP
54 .B IBV_ACCESS_FLUSH_PERSISTENT\fR
55 Enable Remote Flush Operation with persistence placement type (if supported)
56 .TP
57 .B IBV_ACCESS_MW_BIND\fR
58 Enable Memory Window Binding
59 .TP
60 .B IBV_ACCESS_ZERO_BASED\fR
61 Use byte offset from beginning of MR to access this MR, instead of a pointer address
62 .TP
63 .B IBV_ACCESS_ON_DEMAND\fR
64 Create an on-demand paging MR
65 .TP
66 .B IBV_ACCESS_HUGETLB\fR
67 Huge pages are guaranteed to be used for this MR, applicable with IBV_ACCESS_ON_DEMAND in explicit mode only
68 .TP
69 .B IBV_ACCESS_RELAXED_ORDERING\fR
70 This setting allows the NIC to relax the order that data is transferred between the
71 network and the target memory region. Relaxed ordering allows network initiated
72 writes (such as incoming message send or RDMA write operations) to reach memory
73 in an arbitrary order. This can improve the performance of some applications.
74 However, relaxed ordering has the following impact: RDMA write-after-write message
75 order is no longer guaranteed. (Send messages will still match posted receive buffers
76 in order.) Back-to-back network writes that target the same memory region
77 leave the region in an unknown state. Relaxed ordering does not change completion
78 semantics, such as data visibility. That is, a completion still ensures that all
79 data is visible, including data from prior transfers. Relaxed ordered operations
80 will also not bypass atomic operations.
81 .PP
82 If
83 .B IBV_ACCESS_REMOTE_WRITE
84 or
85 .B IBV_ACCESS_REMOTE_ATOMIC
86 is set, then
87 .B IBV_ACCESS_LOCAL_WRITE
88 must be set too.
89 .PP
90 Local read access is always enabled for the MR.
91 .PP
92 To create an implicit ODP MR, IBV_ACCESS_ON_DEMAND should be set, addr should be 0 and length should be SIZE_MAX.
93 .PP
94 If
95 .B IBV_ACCESS_HUGETLB
96 is set, then application awares that for this MR all pages are huge and must promise it will never do anything to break huge pages.
97 .PP
98 .B ibv_reg_mr_iova()
99 ibv_reg_mr_iova is the same as the normal reg_mr, except that the user is
100 allowed to specify the virtual base address of the MR when accessed through
101 a lkey or rkey. The offset in the memory region is computed as 'addr +
102 (iova - hca_va)'. Specifying 0 for hca_va has the same effect as
103 IBV_ACCESS_ZERO_BASED.
104 .PP
105 .B ibv_reg_dmabuf_mr()
106 registers a dma-buf based memory region (MR) associated with the protection domain
107 .I pd\fR.
108 The MR starts at
109 .I offset
110 of the dma-buf and its size is
111 .I length\fR.
112 The dma-buf is identified by the file descriptor
113 .I fd\fR.
114 The argument
115 .I iova
116 specifies the virtual base address of the MR when accessed through a lkey or rkey.
117 It must have the same page offset as
118 .I offset\fR.
119 The argument
120 .I access
121 describes the desired memory protection attributes; it is similar to the ibv_reg_mr case except that only the following flags are supported:
122 .B IBV_ACCESS_LOCAL_WRITE, IBV_ACCESS_REMOTE_WRITE, IBV_ACCESS_REMOTE_READ, IBV_ACCESS_REMOTE_ATOMIC, IBV_ACCESS_RELAXED_ORDERING.
123 .PP
124 .B ibv_reg_mr_ex()
125 ibv_reg_mr_ex is a an API that enables all the variants of the other ibv_reg_mr_xxx() that desecibed in that man page.
126 It has the
127 .I mr_init_attr->comp_mask
128 field to let application mark which fields are applicable.
129 In addition, it includes the
130 .I mr_init_attr->dmah
131 which can be used to include an ibv_dmah object that will be used for that MR.
132 The other fields on the input pointer have the same meaning as of the fields that described in that man page for the other verbs.
133 .PP
134 .B ibv_dereg_mr()
135 deregisters the MR
136 .I mr\fR.
137 .SH "RETURN VALUE"
138 .B ibv_reg_mr() / ibv_reg_mr_iova() / ibv_reg_dmabuf_mr() / ibv_reg_mr_ex()
139 returns a pointer to the registered MR, or NULL if the request fails.
140 The local key (\fBL_Key\fR) field
141 .B lkey
142 is used as the lkey field of struct ibv_sge when posting buffers with
143 ibv_post_* verbs, and the the remote key (\fBR_Key\fR)
144 field
145 .B rkey
146 is used by remote processes to perform Atomic and RDMA operations. The remote process places this
147 .B rkey
148 as the rkey field of struct ibv_send_wr passed to the ibv_post_send function.
149 .PP
150 .B ibv_dereg_mr()
151 returns 0 on success, or the value of errno on failure (which indicates the failure reason).
152 .SH "NOTES"
153 .B ibv_dereg_mr()
154 fails if any memory window is still bound to this MR.
155 .B ibv_dereg_mr_ex()
156 One among mr_init_attr->fd and mr_init_attr->addr is required, both can't come together.
157 .SH "SEE ALSO"
158 .BR ibv_alloc_pd (3),
159 .BR ibv_post_send (3),
160 .BR ibv_post_recv (3),
161 .BR ibv_post_srq_recv (3)
162 .SH "AUTHORS"
163 .TP
164 Dotan Barak <[email protected]>