Repository navigation
wifi: apple: centauri: t6050: NAPI/spinlock data path, SG, EHT caps, and dynamic PS hold - #4282
Conversation
…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>
|
Merge readiness at
Areas: Updated by pr-readiness on pushes, edits, reviews and comments, and on a schedule. Rules: merge policy · labels. |
There was a problem hiding this comment.
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
left a comment
There was a problem hiding this comment.
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).
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 kernel7.3.0-j714s-b11+(main9ece2d8202d2plus 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-testate7ab6d7b65c2. 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.btcentauri_t6050first: 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 toaf4467eb, 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 serializeps_invalidate); itst6050/centauri_wifi.cdiffers from the head by +941/-18 lines. On that kernel: boots and connects at 1201 MBit/s withPower save: onandNETIF_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 indmesg. 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) andW=1 LLVM=1(normal + KUnit) pass at every commit. No row ataf4467ebitself 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
wifi: apple: centauri: t6050: run the data rings outside the command mutex: addsdata_rx_lockanddata_tx_lockspinlocks plusdata_pausedquiesce, removesrx_gro_queue, collects RX ring 15 and reaps TX ring 76 inrx_poll(), posts TX directly to ring 25, and gates TX on!disconnect_eventand shareddata_tx_fail().wifi: apple: centauri: t6050: route the data vectors to NAPI and batch the TX doorbell: schedulesrx_napidirectly from hardirq for vectors 3 and 8 (still wakinglink_workon control traffic or unexpected Alpha stage, withlink_worker()checking stage beforedrain()), and defers TX doorbells undernetdev_xmit_more().wifi: apple: centauri: t6050: take paged frames: enablesNETIF_F_SGsovalidate_xmit_skb()does not linearize paged skbs beforeskb_copy_bits()(leavesGSO_SOFTWARE/TSO off so frames stay within 2048-byte ring slots).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 (markingNO_320MHZwhereverNO_160MHZis set), and requires nonzero base RX/TX NSS.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 whileps_useris enabled, restores mode 0 after 2 s below 32 fps (retrying recoverable failures and restoring on reassociation), and fixes a pre-existingwifi_power_mgmt()/link_workunregister teardown race.Evidence
feat/centauri-t6050-dataplane-eht, headaf4467ebd9964on9c9e5f035baa2scripts/checkpatch.pl --strict --git 9c9e5f035baa2..af4467ebd9964: 0 errors, 0 warnings, 0 checks across all 5 commitsmake ARCH=arm64 LLVM=1 W=1(normal andAPPLE_CENTAURI_T6050_KUNIT_TEST=y): 0 warnings at every commitcentauri-scan-tests.pyPASS (9/9 negative controls rejected),centauri-wifi-pm-tests.pyPASS (14/14 negative controls rejected),centauri-wifi-avoid-tests.py4/4 PASS7.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: on192.168.0.1: 0% loss, min 1.15 ms, p50 1.71 ms, p95 2.44 ms, p99 2.58 ms, max 2.87 msspeed.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 indmesg