Linux repositories inspector

ibv_get_device_list(3)

libibverbs
2006-10-31
Aliases: ibv_free_device_list(3), ibv_free_device_list(3), ibv_free_device_list(3)

libibverbs-dev

Development files for the libibverbs library

rdma-core-devel

RDMA core development libraries and headers

libibverbs-devel

Development files for the libibverbs library

NAME

ibv_get_device_list, ibv_free_device_list - get and release list of available RDMA devices

SYNOPSIS

C]
#include <infiniband/verbs.h>

struct ibv_device **ibv_get_device_list(int *num_devices);
void ibv_free_device_list(struct ibv_device **list);
R]

DESCRIPTION

B]ibv_get_device_list()R] returns a NULL-terminated array of RDMA devices currently available. The argument I]num_devicesR] is optional; if not NULL, it is set to the number of devices returned in the array.
B]ibv_free_device_list()R] frees the array of devices I]listR] returned by B]ibv_get_device_list()R].

RETURN VALUE

B]ibv_get_device_list()R] returns the array of available RDMA devices, or sets I]errnoR] and returns NULL if the request fails. If no devices are found then I]num_devicesR] is set to 0, and non-NULL is returned.
B]ibv_free_device_list()R] returns no value.

ERRORS

B]EPERMR]
Permission denied.
B]ENOSYSR]
No kernel support for RDMA.
B]ENOMEMR]
Insufficient memory to complete the operation.

NOTES

Client code should open all the devices it intends to use with B]ibv_open_device()R] before calling B]ibv_free_device_list()R]. Once it frees the array with B]ibv_free_device_list()R], it will be able to use only the open devices; pointers to unopened devices will no longer be valid.
Setting the environment variable B]IBV_SHOW_WARNINGSR] will cause warnings to be emitted to stderr if a kernel verbs device is discovered, but no corresponding userspace driver can be found for it.

STATIC LINKING

If B]libibverbsR] is statically linked to the application then all provider drivers must also be statically linked. The library will not load dynamic providers when static linking is used.
To link the providers set the B]RDMA_STATIC_PROVIDERSR] define to the comma separated list of desired providers when compiling the application. The special keyword ‘all’ will statically link all supported B]libibverbsR] providers.
This is intended to be used along with B]pkg-config(1)R] to setup the proper flags for B]libibverbsR] linking.
If this is not done then B]ibv_get_device_listR] will always return an empty list.
Using only dynamic linking for B]libibverbsR] applications is strongly recommended.

SEE ALSO

B]ibv_fork_initR](3), B]ibv_get_device_guidR](3), B]ibv_get_device_nameR](3), B]ibv_open_deviceR](3)

AUTHOR

Dotan Barak <>
⇧ Top