* [PATCH] mt7601u: remove warning when avg_rssi is zero
@ 2018-06-09 10:10 Stanislaw Gruszka
2018-06-09 16:18 ` Adam Borowski
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: Stanislaw Gruszka @ 2018-06-09 10:10 UTC (permalink / raw)
To: Jakub Kicinski, linux-wireless; +Cc: Adam Borowski
It turned out that we can run calibration without already received
frames with RSSI data. In such case just don't update AGC register
and don't print the warning.
Fixes: b305a6ab0247 ("mt7601u: use EWMA to calculate avg_rssi")
Reported-by: Adam Borowski <kilobyte@angband.pl>
Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
---
drivers/net/wireless/mediatek/mt7601u/phy.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/drivers/net/wireless/mediatek/mt7601u/phy.c b/drivers/net/wireless/mediatek/mt7601u/phy.c
index d440c550bdb1..3ffc8d19285b 100644
--- a/drivers/net/wireless/mediatek/mt7601u/phy.c
+++ b/drivers/net/wireless/mediatek/mt7601u/phy.c
@@ -985,13 +985,15 @@ static void mt7601u_agc_tune(struct mt7601u_dev *dev)
*/
spin_lock_bh(&dev->con_mon_lock);
avg_rssi = ewma_rssi_read(&dev->avg_rssi);
- WARN_ON_ONCE(avg_rssi == 0);
+ spin_unlock_bh(&dev->con_mon_lock);
+ if (avg_rssi == 0)
+ return;
+
avg_rssi = -avg_rssi;
if (avg_rssi <= -70)
val -= 0x20;
else if (avg_rssi <= -60)
val -= 0x10;
- spin_unlock_bh(&dev->con_mon_lock);
if (val != mt7601u_bbp_rr(dev, 66))
mt7601u_bbp_wr(dev, 66, val);
--
1.9.3
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] mt7601u: remove warning when avg_rssi is zero
2018-06-09 10:10 [PATCH] mt7601u: remove warning when avg_rssi is zero Stanislaw Gruszka
@ 2018-06-09 16:18 ` Adam Borowski
2018-06-11 21:59 ` Jakub Kicinski
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: Adam Borowski @ 2018-06-09 16:18 UTC (permalink / raw)
To: Stanislaw Gruszka; +Cc: Jakub Kicinski, linux-wireless
On Sat, Jun 09, 2018 at 12:10:44PM +0200, Stanislaw Gruszka wrote:
> It turned out that we can run calibration without already received
> frames with RSSI data. In such case just don't update AGC register
> and don't print the warning.
>
> Fixes: b305a6ab0247 ("mt7601u: use EWMA to calculate avg_rssi")
The patch is quite obvious, but still had to be tested, at least out of
principle. And unsurprisingly, no Earth-shattering kaboom.
> Reported-by: Adam Borowski <kilobyte@angband.pl>
> Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
> ---
> drivers/net/wireless/mediatek/mt7601u/phy.c | 6 ++++--
> 1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/net/wireless/mediatek/mt7601u/phy.c b/drivers/net/wireless/mediatek/mt7601u/phy.c
> index d440c550bdb1..3ffc8d19285b 100644
> --- a/drivers/net/wireless/mediatek/mt7601u/phy.c
> +++ b/drivers/net/wireless/mediatek/mt7601u/phy.c
> @@ -985,13 +985,15 @@ static void mt7601u_agc_tune(struct mt7601u_dev *dev)
> */
> spin_lock_bh(&dev->con_mon_lock);
> avg_rssi = ewma_rssi_read(&dev->avg_rssi);
> - WARN_ON_ONCE(avg_rssi == 0);
> + spin_unlock_bh(&dev->con_mon_lock);
> + if (avg_rssi == 0)
> + return;
> +
> avg_rssi = -avg_rssi;
> if (avg_rssi <= -70)
> val -= 0x20;
> else if (avg_rssi <= -60)
> val -= 0x10;
> - spin_unlock_bh(&dev->con_mon_lock);
>
> if (val != mt7601u_bbp_rr(dev, 66))
> mt7601u_bbp_wr(dev, 66, val);
> --
> 1.9.3
Meow!
--
⢀⣴⠾⠻⢶⣦⠀ I've read an article about how lively happy music boosts
⣾⠁⢰⠒⠀⣿⡁ productivity. You can read it, too, you just need the
⢿⡄⠘⠷⠚⠋⠀ right music while doing so. I recommend Skepticism
⠈⠳⣄⠀⠀⠀⠀ (funeral doom metal).
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] mt7601u: remove warning when avg_rssi is zero
2018-06-09 10:10 [PATCH] mt7601u: remove warning when avg_rssi is zero Stanislaw Gruszka
2018-06-09 16:18 ` Adam Borowski
@ 2018-06-11 21:59 ` Jakub Kicinski
2018-06-18 14:47 ` Kalle Valo
2018-06-24 17:02 ` Kalle Valo
3 siblings, 0 replies; 5+ messages in thread
From: Jakub Kicinski @ 2018-06-11 21:59 UTC (permalink / raw)
To: Stanislaw Gruszka; +Cc: linux-wireless, Adam Borowski
On Sat, 9 Jun 2018 12:10:44 +0200, Stanislaw Gruszka wrote:
> It turned out that we can run calibration without already received
> frames with RSSI data. In such case just don't update AGC register
> and don't print the warning.
>
> Fixes: b305a6ab0247 ("mt7601u: use EWMA to calculate avg_rssi")
> Reported-by: Adam Borowski <kilobyte@angband.pl>
> Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
Acked-by: Jakub Kicinski <kubakici@wp.pl>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: mt7601u: remove warning when avg_rssi is zero
2018-06-09 10:10 [PATCH] mt7601u: remove warning when avg_rssi is zero Stanislaw Gruszka
2018-06-09 16:18 ` Adam Borowski
2018-06-11 21:59 ` Jakub Kicinski
@ 2018-06-18 14:47 ` Kalle Valo
2018-06-24 17:02 ` Kalle Valo
3 siblings, 0 replies; 5+ messages in thread
From: Kalle Valo @ 2018-06-18 14:47 UTC (permalink / raw)
To: Stanislaw Gruszka; +Cc: Jakub Kicinski, linux-wireless, Adam Borowski
Stanislaw Gruszka <sgruszka@redhat.com> wrote:
> It turned out that we can run calibration without already received
> frames with RSSI data. In such case just don't update AGC register
> and don't print the warning.
>
> Fixes: b305a6ab0247 ("mt7601u: use EWMA to calculate avg_rssi")
> Reported-by: Adam Borowski <kilobyte@angband.pl>
> Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
> Acked-by: Jakub Kicinski <kubakici@wp.pl>
As the first release for b305a6ab0247 was v4.18-rc1, I'll queue this to 4.18.
--
https://patchwork.kernel.org/patch/10455479/
https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: mt7601u: remove warning when avg_rssi is zero
2018-06-09 10:10 [PATCH] mt7601u: remove warning when avg_rssi is zero Stanislaw Gruszka
` (2 preceding siblings ...)
2018-06-18 14:47 ` Kalle Valo
@ 2018-06-24 17:02 ` Kalle Valo
3 siblings, 0 replies; 5+ messages in thread
From: Kalle Valo @ 2018-06-24 17:02 UTC (permalink / raw)
To: Stanislaw Gruszka; +Cc: Jakub Kicinski, linux-wireless, Adam Borowski
Stanislaw Gruszka <sgruszka@redhat.com> wrote:
> It turned out that we can run calibration without already received
> frames with RSSI data. In such case just don't update AGC register
> and don't print the warning.
>
> Fixes: b305a6ab0247 ("mt7601u: use EWMA to calculate avg_rssi")
> Reported-by: Adam Borowski <kilobyte@angband.pl>
> Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
> Acked-by: Jakub Kicinski <kubakici@wp.pl>
Patch applied to wireless-drivers.git, thanks.
92963318a255 mt7601u: remove warning when avg_rssi is zero
--
https://patchwork.kernel.org/patch/10455479/
https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2018-06-24 17:02 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-06-09 10:10 [PATCH] mt7601u: remove warning when avg_rssi is zero Stanislaw Gruszka
2018-06-09 16:18 ` Adam Borowski
2018-06-11 21:59 ` Jakub Kicinski
2018-06-18 14:47 ` Kalle Valo
2018-06-24 17:02 ` Kalle Valo
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).