From: Felix Fietkau <nbd@nbd.name>
To: Michael Shih <michael.shih@mediatek.com>, lorenzo@kernel.org
Cc: linux-wireless@vger.kernel.org,
linux-mediatek@lists.infradead.org, kun.wu@mediatek.com,
deren.wu@mediatek.com, sean.wang@mediatek.com,
quan.zhou@mediatek.com, ryder.lee@mediatek.com,
leon.yen@mediatek.com, litien.chang@mediatek.com,
jb.tsai@mediatek.com, eason.Lai@mediatek.com
Subject: Re: [PATCH v6 2/2] wifi: mt76: mt7925: support per-channel survey dump during scan
Date: Wed, 25 Nov 2026 14:24:56 +0100 [thread overview]
Message-ID: <2ea4dc91-9235-4b54-ad7e-0fcefcb933e5@nbd.name> (raw)
In-Reply-To: <20261117032530.470475-3-michael.shih@mediatek.com>
Hi,
On 17.11.26 04:25, Michael Shih wrote:
> Report per-channel survey airtime (active/busy/rx/tx) so that
> "iw <dev> survey dump" shows non-zero airtime not only for the
> connected home channel, but also for every channel visited during
> a firmware-offloaded scan.
>
> Two accounting paths are wired up:
>
> (1) Home/operating channel (periodic mac_work):
> mt7925 is firmware/chanctx managed and never goes through
> __mt76_set_channel(), so phy->chan_state used to stay pinned to
> its init default and the periodic survey was charged to the wrong
> channel. mt7925_survey_switch_channel() is added and called from
> assign_vif_chanctx() to settle the old channel, re-point
> chan_state/chandef to the operating channel, and re-base the
> firmware MIB snapshot so active/busy/rx/tx keep accumulating on
> the channel actually dwelt on.
>
> (2) Scanned channels (scan-done event):
> The scan-done CHNLINFO event now carries per-channel airtime
> (firmware Ch-Survey extension). mt7925_scan_update_survey() parses
> the per-channel array and folds the airtime deltas into each
> channel's mt76_channel_state. The firmware 6G channel id is
> converted back to the real channel number before lookup.
>
> mt76_channel_state() is exported so the mt7925 module can map a
> band/channel pair to its channel state.
>
> Usage:
> (1) Connect STA to AP and generate traffic:
> dhclient ${WLAN_IF} -v
> ping 192.168.0.XXX -i0.1
>
> (2) (Optional) Trigger a scan to collect other channels:
> iw ${WLAN_IF} scan
> or use wpa_supplicant / wpa_cli scan.
>
> (3) Dump the survey:
> iw ${WLAN_IF} survey dump
>
> (4) You will see per-channel airtime, e.g.:
> Survey data from wls1
> frequency: 5240 MHz
> channel active time: 163258 ms
> channel busy time: 34076 ms
> channel receive time: 32084 ms
> channel transmit time: 253 ms
> - The connected/dwelt channel keeps increasing over time.
> - Channels visited during scan accumulate airtime each scan.
I've tested a rebased version of this patch with firmware 20260813 and
found a few discrepancies:
- the idle counter seems to count slots of about 8 us, not microseconds,
so busy + idle gives about 1/8 of real time.
- the code always queries band 0. With MLO, the firmware puts the second
link on band 1, so that link's airtime is missed.
Thanks,
- Felix
next prev parent reply other threads:[~2026-11-25 13:25 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-24 3:07 [PATCH v1] wifi: mt76: mt7928: Add debugfs for stats to provide debug purpose Eason Lai
2026-08-25 4:00 ` kernel test robot
2026-08-25 7:55 ` kernel test robot
2026-08-27 5:54 ` [PATCH v2] " Eason Lai
2026-08-27 8:44 ` [PATCH v3] " Eason Lai
2026-08-28 7:39 ` kernel test robot
2026-08-31 3:28 ` [PATCH v4] " Eason Lai
2026-11-12 7:55 ` [PATCH v5 0/2] wifi: mt76: mt7925: per-channel survey dump during scan Michael Shih
2026-11-12 7:55 ` [PATCH v5 1/2] wifi: mt76: mt7928: Add debugfs for stats to provide debug purpose Michael Shih
2026-11-13 0:46 ` kernel test robot
2026-11-13 11:09 ` kernel test robot
2026-11-17 3:25 ` [PATCH v6 0/2] wifi: mt76: mt7925/mt7928: per-channel survey dump during scan Michael Shih
2026-11-17 3:25 ` [PATCH v6 1/2] wifi: mt76: mt7928: Add debugfs for stats to provide debug purpose Michael Shih
2026-11-17 3:25 ` [PATCH v6 2/2] wifi: mt76: mt7925: support per-channel survey dump during scan Michael Shih
2026-11-25 13:24 ` Felix Fietkau [this message]
2026-11-12 7:55 ` [PATCH v5 " Michael Shih
2026-11-13 15:00 ` Devin Wittmayer
2026-11-17 2:51 ` Michael Shih (史君仲)
2026-11-17 14:58 ` Chris
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=2ea4dc91-9235-4b54-ad7e-0fcefcb933e5@nbd.name \
--to=nbd@nbd.name \
--cc=deren.wu@mediatek.com \
--cc=eason.Lai@mediatek.com \
--cc=jb.tsai@mediatek.com \
--cc=kun.wu@mediatek.com \
--cc=leon.yen@mediatek.com \
--cc=linux-mediatek@lists.infradead.org \
--cc=linux-wireless@vger.kernel.org \
--cc=litien.chang@mediatek.com \
--cc=lorenzo@kernel.org \
--cc=michael.shih@mediatek.com \
--cc=quan.zhou@mediatek.com \
--cc=ryder.lee@mediatek.com \
--cc=sean.wang@mediatek.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox