ath9k_hw: fix OFDM weak signal detection handling
authorFelix Fietkau <nbd@openwrt.org>
Fri, 15 Jun 2012 13:25:20 +0000 (15:25 +0200)
committerJohn W. Linville <linville@tuxdriver.com>
Wed, 20 Jun 2012 18:44:41 +0000 (14:44 -0400)
Commit "ath9k_hw: improve ANI processing and rx desensitizing parameters"
was unifying some code related to overriding OFDM weak signal detection,
but seems to have gotten some of the original intent wrong, probably
because of a misnamed variable.

The beacon RSSI is only valid in station mode, and the main reason to check
it in ath9k_hw_set_ofdm_nil is to make sure that OFDM weak signal detection
stays enabled if the RSSI is low, even when the OFDM noise immunity entry
is supposed to disable it.

The above commit removed the mode checks and changed the code so that
OFDM weak signal detection would only be changed if the rssi is high, which
is wrong for everything but client mode.

This patch restores the old behavior in a simplified form.

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
drivers/net/wireless/ath/ath9k/ani.c

index 18ce69d7feacb2dd1ff3158ffa34d749b2ebf083..cf310508cac51386acdafe33b1fefad2381fba17 100644 (file)
@@ -265,6 +265,7 @@ static void ath9k_hw_set_ofdm_nil(struct ath_hw *ah, u8 immunityLevel)
        struct ath_common *common = ath9k_hw_common(ah);
        const struct ani_ofdm_level_entry *entry_ofdm;
        const struct ani_cck_level_entry *entry_cck;
+       bool weak_sig;
 
        ath_dbg(common, ANI, "**** ofdmlevel %d=>%d, rssi=%d[lo=%d hi=%d]\n",
                aniState->ofdmNoiseImmunityLevel,
@@ -290,13 +291,15 @@ static void ath9k_hw_set_ofdm_nil(struct ath_hw *ah, u8 immunityLevel)
                                     ATH9K_ANI_FIRSTEP_LEVEL,
                                     entry_ofdm->fir_step_level);
 
-       if (BEACON_RSSI(ah) >= aniState->rssiThrHigh &&
-           (!aniState->ofdmWeakSigDetectOff !=
-            entry_ofdm->ofdm_weak_signal_on)) {
+       weak_sig = entry_ofdm->ofdm_weak_signal_on;
+       if (ah->opmode == NL80211_IFTYPE_STATION &&
+           BEACON_RSSI(ah) <= aniState->rssiThrHigh)
+               weak_sig = true;
+
+       if (!aniState->ofdmWeakSigDetectOff != weak_sig)
                        ath9k_hw_ani_control(ah,
                                ATH9K_ANI_OFDM_WEAK_SIGNAL_DETECTION,
                                entry_ofdm->ofdm_weak_signal_on);
-       }
 }
 
 static void ath9k_hw_ani_ofdm_err_trigger(struct ath_hw *ah)