Repository navigation
wifi: brcmfmac: capability-gated LPAS associated sleep (v2, supersedes #1216) - #1218
Closed
RyanTheTide wants to merge 6 commits into
Closed
RyanTheTide wants to merge 6 commits into
RyanTheTide wants to merge 6 commits into
Conversation
The BCM4378 and BCM4387 on Apple Arm systems retain firmware across the existing D3 path, but their endpoint does not advertise standard D3hot PME. The platform has a separate wake route, so using PME as the firmware feature-probe gate prevents cfg80211 from ever keeping an association. Split transport retention from host wake routing, retain the standard PME test, and opt only the public Apple Arm BCM4378/4387 identities into the platform wake route. Require successful wowl and wowl_cap probes before advertising anything. Make WoWLAN setup transactional. Check each retained-state operation and unwind to cfg80211's ordinary disconnect fallback on failure. Restore the bus WoWLAN state on resume. Firmware without the public capability therefore keeps the previous behavior. Signed-off-by: Ryan Murray <[email protected]> Assisted-by: LLM
Replace the Apple machine quirk with wakeup-source permission and an allocated MSI. Keep the firmware capability gate and the ordinary PCI PME path. After the firmware host-sleep acknowledgment, arm the IRQ and keep the PCI function in D0 using pci_save_state(), so PCI PM also retains its upstream bridges. Limit this in-band route to s2idle. Account for an early interrupt before suspend_device_irqs(), and balance wake arming on resume, thaw, suspend failure and IRQ teardown. Use explicit enable_irq_wake() rather than automatic wakeirq arming so an arming failure can refuse suspend and restore the bus. The wiphy resume callback then clears the firmware policy on the PM unwind. Signed-off-by: Ryan Murray <[email protected]> Assisted-by: LLM
Track the wakeup source created for a DT-selected MSI separately from pre-existing PCI wake capability. On IRQ teardown, remove only the source we created and restore the original capability. Leave an already enabled source owned by the bus or platform intact. Signed-off-by: Ryan Murray <[email protected]> Assisted-by: LLM
Firmware with the lpas capability can retain an association without the standard wowl iovar. Advertise only the generic WoWLAN any trigger when retained transport and a wake route are both available. Save PM, ARP/ND, packet-filter, event-mask and link-event policy, install a minimal public unicast filter, and enable lpas last. Unwind every completed step on failure so cfg80211 can use its ordinary disconnect fallback. Restore the saved policy after the existing D0/HOSTREADY path and report an unspecified wake reason. Signed-off-by: Ryan Murray <[email protected]> Assisted-by: LLM
The LPAS branch of brcmf_cfg80211_resume() returned straight after restoring the firmware policy, so cfg->suspended stayed set. Country updates deferred across the sleep were then never applied and every later hint stayed pending. Fall through to the common tail instead: clear the suspended state, replay the deferred country update, then return the restore result. Signed-off-by: Ryan Murray <[email protected]> Assisted-by: LLM
Stub the in-band wake fields and helpers that brcmf_pcie_pm_enter_D3() and the LPAS resume path now use, and add an LPAS resume control: the restore runs with the bus up, the wake is reported, the suspended state clears and a country hint deferred across the sleep is applied, also when the restore fails. The lpas-resume mutation (early return) fails the control. Signed-off-by: Ryan Murray <[email protected]> Assisted-by: LLM
Contributor
Author
|
Re-run on the fixed head (3518415, LPAS resume clears the suspended state) on the M2, kernel 7.3.0-aurora-fleet35. Modules were built against dc8dd01 exactly, and the stock module was restored afterwards.
Leaving this as a draft. The default path (WoWLAN off) behaves the same as stock. The lid-close path will only gain once NetworkManager keeps a WoWLAN device associated across wake and the J413 DT gets a |
Contributor
Author
|
Superseded by #1232 (adds magic-packet WoWLAN, the J413/J415 wake route and the resume fix on current integration/aurora). |
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.
Supersedes #1216 (same series, rebased onto current integration/aurora; that branch conflicted).
What
brcmfmac keeps the Wi-Fi association across s2idle on firmware that has the
lpascapability but nowowliovar (BCM4387 on the M2 and the M1 Pro class machines returns -23 forwowl). Today cfg80211 disconnects on every suspend and the Mac needs ~4 s after resume to get back on the network.Commits (driver changes under
drivers/net/wireless/broadcom/brcm80211/brcmfmac/, plus the host-test harness):wakeup-source) in-band PCIe MSI for WoWLAN, s2idle only, balanced wake-IRQ handlingBRCMF_FEAT_LPASonly from the firmwarecaptokenlpas; save PM, ARP/ND, packet filter, event mask andnolinkup, install a minimal unicast filter, enablelpaslast; unwind on any failure so cfg80211 falls back to the normal disconnect; restore after D0/HOSTREADYWithout
lpasincap, or without retained transport and a wake route, nothing is advertised and behaviour is unchanged.Changes from #1216: conflict in
brcmf_pcie_pm_enter_D3()resolved against #1081 (WoWLAN refusal checks first, then the TX quiesce; the D3-ack timeout path keepsbrcmf_msgbuf_resume()); the two warning-only follow-ups are squashed into the LPAS commit (tree identical); the LPAS commit message had literal\nsequences, fixed.Firmware capability (M2, J413, BCM4387, fleet33)
Read with the brcmfmac nl80211 vendor DCMD (
capiovar, read-only):lpaspresent,wowlabsent;ndoe,arpoe,pktfltr2,tko,evt_extpresent. The M2's BCM4387 reports PME from D3hot, so the wake route is available without a DT change.Hardware receipts (M2 J413, 7.3.0-aurora-fleet33, 2026-11-08)
Test modules built against fleet33 exactly (009c878 + this branch's brcm80211 dir, fleet33 .config, fleet33 signing key), swapped in with a non-persistent bind mount and restored afterwards. Each row is 3 real
rtcwake -d rtc1 -m freeze -s 15cycles. Time is from resume to the first gateway ping reply.anyanyiw phy wowlan showadvertises only "wake up on anything".anyset and a 90 s RTC alarm, pings from another host from t+25 s did not wake the M2 (slept 92.6 s; association still kept). Its wake route is PCI PME only; the in-band MSI route needswakeup-sourceon the wifi node in the DT, which the J413 DT doesn't have yet.activated -> unmanaged, a locally generated deauth with reason 3), and then a full reconnect follows. That's why the NM row is slower, and the lid-close path (logind -> NM Sleep) won't benefit until NM keeps the device.Status: draft. The driver mechanism works. There's no gain on the default path (WoWLAN off) and no regression either. The user-visible gain needs the NM wake behaviour fixed plus the DT wake route. The fixed head (3518415 + harness) still has to be re-run on the M2.
Traces (lab): traces/wifi-bt/20261108-m2-lpas-s2idle, traces/wifi-bt/20261108-m2-fwcap.
🤖 Generated with Claude Code