RE: [PATCH rtw-next v10 2/4] wifi: rtw88: sdio: Track running state and cancel TX worker on stop
From: Ping-Ke Shih
Date: Tue Nov 17 2026 - 01:15:56 EST
Alastair D'Silva <alastair@xxxxxxxxxxx> wrote:
> When rtw_sdio_stop() disables interrupts, in-flight interrupt handlers or
> delayed TX work may still run against a powered-down device.
>
> Track the operational state in rtwsdio->running with an irq_lock mutex
> (similar to PCI), check it at the entry of rtw_sdio_handle_interrupt()
> and rtw_sdio_tx_handler(), serialize state transitions in rtw_sdio_start()
> and rtw_sdio_stop() under sdio_claim_host() and irq_lock, and cancel the
> TX worker synchronously in rtw_sdio_stop().
>
> Drain rtwsdio->tx_queue[] with locked skb_dequeue() and
> ieee80211_free_txskb() in rtw_sdio_stop() and again in rtw_sdio_start() to
> catch any frames queued by an in-flight rtwdev->tx_work after
> rtw_sdio_stop() completes, and reset rtwsdio->tx_queue_stopped[] while
> waking stopped AC queues under tx_queue[].lock in rtw_sdio_start().
>
> Fixes: 28eaf7971a20 ("wifi: rtw88: sdio: add TX back-pressure and retry on page starvation")
> Cc: stable@xxxxxxxxxxxxxxx
> Assisted-by: LLM
No need Assisted-by tag now.
> Reviewed-by: Luka Gejak <luka.gejak@xxxxxxxxx>
> Signed-off-by: Alastair D'Silva <alastair@xxxxxxxxxxx>
Take my acked-by to v11 with small nit below.
Acked-by: Ping-Ke Shih <pkshih@xxxxxxxxxxx>
[...]
> static int rtw_sdio_start(struct rtw_dev *rtwdev)
> {
> + struct rtw_sdio *rtwsdio = (struct rtw_sdio *)rtwdev->priv;
> + enum rtw_tx_queue_type queue;
> u32 clear;
> + int i;
>
> if (rtw_is_8723bs(rtwdev)) {
> int ret = rtw_sdio_8723bs_check_rqpn(rtwdev);
> @@ -1069,20 +1086,49 @@ static int rtw_sdio_start(struct rtw_dev *rtwdev)
>
> rtw_sdio_enable_rx_aggregation(rtwdev);
>
> + rtw_sdio_purge_tx_queues(rtwdev);
> +
> + for (i = 0; i < IEEE80211_NUM_ACS; i++) {
> + queue = rtw_tx_ac_to_hwq(i);
> + scoped_guard(spinlock_irqsave, &rtwsdio->tx_queue[queue].lock) {
> + if (rtwsdio->tx_queue_stopped[queue]) {
> + rtwsdio->tx_queue_stopped[queue] = false;
> + ieee80211_wake_queue(rtwdev->hw, i);
> + }
> + }
> + }
Create a function to reset TX queues state.
In rtw_sdio_start(), this is a cleanup operation, but it takes up too much space
(blurring the focus).
> +
> + sdio_claim_host(rtwsdio->sdio_func);
> +
[...]