IB/qib: Correct nfreectxts for multiple HCAs
authorMike Marciniszyn <mike.marciniszyn@qlogic.com>
Thu, 6 Oct 2011 16:33:35 +0000 (09:33 -0700)
committerRoland Dreier <roland@purestorage.com>
Thu, 6 Oct 2011 16:33:35 +0000 (09:33 -0700)
commit53ab1c6498371723c31b18400fab10a902a15a63
treedf710c8c65b897c6738263f976da825d00e406af
parent976d167615b64e14bc1491ca51d424e2ba9a5e84
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