* [PATCH rtw-next v5] wifi: rtw88: pci: wake the TX queues after restart_hw and interface up
@ 2026-10-23 10:41 Abdurrahman Karadag
2026-10-24 7:16 ` Luka Gejak
0 siblings, 1 reply; 2+ messages in thread
From: Abdurrahman Karadag @ 2026-10-23 10:41 UTC (permalink / raw)
To: linux-wireless; +Cc: pkshih, linux-kernel, rtl8821cerfe2
When a TX ring fills, rtw_pci_tx_write() stops the mac80211 queue and
records it in ring->queue_stopped. The completion loop in
rtw_pci_tx_isr() is what clears them, and it needs a descriptor to
complete. If the device goes down first, rtw_pci_dma_release() rewinds
the indices and frees what was in flight, so nothing is left that
could. ieee80211_reconfig() does not help either: it wakes only
IEEE80211_QUEUE_STOP_REASON_SUSPEND, and an interface down/up does not
reach it at all. TX then stays dead although the device came back.
Reset that state where the device starts, which both
ieee80211_restart_hw() and an interface down/up reach through
rtw_core_start(). Gate the wake on ring->queue_stopped so that a
start which stopped nothing leaves the queues alone. The wake cannot be
narrowed to the queue the ring-full path stopped: the flag sits on the
ring, and rtw_tx_queue_mapping() puts management frames and multicast on
rings of their own whatever queue they came from, so a flag there does
not name a queue. mac80211 also keeps a single non-refcounted DRIVER
stop per queue, shared with the scan paths in fw.c, so
ieee80211_wake_queues() releases whatever holds that slot.
Signed-off-by: Abdurrahman Karadag <abdurrahmankaradag19@gmail.com>
---
v5:
- reset the flags before rtw_pci_enable_interrupt(), move it into
rtw_pci_reset_tx_queue_state(), and add the blank line before
running = true (Ping-Ke Shih)
- justify the gate by what it does on a start that stopped nothing,
and give the cannot-be-narrowed note its actual reason (Luka Gejak)
v4: reset the flags and wake from rtw_pci_start() instead of
rtw_reconfig_complete(), so an interface down/up is covered as well,
and name restart_hw in the subject (Ping-Ke Shih)
v3: wake from rtw_reconfig_complete() on RECONFIG_TYPE_RESTART
v2: wake from rtw_pci_reset_trx_ring(), gated on ring->queue_stopped
v1: https://lore.kernel.org/linux-wireless/20261002231013.11792-1-abdurrahmankaradag19@gmail.com/
drivers/net/wireless/realtek/rtw88/pci.c | 19 +++++++++++++++++++
1 file changed, 19 insertions(+)
diff --git a/drivers/net/wireless/realtek/rtw88/pci.c b/drivers/net/wireless/realtek/rtw88/pci.c
index 66d2e5f..c7ccde8 100644
--- a/drivers/net/wireless/realtek/rtw88/pci.c
+++ b/drivers/net/wireless/realtek/rtw88/pci.c
@@ -568,6 +568,23 @@ static void rtw_pci_napi_stop(struct rtw_dev *rtwdev)
napi_disable(&rtwpci->napi);
}
+static void rtw_pci_reset_tx_queue_state(struct rtw_dev *rtwdev)
+{
+ struct rtw_pci *rtwpci = (struct rtw_pci *)rtwdev->priv;
+ enum rtw_tx_queue_type queue;
+ bool wake = false;
+
+ lockdep_assert_held(&rtwpci->irq_lock);
+
+ for (queue = 0; queue < RTK_MAX_TX_QUEUE_NUM; queue++) {
+ wake |= rtwpci->tx_rings[queue].queue_stopped;
+ rtwpci->tx_rings[queue].queue_stopped = false;
+ }
+
+ if (wake)
+ ieee80211_wake_queues(rtwdev->hw);
+}
+
static int rtw_pci_start(struct rtw_dev *rtwdev)
{
struct rtw_pci *rtwpci = (struct rtw_pci *)rtwdev->priv;
@@ -575,6 +592,8 @@ static int rtw_pci_start(struct rtw_dev *rtwdev)
rtw_pci_napi_start(rtwdev);
spin_lock_bh(&rtwpci->irq_lock);
+ rtw_pci_reset_tx_queue_state(rtwdev);
+
rtwpci->running = true;
rtw_pci_enable_interrupt(rtwdev, rtwpci, false);
spin_unlock_bh(&rtwpci->irq_lock);
base-commit: 9b0be45d4d52fd223994e151f169743a97abd290
--
2.56.0
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH rtw-next v5] wifi: rtw88: pci: wake the TX queues after restart_hw and interface up
2026-10-23 10:41 [PATCH rtw-next v5] wifi: rtw88: pci: wake the TX queues after restart_hw and interface up Abdurrahman Karadag
@ 2026-10-24 7:16 ` Luka Gejak
0 siblings, 0 replies; 2+ messages in thread
From: Luka Gejak @ 2026-10-24 7:16 UTC (permalink / raw)
To: Abdurrahman Karadag, linux-wireless; +Cc: pkshih, linux-kernel, rtl8821cerfe2
October 23, 2026 at 12:41 PM, "Abdurrahman Karadag" <abdurrahmankaradag19@gmail.com> wrote:
>
> When a TX ring fills, rtw_pci_tx_write() stops the mac80211 queue and
> records it in ring->queue_stopped. The completion loop in
> rtw_pci_tx_isr() is what clears them, and it needs a descriptor to
> complete. If the device goes down first, rtw_pci_dma_release() rewinds
> the indices and frees what was in flight, so nothing is left that
> could. ieee80211_reconfig() does not help either: it wakes only
> IEEE80211_QUEUE_STOP_REASON_SUSPEND, and an interface down/up does not
> reach it at all. TX then stays dead although the device came back.
>
> Reset that state where the device starts, which both
> ieee80211_restart_hw() and an interface down/up reach through
> rtw_core_start(). Gate the wake on ring->queue_stopped so that a
> start which stopped nothing leaves the queues alone. The wake cannot be
> narrowed to the queue the ring-full path stopped: the flag sits on the
> ring, and rtw_tx_queue_mapping() puts management frames and multicast on
> rings of their own whatever queue they came from, so a flag there does
> not name a queue. mac80211 also keeps a single non-refcounted DRIVER
> stop per queue, shared with the scan paths in fw.c, so
> ieee80211_wake_queues() releases whatever holds that slot.
>
> Signed-off-by: Abdurrahman Karadag <abdurrahmankaradag19@gmail.com>
> ---
Looks good to me.
Reviewed-by: Luka Gejak <luka.gejak@linux.dev>
Best regards,
Luka Gejak
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-10-24 7:16 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-10-23 10:41 [PATCH rtw-next v5] wifi: rtw88: pci: wake the TX queues after restart_hw and interface up Abdurrahman Karadag
2026-10-24 7:16 ` Luka Gejak
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®