diff options
Diffstat (limited to 'drivers/infiniband/hw/ipath/ipath_stats.c')
-rw-r--r-- | drivers/infiniband/hw/ipath/ipath_stats.c | 25 |
1 files changed, 22 insertions, 3 deletions
diff --git a/drivers/infiniband/hw/ipath/ipath_stats.c b/drivers/infiniband/hw/ipath/ipath_stats.c index d8b5e4cefe25..73ed17d03188 100644 --- a/drivers/infiniband/hw/ipath/ipath_stats.c +++ b/drivers/infiniband/hw/ipath/ipath_stats.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) 2006 QLogic, Inc. All rights reserved. | 2 | * Copyright (c) 2006, 2007 QLogic Corporation. All rights reserved. |
3 | * Copyright (c) 2003, 2004, 2005, 2006 PathScale, Inc. All rights reserved. | 3 | * Copyright (c) 2003, 2004, 2005, 2006 PathScale, Inc. All rights reserved. |
4 | * | 4 | * |
5 | * This software is available to you under a choice of one of two | 5 | * This software is available to you under a choice of one of two |
@@ -55,6 +55,7 @@ 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; | ||
58 | 59 | ||
59 | t0 = jiffies; | 60 | t0 = jiffies; |
60 | /* If fast increment counters are only 32 bits, snapshot them, | 61 | /* If fast increment counters are only 32 bits, snapshot them, |
@@ -91,12 +92,18 @@ u64 ipath_snap_cntr(struct ipath_devdata *dd, ipath_creg creg) | |||
91 | if (creg == dd->ipath_cregs->cr_wordsendcnt) { | 92 | if (creg == dd->ipath_cregs->cr_wordsendcnt) { |
92 | if (val != dd->ipath_lastsword) { | 93 | if (val != dd->ipath_lastsword) { |
93 | dd->ipath_sword += val - dd->ipath_lastsword; | 94 | 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); | ||
94 | dd->ipath_lastsword = val; | 98 | dd->ipath_lastsword = val; |
95 | } | 99 | } |
96 | val64 = dd->ipath_sword; | 100 | val64 = dd->ipath_sword; |
97 | } else if (creg == dd->ipath_cregs->cr_wordrcvcnt) { | 101 | } else if (creg == dd->ipath_cregs->cr_wordrcvcnt) { |
98 | if (val != dd->ipath_lastrword) { | 102 | if (val != dd->ipath_lastrword) { |
99 | dd->ipath_rword += val - dd->ipath_lastrword; | 103 | 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); | ||
100 | dd->ipath_lastrword = val; | 107 | dd->ipath_lastrword = val; |
101 | } | 108 | } |
102 | val64 = dd->ipath_rword; | 109 | val64 = dd->ipath_rword; |
@@ -200,6 +207,7 @@ void ipath_get_faststats(unsigned long opaque) | |||
200 | struct ipath_devdata *dd = (struct ipath_devdata *) opaque; | 207 | struct ipath_devdata *dd = (struct ipath_devdata *) opaque; |
201 | u32 val; | 208 | u32 val; |
202 | static unsigned cnt; | 209 | static unsigned cnt; |
210 | unsigned long flags; | ||
203 | 211 | ||
204 | /* | 212 | /* |
205 | * don't access the chip while running diags, or memory diags can | 213 | * don't access the chip while running diags, or memory diags can |
@@ -210,9 +218,20 @@ void ipath_get_faststats(unsigned long opaque) | |||
210 | /* but re-arm the timer, for diags case; won't hurt other */ | 218 | /* but re-arm the timer, for diags case; won't hurt other */ |
211 | goto done; | 219 | goto done; |
212 | 220 | ||
221 | /* | ||
222 | * We now try to maintain a "active timer", based on traffic | ||
223 | * exceeding a threshold, so we need to check the word-counts | ||
224 | * even if they are 64-bit. | ||
225 | */ | ||
226 | ipath_snap_cntr(dd, dd->ipath_cregs->cr_wordsendcnt); | ||
227 | ipath_snap_cntr(dd, dd->ipath_cregs->cr_wordrcvcnt); | ||
228 | spin_lock_irqsave(&dd->ipath_eep_st_lock, flags); | ||
229 | if (dd->ipath_traffic_wds >= IPATH_TRAFFIC_ACTIVE_THRESHOLD) | ||
230 | atomic_add(5, &dd->ipath_active_time); /* S/B #define */ | ||
231 | dd->ipath_traffic_wds = 0; | ||
232 | spin_unlock_irqrestore(&dd->ipath_eep_st_lock, flags); | ||
233 | |||
213 | if (dd->ipath_flags & IPATH_32BITCOUNTERS) { | 234 | if (dd->ipath_flags & IPATH_32BITCOUNTERS) { |
214 | ipath_snap_cntr(dd, dd->ipath_cregs->cr_wordsendcnt); | ||
215 | ipath_snap_cntr(dd, dd->ipath_cregs->cr_wordrcvcnt); | ||
216 | ipath_snap_cntr(dd, dd->ipath_cregs->cr_pktsendcnt); | 235 | ipath_snap_cntr(dd, dd->ipath_cregs->cr_pktsendcnt); |
217 | ipath_snap_cntr(dd, dd->ipath_cregs->cr_pktrcvcnt); | 236 | ipath_snap_cntr(dd, dd->ipath_cregs->cr_pktrcvcnt); |
218 | } | 237 | } |