---
name: "ibv_rereg_mr"
section: "3"
platform: "freebsd"
package: "base"
version: "16.0-CURRENT-20261027-61c70dc16a79"
release: "FreeBSD 16.0-CURRENT (2026-10-27)"
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.

- **ibv\_rereg\_mr()**

  ## RETURN VALUE

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\_reg\_mr**(3)](/ibv_reg_mr/3.md), [**ibv\_dereg\_mr**(3)](/ibv_dereg_mr/3.md),

## AUTHORS

- Matan Barak \<matanb@mellanox.com\>

  - Yishai Hadas \<yishaih@mellanox.com\>
