Commit 02e5a769 authored by Felix Fietkau's avatar Felix Fietkau

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: default avatarFelix Fietkau <nbd@nbd.name>
parent ef13edc0
...@@ -567,7 +567,9 @@ mt76_check_sta(struct mt76_dev *dev, struct sk_buff *skb) ...@@ -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); 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; wcid->inactive_count = 0;
if (!test_bit(MT_WCID_FLAG_CHECK_PS, &wcid->flags)) if (!test_bit(MT_WCID_FLAG_CHECK_PS, &wcid->flags))
......
...@@ -100,7 +100,7 @@ int mt76_get_min_avg_rssi(struct mt76_dev *dev) ...@@ -100,7 +100,7 @@ int mt76_get_min_avg_rssi(struct mt76_dev *dev)
spin_lock(&dev->rx_lock); spin_lock(&dev->rx_lock);
if (wcid->inactive_count++ < 5) if (wcid->inactive_count++ < 5)
cur_rssi = ewma_signal_read(&wcid->rssi); cur_rssi = -ewma_signal_read(&wcid->rssi);
else else
cur_rssi = 0; cur_rssi = 0;
spin_unlock(&dev->rx_lock); spin_unlock(&dev->rx_lock);
......
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