[RFC PATCH ath-next 0/3] wifi: ath11k: merge the TCP segments of a station in the REO reap

From: Julius Bairaktaris

Date: Mon Nov 23 2026 - 08:50:19 EST


With Ethernet rx decap, ath11k hands every MSDU of a REO reap to
ieee80211_rx_napi() on its own. mac80211 runs its 802.3 receive path for
it (station and fast_rx lookup, station and netdev counters, control port
check, internal forward lookup) and passes it to napi_gro_receive(), where
TCP GRO on the netdev parses it again and adds it to the aggregate it is
building. A TCP upload of one station at 850 Mbit/s is about 70,000
frames a second through both.

3/3 merges the consecutive segments of one TCP stream of one station and
TID of a reap in the driver, as GRO on the netdev would, and hands the
run to mac80211 as one GSO frame. I would like to know whether this is
the right layer before going further, so this is an RFC.

Why in the driver and not GRO per MSDU: on a Xiaomi AX3600 (IPQ8074,
four Cortex-A53) routing a TCP upload of one HE160 station at
852 Mbit/s, without the merge, a CPU profile (one run) has the GRO
functions (dev_gro_receive(), tcp_gro_receive(), inet_gro_receive(),
tcp4_gro_receive() and their helpers) at 7.9 % of all samples, the
mac80211 802.3 receive path at 5.2 %, and the second peer lookup that
the RX cost series [1] removes at 1.7 %. With the merge, in a profile of
the same upload at 814 Mbit/s (one run, with further datapath changes of
mine on OpenWrt), GRO is at 1.0 %, the mac80211 receive path at 1.4 %,
and the merge functions themselves at 2.7 %. The driver already has what
a merge needs per MSDU (the station, TID and receive status of each
frame, in ring order) before mac80211 sees the frame, so joining a
segment is one header comparison.

What stays per MSDU: every frame still passes ath11k_dp_rx_process_msdu()
and ath11k_dp_rx_h_mpdu() before it can join, so the run is built only
from frames that would take the 802.3 path on their own. A frame joins
only with a receive status identical to the run's (so the decryption and
PN-validated flags are those of every segment), with no FCS or MIC
error, unicast, not EAPOL (those take the 802.11 path), not of a
4-address station, in one buffer, with a TCP checksum the hardware
verified, and with the Ethernet header of the run, so the source address
mac80211 checks is the one of every segment. ath11k has no decap offload
on mesh interfaces, so mesh is not merged. A frame that does not join
ends the run before it is handled, so order is kept and nothing is held
across reaps.

Counters: 1/3 makes ieee80211_rx_8023() count a TCP GSO frame as its
gso_segs packets, fragments and MSDUs and add the headers of the merged
segments to the byte counts, for the station and the netdev. It also
fixes the internal forward of such a frame to another station, which
today sets ETH_P_802_3 and the network header on the MAC header, so
validate_xmit_skb() fails to segment it and drops it. 2/3 exports the
netdev a station's 802.3 frames reach (its AP_VLAN netdev if it has
one), so the driver can decide as GRO there would: no merge with GRO off
or an XDP program, a frame list with rx-gro-list unless a local socket
takes the stream, else a frame with fragments, up to the netdev's GRO
size.

Alternatives I see, and would follow if preferred:
- a batched receive call in mac80211 that takes a list of 802.3 frames
of one station, does the per-station work once and merges in
__ieee80211_rx_handle_8023(), so every driver with decap offload gets
it (ieee80211_rx_list() today takes one frame per call);
- keeping GRO per MSDU and making each step cheaper (a hardware skb
hash so GRO finds its flow without hashing, no second peer lookup,
both in [1]), which keeps most of the 13 % above.
ath12k has the same per-MSDU path and would get the same change once
the layer is agreed; it also looks the peer up twice per MSDU (in
ath12k_wifi7_dp_rx_h_mpdu() and ath12k_dp_rx_deliver_msdu()).

The merge joins only frames whose TCP checksum the hardware verified,
which relies on the RX checksum fix of the RX correctness series [2].

1/3 and 2/3 are mac80211 changes, for wireless-next. The merge acts only
with Ethernet decap (frame_mode=2); with the native Wi-Fi default nothing
changes. The series applies on top of the RX cost
series [1], whose page_pool RX buffers the fragment form takes over and
whose single peer lookup gives the station of each frame; [1] applies
on the RX correctness series [2].

The same changes ran on the AX3600 with OpenWrt's 6.18 kernel and
wireless backports, together with further datapath changes of mine,
with frame_mode=2. Over a run of routed and bridged TCP up- and
download, IPv4 and IPv6, with one HE160 station, the driver merged
14,640,275 segments into 1,359,382 frames (10.8 per frame), and the
kernel log stayed clean. Station to station on one radio, the stream
that mac80211 forwards internally ran at 3.8 / 4.3 Mbit/s with the merge
before the forward fix in 1/3, and at 83.4 / 99.0 Mbit/s with it,
against 81.6 / 99.5 Mbit/s without the merge (one run each; the second
station's link is the limit).

[1] https://lore.kernel.org/all/20261123134137.718575-1-julius@xxxxxxxxxxxxxx/
[2] https://lore.kernel.org/all/20261122210525.2076058-1-julius@xxxxxxxxxxxxxx/

I used Claude (Anthropic) to help write these patches.
I have reviewed the commit messages and the cover letter myself and edited
them where needed.

Julius Bairaktaris (3):
wifi: mac80211: count the segments of a received GSO frame
wifi: mac80211: tell a driver the netdev a station's 802.3 frames
reach
wifi: ath11k: merge the TCP segments of a station in a REO reap

drivers/net/wireless/ath/ath11k/core.h | 3 +
drivers/net/wireless/ath/ath11k/debugfs.c | 4 +
drivers/net/wireless/ath/ath11k/dp_rx.c | 444 +++++++++++++++++++++-
include/net/mac80211.h | 17 +
net/mac80211/rx.c | 70 +++-
5 files changed, 530 insertions(+), 8 deletions(-)


base-commit: 1983b40acfcb3c3464b291c85977290a785bcfdc
prerequisite-patch-id: ed566369a9bbda0ac9a48357261e8cfe1cc0f1d1
prerequisite-patch-id: 726d7737c833da0842192eccececad4a0dedb1a6
prerequisite-patch-id: cf0b8ff1ac6cef681433247e4b937a3e23af78a3
prerequisite-patch-id: 03c89df01745ac9a80653431261f9a003dbca7db
prerequisite-patch-id: cb48c0eddbe0c2fe176e8edc94c6bc40be3c48a9
prerequisite-patch-id: 1956ec85ad80b68868538070fc0e89c29603467a
prerequisite-patch-id: a66e3c439fe1341f83075e5687361fdb197cfe5a
prerequisite-patch-id: 3e5becdd444369ceebf7128696f32b9c7575cdae
prerequisite-patch-id: 09d8e8e4d5db48209df13c50b0bceadc913f1b36
prerequisite-patch-id: a665dc2d623226337224372a5bc7e3e78be9c96e
prerequisite-patch-id: 7cbac21c92659e4da6c3e708271517b65d7a5272
prerequisite-patch-id: d615376a310af6a446929dd935dfa6d7576b7cb4
prerequisite-patch-id: 291642da9c3994bb7deacb428c37d0ec8eb121ae
prerequisite-patch-id: 09359a8fb405612c1ef37addfa8a8518bad32fcc
prerequisite-patch-id: 7ef0f31a73ea2a5c875e2c1a233a4db18c4ed8d1
prerequisite-patch-id: 5d75f6dfac0bc5ccb54a9e2fdcd0583381c158eb
--
2.53.0