ath9k: fix signal strength of received packets
PATCH 1/3 ath9k: fix signal strength of received packets
The reported RSSI values are relative to the calibrated noise floor, not relative to a hardcoded value of -95.
--- drivers/net/wireless/ath/ath9k/recv.c | 11 ++++++++++- 1 files changed, 10 insertions(+), 1 deletions(-)
drivers/net/wireless/ath/ath9k/recv.c +10 -1
@@ -959,6 +959,9 @@ static int ath9k_rx_skb_preprocess(struct ath_common *common,struct ieee80211_rx_status *rx_status, bool *decrypt_error) { + struct ath_hw *ah = common->ah; +int noise; +memset (rx_status,0 ,sizeof (struct ieee80211_rx_status ));/*
@@ -979,7 +982,13 @@ static int ath9k_rx_skb_preprocess(struct ath_common *common, rx_status->band = hw->conf.channel->band; rx_status->freq = hw->conf.channel->center_freq; - rx_status->signal =ATH_DEFAULT_NOISE_FLOOR + rx_stats->rs_rssi; + +if (ah->curchan) + noise = ah->curchan->noisefloor; +else + noise =ATH_DEFAULT_NOISE_FLOOR ; + + rx_status->signal = noise + rx_stats->rs_rssi; rx_status->antenna = rx_stats->rs_antenna; rx_status->flag |=RX_FLAG_MACTIME_MPDU ;
Signature · 1 line
1.7.3.2
PATCH 2/3 ath9k: fix beacon slot processing in ad-hoc mode
The recent cleanups in the beacon code fixed SWBA backoff calculation, however it did not remove a line of code that worked around the issues from the earlier version of the code.
After the cleanup, the initial TSF based slot calculation now always returns 0 instead of ATH_BCBUF-1, so the previous hack that reversed the slot order needs to be removed, as ad-hoc mode does not use staggered beacons.
--- drivers/net/wireless/ath/ath9k/beacon.c | 8 -------- 1 files changed, 0 insertions(+), 8 deletions(-)
drivers/net/wireless/ath/ath9k/beacon.c +0 -8
@@ -392,14 +392,6 @@ void ath_beacon_tasklet(unsigned long data) tsf +=TU_TO_USEC (ah->config.sw_beacon_response_time); tsftu =TSF_TO_TU ((tsf *ATH_BCBUF ) >>32 , tsf *ATH_BCBUF ); slot = (tsftu % (intval *ATH_BCBUF )) / intval; -/* -* Reverse the slot order to get slot 0 on the TBTT offset that does -* not require TSF adjustment and other slots adding -* slot/ATH_BCBUF * beacon_int to timestamp. For example, with -* ATH_BCBUF = 4, we process beacon slots as follows: 3 2 1 0 3 2 1 .. -* and slot 0 is at correct offset to TBTT. -*/ - slot =ATH_BCBUF - slot -1 ; vif = sc->beacon.bslot[slot]; ath_dbg(common, ATH_DBG_BEACON,
Signature · 1 line
1.7.3.2
PATCH 3/3 ath9k: use the hw opmode to select the beacon timer mode
Since the beacon timers are global, the individual vif type should not be used to determine the beacon timer configuration mode, use the global opmode instead.
--- drivers/net/wireless/ath/ath9k/beacon.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/net/wireless/ath/ath9k/beacon.c +1 -1
@@ -700,7 +700,7 @@ void ath_beacon_config(struct ath_softc *sc, struct ieee80211_vif *vif)if (cur_conf->dtim_period ==0 ) cur_conf->dtim_period =1 ; -switch (iftype) { +switch (sc->sc_ah->opmode) {case NL80211_IFTYPE_AP :ath_beacon_config_ap (sc, cur_conf);break ;
Signature · 1 line
1.7.3.2
Quoted 23 lines · Felix Fietkau
The reported RSSI values are relative to the calibrated noise floor, not relative to a hardcoded value of -95.
Signed-off-by Felix Fietkau <[email protected]>--- drivers/net/wireless/ath/ath9k/recv.c | 11 ++++++++++- 1 files changed, 10 insertions(+), 1 deletions(-)drivers/net/wireless/ath/ath9k/recv.c +3
-0@@ -959,6 +959,9 @@ static int ath9k_rx_skb_preprocess(struct ath_common *common,struct ieee80211_rx_status *rx_status, bool *decrypt_error) { + struct ath_hw *ah = common->ah; +int noise; +memset (rx_status,0 ,sizeof (struct ieee80211_rx_status ));/*
drivers/net/wireless/ath/ath9k/recv.c static int ath9k_rx_skb_preprocess(struct ath_common *common, · line 982
Quoted 4 lines
drivers/net/wireless/ath/ath9k/recv.c +0
-1@@ -979,7 +982,13 @@ static int ath9k_rx_skb_preprocess(struct ath_common *common, rx_status->band = hw->conf.channel->band; rx_status->freq = hw->conf.channel->center_freq; - rx_status->signal =ATH_DEFAULT_NOISE_FLOOR + rx_stats->rs_rssi;
In some cases noisefloor values were not reliable and so using default works for most of the cases. Please refer to our earlier commit a59b5a5e684652eec035c869ab8911a1689c8f53. Let me see if i can get more information.
drivers/net/wireless/ath/ath9k/recv.c static int ath9k_rx_skb_preprocess(struct ath_common *common, · line 987
Quoted 3 lines
drivers/net/wireless/ath/ath9k/recv.c +3
-0+ +if (ah->curchan) + noise = ah->curchan->noisefloor;
Even otherwise, noisefloor can be zero sometimes and so it can return incorrect signal strengths.. Please refer to some samples.
BSS 00:10:18:90:3a:9e (on wlan56)
TSF: 110532917222 usec (1d, 06:42:12)
freq: 2462
beacon interval: 100
capability: ESS (0x0001)
signal: 50.00 dBm
last seen: 20 ms ago
SSID: Broadcom
Supported rates: 1.0* 2.0* 5.5* 11.0* 18.0 24.0 36.0 54.0
DS Parameter set: channel 11
ERP: NonERP_Present Use_Protection Barker_Preamble_Mode
Extended supported rates: 6.0 9.0 12.0 48.0
HT capabilities:SS 00:03:7f:0b:a6:1b (on wlan56)
TSF: 4376472960 usec (0d, 01:12:56)
freq: 2462
beacon interval: 100
capability: ESS Privacy ShortPreamble (0x0031)
signal: 60.00 dBm
last seen: 8 ms ago
SSID: STRESS-HB125Quoted 14 lines
drivers/net/wireless/ath/ath9k/recv.c +4
-0+else + noise =ATH_DEFAULT_NOISE_FLOOR ; + + rx_status->signal = noise + rx_stats->rs_rssi; rx_status->antenna = rx_stats->rs_antenna; rx_status->flag |=RX_FLAG_MACTIME_MPDU ;Signature · 6 lines
1.7.3.2 -- To unsubscribe from this list: send the line "unsubscribe linux-wireless" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 25 lines · Senthil Balasubramanian
Quoted 24 lines · Felix Fietkau
The reported RSSI values are relative to the calibrated noise floor, not relative to a hardcoded value of -95.
Signed-off-by Felix Fietkau<[email protected]>---
drivers/net/wireless/ath/ath9k/recv.c | 11 ++++++++++- 1 files changed, 10 insertions(+), 1 deletions(-)diff --git
a/drivers/net/wireless/ath/ath9k/recv.cb/drivers/net/wireless/ath/ath9k/recv.cindex a9c3f46..87d96c5 100644
---a/drivers/net/wireless/ath/ath9k/recv.c
+++b/drivers/net/wireless/ath/ath9k/recv.c
@@ -959,6 +959,9 @@ static int ath9k_rx_skb_preprocess(structath_common*common,
structieee80211_rx_status*rx_status,
bool*decrypt_error)
{
+ structath_hw*ah =common->ah;
+ int noise;
+
memset(rx_status, 0, sizeof(struct ieee80211_rx_status));/*
@@ -979,7 +982,13 @@ static int ath9k_rx_skb_preprocess(structath_common*common,
Quoted 7 lines
Quoted 3 lines
rx_status->band=hw->conf.channel->band;rx_status->freq=hw->conf.channel->center_freq;
-rx_status->signal=ATH_DEFAULT_NOISE_FLOOR+rx_stats->rs_rssi;In some cases noisefloor values were not reliable and so using default works for most of the cases. Please refer to our earlier commit
a59b5a5e684652eec035c869ab8911a1689c8f53. Let me see if i can get more information.
Well, if the average noise floor is at -110 (which is not uncommon with AR9280 chipsets) then that means the signal strength is off by at least 15 dBm as well.
Quoted 5 lines
Quoted 3 lines
+
+ if (ah->curchan)
+ noise =ah->curchan->noisefloor;Even otherwise, noisefloor can be zero sometimes and so it can return incorrect signal strengths.. Please refer to some samples.
OK, that's easy to fix, we only need to initialize the channel noisefloor when we switch to the channel. I'll make a patch to fix it the noisefloor values and then resend this one.
John, please drop this patch but apply the other two in the series.
- Felix