Skip to content

wifi: apple: centauri: add the AWDL interface (awdl0) - #3462

Draft
m0d16l14n1 wants to merge 11 commits into
aurora-silicon:mainfrom
m0d16l14n1:feat/centauri-awdl
Draft

m0d16l14n1 wants to merge 11 commits into
aurora-silicon:mainfrom
m0d16l14n1:feat/centauri-awdl

Conversation

@m0d16l14n1

@m0d16l14n1 m0d16l14n1 commented Nov 28, 2026 •

Copy link
Copy Markdown
Contributor

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 (base feat/centauri-keep-crash-record f8442a4900bf, 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 with awdl0 up: 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 with W=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). awdl0 exists 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=0 leaves 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):
    • Bringing awdl0 up 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.
    • Election: start as top master with own metric 65 and PSF periods 110/0. 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. Election, 0xfe00 and channel sequence TLVs go out at 19, 43 and 38 bytes, 0xff04 carries a (flags, channel) pair per slot, and the election and sync state are refreshed every 3.15 s.
    • Frame templates (election tree, data-path state, HT/VHT capabilities, hostname, version, service parameters) are appended to sync and master-indication frames.
    • Every peer heard is registered with the firmware. LLC/SNAP + AWDL data header are added or stripped when the firmware leaves that to the host, and RX is told apart from the station's by the interface ID in the completion footer.
    • debugfs awdl_status, awdl_peers, awdl_chanseq, awdl_arpa, awdl_service_tlvs.
  • docs: apple: centauri: document AWDL, add its host tests: the AWDL section of centauri.rst; tools/asahi/centauri-awdl-tests.py builds the AWDL helpers on the host, registered in run-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 wake awdl0 was up with no AWDL running. Start it again when awdl0 is still up, after the wake and on both refused-suspend paths; awdl_status counts 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: writing station to awdl_chanseq drops 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 diff of centauri_awdl.c between this head and the test branch shows only those switches. The modules were built by the J815 test kit and loaded into the running 7.3.0-aurora-j815-dev kernel, 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_status and the Mac's own log; addresses and names removed):

PASS awdl receive-x-maca [continued]: 2 file(s) received; rx_action +9091 rx_frames +1018 tx_mcbc +93 tx_unicast +800 ring_reuses +0 peer_holds +6102 rx_dropped +0
INFO awdl x-maca: requests by time: D+0 A+5 U+5 A+121 U+121
INFO awdl receive-x-maca: unicast ping <mac>: 674 of 675 answered; gaps over 1 s: none
INFO awdl receive-x-maca: TCP round trips: handshakes 3, median 5 ms, max 5 ms; data acks 18, median 5 ms, max 11 ms; sequence 149,149,149,149,149,149,149,149,6,149,149,149,149,149,149,149
INFO awdl receive-x-maca: peer sequences: 5 heard, 4 differ from ours; peer_seq_adds=127 peer_seq_differs=126
PASS regress: no N1 driver errors since the kit started
PASS regress: 0 failed units

On the Mac both sends went from Ask to the end of the upload in 0.13 s and 0.33 s.

Sleep with awdl0 up (four runs, 2026-11-28 and 2026-11-29); every one was a deep suspend (PM: suspend entry (deep)):

run suspended handshake after the wake file after the wake
143609 189.5 s sleep/wake ret=0 AWDL restarted 1x, resume_rc 0, station rejoined on 149, sequence followed only after a quiet pause (before the client's republish fix)
184943 48.4 s ret=0 restarted 1x, resume_rc 0 iPhone, PASS
194258 19.7 s ret=0 restarted 1x, resume_rc 0 Mac, PASS
141744 2.3 s ret=0 restarted 1x, resume_rc 0 iPhone, PASS

iPhone, 2026-11-28 (an earlier build of this branch, before the last three commits):

PASS awdl receive: 7 file(s) received; rx_action +776 rx_frames +108766 tx_mcbc +76 tx_unicast +20177 ring_reuses +0 rx_dropped +0
PASS awdl send: the iPhone took the file (Upload framed); rx_action +146 rx_frames +63 tx_mcbc +12 tx_unicast +65

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 centauri 22 of 22; centauri-awdl-tests.py PASS, --negative-controls 36 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.

…, 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]>
@m0d16l14n1

Copy link
Copy Markdown
Contributor Author

@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?

  1. Build feat/centauri-awdl (or apply this PR on main); apple_centauri should register awdl0 at probe.
  2. Get the client: https://github.com/m0d16l14n1/aurora-airdrop. Its README has the steps (udev rule, two sysctls, then receive and send as root).
  3. Receive: run the receiver and share a photo or file to the Linux Mac from the phone's AirDrop row. Send: with the phone's AirDrop sheet open, send a file with send --to-model iPhone and accept it on the phone.

Please report:

  • your Mac model and the kernel commit;
  • which direction worked, and what was sent (type and rough size, no file names);
  • awdl_status from debugfs after the transfer, with MAC addresses removed;
  • any firmware fault / recovery: lines in dmesg.

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]>
@sithglan

Copy link
Copy Markdown
Contributor

Tested both ways between a MacBook Air M5 (J813 / T8142) running apple_centauri from feat/centauri-awdl (18078270b6ff, built out-of-tree against 7.3.0-aurora-j813-main+ with apple_smc_warm_reset* stubbed) and a Linux MacBook Air M1 (J313, BCM4378 brcmfmac + omdrop-awdl) as the peer, using aurora-airdrop.

  • Station channel: J813 wlp1s0f0 associated on 5 GHz channel 40 (5200 MHz, country DE). Note: because channel 40 does not match (c - 36) % 8 == 0, cen_awdl_follow_station_chanseq() fell back to 6,0,149 instead of using channel 44 (or 36), leaving only 1/16 slot overlap with the DE ch 44/6 peer (~900 ms RTT). Writing 6,44,44 to awdl_chanseq dropped 1400 B ping6 RTT on awdl0 to ~4.3 ms.
  • Send (J813 -> peer): Worked cleanly (mDNS discovery, BLE wake, TLSv1.3 /Discover, /Ask, /Upload). Sent binary payloads of ~200 KB, ~2 MB (~7 s), and ~10 MB (~24 s); all arrived intact (SHA-256 verified, 9,660 unicast TX frames, comp=9660 fail=0 bad=0).
  • Receive (peer -> J813): ~200 KB binary payload arrived in <1 s and SHA-256 verified. Larger sends (2 MB, 10 MB) from the BCM4378 peer stalled mid-upload on the sender side (known BCM4378 TX caveat; J813 RX remained healthy with 4,652 frames, rx_dropped=0).
  • dmesg: No firmware fault or recovery: lines.

awdl_status after the transfers (MACs and host label redacted):

interface=awdl0 active=1 defaults_loaded=1 mac=<SELF_MAC> bssid=00:25:00:ff:94:73
sync_addr=<PEER_MAC> distance=1 top_master=<PEER_MAC> top_metric=100 self_metric=65
following=1 adoptions=1 reverts=0 follow_fails=0 follow_rc=0 bad_sync=0 no_time=0 rx_root_us=9 rx_timed=11531 rtap_len=96 rtap_present=4840006f rtap_fallbacks=0
refreshes=438 refresh_rc=0
master_channel=6 sync_state=0 max_peers=8 fw_llc_encap=0 extra_tlvs=150 arpa=<HOST> mif_tlvs=297 svc_tlvs=135 vht_ie=14 tlv_pushes=887
rx_frames=4652 rx_decap=4648 rx_dropped=0 rx_action=11531 rx_psf=11531 rx_mif=0 tx_mcbc=267 tx_unicast=9660 tx_encap=9927 tx_queued=0 auto_peers=43 ring_reuses=0 peer_holds=1746
events=26601 sync=24256 election=0 peer=2345 last_event=0x1c last_status=0 last_peer=<PEER_MAC> last_peer_state=0 rx_peer=<PEER_MAC> rx_metric=100 rx_chan=6
ring=26 role=mcbc peer=ff:ff:ff:ff:ff:ff sub=267 comp=267 fail=0 bad=0
ring=27 role=peer peer=<PEER_MAC> sub=9660 comp=9660 fail=0 bad=0

…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]>
@m0d16l14n1

Copy link
Copy Markdown
Contributor Author

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

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants