Skip to content

Commit 05db221

Browse files
Anthony RomanoKalle Valo
authored andcommitted
mt7601u: wait for clear rxq when stopping mac
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> Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
1 parent 53e3a80 commit 05db221

File tree

2 files changed

+10
-7
lines changed

2 files changed

+10
-7
lines changed

drivers/net/wireless/mediatek/mt7601u/init.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -293,13 +293,13 @@ static void mt7601u_mac_stop_hw(struct mt7601u_dev *dev)
293293
ok = 0;
294294
i = 200;
295295
while (i--) {
296-
if ((mt76_rr(dev, 0x0430) & 0x00ff0000) ||
297-
(mt76_rr(dev, 0x0a30) & 0xffffffff) ||
298-
(mt76_rr(dev, 0x0a34) & 0xffffffff))
299-
ok++;
300-
if (ok > 6)
301-
break;
302-
296+
if (!(mt76_rr(dev, MT_RXQ_STA) & 0x00ff0000) &&
297+
!mt76_rr(dev, 0x0a30) &&
298+
!mt76_rr(dev, 0x0a34)) {
299+
if (ok++ > 5)
300+
break;
301+
continue;
302+
}
303303
msleep(1);
304304
}
305305

drivers/net/wireless/mediatek/mt7601u/regs.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,9 @@
192192
#define MT_BCN_OFFSET_BASE 0x041c
193193
#define MT_BCN_OFFSET(_n) (MT_BCN_OFFSET_BASE + ((_n) << 2))
194194

195+
#define MT_RXQ_STA 0x0430
196+
#define MT_TXQ_STA 0x0434
197+
195198
#define MT_RF_CSR_CFG 0x0500
196199
#define MT_RF_CSR_CFG_DATA GENMASK(7, 0)
197200
#define MT_RF_CSR_CFG_REG_ID GENMASK(13, 8)

0 commit comments

Comments
 (0)