summaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/mediatek/mt7601u/mt7601u.h
diff options
context:
space:
mode:
authorStanislaw Gruszka <sgruszka@redhat.com>2018-04-16 13:56:17 +0200
committerKalle Valo <kvalo@codeaurora.org>2018-04-24 20:33:02 +0300
commitb305a6ab02475f52ef604b36e4cecd3bf4aa5eb7 (patch)
tree6cc4efa47af1e17075cfd80e131fef7ba5cd5d81 /drivers/net/wireless/mediatek/mt7601u/mt7601u.h
parentb9e5d4feb4fc0ec0823e5da3bdea1c01d38f448e (diff)
downloadtalos-obmc-linux-b305a6ab02475f52ef604b36e4cecd3bf4aa5eb7.tar.gz
talos-obmc-linux-b305a6ab02475f52ef604b36e4cecd3bf4aa5eb7.zip
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>
Diffstat (limited to 'drivers/net/wireless/mediatek/mt7601u/mt7601u.h')
-rw-r--r--drivers/net/wireless/mediatek/mt7601u/mt7601u.h5
1 files changed, 4 insertions, 1 deletions
diff --git a/drivers/net/wireless/mediatek/mt7601u/mt7601u.h b/drivers/net/wireless/mediatek/mt7601u/mt7601u.h
index 9233744451a9..db317d8c1652 100644
--- a/drivers/net/wireless/mediatek/mt7601u/mt7601u.h
+++ b/drivers/net/wireless/mediatek/mt7601u/mt7601u.h
@@ -23,6 +23,7 @@
#include <linux/completion.h>
#include <net/mac80211.h>
#include <linux/debugfs.h>
+#include <linux/average.h>
#include "regs.h"
@@ -138,6 +139,8 @@ enum {
MT7601U_STATE_MORE_STATS,
};
+DECLARE_EWMA(rssi, 10, 4);
+
/**
* struct mt7601u_dev - adapter structure
* @lock: protects @wcid->tx_rate.
@@ -220,7 +223,7 @@ struct mt7601u_dev {
s8 bcn_freq_off;
u8 bcn_phy_mode;
- int avg_rssi; /* starts at 0 and converges */
+ struct ewma_rssi avg_rssi;
u8 agc_save;
OpenPOWER on IntegriCloud