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)
commit8eacee56c6e56aa16c374000c5fb818bd758153f
treedb5433d720ad71deee07d70a20f39f7dc341a413
parent64cdfc6b7d3b439100a5605fb7a59ac51843e559
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