Skip to content

wifi: mt7932: bound the address-change wait to two seconds - #206

Merged
RyanTheTide merged 1 commit into
aurora-wipfrom
fix/mt7932-mac-change-wait
Oct 8, 2026
Merged

RyanTheTide merged 1 commit into
aurora-wipfrom
fix/mt7932-mac-change-wait

Conversation

@RyanTheTide

@RyanTheTide RyanTheTide commented Oct 8, 2026 •

Copy link
Copy Markdown
Contributor

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:

  • About 7 s with RTNL held. 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.
  • A 2 s busy loop when stopping. mt_stop_host() completes scan_done for 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:

  1. cancels any scan that is still recorded;
  2. waits for the retirement against one deadline computed at the start;
  3. stops waiting once the driver is stopping.

The address change itself is unchanged. It is still refused with -EBUSY while 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 onto aurora-wip 35c7d87), 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.

  • Builds, W=1 on the touched directories, then a full Image + modules + dtbs, on two configurations:
    • the J700 configuration with arch/arm64/configs/j700-radio.config;
    • arm64 defconfig + asahi.config with every Apple Silicon driver as a module (16K pages, Rust).
  • Warnings: both builds pass with no new warnings compared with aurora-wip (35c7d87921c0).
  • checkpatch --strict: clean, apart from the project's Assisted-by: LLM trailer-format warning.
  • Merge check: merges cleanly with aurora-wip and with the other follow-up branches.

Provenance

Written for this PR from the public driver source and the review finding.

🤖 Generated with Claude Code

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>
@RyanTheTide
RyanTheTide merged commit 64fd324 into aurora-wip Oct 8, 2026
@DjDeveloperr
DjDeveloperr deleted the fix/mt7932-mac-change-wait branch October 12, 2026 19:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant