ibv_get_device_list, ibv_free_device_list

Obtains and releases the list of available RDMA devices.

Syntax

#include <rdma/verbs.h>
struct ibv_device **ibv_get_device_list(int *num_devices);
void ibv_free_device_list(struct ibv_device **list);

Description

The ibv_get_device_list() function returns a NULL-terminated array of RDMA devices that are available. The argument num_devices is optional and if it is NULL, it is set to the number of devices returned in the array.

The ibv_free_device_list() function frees the array of devices list that is returned by the ibv_get_device_list() function.

Note: The client code must open all the devices it intends to use with the ibv_open_device() operation before running the ibv_free_device_list() function. When the ibv_free_device_list() function frees the array, the system can use the open devices, and the pointers to unopened devices is no longer valid.

Errors

Error Descriptor
EPERM Permission denied.
ENOSYS No kernel support for RDMA.
ENOMEM Insufficient memory to complete the operation.

Output Parameters

Item Description
num_devices (Optional) If not null, the number of devices returned in the array is stored in this parameter.

Return Value

The ibv_get_device_list() function returns the array of available RDMA devices, or NULL if the request fails. If no devices are found then num_devices is set to 0, and a non-NULL is returned.

The ibv_free_device_list() function returns no value.