| 1 | --- |
| 2 | date: 2020-5-3 |
| 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_import_mr ibv_unimport_mr |
| 9 | --- |
| 10 | |
| 11 | # NAME |
| 12 | |
| 13 | ibv_import_mr - import an MR from a given ibv_pd |
| 14 | |
| 15 | ibv_unimport_mr - unimport an MR |
| 16 | |
| 17 | # SYNOPSIS |
| 18 | |
| 19 | ```c |
| 20 | #include <infiniband/verbs.h> |
| 21 | |
| 22 | struct ibv_mr *ibv_import_mr(struct ibv_pd *pd, uint32_t mr_handle); |
| 23 | void ibv_unimport_mr(struct ibv_mr *mr) |
| 24 | |
| 25 | ``` |
| 26 | |
| 27 | |
| 28 | # DESCRIPTION |
| 29 | |
| 30 | **ibv_import_mr()** returns a Memory region (MR) that is associated with the given |
| 31 | *mr_handle* in the RDMA context that assosicated with the given *pd*. |
| 32 | |
| 33 | The input *mr_handle* value must be a valid kernel handle for an MR object in the assosicated RDMA context. |
| 34 | It can be achieved from the original MR by getting its ibv_mr->handle member value. |
| 35 | |
| 36 | **ibv_unimport_mr()** un import the MR. |
| 37 | Once the MR usage has been ended ibv_dereg_mr() or ibv_unimport_mr() should be called. |
| 38 | The first one will go to the kernel to destroy the object once the second one way cleanup what |
| 39 | ever is needed/opposite of the import without calling the kernel. |
| 40 | |
| 41 | This is the responsibility of the application to coordinate between all ibv_context(s) that use this MR. |
| 42 | Once destroy is done no other process can touch the object except for unimport. All users of the context must |
| 43 | collaborate to ensure this. |
| 44 | |
| 45 | # RETURN VALUE |
| 46 | |
| 47 | **ibv_import_mr()** returns a pointer to the allocated MR, or NULL if the request fails. |
| 48 | |
| 49 | # NOTES |
| 50 | |
| 51 | The *addr* field in the imported MR is not applicable, NULL value is expected. |
| 52 | |
| 53 | # SEE ALSO |
| 54 | |
| 55 | **ibv_reg_mr**(3), |
| 56 | **ibv_reg_dm_mr**(3), |
| 57 | **ibv_reg_mr_iova**(3), |
| 58 | **ibv_reg_mr_iova2**(3), |
| 59 | **ibv_dereg_mr**(3), |
| 60 | |
| 61 | # AUTHOR |
| 62 | |
| 63 | Yishai Hadas <[email protected]> |
| 64 |