Lines Matching refs:ah

107 static void ath9k_hw_update_mibstats(struct ath_hw *ah,  in ath9k_hw_update_mibstats()  argument
114 REG_READ_MULTI(ah, &addr[0], &data[0], 5); in ath9k_hw_update_mibstats()
127 static void ath9k_ani_restart(struct ath_hw *ah) in ath9k_ani_restart() argument
129 struct ar5416AniState *aniState = &ah->ani; in ath9k_ani_restart()
133 ENABLE_REGWRITE_BUFFER(ah); in ath9k_ani_restart()
135 REG_WRITE(ah, AR_PHY_ERR_1, 0); in ath9k_ani_restart()
136 REG_WRITE(ah, AR_PHY_ERR_2, 0); in ath9k_ani_restart()
137 REG_WRITE(ah, AR_PHY_ERR_MASK_1, AR_PHY_ERR_OFDM_TIMING); in ath9k_ani_restart()
138 REG_WRITE(ah, AR_PHY_ERR_MASK_2, AR_PHY_ERR_CCK_TIMING); in ath9k_ani_restart()
140 REGWRITE_BUFFER_FLUSH(ah); in ath9k_ani_restart()
142 ath9k_hw_update_mibstats(ah, &ah->ah_mibStats); in ath9k_ani_restart()
149 static void ath9k_hw_set_ofdm_nil(struct ath_hw *ah, u8 immunityLevel, in ath9k_hw_set_ofdm_nil() argument
152 struct ar5416AniState *aniState = &ah->ani; in ath9k_hw_set_ofdm_nil()
153 struct ath_common *common = ath9k_hw_common(ah); in ath9k_hw_set_ofdm_nil()
160 immunityLevel, BEACON_RSSI(ah), in ath9k_hw_set_ofdm_nil()
164 if (AR_SREV_9100(ah) && immunityLevel < ATH9K_ANI_OFDM_DEF_LEVEL) in ath9k_hw_set_ofdm_nil()
174 ath9k_hw_ani_control(ah, in ath9k_hw_set_ofdm_nil()
180 ath9k_hw_ani_control(ah, in ath9k_hw_set_ofdm_nil()
185 if (ah->opmode == NL80211_IFTYPE_STATION && in ath9k_hw_set_ofdm_nil()
186 BEACON_RSSI(ah) <= ATH9K_ANI_RSSI_THR_HIGH) in ath9k_hw_set_ofdm_nil()
193 else if (AR_SREV_9300_20_OR_LATER(ah) && in ath9k_hw_set_ofdm_nil()
194 ah->opmode != NL80211_IFTYPE_STATION) in ath9k_hw_set_ofdm_nil()
198 else if (!AR_SREV_9300_20_OR_LATER(ah) && in ath9k_hw_set_ofdm_nil()
203 ath9k_hw_ani_control(ah, ATH9K_ANI_OFDM_WEAK_SIGNAL_DETECTION, in ath9k_hw_set_ofdm_nil()
206 if (!AR_SREV_9300_20_OR_LATER(ah)) in ath9k_hw_set_ofdm_nil()
210 ah->config.ofdm_trig_high = ATH9K_ANI_OFDM_TRIG_HIGH; in ath9k_hw_set_ofdm_nil()
211 ah->config.ofdm_trig_low = ATH9K_ANI_OFDM_TRIG_LOW_ABOVE_INI; in ath9k_hw_set_ofdm_nil()
213 ah->config.ofdm_trig_high = ATH9K_ANI_OFDM_TRIG_HIGH_BELOW_INI; in ath9k_hw_set_ofdm_nil()
214 ah->config.ofdm_trig_low = ATH9K_ANI_OFDM_TRIG_LOW; in ath9k_hw_set_ofdm_nil()
218 static void ath9k_hw_ani_ofdm_err_trigger(struct ath_hw *ah) in ath9k_hw_ani_ofdm_err_trigger() argument
220 struct ar5416AniState *aniState = &ah->ani; in ath9k_hw_ani_ofdm_err_trigger()
223 ath9k_hw_set_ofdm_nil(ah, aniState->ofdmNoiseImmunityLevel + 1, false); in ath9k_hw_ani_ofdm_err_trigger()
229 static void ath9k_hw_set_cck_nil(struct ath_hw *ah, u_int8_t immunityLevel, in ath9k_hw_set_cck_nil() argument
232 struct ar5416AniState *aniState = &ah->ani; in ath9k_hw_set_cck_nil()
233 struct ath_common *common = ath9k_hw_common(ah); in ath9k_hw_set_cck_nil()
239 BEACON_RSSI(ah), ATH9K_ANI_RSSI_THR_LOW, in ath9k_hw_set_cck_nil()
242 if (AR_SREV_9100(ah) && immunityLevel < ATH9K_ANI_CCK_DEF_LEVEL) in ath9k_hw_set_cck_nil()
245 if (ah->opmode == NL80211_IFTYPE_STATION && in ath9k_hw_set_cck_nil()
246 BEACON_RSSI(ah) <= ATH9K_ANI_RSSI_THR_LOW && in ath9k_hw_set_cck_nil()
258 ath9k_hw_ani_control(ah, in ath9k_hw_set_cck_nil()
263 if (!AR_SREV_9300_20_OR_LATER(ah) || AR_SREV_9485(ah) || in ath9k_hw_set_cck_nil()
264 AR_SREV_9565(ah) || AR_SREV_9561(ah)) in ath9k_hw_set_cck_nil()
268 ath9k_hw_ani_control(ah, in ath9k_hw_set_cck_nil()
273 static void ath9k_hw_ani_cck_err_trigger(struct ath_hw *ah) in ath9k_hw_ani_cck_err_trigger() argument
275 struct ar5416AniState *aniState = &ah->ani; in ath9k_hw_ani_cck_err_trigger()
278 ath9k_hw_set_cck_nil(ah, aniState->cckNoiseImmunityLevel + 1, in ath9k_hw_ani_cck_err_trigger()
286 static void ath9k_hw_ani_lower_immunity(struct ath_hw *ah) in ath9k_hw_ani_lower_immunity() argument
288 struct ar5416AniState *aniState = &ah->ani; in ath9k_hw_ani_lower_immunity()
293 ath9k_hw_set_ofdm_nil(ah, aniState->ofdmNoiseImmunityLevel - 1, in ath9k_hw_ani_lower_immunity()
300 ath9k_hw_set_cck_nil(ah, aniState->cckNoiseImmunityLevel - 1, in ath9k_hw_ani_lower_immunity()
309 void ath9k_ani_reset(struct ath_hw *ah, bool is_scanning) in ath9k_ani_reset() argument
311 struct ar5416AniState *aniState = &ah->ani; in ath9k_ani_reset()
312 struct ath9k_channel *chan = ah->curchan; in ath9k_ani_reset()
313 struct ath_common *common = ath9k_hw_common(ah); in ath9k_ani_reset()
320 ah->stats.ast_ani_reset++; in ath9k_ani_reset()
328 (ah->opmode != NL80211_IFTYPE_STATION && in ath9k_ani_reset()
329 ah->opmode != NL80211_IFTYPE_ADHOC)) { in ath9k_ani_reset()
342 ah->opmode, in ath9k_ani_reset()
357 ah->opmode, in ath9k_ani_reset()
363 ath9k_hw_set_ofdm_nil(ah, ofdm_nil, is_scanning); in ath9k_ani_reset()
364 ath9k_hw_set_cck_nil(ah, cck_nil, is_scanning); in ath9k_ani_reset()
366 ath9k_ani_restart(ah); in ath9k_ani_reset()
369 static bool ath9k_hw_ani_read_counters(struct ath_hw *ah) in ath9k_hw_ani_read_counters() argument
371 struct ath_common *common = ath9k_hw_common(ah); in ath9k_hw_ani_read_counters()
372 struct ar5416AniState *aniState = &ah->ani; in ath9k_hw_ani_read_counters()
380 ah->stats.ast_ani_lneg_or_lzero++; in ath9k_hw_ani_read_counters()
381 ath9k_ani_restart(ah); in ath9k_hw_ani_read_counters()
387 ath9k_hw_update_mibstats(ah, &ah->ah_mibStats); in ath9k_hw_ani_read_counters()
389 phyCnt1 = REG_READ(ah, AR_PHY_ERR_1); in ath9k_hw_ani_read_counters()
390 phyCnt2 = REG_READ(ah, AR_PHY_ERR_2); in ath9k_hw_ani_read_counters()
392 ah->stats.ast_ani_ofdmerrs += phyCnt1 - aniState->ofdmPhyErrCount; in ath9k_hw_ani_read_counters()
395 ah->stats.ast_ani_cckerrs += phyCnt2 - aniState->cckPhyErrCount; in ath9k_hw_ani_read_counters()
401 void ath9k_hw_ani_monitor(struct ath_hw *ah, struct ath9k_channel *chan) in ath9k_hw_ani_monitor() argument
403 struct ar5416AniState *aniState = &ah->ani; in ath9k_hw_ani_monitor()
404 struct ath_common *common = ath9k_hw_common(ah); in ath9k_hw_ani_monitor()
407 if (!ath9k_hw_ani_read_counters(ah)) in ath9k_hw_ani_monitor()
422 if (aniState->listenTime > ah->aniperiod) { in ath9k_hw_ani_monitor()
423 if (cckPhyErrRate < ah->config.cck_trig_low && in ath9k_hw_ani_monitor()
424 ofdmPhyErrRate < ah->config.ofdm_trig_low) { in ath9k_hw_ani_monitor()
425 ath9k_hw_ani_lower_immunity(ah); in ath9k_hw_ani_monitor()
427 } else if (ofdmPhyErrRate > ah->config.ofdm_trig_high) { in ath9k_hw_ani_monitor()
428 ath9k_hw_ani_ofdm_err_trigger(ah); in ath9k_hw_ani_monitor()
430 } else if (cckPhyErrRate > ah->config.cck_trig_high) { in ath9k_hw_ani_monitor()
431 ath9k_hw_ani_cck_err_trigger(ah); in ath9k_hw_ani_monitor()
436 ath9k_ani_restart(ah); in ath9k_hw_ani_monitor()
441 void ath9k_enable_mib_counters(struct ath_hw *ah) in ath9k_enable_mib_counters() argument
443 struct ath_common *common = ath9k_hw_common(ah); in ath9k_enable_mib_counters()
447 ath9k_hw_update_mibstats(ah, &ah->ah_mibStats); in ath9k_enable_mib_counters()
449 ENABLE_REGWRITE_BUFFER(ah); in ath9k_enable_mib_counters()
451 REG_WRITE(ah, AR_FILT_OFDM, 0); in ath9k_enable_mib_counters()
452 REG_WRITE(ah, AR_FILT_CCK, 0); in ath9k_enable_mib_counters()
453 REG_WRITE(ah, AR_MIBC, in ath9k_enable_mib_counters()
456 REG_WRITE(ah, AR_PHY_ERR_MASK_1, AR_PHY_ERR_OFDM_TIMING); in ath9k_enable_mib_counters()
457 REG_WRITE(ah, AR_PHY_ERR_MASK_2, AR_PHY_ERR_CCK_TIMING); in ath9k_enable_mib_counters()
459 REGWRITE_BUFFER_FLUSH(ah); in ath9k_enable_mib_counters()
463 void ath9k_hw_disable_mib_counters(struct ath_hw *ah) in ath9k_hw_disable_mib_counters() argument
465 struct ath_common *common = ath9k_hw_common(ah); in ath9k_hw_disable_mib_counters()
469 REG_WRITE(ah, AR_MIBC, AR_MIBC_FMC); in ath9k_hw_disable_mib_counters()
470 ath9k_hw_update_mibstats(ah, &ah->ah_mibStats); in ath9k_hw_disable_mib_counters()
471 REG_WRITE(ah, AR_MIBC, AR_MIBC_CMC); in ath9k_hw_disable_mib_counters()
472 REG_WRITE(ah, AR_FILT_OFDM, 0); in ath9k_hw_disable_mib_counters()
473 REG_WRITE(ah, AR_FILT_CCK, 0); in ath9k_hw_disable_mib_counters()
477 void ath9k_hw_ani_init(struct ath_hw *ah) in ath9k_hw_ani_init() argument
479 struct ath_common *common = ath9k_hw_common(ah); in ath9k_hw_ani_init()
480 struct ar5416AniState *ani = &ah->ani; in ath9k_hw_ani_init()
484 if (AR_SREV_9300_20_OR_LATER(ah)) { in ath9k_hw_ani_init()
485 ah->config.ofdm_trig_high = ATH9K_ANI_OFDM_TRIG_HIGH; in ath9k_hw_ani_init()
486 ah->config.ofdm_trig_low = ATH9K_ANI_OFDM_TRIG_LOW; in ath9k_hw_ani_init()
487 ah->config.cck_trig_high = ATH9K_ANI_CCK_TRIG_HIGH; in ath9k_hw_ani_init()
488 ah->config.cck_trig_low = ATH9K_ANI_CCK_TRIG_LOW; in ath9k_hw_ani_init()
490 ah->config.ofdm_trig_high = ATH9K_ANI_OFDM_TRIG_HIGH_OLD; in ath9k_hw_ani_init()
491 ah->config.ofdm_trig_low = ATH9K_ANI_OFDM_TRIG_LOW_OLD; in ath9k_hw_ani_init()
492 ah->config.cck_trig_high = ATH9K_ANI_CCK_TRIG_HIGH_OLD; in ath9k_hw_ani_init()
493 ah->config.cck_trig_low = ATH9K_ANI_CCK_TRIG_LOW_OLD; in ath9k_hw_ani_init()
498 ani->mrcCCK = AR_SREV_9300_20_OR_LATER(ah) ? true : false; in ath9k_hw_ani_init()
508 ah->aniperiod = ATH9K_ANI_PERIOD; in ath9k_hw_ani_init()
509 ah->config.ani_poll_interval = ATH9K_ANI_POLLINTERVAL; in ath9k_hw_ani_init()
511 ath9k_ani_restart(ah); in ath9k_hw_ani_init()
512 ath9k_enable_mib_counters(ah); in ath9k_hw_ani_init()