5 sc->sc_hasveol = ath_hal_hasveol(ah);
7 - /* Interference mitigation/ambient noise immunity (ANI).
8 - * In modes other than HAL_M_STA, it causes receive sensitivity
9 - * problems for OFDM. */
10 + /* Interference mitigation/ambient noise immunity (ANI). */
11 sc->sc_hasintmit = ath_hal_hasintmit(ah);
13 /* get mac address from hardware */
14 @@ -1144,6 +1142,11 @@
15 sc->sc_rp_lasttsf = 0;
18 + /* set all 3 to auto */
20 + sc->sc_noise_immunity = -1;
21 + sc->sc_ofdm_weak_det = -1;
25 ieee80211_ifdetach(ic);
26 @@ -2351,16 +2354,6 @@
28 if (status & HAL_INT_MIB) {
29 sc->sc_stats.ast_mib++;
30 - /* When the card receives lots of PHY errors, the MIB
31 - * interrupt will fire at a very rapid rate. We will use
32 - * a timer to enforce at least 1 jiffy delay between
33 - * MIB interrupts. This should be unproblematic, since
34 - * the hardware will continue to update the counters in
36 - sc->sc_imask &= ~HAL_INT_MIB;
37 - ath_hal_intrset(ah, sc->sc_imask);
38 - mod_timer(&sc->sc_mib_enable, jiffies + 1);
40 /* Let the HAL handle the event. */
41 ath_hal_mibevent(ah, &sc->sc_halstats);
43 @@ -2430,6 +2423,43 @@
47 +static int ath_setintmit(struct ath_softc *sc)
49 + struct ath_hal *ah = sc->sc_ah;
53 + if (!sc->sc_hasintmit)
56 + switch(sc->sc_intmit) {
58 + if (sc->sc_opmode != IEEE80211_M_MONITOR)
63 + case 0: /* disabled */
64 + case 1: /* enabled */
65 + val = sc->sc_intmit;
70 + ret = ath_hal_setintmit(ah, val);
74 + /* manual settings */
75 + if ((sc->sc_noise_immunity >= 0) && (sc->sc_noise_immunity <= 5))
76 + ath_hal_setcapability(ah, HAL_CAP_INTMIT, 2, sc->sc_noise_immunity, NULL);
77 + if ((sc->sc_ofdm_weak_det == 0) || (sc->sc_ofdm_weak_det == 1))
78 + ath_hal_setcapability(ah, HAL_CAP_INTMIT, 3, sc->sc_ofdm_weak_det, NULL);
85 * Context: process context
89 ath_hal_gpioCfgOutput(ah, sc->sc_ledpin);
91 - if ((sc->sc_opmode != HAL_M_STA) && sc->sc_hasintmit)
92 - ath_hal_setintmit(ah, 0);
96 * This is needed only to setup initial state
98 * Enable MIB interrupts when there are hardware phy counters.
99 * Note we only do this (at the moment) for station mode.
101 - if (sc->sc_needmib && ic->ic_opmode == IEEE80211_M_STA)
102 + if (sc->sc_needmib && ath_hal_getintmit(ah, NULL))
103 sc->sc_imask |= HAL_INT_MIB;
104 ath_hal_intrset(ah, sc->sc_imask);
106 @@ -2789,9 +2818,7 @@
107 EPRINTF(sc, "Unable to reset hardware: '%s' (HAL status %u)\n",
108 ath_get_hal_status_desc(status), status);
110 - if ((sc->sc_opmode != HAL_M_STA) && sc->sc_hasintmit)
111 - ath_hal_setintmit(ah, 0);
114 ath_update_txpow(sc); /* update tx power state */
115 ath_radar_update(sc);
116 ath_setdefantenna(sc, sc->sc_defant);
117 @@ -4176,6 +4203,8 @@
118 if (sc->sc_nmonvaps > 0)
119 rfilt |= (HAL_RX_FILTER_CONTROL | HAL_RX_FILTER_BEACON |
120 HAL_RX_FILTER_PROBEREQ | HAL_RX_FILTER_PROM);
121 + if (sc->sc_hasintmit && !sc->sc_needmib && ath_hal_getintmit(ah, NULL))
122 + rfilt |= HAL_RX_FILTER_PHYERR;
123 if (sc->sc_curchan.privFlags & CHANNEL_DFS)
124 rfilt |= (HAL_RX_FILTER_PHYERR | HAL_RX_FILTER_PHYRADAR);
126 @@ -6526,9 +6555,6 @@
129 len = rs->rs_datalen;
130 - /* DMA sync. dies spectacularly if len == 0 */
136 @@ -8880,9 +8906,7 @@
138 ath_hal_gpioCfgOutput(ah, sc->sc_ledpin);
140 - if ((sc->sc_opmode != HAL_M_STA) && sc->sc_hasintmit)
141 - ath_hal_setintmit(ah, 0);
144 sc->sc_curchan = hchan;
145 ath_update_txpow(sc); /* update tx power state */
146 ath_radar_update(sc);
147 @@ -10659,9 +10683,54 @@
149 ATH_RADAR_IGNORED = 25,
152 + ATH_NOISE_IMMUNITY = 28,
153 + ATH_OFDM_WEAK_DET = 29
157 +ath_sysctl_set_intmit(struct ath_softc *sc, long ctl, u_int val)
163 + sc->sc_intmit = val;
165 + case ATH_NOISE_IMMUNITY:
166 + sc->sc_noise_immunity = val;
168 + case ATH_OFDM_WEAK_DET:
169 + sc->sc_ofdm_weak_det = val;
174 + ret = ath_setintmit(sc);
175 + ath_calcrxfilter(sc);
180 +ath_sysctl_get_intmit(struct ath_softc *sc, long ctl, u_int *val)
182 + struct ath_hal *ah = sc->sc_ah;
186 + *val = (ath_hal_getcapability(ah, HAL_CAP_INTMIT, 1, NULL) == HAL_OK);
188 + case ATH_NOISE_IMMUNITY:
189 + return ath_hal_getcapability(ah, HAL_CAP_INTMIT, 2, val);
190 + case ATH_OFDM_WEAK_DET:
191 + return ath_hal_getcapability(ah, HAL_CAP_INTMIT, 3, val);
199 ATH_SYSCTL_DECL(ath_sysctl_halparam, ctl, write, filp, buffer, lenp, ppos)
201 struct ath_softc *sc = ctl->extra1;
202 @@ -10847,6 +10916,11 @@
203 case ATH_RADAR_IGNORED:
204 sc->sc_radar_ignored = val;
207 + case ATH_NOISE_IMMUNITY:
208 + case ATH_OFDM_WEAK_DET:
209 + ret = ath_sysctl_set_intmit(sc, (long)ctl->extra2, val);
214 @@ -10913,6 +10987,11 @@
215 case ATH_RADAR_IGNORED:
216 val = sc->sc_radar_ignored;
219 + case ATH_NOISE_IMMUNITY:
220 + case ATH_OFDM_WEAK_DET:
221 + ret = ath_sysctl_get_intmit(sc, (long)ctl->extra2, &val);
226 @@ -11090,6 +11169,24 @@
227 .proc_handler = ath_sysctl_halparam,
228 .extra2 = (void *)ATH_RADAR_IGNORED,
230 + { .ctl_name = CTL_AUTO,
231 + .procname = "intmit",
233 + .proc_handler = ath_sysctl_halparam,
234 + .extra2 = (void *)ATH_INTMIT,
236 + { .ctl_name = CTL_AUTO,
237 + .procname = "noise_immunity",
239 + .proc_handler = ath_sysctl_halparam,
240 + .extra2 = (void *)ATH_NOISE_IMMUNITY,
242 + { .ctl_name = CTL_AUTO,
243 + .procname = "ofdm_weak_det",
245 + .proc_handler = ath_sysctl_halparam,
246 + .extra2 = (void *)ATH_OFDM_WEAK_DET,
251 --- a/ath/if_athvar.h
252 +++ b/ath/if_athvar.h
254 unsigned int sc_txcont_power; /* Continuous transmit power in 0.5dBm units */
255 unsigned int sc_txcont_rate; /* Continuous transmit rate in Mbps */
257 + int8_t sc_intmit; /* Interference mitigation enabled, -1 = auto, based on mode, 0/1 = off/on */
258 + int8_t sc_noise_immunity; /* Noise immunity level, 0-4, -1 == auto) */
259 + int8_t sc_ofdm_weak_det; /* OFDM weak frames detection, -1 == auto */
262 const HAL_RATE_TABLE *sc_rates[IEEE80211_MODE_MAX];
263 const HAL_RATE_TABLE *sc_currates; /* current rate table */
264 --- a/ath/if_ath_hal.h
265 +++ b/ath/if_ath_hal.h
268 static inline HAL_BOOL ath_hal_getdiagstate(struct ath_hal *ah, int request,
269 const void *args, u_int32_t argsize,
272 u_int32_t *resultsize)
275 ATH_HAL_LOCK_IRQ(ah->ah_sc);
276 ath_hal_set_function(__func__);
278 - ah->ah_getDiagState(ah, request, args, argsize, *result,
279 + ah->ah_getDiagState(ah, request, args, argsize, result,
281 ath_hal_set_function(NULL);
282 ATH_HAL_UNLOCK_IRQ(ah->ah_sc);