Skip to content

wifi: brcmfmac: skip 500 ms down delay when not connected - #3169

Merged
RyanTheTide merged 1 commit into
mainfrom
fix/brcmfmac-skip-down-delay
Nov 26, 2026
Merged

RyanTheTide merged 1 commit into
mainfrom
fix/brcmfmac-skip-down-delay

Conversation

@jgoyvaerts

@jgoyvaerts jgoyvaerts commented Nov 25, 2026 •

Copy link
Copy Markdown
Contributor

What

Both __brcmf_cfg80211_down() and brcmf_cfg80211_suspend() check BRCMF_VIF_STATUS_READY, call brcmf_link_down(), and then unconditionally sleep 500 ms via brcmf_delay(500) under rtnl_lock() so wpa_supplicant can process the firmware DISASSOC event.

When wpa_supplicant has already disconnected before bringing the interface down (as on every normal shutdown, reboot, and suspend), BRCMF_VIF_STATUS_CONNECTED is already clear and brcmf_link_down() sends no WLC_DISASSOC command to firmware, making the 500 ms sleep pure delay.

Return whether brcmf_link_down() actually sent WLC_DISASSOC and only sleep 500 ms when it did, and update the brcmf_link_down() stub in tools/asahi/brcmf-suspend-tests.py to match the bool return type.

Tested: J616s (MacBook Pro 16-inch M4 Pro, T6040) at 6662295 on 7.3.0-m4.190: scripts/checkpatch.pl --strict 0 errors / 0 warnings; python3 tools/asahi/brcmf-suspend-tests.py 37/37 controls pass; booted live on J616s, verified 500 ms removed from interface teardown when already disconnected, Wi-Fi association, reconnect, and interface down/up clean with 0 kernel errors.

Not yet: hardware test row from a second Mac generation (shared brcmfmac path).

Risk: two-way · all Macs with Broadcom brcmfmac Wi-Fi

@jgoyvaerts
jgoyvaerts requested review from a team as code owners November 25, 2026 16:38

@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.

Audited full diff at 043eb2b: having brcmf_link_down() return whether WLC_DISASSOC was actually sent and gating the 500 ms brcmf_delay() in both __brcmf_cfg80211_down() and brcmf_cfg80211_suspend() on that return value cleanly skips the redundant rtnl_lock sleep when already disconnected while preserving the wait whenever a disassoc event is expected. Verified checkpatch clean and J616s live results.

@github-actions github-actions Bot added area:wireless Area from CODEOWNERS (bot) blast:all Macs affected, from Merge risk (bot) ci-failing A check failed at the PR head (bot) door:two-way Revertible or not, from Merge risk (bot) labels Nov 25, 2026
@github-actions

github-actions Bot commented Nov 25, 2026 •

Copy link
Copy Markdown

Merge readiness at 66622957: not ready yet

Check Detail
CI at head no failing: pr-text / pr-text
Review ok approved by DjDeveloperr
Requested changes ok none
Hardware row at head ok in the PR body at 66622957
Conflicts ok none
PR text ok Risk: two-way · all Macs with Broadcom brcmfmac Wi-Fi

Areas: area:gpu, area:wireless

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.

Host tests (tools/asahi/brcmf-suspend-tests.py) fail to compile the generated controls.c after changing brcmf_link_down() from void to bool:

error: statement requires expression of scalar type ('void' invalid) at if (brcmf_link_down(vif, WLAN_REASON_UNSPECIFIED, true)).

Please update the brcmf_link_down() stub in tools/asahi/brcmf-suspend-tests.py to return bool so host-tests passes cleanly (and once green, this will also need a second hardware generation test row for the shared brcmfmac path).

@github-actions github-actions Bot added changes-requested A reviewer requested changes (bot) needs-review No approving review from Core or Omarchy Mac yet (bot) labels Nov 25, 2026
Both __brcmf_cfg80211_down() and brcmf_cfg80211_suspend() check
BRCMF_VIF_STATUS_READY, call brcmf_link_down(), and then unconditionally
sleep 500 ms via brcmf_delay(500) so wpa_supplicant can process the
firmware DISASSOC event. When wpa_supplicant has already disconnected
before bringing the interface down (as on every normal shutdown/reboot
and suspend), BRCMF_VIF_STATUS_CONNECTED is already clear and
brcmf_link_down() sends no WLC_DISASSOC to firmware, making the 500 ms
sleep under rtnl_lock() pure delay.

Return whether brcmf_link_down() actually sent WLC_DISASSOC and only
sleep 500 ms when it did.

Signed-off-by: Jonathan Goyvaerts <[email protected]>
@jgoyvaerts
jgoyvaerts force-pushed the fix/brcmfmac-skip-down-delay branch from 043eb2b to 6662295 Compare November 25, 2026 22:08
@jgoyvaerts

Copy link
Copy Markdown
Contributor Author

Amended at 66622957ef131: updated the brcmf_link_down() stub in tools/asahi/brcmf-suspend-tests.py to return bool (verified locally: 37/37 controls pass), and listed the second Mac generation hardware row under Not yet: in the PR body.

@github-actions github-actions Bot added area:gpu Area from CODEOWNERS (bot) ci-failing A check failed at the PR head (bot) and removed ci-failing A check failed at the PR head (bot) labels Nov 25, 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.

Stub fix in tools/asahi/brcmf-suspend-tests.py matches the new bool brcmf_link_down() signature cleanly, and the PR body now tracks the missing second-generation row. Holding merge until host-tests completes green and a second Mac generation row is posted.

@github-actions github-actions Bot removed changes-requested A reviewer requested changes (bot) needs-review No approving review from Core or Omarchy Mac yet (bot) labels Nov 25, 2026
@RyanTheTide

Copy link
Copy Markdown
Contributor

66622957ef13 (batched cleanly in J616s Batch #2 5b411e230229 over main 95a983c08be4, 0 merge-tree diffs across all 2 changed files) J616s (MacBook Pro 16" M4 Pro, T6040, Apple M4 Pro (G16S B1), macOS 26.6.2 fw, guarded one-shot 7.3.0-aurora-pr2905+, default cmdline, stock Stage 2 1.0.0b17, boot_id=de17fad3) PASS: 0 failed units, Enforcing, 0 new AVC (1 matching baseline), 0 GPU faults, 0 errors in this subsystem, real rtc1 s2idle 2/2 (success=2 fail=0), eDP connected pre/post-sleep, 406600000.sep + 514600000.mtp RTKit v12 (AppleMTPFirmwareMac-5340.61.4~502, HID keyboard/trackpad/accel/actuator/touch) clean, Borealis VK dEQP-VK.api.smoke.* 8/8 (pre & post-sleep) + glsl.loops.* 624/624, Wi-Fi 3/3 ping pre/post-sleep; stock 7.3.0-aurora-fleet89 restored & verified (b67edc6c).

@RyanTheTide
RyanTheTide merged commit 7d3b144 into main Nov 26, 2026
4 of 6 checks passed
@RyanTheTide
RyanTheTide deleted the fix/brcmfmac-skip-down-delay branch November 27, 2026 13:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:gpu Area from CODEOWNERS (bot) area:wireless Area from CODEOWNERS (bot) blast:all Macs affected, from Merge risk (bot) ci-failing A check failed at the PR head (bot) door:two-way Revertible or not, from Merge risk (bot)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants