1 --- a/drivers/net/wireless/ath/ath9k/ani.h
2 +++ b/drivers/net/wireless/ath/ath9k/ani.h
4 #define BEACON_RSSI(ahp) (ahp->stats.avgbrssi)
6 /* units are errors per second */
7 -#define ATH9K_ANI_OFDM_TRIG_HIGH 1000
8 +#define ATH9K_ANI_OFDM_TRIG_HIGH 3500
9 +#define ATH9K_ANI_OFDM_TRIG_HIGH_BELOW_INI 1000
11 #define ATH9K_ANI_OFDM_TRIG_LOW 400
12 +#define ATH9K_ANI_OFDM_TRIG_LOW_ABOVE_INI 900
14 #define ATH9K_ANI_CCK_TRIG_HIGH 600
15 #define ATH9K_ANI_CCK_TRIG_LOW 300
17 --- a/drivers/net/wireless/ath/ath9k/ani.c
18 +++ b/drivers/net/wireless/ath/ath9k/ani.c
19 @@ -177,14 +177,17 @@ static void ath9k_hw_set_ofdm_nil(struct
20 BEACON_RSSI(ah) <= ATH9K_ANI_RSSI_THR_HIGH)
24 - * OFDM Weak signal detection is always enabled for AP mode.
26 - if (ah->opmode != NL80211_IFTYPE_AP &&
27 - aniState->ofdmWeakSigDetect != weak_sig) {
28 - ath9k_hw_ani_control(ah,
29 - ATH9K_ANI_OFDM_WEAK_SIGNAL_DETECTION,
30 - entry_ofdm->ofdm_weak_signal_on);
31 + if (aniState->ofdmWeakSigDetect != weak_sig)
32 + ath9k_hw_ani_control(ah,
33 + ATH9K_ANI_OFDM_WEAK_SIGNAL_DETECTION,
34 + entry_ofdm->ofdm_weak_signal_on);
36 + if (aniState->ofdmNoiseImmunityLevel >= ATH9K_ANI_OFDM_DEF_LEVEL) {
37 + ah->config.ofdm_trig_high = ATH9K_ANI_OFDM_TRIG_HIGH;
38 + ah->config.ofdm_trig_low = ATH9K_ANI_OFDM_TRIG_LOW_ABOVE_INI;
40 + ah->config.ofdm_trig_high = ATH9K_ANI_OFDM_TRIG_HIGH_BELOW_INI;
41 + ah->config.ofdm_trig_low = ATH9K_ANI_OFDM_TRIG_LOW;
45 @@ -420,25 +423,12 @@ void ath9k_hw_ani_monitor(struct ath_hw
46 ofdmPhyErrRate, aniState->cckNoiseImmunityLevel,
47 cckPhyErrRate, aniState->ofdmsTurn);
49 - if (aniState->listenTime > 5 * ah->aniperiod) {
51 - * Check if we need to lower immunity if
52 - * 5 ani_periods have passed.
54 - if (ofdmPhyErrRate <= ah->config.ofdm_trig_low &&
55 - cckPhyErrRate <= ah->config.cck_trig_low) {
56 + if (aniState->listenTime > ah->aniperiod) {
57 + if (cckPhyErrRate < ah->config.cck_trig_low &&
58 + ofdmPhyErrRate < ah->config.ofdm_trig_low) {
59 ath9k_hw_ani_lower_immunity(ah);
60 aniState->ofdmsTurn = !aniState->ofdmsTurn;
62 - ath9k_ani_restart(ah);
63 - } else if (aniState->listenTime > ah->aniperiod) {
65 - * Check if immunity has to be raised,
66 - * (either OFDM or CCK).
68 - if (ofdmPhyErrRate > ah->config.ofdm_trig_high &&
69 - (cckPhyErrRate <= ah->config.cck_trig_high ||
70 - aniState->ofdmsTurn)) {
71 + } else if (ofdmPhyErrRate > ah->config.ofdm_trig_high) {
72 ath9k_hw_ani_ofdm_err_trigger(ah);
73 aniState->ofdmsTurn = false;
74 } else if (cckPhyErrRate > ah->config.cck_trig_high) {