struct ibv_device** ibv_get_device_list(int *num_devices);
ibv_fork_init() should be called before calling any other function in libibverbs.
ibv_get_device_list() returns a NULL-terminated array of RDMA devices currently available. The array should be released with ibv_free_device_list().
The array entries shouldn't be accessed directly. Instead, they should be used with the following service verbs: ibv_get_device_name(), ibv_get_device_guid() and ibv_open_device().
|num_devices||out||(optional) If not NULL, it is set to the number of devices returned in the array|
ibv_get_device_list() returns the array of available RDMA devices on success, returns NULL and sets errno if the request fails. If no devices are found, then num_devices is set to 0, and non-NULL is returned.
Possible errno values are:
- EPERM - Permission denied.
- ENOMEM - Insufficient memory to complete the operation.
- ENOSYS - No kernel support for RDMA.
Get device list without a parameter:
struct ibv_device **dev_list; dev_list = ibv_get_device_list(NULL); if (!dev_list) exit(1);
Get device list with a parameter:
struct ibv_device **dev_list; int num_devices; dev_list = ibv_get_device_list(&num_devices); if (!dev_list) exit(1);
I called ibv_get_device_list() and it returned NULL, what does it mean?
This is a basic verb that shouldn't fail, check if the module ib_uverbs is loaded.
I called ibv_get_device_list() and it didn't find any RDMA device at all (empty list), what does it mean?
The driver couldn't find any RDMA device.
- Check with lspci, if you have any RDMA device in your machine
- Check if the low-level driver for your RDMA device is loaded, using lsmod
- Check dmesg/var/log/messages for errors
Tell us what do you think.