Repository navigation
wifi: apple: centauri: keep the association through a deep sleep (WoWLAN) - #3921
m0d16l14n1 wants to merge 5 commits into
Conversation
…LAN) A deep sleep refused to start while the station was associated, so cfg80211 left the network first and the machine came back offline until the supplicant joined again. The firmware runs on through the sleep, and its host sleep request has a state that keeps the association: 1, where 3 is the unassociated sleep. Advertise WoWLAN "any". When userspace arms it, the wiphy suspend keeps the association for a deep sleep (on s2idle nothing services the link, so it still leaves first, as without WoWLAN), and the device suspend sends the associated sleep state. It also lets the connection's loss, the disconnect, the scan quota and the keepalive and service wake events through to the host. At resume the events that came during the sleep are drained, so a link lost in the sleep is reported at once, and the log says whether the association was kept. No packet patterns, magic packet or disconnect triggers are advertised: the firmware is not given any. Signed-off-by: Nick <nekreshen@yandex.ru>
satchlj
left a comment
There was a problem hiding this comment.
Verdict: FINISH, then merge (draft — solid approach, a couple of locking/state-cleanup items before undrafting and running the armed WoWLAN row).
Reviewed 17379d1a45da across drivers/net/wireless/apple/centauri/centauri_wifi.c (wifi_suspend()/wifi_resume(), alpha_host_power_send(), centauri_wifi_suspend(), centauri_wifi_resume(), and alpha_resume_locked()):
- Unlocked read of
wifi->wowlan_armedinwifi_suspend()(centauri_wifi.c:3629–3630):return wowlan && !wifi->wowlan_armed ? 1 : 0;readswifi->wowlan_armedaftermutex_unlock(&wifi->lock). Capturebool armed = ...; wifi->wowlan_armed = armed;under the mutex and returnwowlan && !armed ? 1 : 0;after unlocking. - Keep
wifi->wowlan_armedbounded to the sleep cycle:wifi_suspend()setswifi->wowlan_armed = trueand currently onlywifi_resume()clears it. Also clearingwifi->wowlan_armed = falseincentauri_wifi_resume()and on the error path ofcentauri_wifi_suspend()(alongsidewifi->wowlan_sleep = false) avoids leavingwowlan_armedstale if a suspend fails or aborts early. - Minor clarity nit:
alpha_host_power_send()keys sleep state1andhost_sleep_events_wowlanoffwifi->connected. That matcheswifi->wowlan_sleeptoday becausecentauri_wifi_suspend()rejects connected non-WoWLAN sleeps, though keying onwifi->wowlan_sleepmakes the invariant self-documenting. - Checked clean:
CEN_HOST_EVENTS_LEGACY(85) covers the 14-bytehost_sleep_events_wowlantable without truncation,drain(wifi)is called underwifi->lockmatchinglink_work, andalpha_resume_locked()already re-wakes the netif queue and rescheduleslink_workwhenwifi->connected. - Remaining before approval: fix the unlocked read above, undraft so CI runs on the final head, and add the exact-head armed WoWLAN (
state=1) sleep/wake hardware row (including the post-wake association / disconnect path).
|
Merge readiness at
Areas: none matched in CODEOWNERS Updated by pr-readiness on pushes, edits, reviews and comments, and on a schedule. Rules: merge policy · labels. |
Return the arming decision captured under the Wi-Fi lock. Clear the arming bit on device resume and on either suspend refusal path. Signed-off-by: DjDeveloperr <hey@djdev.me>
|
Pushed On the merge tree with main |
There was a problem hiding this comment.
Verdict: FINISH at 4265c100cffa8aef3e22e5b2e176588146b1a69f.
Failure: The wiphy accepts wowlan enable any even though Wi-Fi cannot wake this platform. include/net/cfg80211.h:5880–5884 defines WIPHY_WOWLAN_ANY as a host wake trigger. centauri_wifi.c:3604–3633 advertises and accepts it, and the PR's J815 test reports two attempts where the firmware wake event did not wake the host. Both sleeps ended with a trackpad touch. Expose that trigger only when the wake path works.
Checked: The supplied armed and unarmed rows demonstrate the association retention change. I also checked cfg80211's handling of the driver's fallback return and the PCI suspend/resume path.
|
@m0d16l14n1 This branch now conflicts with
Could you forward-merge |
Signed-off-by: Nick <nekreshen@yandex.ru> # Conflicts: # drivers/net/wireless/apple/centauri/centauri_wifi.c
A board whose N1 can wake the host from system sleep marks function zero with the standard wakeup-source property. The native driver offers WoWLAN only there. Signed-off-by: Nick <nekreshen@yandex.ru>
WoWLAN "any" is a host wake trigger: the device keeps running and wakes the host on activity. The association is kept through a deep sleep, but no N1 board wakes the host from Wi-Fi yet: on the J815 the firmware's test wake during an armed sleep did not wake the machine. Advertise WoWLAN only when the control function's node has wakeup-source, so cfg80211 accepts "wowlan enable any" only where the wake path exists. Without it the wiphy has no WoWLAN support and a deep sleep leaves the network first, as before. Signed-off-by: Nick <nekreshen@yandex.ru>
|
Merged For the review at At this head: |
There was a problem hiding this comment.
Verdict: MERGE at 6d4e2d3
Checked: The control PCI function advertises WIPHY_WOWLAN_ANY only when its device node has wakeup-source. With the property absent the wiphy has no WoWLAN capability and nl80211 returns EOPNOTSUPP. The extracted registration and refusal checks pass under GCC and Clang. The revised Centauri schema passes dt-doc-validate and accepts compiled control nodes with and without the flag while rejecting an undeclared property. The PR adds the binding without enabling it on a board. The forward merge retains the pending-disconnect refusal and clears the armed state when suspend aborts.
|
Hardware: J815 (MacBook Air 15" M5) · tree containing head The J815 DT has no
Not covered: the armed path. No board sets |
What: let an N1 Mac keep its Wi-Fi association through a deep sleep when userspace arms WoWLAN. Today a deep sleep refuses to start while the station is associated, so cfg80211 leaves the network first and the Mac wakes up offline. On a board whose DT marks the N1 control function with
wakeup-source, the driver advertises WoWLAN "any" (a host wake trigger in cfg80211). No board sets it yet: Wi-Fi cannot wake these Macs so far (see Not yet), so until a board does, nothing changes. Once it is advertised and armed (iw phy <phy> wowlan enable any), a deep sleep keeps the association and sends the firmware's associated host sleep state (1, where 3 is the unassociated sleep). That state also lets connection loss, disconnect, scan quota, keepalive and service wake events through to the host. At resume the driver drains the events that came in during the sleep and logs whether the association was kept. With WoWLAN not armed, and on s2idle, nothing changes. Three commits onmain: the feature, thewakeup-sourcebinding, and the gate.Tested: at head
6d4e2d31d95d(merge ofmainf02bd68a08cbplus thewakeup-sourcegate):make ARCH=arm64 LLVM=1 W=1 drivers/net/wireless/apple/centauri/builds with no warnings,run-host-tests.py --only centauri22 of 22. No hardware row at this head yet; the rows below were taken at17379d1a45da, which advertised WoWLAN without the DT gate, so they stand for a board withwakeup-sourceset. J815 (MacBook Air 15" M5), nightly13: main59c55677a7a8+ this PR at17379d1a45da+ the other open J815 PRs. Armed (iw phy wowlan enable any): the firmware got the associated sleep (state=1 events=14), slept 39 s, resume returned 0 and the association was kept (same access point, gateway answers, 0 supplicant disconnects, NetworkManager never went to sleeping). Unarmed, the same boot: unassociated sleep (state=3 events=9), 29 s, rejoined after the wake. Awake, the firmware test wake event (0x20) arrives 5 s after the request. Scan 37 (2.4 GHz) + 21 (5 GHz) networks, link VHT80 NSS2, gateway ping 0 % loss. 0 N1 driver errors, 0 failed units, 0 new kernel errors vs the previous boot, 0 WARN/BUG/Oops. Earlier: J815 (MacBook Air 15" M5), with WoWLAN not armed only: one deep suspend of 30.7 s on a kernel carrying this patch. The firmware got the unassociated sleep (state=3 events=9), the sleep and wake handshakes returned 0, the station rejoined on channel 149 after the wake, and AWDL file transfers (AirDrop-like) worked before and after the sleep. 0 N1 driver errors, 0 WARN/BUG/Oops, 0 failed units (SELinux is not built on this image). Build:make W=1 drivers/net/wireless/apple/centauri/at this head (arm64, with the KUnit tests on), no warnings;checkpatch --strictclean;run-host-tests.py --only centauri22 of 22.Risk: two-way door; N1 boards on the shared transport (J813, J815 and the other T8142/T8152 boards). No board DT sets
wakeup-sourceyet, so no Mac changes behaviour with this PR alone; on a board that sets it, behaviour changes only once userspace arms WoWLAN. Armed, a deep sleep no longer leaves the network first. If the firmware drops the link during the sleep, the driver reports the disconnect at resume.Not yet: a wake started by the N1: with the test wake event set during an armed sleep the Mac did not wake (2 tries, 32 s and 3 s, both ended by a trackpad touch, wake source
MTP.DOCK.CHANNELS.AP0.IRQ), so waking the host from Wi-Fi needs the platform wake path and is not part of this PR. That is why the board DTs do not setwakeup-sourceyet; a hardware row at this head with the property added by hand; other N1 boards; network managers other than NetworkManager.Details
wiphy->wowlanadvertisesWIPHY_WOWLAN_ANYonly, and only when the control function's node haswakeup-source(documented inapple,centauri.yaml). Without it the wiphy has no WoWLAN support andiw phy <phy> wowlan enable anyis refused. No packet patterns, magic packet, GTK rekey or disconnect triggers are advertised, because the firmware is not given any..suspend(cfg80211) arms the associated sleep only for a deep sleep (pm_suspend_via_firmware()) with WoWLAN "any" set, the station connected, and no connect, scan, stop or paused transport in flight. Otherwise it returns 1, so cfg80211 disconnects first, as before..resumeclears the flag.Evidence
Tested tree: the J815 nightly
7.3.0-aurora-j815-dev(built in Docker, clang 19). Its N1 code ismainatfdad0c5804d8plus #3462, an RSSI-threshold (CQM) commit that is not posted, test-only switches and debug files, and this patch. This patch there differs from this head only in context: the CQM op next to it inwifi_ops, and #3462's AWDL suspend and resume calls. No centauri or Bluetooth words were on the command line.One deep suspend with
awdl0up and WoWLAN not armed (2026-12-02):