Repository navigation
Conversation
chriskearney
left a comment
There was a problem hiding this comment.
Requesting changes on 5f0966df72cabe2d69c87771fb8cedad189a256f: the flowring reclaim can recycle transmit buffers before firmware ownership has ended. Details inline.
The bounded BCM4378 assoc_info retry is separable from this reclaim change.
Validation: source review of the allocation, reclaim and completion paths. I have not built or boot-tested this head, or reproduced a hardware failure.
| * completes them late, or not at all once the bus is down. | ||
| * Reclaim the pktids so a late txstatus finds them free. | ||
| */ | ||
| brcmf_msgbuf_reclaim_flowring_tx(msgbuf, flowid); |
There was a problem hiding this comment.
Please defer reclaim and pktid reuse until firmware can no longer access these buffers. This call runs before the bus-state check and before FLOW_RING_DELETE is submitted, so closing the host ring does not establish that firmware has drained it.
take_pktid() immediately unmaps the DMA buffer and marks the slot FREE. The allocator can reuse that slot, while process_txstatus() looks it up using only request_id - 1 (match_flow=false, no generation check). A delayed completion for the reclaimed frame can then claim and unmap a newer frame occupying the same slot. The atomic claim prevents concurrent host claims, but cannot distinguish those two allocations.
Please preserve buffer ownership until a protocol-defined completion/quiescence point and prevent stale completions from consuming reused slots. The added KUnit policy tests do not cover this lifetime ordering.
|
Tested on a J313 (M1 Air). This fixes what it targets, but the device suspend phase now fails on 2 of 2 boots (the baseline passed 1 of 1, and a second baseline run is queued to rule out flakiness). Improved vs the baseline (
Regression: brcmfmac fails the device suspend phase. On both boots, the
I haven't tied the fault to a specific path. It fits a reclaimed tx pktid whose buffer the firmware still referenced: Not run: the How this was tested
|
…p and roam BCM4378/3 (PCI 14e4:4425 rev 03, firmware 18.20.383 loaded as brcmfmac4378b1-pcie) returns a firmware error from assoc_info while a connect or roam is still committing, which fwil surfaces as -EBADE (-52). The same windows drop in-flight flowring frames without a txstatus. brcmf_msgbuf_delete_flowring() waits about 75 ms per ring on the event worker, logs the timeout, and zeros outstanding_tx while the pktids stay allocated. On this chip, reclaim those pktids instead of waiting, and retry assoc_info up to eight times (175 ms of backoff) only after -EBADE. Other chips keep the historical wait and do not retry. Signed-off-by: Lucas Goossen <lucas.goossen@hey.com>
5f0966d to
3a93601
Compare
|
Follow-up after more runs: 4 automated boots of this PR, 4 of the baseline, and one hands-on real sleep. My earlier comment overstated the fix. The baseline's Wi-Fi failure is intermittent, and with more runs this PR doesn't measurably improve re-association. The suspend regression showed up on every boot, and also in real use.
Real lid-close sleep:
In normal use this shows up as a delayed sleep, about 45 s here, with a userspace driver reload covering for it. The automated A hypothesis I haven't verified: the D3 handshake and the commonring time out because the firmware still holds tx frames whose pktids the host reclaimed in How this was tested
|
On BCM4378 only, retry
assoc_infoafter-EBADE(-52) and reclaim a flowring's tx pktids instead of waiting for a txstatus that does not arrive.BCM4378/3 answers
assoc_infowith a firmware error while a connect or roam is still committing. fwil reports that as-EBADE. The same windows drop in-flight flowring frames without a txstatus, andbrcmf_msgbuf_delete_flowring()then waits about 75 ms on the event worker, logs the timeout, and zerosoutstanding_txwhile those pktids stay allocated. This chip retriesassoc_infoup to eight times (175 ms of backoff) only after-EBADE, and reclaims that ring's tx pktids instead of waiting. Other chips keep the historical wait and do not retry.Machine: MacBook Air M1 2020 (J313), PCI 14e4:4425 rev 03, firmware 18.20.383 loaded as
brcmfmac4378b1-pcie.Session build, Monday 26 Oct 2026 05:02 PM -03: linux-aurora 7.2.11-6-2-ARCH (package 7.2.11.aurora6-2), branch local/j313-test at 7638df0. makepkg exited 0. rustc 1.85.0, LLVM/clang 18.1.8. This machine is running that kernel. The stacked commit compiled in was f07926d. This pull request's head is 3a93601, which is not the commit that was built.
Host policy check of
sleep_roam.hprintedok. The KUnit suitebrcmfmac-sleep-roamwas not run. Wi-Fi sleep/roam stress has not been run on this kernel.