1 --- a/ath_rate/minstrel/minstrel.c
2 +++ b/ath_rate/minstrel/minstrel.c
4 #include <net80211/ieee80211_var.h>
5 #include <net80211/ieee80211_rate.h>
7 +#include "if_ath_debug.h"
9 #include "if_ath_hal.h"
15 -#define MINSTREL_DEBUG
17 -#ifdef MINSTREL_DEBUG
19 - ATH_DEBUG_RATE = 0x00000010 /* rate control */
21 -#define DPRINTF(sc, _fmt, ...) do { \
22 - if (sc->sc_debug & ATH_DEBUG_RATE) \
23 - printk(_fmt, __VA_ARGS__); \
26 -#define DPRINTF(sc, _fmt, ...)
29 #define ONE_SECOND (1000 * 1000) /* 1 second, or 1000 milliseconds; eternity, in other words */
33 * the node. We know the rate is there because the
34 * rate set is checked when the station associates. */
35 /* NB: the rate set is assumed sorted */
36 - for (; (srate >= 0) && (ni->ni_rates.rs_rates[srate] & IEEE80211_RATE_VAL) != vap->iv_fixed_rate; srate--);
39 - ("fixed rate %d not in rate set", vap->iv_fixed_rate));
40 + for (; (srate > 0) && (ni->ni_rates.rs_rates[srate] & IEEE80211_RATE_VAL) != vap->iv_fixed_rate; srate--);
42 sn->static_rate_ndx = srate;
43 ni->ni_txrate = srate;
44 - DPRINTF(sc, "%s: %s " MAC_FMT " fixed rate %d%sMbps\n",
45 - dev_info, __func__, MAC_ADDR(ni->ni_macaddr),
46 - sn->rates[srate].rate / 2,
47 - (sn->rates[srate].rate % 2) ? ".5 " : " ");
48 + if ((ni->ni_rates.rs_rates[srate] & IEEE80211_RATE_VAL) != vap->iv_fixed_rate)
49 + EPRINTF(sc, "Invalid static rate, falling back to basic rate\n");
51 + DPRINTF(sc, "%s: %s " MAC_FMT " fixed rate %d%sMbps\n",
52 + dev_info, __func__, MAC_ADDR(ni->ni_macaddr),
53 + sn->rates[srate].rate / 2,
54 + (sn->rates[srate].rate % 2) ? ".5 " : " ");
58 --- a/ath_rate/amrr/amrr.c
59 +++ b/ath_rate/amrr/amrr.c
61 #include <net80211/ieee80211_var.h>
62 #include <net80211/ieee80211_rate.h>
64 +#include "if_ath_debug.h"
65 #include "if_athvar.h"
66 #include "if_ath_hal.h"
75 -#define DPRINTF(sc, _fmt, ...) do { \
76 - if (sc->sc_debug & 0x10) \
77 - printk(_fmt, __VA_ARGS__); \
80 -#define DPRINTF(sc, _fmt, ...)
83 static int ath_rateinterval = 1000; /* rate ctl interval (ms) */
84 static int ath_rate_max_success_threshold = 10;
85 static int ath_rate_min_success_threshold = 1;
87 * rate set is checked when the station associates.
89 srate = ni->ni_rates.rs_nrates - 1;
90 - for (; srate >= 0 && RATE(srate) != vap->iv_fixed_rate; srate--);
92 - ("fixed rate %d not in rate set", vap->iv_fixed_rate));
93 + for (; srate > 0 && RATE(srate) != vap->iv_fixed_rate; srate--);
94 + if (RATE(srate) != vap->iv_fixed_rate)
95 + EPRINTF(sc, "Invalid static rate, falling back to basic rate\n");
97 ath_rate_update(sc, ni, srate);
99 --- a/ath_rate/onoe/onoe.c
100 +++ b/ath_rate/onoe/onoe.c
102 #include <net80211/ieee80211_var.h>
103 #include <net80211/ieee80211_rate.h>
105 +#include "if_ath_debug.h"
106 #include "if_athvar.h"
107 #include "if_ath_hal.h"
117 - ATH_DEBUG_RATE = 0x00000010, /* rate control */
119 -#define DPRINTF(sc, _fmt, ...) do { \
120 - if (sc->sc_debug & ATH_DEBUG_RATE) \
121 - printk(_fmt, __VA_ARGS__); \
124 -#define DPRINTF(sc, _fmt, ...)
128 * Default parameters for the rate control algorithm. These are
129 * all tunable with sysctls. The rate controller runs periodically
132 /* NB: the rate set is assumed sorted */
133 srate = ni->ni_rates.rs_nrates - 1;
134 - for (; srate >= 0 && RATE(srate) != vap->iv_fixed_rate; srate--);
135 - KASSERT(srate >= 0,
136 - ("fixed rate %d not in rate set", vap->iv_fixed_rate));
137 + for (; srate > 0 && RATE(srate) != vap->iv_fixed_rate; srate--);
138 + if (RATE(srate) != vap->iv_fixed_rate)
139 + EPRINTF(sc, "Invalid static rate, falling back to basic rate\n");
141 ath_rate_update(sc, ni, srate);
143 --- a/ath_rate/sample/sample.c
144 +++ b/ath_rate/sample/sample.c
146 #include <net80211/ieee80211_var.h>
147 #include <net80211/ieee80211_rate.h>
149 +#include "if_ath_debug.h"
150 #include "if_athvar.h"
151 #include "if_ath_hal.h"
157 -#define SAMPLE_DEBUG
161 - ATH_DEBUG_RATE = 0x00000010, /* rate control */
162 - ATH_DEBUG_ANY = 0xffffffff
164 -#define DPRINTF(sc, m, fmt, ...) do { \
165 - if (sc->sc_debug & (m)) \
166 - printk(fmt, __VA_ARGS__); \
169 -#define DPRINTF(sc, m, fmt, ...) do { \
175 * This file is an implementation of the SampleRate algorithm
176 * in "Bit-rate Selection in Wireless Networks"
177 @@ -886,15 +869,16 @@
178 if ((ni->ni_rates.rs_rates[x] & IEEE80211_RATE_VAL) == vap->iv_fixed_rate)
181 - KASSERT(((ni->ni_rates.rs_rates[srate] & IEEE80211_RATE_VAL) == vap->iv_fixed_rate),
182 - ("fixed rate %u not in rate set", vap->iv_fixed_rate));
184 sn->static_rate_ndx = srate;
185 ni->ni_txrate = srate;
186 - DPRINTF(sc, ATH_DEBUG_RATE, "%s: %s " MAC_FMT " fixed rate %u%sMbps\n",
187 - dev_info, __func__, MAC_ADDR(ni->ni_macaddr),
188 - sn->rates[srate].rate / 2,
189 - (sn->rates[srate].rate % 0x1) ? ".5" : " ");
191 + if ((ni->ni_rates.rs_rates[srate] & IEEE80211_RATE_VAL) != vap->iv_fixed_rate)
192 + EPRINTF(sc, "Invalid static rate, falling back to basic rate\n");
194 + DPRINTF(sc, ATH_DEBUG_RATE, "%s: %s " MAC_FMT " fixed rate %u%sMbps\n",
195 + dev_info, __func__, MAC_ADDR(ni->ni_macaddr),
196 + sn->rates[srate].rate / 2,
197 + (sn->rates[srate].rate % 0x1) ? ".5" : " ");