Skip to content

wifi: brcmfmac: msgbuf: keep the flowring tx count from going negative - #1081

Merged
RyanTheTide merged 1 commit into
integration/aurorafrom
fix/brcmfmac-flowring-outstanding
Nov 7, 2026
Merged

RyanTheTide merged 1 commit into
integration/aurorafrom
fix/brcmfmac-flowring-outstanding

Conversation

@RyanTheTide

Copy link
Copy Markdown
Contributor

Every Wi-Fi disconnect before system sleep logs brcmf_msgbuf_delete_flowring: timed out waiting for txstatus on the BCM4387 Macs (M1 Pro, M2): 10 lines in 12 sleep cycles on the M2 with fleet20, 2 to 14 per boot on the M1 Pro. The BCM4388 in the M4 Pro is not affected (0 in 14 deletes).

Cause: a kprobe on brcmf_msgbuf_delete_flowring() that reads every flowring's outstanding_tx shows two cases, and every timeout matches one of them:

  • Positive count (6 of 10): frames were queued to the AP when NetworkManager dropped the link for sleep. The firmware completes them only when it flushes the ring for the delete request, so the wait before that request can't succeed.
  • Negative count (4 of 10): after a timeout the count is set to zero. The late completions then take it below zero, and nothing resets it when the flowid is used again, so the next delete on that flowid also waits out its full ~75 ms.

Change:

  • Reset the count when a ring is created.
  • Use atomic_dec_if_positive() on tx completion.
  • Log the timeout with brcmf_dbg(MSGBUF) and the count, since it is expected when the peer is gone. The ring is deleted either way, as before.

Testing: M2 (J413, BCM4387) on fleet20 (integration 98f6184), patched module swapped in live, then 6 systemd suspends and 6 direct /sys/power/state freezes with speakerguardd-v2 active:

stock fleet20 patched
"timed out waiting for txstatus" 10 0
deletes entered with a negative count 4 of 10 probed 0 of 19
Wi-Fi back after every cycle yes yes

The speaker gate was unchanged: every cycle regranted, with 0 faults, EPERM or AVC. The module also builds with W=1 and no msgbuf warnings, and checkpatch is clean.

Not covered: the separate firmware wedge on the M1 Pro (brcmf_msgbuf_query_dcmd_len: Timeout on response, seen once in about 84 pm_test cycles on fleet18) is not reproduced and is not addressed here.

🤖 Generated with Claude Code

Every Wi-Fi disconnect before system sleep logged
"brcmf_msgbuf_delete_flowring: timed out waiting for txstatus", one or
two per sleep cycle on BCM4387 Macs (M1 Pro, M2).

A kprobe on brcmf_msgbuf_delete_flowring() reading each flowring's
outstanding_tx showed two cases, 10 timeouts in 12 sleep cycles:

- the count is positive: frames were queued to the AP when the link
  went down, and the firmware completes them only when it flushes the
  ring for the delete request, so the wait before that request cannot
  succeed;
- the count is negative: after a timeout the count is set to zero,
  the late completions then take it below zero, and nothing resets it
  when the flowid is used again, so the next delete on that flowid
  waits out its full timeout as well.

Reset the count when a ring is created, never decrement it below zero,
and report the timeout at debug level with the count: it is expected
when the peer is gone, and the ring is deleted either way.

Signed-off-by: Ryan Murray <[email protected]>
Assisted-by: LLM
@RyanTheTide
RyanTheTide merged commit caa2071 into integration/aurora Nov 7, 2026
1 check passed
@RyanTheTide
RyanTheTide deleted the fix/brcmfmac-flowring-outstanding branch November 7, 2026 07:45
RyanTheTide added a commit that referenced this pull request Nov 7, 2026
Brings aurora-wip up to the tested release branch: CTXR execmem
(#985, #1079), KFIX speaker sleep and resume fixes (#1077, #1080),
JPEG v2 (#1072), Jonathan's G17 and USB work (#1073-#1076), brcmfmac
flowring count (#1081), ANE H16 startup restart (#1066) and the
Touch ID per-prompt match (#904).

Signed-off-by: Ryan Murray <[email protected]>
Assisted-by: LLM
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