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>
This commit is contained in:

committed by
Roland Dreier

parent
6c719cae0b
commit
3029fcc3d4
@@ -108,21 +108,16 @@ static const struct file_operations atomic_stats_ops = {
|
||||
.read = atomic_stats_read,
|
||||
};
|
||||
|
||||
#define NUM_COUNTERS sizeof(struct infinipath_counters) / sizeof(u64)
|
||||
|
||||
static ssize_t atomic_counters_read(struct file *file, char __user *buf,
|
||||
size_t count, loff_t *ppos)
|
||||
{
|
||||
u64 counters[NUM_COUNTERS];
|
||||
u16 i;
|
||||
struct infinipath_counters counters;
|
||||
struct ipath_devdata *dd;
|
||||
|
||||
dd = file->f_path.dentry->d_inode->i_private;
|
||||
dd->ipath_f_read_counters(dd, &counters);
|
||||
|
||||
for (i = 0; i < NUM_COUNTERS; i++)
|
||||
counters[i] = ipath_snap_cntr(dd, i);
|
||||
|
||||
return simple_read_from_buffer(buf, count, ppos, counters,
|
||||
return simple_read_from_buffer(buf, count, ppos, &counters,
|
||||
sizeof counters);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user