Skip to content

wifi: apple: centauri: t6050: NAPI/spinlock data path, SG, EHT caps, and dynamic PS hold - #4282

Merged
RyanTheTide merged 5 commits into
aurora-silicon:mainfrom
tully-8888:feat/centauri-t6050-dataplane-eht
Dec 5, 2026
Merged

RyanTheTide merged 5 commits into
aurora-silicon:mainfrom
tully-8888:feat/centauri-t6050-dataplane-eht

Conversation

@tully-8888

@tully-8888 tully-8888 commented Dec 4, 2026 •

Copy link
Copy Markdown
Contributor

What: Move Centauri T6050 Wi-Fi data rings off the shared command mutex onto separate RX/TX spinlocks, route data MSI vectors (3 and 8) directly to NAPI with batched TX doorbells, accept paged frames (NETIF_F_SG), parse firmware EHT capabilities, and hold firmware power save off during active traffic bursts.

Tested: J714s MacBook Pro 14" M5 Pro (Mac17,9, T6050) at af4467ebd996, in the batched Boot #11 kernel 7.3.0-j714s-b11+ (main 9ece2d8202d2 plus 16 open PR heads unchanged, this one included, plus local J714s patches), 2026-12-04: boots, 0 failed units, 0 new kernel warnings against the previous boot. Wi-Fi module reload, twice: modprobe rc 0, rejoined, ping over wlan0 20 of 20, Bluetooth powered. Both rejoins took 88 s: the first join after the reload got AP status 306 because no deauth was sent on removal, a gap that a separate Wi-Fi fix outside this PR addresses. s2idle sleep (322 s): Wi-Fi associated again 2 s after resume without a reload. No throughput A/B.

Boot #11 row

Kernel: local branch j714s-boot11-test at e7ab6d7b65c2. Its last commit is a test-only patch with runtime switches that turn single PR changes off, for same-kernel A/B runs. In an A/B row the "off" arm is that switch, which emulates the old code; it is not the old tree.

Non-default command line: nvme_apple.flush_interval=0 cpuidle.governor=teo ane_t6021.irq_wait=0 ane_t6021.irq_wait_switch=1 ane_t6021.bridge_record=1 appledrm.ext_pq_as_hlg=1 kvm.halt_poll_ns_grow_start=100000 macsmc.m5_pcio_budget=2 macsmc.m5_n1_budget=3 arm64.nowfxt zswap.enabled=0 softlockup_panic=1.

  • The 306 comes from removing btcentauri_t6050 first: the N1 recovery teardown unregisters wlan0 before the leave runs.
Earlier rows

J714s MacBook Pro 14" M5 Pro (Mac17,9, T6050), local kernel 7.3.0-j714s-b8+. It is not this head: it carries the SG and EHT commits patch-identical to af4467eb, but earlier versions of the data ring, NAPI and power save commits, plus the statistics and warm reset commits of #3946 and one more Centauri commit (check stage before drain and serialize ps_invalidate); its t6050/centauri_wifi.c differs from the head by +941/-18 lines. On that kernel: boots and connects at 1201 MBit/s with Power save: on and NETIF_F_SG = 1; a 50 MB HTTPS download (one run) reaches 79.4 MB/s (635 Mbps) through data MSI vectors 3 and 8 with 0 control-vector wakeups; a 200-packet 10 ms gateway burst ping (one run) holds 0% loss with p50 1.71 ms / p99 2.58 ms / max 2.87 ms; 0 Centauri errors in dmesg. These are single runs with no baseline, not a measure of a speedup. Host harnesses (centauri-scan-tests.py, centauri-wifi-pm-tests.py, centauri-wifi-avoid-tests.py + negative controls) and W=1 LLVM=1 (normal + KUnit) pass at every commit. No row at af4467eb itself yet.

Risk: two-way door · T6050 / M5 Pro Macs using apple_centauri_t6050.

Not yet: proof on J714s that traffic uses vectors 3 and 8, and a same-kernel A/B at this head (the same tree with and without these five commits, interleaved, several runs per arm with the spread) before any throughput or latency claim; suspend/resume soak on hardware with the new data-path quiesce; EHT association (current J714s firmware does not yet emit an EHT element in system_caps).

Details
  1. wifi: apple: centauri: t6050: run the data rings outside the command mutex: adds data_rx_lock and data_tx_lock spinlocks plus data_paused quiesce, removes rx_gro_queue, collects RX ring 15 and reaps TX ring 76 in rx_poll(), posts TX directly to ring 25, and gates TX on !disconnect_event and shared data_tx_fail().
  2. wifi: apple: centauri: t6050: route the data vectors to NAPI and batch the TX doorbell: schedules rx_napi directly from hardirq for vectors 3 and 8 (still waking link_work on control traffic or unexpected Alpha stage, with link_worker() checking stage before drain()), and defers TX doorbells under netdev_xmit_more().
  3. wifi: apple: centauri: t6050: take paged frames: enables NETIF_F_SG so validate_xmit_skb() does not linearize paged skbs before skb_copy_bits() (leaves GSO_SOFTWARE/TSO off so frames stay within 2048-byte ring slots).
  4. wifi: apple: centauri: t6050: read EHT capabilities from the firmware: parses an EHT capabilities element from TLV 255 with exact MCS/PPE length validation, clears band-inapplicable fields per band, withholds 320 MHz (marking NO_320MHZ wherever NO_160MHZ is set), and requires nonzero base RX/TX NSS.
  5. wifi: apple: centauri: t6050: hold power save off while traffic flows: tracks RX/TX frames in generation-tagged 250 ms windows, sends cmd 7 mode 3 when a direction crosses 64 frames while ps_user is enabled, restores mode 0 after 2 s below 32 fps (retrying recoverable failures and restoring on reassociation), and fixes a pre-existing wifi_power_mgmt()/link_work unregister teardown race.
Evidence
  • Branch: feat/centauri-t6050-dataplane-eht, head af4467ebd9964 on 9c9e5f035baa2
  • scripts/checkpatch.pl --strict --git 9c9e5f035baa2..af4467ebd9964: 0 errors, 0 warnings, 0 checks across all 5 commits
  • make ARCH=arm64 LLVM=1 W=1 (normal and APPLE_CENTAURI_T6050_KUNIT_TEST=y): 0 warnings at every commit
  • Harnesses at every commit: centauri-scan-tests.py PASS (9/9 negative controls rejected), centauri-wifi-pm-tests.py PASS (14/14 negative controls rejected), centauri-wifi-avoid-tests.py 4/4 PASS
  • Hardware run on Mac17,9 / J714s (7.3.0-j714s-b8+, not this head, see Tested; single runs):
    • wlan0: NETIF_F_SG = 1, rx/tx bitrate 1201.0 MBit/s, Power save: on
    • 200-packet 10 ms burst ping to 192.168.0.1: 0% loss, min 1.15 ms, p50 1.71 ms, p95 2.44 ms, p99 2.58 ms, max 2.87 ms
    • 50 MB download (speed.cloudflare.com): 79,378,057 B/s (79.4 MB/s, 0.63 s); 0 new control IRQs on vector 2 (169) during transfer; 0 Centauri errors in dmesg

…mutex

Frames went through the link worker, which takes wifi->lock, the mutex
held across firmware commands, scans, station queries and regulatory
updates. A frame could wait behind any of them, and every received
frame took the path interrupt, worker, mutex, copy, queue, NAPI.

- Two spinlocks now cover the data rings: data_tx_lock for TX ring 25
  and completion ring 76, data_rx_lock for RX rings 12 and 15.
- net_transmit() reaps completions and posts to the ring itself. A
  frame waits in data_tx_queue only while the ring or the in-flight cap
  is full; the cap and its bypass work as before.
- The interrupt schedules rx_napi directly. Its poll reaps the TX
  completions, drains the RX ring within the budget and hands frames
  to GRO without the intermediate rx_gro_queue.
- The link worker keeps the control and event rings and still services
  the data rings, so the cap bypass and the RX drop path while the
  interface is down work as before.
- Suspend, unregister and mark_failed close the data paths through
  data_quiesce(); resume and a failed suspend reopen them. Suspend also
  waits for a running rx_napi poll before the transport sleeps. A data
  ring is published to the fast paths only after it is set up.
- A command fault and mark_failed set command_failed and stop the
  queue under data_tx_lock (data_tx_fail()), so a running TX batch
  cannot post or wake the queue after it. Netpoll takes data_tx_lock
  only with a trylock.
- A disconnect event closes TX as soon as it is read, under
  data_tx_lock: no path, resume included, posts a frame or wakes the
  queue between the event and the link worker taking the link down.
- The station counters and data_stats are read under the data locks.

The tools/asahi PM and scan harnesses get stubs for the new helpers.

Signed-off-by: vlad <tulituvlad@gmail.com>
…h the TX doorbell

data_ring_open() gives the TX rings (25 and 76) MSI vector 3 and the
RX rings (12, 14 and 15) vector 8, but every vector still scheduled the
link worker next to rx_napi, so each data interrupt also woke a worker
that then waited for the command mutex.

- A data vector now only schedules rx_napi. The link worker still runs
  for every other vector, when a control, event or scan ring shows a
  new message on a data vector, and while rx_napi is off or the data
  paths are paused. The vector numbers get names and data_ring_open()
  uses them.
- Without the wake on every vector, two events could wait for the next
  control interrupt: drain() now wakes the link worker for a disconnect
  event on an established link, whichever thread drained it, and a data
  path that finds the firmware stopped while nothing took the transport
  down wakes it to report the fault, each time: stage_fault_logged only
  keeps the worker from logging the same stop twice. The worker reads
  the stage first and drains only while Alpha runs, so that its own
  drain cannot wake it again and again while no fault closes the
  transport, as during a suspend.
- net_transmit() posts every frame at once but rings the TX doorbell
  only for the last frame of a batch (netdev_xmit_more()), when it
  stops the queue, when it returns busy, and when the last frame of a
  batch is dropped. The poll, the link worker and netpoll ring it
  whenever a ring moved. data_quiesce() rings one still owed while the
  transport runs; after a command fault, a stop or a pause it is dropped.

Signed-off-by: vlad <tulituvlad@gmail.com>
The netdev had no features, so before every transmit of a paged frame
the stack copied its fragments into one linear buffer
(validate_xmit_skb() linearizes when the device lacks scatter-gather).

TX copies a frame into its ring slot with skb_copy_bits(), which reads
the paged parts as well as the linear one. Set NETIF_F_SG, so readable
paged frames reach net_transmit() unchanged and the copy into the slot
is the only one. No segmentation offload is set: a ring slot holds one
frame of at most BUFFER_SIZE bytes, and TSO or the other GSO_SOFTWARE
types would hand over larger ones.

Signed-off-by: vlad <tulituvlad@gmail.com>
The system capabilities reply carries the HE capabilities element in
a TLV of its own. Take an EHT capabilities element from the same kind
of TLV and register it on the bands it fits.

The element is checked against the HE capabilities it came with: its
MCS map size follows the 5 and 6 GHz widths, or 40 MHz on 2.4 GHz when
HE lists no 5 or 6 GHz width, the widths must build on each other (320
needs 160, 160 needs 80), the element must be exactly the size its
fields give, PPE thresholds included, and its base MCS range must give
at least one spatial stream each way. Anything else is ignored, and the
bands stay HE only.

Each band gets 160 MHz fields only where the band's HE capabilities
list 160 MHz, the MCS maps of the widths it keeps, the 6 GHz duplicate
mode on 6 GHz only and the EHT maximum MPDU length on 2.4 GHz only. A
band whose map layout the element does not carry (20 MHz only against
a wider one) gets no EHT.

No band gets 320 MHz. The firmware channel list encodes widths up to
160 MHz, so it cannot say which 6 GHz channels take 320 MHz, and
cfg80211 checks a 320 MHz channel against IEEE80211_CHAN_NO_320MHZ
only. A channel the list gives no 160 MHz width now also gets that
flag.

The firmware on the J714s does not report an EHT element today (its
reply holds HT, VHT and HE only), so nothing changes there until a
firmware does.

Signed-off-by: vlad <tulituvlad@gmail.com>
With power save on (command 7, mode 0) the firmware dozes between
beacons, which costs throughput and adds latency under sustained
traffic. Hold it off while frames flow and give it back when the link
goes quiet.

The data paths count their frames in 250 ms windows, each under its own
lock: TX in net_transmit(), RX in the NAPI poll. When one direction
reaches 64 frames in a window while power save is on, it flags a burst
and ps_work turns power save off (mode 3). It then samples the packet
counters every 500 ms and turns power save back on after 2 s below 32
frames a second, or at once when the link goes away. Only a flagged
burst starts a hold, never a sample, and ps_work takes the burst flag
with one atomic exchange, so a stale sample cannot erase a new one. If
the firmware refuses the restore, the hold stays and the next sample
tries again while the link lasts. With the link gone the hold stays
without samples, and the next association restores it at once.

cfg80211's setting stays in charge: with power save off nothing is held
off, turning it off while it is held drops the hold, and turning it on
while it is held lets ps_work restore it once the traffic stops. A
change of the setting, and the end of a connect, drop a pending burst
and the frames each window counted toward one, and a hold started
before ends at its next sample.

Suspend cancels ps_work after tx_paused, so a late run leaves the
firmware alone, and again once the data paths are quiet, dropping a
burst they flagged in between. Resume or a failed suspend starts it
again if it still holds power save off.

Remove cancels ps_work and the link worker only after the netdev and
the wiphy are unregistered. Before, a power save request could still
arrive after the last cancel of the link worker, fault in the command
path that stopping cancels, and queue the worker against freed state.
Power save requests are now refused once stopping is set.

Signed-off-by: vlad <tulituvlad@gmail.com>
@tully-8888
tully-8888 requested review from a team and DjDeveloperr as code owners December 4, 2026 07:50
@github-actions github-actions Bot added area:gpu Area from CODEOWNERS (bot) blast:m5 Macs affected, from Merge risk (bot) door:two-way Revertible or not, from Merge risk (bot) needs-review No approving review from Core or Omarchy Mac yet (bot) labels Dec 4, 2026
@github-actions

github-actions Bot commented Dec 4, 2026 •

Copy link
Copy Markdown

Merge readiness at af4467eb: not ready yet

Check Detail
CI at head ok 4 checks passed
Review no needs one approving review from Core or Omarchy Mac (not the author)
Requested changes ok none
Hardware row at head ok in the PR body at af4467eb
Conflicts ok none
PR text ok Risk: two-way · T6050 / M5 Pro Macs using applecentaurit6050.

Areas: area:gpu

Updated by pr-readiness on pushes, edits, reviews and comments, and on a schedule. Rules: merge policy · labels.

@aurora-silicon-review aurora-silicon-review Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verdict: MERGE at af4467e

Checked: The RX and TX work uses separate locks. The zero-budget poll limits itself to TX, and received frames reach GRO outside the ring lock. Suspend quiesces both rings before transport sleep, and unregister drains IRQs and workers before freeing state. Paged skbs use the existing copy path, with segmentation offload left disabled. The EHT parser checks the capability lengths before reading optional fields and leaves 320 MHz disabled. All three exact host harnesses passed.

Follow-ups: The J714s batch establishes basic reload and suspend behavior. It ran with extra kernel arguments. Exact vector usage, EHT association and an A/B performance comparison remain open. For a follow-up series, keep the capability parsing and power-save policy separate from the data-ring changes where possible.

Evidence

Ran the submitted Centauri scan, Wi-Fi PM and network-avoidance harnesses against source from this head. No local kernel build, traffic or hardware run.

@RyanTheTide RyanTheTide left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ORCH5 merge sweep: passes the six-point gate (CI green at af4467e, independent review approval by aurora-silicon-review[bot], no taint, no Stage 1/LocalPolicy change).

@RyanTheTide
RyanTheTide merged commit 95a5913 into aurora-silicon:main Dec 5, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:gpu Area from CODEOWNERS (bot) blast:m5 Macs affected, from Merge risk (bot) door:two-way Revertible or not, from Merge risk (bot) needs-review No approving review from Core or Omarchy Mac yet (bot)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants