diff options
author | Sujith Manoharan <c_manoha@qca.qualcomm.com> | 2013-06-02 23:49:29 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2013-06-03 15:55:48 -0400 |
commit | c24bd3620c50cc8f1d13935c95003f41339a748d (patch) | |
tree | a5dc5db6a509f13d74f0d01c1cd8dd5dec2587df /drivers/net | |
parent | 6e4d291eec82c682d82d02cd275a6ec511f9b203 (diff) |
ath9k: Do not maintain ANI state per-channel
ANI state can be maintained globally instead of per-channel.
This reduces memory usage and since default values are used
during a scan run, per-channel state is not required.
Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net')
-rw-r--r-- | drivers/net/wireless/ath/ath9k/ani.c | 40 | ||||
-rw-r--r-- | drivers/net/wireless/ath/ath9k/ar5008_phy.c | 4 | ||||
-rw-r--r-- | drivers/net/wireless/ath/ath9k/ar9003_phy.c | 4 | ||||
-rw-r--r-- | drivers/net/wireless/ath/ath9k/hw.h | 2 |
4 files changed, 22 insertions, 28 deletions
diff --git a/drivers/net/wireless/ath/ath9k/ani.c b/drivers/net/wireless/ath/ath9k/ani.c index ba0bad6728bb..e91725bf401c 100644 --- a/drivers/net/wireless/ath/ath9k/ani.c +++ b/drivers/net/wireless/ath/ath9k/ani.c | |||
@@ -121,7 +121,7 @@ static void ath9k_ani_restart(struct ath_hw *ah) | |||
121 | if (!ah->curchan) | 121 | if (!ah->curchan) |
122 | return; | 122 | return; |
123 | 123 | ||
124 | aniState = &ah->curchan->ani; | 124 | aniState = &ah->ani; |
125 | aniState->listenTime = 0; | 125 | aniState->listenTime = 0; |
126 | 126 | ||
127 | ENABLE_REGWRITE_BUFFER(ah); | 127 | ENABLE_REGWRITE_BUFFER(ah); |
@@ -143,7 +143,7 @@ static void ath9k_ani_restart(struct ath_hw *ah) | |||
143 | static void ath9k_hw_set_ofdm_nil(struct ath_hw *ah, u8 immunityLevel, | 143 | static void ath9k_hw_set_ofdm_nil(struct ath_hw *ah, u8 immunityLevel, |
144 | bool scan) | 144 | bool scan) |
145 | { | 145 | { |
146 | struct ar5416AniState *aniState = &ah->curchan->ani; | 146 | struct ar5416AniState *aniState = &ah->ani; |
147 | struct ath_common *common = ath9k_hw_common(ah); | 147 | struct ath_common *common = ath9k_hw_common(ah); |
148 | const struct ani_ofdm_level_entry *entry_ofdm; | 148 | const struct ani_ofdm_level_entry *entry_ofdm; |
149 | const struct ani_cck_level_entry *entry_cck; | 149 | const struct ani_cck_level_entry *entry_cck; |
@@ -198,7 +198,7 @@ static void ath9k_hw_ani_ofdm_err_trigger(struct ath_hw *ah) | |||
198 | if (!ah->curchan) | 198 | if (!ah->curchan) |
199 | return; | 199 | return; |
200 | 200 | ||
201 | aniState = &ah->curchan->ani; | 201 | aniState = &ah->ani; |
202 | 202 | ||
203 | if (aniState->ofdmNoiseImmunityLevel < ATH9K_ANI_OFDM_MAX_LEVEL) | 203 | if (aniState->ofdmNoiseImmunityLevel < ATH9K_ANI_OFDM_MAX_LEVEL) |
204 | ath9k_hw_set_ofdm_nil(ah, aniState->ofdmNoiseImmunityLevel + 1, false); | 204 | ath9k_hw_set_ofdm_nil(ah, aniState->ofdmNoiseImmunityLevel + 1, false); |
@@ -210,7 +210,7 @@ static void ath9k_hw_ani_ofdm_err_trigger(struct ath_hw *ah) | |||
210 | static void ath9k_hw_set_cck_nil(struct ath_hw *ah, u_int8_t immunityLevel, | 210 | static void ath9k_hw_set_cck_nil(struct ath_hw *ah, u_int8_t immunityLevel, |
211 | bool scan) | 211 | bool scan) |
212 | { | 212 | { |
213 | struct ar5416AniState *aniState = &ah->curchan->ani; | 213 | struct ar5416AniState *aniState = &ah->ani; |
214 | struct ath_common *common = ath9k_hw_common(ah); | 214 | struct ath_common *common = ath9k_hw_common(ah); |
215 | const struct ani_ofdm_level_entry *entry_ofdm; | 215 | const struct ani_ofdm_level_entry *entry_ofdm; |
216 | const struct ani_cck_level_entry *entry_cck; | 216 | const struct ani_cck_level_entry *entry_cck; |
@@ -254,7 +254,7 @@ static void ath9k_hw_ani_cck_err_trigger(struct ath_hw *ah) | |||
254 | if (!ah->curchan) | 254 | if (!ah->curchan) |
255 | return; | 255 | return; |
256 | 256 | ||
257 | aniState = &ah->curchan->ani; | 257 | aniState = &ah->ani; |
258 | 258 | ||
259 | if (aniState->cckNoiseImmunityLevel < ATH9K_ANI_CCK_MAX_LEVEL) | 259 | if (aniState->cckNoiseImmunityLevel < ATH9K_ANI_CCK_MAX_LEVEL) |
260 | ath9k_hw_set_cck_nil(ah, aniState->cckNoiseImmunityLevel + 1, | 260 | ath9k_hw_set_cck_nil(ah, aniState->cckNoiseImmunityLevel + 1, |
@@ -269,7 +269,7 @@ static void ath9k_hw_ani_lower_immunity(struct ath_hw *ah) | |||
269 | { | 269 | { |
270 | struct ar5416AniState *aniState; | 270 | struct ar5416AniState *aniState; |
271 | 271 | ||
272 | aniState = &ah->curchan->ani; | 272 | aniState = &ah->ani; |
273 | 273 | ||
274 | /* lower OFDM noise immunity */ | 274 | /* lower OFDM noise immunity */ |
275 | if (aniState->ofdmNoiseImmunityLevel > 0 && | 275 | if (aniState->ofdmNoiseImmunityLevel > 0 && |
@@ -292,7 +292,7 @@ static void ath9k_hw_ani_lower_immunity(struct ath_hw *ah) | |||
292 | */ | 292 | */ |
293 | void ath9k_ani_reset(struct ath_hw *ah, bool is_scanning) | 293 | void ath9k_ani_reset(struct ath_hw *ah, bool is_scanning) |
294 | { | 294 | { |
295 | struct ar5416AniState *aniState = &ah->curchan->ani; | 295 | struct ar5416AniState *aniState = &ah->ani; |
296 | struct ath9k_channel *chan = ah->curchan; | 296 | struct ath9k_channel *chan = ah->curchan; |
297 | struct ath_common *common = ath9k_hw_common(ah); | 297 | struct ath_common *common = ath9k_hw_common(ah); |
298 | int ofdm_nil, cck_nil; | 298 | int ofdm_nil, cck_nil; |
@@ -380,7 +380,7 @@ void ath9k_ani_reset(struct ath_hw *ah, bool is_scanning) | |||
380 | static bool ath9k_hw_ani_read_counters(struct ath_hw *ah) | 380 | static bool ath9k_hw_ani_read_counters(struct ath_hw *ah) |
381 | { | 381 | { |
382 | struct ath_common *common = ath9k_hw_common(ah); | 382 | struct ath_common *common = ath9k_hw_common(ah); |
383 | struct ar5416AniState *aniState = &ah->curchan->ani; | 383 | struct ar5416AniState *aniState = &ah->ani; |
384 | u32 phyCnt1, phyCnt2; | 384 | u32 phyCnt1, phyCnt2; |
385 | int32_t listenTime; | 385 | int32_t listenTime; |
386 | 386 | ||
@@ -418,7 +418,7 @@ void ath9k_hw_ani_monitor(struct ath_hw *ah, struct ath9k_channel *chan) | |||
418 | if (!ah->curchan) | 418 | if (!ah->curchan) |
419 | return; | 419 | return; |
420 | 420 | ||
421 | aniState = &ah->curchan->ani; | 421 | aniState = &ah->ani; |
422 | if (!ath9k_hw_ani_read_counters(ah)) | 422 | if (!ath9k_hw_ani_read_counters(ah)) |
423 | return; | 423 | return; |
424 | 424 | ||
@@ -490,28 +490,22 @@ EXPORT_SYMBOL(ath9k_hw_disable_mib_counters); | |||
490 | void ath9k_hw_ani_init(struct ath_hw *ah) | 490 | void ath9k_hw_ani_init(struct ath_hw *ah) |
491 | { | 491 | { |
492 | struct ath_common *common = ath9k_hw_common(ah); | 492 | struct ath_common *common = ath9k_hw_common(ah); |
493 | int i; | 493 | struct ar5416AniState *ani = &ah->ani; |
494 | 494 | ||
495 | ath_dbg(common, ANI, "Initialize ANI\n"); | 495 | ath_dbg(common, ANI, "Initialize ANI\n"); |
496 | 496 | ||
497 | ah->config.ofdm_trig_high = ATH9K_ANI_OFDM_TRIG_HIGH; | 497 | ah->config.ofdm_trig_high = ATH9K_ANI_OFDM_TRIG_HIGH; |
498 | ah->config.ofdm_trig_low = ATH9K_ANI_OFDM_TRIG_LOW; | 498 | ah->config.ofdm_trig_low = ATH9K_ANI_OFDM_TRIG_LOW; |
499 | |||
500 | ah->config.cck_trig_high = ATH9K_ANI_CCK_TRIG_HIGH; | 499 | ah->config.cck_trig_high = ATH9K_ANI_CCK_TRIG_HIGH; |
501 | ah->config.cck_trig_low = ATH9K_ANI_CCK_TRIG_LOW; | 500 | ah->config.cck_trig_low = ATH9K_ANI_CCK_TRIG_LOW; |
502 | 501 | ||
503 | for (i = 0; i < ARRAY_SIZE(ah->channels); i++) { | 502 | ani->spurImmunityLevel = ATH9K_ANI_SPUR_IMMUNE_LVL; |
504 | struct ath9k_channel *chan = &ah->channels[i]; | 503 | ani->firstepLevel = ATH9K_ANI_FIRSTEP_LVL; |
505 | struct ar5416AniState *ani = &chan->ani; | 504 | ani->mrcCCK = AR_SREV_9300_20_OR_LATER(ah) ? true : false; |
506 | 505 | ani->ofdmsTurn = true; | |
507 | ani->spurImmunityLevel = ATH9K_ANI_SPUR_IMMUNE_LVL; | 506 | ani->ofdmWeakSigDetect = true; |
508 | ani->firstepLevel = ATH9K_ANI_FIRSTEP_LVL; | 507 | ani->cckNoiseImmunityLevel = ATH9K_ANI_CCK_DEF_LEVEL; |
509 | ani->mrcCCK = AR_SREV_9300_20_OR_LATER(ah) ? true : false; | 508 | ani->ofdmNoiseImmunityLevel = ATH9K_ANI_OFDM_DEF_LEVEL; |
510 | ani->ofdmsTurn = true; | ||
511 | ani->ofdmWeakSigDetect = true; | ||
512 | ani->cckNoiseImmunityLevel = ATH9K_ANI_CCK_DEF_LEVEL; | ||
513 | ani->ofdmNoiseImmunityLevel = ATH9K_ANI_OFDM_DEF_LEVEL; | ||
514 | } | ||
515 | 509 | ||
516 | /* | 510 | /* |
517 | * since we expect some ongoing maintenance on the tables, let's sanity | 511 | * since we expect some ongoing maintenance on the tables, let's sanity |
diff --git a/drivers/net/wireless/ath/ath9k/ar5008_phy.c b/drivers/net/wireless/ath/ath9k/ar5008_phy.c index 92b79a2a003d..d1acfe98918a 100644 --- a/drivers/net/wireless/ath/ath9k/ar5008_phy.c +++ b/drivers/net/wireless/ath/ath9k/ar5008_phy.c | |||
@@ -931,7 +931,7 @@ static bool ar5008_hw_ani_control_new(struct ath_hw *ah, | |||
931 | { | 931 | { |
932 | struct ath_common *common = ath9k_hw_common(ah); | 932 | struct ath_common *common = ath9k_hw_common(ah); |
933 | struct ath9k_channel *chan = ah->curchan; | 933 | struct ath9k_channel *chan = ah->curchan; |
934 | struct ar5416AniState *aniState = &chan->ani; | 934 | struct ar5416AniState *aniState = &ah->ani; |
935 | s32 value, value2; | 935 | s32 value, value2; |
936 | 936 | ||
937 | switch (cmd & ah->ani_function) { | 937 | switch (cmd & ah->ani_function) { |
@@ -1207,7 +1207,7 @@ static void ar5008_hw_ani_cache_ini_regs(struct ath_hw *ah) | |||
1207 | { | 1207 | { |
1208 | struct ath_common *common = ath9k_hw_common(ah); | 1208 | struct ath_common *common = ath9k_hw_common(ah); |
1209 | struct ath9k_channel *chan = ah->curchan; | 1209 | struct ath9k_channel *chan = ah->curchan; |
1210 | struct ar5416AniState *aniState = &chan->ani; | 1210 | struct ar5416AniState *aniState = &ah->ani; |
1211 | struct ath9k_ani_default *iniDef; | 1211 | struct ath9k_ani_default *iniDef; |
1212 | u32 val; | 1212 | u32 val; |
1213 | 1213 | ||
diff --git a/drivers/net/wireless/ath/ath9k/ar9003_phy.c b/drivers/net/wireless/ath/ath9k/ar9003_phy.c index 94b22cb84535..0d053503b8bf 100644 --- a/drivers/net/wireless/ath/ath9k/ar9003_phy.c +++ b/drivers/net/wireless/ath/ath9k/ar9003_phy.c | |||
@@ -904,7 +904,7 @@ static bool ar9003_hw_ani_control(struct ath_hw *ah, | |||
904 | { | 904 | { |
905 | struct ath_common *common = ath9k_hw_common(ah); | 905 | struct ath_common *common = ath9k_hw_common(ah); |
906 | struct ath9k_channel *chan = ah->curchan; | 906 | struct ath9k_channel *chan = ah->curchan; |
907 | struct ar5416AniState *aniState = &chan->ani; | 907 | struct ar5416AniState *aniState = &ah->ani; |
908 | s32 value, value2; | 908 | s32 value, value2; |
909 | 909 | ||
910 | switch (cmd & ah->ani_function) { | 910 | switch (cmd & ah->ani_function) { |
@@ -1172,7 +1172,7 @@ static void ar9003_hw_ani_cache_ini_regs(struct ath_hw *ah) | |||
1172 | struct ath9k_ani_default *iniDef; | 1172 | struct ath9k_ani_default *iniDef; |
1173 | u32 val; | 1173 | u32 val; |
1174 | 1174 | ||
1175 | aniState = &ah->curchan->ani; | 1175 | aniState = &ah->ani; |
1176 | iniDef = &aniState->iniDef; | 1176 | iniDef = &aniState->iniDef; |
1177 | 1177 | ||
1178 | ath_dbg(common, ANI, "ver %d.%d opmode %u chan %d Mhz/0x%x\n", | 1178 | ath_dbg(common, ANI, "ver %d.%d opmode %u chan %d Mhz/0x%x\n", |
diff --git a/drivers/net/wireless/ath/ath9k/hw.h b/drivers/net/wireless/ath/ath9k/hw.h index 301b19ed7664..7d259b7dc254 100644 --- a/drivers/net/wireless/ath/ath9k/hw.h +++ b/drivers/net/wireless/ath/ath9k/hw.h | |||
@@ -420,7 +420,6 @@ struct ath9k_hw_cal_data { | |||
420 | 420 | ||
421 | struct ath9k_channel { | 421 | struct ath9k_channel { |
422 | struct ieee80211_channel *chan; | 422 | struct ieee80211_channel *chan; |
423 | struct ar5416AniState ani; | ||
424 | u16 channel; | 423 | u16 channel; |
425 | u32 channelFlags; | 424 | u32 channelFlags; |
426 | u32 chanmode; | 425 | u32 chanmode; |
@@ -854,6 +853,7 @@ struct ath_hw { | |||
854 | u32 aniperiod; | 853 | u32 aniperiod; |
855 | enum ath9k_ani_cmd ani_function; | 854 | enum ath9k_ani_cmd ani_function; |
856 | u32 ani_skip_count; | 855 | u32 ani_skip_count; |
856 | struct ar5416AniState ani; | ||
857 | 857 | ||
858 | #ifdef CONFIG_ATH9K_BTCOEX_SUPPORT | 858 | #ifdef CONFIG_ATH9K_BTCOEX_SUPPORT |
859 | struct ath_btcoex_hw btcoex_hw; | 859 | struct ath_btcoex_hw btcoex_hw; |