madwifi: modify madwifi.sh to support IBSS WPA-NONE
[openwrt.git] / package / madwifi / patches / 379-invalid_rate_fix.patch
1 --- a/ath_rate/minstrel/minstrel.c
2 +++ b/ath_rate/minstrel/minstrel.c
3 @@ -111,27 +111,13 @@
4 #include <net80211/ieee80211_var.h>
5 #include <net80211/ieee80211_rate.h>
6
7 +#include "if_ath_debug.h"
8 #include "if_athvar.h"
9 #include "if_ath_hal.h"
10 #include "ah_desc.h"
11
12 #include "minstrel.h"
13
14 -#ifdef AR_DEBUG
15 -#define MINSTREL_DEBUG
16 -#endif
17 -#ifdef MINSTREL_DEBUG
18 -enum {
19 - ATH_DEBUG_RATE = 0x00000010 /* rate control */
20 -};
21 -#define DPRINTF(sc, _fmt, ...) do { \
22 - if (sc->sc_debug & ATH_DEBUG_RATE) \
23 - printk(_fmt, __VA_ARGS__); \
24 -} while (0)
25 -#else
26 -#define DPRINTF(sc, _fmt, ...)
27 -#endif
28 -
29 #define ONE_SECOND (1000 * 1000) /* 1 second, or 1000 milliseconds; eternity, in other words */
30
31 #include "release.h"
32 @@ -471,11 +457,11 @@ ath_rate_tx_complete(struct ath_softc *s
33 final_rate = sc->sc_hwmap[ts->ts_rate & ~HAL_TXSTAT_ALTRATE].ieeerate;
34 final_ndx = rate_to_ndx(sn, final_rate);
35 if (final_ndx >= sn->num_rates) {
36 - DPRINTF(sc, "%s: final ndx too high\n", __func__);
37 + DPRINTF(sc, ATH_DEBUG_RATE, "%s: final ndx too high\n", __func__);
38 final_ndx = 0;
39 }
40 if (final_ndx < 0) {
41 - DPRINTF(sc, "%s: final ndx too low\n", __func__);
42 + DPRINTF(sc, ATH_DEBUG_RATE, "%s: final ndx too low\n", __func__);
43 final_ndx = 0;
44 }
45
46 @@ -485,7 +471,7 @@ ath_rate_tx_complete(struct ath_softc *s
47 tries = ts->ts_longretry + 1;
48
49 if (sn->num_rates <= 0) {
50 - DPRINTF(sc, "%s: " MAC_FMT " %s no rates yet\n", dev_info,
51 + DPRINTF(sc, ATH_DEBUG_RATE, "%s: " MAC_FMT " %s no rates yet\n", dev_info,
52 MAC_ADDR(an->an_node.ni_macaddr), __func__);
53 return;
54 }
55 @@ -551,7 +537,7 @@ ath_rate_tx_complete(struct ath_softc *s
56 static void
57 ath_rate_newassoc(struct ath_softc *sc, struct ath_node *an, int isnew)
58 {
59 - DPRINTF(sc, "%s: " MAC_FMT " %s\n", dev_info,
60 + DPRINTF(sc, ATH_DEBUG_RATE, "%s: " MAC_FMT " %s\n", dev_info,
61 MAC_ADDR(an->an_node.ni_macaddr), __func__);
62 if (isnew)
63 ath_rate_ctl_reset(sc, &an->an_node);
64 @@ -601,7 +587,7 @@ ath_fill_sample_table(struct minstrel_no
65 p = rates + sprintf(rates, "rates :: %d ", column_index);
66 for (i = 0; i < num_sample_rates; i++)
67 p += sprintf(p, "%2u ", sn->rs_sampleTable[i][column_index]);
68 - DPRINTF(sc, "%s\n", rates);
69 + DPRINTF(sc, ATH_DEBUG_RATE, "%s\n", rates);
70 };
71 #endif
72 }
73 @@ -628,7 +614,7 @@ ath_rate_ctl_reset(struct ath_softc *sc,
74 sn->is_sampling = 0;
75
76 if (rt == NULL) {
77 - DPRINTF(sc, "no rates yet! mode %u\n", sc->sc_curmode);
78 + DPRINTF(sc, ATH_DEBUG_RATE, "no rates yet! mode %u\n", sc->sc_curmode);
79 return;
80 }
81 sn->static_rate_ndx = -1;
82 @@ -658,7 +644,7 @@ ath_rate_ctl_reset(struct ath_softc *sc,
83 sn->rates[x].rix = sc->sc_rixmap[sn->rates[x].rate];
84 }
85 if (sn->rates[x].rix == 0xff) {
86 - DPRINTF(sc, "%s: %s ignore bogus rix at %d\n",
87 + DPRINTF(sc, ATH_DEBUG_RATE, "%s: %s ignore bogus rix at %d\n",
88 dev_info, __func__, x);
89 continue;
90 }
91 @@ -673,7 +659,7 @@ ath_rate_ctl_reset(struct ath_softc *sc,
92 ni->ni_txrate = 0;
93
94 if (sn->num_rates <= 0) {
95 - DPRINTF(sc, "%s: %s " MAC_FMT " no rates (fixed %d) \n",
96 + DPRINTF(sc, ATH_DEBUG_RATE, "%s: %s " MAC_FMT " no rates (fixed %d) \n",
97 dev_info, __func__, MAC_ADDR(ni->ni_macaddr),
98 vap->iv_fixed_rate);
99 /* There are no rates yet; we're done */
100 @@ -689,23 +675,23 @@ ath_rate_ctl_reset(struct ath_softc *sc,
101 * the node. We know the rate is there because the
102 * rate set is checked when the station associates. */
103 /* NB: the rate set is assumed sorted */
104 - for (; (srate >= 0) && (ni->ni_rates.rs_rates[srate] & IEEE80211_RATE_VAL) != vap->iv_fixed_rate; srate--);
105 -
106 - KASSERT(srate >= 0,
107 - ("fixed rate %d not in rate set", vap->iv_fixed_rate));
108 + for (; (srate > 0) && (ni->ni_rates.rs_rates[srate] & IEEE80211_RATE_VAL) != vap->iv_fixed_rate; srate--);
109
110 sn->static_rate_ndx = srate;
111 ni->ni_txrate = srate;
112 - DPRINTF(sc, "%s: %s " MAC_FMT " fixed rate %d%sMbps\n",
113 - dev_info, __func__, MAC_ADDR(ni->ni_macaddr),
114 - sn->rates[srate].rate / 2,
115 - (sn->rates[srate].rate % 2) ? ".5 " : " ");
116 + if ((ni->ni_rates.rs_rates[srate] & IEEE80211_RATE_VAL) != vap->iv_fixed_rate)
117 + EPRINTF(sc, "Invalid static rate, falling back to basic rate\n");
118 + else
119 + DPRINTF(sc, ATH_DEBUG_RATE, "%s: %s " MAC_FMT " fixed rate %d%sMbps\n",
120 + dev_info, __func__, MAC_ADDR(ni->ni_macaddr),
121 + sn->rates[srate].rate / 2,
122 + (sn->rates[srate].rate % 2) ? ".5 " : " ");
123 return;
124 }
125
126 for (x = 0; x < ni->ni_rates.rs_nrates; x++) {
127 if (sn->rates[x].rix == 0xff) {
128 - DPRINTF(sc, "%s: %s ignore bogus rix at %d\n",
129 + DPRINTF(sc, ATH_DEBUG_RATE, "%s: %s ignore bogus rix at %d\n",
130 dev_info, __func__, x);
131 continue;
132 }
133 @@ -735,9 +721,9 @@ ath_rate_ctl_reset(struct ath_softc *sc,
134 }
135
136 #if 0
137 - DPRINTF(sc, "%s: Retry table for this node\n", __func__);
138 + DPRINTF(sc, ATH_DEBUG_RATE, "%s: Retry table for this node\n", __func__);
139 for (x = 0; x < ni->ni_rates.rs_nrates; x++)
140 - DPRINTF(sc, "%2d %2d %6d \n", x, sn->retry_count[x], sn->perfect_tx_time[x]);
141 + DPRINTF(sc, ATH_DEBUG_RATE, "%2d %2d %6d \n", x, sn->retry_count[x], sn->perfect_tx_time[x]);
142 #endif
143
144 /* Set the initial rate */
145 @@ -781,10 +767,10 @@ ath_timer_function(unsigned long data)
146 unsigned int interval = ath_timer_interval;
147
148 if (dev == NULL)
149 - DPRINTF(sc, "%s: 'dev' is null in this timer \n", __func__);
150 + DPRINTF(sc, ATH_DEBUG_RATE, "%s: 'dev' is null in this timer \n", __func__);
151
152 if (sc == NULL)
153 - DPRINTF(sc, "%s: 'sc' is null in this timer\n", __func__);
154 + DPRINTF(sc, ATH_DEBUG_RATE, "%s: 'sc' is null in this timer\n", __func__);
155
156 ic = &sc->sc_ic;
157
158 @@ -808,7 +794,7 @@ ath_timer_function(unsigned long data)
159
160 timer = &(ssc->timer);
161 if (timer == NULL)
162 - DPRINTF(sc, "%s: timer is null - leave it\n", __func__);
163 + DPRINTF(sc, ATH_DEBUG_RATE, "%s: timer is null - leave it\n", __func__);
164
165 timer->expires = jiffies + ((HZ * interval) / 1000);
166 add_timer(timer);
167 @@ -904,7 +890,7 @@ static struct ath_ratectrl *
168 ath_rate_attach(struct ath_softc *sc)
169 {
170 struct minstrel_softc *osc;
171 - DPRINTF(sc, "%s: %s\n", dev_info, __func__);
172 + DPRINTF(sc, ATH_DEBUG_RATE, "%s: %s\n", dev_info, __func__);
173
174 _MOD_INC_USE(THIS_MODULE, return NULL);
175 osc = kmalloc(sizeof(struct minstrel_softc), GFP_ATOMIC);
176 @@ -963,7 +949,7 @@ ath_proc_read_nodes(struct ieee80211vap
177 p += sprintf(p, "out of room for node " MAC_FMT "\n\n", MAC_ADDR(ni->ni_macaddr));
178 break;
179 }
180 - DPRINTF(sc, "%s: out of memeory to write tall of the nodes\n", __func__);
181 + DPRINTF(sc, ATH_DEBUG_RATE, "%s: out of memeory to write tall of the nodes\n", __func__);
182 break;
183 }
184 an = ATH_NODE(ni);
185 --- a/ath_rate/amrr/amrr.c
186 +++ b/ath_rate/amrr/amrr.c
187 @@ -64,24 +64,13 @@
188 #include <net80211/ieee80211_var.h>
189 #include <net80211/ieee80211_rate.h>
190
191 +#include "if_ath_debug.h"
192 #include "if_athvar.h"
193 #include "if_ath_hal.h"
194 #include "ah_desc.h"
195
196 #include "amrr.h"
197
198 -#ifdef AR_DEBUG
199 -#define AMRR_DEBUG
200 -#endif
201 -#ifdef AMRR_DEBUG
202 -#define DPRINTF(sc, _fmt, ...) do { \
203 - if (sc->sc_debug & 0x10) \
204 - printk(_fmt, __VA_ARGS__); \
205 -} while (0)
206 -#else
207 -#define DPRINTF(sc, _fmt, ...)
208 -#endif
209 -
210 static int ath_rateinterval = 1000; /* rate ctl interval (ms) */
211 static int ath_rate_max_success_threshold = 10;
212 static int ath_rate_min_success_threshold = 1;
213 @@ -197,7 +186,7 @@ ath_rate_update(struct ath_softc *sc, st
214
215 KASSERT(rt != NULL, ("no rate table, mode %u", sc->sc_curmode));
216
217 - DPRINTF(sc, "%s: set xmit rate for " MAC_FMT " to %dM\n",
218 + DPRINTF(sc, ATH_DEBUG_RATE, "%s: set xmit rate for " MAC_FMT " to %dM\n",
219 __func__, MAC_ADDR(ni->ni_macaddr),
220 ni->ni_rates.rs_nrates > 0 ?
221 (ni->ni_rates.rs_rates[rate] & IEEE80211_RATE_VAL) / 2 : 0);
222 @@ -297,9 +286,9 @@ ath_rate_ctl_start(struct ath_softc *sc,
223 * rate set is checked when the station associates.
224 */
225 srate = ni->ni_rates.rs_nrates - 1;
226 - for (; srate >= 0 && RATE(srate) != vap->iv_fixed_rate; srate--);
227 - KASSERT(srate >= 0,
228 - ("fixed rate %d not in rate set", vap->iv_fixed_rate));
229 + for (; srate > 0 && RATE(srate) != vap->iv_fixed_rate; srate--);
230 + if (RATE(srate) != vap->iv_fixed_rate)
231 + EPRINTF(sc, "Invalid static rate, falling back to basic rate\n");
232 }
233 ath_rate_update(sc, ni, srate);
234 #undef RATE
235 @@ -377,7 +366,7 @@ ath_rate_ctl(void *arg, struct ieee80211
236
237 old_rate = ni->ni_txrate;
238
239 - DPRINTF (sc, "cnt0: %d cnt1: %d cnt2: %d cnt3: %d -- threshold: %d\n",
240 + DPRINTF(sc, ATH_DEBUG_RATE, "cnt0: %d cnt1: %d cnt2: %d cnt3: %d -- threshold: %d\n",
241 amn->amn_tx_try0_cnt,
242 amn->amn_tx_try1_cnt,
243 amn->amn_tx_try2_cnt,
244 @@ -390,7 +379,7 @@ ath_rate_ctl(void *arg, struct ieee80211
245 amn->amn_recovery = 1;
246 amn->amn_success = 0;
247 ni->ni_txrate++;
248 - DPRINTF(sc, "increase rate to %d\n", ni->ni_txrate);
249 + DPRINTF(sc, ATH_DEBUG_RATE, "increase rate to %d\n", ni->ni_txrate);
250 } else
251 amn->amn_recovery = 0;
252 } else if (is_failure(amn)) {
253 @@ -401,12 +390,12 @@ ath_rate_ctl(void *arg, struct ieee80211
254 amn->amn_success_threshold *= 2;
255 amn->amn_success_threshold = min(amn->amn_success_threshold,
256 (u_int)ath_rate_max_success_threshold);
257 - DPRINTF(sc, "decrease rate recovery thr: %d\n",
258 + DPRINTF(sc, ATH_DEBUG_RATE, "decrease rate recovery thr: %d\n",
259 amn->amn_success_threshold);
260 } else {
261 /* simple failure. */
262 amn->amn_success_threshold = ath_rate_min_success_threshold;
263 - DPRINTF(sc, "decrease rate normal thr: %d\n",
264 + DPRINTF(sc, ATH_DEBUG_RATE, "decrease rate normal thr: %d\n",
265 amn->amn_success_threshold);
266 }
267 amn->amn_recovery = 0;
268 --- a/ath_rate/onoe/onoe.c
269 +++ b/ath_rate/onoe/onoe.c
270 @@ -60,27 +60,13 @@
271 #include <net80211/ieee80211_var.h>
272 #include <net80211/ieee80211_rate.h>
273
274 +#include "if_ath_debug.h"
275 #include "if_athvar.h"
276 #include "if_ath_hal.h"
277 #include "ah_desc.h"
278
279 #include "onoe.h"
280
281 -#ifdef AR_DEBUG
282 -#define ONOE_DEBUG
283 -#endif
284 -#ifdef ONOE_DEBUG
285 -enum {
286 - ATH_DEBUG_RATE = 0x00000010, /* rate control */
287 -};
288 -#define DPRINTF(sc, _fmt, ...) do { \
289 - if (sc->sc_debug & ATH_DEBUG_RATE) \
290 - printk(_fmt, __VA_ARGS__); \
291 -} while (0)
292 -#else
293 -#define DPRINTF(sc, _fmt, ...)
294 -#endif
295 -
296 /*
297 * Default parameters for the rate control algorithm. These are
298 * all tunable with sysctls. The rate controller runs periodically
299 @@ -186,7 +172,7 @@ ath_rate_update(struct ath_softc *sc, st
300
301 KASSERT(rt != NULL, ("no rate table, mode %u", sc->sc_curmode));
302
303 - DPRINTF(sc, "%s: set xmit rate for " MAC_FMT " to %dM\n",
304 + DPRINTF(sc, ATH_DEBUG_RATE, "%s: set xmit rate for " MAC_FMT " to %dM\n",
305 __func__, MAC_ADDR(ni->ni_macaddr),
306 ni->ni_rates.rs_nrates > 0 ?
307 (ni->ni_rates.rs_rates[rate] & IEEE80211_RATE_VAL) / 2 : 0);
308 @@ -283,9 +269,9 @@ ath_rate_ctl_start(struct ath_softc *sc,
309 */
310 /* NB: the rate set is assumed sorted */
311 srate = ni->ni_rates.rs_nrates - 1;
312 - for (; srate >= 0 && RATE(srate) != vap->iv_fixed_rate; srate--);
313 - KASSERT(srate >= 0,
314 - ("fixed rate %d not in rate set", vap->iv_fixed_rate));
315 + for (; srate > 0 && RATE(srate) != vap->iv_fixed_rate; srate--);
316 + if (RATE(srate) != vap->iv_fixed_rate)
317 + EPRINTF(sc, "Invalid static rate, falling back to basic rate\n");
318 }
319 ath_rate_update(sc, ni, srate);
320 #undef RATE
321 @@ -364,7 +350,7 @@ ath_rate_ctl(void *arg, struct ieee80211
322 on->on_tx_retr < (on->on_tx_ok * ath_rate_raise) / 100)
323 dir = 1;
324
325 - DPRINTF(sc, MAC_FMT ": ok %d err %d retr %d upper %d dir %d\n",
326 + DPRINTF(sc, ATH_DEBUG_RATE, MAC_FMT ": ok %d err %d retr %d upper %d dir %d\n",
327 MAC_ADDR(ni->ni_macaddr),
328 on->on_tx_ok, on->on_tx_err, on->on_tx_retr,
329 on->on_tx_upper, dir);
330 @@ -395,7 +381,7 @@ ath_rate_ctl(void *arg, struct ieee80211
331 }
332
333 if (nrate != ni->ni_txrate) {
334 - DPRINTF(sc, "%s: %dM -> %dM (%d ok, %d err, %d retr)\n",
335 + DPRINTF(sc, ATH_DEBUG_RATE, "%s: %dM -> %dM (%d ok, %d err, %d retr)\n",
336 __func__,
337 (rs->rs_rates[ni->ni_txrate] & IEEE80211_RATE_VAL) / 2,
338 (rs->rs_rates[nrate] & IEEE80211_RATE_VAL) / 2,
339 --- a/ath_rate/sample/sample.c
340 +++ b/ath_rate/sample/sample.c
341 @@ -62,30 +62,13 @@
342 #include <net80211/ieee80211_var.h>
343 #include <net80211/ieee80211_rate.h>
344
345 +#include "if_ath_debug.h"
346 #include "if_athvar.h"
347 #include "if_ath_hal.h"
348 #include "ah_desc.h"
349
350 #include "sample.h"
351
352 -#ifdef AR_DEBUG
353 -#define SAMPLE_DEBUG
354 -#endif
355 -#ifdef SAMPLE_DEBUG
356 -enum {
357 - ATH_DEBUG_RATE = 0x00000010, /* rate control */
358 - ATH_DEBUG_ANY = 0xffffffff
359 -};
360 -#define DPRINTF(sc, m, fmt, ...) do { \
361 - if (sc->sc_debug & (m)) \
362 - printk(fmt, __VA_ARGS__); \
363 -} while (0)
364 -#else
365 -#define DPRINTF(sc, m, fmt, ...) do { \
366 - (void) sc; \
367 -} while (0)
368 -#endif
369 -
370 /*
371 * This file is an implementation of the SampleRate algorithm
372 * in "Bit-rate Selection in Wireless Networks"
373 @@ -740,7 +723,7 @@ ath_rate_tx_complete(struct ath_softc *s
374 ndx[3] = rate_to_ndx(sn, rate[3]);
375
376 #if 0
377 - DPRINTF(sc, "%s: " MAC_FMT " size %u finaltsidx %u tries %u status %u rate/try %u/%u %u/%u %u/%u %u/%u\n",
378 + DPRINTF(sc, ATH_DEBUG_RATE, "%s: " MAC_FMT " size %u finaltsidx %u tries %u status %u rate/try %u/%u %u/%u %u/%u %u/%u\n",
379 dev_info, MAC_ADDR(an->an_node.ni_macaddr),
380 bin_to_size(size_to_bin(frame_size)),
381 finalTSIdx,
382 @@ -886,15 +869,16 @@ ath_rate_ctl_reset(struct ath_softc *sc,
383 if ((ni->ni_rates.rs_rates[x] & IEEE80211_RATE_VAL) == vap->iv_fixed_rate)
384 srate = x;
385
386 - KASSERT(((ni->ni_rates.rs_rates[srate] & IEEE80211_RATE_VAL) == vap->iv_fixed_rate),
387 - ("fixed rate %u not in rate set", vap->iv_fixed_rate));
388 -
389 sn->static_rate_ndx = srate;
390 ni->ni_txrate = srate;
391 - DPRINTF(sc, ATH_DEBUG_RATE, "%s: %s " MAC_FMT " fixed rate %u%sMbps\n",
392 - dev_info, __func__, MAC_ADDR(ni->ni_macaddr),
393 - sn->rates[srate].rate / 2,
394 - (sn->rates[srate].rate % 0x1) ? ".5" : " ");
395 +
396 + if ((ni->ni_rates.rs_rates[srate] & IEEE80211_RATE_VAL) != vap->iv_fixed_rate)
397 + EPRINTF(sc, "Invalid static rate, falling back to basic rate\n");
398 + else
399 + DPRINTF(sc, ATH_DEBUG_RATE, "%s: %s " MAC_FMT " fixed rate %u%sMbps\n",
400 + dev_info, __func__, MAC_ADDR(ni->ni_macaddr),
401 + sn->rates[srate].rate / 2,
402 + (sn->rates[srate].rate % 0x1) ? ".5" : " ");
403 return;
404 }
405
This page took 0.057817 seconds and 5 git commands to generate.