mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH rtw-next v4] wifi: rtw88: pci: wake the TX queues after restart_hw and interface up
@ 2026-10-21 10:13 Abdurrahman Karadag
  2026-10-21 13:15 ` Luka Gejak
  2026-10-22  1:36 ` Ping-Ke Shih
  0 siblings, 2 replies; 4+ messages in thread
From: Abdurrahman Karadag @ 2026-10-21 10:13 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(). Wake only when a ring was recorded as stopped:
mac80211 keeps a single non-refcounted DRIVER stop per queue, so an
unconditional wake here would also release the stop that
rtw_hw_scan_start() takes before it reaches rtw_pci_start() from idle.

Signed-off-by: Abdurrahman Karadag <abdurrahmankaradag19@gmail.com>
---
v4:
 - reset the flags and wake from rtw_pci_start() instead of
   rtw_reconfig_complete(), so an interface down/up is covered as well
   (Ping-Ke Shih)
 - 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 | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/drivers/net/wireless/realtek/rtw88/pci.c b/drivers/net/wireless/realtek/rtw88/pci.c
index 66d2e5f..fd84ace 100644
--- a/drivers/net/wireless/realtek/rtw88/pci.c
+++ b/drivers/net/wireless/realtek/rtw88/pci.c
@@ -571,12 +571,20 @@ static void rtw_pci_napi_stop(struct rtw_dev *rtwdev)
 static int rtw_pci_start(struct rtw_dev *rtwdev)
 {
 	struct rtw_pci *rtwpci = (struct rtw_pci *)rtwdev->priv;
+	enum rtw_tx_queue_type queue;
+	bool wake = false;
 
 	rtw_pci_napi_start(rtwdev);
 
 	spin_lock_bh(&rtwpci->irq_lock);
 	rtwpci->running = true;
 	rtw_pci_enable_interrupt(rtwdev, rtwpci, false);
+	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);
 	spin_unlock_bh(&rtwpci->irq_lock);
 
 	return 0;
base-commit: 9b0be45d4d52fd223994e151f169743a97abd290
-- 
2.56.0


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH rtw-next v4] wifi: rtw88: pci: wake the TX queues after restart_hw and interface up
  2026-10-21 10:13 [PATCH rtw-next v4] wifi: rtw88: pci: wake the TX queues after restart_hw and interface up Abdurrahman Karadag
@ 2026-10-21 13:15 ` Luka Gejak
  2026-10-21 15:03   ` Abdurrahman Karadag
  2026-10-22  1:36 ` Ping-Ke Shih
  1 sibling, 1 reply; 4+ messages in thread
From: Luka Gejak @ 2026-10-21 13:15 UTC (permalink / raw)
  To: Abdurrahman Karadag, linux-wireless; +Cc: pkshih, linux-kernel, rtl8821cerfe2

October 21, 2026 at 12:13 PM, "Abdurrahman Karadag" <abdurrahmankaradag19@gmail.com> wrote:

> Wake only when a ring was recorded as stopped:
> mac80211 keeps a single non-refcounted DRIVER stop per queue, so an
> unconditional wake here would also release the stop that
> rtw_hw_scan_start() takes before it reaches rtw_pci_start() from idle.

The gated wake still releases that stop when a ring was left stopped. A
stalled ring followed by a disconnect keeps queue_stopped set through
rtw_enter_ips(), and the next scan from idle then does:

        rtw_hw_scan_start()
          ieee80211_stop_queues()
          rtw_core_scan_start()
            rtw_leave_ips()
              rtw_core_start()
                rtw_pci_start()
                  ieee80211_wake_queues()

Nothing transmits in idle, so this is harmless, but the v3 thread settled
on saying the wake can't be narrowed to the queue the ring-full path
stopped. Could the message say that, rather than suggest the gate keeps
the scan stop intact?

Other than that I have no objections with the code itself.

Best regards,
Luka Gejak

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH rtw-next v4] wifi: rtw88: pci: wake the TX queues after restart_hw and interface up
  2026-10-21 13:15 ` Luka Gejak
@ 2026-10-21 15:03   ` Abdurrahman Karadag
  0 siblings, 0 replies; 4+ messages in thread
From: Abdurrahman Karadag @ 2026-10-21 15:03 UTC (permalink / raw)
  To: linux-wireless; +Cc: pkshih, linux-kernel, rtl8821cerfe2

> The gated wake still releases that stop when a ring was left stopped.

Right, and the message should not have rested the gate on that case.

The gate is there for the common case: a start that stopped nothing
does not touch mac80211's stop reason at all, and that is every start
except one that follows a ring-full stop. After such a stop the
completion loop that would clear it cannot run - it needs a descriptor
and rtw_pci_dma_release() has already freed them - so on that path the
wake is what gets TX back.

Your case is the overlap of the two, and as you say nothing transmits
in idle. I will word it that way, and keep the v2 note that the wake
cannot be narrowed to the queue the ring-full path stopped.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* RE: [PATCH rtw-next v4] wifi: rtw88: pci: wake the TX queues after restart_hw and interface up
  2026-10-21 10:13 [PATCH rtw-next v4] wifi: rtw88: pci: wake the TX queues after restart_hw and interface up Abdurrahman Karadag
  2026-10-21 13:15 ` Luka Gejak
@ 2026-10-22  1:36 ` Ping-Ke Shih
  1 sibling, 0 replies; 4+ messages in thread
From: Ping-Ke Shih @ 2026-10-22  1:36 UTC (permalink / raw)
  To: Abdurrahman Karadag, linux-wireless; +Cc: linux-kernel, rtl8821cerfe2

Abdurrahman Karadag <abdurrahmankaradag19@gmail.com> wrote:
> diff --git a/drivers/net/wireless/realtek/rtw88/pci.c b/drivers/net/wireless/realtek/rtw88/pci.c
> index 66d2e5f..fd84ace 100644
> --- a/drivers/net/wireless/realtek/rtw88/pci.c
> +++ b/drivers/net/wireless/realtek/rtw88/pci.c
> @@ -571,12 +571,20 @@ static void rtw_pci_napi_stop(struct rtw_dev *rtwdev)
>  static int rtw_pci_start(struct rtw_dev *rtwdev)
>  {
>         struct rtw_pci *rtwpci = (struct rtw_pci *)rtwdev->priv;
> +       enum rtw_tx_queue_type queue;
> +       bool wake = false;
> 
>         rtw_pci_napi_start(rtwdev);
> 
>         spin_lock_bh(&rtwpci->irq_lock);

It would look natural to clear queue_stopped before enabling interrupt, 
since it is intended to reset. More, add a function to be clear that we 
are resetting queue_stopped, like rtw_pci_reset_tx_{ring or queue}_state().

For scanning from idle case, we have an assistant 
'test_bit(RTW_FLAG_SCANNING, rtwdev->flags)' if you want.

Add an empty line before 'running = true'.

>         rtwpci->running = true;
>         rtw_pci_enable_interrupt(rtwdev, rtwpci, false);
> +       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);
>         spin_unlock_bh(&rtwpci->irq_lock);
> 
>         return 0;
> base-commit: 9b0be45d4d52fd223994e151f169743a97abd290
> --
> 2.56.0


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2026-10-22  1:36 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-10-21 10:13 [PATCH rtw-next v4] wifi: rtw88: pci: wake the TX queues after restart_hw and interface up Abdurrahman Karadag
2026-10-21 13:15 ` Luka Gejak
2026-10-21 15:03   ` Abdurrahman Karadag
2026-10-22  1:36 ` Ping-Ke Shih

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®