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>
This commit is contained in:
committed by
Roland Dreier
parent
976d167615
commit
53ab1c6498
@ -1284,6 +1284,7 @@ static int setup_ctxt(struct qib_pportdata *ppd, int ctxt,
|
||||
strlcpy(rcd->comm, current->comm, sizeof(rcd->comm));
|
||||
ctxt_fp(fp) = rcd;
|
||||
qib_stats.sps_ctxts++;
|
||||
dd->freectxts++;
|
||||
ret = 0;
|
||||
goto bail;
|
||||
|
||||
@ -1792,6 +1793,7 @@ static int qib_close(struct inode *in, struct file *fp)
|
||||
if (dd->pageshadow)
|
||||
unlock_expected_tids(rcd);
|
||||
qib_stats.sps_ctxts--;
|
||||
dd->freectxts--;
|
||||
}
|
||||
|
||||
mutex_unlock(&qib_mutex);
|
||||
|
Reference in New Issue
Block a user