Repository navigation
wifi: apple: centauri: t6050: report station statistics and use a wake's warm reset once - #3946
tully-8888 wants to merge 6 commits into
Conversation
…firmware Ask the firmware for its statistics reports (command 0xb0001, TLV 363) when cfg80211 reads the station, as the shared transport driver does: chip counters for TX retries, failures and rates, the TX report for the MCS, width, NSS and GI, frame counters for beacons and the PHY dump for per-chain signal. Add a survey of the operating channel with its noise and CCA load, and take the firmware version from the reply to command 0. The reports are optional. A query the firmware refuses is not sent again, and one it consumes without a reply stops them all after 500 ms instead of faulting the interface. Every TLV is bounds checked, and a missing report leaves its station fields unset. Signed-off-by: vlad <tulituvlad@gmail.com>
…he link A statistics query the firmware still holds after 500 ms now gets the full 1.5 s command deadline; only one it consumed without a reply ends early. Record reply status and command only for the sequence being waited for, so a late reply to an abandoned query cannot hide the completion of the next command. Cache a refused statistics report per slice and still try slice 1 after a refused slice 2. Prefer the CCA slot that matches the link's primary channel position, count only awake time as survey time, and stop reporting missed beacons as beacon loss events. Signed-off-by: vlad <tulituvlad@gmail.com>
The CCA report's per-read deltas are inconsistent with each other: in one second with power save on, the primary tx time grew by 30.9 ms and the summed busy time by 40.0 ms, while the awake time grew by 5.0 ms. No time base the report carries is known to give a valid busy or tx time, so report only the channel noise and stop querying the CCA report. Signed-off-by: vlad <tulituvlad@gmail.com>
The host sets its warm-reset flag when it resets the N1 in a wake's noirq resume and clears it only at the next suspend prepare. A port cycle for recovery leaves it set too. Any later recovery in the same wake, such as a Bluetooth unbind that cannot fence its DMA or a probe failure, then reads the old flag, skips the port cycle and enumerates the functions again on firmware that was never reset. Record that the wake's reset went to an enumeration and cycle the port for every later recovery. A PM notifier clears the record at suspend prepare, where the host clears its flag. Signed-off-by: vlad <tulituvlad@gmail.com>
A recovery owner allocated in the middle of a wake, after a module reload, started with host_reset_used false while the PCI host still reported this wake's warm reset as done, so the next recovery could skip the port cycle on firmware that was never reset. Start a new owner with the reset taken as used; the suspend-prepare notifier clears it for the first sleep the owner sees. Signed-off-by: vlad <tulituvlad@gmail.com>
|
Merge readiness at
Areas: Updated by pr-readiness on pushes, edits, reviews and comments, and on a schedule. Rules: merge policy · labels. |
DjDeveloperr
left a comment
There was a problem hiding this comment.
The code looks right to me at 0f62a44. The TLV reads are bounds-checked, a refused or unanswered query stops that query instead of faulting the link, and every command sets reply_capture, so the stricter reply match in drain() is safe.
Two things before merge:
- host-tests fail because of this PR, in three harnesses that copy driver code. I reproduced all three with this diff applied to main 1da28cf, where they pass without it:
centauri-wifi-pm-tests:struct centauri_t6050_wifihas nocommand_probe, andtime_after()andcommand_payload_consumed()are not declared.centauri-scan-tests:fill_station_stats()is not declared.centauri-physical-recovery-tests:struct centauri_t6050_rewakehas nohost_reset_used.
- The J714s row covers the statistics, but not the last two commits (the warm-reset bookkeeping). They need a sleep/wake with Wi-Fi recovery on J714s, plus the second recovery inside one wake that you list under Not yet.
Small note, not a blocker: station_bw_primary and station_bw_valid are set but nothing reads them yet.
Three host tests copy or model t6050 driver code that this series changed, so they no longer built: - centauri-wifi-pm-tests: command_reply() gives up an optional query the firmware consumed but did not answer. Model command_probe and extract command_payload_consumed(). Check that such a query ends with -ENODATA and no fault, that one the firmware still holds and any other command keep the full deadline and fault, and that the next command gets its own reply. - centauri-scan-tests: fill_station() now reads the statistics. Run stats_query() from it and check that a station read during a scan sends no statistics command, like command 20. - centauri-physical-recovery-tests: model host_reset_used and extract the PM notifier. Check that the host's warm reset serves one enumeration per wake, that a later recovery cycles the port, that the next suspend makes the reset usable again and that a refused recovery does not use it. Add a negative control for each new check. The driver is unchanged. Signed-off-by: DjDeveloperr <hey@djdev.me>
|
I pushed 80ab0c0 on top of 0f62a44. It fixes the three host-test harnesses from my earlier review. Only
All existing negative controls still reject. There are six new ones, one for each new check: Results, in the host-tests.yml image (ubuntu 24.04 pins):
Still needed on J714s: |
There was a problem hiding this comment.
Verdict: MERGE at 80ab0c0
Checked: The current revision restores the earlier failing host fixtures. I ran the exact scan, Wi-Fi PM and physical-recovery suites. The optional query can exit early only after firmware consumes its specific payload, ordinary requests retain their deadline, and recovery can use the host's warm reset only once per wake. The driver's report processing bounds the TLV slices and leaves unavailable statistics unset.
Follow-ups: Please send the independent statistics and warm-reset changes separately in future revisions to make the production diff easier to review.
What: Report station rates and counters from the firmware's statistics reports (command 0xb0001), as the shared transport driver does since #3458, so
iw station dumpon t6050 shows TX and RX bitrate, MCS, NSS, GI, retries, failures, beacons and per-chain signal. The survey reports channel noise only, because the CCA report's busy and TX times do not add up. A second recovery in one wake now cycles the port instead of reusing that wake's host warm reset on firmware that was never reset.Tested: J714s (MacBook Pro 14-inch, M5 Pro) at 0f62a44 (the driver code at the head 80ab0c0 is the same; that commit only updates the host tests in tools/asahi), loaded as a module on a local 7.3 kernel: station dump with TX 720.6 to 864.8 Mbit/s at 80 MHz HE-MCS 7 to 8 NSS 2, RX 1201.0 Mbit/s, TX retries, TX failed 0, beacon RX and per-chain signal; survey with noise only (-90 dBm); gateway ping p50 3.60 / p99 8.60 ms, 0% loss; LAN TCP throughput and latency under load unchanged with station dumps running.
Risk: two-way door · Macs that bind
apple_centauri_t6050(M5 Pro, M5 Max)Not yet: on J714s, a sleep/wake with Wi-Fi recovery, and a module reload in the same wake. The reload shows only that Wi-Fi comes back after a reload in that wake: the removal cycles the port itself, so the new probe starts from the ROM. The new owner's record of the used host reset (0f62a44) and a second recovery by the same owner inside one wake (3611b3f) are covered by the host tests only; there is no user-space trigger for them on J714s.
Details
Statistics: on a station read, the driver asks for the chip counters (TX retries, failures, rates), the TX report (MCS, width, NSS, GI), the frame counters (beacons) and the PHY dump (per-chain signal). Each query runs at most once per second. The reports are optional: a refused query is cached per slice and not sent again, and one the firmware consumes without a reply ends the queries after 500 ms instead of faulting the interface. A query the firmware still holds gets the full 1.5 s command deadline. Reply status is recorded only for the sequence being waited for, so a late reply to an abandoned query cannot complete the next command. Every TLV is bounds checked, and a missing report leaves its fields unset. The firmware version comes from the reply to command 0. Beacon loss events are not reported, because the firmware counts missed beacons, not loss events.
Survey: in one second with power save on, the CCA report's primary TX time grew by 30.9 ms and its summed busy time by 40.0 ms, while the awake time grew by 5.0 ms. No time base in the report gives a valid busy or TX time, so the survey keeps only the noise and the CCA report is no longer queried.
Warm reset: the PCI host sets its warm reset flag when it resets the N1 in a wake's noirq resume and clears it only at the next suspend prepare. A later recovery in the same wake (a Bluetooth unbind that cannot fence its DMA, a probe failure) read the stale flag, skipped the port cycle and enumerated the functions again on firmware that was never reset. The driver now records that the wake's reset was used and cycles the port for every later recovery; a PM notifier clears the record at suspend prepare. A recovery owner created mid-wake, for example after a module reload, starts with the reset taken as used. This builds on the recovery from #3346. #2191 also changes the t6050 recovery path, for a different case.
Evidence
At 0f62a44 on the J714s, module built against the running kernel and swapped in live:
iw dev wlan0 station dump, 3 times at 2 siw dev wlan0 survey dumpLAN load, 4 TCP streams in each direction to a wired host for 60 s, gateway ping under load, median of 3 runs:
No kernel line during the LAN runs. The only kernel warnings in the run are the ones every module reload prints, the stock module included: probe error -108 while the chip resets, and a first join that times out with firmware status 306 before the retry joins.
Earlier, station statistics, first two commits loaded as a module on a local 7.3 kernel (
iw dev wlan0 station dump3 times at 2 s, gateway ping 1000 x 20 ms with a station dump every second):The five driver commits booted (with the data path change noted above): station dump TX 960.7 Mbit/s 80 MHz HE-MCS 9 HE-NSS 2, RX 1201.0 Mbit/s, TX retries and beacon RX counting;
iw dev wlan0 survey dumpshows noise -90 dBm and no busy or TX time; 0 driver warnings since boot.At 0f62a44:
make LLVM=1 W=1 M=drivers/net/wireless/apple/centauri modulesbuilds with 0 warnings;checkpatch.pl --stricton the five driver commits: 0 errors, 0 warnings. 80ab0c0 updates the host tests for the statistics and warm reset changes.