Repository navigation
wifi: brcmfmac: AWDL support (AirDrop link layer) for M1-M2 Macs - #24
Merged
RyanTheTide merged 7 commits intoOct 8, 2026
Merged
RyanTheTide merged 7 commits into
RyanTheTide merged 7 commits into
Conversation
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
force-pushed
the
feat/awdl-bcm4387-aurora
branch
from
October 7, 2026 19:06
e506f77 to
d2a7ae4
Compare
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]>
This was referenced Oct 9, 2026
This was referenced Nov 8, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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-wipatf9572b5.drivers/net/wireless/broadcom/brcm80211there is the same git tree (637290c) as Asahi'sasahi-7.1.13-2, where these patches were developed and tested, and as2439016, the commitlinux-auroracurrently builds. The resulting driver is byte-for-byte the tested one. Once merged, it reaches users whenlinux-aurorain 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
brcmfmaccard. On firmware that doesn't implement AWDL, the failure comes at interface creation. Recovering from wedged firmware means unloadingbrcmfmac, which drops Wi-Fi until it reloads, so test on a machine you can afford to take off the network.What the patches do
BRCMF_INTERFACE_TYPE_AWDL.awdl0.awdl0boundary.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
Fridatosharingdin 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
omdropfrom omdrop-awdl.ip link show awdl0ip -6 addr show awdl0shows a link-local addressomdrop peersomdrop peers -nreturns a name/Discoverround trip completed over AWDL.If it doesn't come up
awdl0after the vendor command: the firmware didn't acceptBRCMF_INTERFACE_TYPE_AWDL. Report the device ID and the firmware error.awdl0exists but has no link-local address: usually NetworkManager is managing it, which leaves its IPv6 address generation off.nmcli device statusshows it as anything other thanunmanaged. Keep it unmanaged withunmanaged-devices=interface-name:awdl0in aNetworkManager.conf.dfile, then runnmcli general reload conf. NetworkManager reads that folder only at startup or on a reload (omdrop-awdl#15).awdl0exists 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.awdl0from IPv6 link-local addresses.brcmfmac; a reboot always clears it.Hardware compatibility
Find your Wi-Fi chip with
lspci -nn | grep -i network. BCM4378 is14e4:4425, BCM4387 is14e4:4433, and BCM4388 is14e4:4434.Known to work
14e4:443314e4:442514e4:443414e4:4433Probably works
Same Wi-Fi chips as the Macs above, not yet reported:
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-wipatf9572b5:scripts/checkpatch.pl --strict -greports 0 errors, 0 warnings and 0 checks across all seven commits.brcm80211builds without warnings with thelinux-auroraconfig from omarchy-pkgs (7.1.12), and modpost resolves every symbol againstlinux-aurora-headers7.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.