Skip to content

wifi: apple: centauri: fix roaming (-EALREADY, disconnect wait) and cfg80211 disconnect race - #4285

Merged
DjDeveloperr merged 4 commits into
mainfrom
fix/centauri-reassoc-disconnect
Dec 4, 2026
Merged

DjDeveloperr merged 4 commits into
mainfrom
fix/centauri-reassoc-disconnect

Conversation

@sithglan

@sithglan sithglan commented Dec 4, 2026 •

Copy link
Copy Markdown
Contributor

What: Fix roaming failures on the base apple_centauri Wi-Fi driver (J813/J815/J873g/J804) by returning -EALREADY on wifi_connect() while connected (matching T6050 commit 019e4b0e0946 / #3954), waiting for the firmware's asynchronous disconnect completion event (0x80000004) in wifi_disconnect() without latching disconnect_pending on timeout/fault, registering apple-centauri-wifi in scripts/ci/apple-kunit.py, and fixing the cfg80211 net/wireless/sme.c disconnect-event / missing-Country-IE SSID race exposed by immediate disconnect-then-connect retries.
Tested:

  • J873g (Mac mini M6, T8152, N1 Centauri) at 18740d123634 (boot 4ee44a1a-67db-4dab-853c-415afc210c8c): 6/6 consecutive cross-band roams (2.4 GHz <-> 5 GHz ch 44) in 225–227 ms each, 0 ignore-list entries, 3/3 explicit disconnect + immediate reconnects, 10/10 Wi-Fi disconnect: rc=0 status=0 reply_cmd=0x40020001 pending=0, 0 firmware_status=333, 20/20 (0% loss) gateway pings on 5 GHz, 0 failed units, 0 oops/WARN/BUG.
  • J813 (MacBook Air 13" M5, T8142, N1 Centauri) at 18740d123634 (boot 317f08ad-d877-4de2-87a5-fa6e097a00e9): 3/3 wpa_cli roam while connected (ignore=[]), 3/3 explicit disconnect + immediate reconnect, 1/1 connected s2idle (rtcwake -m freeze -s 10, Wi-Fi back in 5.65 s, 5/5 pings), 2/2 connected hardware deep sleep (rtcwake -m mem -s 15, full SoC commit + radio PCIe retrain each wake, Wi-Fi back in 5.66 s, 5/5 pings + immediate post-wake disconnect/reconnect OK each time), 20/20 (0% loss) final gateway pings, 0 firmware_status=333, 0 sleep refusals, 0 ASSOC-REJECT, 0 WARN/BUG/Oops.
  • J516s (M3 Pro, brcmfmac, paired arm A/B cfg80211.ko by @DjDeveloperr): PASS including 3 deep sleeps + reconnects, 0 WARN/Oops/BUG.
  • Hosted CI 15/15 GREEN (apple-build, host-tests, full arm64 KUnit matrix including centauri apple-centauri-wifi* 2/2 PASS); tools/asahi/run-host-tests.py --only centauri 22/22 PASS; W=1 0 warnings.
    Risk: two-way door · N1 Centauri Macs (apple_centauri: J813/J815/J873g/J804) and shared cfg80211 (net/wireless/sme.c, all Macs).
    Not yet: Separate follow-up for IWD userspace roam behavior (t6050 centauri: a roam dead-ends the station — every CMD_CONNECT refused until reboot (J714s, v272-28) #4290), where IWD does not issue CMD_DISCONNECT after a CMD_CONNECT error.
Details

Three interlocking bugs caused wpa_supplicant roams on apple_centauri to fail, blacklist the better 5 GHz BSSID, and wedge disconnect handling:

  1. wifi_connect() returned -EBUSY while connected (drivers/net/wireless/apple/centauri/centauri_wifi.c):
    Just like the T6050 driver before wifi: apple: centauri: t6050: return -EALREADY to a connect while connected #3954 (019e4b0e0946), returning -EBUSY makes wpa_supplicant log Association request to the driver failed, ignore the target BSSID for 10 s, and fall back to a weaker AP. Returning -EALREADY makes wpa_supplicant disconnect explicitly and retry the same target BSS.
  2. wifi_disconnect() did not wait for firmware disconnect completion (drivers/net/wireless/apple/centauri/centauri_wifi.c):
    drain_control() stripped BIT(30) (more-data-pending) before storing wifi->reply_command, and wifi_disconnect() returned immediately after the initial 0x40020001 ack without waiting for event 0x80000004. On the immediate roam retry, firmware rejected command 0x20000 with firmware_status=333 (CTRL-EVENT-ASSOC-REJECT status_code=1). Preserving wire_command in wifi->reply_command, tracking wifi->disconnect_pending until 0x80000004, waiting in wifi_disconnect() when BIT(30) is set (clearing disconnect_pending before unlocking wifi->lock so a timeout or fault never wedges scan/connect/suspend), guarding scan/connect/MAC/PM/debugfs paths on disconnect_pending, and guarding link_worker() with was_connected eliminates both the status=333 rejection and duplicate cfg80211_disconnected() notifications.
  3. cfg80211 queued disconnect-event race + early return before SSID restore (net/wireless/sme.c):
    When an ops->disconnect() callback calls cfg80211_disconnected(), EVENT_DISCONNECTED is queued asynchronously onto wdev->event_list. When wpa_supplicant immediately sends NL80211_CMD_CONNECT on the same thread after -EALREADY, EVENT_DISCONNECTED ran after the new connect started, emitting a spurious disconnect for the new target and clearing wdev->u.client.ssid_len = 0. When that connect completed on an AP without a Country IE, __cfg80211_connect_result() returned early on !country_elem before the if (!wdev->u.client.ssid_len) fallback, leaving wdev->connected == true with wdev->u.client.ssid_len == 0 — making every subsequent cfg80211_disconnect() (else if (wdev->u.client.ssid_len)) a silent no-op and wedging the interface.
    • Reorder __cfg80211_connect_result() so wdev->u.client.ssid_len is restored before the optional Country IE lookup.
    • In cfg80211_disconnect(), check wdev->u.client.ssid_len || wdev->connected and call cfg80211_process_wdev_events(wdev) after rdev_disconnect() (under the held wiphy lock) so synchronously queued disconnect events are delivered before nl80211_disconnect() returns.
  4. Hosted KUnit CI coverage (drivers/net/wireless/apple/centauri/centauri.kunitconfig, scripts/ci/apple-kunit.py):
    Register the centauri suite (apple-centauri-wifi*) so centauri_station_stats_len_test and centauri_connect_state_guards_test run automatically in hosted arm64 KUnit CI.
Evidence
  • Head commit: 18740d123634 (base main ac0201f5287a)
  • Static & unit checks:
    • ./scripts/checkpatch.pl --strict: 0 errors, 0 warnings on C changes (centauri.kunitconfig triggers only the standard new-file MAINTAINERS note)
    • make ARCH=arm64 LLVM=-19 W=1 drivers/net/wireless/apple/centauri/ net/wireless/sme.o: 0 warnings
    • Hosted CI 15/15 GREEN including KUnit apple-sio centauri mt7932 asahi (apple-centauri-wifi*: 2/2 PASS)
    • python3 -I tools/asahi/run-host-tests.py --only centauri: 22/22 PASS
  • Before (J873g 7.3.0-aurora-j873-main+, unpatched):
    • wpa_cli roam -> Association request to the driver failed, target added to ignore list; subsequent connect rejected with Wi-Fi command 0x20000 rejected: firmware_status=333 -> CTRL-EVENT-ASSOC-REJECT status_code=1.
  • After — J873g (7.3.0-aurora-centauri-roam+ at 18740d123634, boot 4ee44a1a-67db-4dab-853c-415afc210c8c, one-shot aura-try):
    • 6/6 consecutive wpa_cli roam transitions (2437 -> 5220 -> 2462 -> 5220 -> 2437 -> 5220 MHz): 225–227 ms each, ignore_list: [] after every roam.
    • 3/3 explicit wpa_cli disconnect + immediate wpa_cli reconnect -> cleanly reconnected on 5220 MHz.
    • 10/10 Wi-Fi disconnect: rc=0 status=0 reply_cmd=0x40020001 pending=0, 0 firmware_status=333, 0 CTRL-EVENT-ASSOC-REJECT, 0 timeouts.
    • 5 GHz gateway ping: 20/20 transmitted/received, 0% loss (rtt min/avg/max = 2.148/3.040/8.022 ms).
    • systemctl --failed: 0 failed units; 0 kernel oops/WARN/BUG; clean reboot back to default kernel 7.3.0-aurora-j873-main+.
  • After — J813 (7.3.0-aurora-j813-roam+ at 18740d123634, boot 317f08ad-d877-4de2-87a5-fa6e097a00e9, one-shot aura-try):
    • 3/3 wpa_cli roam while connected (ignore=[]), 3/3 explicit wpa_cli disconnect + immediate wpa_cli reconnect (ignore=[]), each completing full firmware supplicant handshake (result=0 phase=7).
    • 1/1 connected s2idle (rtcwake -d rtc0 -m freeze -s 10): rc=0, Wi-Fi reconnected in 5.65 s, 5/5 (0% loss) gateway pings.
    • 2/2 connected hardware deep sleep (rtcwake -d rtc0 -m mem -s 15, s2idle [deep]): both rc=0, full SoC commit (apple-sleep: wake: 9 cores started in one burst; stop/sys/e/p now 0/0/0/0, the radio's PCIe link trained again after the wake), Wi-Fi reconnected in 5.66 s, 5/5 (0% loss) gateway pings + post-wake disconnect/reconnect PASS (203 ms / 210 ms) after each wake.
    • Final 20/20 gateway pings: 0% loss (rtt min/avg/max = 4.447/12.851/84.350 ms).
    • Full dmesg + wpa_supplicant check: 0 firmware_status=333, 0 disconnect timeouts, 0 sleep refusals, 0 ASSOC-REJECT, 0 WARNING/BUG/Oops/Call trace.

…disconnect

Like the T6050 Centauri driver (commit 019e4b0), the base Centauri
Wi-Fi firmware has no in-place reassociation, yet wifi_connect() refused a
connect while connected with -EBUSY. On a roam attempt wpa_supplicant then
marks the target BSS failed ("Association request to the driver failed"),
adds it to its ignore list for 10 s, and falls back to another AP.

In addition, drain_control() stripped BIT(30) (more-data-pending) before
recording wifi->reply_command and wifi_disconnect() did not wait for the
firmware's asynchronous disconnect completion event (0x80000004). When
wpa_supplicant immediately disconnects and retries a connect, command
0x20000 races with the in-flight teardown and is rejected by firmware
with status 333 (CTRL-EVENT-ASSOC-REJECT status_code=1).

Fix both halves so wpa_supplicant roams cleanly:
- Return -EALREADY from wifi_connect() when wifi->connected is set, so
  wpa_supplicant explicitly disconnects and retries the same target BSS.
- Preserve wire_command (including BIT(30)) in wifi->reply_command, track
  wifi->disconnect_pending until event 0x80000004 arrives, wait for it in
  wifi_disconnect() when BIT(30) is set, and guard scan/connect/MAC/PM
  paths while disconnect_pending is set.
- Guard link_worker() with was_connected so a worker racing with
  wifi_disconnect() does not emit a duplicate cfg80211_disconnected() or
  re-arm itself.
- Add a KUnit test covering the wifi_connect()/wifi_scan() state guards.

Signed-off-by: Thomas Glanzmann <thomas@glanzmann.de>
…D on connect

When a FullMAC driver reports disconnect synchronously from ops->disconnect()
via cfg80211_disconnected(), EVENT_DISCONNECTED is queued asynchronously onto
wdev->event_list. If userspace (such as wpa_supplicant handling -EALREADY on
a roam) immediately calls NL80211_CMD_CONNECT before cfg80211_wq runs, the
stale EVENT_DISCONNECTED fires after the new connect has started, emitting a
spurious disconnect for the new target and clearing wdev->u.client.ssid_len.

When that new connect completes, __cfg80211_connect_result() only restored
wdev->u.client.ssid_len after checking for a Country IE; on any AP without a
Country IE it returned early, leaving wdev->connected == true with
wdev->u.client.ssid_len == 0. Subsequent cfg80211_disconnect() calls then
skipped rdev_disconnect() completely because ssid_len was 0, permanently
wedging the interface in a connected state.

Fix both bugs:
- In __cfg80211_connect_result(), restore wdev->u.client.ssid_len before the
  optional Country IE handling so it is never skipped.
- In cfg80211_disconnect(), check wdev->connected alongside
  wdev->u.client.ssid_len and call cfg80211_process_wdev_events(wdev) after
  rdev_disconnect() so synchronously queued disconnect events are delivered
  before nl80211_disconnect() returns.

Signed-off-by: Thomas Glanzmann <thomas@glanzmann.de>
@sithglan
sithglan requested review from a team as code owners December 4, 2026 07:51
@github-actions github-actions Bot added blast:all Macs affected, from Merge risk (bot) door:two-way Revertible or not, from Merge risk (bot) needs-review No approving review from Core or Omarchy Mac yet (bot) labels Dec 4, 2026
@github-actions

github-actions Bot commented Dec 4, 2026 •

Copy link
Copy Markdown

Merge readiness at 18740d12: ready to merge

Check Detail
CI at head ok 17 checks passed
Review ok approved by DjDeveloperr
Requested changes ok none
Hardware row at head ok in the PR body at 18740d12
Conflicts ok none
PR text ok Risk: two-way · N1 Centauri Macs (applecentauri: J813/J815/J873g/J804) and shared cfg80211 (net/wireless/sme.c, all Macs).

Areas: none matched in CODEOWNERS
Merge: gh pr merge 4285 --merge (Owners and Core through the bypass: add --admin).

Updated by pr-readiness on pushes, edits, reviews and comments, and on a schedule. Rules: merge policy · labels.

@DjDeveloperr DjDeveloperr left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review at c448d9ad8e11, merged onto main a9f1fabc2493 (merge tree 18ff24983e55, same as GitHub's merge ref). Not approving yet: one small fix in the Centauri wait, and the second-generation rows are queued.

Needs a fix: a disconnect timeout wedges the interface and blocks deep sleep.
In wifi_disconnect(), when wait_disconnect() returns -ETIMEDOUT (Alpha still at stage 2, no 0x80000004 within 5 s), disconnect_pending stays set. The same happens when command() itself times out. Nothing clears it afterwards. Only drain_control() does, on 0x80000004, and nothing drains the control ring while the interface is disconnected: centauri_wifi_kick() and link_worker() only run while connected, and scan/connect refuse before they send a command. From then on wifi_scan(), wifi_connect() and net_set_mac_address() return -EBUSY, and centauri_wifi_suspend() returns -EBUSY, which aborts every deep sleep until the module is rebound. Before this PR the worst case was a status 333 reject that wpa_supplicant retries. The recovery request after a command timeout doesn't help: the worker restarts the chip only when centauri_wifi_stalled() is true, and it isn't while Alpha is at stage 2.
Suggestion: on a wait timeout, log it and clear disconnect_pending (the next connect then sees, at worst, the old status 333), or drain once in wifi_connect()/wifi_scan()/suspend when the flag is set, so a late event is consumed. The merged T6050 wait_disconnect() has the same shape and could get the same follow-up.

cfg80211 (sme.c): looks right.

  • Locking: cfg80211_disconnect() already asserts the wiphy lock. Draining the wdev event list right after a disconnect is what cfg80211_change_iface() (util.c, after cfg80211_leave_locked()) and wiphy_suspend() (sysfs.c, after cfg80211_leave_all()) already do.
  • No double report: each event is taken off the list under event_lock before it is handled, so cfg80211_event_work can't deliver it again. The handler calls back into the driver (del_key, set_qos_map, crit_proto_stop) with no driver lock held, the same as from the worker. A nested drain (EVENT_STOPPED -> cfg80211_leave_locked() -> cfg80211_disconnect()) is safe for the same reason.
  • Userspace now gets NL80211_CMD_DISCONNECT before the disconnect command's ack. mac80211 already does that (its deauth path reports synchronously), so wpa_supplicant handles it.
  • Other drivers: only FullMAC drivers with .disconnect take this branch. brcmfmac (BCM4388 on J516s/J773g) calls cfg80211_disconnected() from brcmf_cfg80211_disconnect() unconditionally, and mt7932 (J700) and the T6050 Centauri driver (J714s) report from their disconnect paths too, so their disconnect event is now delivered synchronously. Hence the rows below.
  • The ssid_len move: for APs that send a Country IE nothing changes (regulatory_hint_country_ie() doesn't read the SSID). The restore now also runs when there is no Country IE or the kmemdup() fails, which is the bug. || wdev->connected only adds the connected-without-SSID state. Both halves fix upstream code and are worth sending to linux-wireless.

Small things, no blocker:

  • The 5000 ms wait matches the T6050 driver. A one-line comment on where it comes from (next to the 500 ms budget in the payload) would help.
  • scripts/ci/apple-kunit.py plan maps the centauri files to no suite, so hosted CI never runs centauri_connect_state_guards_test. A table entry would keep it running.

Checked locally on the merge tree:

  • make ARCH=arm64 LLVM=1 W=1 (clang 23.1.3, defconfig + asahi.config, Rust off, KUnit on) of net/wireless/ drivers/net/wireless/apple/centauri/ drivers/net/wireless/mediatek/mt7932/ drivers/net/wireless/broadcom/brcm80211/brcmfmac/: no warning in the PR's files. One warning in untouched net/wireless/reg.c:112 (-Wunused-but-set-global, clang 23, not from this PR). centauri_connect_state_guards_test compiles; not run here (no QEMU on our build hosts, and MFD_MACSMC doesn't build on UML).
  • tools/asahi/run-host-tests.py --only centauri: 22/22 pass.
  • Hosted CI: apple-build passed; KUnit mt7932 and host-tests were still running when I wrote this.

Rows queued, this head's sme.c, module-only:

  • J516s (M3 Pro, brcmfmac, stock 7.3.0-f3822): cfg80211.ko with this sme.c swapped in at run time, stock module as the control first. Connect, disconnect, three immediate reconnects, a BSSID switch if one is in range, a suspend/resume with Wi-Fi up, 0 WARN/Oops, stock module back at the end.
  • J714s (M5 Pro, T6050 Centauri, trial 7.3.0-main571a6c45): the same sequence with the new cfg80211.ko loaded at boot.

Not yet: J813 exact-head row (peer row). A connected suspend/resume on a base Centauri Mac (J813 or J873g) at this head, since the new wait now runs inside cfg80211's suspend-time disconnect and the driver refuses to suspend while disconnect_pending is set.

…t returns

If command(131073) or wait_disconnect() times out (or hits a transient
fault) while Alpha stays at stage 2, nothing drains the control ring
while the interface is disconnected. Leaving disconnect_pending latched
would permanently wedge wifi_scan(), wifi_connect(),
net_set_mac_address(), and centauri_wifi_suspend() until module rebind.

Log the pre-clear pending state in dev_dbg() and clear
wifi->disconnect_pending before releasing wifi->lock. Also note why
wait_disconnect() uses a 5000 ms deadline alongside the 500 ms firmware
payload budget.

Signed-off-by: Thomas Glanzmann <thomas@glanzmann.de>
Add drivers/net/wireless/apple/centauri/centauri.kunitconfig and wire it
into scripts/ci/apple-kunit.py so hosted arm64 KUnit CI runs
apple-centauri-wifi* (centauri_station_stats_len_test and
centauri_connect_state_guards_test) whenever centauri files change.

Signed-off-by: Thomas Glanzmann <thomas@glanzmann.de>
@github-actions github-actions Bot added the needs-hw-row No hardware row at the PR head (bot) label Dec 4, 2026
@sithglan

sithglan commented Dec 4, 2026

Copy link
Copy Markdown
Contributor Author

Addressed review feedback on top of c448d9ad8e11 (new head 18740d123634; net/wireless/sme.c is untouched so the queued J516s/J714s cfg80211.ko rows remain valid for sme.c):

  • 875311ad644f: Clear wifi->disconnect_pending = false before releasing wifi->lock in wifi_disconnect() (after logging the pre-clear pending state in dev_dbg), so a command(131073) or wait_disconnect() timeout/fault can never wedge scan, connect, set-MAC, or deep sleep. Also added a one-line comment on the 5000 ms wait matching T6050 above the 500 ms payload budget.
  • 18740d123634: Added drivers/net/wireless/apple/centauri/centauri.kunitconfig and registered the centauri suite (apple-centauri-wifi*) in scripts/ci/apple-kunit.py (verified locally with kunit.py run --arch=arm64 — 2/2 pass — and apple-kunit.py plan).
  • Re-verified on J873g (mini6, 18740d123634, boot 4ee44a1a-67db-4dab-853c-415afc210c8c): 6/6 cross-band roams (225–227 ms, ignore=[]), 3/3 explicit disconnect + immediate reconnect, 10/10 rc=0 status=0 reply_cmd=0x40020001 pending=0, 20/20 5 GHz pings (0% loss), 0 WARN/BUG/Oops, 0 failed units. (Note: our lean J873g config has no CONFIG_SUSPEND; connected suspend/resume + J813 exact-head row will run on air5 once we get the go-ahead to reboot it.)

@github-actions github-actions Bot removed the needs-hw-row No hardware row at the PR head (bot) label Dec 4, 2026

@DjDeveloperr DjDeveloperr left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Re-review at 18740d123634 (two new commits since c448d9ad8e11; net/wireless/sme.c unchanged, still blob bcf2d612). Merged locally onto main be72f78e54d6 (merge tree 5e6b3517). The blocker from the last review is fixed, and nothing new is wrong. Approving the code. Please don't merge yet: two rows are still owed (listed at the end).

The disconnect wedge is fixed.

  • disconnect_pending is set in one place only: wifi_disconnect(), under wifi->lock. The new unconditional clear runs before the unlock on every way out: a command() error or timeout, -EREMOTEIO, wait_disconnect() returning -ETIMEDOUT, and -EIO from stopping or Alpha leaving stage 2. There is no early return between setting and clearing it, and command() and wait_disconnect() don't drop the lock.
  • So scan, connect, set-MAC and centauri_wifi_suspend() can no longer stay stuck at -EBUSY after a timeout. A disconnect that times out during cfg80211's suspend-time disconnect no longer blocks deep sleep.
  • Locking: the change is one store under a lock that is already held. Lock order and the sleep under wifi->lock (up to 5 s, a mutex) are the same as before. cancel_work_sync(connect_work) still runs before the lock is taken, and cancel_delayed_work_sync(link_work) and cfg80211_disconnected() still run after it is released.
  • A firmware disconnect event (0x80000004) that arrives late after a timeout can't wedge anything. While disconnected nothing drains the ring, so the event waits there. connect_worker() drains the ring and clears disconnect_event before it sends the join, so the event is dropped there. If the firmware posts it after that drain, it fails that one join (-ENOTCONN), or, after a join that succeeded, it makes link_worker() report one disconnect. wpa_supplicant retries either way. That is the same worst case as before this PR (a rejected join), and it needs the firmware to be more than 5 s late.

Small things, no blocker:

  • All six places that read disconnect_pending (scan, connect, set-MAC, fwlog, host_wakeup, suspend) hold wifi->lock, so they can never see it set now. The guards and the disconnect_pending = true step in centauri_connect_state_guards_test test a state that can't happen anymore. They are harmless. You could drop them in a follow-up, or leave them as a safety net.
  • scripts/ci/apple-kunit.py: the entry has the same shape as its neighbours (a glob filter like apple-dart*/apple_sep*). It selects the right suite: the suite name is apple-centauri-wifi, and plan maps the three centauri files to centauri and sme.c to mt7932. One gap for later: the path drivers/net/wireless/apple/centauri/ also matches t6050/, but the kunitconfig doesn't turn on the T6050 tests (apple-centauri-t6050-sleep, centauri_t6050_wifi). So a T6050-only change would run only the base suite. Not this PR's job.

Checked locally on the merge tree (Mini, clang 23.1.3):

  • make ARCH=arm64 LLVM=1 W=1 net/wireless/ drivers/net/wireless/apple/centauri/ (defconfig + asahi.config, Rust off, KUnit on, base Centauri and T6050 as modules with their KUnit tests): no warning in the PR's files. The only warning is in untouched net/wireless/reg.c:112 (-Wunused-but-set-global, also on main).
  • tools/asahi/run-host-tests.py --only centauri: 22/22 pass.
  • kunit.py build --arch=arm64 --make_options LLVM=1 --kunitconfig=drivers/net/wireless/apple/centauri/centauri.kunitconfig: builds in 244 s. All of its options end up set, and centauri_wifi_suite with both cases is in vmlinux. It was built only, not run: our build hosts have no QEMU, and UML can't host this suite. The hosted KUnit job that runs it (apple-sio centauri mt7932 asahi) was still queued when I wrote this. Hosted apple-build and host-tests passed at this head.

Still owed before merge:

  • J516s row (brcmfmac, stock 7.3.0-f3822, module-only cfg80211.ko with this sme.c): the first run gave no verdict because of a fault in our test kit, not in this PR. After the module swap the running wpa_supplicant lost the device, on the stock module too, with 0 kernel warnings. The kit is being resealed to restart wpa_supplicant after the swap and to use mem sleep. The M3 lead runs it next.
  • Your J813 exact-head row with a connected suspend/resume, since your J873g config has no CONFIG_SUSPEND. It is the only row that runs the new wait inside cfg80211's suspend-time disconnect on base Centauri.
  • The hosted centauri KUnit job finishing green.

@github-actions github-actions Bot removed the needs-review No approving review from Core or Omarchy Mac yet (bot) label Dec 4, 2026
@DjDeveloperr

Copy link
Copy Markdown
Contributor

J516s (M3 Pro) row: PAIRED PASS for net/wireless/sme.c blob bcf2d612 (unchanged at head 18740d123634).

Kit c1621-4285-wifi-kit-v4-20261204 (KIT.sha256 fa5b8ae8, check OK). One trial boot per arm on 7.3.0-j516s-r1940 (the J516s deep-sleep chain), brcmfmac BCM4388. Arm B loads the PR's cfg80211.ko via depmod, and nothing is unloaded inside a boot.

Arm cfg80211 Boot Result
A (main) 5502607b 4494226d PASS
B (#4285) db97a5b9 4020dc06 PASS

Arm B steps: initial connect, disconnect, connect and 3 reconnects OK. Then 3 deep sleeps (rtcwake -m mem -s 20), each with rc=0, 1 commit, Wi-Fi back in 8 s, and a reconnect after every wake OK. The kernel log has 0 WARN/Oops/BUG lines. Roam was skipped: there's only one BSSID for the test network. The Mac is back on stock and clean.

Still owed before merge: the author's J813 connected suspend/resume row at this head (the centauri half), and the hosted KUnit job that covers centauri (running).

@andyholst

Copy link
Copy Markdown

Field report for the IWD path, which the -EALREADY change does not cover.

J714s (MacBook Pro 14" M5 Pro, T6050) on linux-aurora 7.3.0.aurora17.v272-28 (pre-#4285), NetworkManager 1.58.1 with wifi.backend=iwd, iwd 3.12. One userspace roam at 09:33:18 dead-ended the station: 93 connect-failed, status: 1 notices over 36 minutes, including an AP at -22 dBm, and only a reboot recovered it. Full report with the log and the code path: #4290.

IWD does not react to the error the way wpa_supplicant does. netdev_cmd_connect_cb() (src/netdev.c:2682, iwd 3.12) turns any CMD_CONNECT error into NETDEV_RESULT_ASSOCIATION_FAILED with MMPDU_STATUS_CODE_UNSPECIFIED, so -EALREADY and -EBUSY both surface as status: 1. station_connect_cb() then only resets IWD's own state (station_reset_connection_state(), no netdev_disconnect(); same in station_disassociated()), so the driver keeps wifi->connected = true and every later connect is refused again. On this build the log looks exactly like the one in #4290; with 019e4b0e09 it would differ only in the errno.

So as tested (wpa_supplicant on J873g) this PR does not fix the iwd backend on the same driver. Two ways to cover it:

  • accept a connect while connected by tearing the link down in .connect (firmware disconnect, clear connected, then join), which is what the firmware needs anyway since it cannot reassociate in place; or
  • have iwd send CMD_DISCONNECT when a roam fails (upstream iwd, not this tree).

The PR lists "J714s (apple_centauri_t6050) cfg80211.ko regression rows" as not yet. This J714s is available to run that row at the PR head, under either backend.

@sithglan

sithglan commented Dec 4, 2026

Copy link
Copy Markdown
Contributor Author

J813 (MacBook Air 13" M5, T8142, apple_centauri) exact-head row at 18740d123634: PASS

  • Kernel / boot: 7.3.0-aurora-j813-roam+ (18740d123634, one-shot aura-try, boot 317f08ad-d877-4de2-87a5-fa6e097a00e9, s2idle [deep], apple-pmu-rtc on rtc0).
  • Roam & disconnect/reconnect:
    • 3/3 wpa_cli roam while connected (ignore=[]), 3/3 full firmware supplicant handshakes (result=0 phase=7).
    • 3/3 explicit wpa_cli disconnect + immediate wpa_cli reconnect (ignore=[]), 3/3 full handshakes (result=0 phase=7).
  • Connected suspend/resume:
    • 1/1 connected s2idle (rtcwake -d rtc0 -m freeze -s 10): rc=0, Wi-Fi reconnected in 5.65 s, 5/5 (0% loss) gateway pings.
    • 2/2 connected hardware deep sleep (rtcwake -d rtc0 -m mem -s 15): both rc=0, full SoC commit (apple-sleep: wake: 9 cores started in one burst; stop/sys/e/p now 0/0/0/0, the radio's PCIe link trained again after the wake), Wi-Fi reconnected in 5.66 s, 5/5 (0% loss) gateway pings + immediate post-wake disconnect/reconnect PASS (203 ms and 210 ms) after each wake.
  • Final check: 20/20 gateway pings (0% loss), 0 firmware_status=333, 0 disconnect timeouts, 0 sleep refusals, 0 ASSOC-REJECT, 0 WARNING/BUG/Oops/Call trace. Trial EFI artifacts removed (aura-try spent).

Hosted CI is also 15/15 GREEN (including KUnit apple-sio centauri mt7932 asahi).

Thanks @andyholst for the IWD trace in #4290 — agreed that IWD's handling of CMD_CONNECT errors without issuing CMD_DISCONNECT is a separate follow-up beyond this wpa_supplicant + cfg80211 fix.

@github-actions github-actions Bot added ready-to-merge Meets the merge policy: merge it (bot) and removed ready-to-merge Meets the merge policy: merge it (bot) labels Dec 4, 2026
@DjDeveloperr
DjDeveloperr merged commit 19c6615 into main Dec 4, 2026
21 checks passed
@DjDeveloperr
DjDeveloperr deleted the fix/centauri-reassoc-disconnect branch December 4, 2026 09:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

blast:all Macs affected, from Merge risk (bot) door:two-way Revertible or not, from Merge risk (bot) ready-to-merge Meets the merge policy: merge it (bot)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants