Repository navigation
wifi: mt7932: bound the address-change wait to two seconds - #206
Merged
Merged
Conversation
An address change on a stopped interface waits for a cancelled scan to retire before it checks whether the address can change. The change runs under RTNL, and the wait is documented as lasting at most two seconds, but it is longer in two cases: - mt_scan_quiesce() first waits up to five seconds for the scan to complete, and the two-second loop only starts after that, so a firmware that never retires the scan holds RTNL for about seven seconds; - once the driver is stopping, mt_stop_host() has completed scan_done for good, so every wait in the loop returns at once and the loop spins for two seconds. The interface is already down at this point, so its scan has been cancelled and only the retirement is left to wait for. Cancel any scan that is still recorded, then wait for the retirement against a single two-second deadline, and stop waiting as soon as the driver is stopping. The address change itself is unchanged: it is still refused with -EBUSY while a retirement is outstanding. Fixes: 22fc65c ("wifi: mt7932: let an address change wait for a retiring scan") Assisted-by: LLM Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
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.
A follow-up to #204 from its post-merge review. One commit.
What
An address change on a stopped interface still waits for a cancelled scan to retire before it decides whether the address can change. That wait now has a single two-second deadline, and it ends as soon as the driver is stopping.
Why
The change runs under RTNL, and the wait is documented as lasting at most two seconds. In two cases it was longer:
mt_scan_quiesce()first waited up to five seconds for the scan to complete. The two-second retirement loop only started after that, so a firmware that never retires the scan held RTNL for about seven seconds.mt_stop_host()completesscan_donefor good. Every wait in the loop then returned at once, and the loop spun until its deadline.The interface is down at this point, so its scan has already been cancelled and only the retirement is left to wait for. The new helper:
The address change itself is unchanged. It is still refused with
-EBUSYwhile a retirement is outstanding, and it is still refused on a running interface. The normal path, where the firmware retires the scan promptly, behaves as before.Fixes: 22fc65ce6709 ("wifi: mt7932: let an address change wait for a retiring scan")Testing
Hardware-tested on the MacBook Neo (J700), kernel
7.1.12-aurora-j700-fu1+(all seven follow-ups merged ontoaurora-wip35c7d87), compared item for item with the default kernel built from that base: a NetworkManager MAC-policy toggle on the 5 GHz profile (permanent → stable → permanent) reconnected in 0.5 s each time (previous kernel: 4.2 s / 0.6 s), with no driver refusals, no NetworkManager MAC-set failures and no packet loss. A MAC change while a scan is still running, and the stopping path, are covered by review only.arch/arm64/configs/j700-radio.config;defconfig+asahi.configwith every Apple Silicon driver as a module (16K pages, Rust).aurora-wip(35c7d87921c0).Assisted-by: LLMtrailer-format warning.aurora-wipand with the other follow-up branches.Provenance
Written for this PR from the public driver source and the review finding.
🤖 Generated with Claude Code