rtw88: don't hold all IRQs disabled for PS operations
authorBrian Norris <briannorris@chromium.org>
Thu, 12 Mar 2020 08:08:48 +0000 (16:08 +0800)
committerKalle Valo <kvalo@codeaurora.org>
Mon, 23 Mar 2020 17:29:26 +0000 (19:29 +0200)
commit57fb39e247754b60401358b1f4be78ab6f5ef9f4
treedb5433d720ad71deee07d70a20f39f7dc341a413
parent53efdc9cb9e6a6f693a81da005280df92b813933
rtw88: don't hold all IRQs disabled for PS operations

This driver generally only needs to ensure that
(a) it doesn't try to process TX interrupts at the same time as
    power-save operations (and similar)
(b) the device interrupt gets disabled while we're still handling the
    last set of interrupts

For (a), all the operations (e.g., PS transitions, packet handling)
happens in non-atomic contexts (e.g., threaded IRQ).

For (b), we only need mutual exclusion for brief sections (i.e., while
we're actually manipulating the interrupt mask/status).

So, we can introduce a separate lock for handling (b), disabling IRQs
while we do it. For (a), we can demote the locking to BH only, now that
(b) (the only steps done in atomic context) and that has its own lock.

This helps reduce the amount of time this driver spends with IRQs off.
Notably, transitioning out of power-save modes can take >3 milliseconds,
and this transition is done under the protection of 'irq_lock'.

Signed-off-by: Brian Norris <briannorris@chromium.org>
Signed-off-by: Yan-Hsuan Chuang <yhchuang@realtek.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Link: https://lore.kernel.org/r/20200312080852.16684-2-yhchuang@realtek.com
drivers/net/wireless/realtek/rtw88/pci.c
drivers/net/wireless/realtek/rtw88/pci.h