| 1 | --- |
| 2 | date: 2018-6-1 |
| 3 | footer: libibverbs |
| 4 | header: "Libibverbs Programmer's Manual" |
| 5 | layout: page |
| 6 | license: 'Licensed under the OpenIB.org BSD license (FreeBSD Variant) - See COPYING.md' |
| 7 | section: 3 |
| 8 | title: ibv_alloc_null_mr |
| 9 | --- |
| 10 | |
| 11 | # NAME |
| 12 | |
| 13 | ibv_alloc_null_mr - allocate a null memory region (MR) |
| 14 | |
| 15 | # SYNOPSIS |
| 16 | |
| 17 | ```c |
| 18 | #include <infiniband/verbs.h> |
| 19 | |
| 20 | struct ibv_mr *ibv_alloc_null_mr(struct ibv_pd *pd); |
| 21 | ``` |
| 22 | |
| 23 | |
| 24 | # DESCRIPTION |
| 25 | |
| 26 | **ibv_alloc_null_mr()** allocates a null memory region (MR) that is associated with the protection |
| 27 | domain *pd*. |
| 28 | |
| 29 | A null MR discards all data written to it, and always returns 0 on |
| 30 | read. It has the maximum length and only the lkey is valid, the MR is not |
| 31 | exposed as an rkey. |
| 32 | |
| 33 | A device should implement the null MR in a way that bypasses PCI |
| 34 | transfers, internally discarding or sourcing 0 data. This provides a |
| 35 | way to avoid PCI bus transfers by using a scatter/gather list in |
| 36 | commands if applications do not intend to access the data, or need |
| 37 | data to be 0 filled. |
| 38 | |
| 39 | Specifically upon **ibv_post_send()** the device skips PCI read cycles and |
| 40 | upon **ibv_post_recv()** the device skips PCI write cycles which finally |
| 41 | improves performance. |
| 42 | |
| 43 | **ibv_dereg_mr()** deregisters the MR. |
| 44 | The use of ibv_rereg_mr() or ibv_bind_mw() |
| 45 | with this MR is invalid. |
| 46 | |
| 47 | # RETURN VALUE |
| 48 | |
| 49 | **ibv_alloc_null_mr()** returns a pointer to the allocated MR, or NULL if the request fails. |
| 50 | |
| 51 | # SEE ALSO |
| 52 | |
| 53 | **ibv_reg_mr**(3), |
| 54 | **ibv_dereg_mr**(3), |
| 55 | |
| 56 | # AUTHOR |
| 57 | |
| 58 | Yonatan Cohen <[email protected]> |
| 59 |