Skip to contentSkip to conversation

wifi: mt76: feed the station RSSI average from the chain signals

PATCH New Cristian Papa 1 participant 1 message Sep 24

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 wifi: mt76: feed the station RSSI average from the chain signals

mt76_check_sta() adds status->signal of every received frame to the station's RSSI average, wcid->rssi, which mt76_get_min_avg_rssi() reads for the dynamic sensitivity of mt7603 and mt7615 and for the gain control of mt76x0 and mt76x2.

Since commit 4550fb9e9810 ("mt76: improve signal strength reporting"), drivers no longer set status->signal: mt76_rx_convert() computes it from the chain values when the frame is handed to mac80211, after mt76_check_sta() has run. Except on mt7921, which still sets it, the average is fed zeros. mt76_get_min_avg_rssi() then returns 0, so mt7603 and mt7615 leave the sensitivity at its default, and mt76x0 and mt76x2 fall back to -75 dBm for their gain settings.

Compute the signal from the chain values in mt76_check_sta() as well, as mt76_rx_convert() does. On mt7921, the average now follows the same combined value that mac80211 gets instead of the strongest chain.

Tested on a TP-Link Archer XR500v with one client, switching between the old and the new input every 30 seconds. On the MT7662E (mt76x2), the average the AGC works with was -75 dBm, its fallback, with the old input and -54 dBm with the new one, while iw reported -54 and -52 dBm for the station, and the AGC mostly used its low_gain 2 setting instead of 1. On the MT7603E, the station average was 0 with the old input and -41 dBm with the new one, while iw reported -42 and -41 dBm. The mt7603 sensitivity still stayed at its default: a separate bug keeps it from leaving 0.

Fixes 4550fb9e9810 ("mt76: improve signal strength reporting")
Assisted-by LLM

---
Testing: OpenWrt, kernel 6.18.41 with the mac80211 backport of 6.18.39, openwrt/mt76 at be5ce79105 plus this change and the board's local patches, with a temporary module parameter selecting the old or the new input (not part of this patch). One client; the old-input samples of each run come from the same minutes as the new ones.

Tools: an AI coding assistant (Claude Opus 5.5 in Claude Code) found the cause, wrote the instrumentation and drafted this change and changelog; the tests ran on my device.

 drivers/net/wireless/mediatek/mt76/mac80211.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
drivers/net/wireless/mediatek/mt76/mac80211.c +5 -2
index cda5c5d51..4231adb77 100644
@@ -1471,6 +1471,7 @@ mt76_check_sta(struct mt76_dev *dev, struct sk_buff *skb)
 	struct ieee80211_hw *hw;
 	struct mt76_wcid *wcid = status->wcid;
 	u8 tidno = status->qos_ctl & IEEE80211_QOS_CTL_TID_MASK;
+	int signal;
 	bool ps;
 
 	hw = mt76_phy_hw(dev, status->phy_idx);
@@ -1488,8 +1489,10 @@ mt76_check_sta(struct mt76_dev *dev, struct sk_buff *skb)
 
 	sta = container_of((void *)wcid, struct ieee80211_sta, drv_priv);
 
-	if (status->signal <= 0)
-		ewma_signal_add(&wcid->rssi, -status->signal);
+	/* status->signal is only set later, by mt76_rx_convert() */
+	signal = mt76_rx_signal(status->chains, status->chain_signal);
+	if (signal <= 0 && signal > -128)
+		ewma_signal_add(&wcid->rssi, -signal);
 
 	wcid->inactive_count = 0;
 
Signature · 1 line
2.47.3