Registers or releases a memory region (MR).
#include <rdma/verbs.h> struct ibv_mr *ibv_reg_mr(struct ibv_pd *pd, void *addr,size_t length,enum ibv_access_flags access); int ibv_dereg_mr(struct ibv_mr *mr);
The ibv_reg_mr() function registers a memory region (MR) associated with the protection domain pd. The MR's starting address is addr and its size is length. The parameter access describes the required memory protection attributes that is either 0 or the bitwise OR of one or more of the following flags:
If IBV_ACCESS_REMOTE_WRITE, or IBV_ACCESS_REMOTE_ATOMIC is set, then IBV_ACCESS_LOCAL_WRITE must be set too.
The ibv_dereg_mr() function release the MR mr.
pd | Specifies the protection domain, struct ibv_pd from ibv_alloc_pd. |
addr | Specifies the memory base address. |
length | Specifies the length of memory region in bytes. |
access | Specifies the access flags. |
The ibv_reg_mr() function returns a pointer to the registered MR on success, and NULL if the request fails. The local key (L_Key) field lkey is used as the lkey field of struct ibv_sge when posting buffers with ibv_post_* verbs, and the remote key (R_Key) field rkey is used by remote processes to perform RDMA operations. The remote process places this rkey as the rkey field of struct ibv_send_wr passed to the ibv_post_send function.
The ibv_dereg_mr() function returns 0 on success, and the value of errno on failure that indicates the failure reason.