From: Ping-Ke Shih <pkshih@realtek.com>
To: "luka.gejak@linux.dev" <luka.gejak@linux.dev>
Cc: "linux-wireless@vger.kernel.org" <linux-wireless@vger.kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"Michael Straube" <straube.linux@gmail.com>,
Peter Robinson <pbrobinson@gmail.com>,
Bitterblue Smith <rtl8821cerfe2@gmail.com>
Subject: RE: [PATCH v11 5/7] wifi: rtw88: sdio: track free TX pages and OQT credits for RTL8723BS
Date: Thu, 10 Sep 2026 02:40:39 +0000 [thread overview]
Message-ID: <351ffe7fa4d94b34ae6ce9984bb8b5b9@realtek.com> (raw)
In-Reply-To: <20260909074556.55709-6-luka.gejak@linux.dev>
luka.gejak@linux.dev <luka.gejak@linux.dev> wrote:
> From: Luka Gejak <luka.gejak@linux.dev>
>
> The RTL8723BS reports free TX page counts that the generic 8051 path
> reads back from the chip on every transfer, which is both slow over SDIO
> and unreliable on this part: the register frequently reads back zero
> while pages are in fact available. It also gates transmission on a free
> count in the SDIO output queue, REG_SDIO_OQT_FREE_PG, which rtw88 does
> not track at all. The vendor driver calls this the OQT free space and
> never expands the acronym; the register holds the number of further
> transfers the SDIO output queue can accept, and the chip discards
> writes that arrive when it has run out.
>
> Mirror the vendor driver and keep the per-queue and public page counts
> in software, seeded at start and resynchronised from the chip only when
> the cached counts say there is not enough room. Wait for a free output
> queue entry before writing, and account for the pages consumed after a
> successful transfer.
>
> rtw_sdio_write_port() becomes a dispatcher. It works out the transfer
> address and the aligned transfer size, which both paths need, and hands
> them to rtw_sdio_write_port_8723bs() or rtw_sdio_write_port_generic().
> The transfer itself moves into rtw_sdio_write_to_port(), which both
> call, so the generic path is step for step what it was. The padding
> added by the previous patch stays in rtw_sdio_write_port(), so it still
> runs once for both paths and stays outside the credit mutex.
>
> The RTL8723BS path keeps a separate length for the accounting. The chip
> charges pages by the frame length rather than by the padded transfer, as
> the vendor driver does, and the two differ just above a block boundary:
> a 1025 byte frame is nine pages by length and twelve by the padded size.
>
> The check, the output queue wait and the accounting are serialised by
> a mutex. The TX worker and the H2C path reach this function
> concurrently, and two writers that both pass the checks can otherwise
> claim the same pages and output queue entry, after which the chip
> silently discards whichever transfer arrives second. The vendor driver
> avoids the same race by funnelling all transmission through one thread.
>
> Measured on RTL8723BS hardware against an iperf3 server one hop behind
> the AP, with the wlan0 byte counters as ground truth. On the generic
> path the association completes but no data passes at all: TCP and UDP
> both measure 0 bit/s in either direction. With this patch TCP is
> 25.3 Mbit/s up and 37.3 Mbit/s down, and UDP is 25.0 Mbit/s up at 0%
> loss.
>
> Signed-off-by: Luka Gejak <luka.gejak@linux.dev>
Acked-by: Ping-Ke Shih <pkshih@realtek.com>
next prev parent reply other threads:[~2026-09-10 2:40 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-09 7:45 [PATCH v11 0/7] wifi: rtw88: preparations for RTL8723B/RTL8723BS luka.gejak
2026-09-09 7:45 ` [PATCH v11 1/7] wifi: rtw88: add the RTL8723B chip type and SDIO helper luka.gejak
2026-09-09 7:45 ` [PATCH v11 2/7] wifi: rtw88: rx: mark zero length packets on RTL8723BS luka.gejak
2026-09-09 7:45 ` [PATCH v11 3/7] wifi: rtw88: tx: extend the TX report purge timeout to RTL8723BS luka.gejak
2026-09-09 7:45 ` [PATCH v11 4/7] wifi: rtw88: sdio: zero the padding added to a TX transfer luka.gejak
2026-09-10 2:24 ` Ping-Ke Shih
2026-09-09 7:45 ` [PATCH v11 5/7] wifi: rtw88: sdio: track free TX pages and OQT credits for RTL8723BS luka.gejak
2026-09-10 2:40 ` Ping-Ke Shih [this message]
2026-09-09 7:45 ` [PATCH v11 6/7] wifi: rtw88: sdio: set up RX aggregation and interrupts " luka.gejak
2026-09-09 7:45 ` [PATCH v11 7/7] wifi: rtw88: sdio: add TX back-pressure and retry on page starvation luka.gejak
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=351ffe7fa4d94b34ae6ce9984bb8b5b9@realtek.com \
--to=pkshih@realtek.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-wireless@vger.kernel.org \
--cc=luka.gejak@linux.dev \
--cc=pbrobinson@gmail.com \
--cc=rtl8821cerfe2@gmail.com \
--cc=straube.linux@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.