aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/ath/ath9k
diff options
context:
space:
mode:
authorFelix Fietkau <nbd@openwrt.org>2012-06-15 09:25:26 -0400
committerJohn W. Linville <linville@tuxdriver.com>2012-06-20 14:44:43 -0400
commit1e8f0a317b5774b2856cd8824991324efb353963 (patch)
tree729b00259f1cc4fb4c40ca2a40135945db91021f /drivers/net/wireless/ath/ath9k
parent198823fd002a7f9784648c24c72b7e8c9e73fd14 (diff)
ath9k_hw: fix setting lower noise immunity values
Commit af1e8a6f "ath9k: reset noiseimmunity level to default" was supposed to ensure that the default noise immunity level is above the INI values, however it prevents setting lower noise immunity values altogether. Fix this by moving the checks to the right function. Signed-off-by: Felix Fietkau <nbd@openwrt.org> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/ath/ath9k')
-rw-r--r--drivers/net/wireless/ath/ath9k/ani.c24
1 files changed, 12 insertions, 12 deletions
diff --git a/drivers/net/wireless/ath/ath9k/ani.c b/drivers/net/wireless/ath/ath9k/ani.c
index da73fa2a77d6..6ee0875df469 100644
--- a/drivers/net/wireless/ath/ath9k/ani.c
+++ b/drivers/net/wireless/ath/ath9k/ani.c
@@ -154,9 +154,7 @@ static void ath9k_hw_set_ofdm_nil(struct ath_hw *ah, u8 immunityLevel)
154 aniState->rssiThrLow, aniState->rssiThrHigh); 154 aniState->rssiThrLow, aniState->rssiThrHigh);
155 155
156 if (aniState->update_ani) 156 if (aniState->update_ani)
157 aniState->ofdmNoiseImmunityLevel = 157 aniState->ofdmNoiseImmunityLevel = immunityLevel;
158 (immunityLevel > ATH9K_ANI_OFDM_DEF_LEVEL) ?
159 immunityLevel : ATH9K_ANI_OFDM_DEF_LEVEL;
160 158
161 entry_ofdm = &ofdm_level_table[aniState->ofdmNoiseImmunityLevel]; 159 entry_ofdm = &ofdm_level_table[aniState->ofdmNoiseImmunityLevel];
162 entry_cck = &cck_level_table[aniState->cckNoiseImmunityLevel]; 160 entry_cck = &cck_level_table[aniState->cckNoiseImmunityLevel];
@@ -217,9 +215,7 @@ static void ath9k_hw_set_cck_nil(struct ath_hw *ah, u_int8_t immunityLevel)
217 immunityLevel = ATH9K_ANI_CCK_MAX_LEVEL_LOW_RSSI; 215 immunityLevel = ATH9K_ANI_CCK_MAX_LEVEL_LOW_RSSI;
218 216
219 if (aniState->update_ani) 217 if (aniState->update_ani)
220 aniState->cckNoiseImmunityLevel = 218 aniState->cckNoiseImmunityLevel = immunityLevel;
221 (immunityLevel > ATH9K_ANI_CCK_DEF_LEVEL) ?
222 immunityLevel : ATH9K_ANI_CCK_DEF_LEVEL;
223 219
224 entry_ofdm = &ofdm_level_table[aniState->ofdmNoiseImmunityLevel]; 220 entry_ofdm = &ofdm_level_table[aniState->ofdmNoiseImmunityLevel];
225 entry_cck = &cck_level_table[aniState->cckNoiseImmunityLevel]; 221 entry_cck = &cck_level_table[aniState->cckNoiseImmunityLevel];
@@ -285,6 +281,7 @@ void ath9k_ani_reset(struct ath_hw *ah, bool is_scanning)
285 struct ar5416AniState *aniState = &ah->curchan->ani; 281 struct ar5416AniState *aniState = &ah->curchan->ani;
286 struct ath9k_channel *chan = ah->curchan; 282 struct ath9k_channel *chan = ah->curchan;
287 struct ath_common *common = ath9k_hw_common(ah); 283 struct ath_common *common = ath9k_hw_common(ah);
284 int ofdm_nil, cck_nil;
288 285
289 if (!DO_ANI(ah)) 286 if (!DO_ANI(ah))
290 return; 287 return;
@@ -306,6 +303,11 @@ void ath9k_ani_reset(struct ath_hw *ah, bool is_scanning)
306 /* always allow mode (on/off) to be controlled */ 303 /* always allow mode (on/off) to be controlled */
307 ah->ani_function |= ATH9K_ANI_MODE; 304 ah->ani_function |= ATH9K_ANI_MODE;
308 305
306 ofdm_nil = max_t(int, ATH9K_ANI_OFDM_DEF_LEVEL,
307 aniState->ofdmNoiseImmunityLevel);
308 cck_nil = max_t(int, ATH9K_ANI_CCK_DEF_LEVEL,
309 aniState->cckNoiseImmunityLevel);
310
309 if (is_scanning || 311 if (is_scanning ||
310 (ah->opmode != NL80211_IFTYPE_STATION && 312 (ah->opmode != NL80211_IFTYPE_STATION &&
311 ah->opmode != NL80211_IFTYPE_ADHOC)) { 313 ah->opmode != NL80211_IFTYPE_ADHOC)) {
@@ -329,8 +331,8 @@ void ath9k_ani_reset(struct ath_hw *ah, bool is_scanning)
329 aniState->cckNoiseImmunityLevel); 331 aniState->cckNoiseImmunityLevel);
330 332
331 aniState->update_ani = false; 333 aniState->update_ani = false;
332 ath9k_hw_set_ofdm_nil(ah, ATH9K_ANI_OFDM_DEF_LEVEL); 334 ofdm_nil = ATH9K_ANI_OFDM_DEF_LEVEL;
333 ath9k_hw_set_cck_nil(ah, ATH9K_ANI_CCK_DEF_LEVEL); 335 cck_nil = ATH9K_ANI_CCK_DEF_LEVEL;
334 } 336 }
335 } else { 337 } else {
336 /* 338 /*
@@ -346,11 +348,9 @@ void ath9k_ani_reset(struct ath_hw *ah, bool is_scanning)
346 aniState->cckNoiseImmunityLevel); 348 aniState->cckNoiseImmunityLevel);
347 349
348 aniState->update_ani = true; 350 aniState->update_ani = true;
349 ath9k_hw_set_ofdm_nil(ah,
350 aniState->ofdmNoiseImmunityLevel);
351 ath9k_hw_set_cck_nil(ah,
352 aniState->cckNoiseImmunityLevel);
353 } 351 }
352 ath9k_hw_set_ofdm_nil(ah, ofdm_nil);
353 ath9k_hw_set_cck_nil(ah, cck_nil);
354 354
355 /* 355 /*
356 * enable phy counters if hw supports or if not, enable phy 356 * enable phy counters if hw supports or if not, enable phy