Skip to contentSkip to conversation

wifi: rtw89: pci: fix interrupt stuck after leaving low power mode

PATCH In review Ping-Ke Shih 2 participants 4 messages Aug 24, 2022 – Sep 2, 2022 Realtek wireless driver (rtw89)

lore
Share & tools
lore

Ping-Ke Shih

author maintainer
#0 lore raw

PATCH 1/2 wifi: rtw89: pci: fix interrupt stuck after leaving low power mode

We turn off interrupt in ISR, and re-enable interrupt in threadfn or napi_poll according to the mode it stays. If we are turning off interrupt, rtwpci->running flag is unset and interrupt handler stop processing even if it was called, so disallow to re-enable interrupt in this situation. Or, wifi chip doesn't trigger interrupt events anymore because interrupt status (ISR) isn't clear by interrupt handler anymore.

Fixes c83dcd0508e2 ("rtw89: pci: add a separate interrupt handler for low power mode")

---
Hi Kalle,

This patchset contains two patches with fixes tag, but we don't turn on lower power mode yet, so this patchset should go to wireless-next tree.

Thank you.

---
 drivers/net/wireless/realtek/rtw89/pci.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/wireless/realtek/rtw89/pci.c +2 -1
index c68fec9eb5a64..8a093e1cb328e 100644
@@ -760,7 +760,8 @@ static irqreturn_t rtw89_pci_interrupt_threadfn(int irq, void *dev)
 
 enable_intr:
 	spin_lock_irqsave(&rtwpci->irq_lock, flags);
-	rtw89_chip_enable_intr(rtwdev, rtwpci);
+	if (likely(rtwpci->running))
+		rtw89_chip_enable_intr(rtwdev, rtwpci);
 	spin_unlock_irqrestore(&rtwpci->irq_lock, flags);
 	return IRQ_HANDLED;
 }
Signature · 1 line
2.25.1
author maintainer
#1 lore raw

PATCH 2/2 wifi: rtw89: pci: correct TX resource checking in low power mode

Number of TX resource must be minimum of TX_BD and TX_WD. Only considering TX_BD could drop TX packets pulled from mac80211 if TX_WD is unavailable.

Fixes 52edbb9fb78a ("rtw89: ps: access TX/RX rings via another registers in low power mode")
---
 drivers/net/wireless/realtek/rtw89/pci.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/net/wireless/realtek/rtw89/pci.c +2 -0
index 8a093e1cb328e..7bb1b494c5d15 100644
@@ -926,10 +926,12 @@ u32 __rtw89_pci_check_and_reclaim_tx_resource_noio(struct rtw89_dev *rtwdev,
 {
 	struct rtw89_pci *rtwpci = (struct rtw89_pci *)rtwdev->priv;
 	struct rtw89_pci_tx_ring *tx_ring = &rtwpci->tx_rings[txch];
+	struct rtw89_pci_tx_wd_ring *wd_ring = &tx_ring->wd_ring;
 	u32 cnt;
 
 	spin_lock_bh(&rtwpci->trx_lock);
 	cnt = rtw89_pci_get_avail_txbd_num(tx_ring);
+	cnt = min(cnt, wd_ring->curr_num);
 	spin_unlock_bh(&rtwpci->trx_lock);
 
 	return cnt;
Signature · 1 line
2.25.1
#2 lore raw
In reply to Ping-Ke Shih
Quoted 7 lines · Ping-Ke Shih

We turn off interrupt in ISR, and re-enable interrupt in threadfn or napi_poll according to the mode it stays. If we are turning off interrupt, rtwpci->running flag is unset and interrupt handler stop processing even if it was called, so disallow to re-enable interrupt in this situation. Or, wifi chip doesn't trigger interrupt events anymore because interrupt status (ISR) isn't clear by interrupt handler anymore.

Quoted 7 lines
Fixes c83dcd0508e2 ("rtw89: pci: add a separate interrupt handler for low power mode")

---
Hi Kalle,

This patchset contains two patches with fixes tag, but we don't turn on lower power mode yet, so this patchset should go to wireless-next tree.

Very good, thanks for letting me know. This kind of info always helps.

Signature · 3 lines
https://patchwork.kernel.org/project/linux-wireless/list/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches
#3 lore raw
In reply to Ping-Ke Shih
Quoted 9 lines · Ping-Ke Shih

We turn off interrupt in ISR, and re-enable interrupt in threadfn or napi_poll according to the mode it stays. If we are turning off interrupt, rtwpci->running flag is unset and interrupt handler stop processing even if it was called, so disallow to re-enable interrupt in this situation. Or, wifi chip doesn't trigger interrupt events anymore because interrupt status (ISR) isn't clear by interrupt handler anymore.

Fixes c83dcd0508e2 ("rtw89: pci: add a separate interrupt handler for low power mode")

2 patches applied to wireless-next.git, thanks.

b7e715d3dcd2 wifi: rtw89: pci: fix interrupt stuck after leaving low power mode 4a29213cd775 wifi: rtw89: pci: correct TX resource checking in low power mode

Signature · 3 lines
https://patchwork.kernel.org/project/linux-wireless/patch/[email protected]/

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