1 Index: madwifi-trunk-r3314/ath/if_ath.c
2 ===================================================================
3 --- madwifi-trunk-r3314.orig/ath/if_ath.c 2008-06-13 10:39:28.000000000 +0200
4 +++ madwifi-trunk-r3314/ath/if_ath.c 2008-06-13 10:39:54.000000000 +0200
7 sc->sc_hasveol = ath_hal_hasveol(ah);
9 - /* Interference mitigation/ambient noise immunity (ANI).
10 - * In modes other than HAL_M_STA, it causes receive sensitivity
11 - * problems for OFDM. */
12 + /* Interference mitigation/ambient noise immunity (ANI). */
13 sc->sc_hasintmit = ath_hal_hasintmit(ah);
15 /* get mac address from hardware */
16 @@ -1144,6 +1142,11 @@
17 sc->sc_rp_lasttsf = 0;
20 + /* set all 3 to auto */
22 + sc->sc_noise_immunity = -1;
23 + sc->sc_ofdm_weak_det = -1;
27 ieee80211_ifdetach(ic);
28 @@ -2347,16 +2350,6 @@
30 if (status & HAL_INT_MIB) {
31 sc->sc_stats.ast_mib++;
32 - /* When the card receives lots of PHY errors, the MIB
33 - * interrupt will fire at a very rapid rate. We will use
34 - * a timer to enforce at least 1 jiffy delay between
35 - * MIB interrupts. This should be unproblematic, since
36 - * the hardware will continue to update the counters in
38 - sc->sc_imask &= ~HAL_INT_MIB;
39 - ath_hal_intrset(ah, sc->sc_imask);
40 - mod_timer(&sc->sc_mib_enable, jiffies + 1);
42 /* Let the HAL handle the event. */
43 ath_hal_mibevent(ah, &sc->sc_halstats);
45 @@ -2426,6 +2419,43 @@
49 +static int ath_setintmit(struct ath_softc *sc)
51 + struct ath_hal *ah = sc->sc_ah;
55 + if (!sc->sc_hasintmit)
58 + switch(sc->sc_intmit) {
60 + if (sc->sc_opmode != IEEE80211_M_MONITOR)
65 + case 0: /* disabled */
66 + case 1: /* enabled */
67 + val = sc->sc_intmit;
72 + ret = ath_hal_setintmit(ah, val);
76 + /* manual settings */
77 + if ((sc->sc_noise_immunity >= 0) && (sc->sc_noise_immunity <= 5))
78 + ath_hal_setcapability(ah, HAL_CAP_INTMIT, 2, sc->sc_noise_immunity, NULL);
79 + if ((sc->sc_ofdm_weak_det == 0) || (sc->sc_ofdm_weak_det == 1))
80 + ath_hal_setcapability(ah, HAL_CAP_INTMIT, 3, sc->sc_ofdm_weak_det, NULL);
87 * Context: process context
91 ath_hal_gpioCfgOutput(ah, sc->sc_ledpin);
93 - if ((sc->sc_opmode != HAL_M_STA) && sc->sc_hasintmit)
94 - ath_hal_setintmit(ah, 0);
98 * This is needed only to setup initial state
100 * Enable MIB interrupts when there are hardware phy counters.
101 * Note we only do this (at the moment) for station mode.
103 - if (sc->sc_needmib && ic->ic_opmode == IEEE80211_M_STA)
104 + if (sc->sc_needmib && ath_hal_getintmit(ah, NULL))
105 sc->sc_imask |= HAL_INT_MIB;
106 ath_hal_intrset(ah, sc->sc_imask);
108 @@ -2785,9 +2814,7 @@
109 EPRINTF(sc, "Unable to reset hardware: '%s' (HAL status %u)\n",
110 ath_get_hal_status_desc(status), status);
112 - if ((sc->sc_opmode != HAL_M_STA) && sc->sc_hasintmit)
113 - ath_hal_setintmit(ah, 0);
116 ath_update_txpow(sc); /* update tx power state */
117 ath_radar_update(sc);
118 ath_setdefantenna(sc, sc->sc_defant);
119 @@ -4165,6 +4192,8 @@
120 if (sc->sc_nmonvaps > 0)
121 rfilt |= (HAL_RX_FILTER_CONTROL | HAL_RX_FILTER_BEACON |
122 HAL_RX_FILTER_PROBEREQ | HAL_RX_FILTER_PROM);
123 + if (sc->sc_hasintmit && !sc->sc_needmib && ath_hal_getintmit(ah, NULL))
124 + rfilt |= HAL_RX_FILTER_PHYERR;
125 if (sc->sc_curchan.privFlags & CHANNEL_DFS)
126 rfilt |= (HAL_RX_FILTER_PHYERR | HAL_RX_FILTER_PHYRADAR);
128 @@ -6513,9 +6542,6 @@
131 len = rs->rs_datalen;
132 - /* DMA sync. dies spectacularly if len == 0 */
138 @@ -8865,9 +8891,7 @@
140 ath_hal_gpioCfgOutput(ah, sc->sc_ledpin);
142 - if ((sc->sc_opmode != HAL_M_STA) && sc->sc_hasintmit)
143 - ath_hal_setintmit(ah, 0);
146 sc->sc_curchan = hchan;
147 ath_update_txpow(sc); /* update tx power state */
148 ath_radar_update(sc);
149 @@ -10644,9 +10668,54 @@
151 ATH_RADAR_IGNORED = 25,
154 + ATH_NOISE_IMMUNITY = 28,
155 + ATH_OFDM_WEAK_DET = 29
159 +ath_sysctl_set_intmit(struct ath_softc *sc, long ctl, u_int val)
165 + sc->sc_intmit = val;
167 + case ATH_NOISE_IMMUNITY:
168 + sc->sc_noise_immunity = val;
170 + case ATH_OFDM_WEAK_DET:
171 + sc->sc_ofdm_weak_det = val;
176 + ret = ath_setintmit(sc);
177 + ath_calcrxfilter(sc);
182 +ath_sysctl_get_intmit(struct ath_softc *sc, long ctl, u_int *val)
184 + struct ath_hal *ah = sc->sc_ah;
188 + *val = (ath_hal_getcapability(ah, HAL_CAP_INTMIT, 1, NULL) == HAL_OK);
190 + case ATH_NOISE_IMMUNITY:
191 + return ath_hal_getcapability(ah, HAL_CAP_INTMIT, 2, val);
192 + case ATH_OFDM_WEAK_DET:
193 + return ath_hal_getcapability(ah, HAL_CAP_INTMIT, 3, val);
201 ATH_SYSCTL_DECL(ath_sysctl_halparam, ctl, write, filp, buffer, lenp, ppos)
203 struct ath_softc *sc = ctl->extra1;
204 @@ -10832,6 +10901,11 @@
205 case ATH_RADAR_IGNORED:
206 sc->sc_radar_ignored = val;
209 + case ATH_NOISE_IMMUNITY:
210 + case ATH_OFDM_WEAK_DET:
211 + ret = ath_sysctl_set_intmit(sc, (long)ctl->extra2, val);
216 @@ -10898,6 +10972,11 @@
217 case ATH_RADAR_IGNORED:
218 val = sc->sc_radar_ignored;
221 + case ATH_NOISE_IMMUNITY:
222 + case ATH_OFDM_WEAK_DET:
223 + ret = ath_sysctl_get_intmit(sc, (long)ctl->extra2, &val);
228 @@ -11075,6 +11154,24 @@
229 .proc_handler = ath_sysctl_halparam,
230 .extra2 = (void *)ATH_RADAR_IGNORED,
232 + { .ctl_name = CTL_AUTO,
233 + .procname = "intmit",
235 + .proc_handler = ath_sysctl_halparam,
236 + .extra2 = (void *)ATH_INTMIT,
238 + { .ctl_name = CTL_AUTO,
239 + .procname = "noise_immunity",
241 + .proc_handler = ath_sysctl_halparam,
242 + .extra2 = (void *)ATH_NOISE_IMMUNITY,
244 + { .ctl_name = CTL_AUTO,
245 + .procname = "ofdm_weak_det",
247 + .proc_handler = ath_sysctl_halparam,
248 + .extra2 = (void *)ATH_OFDM_WEAK_DET,
253 Index: madwifi-trunk-r3314/ath/if_athvar.h
254 ===================================================================
255 --- madwifi-trunk-r3314.orig/ath/if_athvar.h 2008-06-13 10:39:28.000000000 +0200
256 +++ madwifi-trunk-r3314/ath/if_athvar.h 2008-06-13 10:39:32.000000000 +0200
258 unsigned int sc_txcont_power; /* Continuous transmit power in 0.5dBm units */
259 unsigned int sc_txcont_rate; /* Continuous transmit rate in Mbps */
261 + int8_t sc_intmit; /* Interference mitigation enabled, -1 = auto, based on mode, 0/1 = off/on */
262 + int8_t sc_noise_immunity; /* Noise immunity level, 0-4, -1 == auto) */
263 + int8_t sc_ofdm_weak_det; /* OFDM weak frames detection, -1 == auto */
266 const HAL_RATE_TABLE *sc_rates[IEEE80211_MODE_MAX];
267 const HAL_RATE_TABLE *sc_currates; /* current rate table */
268 Index: madwifi-trunk-r3314/ath/if_ath_hal.h
269 ===================================================================
270 --- madwifi-trunk-r3314.orig/ath/if_ath_hal.h 2008-06-13 10:39:26.000000000 +0200
271 +++ madwifi-trunk-r3314/ath/if_ath_hal.h 2008-06-13 10:39:32.000000000 +0200
274 static inline HAL_BOOL ath_hal_getdiagstate(struct ath_hal *ah, int request,
275 const void *args, u_int32_t argsize,
278 u_int32_t *resultsize)
281 ATH_HAL_LOCK_IRQ(ah->ah_sc);
282 ath_hal_set_function(__func__);
284 - ah->ah_getDiagState(ah, request, args, argsize, *result,
285 + ah->ah_getDiagState(ah, request, args, argsize, result,
287 ath_hal_set_function(NULL);
288 ATH_HAL_UNLOCK_IRQ(ah->ah_sc);