blob: 77237716b47c0efd44a2204a42ee967306083e14 [file] [log] [blame]
.\" -*- nroff -*-
.TH IBV_REG_MR 3 2006-10-31 libibverbs "Libibverbs Programmer's Manual"
ibv_reg_mr, ibv_dereg_mr \- register or deregister a memory region (MR)
.B #include <infiniband/verbs.h>
.BI "struct ibv_mr *ibv_reg_mr(struct ibv_pd " "*pd" ", void " "*addr" ,
.BI " size_t " "length" ", int " "access" );
.BI "int ibv_dereg_mr(struct ibv_mr " "*mr" );
.B ibv_reg_mr()
registers a memory region (MR) associated with the protection domain
.I pd\fR.
The MR's starting address is
.I addr
and its size is
.I length\fR.
The argument
.I access
describes the desired memory protection attributes; it is either 0 or the bitwise OR of one or more of the following flags:
.B IBV_ACCESS_LOCAL_WRITE \fR Enable Local Write Access
.B IBV_ACCESS_REMOTE_WRITE \fR Enable Remote Write Access
.B IBV_ACCESS_REMOTE_READ\fR Enable Remote Read Access
.B IBV_ACCESS_REMOTE_ATOMIC\fR Enable Remote Atomic Operation Access (if supported)
.B IBV_ACCESS_MW_BIND\fR Enable Memory Window Binding
is set, then
must be set too.
Local read access is always enabled for the MR.
.B ibv_dereg_mr()
deregisters the MR
.I mr\fR.
.B ibv_reg_mr()
returns a pointer to the registered MR, or NULL if the request fails.
The local key (\fBL_Key\fR) field
.B lkey
is used as the lkey field of struct ibv_sge when posting buffers with
ibv_post_* verbs, and the the remote key (\fBR_Key\fR)
.B rkey
is used by remote processes to perform Atomic and RDMA operations. The remote process places this
.B rkey
as the rkey field of struct ibv_send_wr passed to the ibv_post_send function.
.B ibv_dereg_mr()
returns 0 on success, or the value of errno on failure (which indicates the failure reason).
.B ibv_dereg_mr()
fails if any memory window is still bound to this MR.
.BR ibv_alloc_pd (3),
.BR ibv_post_send (3),
.BR ibv_post_recv (3),
.BR ibv_post_srq_recv (3)
Dotan Barak <>