1IBV_REG_MR(3) Libibverbs Programmer's Manual IBV_REG_MR(3)
2
3
4
6 ibv_reg_mr, ibv_reg_mr_iova, ibv_dereg_mr - register or deregister a
7 memory region (MR)
8
10 #include <infiniband/verbs.h>
11
12 struct ibv_mr *ibv_reg_mr(struct ibv_pd *pd, void *addr,
13 size_t length, int access);
14
15 struct ibv_mr *ibv_reg_mr_iova(struct ibv_pd *pd, void *addr,
16 size_t length, uint64_t hca_va,
17 int access);
18
19 int ibv_dereg_mr(struct ibv_mr *mr);
20
22 ibv_reg_mr() registers a memory region (MR) associated with the protec‐
23 tion domain pd. The MR's starting address is addr and its size is
24 length. The argument access describes the desired memory protection
25 attributes; it is either 0 or the bitwise OR of one or more of the fol‐
26 lowing flags:
27
28 IBV_ACCESS_LOCAL_WRITE Enable Local Write Access
29
30 IBV_ACCESS_REMOTE_WRITE Enable Remote Write Access
31
32 IBV_ACCESS_REMOTE_READ Enable Remote Read Access
33
34 IBV_ACCESS_REMOTE_ATOMIC Enable Remote Atomic Operation Access (if sup‐
35 ported)
36
37 IBV_ACCESS_MW_BIND Enable Memory Window Binding
38
39 IBV_ACCESS_ZERO_BASED Use byte offset from beginning of MR to access
40 this MR, instead of a pointer address
41
42 IBV_ACCESS_ON_DEMAND Create an on-demand paging MR
43
44 IBV_ACCESS_HUGETLB Huge pages are guaranteed to be used for this MR,
45 applicable with IBV_ACCESS_ON_DEMAND in explicit mode only
46
47 IBV_ACCESS_RELAXED_ORDERING Allow system to reorder accesses to the MR
48 to improve performance
49
50 If IBV_ACCESS_REMOTE_WRITE or IBV_ACCESS_REMOTE_ATOMIC is set, then
51 IBV_ACCESS_LOCAL_WRITE must be set too.
52
53 Local read access is always enabled for the MR.
54
55 To create an implicit ODP MR, IBV_ACCESS_ON_DEMAND should be set, addr
56 should be 0 and length should be SIZE_MAX.
57
58 If IBV_ACCESS_HUGETLB is set, then application awares that for this MR
59 all pages are huge and must promise it will never do anything to break
60 huge pages.
61
62 ibv_reg_mr_iova() ibv_reg_mr_iova is the same as the normal reg_mr,
63 except that the user is allowed to specify the virtual base address of
64 the MR when accessed through a lkey or rkey. The offset in the memory
65 region is computed as 'addr + (iova - hca_va)'. Specifying 0 for hca_va
66 has the same effect as IBV_ACCESS_ZERO_BASED.
67
68 ibv_dereg_mr() deregisters the MR mr.
69
71 ibv_reg_mr() / ibv_reg_mr_iova() returns a pointer to the registered
72 MR, or NULL if the request fails. The local key (L_Key) field lkey is
73 used as the lkey field of struct ibv_sge when posting buffers with
74 ibv_post_* verbs, and the the remote key (R_Key) field rkey is used by
75 remote processes to perform Atomic and RDMA operations. The remote
76 process places this rkey as the rkey field of struct ibv_send_wr passed
77 to the ibv_post_send function.
78
79 ibv_dereg_mr() returns 0 on success, or the value of errno on failure
80 (which indicates the failure reason).
81
83 ibv_dereg_mr() fails if any memory window is still bound to this MR.
84
86 ibv_alloc_pd(3), ibv_post_send(3), ibv_post_recv(3),
87 ibv_post_srq_recv(3)
88
90 Dotan Barak <dotanba@gmail.com>
91
92
93
94libibverbs 2006-10-31 IBV_REG_MR(3)