Repository navigation
wifi: apple: centauri: add the AWDL interface (awdl0) - #3462
m0d16l14n1 wants to merge 11 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 <[email protected]>
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 <[email protected]>
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 <[email protected]>
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 <[email protected]>
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 <[email protected]>
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 <[email protected]>
|
@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 <[email protected]>
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 <[email protected]>
|
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 <[email protected]>
…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 <[email protected]>
…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 <[email protected]>
|
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 |
What: add
awdl0, the N1's peer-to-peer interface (AWDL), so AirDrop-style 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; the build that passed with a Mac registers peers this way (no single commit is shown to be what a Mac needed). 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 seven listed under Details. Draft until other N1 owners have tested it.Tested: J815 (MacBook Air 15" M5) with an iPhone and a MacBook Air (M4) as peers, modules built from this head's AWDL code plus #3207, #3459, #3461 and #2385 (see Evidence): PASS for iPhones and for Linux to Mac; Mac to Linux only partly (below). Mac to Linux: 2 of 2 files on 2026-11-30, each answered within 0.3 s, but with the kit pinging the Mac 5 times a second (674 of 675 answered). Without that ping (2026-12-01), the Mac's first connection, which shows the file, went through every time, and its second connection a few seconds later, when the file is dropped, did not: its SYNs were acknowledged over the air but never reached
awdl0, and the firmware's receive counters for the AWDL interface counted one duplicate per lost SYN copy (13 and 12, against 13 and 13 lost). That leg got 0 of 2 files; 3 more arrived in the sleep leg, two of them only on a late SYN copy, 7-20 s after the drop. An earlier run with the Mac capturing (2026-11-28) shows the same lost second connection; the other earlier misses were not captured well enough to tell. Linux to Mac: accepted (2026-11-28). iPhone to Linux and Linux to iPhone: PASS in the 2026-11-28 runs 143609 and 184943 and the 2026-11-29 run 141744 (7 files up to 140 MB, every size matched, on an earlier build of this branch). Sleep withawdl0up: 4 deep suspends (2 to 190 s), AWDL restarted after each wake (resume_rc 0), and a file arrived after the wake in 3 of them (the fourth predates a userspace fix). Host tests: 22 of 22 Centauri runs, among them the AWDL production run plus 36 negative controls, each caught; the driver builds withW=1, no warnings. Regression: 0 failed units, 0 N1 driver errors, 0 WARN/BUG/Oops in the last run (SELinux 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: other N1 boards (J813, J704 and others); Mac to Linux without steady unicast traffic between the two (above); a change that gives a peer idle for 4 s to the firmware afresh, as macOS does with idle peers, is being tested on the test branch and is not in this PR; more than one peer at a time; a station on a DFS or 6 GHz channel while AWDL runs; userspace other than the client used here; a sleep on this head without #2385 (the sleep runs had its Alpha sleep handshake). 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.Userspace used for the transfers: https://github.com/m0d16l14n1/aurora-airdrop (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: 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 runs, 2026-11-28 and 2026-11-29); 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-controls36 of 36 caught (among them 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.