Skip to content

wifi: brcmfmac: AWDL support (AirDrop link layer) for M1-M2 Macs - #24

Merged
RyanTheTide merged 7 commits into
aurora-silicon:aurora-wipfrom
brentkearney:feat/awdl-bcm4387-aurora
Oct 8, 2026
Merged

RyanTheTide merged 7 commits into
aurora-silicon:aurora-wipfrom
brentkearney:feat/awdl-bcm4387-aurora

Conversation

@brentkearney

@brentkearney brentkearney commented Sep 25, 2026 •

Copy link
Copy Markdown
Contributor

Adds AWDL (Apple Wireless Direct Link), the link layer Apple devices use to talk to each other directly, to brcmfmac, so AirDrop works natively on Macs whose Wi-Fi firmware implements it. The firmware does the AWDL work; these patches create the interface, route its frames, and stop the driver tearing it down.

Receiving is verified on all three Apple Broadcom chips, BCM4378, BCM4387 and BCM4388. Sending is verified only on the BCM4387, to both iPhone and Mac. See the tables below. Intel, MediaTek and Qualcomm cards can't do AWDL at all.

The series applies cleanly to aurora-wip at f9572b5. drivers/net/wireless/broadcom/brcm80211 there is the same git tree (637290c) as Asahi's asahi-7.1.13-2, where these patches were developed and tested, and as 2439016, the commit linux-aurora currently builds. The resulting driver is byte-for-byte the tested one. Once merged, it reaches users when linux-aurora in omarchy-pkgs moves to a commit that includes it; until then the Omdrop plugin keeps building the same patches as a DKMS module.

Userspace lives outside this tree: omdrop-awdl packages the root-side helpers, and omdrop-plugin is the Omarchy bar widget. Neither is needed to build or load the kernel side.

The module builds and loads on any brcmfmac card. On firmware that doesn't implement AWDL, the failure comes at interface creation. Recovering from wedged firmware means unloading brcmfmac, which drops Wi-Fi until it reloads, so test on a machine you can afford to take off the network.

What the patches do

Patch What it does
0001 Creates an AWDL interface: the firmware accepts BRCMF_INTERFACE_TYPE_AWDL.
0002 Adds AWDL-specific netdev ops for awdl0.
0003 Returns firmware error codes from the vendor command, instead of flattening them.
0004 Creates the interface with no BSSID and no requested index, which is what the firmware wants.
0005 Stops the P2P path tearing down the AWDL netdev.
0007 Translates AWDL data frames at the awdl0 boundary.
0008 Tolerates a txstatus for a freed flowring, rather than dereferencing it.

Numbering follows the source series. 0006 and 0009–0012 are debug instrumentation and stay out of this PR; they're in omdrop-awdl for anyone bringing up another chip.

Before you test

Set the Apple device to Everyone. On an iPhone or iPad: Settings → General → AirDrop → Everyone for 10 Minutes. On a Mac: the AirDrop window in Finder → Allow me to be discovered by: Everyone.

A device in Contacts Only mode accepts files only from its owner's contacts, and answers name lookups only from them. To be one of those contacts, your Omarchy install needs an Apple-issued AirDrop identity: the certificate, private key and Apple ID validation record from a Mac signed into your Apple Account. Omdrop doesn't extract these for you. Without them, test in Everyone mode; Contacts Only has been verified only on the BCM4387 with an identity extracted by disabling System Integrity Protection, attaching Frida to sharingd in MacOS, and monitoring an Airdrop exchange. No tool is published for this procedure, yet.

Check that it came up

Each check shows that the layer beneath it worked. The first two need only this series; the last two use omdrop from omdrop-awdl.

Check Meaning
ip link show awdl0 The firmware accepted the interface-creation request.
ip -6 addr show awdl0 shows a link-local address The netdev is up and addressable.
A peer appears in omdrop peers The firmware is tracking nearby Apple devices.
omdrop peers -n returns a name A full TLS /Discover round trip completed over AWDL.

If it doesn't come up

  • No awdl0 after the vendor command: the firmware didn't accept BRCMF_INTERFACE_TYPE_AWDL. Report the device ID and the firmware error.
  • awdl0 exists but has no link-local address: usually NetworkManager is managing it, which leaves its IPv6 address generation off. nmcli device status shows it as anything other than unmanaged. Keep it unmanaged with unmanaged-devices=interface-name:awdl0 in a NetworkManager.conf.d file, then run nmcli general reload conf. NetworkManager reads that folder only at startup or on a reload (omdrop-awdl#15).
  • awdl0 exists but no peers appear: the firmware isn't tracking neighbours. Check that the other device is advertising: a Mac does while its AirDrop window is open, an iPhone in short bursts.
  • Peers appear but have no name, or nothing connects: first check that the Apple device is set to Everyone (see Before you test). Otherwise it's usually the firewall: the receiver needs TCP 8771 on awdl0 from IPv6 link-local addresses.
  • Wi-Fi drops when the interface is created: the firmware wedged. Reload brcmfmac; a reboot always clears it.

Hardware compatibility

Find your Wi-Fi chip with lspci -nn | grep -i network. BCM4378 is 14e4:4425, BCM4387 is 14e4:4433, and BCM4388 is 14e4:4434.

Known to work

Mac Wi-Fi chip WLAN PCI ID Verified Report
MacBook Pro 16-inch (2021), M1 Pro BCM4387 14e4:4433 Sending and receiving, iPhone and Mac, Everyone and Contacts Only
MacBook Air (2020), M1 BCM4378 14e4:4425 Receiving from an iPhone, Everyone omdrop-plugin#12
MacBook Pro 16-inch (2023), M2 Pro BCM4388 14e4:4434 Receiving from an iPhone, Everyone omdrop-awdl#16
MacBook Air 13-inch (2022), M2 BCM4387 14e4:4433 Receiving from a Mac omdrop-plugin#17

Probably works

Same Wi-Fi chips as the Macs above, not yet reported:

Mac Apple chip Wi-Fi chip
MacBook Pro 14-inch (2021) M1 Pro, M1 Max BCM4387
MacBook Pro 16-inch (2021) M1 Max BCM4387
Mac Studio (2022) M1 Max, M1 Ultra BCM4387
MacBook Air 15-inch (2023) M2 BCM4387
MacBook Pro 13-inch (2020) M1 BCM4378
Mac mini (2020) M1 BCM4378
iMac 24-inch (2021) M1 BCM4378
MacBook Pro 13-inch (2022) M2 BCM4378
MacBook Pro 14-inch (2023) M2 Pro, M2 Max BCM4388
MacBook Pro 16-inch (2023) M2 Max BCM4388
Mac mini (2023) M2, M2 Pro BCM4388
Mac Studio (2023) M2 Max, M2 Ultra BCM4388
Mac Pro (2023) M2 Ultra BCM4388, reported; Asahi's device tree is inconsistent for this model

Sources: the Asahi device list, Asahi's WLAN PCI IDs, and an Apple device-tree radio inventory. Don't infer the Wi-Fi chip from the Apple processor alone.

Tried it on another Mac? Send a hardware report, working or not. Tested-by: from any Mac, and above all sending from a BCM4378 or BCM4388, is the most useful thing anyone can add.

Checks

On this branch, rebased onto aurora-wip at f9572b5:

  • scripts/checkpatch.pl --strict -g reports 0 errors, 0 warnings and 0 checks across all seven commits.
  • brcm80211 builds without warnings with the linux-aurora config from omarchy-pkgs (7.1.12), and modpost resolves every symbol against linux-aurora-headers 7.1.12.aurora2.

Contributing

Patch iteration, the userspace helpers, and the instrumentation left out of this series live in omdrop-awdl. Its CONTRIBUTING.md explains how to send a kernel change so your authorship carries into this series.

@brentkearney brentkearney changed the title wifi: brcmfmac: AWDL support for the BCM4387 (AirDrop link layer) wifi: brcmfmac: AWDL support (AirDrop link layer) for M1-M2 Macs Oct 1, 2026
BCM4387 firmware implements AWDL (Apple Wireless Direct Link) and accepts
BRCMF_INTERFACE_TYPE_AWDL through interface_create, but nl80211 has no AWDL
iftype, so the interface cannot be created via add_virtual_intf(). Drive it
from a vendor command instead.

Creation is asynchronous, and has to be. nl80211 dispatches vendor commands
holding the wiphy mutex: NL80211_CMD_VENDOR sets NL80211_FLAG_NEED_WIPHY
without NL80211_FLAG_NO_WIPHY_MTX, unlike NL80211_CMD_NEW_INTERFACE which
sets NEED_RTNL | NO_WIPHY_MTX and takes the wiphy mutex itself, in that
order. Registering a netdev from the vendor command therefore deadlocks:

  nl80211_vendor_cmd                    <- holds wiphy mutex
   brcmf_awdl_add_vif
    brcmf_net_attach
     register_netdev                    <- takes RTNL
      register_netdevice
       call_netdevice_notifiers_info
        cfg80211_netdev_notifier_call
         mutex_lock                     <- wiphy mutex, already held

The task blocks in uninterruptible sleep while holding the RTNL, which
takes
down every netdev operation on the system; recovery needs a reboot. Using
cfg80211_register_netdevice() instead is not a fix either: it requires both
the RTNL and the wiphy mutex, and the vendor command holds only the latter,
so it trips ASSERT_RTNL and registers into an inconsistent state. Taking
the
RTNL explicitly would invert cfg80211's RTNL-then-wiphy order.

So brcmf_awdl_add_vif() only asks firmware for the interface and returns.
The netdev is registered later by brcmf_cfg80211_awdl_attach_pending(),
called from the fweh event worker, which runs on the system workqueue
holding neither lock. The vif event stays armed across the request because
brcmf_notify_vif_event() is what links the brcmf_if to the vif; without it
ndev->ieee80211_ptr is never set and cfg80211 ignores the netdev.

Userspace must wait for awdl0 to appear rather than assume the vendor
command created it.

Signed-off-by: Brent Kearney <[email protected]>
Bringing an AWDL interface up through brcmf_netdev_open() stops the
firmware
answering dcmds. Every subsequent command times out with -EIO, the
infrastructure STA link drops with it, and only a brcmfmac reload recovers
the device.

The standard open path runs station bring-up against the interface: a
toe_ol
iovar query, brcmf_cfg80211_up(), and then the multicast and promisc
configuration that ndo_set_rx_mode schedules via
_brcmf_set_multicast_list().
An AWDL bsscfg is not a station, and issuing that sequence against one
wedges
the firmware control path.

Give AWDL interfaces their own net_device_ops. brcmf_netdev_open_awdl()
checks the bus is up, clears the 802.1x pending count, and leaves the
carrier
off, touching no firmware state. ndo_set_rx_mode is omitted entirely so the
multicast worker never runs for these interfaces, and ndo_stop skips
brcmf_cfg80211_down() for the same reason the open path skips
brcmf_cfg80211_up().

awdl0 now comes up with the firmware still responsive and the STA link
undisturbed.

Signed-off-by: Brent Kearney <[email protected]>
brcmf_fil_cmd_data() collapses every firmware failure to -EBADE unless
ifp->fwil_fwerr is set, so a userspace probe driving iovars through the
Broadcom vendor dcmd passthrough cannot tell "no such iovar" from "bad
argument" from "not up". Set fwil_fwerr around the call and log the raw
BCME_* value.

This makes the passthrough usable for firmware exploration: the same probe
that previously reported EBADE for every failure now distinguishes
BCME_BADOPTION, BCME_BUFTOOSHORT, BCME_NOTFOUND and BCME_NOTREADY.

Signed-off-by: Brent Kearney <[email protected]>
brcmf_cfg80211_request_awdl_if() sent interface_create with MAC_USE
alone: no BSSID and no requested interface index. On BCM4387 that
yields an interface whose AWDL iovars stay unusable.

Send flags 0x1a (MAC_USE | IF_INDEX_USE | BSSID_USE) with an explicit
BSSID and if_index 2 instead. Firmware behaviour changes with those
arguments: the interface is created at the requested index (wl0.2),
awdl_peer_op returns data instead of BCME_NOMEM, and awdl_af_hdr,
awdl_config and awdl_af_rssi are accepted where they previously were
not.

The three values are module parameters so they can be swept without
rebuilding. Derive a MAC when the caller passes NULL rather than
sending MAC_USE with an all-zero address.

Signed-off-by: Brent Kearney <[email protected]>
nl80211 calls vendor commands holding the wiphy mutex and not the RTNL
(NL80211_CMD_VENDOR sets NEED_WIPHY without NO_WIPHY_MTX). Calling
brcmf_remove_interface() from brcmf_awdl_del_vif() therefore reaches
cfg80211_close_dependents(), which asserts the RTNL:

  RTNL: assertion failed at net/wireless/core.c (419)
   cfg80211_close_dependents
   brcmf_remove_interface
   brcmf_awdl_del_vif
   brcmf_cfg80211_vndr_cmds_awdl_handler

and then deadlocks the netdev layer against any concurrent RTNL holder,
leaving NetworkManager and ip(8) unkillable in D state.

Ask the firmware to drop the BSS and return. The BRCMF_E_IF_DEL event
lands in brcmf_fweh_event_worker(), a plain work item holding neither
lock, and brcmf_fweh_handle_if_event() removes the interface from there.
This mirrors brcmf_awdl_add_vif(), which defers brcmf_net_attach() to the
same worker for the same reason.

Signed-off-by: Brent Kearney <[email protected]>
AWDL data frames on the air are 802.3 + LLC/SNAP (OUI 00:17:f2, protocol
0x0800) + a 6-byte data header (03 04 <seq16> 00 00) + the real ethertype.
The kernel only speaks Ethernet II, so for is_awdl interfaces:

- RX: brcmf_rx_eth_type_trans() strips the encapsulation in place before
  eth_type_trans(). It is called from both delivery paths --
  brcmf_rx_hdrpull
  (BCDC) and the msgbuf RX completion (PCIe); a first attempt in hdrpull
  alone was dead code on PCIe. Frames that are already Ethernet II pass.
- TX: brcmf_awdl_encap() wraps Ethernet II in the same header with a
  per-interface incrementing sequence; needed_headroom grows by 16. Frames
  that already carry a length field (raw AF_PACKET senders building the
  encapsulation themselves) pass untouched.

Also log the destination MAC on each awdl0 TX completion so per-frame fates
can be read per peer (unicast to a MAC without a firmware peer entry
completes 0x0003 FW_TOSSED; with one, 0x0000 acked).

With this, EUI-64 neighbour pinning and awdl_peer_op ADD, a remote peer
completes TCP to us over firmware-native AWDL.

Signed-off-by: Brent Kearney <[email protected]>
brcmf_msgbuf_delete_flowring() gives up on outstanding frames after ~75 ms
and frees the ring; the firmware then completes them (tx_status 0x0006
EXPIRED) against a flow->rings[] slot that is already NULL. The awdl
txstatus log line dereferenced it (oops in
brcmf_flowring_ifidx_get from brcmf_msgbuf_process_rx on awdl-if destroy).
Look the ring up only if it still exists, and reject a flowring id beyond
max_flowrings before indexing.

Signed-off-by: Brent Kearney <[email protected]>
@brentkearney
brentkearney force-pushed the feat/awdl-bcm4387-aurora branch from e506f77 to d2a7ae4 Compare October 7, 2026 19:06
@RyanTheTide
RyanTheTide merged commit 6c00439 into aurora-silicon:aurora-wip Oct 8, 2026
RyanTheTide added a commit that referenced this pull request Oct 8, 2026
Preserve the original review commits and retain subsequent published repairs where superseded.

Assisted-by: LLM
Signed-off-by: Ryan Murray <[email protected]>
RyanTheTide added a commit that referenced this pull request Oct 8, 2026
[follow-up to #24] wifi: brcmfmac: bound AWDL creation and validate its data path

Original contributor commits are preserved. Conflict resolutions retain the audited shared driver APIs and their integrated review fixes.

Assisted-by: LLM
Signed-off-by: Ryan Murray <[email protected]>
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