From: Felix Fietkau <nbd@nbd.name>
To: linux-wireless@vger.kernel.org
Subject: [PATCH 5/7] mt76: fix rssi ewma tracking
Date: Thu, 17 Jan 2019 14:51:31 +0100 [thread overview]
Message-ID: <20190117135133.2753-5-nbd@nbd.name> (raw)
In-Reply-To: <20190117135133.2753-1-nbd@nbd.name>
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>
---
drivers/net/wireless/mediatek/mt76/mac80211.c | 4 +++-
drivers/net/wireless/mediatek/mt76/util.c | 2 +-
2 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/drivers/net/wireless/mediatek/mt76/mac80211.c b/drivers/net/wireless/mediatek/mt76/mac80211.c
index 226f98fff6ef..3b09d4560ae2 100644
--- a/drivers/net/wireless/mediatek/mt76/mac80211.c
+++ b/drivers/net/wireless/mediatek/mt76/mac80211.c
@@ -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))
diff --git a/drivers/net/wireless/mediatek/mt76/util.c b/drivers/net/wireless/mediatek/mt76/util.c
index 6242421c6011..69270c1a9091 100644
--- a/drivers/net/wireless/mediatek/mt76/util.c
+++ b/drivers/net/wireless/mediatek/mt76/util.c
@@ -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);
--
2.17.0
next prev parent reply other threads:[~2019-01-17 13:51 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-01-17 13:51 [PATCH 1/7] mt76: fix tx status reporting for non-probing frames Felix Fietkau
2019-01-17 13:51 ` [PATCH 2/7] mt76: set IEEE80211_HW_NEEDS_UNIQUE_STA_ADDR flag Felix Fietkau
2019-01-17 13:51 ` [PATCH 3/7] mt76: move mt76x02_get_txpower to mt76 core Felix Fietkau
2019-01-17 13:51 ` [PATCH 4/7] mt76: move mt76x02_phy_get_min_avg_rssi " Felix Fietkau
2019-01-17 13:51 ` Felix Fietkau [this message]
2019-01-17 13:51 ` [PATCH 6/7] mt76: fix signedness of rx status signal field Felix Fietkau
2019-01-17 13:51 ` [PATCH 7/7] mt76: add channel switch announcement support Felix Fietkau
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190117135133.2753-5-nbd@nbd.name \
--to=nbd@nbd.name \
--cc=linux-wireless@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox