| 1 | --- |
| 2 | date: 2006-10-31 |
| 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_GET_DEVICE_LIST |
| 9 | --- |
| 10 | |
| 11 | # NAME |
| 12 | |
| 13 | ibv_get_device_list, ibv_free_device_list - get and release list of available |
| 14 | RDMA devices |
| 15 | |
| 16 | # SYNOPSIS |
| 17 | |
| 18 | ```c |
| 19 | #include <infiniband/verbs.h> |
| 20 | |
| 21 | struct ibv_device **ibv_get_device_list(int *num_devices); |
| 22 | |
| 23 | void ibv_free_device_list(struct ibv_device **list); |
| 24 | ``` |
| 25 | |
| 26 | # DESCRIPTION |
| 27 | |
| 28 | **ibv_get_device_list()** returns a NULL-terminated array of RDMA devices |
| 29 | currently available. The argument *num_devices* is optional; if not NULL, it |
| 30 | is set to the number of devices returned in the array. |
| 31 | |
| 32 | **ibv_free_device_list()** frees the array of devices *list* returned by |
| 33 | **ibv_get_device_list()**. |
| 34 | |
| 35 | # RETURN VALUE |
| 36 | |
| 37 | **ibv_get_device_list()** returns the array of available RDMA devices, or sets |
| 38 | *errno* and returns NULL if the request fails. If no devices are found then |
| 39 | *num_devices* is set to 0, and non-NULL is returned. |
| 40 | |
| 41 | **ibv_free_device_list()** returns no value. |
| 42 | |
| 43 | # ERRORS |
| 44 | |
| 45 | **EPERM** |
| 46 | : Permission denied. |
| 47 | |
| 48 | **ENOSYS** |
| 49 | : No kernel support for RDMA. |
| 50 | |
| 51 | **ENOMEM** |
| 52 | : Insufficient memory to complete the operation. |
| 53 | |
| 54 | |
| 55 | # NOTES |
| 56 | |
| 57 | Client code should open all the devices it intends to use with |
| 58 | **ibv_open_device()** before calling **ibv_free_device_list()**. Once it frees |
| 59 | the array with **ibv_free_device_list()**, it will be able to use only the |
| 60 | open devices; pointers to unopened devices will no longer be valid. |
| 61 | |
| 62 | Setting the environment variable **IBV_SHOW_WARNINGS** will cause warnings to |
| 63 | be emitted to stderr if a kernel verbs device is discovered, but no |
| 64 | corresponding userspace driver can be found for it. |
| 65 | |
| 66 | # STATIC LINKING |
| 67 | |
| 68 | If **libibverbs** is statically linked to the application then all provider |
| 69 | drivers must also be statically linked. The library will not load dynamic |
| 70 | providers when static linking is used. |
| 71 | |
| 72 | To link the providers set the **RDMA_STATIC_PROVIDERS** define to the comma |
| 73 | separated list of desired providers when compiling the application. The |
| 74 | special keyword 'all' will statically link all supported **libibverbs** |
| 75 | providers. |
| 76 | |
| 77 | This is intended to be used along with **pkg-config(1)** to setup the proper |
| 78 | flags for **libibverbs** linking. |
| 79 | |
| 80 | If this is not done then **ibv_get_device_list** will always return an empty |
| 81 | list. |
| 82 | |
| 83 | Using only dynamic linking for **libibverbs** applications is strongly |
| 84 | recommended. |
| 85 | |
| 86 | # SEE ALSO |
| 87 | |
| 88 | **ibv_fork_init**(3), |
| 89 | **ibv_get_device_guid**(3), |
| 90 | **ibv_get_device_name**(3), |
| 91 | **ibv_get_device_index**(3), |
| 92 | **ibv_open_device**(3) |
| 93 | |
| 94 | # AUTHOR |
| 95 | |
| 96 | Dotan Barak <[email protected]> |