[ofa-general] Number of devices returned by ibv_get_device_list()

MANIKANTAN KALAIYA kalaiya.1 at buckeyemail.osu.edu
Tue Aug 25 16:03:41 PDT 2009


Resending to the mailing list...

We have Ofed1.3.1 installed, one of the sub packages is libibverbs version 1.1.1. We have a small program that lists the number of IB cards available in the system through ibv_get_device_list(). See below for the sample code.

The system has two IB cards, the value returned by ibv_get_device_list() in 'num_devices' is two, as expected.

However, when we disable one of the cards using the modprobe command, the program continues to return two cards present (monitoring is continuous in a while loop).
Killing and restarting the sample test process results in reporting correct number of IB cards available (returns one after it is restarted). One of the prior versions was known to report the correct number of IB cards without requiring to restart the program.

We would like to determine the number of cards present without having to go through a restart. Any inputs on this behavior is appreciated.

modprobe command - "sudo modprobe -r ib_mthca"

Test program:
=================================================
#include <stdio.h>
#include <infiniband/verbs.h>

int main(int argc, char **argv)
{
    int ret, num_devices;
    struct ibv_device      **dev_list;

    while(1) {

        dev_list = ibv_get_device_list(&num_devices);

        if (num_devices != 0) {
            printf("IB ADAPTER AVAILABLE:%d\n", num_devices);
        }
        else {
            printf("IB ADAPTER UNAVAILABLE\n");
        }
        sleep(2);
        ibv_free_device_list(dev_list);
    }

    return(0);
}
=================================================

Thanks,
Mani.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openfabrics.org/pipermail/general/attachments/20090825/e8ccba17/attachment.html>


More information about the general mailing list