Commit 1e8f0a31 authored by Felix Fietkau's avatar Felix Fietkau Committed by John W. Linville

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: default avatarFelix Fietkau <nbd@openwrt.org>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent 198823fd
...@@ -154,9 +154,7 @@ static void ath9k_hw_set_ofdm_nil(struct ath_hw *ah, u8 immunityLevel) ...@@ -154,9 +154,7 @@ static void ath9k_hw_set_ofdm_nil(struct ath_hw *ah, u8 immunityLevel)
aniState->rssiThrLow, aniState->rssiThrHigh); aniState->rssiThrLow, aniState->rssiThrHigh);
if (aniState->update_ani) if (aniState->update_ani)
aniState->ofdmNoiseImmunityLevel = aniState->ofdmNoiseImmunityLevel = immunityLevel;
(immunityLevel > ATH9K_ANI_OFDM_DEF_LEVEL) ?
immunityLevel : ATH9K_ANI_OFDM_DEF_LEVEL;
entry_ofdm = &ofdm_level_table[aniState->ofdmNoiseImmunityLevel]; entry_ofdm = &ofdm_level_table[aniState->ofdmNoiseImmunityLevel];
entry_cck = &cck_level_table[aniState->cckNoiseImmunityLevel]; 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,9 +215,7 @@ static void ath9k_hw_set_cck_nil(struct ath_hw *ah, u_int8_t immunityLevel)
immunityLevel = ATH9K_ANI_CCK_MAX_LEVEL_LOW_RSSI; immunityLevel = ATH9K_ANI_CCK_MAX_LEVEL_LOW_RSSI;
if (aniState->update_ani) if (aniState->update_ani)
aniState->cckNoiseImmunityLevel = aniState->cckNoiseImmunityLevel = immunityLevel;
(immunityLevel > ATH9K_ANI_CCK_DEF_LEVEL) ?
immunityLevel : ATH9K_ANI_CCK_DEF_LEVEL;
entry_ofdm = &ofdm_level_table[aniState->ofdmNoiseImmunityLevel]; entry_ofdm = &ofdm_level_table[aniState->ofdmNoiseImmunityLevel];
entry_cck = &cck_level_table[aniState->cckNoiseImmunityLevel]; entry_cck = &cck_level_table[aniState->cckNoiseImmunityLevel];
...@@ -285,6 +281,7 @@ void ath9k_ani_reset(struct ath_hw *ah, bool is_scanning) ...@@ -285,6 +281,7 @@ void ath9k_ani_reset(struct ath_hw *ah, bool is_scanning)
struct ar5416AniState *aniState = &ah->curchan->ani; struct ar5416AniState *aniState = &ah->curchan->ani;
struct ath9k_channel *chan = ah->curchan; struct ath9k_channel *chan = ah->curchan;
struct ath_common *common = ath9k_hw_common(ah); struct ath_common *common = ath9k_hw_common(ah);
int ofdm_nil, cck_nil;
if (!DO_ANI(ah)) if (!DO_ANI(ah))
return; return;
...@@ -306,6 +303,11 @@ void ath9k_ani_reset(struct ath_hw *ah, bool is_scanning) ...@@ -306,6 +303,11 @@ void ath9k_ani_reset(struct ath_hw *ah, bool is_scanning)
/* always allow mode (on/off) to be controlled */ /* always allow mode (on/off) to be controlled */
ah->ani_function |= ATH9K_ANI_MODE; ah->ani_function |= ATH9K_ANI_MODE;
ofdm_nil = max_t(int, ATH9K_ANI_OFDM_DEF_LEVEL,
aniState->ofdmNoiseImmunityLevel);
cck_nil = max_t(int, ATH9K_ANI_CCK_DEF_LEVEL,
aniState->cckNoiseImmunityLevel);
if (is_scanning || if (is_scanning ||
(ah->opmode != NL80211_IFTYPE_STATION && (ah->opmode != NL80211_IFTYPE_STATION &&
ah->opmode != NL80211_IFTYPE_ADHOC)) { ah->opmode != NL80211_IFTYPE_ADHOC)) {
...@@ -329,8 +331,8 @@ void ath9k_ani_reset(struct ath_hw *ah, bool is_scanning) ...@@ -329,8 +331,8 @@ void ath9k_ani_reset(struct ath_hw *ah, bool is_scanning)
aniState->cckNoiseImmunityLevel); aniState->cckNoiseImmunityLevel);
aniState->update_ani = false; aniState->update_ani = false;
ath9k_hw_set_ofdm_nil(ah, ATH9K_ANI_OFDM_DEF_LEVEL); ofdm_nil = ATH9K_ANI_OFDM_DEF_LEVEL;
ath9k_hw_set_cck_nil(ah, ATH9K_ANI_CCK_DEF_LEVEL); cck_nil = ATH9K_ANI_CCK_DEF_LEVEL;
} }
} else { } else {
/* /*
...@@ -346,11 +348,9 @@ void ath9k_ani_reset(struct ath_hw *ah, bool is_scanning) ...@@ -346,11 +348,9 @@ void ath9k_ani_reset(struct ath_hw *ah, bool is_scanning)
aniState->cckNoiseImmunityLevel); aniState->cckNoiseImmunityLevel);
aniState->update_ani = true; aniState->update_ani = true;
ath9k_hw_set_ofdm_nil(ah,
aniState->ofdmNoiseImmunityLevel);
ath9k_hw_set_cck_nil(ah,
aniState->cckNoiseImmunityLevel);
} }
ath9k_hw_set_ofdm_nil(ah, ofdm_nil);
ath9k_hw_set_cck_nil(ah, cck_nil);
/* /*
* enable phy counters if hw supports or if not, enable phy * enable phy counters if hw supports or if not, enable phy
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment