linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mt7601u: wait for clear rxq when stopping mac
@ 2016-11-25 11:13 Anthony Romano
  2016-11-25 17:06 ` Jakub Kicinski
  2016-11-29 15:32 ` Kalle Valo
  0 siblings, 2 replies; 3+ messages in thread
From: Anthony Romano @ 2016-11-25 11:13 UTC (permalink / raw)
  To: linux-wireless; +Cc: kubakici

mt7601u_mac_stop_hw should stop polling the rxq once it remains empty
but instead continues polling after the rxq status stays clear; bringing
down the interface takes about six seconds from this alone.

Speed up path by exiting rxq loop once status repeatedly polls empty.

Signed-off-by: Anthony Romano <anthony.romano@coreos.com>
---
 drivers/net/wireless/mediatek/mt7601u/init.c | 14 +++++++-------
 drivers/net/wireless/mediatek/mt7601u/regs.h |  3 +++
 2 files changed, 10 insertions(+), 7 deletions(-)

diff --git a/drivers/net/wireless/mediatek/mt7601u/init.c b/drivers/net/wireless/mediatek/mt7601u/init.c
index 44d46e25db80..a6e901766226 100644
--- a/drivers/net/wireless/mediatek/mt7601u/init.c
+++ b/drivers/net/wireless/mediatek/mt7601u/init.c
@@ -293,13 +293,13 @@ static void mt7601u_mac_stop_hw(struct mt7601u_dev *dev)
 	ok = 0;
 	i = 200;
 	while (i--) {
-		if ((mt76_rr(dev, 0x0430) & 0x00ff0000) ||
-		    (mt76_rr(dev, 0x0a30) & 0xffffffff) ||
-		    (mt76_rr(dev, 0x0a34) & 0xffffffff))
-			ok++;
-		if (ok > 6)
-			break;
-
+		if (!(mt76_rr(dev, MT_RXQ_STA) & 0x00ff0000) &&
+		    !mt76_rr(dev, 0x0a30) &&
+		    !mt76_rr(dev, 0x0a34)) {
+			if (ok++ > 5)
+				break;
+			continue;
+		}
 		msleep(1);
 	}
 
diff --git a/drivers/net/wireless/mediatek/mt7601u/regs.h b/drivers/net/wireless/mediatek/mt7601u/regs.h
index 27a429d90cec..2a8837002f00 100644
--- a/drivers/net/wireless/mediatek/mt7601u/regs.h
+++ b/drivers/net/wireless/mediatek/mt7601u/regs.h
@@ -192,6 +192,9 @@
 #define MT_BCN_OFFSET_BASE		0x041c
 #define MT_BCN_OFFSET(_n)		(MT_BCN_OFFSET_BASE + ((_n) << 2))
 
+#define MT_RXQ_STA			0x0430
+#define MT_TXQ_STA			0x0434
+
 #define	MT_RF_CSR_CFG			0x0500
 #define MT_RF_CSR_CFG_DATA		GENMASK(7, 0)
 #define MT_RF_CSR_CFG_REG_ID		GENMASK(13, 8)
-- 
2.11.0.rc2

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] mt7601u: wait for clear rxq when stopping mac
  2016-11-25 11:13 [PATCH] mt7601u: wait for clear rxq when stopping mac Anthony Romano
@ 2016-11-25 17:06 ` Jakub Kicinski
  2016-11-29 15:32 ` Kalle Valo
  1 sibling, 0 replies; 3+ messages in thread
From: Jakub Kicinski @ 2016-11-25 17:06 UTC (permalink / raw)
  To: Anthony Romano; +Cc: linux-wireless

On Fri, 25 Nov 2016 03:13:34 -0800, Anthony Romano wrote:
> mt7601u_mac_stop_hw should stop polling the rxq once it remains empty
> but instead continues polling after the rxq status stays clear; bringing
> down the interface takes about six seconds from this alone.
> 
> Speed up path by exiting rxq loop once status repeatedly polls empty.
> 
> Signed-off-by: Anthony Romano <anthony.romano@coreos.com>

Looks correct, the condition was inverted and we don't have to
msleep() when we see values go to zero.  Thanks!

Reviewed-by: Jakub Kicinski <kubakici@wp.pl>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: mt7601u: wait for clear rxq when stopping mac
  2016-11-25 11:13 [PATCH] mt7601u: wait for clear rxq when stopping mac Anthony Romano
  2016-11-25 17:06 ` Jakub Kicinski
@ 2016-11-29 15:32 ` Kalle Valo
  1 sibling, 0 replies; 3+ messages in thread
From: Kalle Valo @ 2016-11-29 15:32 UTC (permalink / raw)
  To: Anthony Romano; +Cc: linux-wireless, kubakici

Anthony Romano <anthony.romano@coreos.com> wrote:
> mt7601u_mac_stop_hw should stop polling the rxq once it remains empty
> but instead continues polling after the rxq status stays clear; bringing
> down the interface takes about six seconds from this alone.
> 
> Speed up path by exiting rxq loop once status repeatedly polls empty.
> 
> Signed-off-by: Anthony Romano <anthony.romano@coreos.com>
> Reviewed-by: Jakub Kicinski <kubakici@wp.pl>

Patch applied to wireless-drivers-next.git, thanks.

05db221e30a9 mt7601u: wait for clear rxq when stopping mac

-- 
https://patchwork.kernel.org/patch/9447371/

Documentation about submitting wireless patches and checking status
from patchwork:

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2016-11-29 15:32 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-11-25 11:13 [PATCH] mt7601u: wait for clear rxq when stopping mac Anthony Romano
2016-11-25 17:06 ` Jakub Kicinski
2016-11-29 15:32 ` 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).