From: "David Härdeman" <david@hardeman.nu>
To: Ping-Ke Shih <pkshih@realtek.com>, linux-wireless@vger.kernel.org
Cc: linux-kernel@vger.kernel.org,
"Leonard Lausen" <leonard@lausen.nl>,
"Alastair D'Silva" <alastair@d-silva.org>,
"Luka Gejak" <luka.gejak@linux.dev>,
"Martin Blumenstingl" <martin.blumenstingl@googlemail.com>,
"Jernej Skrabec" <jernej.skrabec@gmail.com>,
"Bitterblue Smith" <rtl8821cerfe2@gmail.com>,
"David Härdeman" <david@hardeman.nu>
Subject: [PATCH rtw-next 0/5] wifi: rtw88: sdio: faster and fairer TX for the 88xx chips
Date: Mon, 16 Nov 2026 20:01:40 +0100 [thread overview]
Message-ID: <20261116190145.2736364-1-david@hardeman.nu> (raw)
The RTL8822CS on a NanoPi R76S (RK3576, SDR104 at 198 MHz) sends at less
than half the rate it receives at, and with traffic in both directions
it hardly sends at all. These patches are about the 88xx chips
(RTL8822BS, RTL8822CS, RTL8821CS); the 8051 chips keep their current
paths.
1. keep the free page and AC output queue counts, as the RTL8723BS path
does, and read the registers only when a transfer doesn't fit;
2. send up to 32 frames / 20 KiB of one access category per transfer;
3. stop the mac80211 queues when the driver's FIFO is deep, so the
backlog stays in mac80211 (fq_codel) instead of an unbounded FIFO;
4. let the TX work have the host between RX reads while frames are
waiting; the RX path otherwise takes most of the bus;
5. read HISR with RX0_REQ_LEN, and the three free page registers, with
one transfer each.
R76S as AP, VHT80 1x1 (client 2x2, AX210), 2 m line of sight, iperf3
TCP between the client and a wired host on the AP's switch, Mbit/s
(AP->client 30 s / client->AP 30 s / both directions at once 120 s),
mean of 3 interleaved rounds:
down up bidir
rtw-next 64 132 28 + 76
+ 1-4 184 210 77 + 89
+ 1-5 198 212 84 + 86
Realtek driver ~183 ~265 ~40 + 180 (FriendlyWrt, same board)
In the bidir runs, the share of 5 s intervals with the download below
40 Mbit/s went from 11-24 of 24 with rtw-next to 1-5 of 24 with the
series.
The individual steps were measured in another set of runs, with the
sender behind a path that reorders some TCP segments (which costs a
little download throughput but doesn't change the ranking); RTT is
ping AP->client during the download, median / 90th percentile:
down up bidir RTT under load
rtw-next 89 164 23 + 119 34 / 91 ms
+ 1-2 189 220 37 + 167 22 / 51 ms
+ 1-3 181 214 30 + 176 10 / 29 ms
+ 1-4 194 198 79 + 91 11 / 25 ms
+ 1-5 190 202 73 + 100 13 / 47 ms
Patch 2 is the big step for one-way traffic, patch 3 halves the
latency under load, and patch 4 is what makes both directions work at
the same time (it costs some upload when that runs alone). Patch 5 is
mainly about bus transfers; in a longer A/B (10 interleaved rounds,
channel 149) it gave about 10 % more download than 1-4 (190 vs 171
Mbit/s), with up and bidir unchanged.
A soak with the full series, 30 120 s bidir transfers in a row,
averaged 95 + 88 Mbit/s, the slowest download being 80 Mbit/s (10 of
the 720 5 s intervals had the download below 40 Mbit/s). There were no
kernel messages and the bus stayed at SDR104.
Known issue, not addressed here: when the client goes off-channel (for
example for a background scan), the chip sometimes gives up on an MPDU
of an A-MPDU session without sending a BAR, and keeps sending up to 64
frames past it. rtw88 reports every SDIO data frame as acked, so
mac80211 doesn't know either and can't send a BAR. The client's
reorder window then stalls until it is pushed past the hole, which
costs a short throughput dip. With iwlwifi clients it turned into
bursts of up to 63 lost frames per hole because of a reorder buffer
bug there, for which I have sent fixes:
https://lore.kernel.org/linux-wireless/20261116155609.535595-1-david@hardeman.nu/
I tried the hardware BAR settings (REG_BAR_MODE_CTRL thresholds, the
BAR retry bits in the TX descriptor), a longer retry limit, MACID sleep
for dozing clients, per-frame TX reports and a BAR sent by the driver
after the client wakes up; none of them helped, and per-frame reports
only came back for about one frame per A-MPDU. Ping-Ke, is there a way
for the firmware to report which MPDU it dropped, or to send the BAR
itself?
Tested on the RTL8822CS only. The RTL8822BS and RTL8821CS share the
register layout and code paths; testing on them would be welcome.
Two series on the list touch the same code, and I'd like to make sure
this one doesn't clash with them:
- Alastair D'Silva's "wifi: rtw88: sdio: Fix unhandled RX request
interrupt storm" (v10) changes the RX interrupt handling that patches
4 and 5 touch. This series is based on rtw-next without it; I have a
version rebased on top of it and will send that once it's applied.
https://lore.kernel.org/linux-wireless/20261113082242.2773369-1-alastair@d-silva.org/
- Leonard Lausen's "wifi: rtw88: reduce RTL8822CS SDIO request
overhead" (v2): his patch 1 (control frame filter) is independent of
this series and applies on top of it. His patch 2 combines the free
page register reads that patch 1 here replaces with cached counts,
so only one of the two makes sense; Leonard, I'm happy to go with
whatever you and Ping-Ke prefer.
https://lore.kernel.org/linux-wireless/20261116100804.425592-2-leonard@lausen.nl/
The bus speed itself needs 67a97316a31a ("mmc: core: sdio: skip CMD11 if
signalling is already 1.8V") from mmc/next on this board; without it the
card runs at 50 MHz and the gains are smaller.
The patches were generated with the help of an LLM; I have reviewed
them (to the best of my ability), and tested them on actual hardware as
described above.
David Härdeman (5):
wifi: rtw88: sdio: cache the free TX page counts of the 88xx chips
wifi: rtw88: sdio: aggregate TX frames of the 88xx chips
wifi: rtw88: sdio: limit the TX queue length of the 88xx chips
wifi: rtw88: sdio: let TX in while receiving on the 88xx chips
wifi: rtw88: sdio: read neighbouring registers of the 88xx chips at
once
drivers/net/wireless/realtek/rtw88/sdio.c | 574 +++++++++++++++++++---
drivers/net/wireless/realtek/rtw88/sdio.h | 13 +
2 files changed, 526 insertions(+), 61 deletions(-)
base-commit: 61a5eb87b2d9b4d5e353780b781cf691f39ba9e1
--
2.47.3
next reply other threads:[~2026-11-16 19:02 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-16 19:01 David Härdeman [this message]
2026-11-16 19:01 ` [PATCH rtw-next 1/5] wifi: rtw88: sdio: cache the free TX page counts of " David Härdeman
2026-11-16 19:01 ` [PATCH rtw-next 2/5] wifi: rtw88: sdio: aggregate TX frames " David Härdeman
2026-11-16 19:01 ` [PATCH rtw-next 3/5] wifi: rtw88: sdio: limit the TX queue length " David Härdeman
2026-11-16 19:01 ` [PATCH rtw-next 4/5] wifi: rtw88: sdio: let TX in while receiving on " David Härdeman
2026-11-16 19:01 ` [PATCH rtw-next 5/5] wifi: rtw88: sdio: read neighbouring registers of the 88xx chips at once David Härdeman
2026-11-16 21:59 ` [PATCH rtw-next 0/5] wifi: rtw88: sdio: faster and fairer TX for the 88xx chips 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=20261116190145.2736364-1-david@hardeman.nu \
--to=david@hardeman.nu \
--cc=alastair@d-silva.org \
--cc=jernej.skrabec@gmail.com \
--cc=leonard@lausen.nl \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-wireless@vger.kernel.org \
--cc=luka.gejak@linux.dev \
--cc=martin.blumenstingl@googlemail.com \
--cc=pkshih@realtek.com \
--cc=rtl8821cerfe2@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 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®