add some madwifi fixes and enhancements by Sven-Ola, refresh patches
[openwrt/svn-archive/archive.git] / package / madwifi / patches / 202-debug_variables.patch
1 --- a/ath/if_ath.c
2 +++ b/ath/if_ath.c
3 @@ -453,8 +453,8 @@
4 MODULE_PARM_DESC(ratectl, "Rate control algorithm [amrr|minstrel|onoe|sample], "
5 "defaults to '" DEF_RATE_CTL "'");
6
7 -static int ath_debug = 0;
8 #ifdef AR_DEBUG
9 +static int ath_debug = 0;
10 #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,52))
11 MODULE_PARM(ath_debug, "i");
12 #else
13 @@ -465,8 +465,8 @@
14 static void ath_printtxbuf(const struct ath_buf *, int);
15 #endif /* defined(AR_DEBUG) */
16
17 -static int ieee80211_debug = 0;
18 #ifdef AR_DEBUG
19 +static int ieee80211_debug = 0;
20 #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,52))
21 MODULE_PARM(ieee80211_debug, "i");
22 #else
23 @@ -1565,7 +1565,9 @@
24 void
25 ath_suspend(struct net_device *dev)
26 {
27 +#ifdef AR_DEBUG
28 struct ath_softc *sc = dev->priv;
29 +#endif
30
31 DPRINTF(sc, ATH_DEBUG_ANY, "flags=%x\n", dev->flags);
32 ath_stop(dev);
33 @@ -1574,7 +1576,9 @@
34 void
35 ath_resume(struct net_device *dev)
36 {
37 +#ifdef AR_DEBUG
38 struct ath_softc *sc = dev->priv;
39 +#endif
40
41 DPRINTF(sc, ATH_DEBUG_ANY, "flags=%x\n", dev->flags);
42 ath_init(dev);
43 @@ -4019,7 +4023,9 @@
44 ath_key_update_begin(struct ieee80211vap *vap)
45 {
46 struct net_device *dev = vap->iv_ic->ic_dev;
47 +#ifdef AR_DEBUG
48 struct ath_softc *sc = dev->priv;
49 +#endif
50
51 DPRINTF(sc, ATH_DEBUG_KEYCACHE, "Begin\n");
52 /*
53 @@ -4040,7 +4046,9 @@
54 ath_key_update_end(struct ieee80211vap *vap)
55 {
56 struct net_device *dev = vap->iv_ic->ic_dev;
57 +#ifdef AR_DEBUG
58 struct ath_softc *sc = dev->priv;
59 +#endif
60
61 DPRINTF(sc, ATH_DEBUG_KEYCACHE, "End\n");
62 netif_wake_queue(dev);
63 @@ -6218,7 +6226,9 @@
64 struct sk_buff *skb, int subtype, int rssi, u_int64_t rtsf)
65 {
66 struct ath_softc *sc = vap->iv_ic->ic_dev->priv;
67 +#ifdef AR_DEBUG
68 struct ieee80211_frame *wh = (struct ieee80211_frame *)skb->data;
69 +#endif
70 struct ieee80211_node * ni = ni_or_null;
71 u_int64_t hw_tsf, beacon_tsf;
72 u_int32_t hw_tu, beacon_tu, intval;
73 @@ -8382,7 +8392,9 @@
74 static void
75 ath_tx_draintxq(struct ath_softc *sc, struct ath_txq *txq)
76 {
77 +#ifdef AR_DEBUG
78 struct ath_hal *ah = sc->sc_ah;
79 +#endif
80 struct ath_buf *bf;
81 /*
82 * NB: this assumes output has been stopped and
83 @@ -11002,6 +11014,7 @@
84 strncat(m, b, MLEN);
85 }
86 strncat(m, "\n", MLEN);
87 +#ifdef AR_DEBUG
88 if (1 /* bootverbose */) {
89 unsigned int i;
90 for (i = 0; i <= WME_AC_VO; i++) {
91 @@ -11014,6 +11027,7 @@
92 sc->sc_cabq->axq_qnum);
93 IPRINTF(sc, "Use hw queue %u for beacons\n", sc->sc_bhalq);
94 }
95 +#endif
96 #undef HAL_MODE_DUALBAND
97 }
98
99 --- a/ath/if_ath_radar.c
100 +++ b/ath/if_ath_radar.c
101 @@ -156,7 +156,9 @@
102 #endif
103 };
104
105 +#ifdef AR_DEBUG
106 static u_int32_t interval_to_frequency(u_int32_t pri);
107 +#endif
108
109 /* Returns true if radar detection is enabled. */
110 int ath_radar_is_enabled(struct ath_softc *sc)
111 @@ -229,7 +231,9 @@
112 {
113
114 struct ath_hal *ah = sc->sc_ah;
115 +#ifdef AR_DEBUG
116 struct net_device *dev = sc->sc_dev;
117 +#endif
118 struct ieee80211com *ic = &sc->sc_ic;
119 int required = 0;
120
121 @@ -366,6 +370,7 @@
122 #define MR_FAIL_MIN_PERIOD 4
123 #define MR_FAIL_MAX_PERIOD 5
124
125 +#ifdef AR_DEBUG
126 static const char* get_match_result_desc(u_int32_t code) {
127 switch (code) {
128 case MR_MATCH:
129 @@ -384,6 +389,7 @@
130 return "unknown";
131 }
132 }
133 +#endif
134
135 static int32_t match_radar(
136 u_int32_t matched,
137 @@ -775,7 +781,10 @@
138 struct ath_softc *sc, struct ath_rp *last_pulse,
139 u_int32_t *index, u_int32_t *pri, u_int32_t *matching_pulses,
140 u_int32_t *missed_pulses, u_int32_t *noise_pulses)
141 -{ struct net_device *dev = sc->sc_dev;
142 +{
143 +#ifdef AR_DEBUG
144 + struct net_device *dev = sc->sc_dev;
145 +#endif
146 int i;
147 int best_index = -1;
148 unsigned int best_matched = 0;
149 @@ -1217,6 +1226,7 @@
150 return (-1 != best_index) ? AH_TRUE : AH_FALSE;
151 }
152
153 +#ifdef AR_DEBUG
154 static u_int32_t interval_to_frequency(u_int32_t interval)
155 {
156 /* Calculate BRI from PRI */
157 @@ -1224,6 +1234,7 @@
158 /* Round to nearest multiple of 50 */
159 return frequency + ((frequency % 50) >= 25 ? 50 : 0) - (frequency % 50);
160 }
161 +#endif
162
163 #ifdef ATH_RADAR_LONG_PULSE
164 static const char* get_longpulse_desc(int lp) {
165 @@ -1580,7 +1591,9 @@
166 void ath_rp_record(struct ath_softc *sc, u_int64_t tsf, u_int8_t rssi,
167 u_int8_t width, HAL_BOOL is_simulated)
168 {
169 +#ifdef AR_DEBUG
170 struct net_device *dev = sc->sc_dev;
171 +#endif
172 struct ath_rp *pulse;
173
174 DPRINTF(sc, ATH_DEBUG_DOTHPULSES, "%s: ath_rp_record: "
175 --- a/ath_rate/minstrel/minstrel.c
176 +++ b/ath_rate/minstrel/minstrel.c
177 @@ -931,7 +931,9 @@
178 (struct ieee80211_node_table *) &vap->iv_ic->ic_sta;
179 unsigned int x = 0;
180 unsigned int this_tp, this_prob, this_eprob;
181 +#ifdef AR_DEBUG
182 struct ath_softc *sc = vap->iv_ic->ic_dev->priv;;
183 +#endif
184
185 IEEE80211_NODE_TABLE_LOCK_IRQ(nt);
186 TAILQ_FOREACH(ni, &nt->nt_node, ni_list) {
187 --- a/net80211/ieee80211_scan_ap.c
188 +++ b/net80211/ieee80211_scan_ap.c
189 @@ -731,6 +731,7 @@
190
191 sort(chans, ss_last, sizeof(*chans), pc_cmp, pc_swap);
192
193 +#ifdef IEEE80211_DEBUG
194 for (i = 0; i < ss_last; i++) {
195 int chan = ieee80211_chan2ieee(ic, chans[i].chan);
196
197 @@ -742,6 +743,7 @@
198 !!IEEE80211_ARE_CHANS_SAME_MODE(chans[i].chan,
199 ic->ic_bsschan));
200 }
201 +#endif
202
203 best = NULL;
204 best_rssi = 0xff; /* If signal is bigger than 0xff, we'd be melting. */