Commit 192594d5 authored by Michael Albaugh's avatar Michael Albaugh Committed by Roland Dreier

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: default avatarMichael Albaugh <Michael.Albaugh@Qlogic.com>
Signed-off-by: default avatarRoland Dreier <rolandd@cisco.com>
parent aa7c79ab
...@@ -55,7 +55,6 @@ u64 ipath_snap_cntr(struct ipath_devdata *dd, ipath_creg creg) ...@@ -55,7 +55,6 @@ u64 ipath_snap_cntr(struct ipath_devdata *dd, ipath_creg creg)
u64 val64; u64 val64;
unsigned long t0, t1; unsigned long t0, t1;
u64 ret; u64 ret;
unsigned long flags;
t0 = jiffies; t0 = jiffies;
/* If fast increment counters are only 32 bits, snapshot them, /* 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,18 +91,12 @@ u64 ipath_snap_cntr(struct ipath_devdata *dd, ipath_creg creg)
if (creg == dd->ipath_cregs->cr_wordsendcnt) { if (creg == dd->ipath_cregs->cr_wordsendcnt) {
if (val != dd->ipath_lastsword) { if (val != dd->ipath_lastsword) {
dd->ipath_sword += val - dd->ipath_lastsword; dd->ipath_sword += val - dd->ipath_lastsword;
spin_lock_irqsave(&dd->ipath_eep_st_lock, flags);
dd->ipath_traffic_wds += val - dd->ipath_lastsword;
spin_unlock_irqrestore(&dd->ipath_eep_st_lock, flags);
dd->ipath_lastsword = val; dd->ipath_lastsword = val;
} }
val64 = dd->ipath_sword; val64 = dd->ipath_sword;
} else if (creg == dd->ipath_cregs->cr_wordrcvcnt) { } else if (creg == dd->ipath_cregs->cr_wordrcvcnt) {
if (val != dd->ipath_lastrword) { if (val != dd->ipath_lastrword) {
dd->ipath_rword += val - dd->ipath_lastrword; dd->ipath_rword += val - dd->ipath_lastrword;
spin_lock_irqsave(&dd->ipath_eep_st_lock, flags);
dd->ipath_traffic_wds += val - dd->ipath_lastrword;
spin_unlock_irqrestore(&dd->ipath_eep_st_lock, flags);
dd->ipath_lastrword = val; dd->ipath_lastrword = val;
} }
val64 = dd->ipath_rword; val64 = dd->ipath_rword;
...@@ -247,6 +240,7 @@ void ipath_get_faststats(unsigned long opaque) ...@@ -247,6 +240,7 @@ void ipath_get_faststats(unsigned long opaque)
u32 val; u32 val;
static unsigned cnt; static unsigned cnt;
unsigned long flags; unsigned long flags;
u64 traffic_wds;
/* /*
* don't access the chip while running diags, or memory diags can * don't access the chip while running diags, or memory diags can
...@@ -262,12 +256,13 @@ void ipath_get_faststats(unsigned long opaque) ...@@ -262,12 +256,13 @@ void ipath_get_faststats(unsigned long opaque)
* exceeding a threshold, so we need to check the word-counts * exceeding a threshold, so we need to check the word-counts
* even if they are 64-bit. * even if they are 64-bit.
*/ */
ipath_snap_cntr(dd, dd->ipath_cregs->cr_wordsendcnt); traffic_wds = ipath_snap_cntr(dd, dd->ipath_cregs->cr_wordsendcnt) +
ipath_snap_cntr(dd, dd->ipath_cregs->cr_wordrcvcnt); ipath_snap_cntr(dd, dd->ipath_cregs->cr_wordrcvcnt);
spin_lock_irqsave(&dd->ipath_eep_st_lock, flags); spin_lock_irqsave(&dd->ipath_eep_st_lock, flags);
if (dd->ipath_traffic_wds >= IPATH_TRAFFIC_ACTIVE_THRESHOLD) traffic_wds -= dd->ipath_traffic_wds;
dd->ipath_traffic_wds += traffic_wds;
if (traffic_wds >= IPATH_TRAFFIC_ACTIVE_THRESHOLD)
atomic_add(5, &dd->ipath_active_time); /* S/B #define */ atomic_add(5, &dd->ipath_active_time); /* S/B #define */
dd->ipath_traffic_wds = 0;
spin_unlock_irqrestore(&dd->ipath_eep_st_lock, flags); spin_unlock_irqrestore(&dd->ipath_eep_st_lock, flags);
if (dd->ipath_flags & IPATH_32BITCOUNTERS) { if (dd->ipath_flags & IPATH_32BITCOUNTERS) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment