aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/infiniband/hw/ipath/ipath_fs.c
diff options
context:
space:
mode:
authorRalph Campbell <ralph.campbell@qlogic.com>2008-01-07 00:02:34 -0500
committerRoland Dreier <rolandd@cisco.com>2008-01-25 17:15:38 -0500
commit3029fcc3d44530601f19fd8f551ac195d3a918d7 (patch)
treedf486443f140a8d47fab8bda9552744c3201b865 /drivers/infiniband/hw/ipath/ipath_fs.c
parent6c719cae0b91f577738dfb4007baee28f03e48a5 (diff)
IB/ipath: Export hardware counters more consistently
Various hardware counters are exported via the ipath file system (since it is binary data). The old file format was very dependent on the HW offsets for these registers. Newer HCA chips can have different counters at different offsets. This patch adds a level of indirection to make the file format consistent across HCAs. Signed-off-by: Ralph Campbell <ralph.campbell@qlogic.com> Signed-off-by: Roland Dreier <rolandd@cisco.com>
Diffstat (limited to 'drivers/infiniband/hw/ipath/ipath_fs.c')
-rw-r--r--drivers/infiniband/hw/ipath/ipath_fs.c11
1 files changed, 3 insertions, 8 deletions
diff --git a/drivers/infiniband/hw/ipath/ipath_fs.c b/drivers/infiniband/hw/ipath/ipath_fs.c
index 262c25db05c..52325e009a1 100644
--- a/drivers/infiniband/hw/ipath/ipath_fs.c
+++ b/drivers/infiniband/hw/ipath/ipath_fs.c
@@ -108,21 +108,16 @@ static const struct file_operations atomic_stats_ops = {
108 .read = atomic_stats_read, 108 .read = atomic_stats_read,
109}; 109};
110 110
111#define NUM_COUNTERS sizeof(struct infinipath_counters) / sizeof(u64)
112
113static ssize_t atomic_counters_read(struct file *file, char __user *buf, 111static ssize_t atomic_counters_read(struct file *file, char __user *buf,
114 size_t count, loff_t *ppos) 112 size_t count, loff_t *ppos)
115{ 113{
116 u64 counters[NUM_COUNTERS]; 114 struct infinipath_counters counters;
117 u16 i;
118 struct ipath_devdata *dd; 115 struct ipath_devdata *dd;
119 116
120 dd = file->f_path.dentry->d_inode->i_private; 117 dd = file->f_path.dentry->d_inode->i_private;
118 dd->ipath_f_read_counters(dd, &counters);
121 119
122 for (i = 0; i < NUM_COUNTERS; i++) 120 return simple_read_from_buffer(buf, count, ppos, &counters,
123 counters[i] = ipath_snap_cntr(dd, i);
124
125 return simple_read_from_buffer(buf, count, ppos, counters,
126 sizeof counters); 121 sizeof counters);
127} 122}
128 123