Re: [PATCH rtw-next 1/5] wifi: rtw88: sdio: cache the free TX page counts of the 88xx chips

From: David Härdeman

Date: Tue Nov 17 2026 - 07:51:07 EST


On Tue, Nov 17, 2026 at 08:20:16AM +0100, Luka Gejak wrote:
>On November 16, 2026 8:01:41 PM GMT+01:00, "David Härdeman"
><david@xxxxxxxxxxx> wrote:
>
>> + free_txpg[0] = rtw_sdio_read32(rtwdev, REG_SDIO_FREE_TXPG);
>> + free_txpg[1] = rtw_sdio_read32(rtwdev, REG_SDIO_FREE_TXPG + 4);
>> + free_txpg[2] = rtw_sdio_read32(rtwdev, REG_SDIO_FREE_TXPG + 8);
>
>[ ... ]
>
>> + rtwsdio->free_txpg_valid = true;
>
>As far as I can see, a failed read can leave bogus credits cached here.
>While the chip is powered on, sdio_readl() returns 0xffffffff on an I/O
>error, and rtw_sdio_read32() only logs the error. That becomes 4095 pages
>in each affected page count.
>
>The first frame can still fit the real page pool and be sent
>successfully. The cache then stays valid, so the next frame can be
>admitted using credits from the failed read even after the real pages
>have been consumed. Previously, the next transfer would read the
>registers again.
>
>Could the sync return an error and leave the cache invalid unless all
>three reads succeed? The individual reads used as a fallback in patch 5
>would need to preserve their errors too.

Yes, I assume Leonard's patches will go in first, and there's already a
read helper there, so when I rebase the patch set, this will be
fixed.

--
David Härdeman