diff options
author | Mike Marciniszyn <mike.marciniszyn@intel.com> | 2013-06-15 23:07:14 +0200 |
---|---|---|
committer | Roland Dreier <roland@purestorage.com> | 2013-06-22 02:19:52 +0200 |
commit | 1dd173b01f52c7a197cab20563d5f4967472a852 (patch) | |
tree | fa7194bc8024ff795bc38ec692e36dd2d5d279b6 /drivers/infiniband/hw/qib/qib_debugfs.c | |
parent | IB/qib: Add per-context stats interface (diff) | |
download | linux-1dd173b01f52c7a197cab20563d5f4967472a852.tar.xz linux-1dd173b01f52c7a197cab20563d5f4967472a852.zip |
IB/qib: Add qp_stats debug file
This adds a seq_file iterator for reporting the QP hash table when the
qp_stats file is read.
Reviewed-by: Dean Luick <dean.luick@intel.com>
Signed-off-by: Mike Marciniszyn <mike.marciniszyn@intel.com>
Signed-off-by: Roland Dreier <roland@purestorage.com>
Diffstat (limited to 'drivers/infiniband/hw/qib/qib_debugfs.c')
-rw-r--r-- | drivers/infiniband/hw/qib/qib_debugfs.c | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/drivers/infiniband/hw/qib/qib_debugfs.c b/drivers/infiniband/hw/qib/qib_debugfs.c index a4e6ee154f19..799a0c3bffc4 100644 --- a/drivers/infiniband/hw/qib/qib_debugfs.c +++ b/drivers/infiniband/hw/qib/qib_debugfs.c @@ -188,6 +188,59 @@ static int _ctx_stats_seq_show(struct seq_file *s, void *v) DEBUGFS_FILE(ctx_stats) +static void *_qp_stats_seq_start(struct seq_file *s, loff_t *pos) +{ + struct qib_qp_iter *iter; + loff_t n = *pos; + + iter = qib_qp_iter_init(s->private); + if (!iter) + return NULL; + + while (n--) { + if (qib_qp_iter_next(iter)) { + kfree(iter); + return NULL; + } + } + + return iter; +} + +static void *_qp_stats_seq_next(struct seq_file *s, void *iter_ptr, + loff_t *pos) +{ + struct qib_qp_iter *iter = iter_ptr; + + (*pos)++; + + if (qib_qp_iter_next(iter)) { + kfree(iter); + return NULL; + } + + return iter; +} + +static void _qp_stats_seq_stop(struct seq_file *s, void *iter_ptr) +{ + /* nothing for now */ +} + +static int _qp_stats_seq_show(struct seq_file *s, void *iter_ptr) +{ + struct qib_qp_iter *iter = iter_ptr; + + if (!iter) + return 0; + + qib_qp_iter_print(s, iter); + + return 0; +} + +DEBUGFS_FILE(qp_stats) + void qib_dbg_ibdev_init(struct qib_ibdev *ibd) { char name[10]; @@ -200,6 +253,7 @@ void qib_dbg_ibdev_init(struct qib_ibdev *ibd) } DEBUGFS_FILE_CREATE(opcode_stats); DEBUGFS_FILE_CREATE(ctx_stats); + DEBUGFS_FILE_CREATE(qp_stats); return; } |