mt76: fix rssi ewma tracking

The generic EWMA code cannot deal with negative numbers, so convert signal
to a positive number before adding it
Fixes mt76x2 AGC tuning

Signed-off-by: Felix Fietkau <nbd@nbd.name>
This commit is contained in:
Felix Fietkau 2019-01-11 14:17:30 +01:00
parent ef13edc007
commit 02e5a769c0
2 changed files with 4 additions and 2 deletions

View File

@ -567,7 +567,9 @@ mt76_check_sta(struct mt76_dev *dev, struct sk_buff *skb)
sta = container_of((void *) wcid, struct ieee80211_sta, drv_priv);
ewma_signal_add(&wcid->rssi, status->signal);
if (status->signal <= 0)
ewma_signal_add(&wcid->rssi, -status->signal);
wcid->inactive_count = 0;
if (!test_bit(MT_WCID_FLAG_CHECK_PS, &wcid->flags))

View File

@ -100,7 +100,7 @@ int mt76_get_min_avg_rssi(struct mt76_dev *dev)
spin_lock(&dev->rx_lock);
if (wcid->inactive_count++ < 5)
cur_rssi = ewma_signal_read(&wcid->rssi);
cur_rssi = -ewma_signal_read(&wcid->rssi);
else
cur_rssi = 0;
spin_unlock(&dev->rx_lock);