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

# ibv\_alloc\_null\_mr(3)

allocate a null memory region (MR)

## NAME

ibv\_alloc\_null\_mr - allocate a null memory region (MR)

## SYNOPSIS

-

  ```
  #include <infiniband/verbs.h>
  struct ibv_mr *ibv_alloc_null_mr(struct ibv_pd *pd);
  ```

## DESCRIPTION

**ibv\_alloc\_null\_mr()** allocates a null memory region (MR) that is associated with the protection domain *pd*.

A null MR discards all data written to it, and always returns 0 on read. It has the maximum length and only the lkey is valid, the MR is not exposed as an rkey.

A device should implement the null MR in a way that bypasses PCI transfers, internally discarding or sourcing 0 data. This provides a way to avoid PCI bus transfers by using a scatter/gather list in commands if applications do not intend to access the data, or need data to be 0 filled.

Specifically upon **ibv\_post\_send()** the device skips PCI read cycles and upon **ibv\_post\_recv()** the device skips PCI write cycles which finally improves performance.

**ibv\_dereg\_mr()** deregisters the MR. The use of ibv\_rereg\_mr() or ibv\_bind\_mw() with this MR is invalid.

## RETURN VALUE

**ibv\_alloc\_null\_mr()** returns a pointer to the allocated MR, or NULL if the request fails, and errno is set to indicate the reason.

## SEE ALSO

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

## AUTHOR

Yonatan Cohen ⟨yonatanc@mellanox.com⟩\\c
