libubox: update to latest version, fixes timer/process deletion on uloop_done()
[openwrt.git] / package / mac80211 / patches / 564-ath9k_fix_ani_update.patch
1 --- a/drivers/net/wireless/ath/ath9k/ani.c
2 +++ b/drivers/net/wireless/ath/ath9k/ani.c
3 @@ -140,7 +140,8 @@ static void ath9k_ani_restart(struct ath
4  }
5  
6  /* Adjust the OFDM Noise Immunity Level */
7 -static void ath9k_hw_set_ofdm_nil(struct ath_hw *ah, u8 immunityLevel)
8 +static void ath9k_hw_set_ofdm_nil(struct ath_hw *ah, u8 immunityLevel,
9 +                                 bool scan)
10  {
11         struct ar5416AniState *aniState = &ah->curchan->ani;
12         struct ath_common *common = ath9k_hw_common(ah);
13 @@ -153,7 +154,7 @@ static void ath9k_hw_set_ofdm_nil(struct
14                 immunityLevel, BEACON_RSSI(ah),
15                 aniState->rssiThrLow, aniState->rssiThrHigh);
16  
17 -       if (aniState->update_ani)
18 +       if (!scan)
19                 aniState->ofdmNoiseImmunityLevel = immunityLevel;
20  
21         entry_ofdm = &ofdm_level_table[aniState->ofdmNoiseImmunityLevel];
22 @@ -199,13 +200,14 @@ static void ath9k_hw_ani_ofdm_err_trigge
23         aniState = &ah->curchan->ani;
24  
25         if (aniState->ofdmNoiseImmunityLevel < ATH9K_ANI_OFDM_MAX_LEVEL)
26 -               ath9k_hw_set_ofdm_nil(ah, aniState->ofdmNoiseImmunityLevel + 1);
27 +               ath9k_hw_set_ofdm_nil(ah, aniState->ofdmNoiseImmunityLevel + 1, false);
28  }
29  
30  /*
31   * Set the ANI settings to match an CCK level.
32   */
33 -static void ath9k_hw_set_cck_nil(struct ath_hw *ah, u_int8_t immunityLevel)
34 +static void ath9k_hw_set_cck_nil(struct ath_hw *ah, u_int8_t immunityLevel,
35 +                                bool scan)
36  {
37         struct ar5416AniState *aniState = &ah->curchan->ani;
38         struct ath_common *common = ath9k_hw_common(ah);
39 @@ -222,7 +224,7 @@ static void ath9k_hw_set_cck_nil(struct 
40             immunityLevel > ATH9K_ANI_CCK_MAX_LEVEL_LOW_RSSI)
41                 immunityLevel = ATH9K_ANI_CCK_MAX_LEVEL_LOW_RSSI;
42  
43 -       if (aniState->update_ani)
44 +       if (!scan)
45                 aniState->cckNoiseImmunityLevel = immunityLevel;
46  
47         entry_ofdm = &ofdm_level_table[aniState->ofdmNoiseImmunityLevel];
48 @@ -254,7 +256,8 @@ static void ath9k_hw_ani_cck_err_trigger
49         aniState = &ah->curchan->ani;
50  
51         if (aniState->cckNoiseImmunityLevel < ATH9K_ANI_CCK_MAX_LEVEL)
52 -               ath9k_hw_set_cck_nil(ah, aniState->cckNoiseImmunityLevel + 1);
53 +               ath9k_hw_set_cck_nil(ah, aniState->cckNoiseImmunityLevel + 1,
54 +                                    false);
55  }
56  
57  /*
58 @@ -270,13 +273,15 @@ static void ath9k_hw_ani_lower_immunity(
59         /* lower OFDM noise immunity */
60         if (aniState->ofdmNoiseImmunityLevel > 0 &&
61             (aniState->ofdmsTurn || aniState->cckNoiseImmunityLevel == 0)) {
62 -               ath9k_hw_set_ofdm_nil(ah, aniState->ofdmNoiseImmunityLevel - 1);
63 +               ath9k_hw_set_ofdm_nil(ah, aniState->ofdmNoiseImmunityLevel - 1,
64 +                                     false);
65                 return;
66         }
67  
68         /* lower CCK noise immunity */
69         if (aniState->cckNoiseImmunityLevel > 0)
70 -               ath9k_hw_set_cck_nil(ah, aniState->cckNoiseImmunityLevel - 1);
71 +               ath9k_hw_set_cck_nil(ah, aniState->cckNoiseImmunityLevel - 1,
72 +                                    false);
73  }
74  
75  /*
76 @@ -338,7 +343,6 @@ void ath9k_ani_reset(struct ath_hw *ah, 
77                                 aniState->ofdmNoiseImmunityLevel,
78                                 aniState->cckNoiseImmunityLevel);
79  
80 -                       aniState->update_ani = false;
81                         ofdm_nil = ATH9K_ANI_OFDM_DEF_LEVEL;
82                         cck_nil = ATH9K_ANI_CCK_DEF_LEVEL;
83                 }
84 @@ -354,11 +358,9 @@ void ath9k_ani_reset(struct ath_hw *ah, 
85                         is_scanning,
86                         aniState->ofdmNoiseImmunityLevel,
87                         aniState->cckNoiseImmunityLevel);
88 -
89 -                       aniState->update_ani = true;
90         }
91 -       ath9k_hw_set_ofdm_nil(ah, ofdm_nil);
92 -       ath9k_hw_set_cck_nil(ah, cck_nil);
93 +       ath9k_hw_set_ofdm_nil(ah, ofdm_nil, is_scanning);
94 +       ath9k_hw_set_cck_nil(ah, cck_nil, is_scanning);
95  
96         /*
97          * enable phy counters if hw supports or if not, enable phy
98 @@ -538,7 +540,6 @@ void ath9k_hw_ani_init(struct ath_hw *ah
99                 ani->ofdmWeakSigDetect = ATH9K_ANI_USE_OFDM_WEAK_SIG;
100                 ani->cckNoiseImmunityLevel = ATH9K_ANI_CCK_DEF_LEVEL;
101                 ani->ofdmNoiseImmunityLevel = ATH9K_ANI_OFDM_DEF_LEVEL;
102 -               ani->update_ani = false;
103         }
104  
105         /*
106 --- a/drivers/net/wireless/ath/ath9k/ani.h
107 +++ b/drivers/net/wireless/ath/ath9k/ani.h
108 @@ -116,7 +116,6 @@ struct ar5416AniState {
109         u8 firstepLevel;
110         u8 ofdmWeakSigDetect;
111         u8 cckWeakSigThreshold;
112 -       bool update_ani;
113         u32 listenTime;
114         int32_t rssiThrLow;
115         int32_t rssiThrHigh;