| 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_pd, ibv_unimport_pd |
| 9 | --- |
| 10 | |
| 11 | # NAME |
| 12 | |
| 13 | ibv_import_pd - import a PD from a given ibv_context |
| 14 | |
| 15 | ibv_unimport_pd - unimport a PD |
| 16 | |
| 17 | # SYNOPSIS |
| 18 | |
| 19 | ```c |
| 20 | #include <infiniband/verbs.h> |
| 21 | |
| 22 | struct ibv_pd *ibv_import_pd(struct ibv_context *context, uint32_t pd_handle); |
| 23 | void ibv_unimport_pd(struct ibv_pd *pd) |
| 24 | |
| 25 | ``` |
| 26 | |
| 27 | |
| 28 | # DESCRIPTION |
| 29 | |
| 30 | **ibv_import_pd()** returns a protection domain (PD) that is associated with the given |
| 31 | *pd_handle* in the given *context*. |
| 32 | |
| 33 | The input *pd_handle* value must be a valid kernel handle for a PD object in the given *context*. |
| 34 | It can be achieved from the original PD by getting its ibv_pd->handle member value. |
| 35 | |
| 36 | The returned *ibv_pd* can be used in all verbs that get a protection domain. |
| 37 | |
| 38 | **ibv_unimport_pd()** unimport the PD. |
| 39 | Once the PD usage has been ended ibv_dealloc_pd() or ibv_unimport_pd() should be called. |
| 40 | The first one will go to the kernel to destroy the object once the second one way cleanup what |
| 41 | ever is needed/opposite of the import without calling the kernel. |
| 42 | |
| 43 | This is the responsibility of the application to coordinate between all ibv_context(s) that use this PD. |
| 44 | Once destroy is done no other process can touch the object except for unimport. All users of the context must |
| 45 | collaborate to ensure this. |
| 46 | |
| 47 | # RETURN VALUE |
| 48 | |
| 49 | **ibv_import_pd()** returns a pointer to the allocated PD, or NULL if the request fails. |
| 50 | |
| 51 | # SEE ALSO |
| 52 | |
| 53 | **ibv_alloc_pd**(3), |
| 54 | **ibv_dealloc_pd**(3), |
| 55 | |
| 56 | # AUTHOR |
| 57 | |
| 58 | Yishai Hadas <[email protected]> |
| 59 |