aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/infiniband/hw/ipath/ipath_stats.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/infiniband/hw/ipath/ipath_stats.c')
-rw-r--r--drivers/infiniband/hw/ipath/ipath_stats.c17
1 files changed, 6 insertions, 11 deletions
diff --git a/drivers/infiniband/hw/ipath/ipath_stats.c b/drivers/infiniband/hw/ipath/ipath_stats.c
index bae4f56f727..f0271415cd5 100644
--- a/drivers/infiniband/hw/ipath/ipath_stats.c
+++ b/drivers/infiniband/hw/ipath/ipath_stats.c
@@ -55,7 +55,6 @@ u64 ipath_snap_cntr(struct ipath_devdata *dd, ipath_creg creg)
55 u64 val64; 55 u64 val64;
56 unsigned long t0, t1; 56 unsigned long t0, t1;
57 u64 ret; 57 u64 ret;
58 unsigned long flags;
59 58
60 t0 = jiffies; 59 t0 = jiffies;
61 /* If fast increment counters are only 32 bits, snapshot them, 60 /* If fast increment counters are only 32 bits, snapshot them,
@@ -92,18 +91,12 @@ u64 ipath_snap_cntr(struct ipath_devdata *dd, ipath_creg creg)
92 if (creg == dd->ipath_cregs->cr_wordsendcnt) { 91 if (creg == dd->ipath_cregs->cr_wordsendcnt) {
93 if (val != dd->ipath_lastsword) { 92 if (val != dd->ipath_lastsword) {
94 dd->ipath_sword += val - dd->ipath_lastsword; 93 dd->ipath_sword += val - dd->ipath_lastsword;
95 spin_lock_irqsave(&dd->ipath_eep_st_lock, flags);
96 dd->ipath_traffic_wds += val - dd->ipath_lastsword;
97 spin_unlock_irqrestore(&dd->ipath_eep_st_lock, flags);
98 dd->ipath_lastsword = val; 94 dd->ipath_lastsword = val;
99 } 95 }
100 val64 = dd->ipath_sword; 96 val64 = dd->ipath_sword;
101 } else if (creg == dd->ipath_cregs->cr_wordrcvcnt) { 97 } else if (creg == dd->ipath_cregs->cr_wordrcvcnt) {
102 if (val != dd->ipath_lastrword) { 98 if (val != dd->ipath_lastrword) {
103 dd->ipath_rword += val - dd->ipath_lastrword; 99 dd->ipath_rword += val - dd->ipath_lastrword;
104 spin_lock_irqsave(&dd->ipath_eep_st_lock, flags);
105 dd->ipath_traffic_wds += val - dd->ipath_lastrword;
106 spin_unlock_irqrestore(&dd->ipath_eep_st_lock, flags);
107 dd->ipath_lastrword = val; 100 dd->ipath_lastrword = val;
108 } 101 }
109 val64 = dd->ipath_rword; 102 val64 = dd->ipath_rword;
@@ -247,6 +240,7 @@ void ipath_get_faststats(unsigned long opaque)
247 u32 val; 240 u32 val;
248 static unsigned cnt; 241 static unsigned cnt;
249 unsigned long flags; 242 unsigned long flags;
243 u64 traffic_wds;
250 244
251 /* 245 /*
252 * don't access the chip while running diags, or memory diags can 246 * don't access the chip while running diags, or memory diags can
@@ -262,12 +256,13 @@ void ipath_get_faststats(unsigned long opaque)
262 * exceeding a threshold, so we need to check the word-counts 256 * exceeding a threshold, so we need to check the word-counts
263 * even if they are 64-bit. 257 * even if they are 64-bit.
264 */ 258 */
265 ipath_snap_cntr(dd, dd->ipath_cregs->cr_wordsendcnt); 259 traffic_wds = ipath_snap_cntr(dd, dd->ipath_cregs->cr_wordsendcnt) +
266 ipath_snap_cntr(dd, dd->ipath_cregs->cr_wordrcvcnt); 260 ipath_snap_cntr(dd, dd->ipath_cregs->cr_wordrcvcnt);
267 spin_lock_irqsave(&dd->ipath_eep_st_lock, flags); 261 spin_lock_irqsave(&dd->ipath_eep_st_lock, flags);
268 if (dd->ipath_traffic_wds >= IPATH_TRAFFIC_ACTIVE_THRESHOLD) 262 traffic_wds -= dd->ipath_traffic_wds;
263 dd->ipath_traffic_wds += traffic_wds;
264 if (traffic_wds >= IPATH_TRAFFIC_ACTIVE_THRESHOLD)
269 atomic_add(5, &dd->ipath_active_time); /* S/B #define */ 265 atomic_add(5, &dd->ipath_active_time); /* S/B #define */
270 dd->ipath_traffic_wds = 0;
271 spin_unlock_irqrestore(&dd->ipath_eep_st_lock, flags); 266 spin_unlock_irqrestore(&dd->ipath_eep_st_lock, flags);
272 267
273 if (dd->ipath_flags & IPATH_32BITCOUNTERS) { 268 if (dd->ipath_flags & IPATH_32BITCOUNTERS) {