IBV_REREG_MR(3)

🌸 NAME 🌸

ibv_rereg_mr β€” re-register a memory region (MR). This is from the Libibverbs Programmer’s Manual, bestie, and yes, ibv_rereg_mr(3) is literally the glow-up page for MRs πŸ’…

✨ SYNOPSIS ✨

#include <infiniband/verbs.h>

int ibv_rereg_mr(struct ibv_mr *mr,
                 int flags,
                 struct ibv_pd *pd,
                 void *addr,
                 size_t length,
                 int access);

πŸ’… DESCRIPTION πŸ’…

okay so ibv_rereg_mr() modifies the attributes of an existing memory region (MR), mr. Conceptually, this call performs the functions deregister memory region followed by register memory region β€” it’s giving makeover arc ✨ Where possible, resources are reused instead of deallocated and reallocated, which is highkey iconic.

flags is a bit-mask used to indicate which of the following properties of the memory region are being modified. flags should be a combination (bit field) of:

  • IBV_REREG_MR_CHANGE_TRANSLATION β€” Change translation (location and length)
  • IBV_REREG_MR_CHANGE_PD β€” Change protection domain
  • IBV_REREG_MR_CHANGE_ACCESS β€” Change access flags

When IBV_REREG_MR_CHANGE_PD is used, pd represents the new PD this MR should be registered to.

When IBV_REREG_MR_CHANGE_TRANSLATION is used, addr represents the virtual address (user-space pointer) of the new MR, while length represents its length.

The access and other flags are represented in the field access. This field describes the desired memory protection attributes; it is either 0 or the bitwise OR of one or more of ibv_access_flags.

🫢 RETURN VALUE 🫢

ibv_rereg_mr() returns 0 on success, otherwise an error has occurred, and enum ibv_rereg_mr_err_code represents the error as of below. vibe check time πŸ‘‘

  • IBV_REREG_MR_ERR_INPUT β€” Old MR is valid, an input error was detected by libibverbs.
  • IBV_REREG_MR_ERR_DONT_FORK_NEW β€” Old MR is valid, failed via don’t fork on new address range.
  • IBV_REREG_MR_ERR_DO_FORK_OLD β€” New MR is valid, failed via do fork on old address range.
  • IBV_REREG_MR_ERR_CMD β€” MR shouldn’t be used, command error.
  • IBV_REREG_MR_ERR_CMD_AND_DO_FORK_NEW β€” MR shouldn’t be used, command error, invalid fork state on new address range.

😭 NOTES 😭

Even on a failure, the user still needs to call ibv_dereg_mr on this MR. not me forgetting the cleanup bestie 😭

πŸ‘€ SEE ALSO πŸ‘€

ibv_dereg_mr(3), ibv_reg_mr(3) β€” go read these too, iykyk πŸ¦‹

πŸŽ€ AUTHORS πŸŽ€

Matan Barak <matanb@mellanox.com>, Yishai Hadas <yishaih@mellanox.com>


xoxo, source/version + date: libibverbs, 2016-03-13 β€” mwah πŸ’‹βœ¨

πŸ“¦ where this page comes from