Commit 2ef16755 authored by Felix Fietkau's avatar Felix Fietkau Committed by John W. Linville

ath9k: fix signal strength reporting issues

On A-MPDU frames, the hardware only reports valid signal strength data for
the last subframe. The driver also mangled rx_stats->rs_rssi using the
ATH_EP_RND macro in a way that may make sense for ANI, but definitely
not for reporting to mac80211.
This patch changes the code to calculate the signal strength from the rssi
directly instead of taking the average value, and flag everything but
the last subframe in an A-MPDU to tell mac80211 to ignore the signal strength
entirely, fixing signal strength fluctuation issues reported by various
users.
Signed-off-by: default avatarFelix Fietkau <nbd@openwrt.org>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent 3a2923e8
...@@ -948,6 +948,7 @@ static void ath9k_process_rssi(struct ath_common *common, ...@@ -948,6 +948,7 @@ static void ath9k_process_rssi(struct ath_common *common,
struct ath_softc *sc = hw->priv; struct ath_softc *sc = hw->priv;
struct ath_hw *ah = common->ah; struct ath_hw *ah = common->ah;
int last_rssi; int last_rssi;
int rssi = rx_stats->rs_rssi;
if (!rx_stats->is_mybeacon || if (!rx_stats->is_mybeacon ||
((ah->opmode != NL80211_IFTYPE_STATION) && ((ah->opmode != NL80211_IFTYPE_STATION) &&
...@@ -959,13 +960,12 @@ static void ath9k_process_rssi(struct ath_common *common, ...@@ -959,13 +960,12 @@ static void ath9k_process_rssi(struct ath_common *common,
last_rssi = sc->last_rssi; last_rssi = sc->last_rssi;
if (likely(last_rssi != ATH_RSSI_DUMMY_MARKER)) if (likely(last_rssi != ATH_RSSI_DUMMY_MARKER))
rx_stats->rs_rssi = ATH_EP_RND(last_rssi, rssi = ATH_EP_RND(last_rssi, ATH_RSSI_EP_MULTIPLIER);
ATH_RSSI_EP_MULTIPLIER); if (rssi < 0)
if (rx_stats->rs_rssi < 0) rssi = 0;
rx_stats->rs_rssi = 0;
/* Update Beacon RSSI, this is used by ANI. */ /* Update Beacon RSSI, this is used by ANI. */
ah->stats.avgbrssi = rx_stats->rs_rssi; ah->stats.avgbrssi = rssi;
} }
/* /*
...@@ -1005,6 +1005,8 @@ static int ath9k_rx_skb_preprocess(struct ath_common *common, ...@@ -1005,6 +1005,8 @@ static int ath9k_rx_skb_preprocess(struct ath_common *common,
rx_status->signal = ah->noise + rx_stats->rs_rssi; rx_status->signal = ah->noise + rx_stats->rs_rssi;
rx_status->antenna = rx_stats->rs_antenna; rx_status->antenna = rx_stats->rs_antenna;
rx_status->flag |= RX_FLAG_MACTIME_MPDU; rx_status->flag |= RX_FLAG_MACTIME_MPDU;
if (rx_stats->rs_moreaggr)
rx_status->flag |= RX_FLAG_NO_SIGNAL_VAL;
return 0; return 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment