mac80211: update to wireless-testing 2011-09-14
[openwrt/staging/chunkeey.git] / package / mac80211 / patches / 571-ath9k_reset_debug.patch
1 --- a/drivers/net/wireless/ath/ath9k/debug.h
2 +++ b/drivers/net/wireless/ath/ath9k/debug.h
3 @@ -25,8 +25,10 @@ struct ath_buf;
4
5 #ifdef CONFIG_ATH9K_DEBUGFS
6 #define TX_STAT_INC(q, c) sc->debug.stats.txstats[q].c++
7 +#define RESET_STAT_INC(sc, type) sc->debug.stats.reset[type]++
8 #else
9 #define TX_STAT_INC(q, c) do { } while (0)
10 +#define RESET_STAT_INC(sc, type) do { } while (0)
11 #endif
12
13 #ifdef CONFIG_ATH9K_DEBUGFS
14 @@ -171,10 +173,21 @@ struct ath_rx_stats {
15 u8 rs_antenna;
16 };
17
18 +enum ath_reset_type {
19 + RESET_TYPE_BB_HANG,
20 + RESET_TYPE_BB_WATCHDOG,
21 + RESET_TYPE_FATAL_INT,
22 + RESET_TYPE_TX_ERROR,
23 + RESET_TYPE_TX_HANG,
24 + RESET_TYPE_PLL_HANG,
25 + __RESET_TYPE_MAX
26 +};
27 +
28 struct ath_stats {
29 struct ath_interrupt_stats istats;
30 struct ath_tx_stats txstats[ATH9K_NUM_TX_QUEUES];
31 struct ath_rx_stats rxstats;
32 + u32 reset[__RESET_TYPE_MAX];
33 };
34
35 #define ATH_DBG_MAX_SAMPLES 10
36 --- a/drivers/net/wireless/ath/ath9k/main.c
37 +++ b/drivers/net/wireless/ath/ath9k/main.c
38 @@ -679,6 +679,14 @@ void ath9k_tasklet(unsigned long data)
39
40 if ((status & ATH9K_INT_FATAL) ||
41 (status & ATH9K_INT_BB_WATCHDOG)) {
42 + enum ath_reset_type type;
43 +
44 + if (status & ATH9K_INT_FATAL)
45 + type = RESET_TYPE_FATAL_INT;
46 + else
47 + type = RESET_TYPE_BB_WATCHDOG;
48 +
49 + RESET_STAT_INC(sc, type);
50 ieee80211_queue_work(sc->hw, &sc->hw_reset_work);
51 goto out;
52 }
53 @@ -995,8 +1003,10 @@ void ath_hw_check(struct work_struct *wo
54 ath_dbg(common, ATH_DBG_RESET, "Possible baseband hang, "
55 "busy=%d (try %d)\n", busy, sc->hw_busy_count + 1);
56 if (busy >= 99) {
57 - if (++sc->hw_busy_count >= 3)
58 + if (++sc->hw_busy_count >= 3) {
59 + RESET_STAT_INC(sc, RESET_TYPE_BB_HANG);
60 ieee80211_queue_work(sc->hw, &sc->hw_reset_work);
61 + }
62
63 } else if (busy >= 0)
64 sc->hw_busy_count = 0;
65 @@ -1016,6 +1026,7 @@ static void ath_hw_pll_rx_hang_check(str
66 /* Rx is hung for more than 500ms. Reset it */
67 ath_dbg(common, ATH_DBG_RESET,
68 "Possible RX hang, resetting");
69 + RESET_STAT_INC(sc, RESET_TYPE_PLL_HANG);
70 ieee80211_queue_work(sc->hw, &sc->hw_reset_work);
71 count = 0;
72 }
73 --- a/drivers/net/wireless/ath/ath9k/xmit.c
74 +++ b/drivers/net/wireless/ath/ath9k/xmit.c
75 @@ -587,8 +587,10 @@ static void ath_tx_complete_aggr(struct
76
77 rcu_read_unlock();
78
79 - if (needreset)
80 + if (needreset) {
81 + RESET_STAT_INC(sc, RESET_TYPE_TX_ERROR);
82 ieee80211_queue_work(sc->hw, &sc->hw_reset_work);
83 + }
84 }
85
86 static bool ath_lookup_legacy(struct ath_buf *bf)
87 @@ -2270,6 +2272,7 @@ static void ath_tx_complete_poll_work(st
88 if (needreset) {
89 ath_dbg(ath9k_hw_common(sc->sc_ah), ATH_DBG_RESET,
90 "tx hung, resetting the chip\n");
91 + RESET_STAT_INC(sc, RESET_TYPE_TX_HANG);
92 ieee80211_queue_work(sc->hw, &sc->hw_reset_work);
93 }
94
95 --- a/drivers/net/wireless/ath/ath9k/debug.c
96 +++ b/drivers/net/wireless/ath/ath9k/debug.c
97 @@ -523,9 +523,22 @@ static ssize_t read_file_wiphy(struct fi
98 if (tmp & ATH9K_RX_FILTER_PHYRADAR)
99 len += snprintf(buf + len, sizeof(buf) - len, " PHYRADAR");
100 if (tmp & ATH9K_RX_FILTER_MCAST_BCAST_ALL)
101 - len += snprintf(buf + len, sizeof(buf) - len, " MCAST_BCAST_ALL\n");
102 - else
103 - len += snprintf(buf + len, sizeof(buf) - len, "\n");
104 + len += snprintf(buf + len, sizeof(buf) - len, " MCAST_BCAST_ALL");
105 +
106 + len += snprintf(buf + len, sizeof(buf) - len,
107 + "\n\nReset causes:\n"
108 + " baseband hang: %d\n"
109 + " baseband watchdog: %d\n"
110 + " fatal hardware error interrupt: %d\n"
111 + " tx hardware error: %d\n"
112 + " tx path hang: %d\n"
113 + " pll rx hang: %d\n",
114 + sc->debug.stats.reset[RESET_TYPE_BB_HANG],
115 + sc->debug.stats.reset[RESET_TYPE_BB_WATCHDOG],
116 + sc->debug.stats.reset[RESET_TYPE_FATAL_INT],
117 + sc->debug.stats.reset[RESET_TYPE_TX_ERROR],
118 + sc->debug.stats.reset[RESET_TYPE_TX_HANG],
119 + sc->debug.stats.reset[RESET_TYPE_PLL_HANG]);
120
121 if (len > sizeof(buf))
122 len = sizeof(buf);