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

Karthik Gopalakrishnan gopalakk at cse.ohio-state.edu
Sun Aug 30 19:38:10 PDT 2009


Hi Jack.

On Sun, Aug 30, 2009 at 11:45 AM, Jack Morgenstein <jackm at dev.mellanox.co.il
> wrote:

> On Wednesday 26 August 2009 02:03, MANIKANTAN KALAIYA wrote:
> > 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.
>
> libibverbs reads the number of devices ONCE, at calling process startup (as
> part of its initialization).
> To get a new device count, you need to restart your program.
>
Does this mean PCI Hotplug is not supported for Infiniband Adapters?


>
> - Jack
>
> > 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.
> >
> _______________________________________________
> general mailing list
> general at lists.openfabrics.org
> http://lists.openfabrics.org/cgi-bin/mailman/listinfo/general
>
> To unsubscribe, please visit
> http://openib.org/mailman/listinfo/openib-general
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openfabrics.org/pipermail/general/attachments/20090830/b60659ba/attachment.html>


More information about the general mailing list