diff mbox

ath9k: mark RSSI as invalid if frame received during channel setup

Message ID AM4PR0101MB2305369CE7574F25AA0AB680E4F50@AM4PR0101MB2305.eurprd01.prod.exchangelabs.com (mailing list archive)
State Rejected
Delegated to: Kalle Valo
Headers show

Commit Message

Jean-Pierre TOSONI Feb. 14, 2018, 2:47 p.m. UTC
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@acksys.fr>

---
 .../a995-b-acksys-ath9k-wait-channel-change.patch  |   39 ++++++++++++++++++++
 1 files changed, 39 insertions(+), 0 deletions(-)
 create mode 100644 package/kernel/mac80211/patches/a995-b-acksys-ath9k-wait-channel-change.patch

-- 
1.7.2.5

Comments

Kalle Valo Feb. 14, 2018, 4:04 p.m. UTC | #1
Jean Pierre TOSONI <jp.tosoni@acksys.fr> writes:

> 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@acksys.fr>
> ---
>  .../a995-b-acksys-ath9k-wait-channel-change.patch  |   39 ++++++++++++++++++++
>  1 files changed, 39 insertions(+), 0 deletions(-)
>  create mode 100644 package/kernel/mac80211/patches/a995-b-acksys-ath9k-wait-channel-change.patch

This looks like a patch for LEDE, not for a Linux kernel tree.
diff mbox

Patch

diff --git a/package/kernel/mac80211/patches/a995-b-acksys-ath9k-wait-channel-change.patch b/package/kernel/mac80211/patches/a995-b-acksys-ath9k-wait-channel-change.patch
new file mode 100644
index 0000000..d1e1146
--- /dev/null
+++ b/package/kernel/mac80211/patches/a995-b-acksys-ath9k-wait-channel-change.patch
@@ -0,0 +1,39 @@ 
+--- a/drivers/net/wireless/ath/ath9k/ani.c
++++ b/drivers/net/wireless/ath/ath9k/ani.c
+@@ -333,6 +333,7 @@ void ath9k_ani_reset(struct ath_hw *ah,
+ 		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,
+--- a/drivers/net/wireless/ath/ath9k/common.c
++++ b/drivers/net/wireless/ath/ath9k/common.c
+@@ -220,6 +220,16 @@ void ath9k_cmn_process_rssi(struct ath_c
+ 	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) {
+--- a/drivers/net/wireless/ath/ath9k/hw.h
++++ b/drivers/net/wireless/ath/ath9k/hw.h
+@@ -816,6 +816,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;