mt7601u: use EWMA to calculate avg_rssi
avr_rssi is not calculated correctly as we do not divide result by 256 (mt76 sum avg_rssi1 and avg_rssi2 and divide by 512). However dividing by 256 will make avg_rssi almost the same as last rssi value - not really an average. So use EWMA to calculate avg_rssi. I've chosen weight_rcp=4 to convergence quicker on signal strength changes. Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com> Acked-by: Jakub Kicinski <kubakici@wp.pl> Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
This commit is contained in:

committed by
Kalle Valo

parent
b9e5d4feb4
commit
b305a6ab02
@@ -453,7 +453,7 @@ mt7601u_rx_monitor_beacon(struct mt7601u_dev *dev, struct mt7601u_rxwi *rxwi,
|
||||
{
|
||||
dev->bcn_freq_off = rxwi->freq_off;
|
||||
dev->bcn_phy_mode = FIELD_GET(MT_RXWI_RATE_PHY, rate);
|
||||
dev->avg_rssi = (dev->avg_rssi * 15) / 16 + (rssi << 8);
|
||||
ewma_rssi_add(&dev->avg_rssi, -rssi);
|
||||
}
|
||||
|
||||
static int
|
||||
@@ -503,7 +503,7 @@ u32 mt76_mac_process_rx(struct mt7601u_dev *dev, struct sk_buff *skb,
|
||||
if (mt7601u_rx_is_our_beacon(dev, data))
|
||||
mt7601u_rx_monitor_beacon(dev, rxwi, rate, rssi);
|
||||
else if (rxwi->rxinfo & cpu_to_le32(MT_RXINFO_U2M))
|
||||
dev->avg_rssi = (dev->avg_rssi * 15) / 16 + (rssi << 8);
|
||||
ewma_rssi_add(&dev->avg_rssi, -rssi);
|
||||
spin_unlock_bh(&dev->con_mon_lock);
|
||||
|
||||
return len;
|
||||
|
Reference in New Issue
Block a user