ani.c 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513
  1. /*
  2. * Copyright (c) 2008-2011 Atheros Communications Inc.
  3. *
  4. * Permission to use, copy, modify, and/or distribute this software for any
  5. * purpose with or without fee is hereby granted, provided that the above
  6. * copyright notice and this permission notice appear in all copies.
  7. *
  8. * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
  9. * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
  10. * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
  11. * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
  12. * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
  13. * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
  14. * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  15. */
  16. #include <linux/kernel.h>
  17. #include <linux/export.h>
  18. #include "hw.h"
  19. #include "hw-ops.h"
  20. struct ani_ofdm_level_entry {
  21. int spur_immunity_level;
  22. int fir_step_level;
  23. int ofdm_weak_signal_on;
  24. };
  25. /* values here are relative to the INI */
  26. /*
  27. * Legend:
  28. *
  29. * SI: Spur immunity
  30. * FS: FIR Step
  31. * WS: OFDM / CCK Weak Signal detection
  32. * MRC-CCK: Maximal Ratio Combining for CCK
  33. */
  34. static const struct ani_ofdm_level_entry ofdm_level_table[] = {
  35. /* SI FS WS */
  36. { 0, 0, 1 }, /* lvl 0 */
  37. { 1, 1, 1 }, /* lvl 1 */
  38. { 2, 2, 1 }, /* lvl 2 */
  39. { 3, 2, 1 }, /* lvl 3 (default) */
  40. { 4, 3, 1 }, /* lvl 4 */
  41. { 5, 4, 1 }, /* lvl 5 */
  42. { 6, 5, 1 }, /* lvl 6 */
  43. { 7, 6, 1 }, /* lvl 7 */
  44. { 7, 7, 1 }, /* lvl 8 */
  45. { 7, 8, 0 } /* lvl 9 */
  46. };
  47. #define ATH9K_ANI_OFDM_NUM_LEVEL \
  48. ARRAY_SIZE(ofdm_level_table)
  49. #define ATH9K_ANI_OFDM_MAX_LEVEL \
  50. (ATH9K_ANI_OFDM_NUM_LEVEL-1)
  51. #define ATH9K_ANI_OFDM_DEF_LEVEL \
  52. 3 /* default level - matches the INI settings */
  53. /*
  54. * MRC (Maximal Ratio Combining) has always been used with multi-antenna ofdm.
  55. * With OFDM for single stream you just add up all antenna inputs, you're
  56. * only interested in what you get after FFT. Signal alignment is also not
  57. * required for OFDM because any phase difference adds up in the frequency
  58. * domain.
  59. *
  60. * MRC requires extra work for use with CCK. You need to align the antenna
  61. * signals from the different antenna before you can add the signals together.
  62. * You need alignment of signals as CCK is in time domain, so addition can cancel
  63. * your signal completely if phase is 180 degrees (think of adding sine waves).
  64. * You also need to remove noise before the addition and this is where ANI
  65. * MRC CCK comes into play. One of the antenna inputs may be stronger but
  66. * lower SNR, so just adding after alignment can be dangerous.
  67. *
  68. * Regardless of alignment in time, the antenna signals add constructively after
  69. * FFT and improve your reception. For more information:
  70. *
  71. * https://en.wikipedia.org/wiki/Maximal-ratio_combining
  72. */
  73. struct ani_cck_level_entry {
  74. int fir_step_level;
  75. int mrc_cck_on;
  76. };
  77. static const struct ani_cck_level_entry cck_level_table[] = {
  78. /* FS MRC-CCK */
  79. { 0, 1 }, /* lvl 0 */
  80. { 1, 1 }, /* lvl 1 */
  81. { 2, 1 }, /* lvl 2 (default) */
  82. { 3, 1 }, /* lvl 3 */
  83. { 4, 0 }, /* lvl 4 */
  84. { 5, 0 }, /* lvl 5 */
  85. { 6, 0 }, /* lvl 6 */
  86. { 7, 0 }, /* lvl 7 (only for high rssi) */
  87. { 8, 0 } /* lvl 8 (only for high rssi) */
  88. };
  89. #define ATH9K_ANI_CCK_NUM_LEVEL \
  90. ARRAY_SIZE(cck_level_table)
  91. #define ATH9K_ANI_CCK_MAX_LEVEL \
  92. (ATH9K_ANI_CCK_NUM_LEVEL-1)
  93. #define ATH9K_ANI_CCK_MAX_LEVEL_LOW_RSSI \
  94. (ATH9K_ANI_CCK_NUM_LEVEL-3)
  95. #define ATH9K_ANI_CCK_DEF_LEVEL \
  96. 2 /* default level - matches the INI settings */
  97. static void ath9k_hw_update_mibstats(struct ath_hw *ah,
  98. struct ath9k_mib_stats *stats)
  99. {
  100. u32 addr[5] = {AR_RTS_OK, AR_RTS_FAIL, AR_ACK_FAIL,
  101. AR_FCS_FAIL, AR_BEACON_CNT};
  102. u32 data[5];
  103. REG_READ_MULTI(ah, &addr[0], &data[0], 5);
  104. /* AR_RTS_OK */
  105. stats->rts_good += data[0];
  106. /* AR_RTS_FAIL */
  107. stats->rts_bad += data[1];
  108. /* AR_ACK_FAIL */
  109. stats->ackrcv_bad += data[2];
  110. /* AR_FCS_FAIL */
  111. stats->fcs_bad += data[3];
  112. /* AR_BEACON_CNT */
  113. stats->beacons += data[4];
  114. }
  115. static void ath9k_ani_restart(struct ath_hw *ah)
  116. {
  117. struct ar5416AniState *aniState = &ah->ani;
  118. aniState->listenTime = 0;
  119. ENABLE_REGWRITE_BUFFER(ah);
  120. REG_WRITE(ah, AR_PHY_ERR_1, 0);
  121. REG_WRITE(ah, AR_PHY_ERR_2, 0);
  122. REG_WRITE(ah, AR_PHY_ERR_MASK_1, AR_PHY_ERR_OFDM_TIMING);
  123. REG_WRITE(ah, AR_PHY_ERR_MASK_2, AR_PHY_ERR_CCK_TIMING);
  124. REGWRITE_BUFFER_FLUSH(ah);
  125. ath9k_hw_update_mibstats(ah, &ah->ah_mibStats);
  126. aniState->ofdmPhyErrCount = 0;
  127. aniState->cckPhyErrCount = 0;
  128. }
  129. /* Adjust the OFDM Noise Immunity Level */
  130. static void ath9k_hw_set_ofdm_nil(struct ath_hw *ah, u8 immunityLevel,
  131. bool scan)
  132. {
  133. struct ar5416AniState *aniState = &ah->ani;
  134. struct ath_common *common = ath9k_hw_common(ah);
  135. const struct ani_ofdm_level_entry *entry_ofdm;
  136. const struct ani_cck_level_entry *entry_cck;
  137. bool weak_sig;
  138. ath_dbg(common, ANI, "**** ofdmlevel %d=>%d, rssi=%d[lo=%d hi=%d]\n",
  139. aniState->ofdmNoiseImmunityLevel,
  140. immunityLevel, BEACON_RSSI(ah),
  141. ATH9K_ANI_RSSI_THR_LOW,
  142. ATH9K_ANI_RSSI_THR_HIGH);
  143. if (AR_SREV_9100(ah) && immunityLevel < ATH9K_ANI_OFDM_DEF_LEVEL)
  144. immunityLevel = ATH9K_ANI_OFDM_DEF_LEVEL;
  145. if (!scan)
  146. aniState->ofdmNoiseImmunityLevel = immunityLevel;
  147. entry_ofdm = &ofdm_level_table[aniState->ofdmNoiseImmunityLevel];
  148. entry_cck = &cck_level_table[aniState->cckNoiseImmunityLevel];
  149. if (aniState->spurImmunityLevel != entry_ofdm->spur_immunity_level)
  150. ath9k_hw_ani_control(ah,
  151. ATH9K_ANI_SPUR_IMMUNITY_LEVEL,
  152. entry_ofdm->spur_immunity_level);
  153. if (aniState->firstepLevel != entry_ofdm->fir_step_level &&
  154. entry_ofdm->fir_step_level >= entry_cck->fir_step_level)
  155. ath9k_hw_ani_control(ah,
  156. ATH9K_ANI_FIRSTEP_LEVEL,
  157. entry_ofdm->fir_step_level);
  158. weak_sig = entry_ofdm->ofdm_weak_signal_on;
  159. if (ah->opmode == NL80211_IFTYPE_STATION &&
  160. BEACON_RSSI(ah) <= ATH9K_ANI_RSSI_THR_HIGH)
  161. weak_sig = true;
  162. /*
  163. * Newer chipsets are better at dealing with high PHY error counts -
  164. * keep weak signal detection enabled when no RSSI threshold is
  165. * available to determine if it is needed (mode != STA)
  166. */
  167. else if (AR_SREV_9300_20_OR_LATER(ah) &&
  168. ah->opmode != NL80211_IFTYPE_STATION)
  169. weak_sig = true;
  170. /* Older chipsets are more sensitive to high PHY error counts */
  171. else if (!AR_SREV_9300_20_OR_LATER(ah) &&
  172. aniState->ofdmNoiseImmunityLevel >= 8)
  173. weak_sig = false;
  174. if (aniState->ofdmWeakSigDetect != weak_sig)
  175. ath9k_hw_ani_control(ah, ATH9K_ANI_OFDM_WEAK_SIGNAL_DETECTION,
  176. weak_sig);
  177. if (!AR_SREV_9300_20_OR_LATER(ah))
  178. return;
  179. if (aniState->ofdmNoiseImmunityLevel >= ATH9K_ANI_OFDM_DEF_LEVEL) {
  180. ah->config.ofdm_trig_high = ATH9K_ANI_OFDM_TRIG_HIGH;
  181. ah->config.ofdm_trig_low = ATH9K_ANI_OFDM_TRIG_LOW_ABOVE_INI;
  182. } else {
  183. ah->config.ofdm_trig_high = ATH9K_ANI_OFDM_TRIG_HIGH_BELOW_INI;
  184. ah->config.ofdm_trig_low = ATH9K_ANI_OFDM_TRIG_LOW;
  185. }
  186. }
  187. static void ath9k_hw_ani_ofdm_err_trigger(struct ath_hw *ah)
  188. {
  189. struct ar5416AniState *aniState = &ah->ani;
  190. if (aniState->ofdmNoiseImmunityLevel < ATH9K_ANI_OFDM_MAX_LEVEL)
  191. ath9k_hw_set_ofdm_nil(ah, aniState->ofdmNoiseImmunityLevel + 1, false);
  192. }
  193. /*
  194. * Set the ANI settings to match an CCK level.
  195. */
  196. static void ath9k_hw_set_cck_nil(struct ath_hw *ah, u_int8_t immunityLevel,
  197. bool scan)
  198. {
  199. struct ar5416AniState *aniState = &ah->ani;
  200. struct ath_common *common = ath9k_hw_common(ah);
  201. const struct ani_ofdm_level_entry *entry_ofdm;
  202. const struct ani_cck_level_entry *entry_cck;
  203. ath_dbg(common, ANI, "**** ccklevel %d=>%d, rssi=%d[lo=%d hi=%d]\n",
  204. aniState->cckNoiseImmunityLevel, immunityLevel,
  205. BEACON_RSSI(ah), ATH9K_ANI_RSSI_THR_LOW,
  206. ATH9K_ANI_RSSI_THR_HIGH);
  207. if (AR_SREV_9100(ah) && immunityLevel < ATH9K_ANI_CCK_DEF_LEVEL)
  208. immunityLevel = ATH9K_ANI_CCK_DEF_LEVEL;
  209. if (ah->opmode == NL80211_IFTYPE_STATION &&
  210. BEACON_RSSI(ah) <= ATH9K_ANI_RSSI_THR_LOW &&
  211. immunityLevel > ATH9K_ANI_CCK_MAX_LEVEL_LOW_RSSI)
  212. immunityLevel = ATH9K_ANI_CCK_MAX_LEVEL_LOW_RSSI;
  213. if (!scan)
  214. aniState->cckNoiseImmunityLevel = immunityLevel;
  215. entry_ofdm = &ofdm_level_table[aniState->ofdmNoiseImmunityLevel];
  216. entry_cck = &cck_level_table[aniState->cckNoiseImmunityLevel];
  217. if (aniState->firstepLevel != entry_cck->fir_step_level &&
  218. entry_cck->fir_step_level >= entry_ofdm->fir_step_level)
  219. ath9k_hw_ani_control(ah,
  220. ATH9K_ANI_FIRSTEP_LEVEL,
  221. entry_cck->fir_step_level);
  222. /* Skip MRC CCK for pre AR9003 families */
  223. if (!AR_SREV_9300_20_OR_LATER(ah) || AR_SREV_9485(ah) ||
  224. AR_SREV_9565(ah) || AR_SREV_9561(ah))
  225. return;
  226. if (aniState->mrcCCK != entry_cck->mrc_cck_on)
  227. ath9k_hw_ani_control(ah,
  228. ATH9K_ANI_MRC_CCK,
  229. entry_cck->mrc_cck_on);
  230. }
  231. static void ath9k_hw_ani_cck_err_trigger(struct ath_hw *ah)
  232. {
  233. struct ar5416AniState *aniState = &ah->ani;
  234. if (aniState->cckNoiseImmunityLevel < ATH9K_ANI_CCK_MAX_LEVEL)
  235. ath9k_hw_set_cck_nil(ah, aniState->cckNoiseImmunityLevel + 1,
  236. false);
  237. }
  238. /*
  239. * only lower either OFDM or CCK errors per turn
  240. * we lower the other one next time
  241. */
  242. static void ath9k_hw_ani_lower_immunity(struct ath_hw *ah)
  243. {
  244. struct ar5416AniState *aniState = &ah->ani;
  245. /* lower OFDM noise immunity */
  246. if (aniState->ofdmNoiseImmunityLevel > 0 &&
  247. (aniState->ofdmsTurn || aniState->cckNoiseImmunityLevel == 0)) {
  248. ath9k_hw_set_ofdm_nil(ah, aniState->ofdmNoiseImmunityLevel - 1,
  249. false);
  250. return;
  251. }
  252. /* lower CCK noise immunity */
  253. if (aniState->cckNoiseImmunityLevel > 0)
  254. ath9k_hw_set_cck_nil(ah, aniState->cckNoiseImmunityLevel - 1,
  255. false);
  256. }
  257. /*
  258. * Restore the ANI parameters in the HAL and reset the statistics.
  259. * This routine should be called for every hardware reset and for
  260. * every channel change.
  261. */
  262. void ath9k_ani_reset(struct ath_hw *ah, bool is_scanning)
  263. {
  264. struct ar5416AniState *aniState = &ah->ani;
  265. struct ath9k_channel *chan = ah->curchan;
  266. struct ath_common *common = ath9k_hw_common(ah);
  267. int ofdm_nil, cck_nil;
  268. if (!chan)
  269. return;
  270. BUG_ON(aniState == NULL);
  271. ah->stats.ast_ani_reset++;
  272. ofdm_nil = max_t(int, ATH9K_ANI_OFDM_DEF_LEVEL,
  273. aniState->ofdmNoiseImmunityLevel);
  274. cck_nil = max_t(int, ATH9K_ANI_CCK_DEF_LEVEL,
  275. aniState->cckNoiseImmunityLevel);
  276. if (is_scanning ||
  277. (ah->opmode != NL80211_IFTYPE_STATION &&
  278. ah->opmode != NL80211_IFTYPE_ADHOC)) {
  279. /*
  280. * If we're scanning or in AP mode, the defaults (ini)
  281. * should be in place. For an AP we assume the historical
  282. * levels for this channel are probably outdated so start
  283. * from defaults instead.
  284. */
  285. if (aniState->ofdmNoiseImmunityLevel !=
  286. ATH9K_ANI_OFDM_DEF_LEVEL ||
  287. aniState->cckNoiseImmunityLevel !=
  288. ATH9K_ANI_CCK_DEF_LEVEL) {
  289. ath_dbg(common, ANI,
  290. "Restore defaults: opmode %u chan %d Mhz is_scanning=%d ofdm:%d cck:%d\n",
  291. ah->opmode,
  292. chan->channel,
  293. is_scanning,
  294. aniState->ofdmNoiseImmunityLevel,
  295. aniState->cckNoiseImmunityLevel);
  296. ofdm_nil = ATH9K_ANI_OFDM_DEF_LEVEL;
  297. cck_nil = ATH9K_ANI_CCK_DEF_LEVEL;
  298. }
  299. } else {
  300. /*
  301. * restore historical levels for this channel
  302. */
  303. ath_dbg(common, ANI,
  304. "Restore history: opmode %u chan %d Mhz is_scanning=%d ofdm:%d cck:%d\n",
  305. ah->opmode,
  306. chan->channel,
  307. is_scanning,
  308. aniState->ofdmNoiseImmunityLevel,
  309. aniState->cckNoiseImmunityLevel);
  310. }
  311. ath9k_hw_set_ofdm_nil(ah, ofdm_nil, is_scanning);
  312. ath9k_hw_set_cck_nil(ah, cck_nil, is_scanning);
  313. ath9k_ani_restart(ah);
  314. }
  315. static bool ath9k_hw_ani_read_counters(struct ath_hw *ah)
  316. {
  317. struct ath_common *common = ath9k_hw_common(ah);
  318. struct ar5416AniState *aniState = &ah->ani;
  319. u32 phyCnt1, phyCnt2;
  320. int32_t listenTime;
  321. ath_hw_cycle_counters_update(common);
  322. listenTime = ath_hw_get_listen_time(common);
  323. if (listenTime <= 0) {
  324. ah->stats.ast_ani_lneg_or_lzero++;
  325. ath9k_ani_restart(ah);
  326. return false;
  327. }
  328. aniState->listenTime += listenTime;
  329. ath9k_hw_update_mibstats(ah, &ah->ah_mibStats);
  330. phyCnt1 = REG_READ(ah, AR_PHY_ERR_1);
  331. phyCnt2 = REG_READ(ah, AR_PHY_ERR_2);
  332. ah->stats.ast_ani_ofdmerrs += phyCnt1 - aniState->ofdmPhyErrCount;
  333. aniState->ofdmPhyErrCount = phyCnt1;
  334. ah->stats.ast_ani_cckerrs += phyCnt2 - aniState->cckPhyErrCount;
  335. aniState->cckPhyErrCount = phyCnt2;
  336. return true;
  337. }
  338. void ath9k_hw_ani_monitor(struct ath_hw *ah, struct ath9k_channel *chan)
  339. {
  340. struct ar5416AniState *aniState = &ah->ani;
  341. struct ath_common *common = ath9k_hw_common(ah);
  342. u32 ofdmPhyErrRate, cckPhyErrRate;
  343. if (!ath9k_hw_ani_read_counters(ah))
  344. return;
  345. ofdmPhyErrRate = aniState->ofdmPhyErrCount * 1000 /
  346. aniState->listenTime;
  347. cckPhyErrRate = aniState->cckPhyErrCount * 1000 /
  348. aniState->listenTime;
  349. ath_dbg(common, ANI,
  350. "listenTime=%d OFDM:%d errs=%d/s CCK:%d errs=%d/s ofdm_turn=%d\n",
  351. aniState->listenTime,
  352. aniState->ofdmNoiseImmunityLevel,
  353. ofdmPhyErrRate, aniState->cckNoiseImmunityLevel,
  354. cckPhyErrRate, aniState->ofdmsTurn);
  355. if (aniState->listenTime > ah->aniperiod) {
  356. if (cckPhyErrRate < ah->config.cck_trig_low &&
  357. ofdmPhyErrRate < ah->config.ofdm_trig_low) {
  358. ath9k_hw_ani_lower_immunity(ah);
  359. aniState->ofdmsTurn = !aniState->ofdmsTurn;
  360. } else if (ofdmPhyErrRate > ah->config.ofdm_trig_high) {
  361. ath9k_hw_ani_ofdm_err_trigger(ah);
  362. aniState->ofdmsTurn = false;
  363. } else if (cckPhyErrRate > ah->config.cck_trig_high) {
  364. ath9k_hw_ani_cck_err_trigger(ah);
  365. aniState->ofdmsTurn = true;
  366. } else
  367. return;
  368. ath9k_ani_restart(ah);
  369. }
  370. }
  371. EXPORT_SYMBOL(ath9k_hw_ani_monitor);
  372. void ath9k_enable_mib_counters(struct ath_hw *ah)
  373. {
  374. struct ath_common *common = ath9k_hw_common(ah);
  375. ath_dbg(common, ANI, "Enable MIB counters\n");
  376. ath9k_hw_update_mibstats(ah, &ah->ah_mibStats);
  377. ENABLE_REGWRITE_BUFFER(ah);
  378. REG_WRITE(ah, AR_FILT_OFDM, 0);
  379. REG_WRITE(ah, AR_FILT_CCK, 0);
  380. REG_WRITE(ah, AR_MIBC,
  381. ~(AR_MIBC_COW | AR_MIBC_FMC | AR_MIBC_CMC | AR_MIBC_MCS)
  382. & 0x0f);
  383. REG_WRITE(ah, AR_PHY_ERR_MASK_1, AR_PHY_ERR_OFDM_TIMING);
  384. REG_WRITE(ah, AR_PHY_ERR_MASK_2, AR_PHY_ERR_CCK_TIMING);
  385. REGWRITE_BUFFER_FLUSH(ah);
  386. }
  387. /* Freeze the MIB counters, get the stats and then clear them */
  388. void ath9k_hw_disable_mib_counters(struct ath_hw *ah)
  389. {
  390. struct ath_common *common = ath9k_hw_common(ah);
  391. ath_dbg(common, ANI, "Disable MIB counters\n");
  392. REG_WRITE(ah, AR_MIBC, AR_MIBC_FMC);
  393. ath9k_hw_update_mibstats(ah, &ah->ah_mibStats);
  394. REG_WRITE(ah, AR_MIBC, AR_MIBC_CMC);
  395. REG_WRITE(ah, AR_FILT_OFDM, 0);
  396. REG_WRITE(ah, AR_FILT_CCK, 0);
  397. }
  398. EXPORT_SYMBOL(ath9k_hw_disable_mib_counters);
  399. void ath9k_hw_ani_init(struct ath_hw *ah)
  400. {
  401. struct ath_common *common = ath9k_hw_common(ah);
  402. struct ar5416AniState *ani = &ah->ani;
  403. ath_dbg(common, ANI, "Initialize ANI\n");
  404. if (AR_SREV_9300_20_OR_LATER(ah)) {
  405. ah->config.ofdm_trig_high = ATH9K_ANI_OFDM_TRIG_HIGH;
  406. ah->config.ofdm_trig_low = ATH9K_ANI_OFDM_TRIG_LOW;
  407. ah->config.cck_trig_high = ATH9K_ANI_CCK_TRIG_HIGH;
  408. ah->config.cck_trig_low = ATH9K_ANI_CCK_TRIG_LOW;
  409. } else {
  410. ah->config.ofdm_trig_high = ATH9K_ANI_OFDM_TRIG_HIGH_OLD;
  411. ah->config.ofdm_trig_low = ATH9K_ANI_OFDM_TRIG_LOW_OLD;
  412. ah->config.cck_trig_high = ATH9K_ANI_CCK_TRIG_HIGH_OLD;
  413. ah->config.cck_trig_low = ATH9K_ANI_CCK_TRIG_LOW_OLD;
  414. }
  415. ani->spurImmunityLevel = ATH9K_ANI_SPUR_IMMUNE_LVL;
  416. ani->firstepLevel = ATH9K_ANI_FIRSTEP_LVL;
  417. ani->mrcCCK = AR_SREV_9300_20_OR_LATER(ah) ? true : false;
  418. ani->ofdmsTurn = true;
  419. ani->ofdmWeakSigDetect = true;
  420. ani->cckNoiseImmunityLevel = ATH9K_ANI_CCK_DEF_LEVEL;
  421. ani->ofdmNoiseImmunityLevel = ATH9K_ANI_OFDM_DEF_LEVEL;
  422. /*
  423. * since we expect some ongoing maintenance on the tables, let's sanity
  424. * check here default level should not modify INI setting.
  425. */
  426. ah->aniperiod = ATH9K_ANI_PERIOD;
  427. ah->config.ani_poll_interval = ATH9K_ANI_POLLINTERVAL;
  428. ath9k_ani_restart(ah);
  429. ath9k_enable_mib_counters(ah);
  430. }