diff options
author | Michael Albaugh <Michael.Albaugh@Qlogic.com> | 2007-10-02 16:26:45 -0400 |
---|---|---|
committer | Roland Dreier <rolandd@cisco.com> | 2007-10-10 00:00:08 -0400 |
commit | 192594d5230f447ef2df8de9d7902ac90d11c118 (patch) | |
tree | 8867ed0ba446ac2a9f1c6549cff18fb7a70f0bfc /drivers/infiniband | |
parent | aa7c79abd154ed9aba4c19b861d439ef6af35d3a (diff) |
IB/ipath: Maintain active time on all chips
There is a count of "active hours" maintained in EEPROM, to aid
troubleshooting. The definition of "active" is based on traffic
exceeding a threshold in any given 5-second polling interval. As
originally written, the check was inadvertently bypassed for chips whose
counters were 64-bits wide, and only applied to chips with 32-bit wide
counters.
This patch moves the test for amount of traffic "out" to a more common
location, rather than depending on a side-effect of the software
emulation of 64-bit counts on chips whose hardware is only 32-bits wide.
Signed-off-by: Michael Albaugh <Michael.Albaugh@Qlogic.com>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
Diffstat (limited to 'drivers/infiniband')
-rw-r--r-- | drivers/infiniband/hw/ipath/ipath_stats.c | 17 |
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 bae4f56f7271..f0271415cd5b 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) { |