A regression introduced by e5ba18c6901631237c49ec54ce54397369dea7fa caused loss of signal power information when using Atheros AR9271 chips in monitor mode.
Fix this by a partial revert of the aforementioned commit until root cause is found. Signed-off-by: Robert Millan <robert.mil...@beabloo.com> --- drivers/net/wireless/ath/ath9k/htc.h | 1 + drivers/net/wireless/ath/ath9k/htc_drv_init.c | 1 - drivers/net/wireless/ath/ath9k/htc_drv_main.c | 1 - drivers/net/wireless/ath/ath9k/htc_drv_txrx.c | 21 +++++++++++++++++++-- 4 files changed, 20 insertions(+), 4 deletions(-) diff --git a/drivers/net/wireless/ath/ath9k/htc.h b/drivers/net/wireless/ath/ath9k/htc.h index 16dff4b..c4a9fca 100644 --- a/drivers/net/wireless/ath/ath9k/htc.h +++ b/drivers/net/wireless/ath/ath9k/htc.h @@ -279,6 +279,7 @@ struct ath9k_htc_rxbuf { }; struct ath9k_htc_rx { + int last_rssi; /* FIXME: per-STA */ struct list_head rxbuf; spinlock_t rxbuflock; }; diff --git a/drivers/net/wireless/ath/ath9k/htc_drv_init.c b/drivers/net/wireless/ath/ath9k/htc_drv_init.c index b65c1b6..1052eb6 100644 --- a/drivers/net/wireless/ath/ath9k/htc_drv_init.c +++ b/drivers/net/wireless/ath/ath9k/htc_drv_init.c @@ -593,7 +593,6 @@ static void ath9k_init_misc(struct ath9k_htc_priv *priv) memcpy(common->bssidmask, ath_bcast_mac, ETH_ALEN); - common->last_rssi = ATH_RSSI_DUMMY_MARKER; priv->ah->opmode = NL80211_IFTYPE_STATION; priv->spec_priv.ah = priv->ah; diff --git a/drivers/net/wireless/ath/ath9k/htc_drv_main.c b/drivers/net/wireless/ath/ath9k/htc_drv_main.c index a553c91..ff22882 100644 --- a/drivers/net/wireless/ath/ath9k/htc_drv_main.c +++ b/drivers/net/wireless/ath/ath9k/htc_drv_main.c @@ -1489,7 +1489,6 @@ static void ath9k_htc_bss_iter(void *data, u8 *mac, struct ieee80211_vif *vif) if ((vif->type == NL80211_IFTYPE_STATION) && bss_conf->assoc) { common->curaid = bss_conf->aid; - common->last_rssi = ATH_RSSI_DUMMY_MARKER; memcpy(common->curbssid, bss_conf->bssid, ETH_ALEN); set_bit(ATH_OP_PRIM_STA_VIF, &common->op_flags); } diff --git a/drivers/net/wireless/ath/ath9k/htc_drv_txrx.c b/drivers/net/wireless/ath/ath9k/htc_drv_txrx.c index cea7a63..3c4f9df 100644 --- a/drivers/net/wireless/ath/ath9k/htc_drv_txrx.c +++ b/drivers/net/wireless/ath/ath9k/htc_drv_txrx.c @@ -924,6 +924,7 @@ void ath9k_host_rx_init(struct ath9k_htc_priv *priv) ath9k_hw_rxena(priv->ah); ath9k_htc_opmode_init(priv); ath9k_hw_startpcureceive(priv->ah, test_bit(ATH_OP_SCANNING, &common->op_flags)); + priv->rx.last_rssi = ATH_RSSI_DUMMY_MARKER; } static inline void convert_htc_flag(struct ath_rx_status *rx_stats, @@ -972,6 +973,7 @@ static bool ath9k_rx_prepare(struct ath9k_htc_priv *priv, struct ath_htc_rx_status *rxstatus; struct ath_rx_status rx_stats; bool decrypt_error = false; + int last_rssi = ATH_RSSI_DUMMY_MARKER; if (skb->len < HTC_RX_FRAME_HEADER_SIZE) { ath_err(common, "Corrupted RX frame, dropping (len: %d)\n", @@ -1029,8 +1031,23 @@ static bool ath9k_rx_prepare(struct ath9k_htc_priv *priv, if (ath9k_cmn_process_rate(common, hw, &rx_stats, rx_status)) goto rx_next; - rx_stats.is_mybeacon = ath_is_mybeacon(common, hdr); - ath9k_cmn_process_rssi(common, hw, &rx_stats, rx_status); + if (rxbuf->rxstatus.rs_rssi != ATH9K_RSSI_BAD && + !rxbuf->rxstatus.rs_moreaggr) + ATH_RSSI_LPF(priv->rx.last_rssi, + rxbuf->rxstatus.rs_rssi); + last_rssi = priv->rx.last_rssi; + + if (ath_is_mybeacon(common, hdr)) { + s8 rssi = rxbuf->rxstatus.rs_rssi; + + if (likely(last_rssi != ATH_RSSI_DUMMY_MARKER)) + rssi = ATH_EP_RND(last_rssi, ATH_RSSI_EP_MULTIPLIER); + + if (rssi < 0) + rssi = 0; + + priv->ah->stats.avgbrssi = rssi; + } rx_status->band = ah->curchan->chan->band; rx_status->freq = ah->curchan->chan->center_freq; -- 1.9.1 _______________________________________________ ath9k-devel mailing list ath9k-devel@lists.ath9k.org https://lists.ath9k.org/mailman/listinfo/ath9k-devel