---
name: "ibv_rereg_mr"
section: "3"
platform: "linux"
package: "rdma-core"
version: "65.0-1"
release: "Arch Linux 2026-11-01"
platforms: ["linux", "freebsd"]
url: "https://new.carta.tech/ibv_rereg_mr"
---

# ibv\_rereg\_mr(3)

re-register a memory region (MR)

## NAME

ibv\_rereg\_mr - re-register a memory region (MR)

## 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

**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. Where possible, resources are reused instead of deallocated and reallocated.

*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, *enum ibv\_rereg\_mr\_err\_code* represents the error as of below.

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.

## SEE ALSO

[**ibv\_dereg\_mr**(3)](/ibv_dereg_mr/3.md), [**ibv\_reg\_mr**(3)](/ibv_reg_mr/3.md)

## AUTHORS

Matan Barak ⟨matanb@mellanox.com⟩\\c , Yishai Hadas ⟨yishaih@mellanox.com⟩\\c
