Home

ibvgetdevicelist

ibv_get_device_list is a function in the libibverbs library that is part of the InfiniBand Verbs API. It enumerates InfiniBand devices present on the local host and returns a list of pointers to ibv_device structures.

Signature and behavior: struct ibv_device **ibv_get_device_list(int *num_devices); On success, it returns a non-null pointer to an

Usage and memory management: The caller iterates over the returned list from 0 to num_devices-1 and can

Return value considerations: A NULL return value with num_devices > 0 generally indicates an error; a NULL

See also: The function is used in conjunction with other libibverbs functions such as ibv_free_device_list and

array
of
ibv_device
pointers
and
writes
the
number
of
devices
to
*num_devices.
If
there
are
no
devices,
the
function
returns
NULL
and
*num_devices
is
set
to
0.
On
error,
it
returns
NULL
and
errno
is
set
to
indicate
the
failure.
obtain
device
information
using
helpers
such
as
ibv_get_device_name(dev_list[i]).
When
finished,
the
list
must
be
freed
with
ibv_free_device_list(dev_list).
The
memory
management
contract
requires
that
the
caller
free
the
allocated
list
to
avoid
leaks.
return
value
with
num_devices
==
0
indicates
that
no
InfiniBand
devices
were
found.
In
both
error
and
no-device
cases,
errno
or
the
application
logic
should
guide
handling.
ibv_get_device_name
to
inspect
and
interact
with
InfiniBand
devices.
It
is
part
of
the
broader
system
for
querying
and
managing
RDMA
hardware
on
a
host.