aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/infiniband
diff options
context:
space:
mode:
authorRam Vepa <ram.vepa@qlogic.com>2011-05-31 16:20:43 -0400
committerRoland Dreier <roland@purestorage.com>2011-07-18 15:09:19 -0400
commit2df4f7579d212e8e0df7c8a24f57bf90f23fd516 (patch)
tree84c5a496f67f22f38a7c926fe3188f6bcbb3ac30 /drivers/infiniband
parentac0cae4495303b8fffd3df9c7cb29c7d0c05f210 (diff)
IB/qib: Add sysfs interface to read free contexts
Indicate the number of free user contexts via the sysfs file /sys/class/infiniband/qib0/nfreectxts as required for PSM. Signed-off-by: Mike Marciniszyn <mike.marciniszyn@qlogic.com> Signed-off-by: Roland Dreier <roland@purestorage.com>
Diffstat (limited to 'drivers/infiniband')
-rw-r--r--drivers/infiniband/hw/qib/qib_sysfs.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/drivers/infiniband/hw/qib/qib_sysfs.c b/drivers/infiniband/hw/qib/qib_sysfs.c
index d50a33fe8bbc..14d129de4320 100644
--- a/drivers/infiniband/hw/qib/qib_sysfs.c
+++ b/drivers/infiniband/hw/qib/qib_sysfs.c
@@ -507,6 +507,18 @@ static ssize_t show_nctxts(struct device *device,
507 dd->first_user_ctxt); 507 dd->first_user_ctxt);
508} 508}
509 509
510static ssize_t show_nfreectxts(struct device *device,
511 struct device_attribute *attr, char *buf)
512{
513 struct qib_ibdev *dev =
514 container_of(device, struct qib_ibdev, ibdev.dev);
515 struct qib_devdata *dd = dd_from_dev(dev);
516
517 /* Return the number of free user ports (contexts) available. */
518 return scnprintf(buf, PAGE_SIZE, "%u\n", dd->cfgctxts -
519 dd->first_user_ctxt - (u32)qib_stats.sps_ctxts);
520}
521
510static ssize_t show_serial(struct device *device, 522static ssize_t show_serial(struct device *device,
511 struct device_attribute *attr, char *buf) 523 struct device_attribute *attr, char *buf)
512{ 524{
@@ -604,6 +616,7 @@ static DEVICE_ATTR(hca_type, S_IRUGO, show_hca, NULL);
604static DEVICE_ATTR(board_id, S_IRUGO, show_hca, NULL); 616static DEVICE_ATTR(board_id, S_IRUGO, show_hca, NULL);
605static DEVICE_ATTR(version, S_IRUGO, show_version, NULL); 617static DEVICE_ATTR(version, S_IRUGO, show_version, NULL);
606static DEVICE_ATTR(nctxts, S_IRUGO, show_nctxts, NULL); 618static DEVICE_ATTR(nctxts, S_IRUGO, show_nctxts, NULL);
619static DEVICE_ATTR(nfreectxts, S_IRUGO, show_nfreectxts, NULL);
607static DEVICE_ATTR(serial, S_IRUGO, show_serial, NULL); 620static DEVICE_ATTR(serial, S_IRUGO, show_serial, NULL);
608static DEVICE_ATTR(boardversion, S_IRUGO, show_boardversion, NULL); 621static DEVICE_ATTR(boardversion, S_IRUGO, show_boardversion, NULL);
609static DEVICE_ATTR(logged_errors, S_IRUGO, show_logged_errs, NULL); 622static DEVICE_ATTR(logged_errors, S_IRUGO, show_logged_errs, NULL);
@@ -617,6 +630,7 @@ static struct device_attribute *qib_attributes[] = {
617 &dev_attr_board_id, 630 &dev_attr_board_id,
618 &dev_attr_version, 631 &dev_attr_version,
619 &dev_attr_nctxts, 632 &dev_attr_nctxts,
633 &dev_attr_nfreectxts,
620 &dev_attr_serial, 634 &dev_attr_serial,
621 &dev_attr_boardversion, 635 &dev_attr_boardversion,
622 &dev_attr_logged_errors, 636 &dev_attr_logged_errors,