ath9k: do a chip reset if noise floor calibration fails, should improve stability
[openwrt/svn-archive/archive.git] / package / kernel / mac80211 / patches / 564-ath9k_cleanup_reset_debug.patch
1 --- a/drivers/net/wireless/ath/ath9k/debug.c
2 +++ b/drivers/net/wireless/ath/ath9k/debug.c
3 @@ -846,36 +846,30 @@ static ssize_t read_file_reset(struct fi
4 size_t count, loff_t *ppos)
5 {
6 struct ath_softc *sc = file->private_data;
7 + static const char * const reset_cause[__RESET_TYPE_MAX] = {
8 + [RESET_TYPE_BB_HANG] = "Baseband Hang",
9 + [RESET_TYPE_BB_WATCHDOG] = "Baseband Watchdog",
10 + [RESET_TYPE_FATAL_INT] = "Fatal HW Error",
11 + [RESET_TYPE_TX_ERROR] = "TX HW error",
12 + [RESET_TYPE_TX_GTT] = "Transmit timeout",
13 + [RESET_TYPE_TX_HANG] = "TX Path Hang",
14 + [RESET_TYPE_PLL_HANG] = "PLL RX Hang",
15 + [RESET_TYPE_MAC_HANG] = "MAC Hang",
16 + [RESET_TYPE_BEACON_STUCK] = "Stuck Beacon",
17 + [RESET_TYPE_MCI] = "MCI Reset",
18 + };
19 char buf[512];
20 unsigned int len = 0;
21 + int i;
22
23 - len += scnprintf(buf + len, sizeof(buf) - len,
24 - "%17s: %2d\n", "Baseband Hang",
25 - sc->debug.stats.reset[RESET_TYPE_BB_HANG]);
26 - len += scnprintf(buf + len, sizeof(buf) - len,
27 - "%17s: %2d\n", "Baseband Watchdog",
28 - sc->debug.stats.reset[RESET_TYPE_BB_WATCHDOG]);
29 - len += scnprintf(buf + len, sizeof(buf) - len,
30 - "%17s: %2d\n", "Fatal HW Error",
31 - sc->debug.stats.reset[RESET_TYPE_FATAL_INT]);
32 - len += scnprintf(buf + len, sizeof(buf) - len,
33 - "%17s: %2d\n", "TX HW error",
34 - sc->debug.stats.reset[RESET_TYPE_TX_ERROR]);
35 - len += scnprintf(buf + len, sizeof(buf) - len,
36 - "%17s: %2d\n", "TX Path Hang",
37 - sc->debug.stats.reset[RESET_TYPE_TX_HANG]);
38 - len += scnprintf(buf + len, sizeof(buf) - len,
39 - "%17s: %2d\n", "PLL RX Hang",
40 - sc->debug.stats.reset[RESET_TYPE_PLL_HANG]);
41 - len += scnprintf(buf + len, sizeof(buf) - len,
42 - "%17s: %2d\n", "MAC Hang",
43 - sc->debug.stats.reset[RESET_TYPE_MAC_HANG]);
44 - len += scnprintf(buf + len, sizeof(buf) - len,
45 - "%17s: %2d\n", "Stuck Beacon",
46 - sc->debug.stats.reset[RESET_TYPE_BEACON_STUCK]);
47 - len += scnprintf(buf + len, sizeof(buf) - len,
48 - "%17s: %2d\n", "MCI Reset",
49 - sc->debug.stats.reset[RESET_TYPE_MCI]);
50 + for (i = 0; i < ARRAY_SIZE(reset_cause); i++) {
51 + if (!reset_cause[i])
52 + continue;
53 +
54 + len += scnprintf(buf + len, sizeof(buf) - len,
55 + "%17s: %2d\n", reset_cause[i],
56 + sc->debug.stats.reset[i]);
57 + }
58
59 if (len > sizeof(buf))
60 len = sizeof(buf);