]> git.karo-electronics.de Git - karo-tx-linux.git/commit
IB/qib: Correct nfreectxts for multiple HCAs
authorMike Marciniszyn <mike.marciniszyn@qlogic.com>
Wed, 21 Sep 2011 16:17:36 +0000 (12:17 -0400)
committerRoland Dreier <roland@purestorage.com>
Wed, 28 Sep 2011 16:15:58 +0000 (09:15 -0700)
commitb712ba6ac0ff9ce48320ba5f7d49082b2bfbb98b
tree6bae08840bec413b2ad3874c94c033749ca85596
parentfcb8ce5cfe30ca9ca5c9a79cdfe26d1993e65e0c
IB/qib: Correct nfreectxts for multiple HCAs

The code that was recently introduced to report the number
of free contexts is flawed for multiple HCAs:

       /* Return the number of free user ports (contexts) available. */
       return scnprintf(buf, PAGE_SIZE, "%u\n", dd->cfgctxts -
                dd->first_user_ctxt - (u32)qib_stats.sps_ctxts);

The qib_stats is global to the module, not per HCA, so the code is broken
for multiple HCAs.

This patch adds a qib_devdata field, freectxts, that reflects the free
contexts for this HCA.

Signed-off-by: Mike Marciniszyn <mike.marciniszyn@qlogic.com>
Reviewed-by: Ram Vepa <ram.vepa@qlogic.com>
Signed-off-by: Roland Dreier <roland@purestorage.com>
drivers/infiniband/hw/qib/qib.h
drivers/infiniband/hw/qib/qib_file_ops.c
drivers/infiniband/hw/qib/qib_init.c
drivers/infiniband/hw/qib/qib_sysfs.c