Repository navigation
wifi: apple: centauri: keep the association through a deep sleep (WoWLAN) - #3921
Draft
m0d16l14n1 wants to merge 1 commit into
Draft
m0d16l14n1 wants to merge 1 commit into
m0d16l14n1 wants to merge 1 commit 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
reviewed
Dec 2, 2026
satchlj
left a comment
Member
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).
This branch has not been deployed
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.
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. The driver now advertises WoWLAN "any". Once it is 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. One commit onmain.Tested: 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). 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: the armed sleep itself (the firmware keeping the association through the sleep, which is what this PR is for); a wake started by the N1; other N1 boards. NetworkManager takes a WoWLAN device down and up again right after a wake, so under NetworkManager the Mac still rejoins after the wake even when the firmware kept the link. Other network managers have not been tried.
Details
wiphy->wowlanadvertisesWIPHY_WOWLAN_ANYonly. 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):