Repository navigation
wifi: apple: centauri: add the AWDL interface (awdl0) - #3462
m0d16l14n1 wants to merge 12 commits into
Conversation
…, and data path Add full station telemetry, channel survey, band capability reporting, ethtool firmware version reporting, and data-path improvements: - Parse firmware statistics reports using packed wire structures with compile-time layout checks: TX retries/failures and live RX/TX bitrates (TLV 0xf901), beacon RX/loss (TLV 0xf915), TX power and rate history (TLV 0xf920), per-chain RSSI and noise floor (TLV 0xf923), station noise (TLV 0xf908), and CCA channel survey (TLV 0xf903). - Populate wiphy->fw_version from firmware version query and wire ethtool_ops.get_drvinfo = cfg80211_get_drvinfo on both T8142/T8152 and T6050 Wi-Fi netdevs so ethtool -i reports the running firmware version. - Populate HT, VHT, and 2.4/5/6 GHz HE band capabilities, decode disconnect reason codes, apply initial firmware regulatory country hint, and avoid restricting channel widths absent from 20 MHz-only lists. - Add NAPI GRO receive processing, TX in-flight cap with bypass watchdog, and TCP pacing shift; add Centauri driver documentation. Signed-off-by: Nick <nekreshen@yandex.ru>
The firmware reserves a crash region in its secondary memory, which debugfs firmware_crash reads. A restart after a firmware fault frees that memory before anyone can read it, so the region of the firmware that stopped is lost and the fault leaves no record of its own. Copy the region before the restart frees anything and expose the copy as debugfs firmware_crash_saved. The restart log says how large it was and whether it held anything. Signed-off-by: Nick <nekreshen@yandex.ru>
Alpha can leave execution stage 2 without raising a fault interrupt. The link worker then only reported a disconnect and the scan worker an aborted scan, and Wi-Fi stayed down until the module was reloaded. When either worker finds Alpha out of stage 2 while the transport is neither stopping nor paused, request the firmware restart. Signed-off-by: Nick <nekreshen@yandex.ru>
The firmware faults seen on the J815 leave nothing to read: the crash region in secondary memory is all zero after an Alpha stop, and the restart frees the Alpha DRAM log, the only record the firmware keeps of what it did last, together with the rest of the IPC buffers. When fwlog_start set the log up, copy it before the restart frees it and expose the copy as debugfs firmware_log_saved; the restart log gives its size and the consumer and producer indices. Log the Alpha execution stage value seen when the stop is detected, which the fault message did not give. Signed-off-by: Nick <nekreshen@yandex.ru>
The N1 firmware runs Apple Wireless Direct Link on its interface 1. Register awdl0 as an Ethernet device on it, so AirDrop-style peer to peer links to phones and Macs nearby can run from Linux userspace. Bringing awdl0 up opens the data rings interface 1 needs next to the shared ones (18 for receive completions, 78 for transmit completions, 79 for type 7 events), reads the firmware defaults, sets the address and starts the interface. The values the host sends, the TLV layouts and lengths and the order of the commands are the ones traced on a working link and captured over the air: - start as top master with own metric 65, PSF periods 110/0 and an empty general configuration TLV; follow a peer whose election beats ours, with its timing from the frame that announced it, and become top master again 5 s after the parent goes quiet; - send the election, 0xfe00 and channel sequence TLVs at 19, 43 and 38 bytes, and 0xff04 with a (flags, channel) pair per slot; - re-send the election and sync state every 3.15 s; - append the frame templates nearby peers send (election tree, data-path state, HT/VHT capabilities, hostname, version, service parameters) to sync and master-indication frames; - take the channel sequence from the station channel (6 plus the lower channel of a 5 GHz 40 MHz pair, else 6 and 149), 5 GHz slots in the 80 MHz operating class; - register every peer heard with the firmware, open one unicast TX ring (a second one faulted the firmware), and add or strip the LLC/SNAP + AWDL data header when the firmware leaves it to the host. Received data is told apart from the station's by the interface ID in the completion footer. debugfs awdl_status, awdl_peers, awdl_chanseq, awdl_arpa and awdl_service_tlvs show the state and let userspace set the channel sequence, hostname and service responses. Module parameter awdl_enable=0 leaves the interface out (default 1). Signed-off-by: Nick <nekreshen@yandex.ru>
Describe what awdl0 sends and expects in the Centauri driver document and add tools/asahi/centauri-awdl-tests.py: host builds of the AWDL helpers (channel encoding and sequences, frame encapsulation, start payload, sync parameters, frame templates, action frame and radiotap parsing, parent choice and timing, peer re-add hold) with 32 negative controls that each break one rule and must be caught. Signed-off-by: Nick <nekreshen@yandex.ru>
|
@sithglan @gig3m, and anyone else with an N1 Mac (J813, J815, J704 or another T8142/T8152 board) and an iPhone or a Mac nearby: could you test AirDrop both ways on this branch?
Please report:
A Mac as the peer, other boards, and a station on a DFS or 6 GHz channel are the parts with no result yet. On the J815 a 140 MB file arrived in about 26 s. |
A sleep with the Alpha sleep handshake stops AWDL in the firmware first, but nothing started it again: after the wake awdl0 stayed up with no AWDL running, and every frame sent to it was dropped until userspace took the interface down and up. A suspend refused by the -EBUSY check or by the firmware left it the same way, and no resume callback follows those. Start AWDL again when awdl0 is still up, after the wake and on both refused paths, and count the restarts in awdl_status. The start pushes the stored hostname, service TLVs and a debugfs channel sequence again. Signed-off-by: Nick <nekreshen@yandex.ru>
The AWDL channel sequence is taken from the station when awdl0 comes up. After a wake AWDL starts again before the station has rejoined, so it falls back to channels 6 and 149; a station that then joins on another 5 GHz channel leaves the radio splitting its time over three channels. When the station joins while AWDL runs and no channel sequence was set through debugfs, follow the station again and push the new sequence if it changed; awdl_status counts these. The host test covers the decision, with a negative control that ignores the join. Signed-off-by: Nick <nekreshen@yandex.ru>
|
Tested both ways between a MacBook Air M5 (J813 / T8142) running
|
…equence Every peer was given to the firmware peer cache with our own channel sequence. A peer whose sequence differs (a Mac that is idle advertises its 5 GHz channel in slots 0-2 and 9-10 and channel 6 in slot 8) was registered with slots in which it is on another channel. In that state a Mac's frames reached us while ours did not reach it. Parse the channel sequence TLV (0x12, encoding 3: a channel and an operating class per slot, idle slots allowed) from each peer's action frames, keep it for the last 16 peers heard, and register a peer with its own sequence; ours stands in only until one is heard. awdl_status counts the peers added with their own sequence and how many of those differ from ours; awdl_peers lists each advertised sequence. The host test parses a captured sequence with idle slots, with negative controls that drop the sequence or reject idle slots. Signed-off-by: Nick <nekreshen@yandex.ru>
…lot 8 With the station on the lower channel of a 5 GHz 40 MHz pair, the AWDL channel sequence was 4-slot blocks of channel 6 and that channel (6 6 6 6 c c c c 6 6 6 6 c c c c). The sequences Apple peers advertise when idle have that channel in slots 0-2 and 9-10 and channel 6 in slot 8, so the only slot both sides spend on the same channel is slot 8. In such sessions peers fetched /Discover, and their next connection came late or not at all. Use the sequence the traced host also sends with a station on such a channel: that channel in every slot but slot 8, which stays on channel 6. The firmware takes 0xff12 and 0xff04 per slot, so nothing else changes. Writing awdl_chanseq (e.g. "6,149,149") still gives the 4-slot blocks. Signed-off-by: Nick <nekreshen@yandex.ru>
…ence A write to the awdl_chanseq debugfs file fixes the channel sequence until the module is reloaded. Accept "station" to drop that and follow the station's channel again, so a test can compare a written sequence with the default and then return to it without a reload. Signed-off-by: Nick <nekreshen@yandex.ru>
|
tested with send/receive with iPhone and Macbook Air 13 M4 (macOS, Tahoe) - working both ways, deep sleep is seems to be working also + send/receive after sleep |
A Mac sending to awdl0 opens one connection to show its file, then a second one when the file is dropped, a few seconds later. The second connection's SYNs were acknowledged over the air but never reached awdl0: the firmware's receive counters for the AWDL interface counted them as duplicate MPDUs, one per lost SYN copy (13 and 12 against 13 and 13), and counted no duplicates in between. The Mac gave up after 13 copies in ~20 s, or got through on a late copy. With unicast traffic kept flowing between the two (a ping every 200 ms) every send went through. The firmware seems to keep a peer's receive state while the peer stays in its cache, and the driver never takes a peer out of it. Take an idle peer out and put it back before its next flow: note unicast data to and from each peer, and when a peer has had none for 4 s, delete it and add it back at once with its own channel sequence, so the next frames meet a fresh entry. A peer is reset once per pause. Its TX ring closes with it and opens again on the next unicast frame to it. awdl_status counts the resets, and among them those of the peer we synchronize to. The host tests cover the per-peer bookkeeping. Signed-off-by: Nick <nekreshen@yandex.ru>
|
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: FINISH at 8dd296a
Failure: Suspend can tear down an active AWDL session even when Wi-Fi refuses the suspend. In centauri_wifi_suspend(), with the existing sleep handshake enabled, wifi->connected true and awdl0 active, centauri_awdl_suspend() runs before the -EBUSY preflight. It closes the rings and clears peer state. The subsequent restart leaves the system awake but restores a fresh interface, losing the existing AWDL session. Keep AWDL intact when the preflight refuses sleep.
Failure: The advertised J815 resume path is unreachable in the exact patch stack. Both Wi-Fi PM callbacks return before reaching the new AWDL hooks when machine compatibility is apple,j815. The reported J815 run used another stack with the Alpha handshake. Align the stated resume scope and the integration so the supported path and evidence refer to the same code.
Checked: The existing AWDL production host test passed at this head. I compared the eight feature commits to their stated parent so inherited station changes were excluded.
Follow-ups: Please split the interface implementation and its PM integration into independently reviewable changes. The patch is already organized into commits that provide a starting point.
What: add
awdl0, the N1's peer-to-peer interface (AWDL), so AirDrop-like transfers to and from iPhones and Macs nearby can run from Linux userspace. The firmware runs AWDL on its interface 1. The driver opens that interface's rings, configures and starts it, joins the peers' election and channel sequence, and carries data frames as an Ethernet device. It also starts AWDL again after a sleep, follows the station's channel, and registers each peer with the channel sequence that peer advertises, and hands a peer that has been idle for 4 s back to the firmware afresh, after which a Mac's later connections were no longer lost in our runs. Values, TLV layouts and command order are the ones seen in our own traces of a working link and in over-the-air captures. Stacked on #3460 (basefeat/centauri-keep-crash-recordf8442a4900bf, on #3458), because a firmware fault while bringing AWDL up needs that restart path. This PR's own commits are the eight listed under Details.Tested: J815 (MacBook Air 15" M5) with an iPhone and a MacBook Air (M4) as peers, all four directions:
awdl0up: 5 deep suspends (2 to 190 s). AWDL restarted after each wake (resume_rc 0), and a file arrived after the wake in 4 of them; the fifth predates a userspace fix. On 2026-12-02, files from the Mac and the iPhone arrived both before and after a 30.7 s sleep.Host tests:
run-host-tests.py --only centauri22 of 22.centauri-awdl-tests.pyPASS, and 39 of 39 negative controls caught, 3 of them for the idle peer reset (a peer due on every poll, traffic ignored, an active peer evicted). The driver builds at this head withW=1and no warnings;checkpatch --strictclean. Regression (2026-12-02): 0 failed units, 0 N1 driver errors, 0 WARN/BUG/Oops. SELinux is not built on this image.Risk: two-way door; N1 boards on the shared transport (J813, J815 and the other T8142/T8152 boards).
awdl0exists from probe and stays down until something brings it up. NetworkManager sees it as an Ethernet port and may bring it up unless told not to (the client below ships a udev rule that marks it unmanaged). The station link shares the radio and stayed up in every run.apple_centauri.awdl_enable=0leaves the interface out.Not yet:
There is one unicast TX ring in total, shared by all peers, because opening a second one has faulted the firmware. One firmware fault in the runs since 2026-11-28 (mid-session, 2026-11-28) was recovered by #3460's restart; its cause is not known yet.
Details
Commits of this PR (on top of #3460):
wifi: apple: centauri: add the AWDL interface (awdl0):awdl0up opens interface 1's data rings in the traced order next to the shared ones (18 RX completions, 78 TX completions, 79 type 7 events). It then reads the firmware defaults, sets the address and starts the interface.awdl_status,awdl_peers,awdl_chanseq,awdl_arpa,awdl_service_tlvs.docs: apple: centauri: document AWDL, add its host tests: the AWDL section ofcentauri.rst;tools/asahi/centauri-awdl-tests.pybuilds the AWDL helpers on the host, registered inrun-host-tests.py.wifi: apple: centauri: restart AWDL after a sleep: the sleep handshake stops AWDL in the firmware and nothing started it again, so after a wakeawdl0was up with no AWDL running. Start it again whenawdl0is still up, after the wake and on both refused-suspend paths;awdl_statuscounts the restarts.wifi: apple: centauri: move AWDL to the station's channel when it joins: after a wake AWDL starts before the station rejoins and falls back to channels 6 and 149. When the station joins, follow its channel and push the new sequence (unless one was written through debugfs).wifi: apple: centauri: register each AWDL peer with its own channel sequence: peers were registered with our sequence. A Mac that is idle advertises its 5 GHz channel in slots 0-2 and 9-10 and channel 6 in slot 8; registered with ours, its frames reached us while ours did not reach it. Parse each peer's channel sequence TLV (0x12, channel and operating class per slot, idle slots allowed), keep it for the last 16 peers, and register the peer with it.wifi: apple: centauri: keep AWDL on the station's 5 GHz channel but slot 8: with the station on 5 GHz the sequence was 4-slot blocks of 6 and that channel, which shares only slot 8 with an idle peer. Use that channel in every slot but slot 8, which stays on channel 6.wifi: apple: centauri: let awdl_chanseq go back to the station's sequence: writingstationtoawdl_chanseqdrops a written sequence without a module reload.wifi: apple: centauri: give an idle AWDL peer to the firmware afresh: a Mac opens a second connection when the file is dropped, and its SYNs were acknowledged over the air but never reachedawdl0. The firmware counted them as duplicates, one per lost copy. The driver now notes unicast data to and from each peer. When a peer has had none for 4 s, the driver deletes it and adds it back at once with its own channel sequence, once per pause.awdl_statuscounts these resets.Userspace used for the transfers: https://github.com/m0d16l14n1/aurora-awdl (BLE wake, mDNS on
awdl0, HTTPS on the link-local address); its README has the test steps for an iPhone and a Mac.Evidence
Tested tree, 2026-12-02: the J815 nightly
7.3.0-aurora-j815-dev(built in Docker, clang 19). Its N1 code ismainfdad0c5804d8with this PR's first seven commits (7e722b3ea360, with #3460) merged and the last commit picked on top behind a test switch. On top of that are test-only switches (an RX ring left out: off; stop/start variants: 0, both this head's behaviour), a switch for the idle peer reset (on is this head; off for the first Mac to Linux leg, on for the leg after it and the sleep), a per-interface counter selector, and station commits outside the AWDL code (an RSSI threshold monitor, #3921). The idle peer reset in this head is the tested one without its switch (always on). No centauri or Bluetooth words were on the command line; the station was on 5 GHz channel 149. The Mac's side comes from its own capture onawdl0and its transfer log, taken during the run.Hardware rows, 2026-12-02 (run 131914):
resume_rc 0, station rejoined on 149The kit's "no /Ask after the drop" lines in that run are a timing artifact of the test script: the tester pressed Enter a few seconds after the drop, after the Mac's /Ask had already arrived. A Mac connection attempt made while
awdl0was being restarted between legs is not counted.Earlier tested tree (2026-11-28 to 2026-12-01): the J815 N1 test branch at
f6add1dd4c18, with a debugfs selector for the firmware's per-interface counters. It is this head's AWDL code plus #3207, #3459, #3461 and #2385 (with #3136, for the Alpha sleep handshake), plus test switches left at the values this head now has as code: each peer registered with its own sequence (on), the stop/start variants (off), restart on station join (off), a fault-injection switch (off).git diffofcentauri_awdl.cbetween this head and the test branch shows only those switches. The modules were built by the J815 test kit and loaded into the running7.3.0-aurora-j815-devkernel, with no centauri or Bluetooth words on the command line. Station on 5 GHz during every run.Linux to Mac, 2026-11-28 run 143609 on the tested tree:
PASS awdl send-mac: the Mac took the file (Upload framed).Mac to Linux, 2026-11-30 (
awdl_statusand the Mac's own log; addresses and names removed):On the Mac both sends went from Ask to the end of the upload in 0.13 s and 0.33 s.
Sleep with
awdl0up (four earlier runs, 2026-11-28 and 2026-11-29, plus the 2026-12-02 one above); every one was a deep suspend (PM: suspend entry (deep)):resume_rc 0, station rejoined on 149, sequence followedresume_rc 0resume_rc 0resume_rc 0iPhone, 2026-11-28 (an earlier build of this branch, before the last three commits):
The same iPhone receive and send steps passed again on the tested tree on 2026-11-28 and 2026-11-29.
Host tests at this head:
run-host-tests.py --only centauri22 of 22;centauri-awdl-tests.pyPASS,--negative-controls39 of 39 caught (among them an idle peer whose traffic is ignored and an active peer evicted, a peer sequence that is ignored, idle slots rejected, the station sequence ignored or built as 4-slot blocks, a station join ignored).make W=1 drivers/net/wireless/apple/centauri/(clang, arm64): no warnings.