Re: [PATCH v9 4/6] wifi: rtw88: sdio: track free TX pages and OQT credits for RTL8723BS
From: Luka Gejak
Date: Wed Sep 09 2026 - 04:14:30 EST
On Wed Sep 9, 2026 at 7:36 AM CEST, Ping-Ke Shih wrote:
>
> Luka Gejak <luka.gejak@xxxxxxxxx> wrote:
>>
[...]
>> On Sun Sep 6, 2026 at 4:22 AM CEST, Ping-Ke Shih wrote:
>>>
[...]
> Will/should you add this in v10 or v11 before your patch 4/6?
>
> As your v10 didn't get ran by NIPA because of [1], you can send v10 with
> RESEND or just send v11 (including the additional one).
>
> (To answer the ordering point question below.) I prefer to have the patch
> in advance, for two reasons. One is to backport easier, and another is to
> clear to know it is existing problem.
>
> [1] https://lore.kernel.org/linux-wireless/fe0d8a3c2951c051b321902582eaf95f230a754d.camel@xxxxxxxxxxxxxxxx/T/#u
>
I have decided to send v11, with the fix as patch 4, ahead of the accounting
patch. Your two reasons are better than mine, so I have dropped the plan to
send it afterwards.
It is not gated on anything, so it does change behaviour for the other
five SDIO parts: the padding they send is zeroed now, and a transmit can
fail with -ENOMEM if the skb has to be reallocated. That is called out in
the Scope section rather than buried in the changelog.
One consequence worth flagging. The back-pressure patch stopped retrying
-ENOMEM in v10, because with no padding in the series nothing could
return it. It is reachable again now, so the retry is back. Without it a
stopped access category has nothing left to kick it. That patch is
therefore code identical to what you acked in v9; only its comments
differ, so I have carried your Acked-by.
[...]
> In v10, the beginning of rtw_sdio_write_port_8723bs() and
> rtw_sdio_write_port_generic become the similar. And
> I think ' txsize = round_up(skb->len, 4);' is not necessary to
> rtw_sdio_write_port_8723bs() because it is 512-byte aligned.
>
> Therefore, you can do the same thing in rtw_sdio_write_port() and then
> call
> rtw_sdio_write_port_8723bs()
> or
> rtw_sdio_write_port_generic()
> by condition.
>
Done. rtw_sdio_write_port() works out the transfer address and the
aligned size and passes both down, and the padding stays there too, so it
runs once for both paths and outside the credit mutex.
I kept the separate length in the RTL8723BS path, though, and I think it
is needed. It is not the transfer size, it feeds the page accounting:
rtw_sdio_check_free_txpg() and DIV_ROUND_UP(txsize, page_size), with a
128 byte page. The chip charges pages by the frame length rather than by
the padded transfer, which is what the vendor driver does, and the two
differ just above a block boundary:
frame pages by length pages by padded size
513 5 8
1025 9 12
So using the aligned size there would charge up to three pages per frame
that the chip never took. There is a comment on the line now saying why.
[...]
> Will this be needed by the additional patch
>
> "wifi: rtw88: sdio: zero the padding added to a TX transfer"?
>
Yes, with pad_size declared at the top, computed unconditionally, and tested
with if (pad_size > 0).
[...]
> I will check this by v11, because I'd like you can have v11 with
>
> 1. "wifi: rtw88: sdio: zero the padding added to a TX transfer"
> 2. move the same beginning of rtw_sdio_write_port_8723bs()
> and rtw_sdio_write_port_generic() to rtw_sdio_write_port()
>
> Is it okay to you?
Both are in v11, so yes.
>
> Ping-Ke
Best regards,
Luka Gejak