Search Linux Wireless

[PATCH v2] ath9k: mark RSSI as invalid if frame received during channel setup

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



ath9k returns a wrong RSSI value for frames received in a 30ms time
window after a channel change. The correct value is typically 10dB
below the returned value.

This was found with a Atheros AR9300 Rev:3 chip (WLE350NX / JWX6083
cards), during offchannel scans.

Mark the signal value as invalid in this case.

Signed-off-by: Jean Pierre TOSONI <jp.tosoni@xxxxxxxxx>
---
V2: replace LEDE patch with due kernel patch (with excuses to Kalle Valo)

 drivers/net/wireless/ath/ath9k/ani.c    |    1 +
 drivers/net/wireless/ath/ath9k/common.c |   10 ++++++++++
 drivers/net/wireless/ath/ath9k/hw.h     |    1 +
 3 files changed, 12 insertions(+), 0 deletions(-)

diff --git a/drivers/net/wireless/ath/ath9k/ani.c b/drivers/net/wireless/ath/ath9k/ani.c
index 5214dd7..a7e07ed 100644
--- a/drivers/net/wireless/ath/ath9k/ani.c
+++ b/drivers/net/wireless/ath/ath9k/ani.c
@@ -317,6 +317,7 @@ void ath9k_ani_reset(struct ath_hw *ah, bool is_scanning)
 		return;
 
 	BUG_ON(aniState == NULL);
+	ah->chan_stable_time = jiffies + (30*HZ)/1000; /* 30ms */
 	ah->stats.ast_ani_reset++;
 
 	ofdm_nil = max_t(int, ATH9K_ANI_OFDM_DEF_LEVEL,
diff --git a/drivers/net/wireless/ath/ath9k/common.c b/drivers/net/wireless/ath/ath9k/common.c
index 099f3d4..7e5f7a3 100644
--- a/drivers/net/wireless/ath/ath9k/common.c
+++ b/drivers/net/wireless/ath/ath9k/common.c
@@ -221,6 +221,16 @@ void ath9k_cmn_process_rssi(struct ath_common *common,
 	int i, j;
 
 	/*
+	 * RSSI is not available before 30ms after reset on ath9k.
+	 */
+	if (time_before(jiffies, ah->chan_stable_time)) {
+		ath_dbg(common, ANY, "early frame rssi=%d\n",rx_stats->rs_rssi);
+		rxs->flag |= RX_FLAG_NO_SIGNAL_VAL;
+		return;
+	}
+	ah->chan_stable_time = jiffies; /* advance stable time to cop with jiffies wraparound */
+
+	/*
 	 * RSSI is not available for subframes in an A-MPDU.
 	 */
 	if (rx_stats->rs_moreaggr) {
diff --git a/drivers/net/wireless/ath/ath9k/hw.h b/drivers/net/wireless/ath/ath9k/hw.h
index 9804a24..ec07da9 100644
--- a/drivers/net/wireless/ath/ath9k/hw.h
+++ b/drivers/net/wireless/ath/ath9k/hw.h
@@ -809,6 +809,7 @@ struct ath_hw {
 
 	bool reset_power_on;
 	bool htc_reset_init;
+	unsigned long chan_stable_time;
 
 	enum nl80211_iftype opmode;
 	enum ath9k_power_mode power_mode;
-- 
1.7.2.5





[Index of Archives]     [Linux Host AP]     [ATH6KL]     [Linux Wireless Personal Area Network]     [Linux Bluetooth]     [Wireless Regulations]     [Linux Netdev]     [Kernel Newbies]     [Linux Kernel]     [IDE]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite Hiking]     [MIPS Linux]     [ARM Linux]     [Linux RAID]

  Powered by Linux