[openib-general] Proposed device enumeration & async event APIs

Roland Dreier roland at topspin.com
Sun Sep 12 12:46:39 PDT 2004


    Fab> How do the above pci_xxx_drvdata functions avoid a malloc?
    Fab> Can we do something similar?  Either way, I think your
    Fab> proposed API will work fine.

The pci functions only support a single driver, so they can just use a
single void * driver_data member of the struct device.  Since IB
allows multiple consumers, the options are to have a table with a
static limit, or to dynamically allocate context for each consumer as
it gets used.  I really don't like having static limits so I chose the
second option.

The chances of a small kmalloc (with GFP_KERNEL) failing are pretty
small, and when such an allocation fails you're usually pretty screwed
anyway.

    Fab> Is it valid for a client to call the get function if it did
    Fab> not call the set function?  Does that just result in NULL
    Fab> being retuned?

Yes.

 - R.



More information about the general mailing list