ath9k: Fix ANI for AP mode
authorSujith Manoharan <c_manoha@qca.qualcomm.com>
Mon, 17 Jun 2013 08:54:36 +0000 (14:24 +0530)
committerJohn W. Linville <linville@tuxdriver.com>
Mon, 17 Jun 2013 18:38:52 +0000 (14:38 -0400)
The commit "ath9k: Fix ANI monitoring" reverted an earlier
commit that adjusted ANI to improve performance. But, this causes
adverse effects in AP mode (as reported by Felix based on an OpenWrt
report). Use the older INI/period configuration for now until more
testing is done.

Cc: Felix Fietkau <nbd@openwrt.org>
Cc: Rajkumar Manoharan <rmanohar@qca.qualcomm.com>
Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
drivers/net/wireless/ath/ath9k/ani.c
drivers/net/wireless/ath/ath9k/ani.h

index a68beb19ce4d6e65aaab31f475be2dff51d6d20d..4994bea809eb00db15a8899ee5d2dd966002db4a 100644 (file)
@@ -186,6 +186,14 @@ static void ath9k_hw_set_ofdm_nil(struct ath_hw *ah, u8 immunityLevel,
                                     ATH9K_ANI_OFDM_WEAK_SIGNAL_DETECTION,
                                     entry_ofdm->ofdm_weak_signal_on);
        }
+
+       if (aniState->ofdmNoiseImmunityLevel >= ATH9K_ANI_OFDM_DEF_LEVEL) {
+               ah->config.ofdm_trig_high = ATH9K_ANI_OFDM_TRIG_HIGH;
+               ah->config.ofdm_trig_low = ATH9K_ANI_OFDM_TRIG_LOW_ABOVE_INI;
+       } else {
+               ah->config.ofdm_trig_high = ATH9K_ANI_OFDM_TRIG_HIGH_BELOW_INI;
+               ah->config.ofdm_trig_low = ATH9K_ANI_OFDM_TRIG_LOW;
+       }
 }
 
 static void ath9k_hw_ani_ofdm_err_trigger(struct ath_hw *ah)
@@ -420,25 +428,12 @@ void ath9k_hw_ani_monitor(struct ath_hw *ah, struct ath9k_channel *chan)
                ofdmPhyErrRate, aniState->cckNoiseImmunityLevel,
                cckPhyErrRate, aniState->ofdmsTurn);
 
-       if (aniState->listenTime > 5 * ah->aniperiod) {
-               /*
-                * Check if we need to lower immunity if
-                * 5 ani_periods have passed.
-                */
-               if (ofdmPhyErrRate <= ah->config.ofdm_trig_low &&
-                   cckPhyErrRate <= ah->config.cck_trig_low) {
+       if (aniState->listenTime > ah->aniperiod) {
+               if (cckPhyErrRate < ah->config.cck_trig_low &&
+                   ofdmPhyErrRate < ah->config.ofdm_trig_low) {
                        ath9k_hw_ani_lower_immunity(ah);
                        aniState->ofdmsTurn = !aniState->ofdmsTurn;
-               }
-               ath9k_ani_restart(ah);
-       } else if (aniState->listenTime > ah->aniperiod) {
-               /*
-                * Check if immunity has to be raised,
-                * (either OFDM or CCK).
-                */
-               if (ofdmPhyErrRate > ah->config.ofdm_trig_high &&
-                   (cckPhyErrRate <= ah->config.cck_trig_high ||
-                    aniState->ofdmsTurn)) {
+               } else if (ofdmPhyErrRate > ah->config.ofdm_trig_high) {
                        ath9k_hw_ani_ofdm_err_trigger(ah);
                        aniState->ofdmsTurn = false;
                } else if (cckPhyErrRate > ah->config.cck_trig_high) {
index 77a06fd40287aae33ff95de948cb7ce5b330bc0c..b54a3fb0188391eba46a797f923a15b40fe34b66 100644 (file)
 #define BEACON_RSSI(ahp) (ahp->stats.avgbrssi)
 
 /* units are errors per second */
-#define ATH9K_ANI_OFDM_TRIG_HIGH          1000
+#define ATH9K_ANI_OFDM_TRIG_HIGH           3500
+#define ATH9K_ANI_OFDM_TRIG_HIGH_BELOW_INI 1000
+
 #define ATH9K_ANI_OFDM_TRIG_LOW           400
+#define ATH9K_ANI_OFDM_TRIG_LOW_ABOVE_INI 900
+
 #define ATH9K_ANI_CCK_TRIG_HIGH           600
 #define ATH9K_ANI_CCK_TRIG_LOW            300