wifi: ath11k: clamp survey noise floor on QCA6390
PATCH 1/1 wifi: ath11k: clamp survey noise floor on QCA6390
QCA6390 firmware reports channel noise floor values of -111 to -118 dBm in the chan info and pdev bss chan info events. The driver passes them unchanged to cfg80211 as the survey noise floor.
These values don't match the signal levels reported by the driver. For management frames, ath11k_mgmt_rx_event() calculates the signal level as rx_ev.snr + ATH11K_DEFAULT_NOISE_FLOOR (-95 dBm). User space calculates the SNR of a scan result as signal level minus survey noise floor, so with a noise floor of -116 dBm, the SNR is 21 dB higher than the SNR reported by the firmware.
The values are also far below the real noise floor. On an AP received at -88 dBm, the AP transmitted to the station at 6.5 Mbit/s (MCS 0), and the station transmitted at 13 to 27 Mbit/s. A noise floor of -116 dBm would mean an SNR of about 28 dB, which allows much higher rates.
wpa_supplicant uses the SNR to calculate the estimated throughput of scan results, and roams within an ESS when another BSS has a higher estimated throughput. In an ESS with many APs, the station repeatedly roamed from an AP at -60 dBm to an AP at -90 dBm:
Current BSS: ... freq=5580 level=-59 snr=57 est_throughput=180001 Selected BSS: ... freq=5180 level=-90 snr=26 est_throughput=263301 Allow reassociation - selected BSS has better estimated throughput
The station roamed to that AP twice within 15 minutes. After the first roam, the connection was lost after about 100 seconds because of beacon loss.
Add a hw_params flag to clamp the survey noise floor to ATH11K_DEFAULT_NOISE_FLOOR, and enable it for QCA6390. The noise floor is still reported, so users that require it, such as hostapd ACS, keep working. Other chips are not changed.
With this change, the distant AP, received at -88 to -90 dBm, gets an SNR of 5 to 7 dB and an estimated throughput of 18 to 26 Mbit/s instead of 263 Mbit/s. In a one hour test at the same desk, the station stayed on an AP at about -68 dBm the whole time, with 0.2% ping loss. Directly afterwards, with the unpatched driver, the station connected to the distant AP at -89 dBm, with 53% ping loss, and the test had to be stopped after three minutes.
The problem was analyzed and this patch was developed with the help of an AI coding assistant (Claude Code, model claude-opus-5-5). The assistant analyzed the debug logs and the driver code, and wrote the code and this commit message. I reviewed the change and tested it on my laptop as described above.
Tested-on: QCA6390 hw2.0 PCI WLAN.HST.1.0.1-05266-QCAHSTSWPLZ_V2_TO_X86-1
---
Notes:
- Only QCA6390 is changed because it is the only chip I could test. I don't know whether other chips (e.g. WCN6855) report similar values. If they do, the flag can be enabled for them, or the clamp could be made unconditional.
- The noise floor is clamped instead of not reported, because hostapd ACS ignores surveys without a noise floor (acs_survey_is_sufficient()).
- ATH11K_DEFAULT_NOISE_FLOOR is used as the limit because it is the noise floor that the driver already assumes for the signal level of management frames. It also matches the link rates observed above.
- The survey noise floor has been reported unchanged since the initial driver commit d5c65159f289, which supported only IPQ8074. The Fixes tag points to the commit that added QCA6390, because the problem was observed there and the change only affects QCA6390.
- I don't know what the chan info noise_floor value refers to in the firmware. If there is a known conversion to dBm, using it would be better than clamping.
- AI assistance: I asked the assistant to find out why my laptop's WiFi was unreliable in one office while it worked elsewhere. It collected and analyzed wpa_supplicant/NetworkManager debug logs and per-second link measurements, found the cause in the driver, and wrote the patch. Over several iterations we changed the approach: from not reporting the noise floor (would break hostapd ACS), to a generic clamp (would affect chips I can't test), to this QCA6390-only clamp.
drivers/net/wireless/ath/ath11k/core.c | 1 + drivers/net/wireless/ath/ath11k/hw.h | 1 + drivers/net/wireless/ath/ath11k/wmi.c | 20 ++++++++++++++++++-- 3 files changed, 20 insertions(+), 2 deletions(-)
drivers/net/wireless/ath/ath11k/core.c +1 -0
@@ -306,6 +306,7 @@ static const struct ath11k_hw_params ath11k_hw_params[] = { .cfr_support = false, .cfr_num_stream_bufs = 0, .cfr_stream_buf_size = 0, + .clamp_survey_noise_floor = true, }, { .name = "qcn9074 hw1.0",
drivers/net/wireless/ath/ath11k/hw.h +1 -0
@@ -231,6 +231,7 @@ struct ath11k_hw_params {bool cfr_support;u32 cfr_num_stream_bufs;u32 cfr_stream_buf_size; +bool clamp_survey_noise_floor; };struct ath11k_hw_ops {
drivers/net/wireless/ath/ath11k/wmi.c +18 -2
@@ -7970,6 +7970,22 @@ static void ath11k_roam_event(struct ath11k_base *ab, struct sk_buff *skb)rcu_read_unlock (); } +/* The firmware of some chips reports channel noise floor values far below +* the actual noise floor, e.g. -111 to -118 dBm on QCA6390. Signal levels +* of received management frames are calculated as rx_ev.snr + +* ATH11K_DEFAULT_NOISE_FLOOR in ath11k_mgmt_rx_event(), so user space +* calculates a far too high SNR for scan results from such a noise floor. +* On these chips, don't report noise floor values below +* ATH11K_DEFAULT_NOISE_FLOOR. +*/ +static s8 ath11k_wmi_survey_noise_floor (struct ath11k_base *ab,s32 noise_floor) +{ +if (ab->hw_params.clamp_survey_noise_floor) +return max_t (s32, noise_floor,ATH11K_DEFAULT_NOISE_FLOOR ); + +return noise_floor; +} +static void ath11k_chan_info_event (struct ath11k_base *ab,struct sk_buff *skb) {struct wmi_chan_info_event ch_info_ev = {};
@@ -8032,7 +8048,7 @@ static void ath11k_chan_info_event(struct ath11k_base *ab, struct sk_buff *skb)if (ch_info_ev.cmd_flags ==WMI_CHAN_INFO_START_RESP ) { survey = &ar->survey[idx];memset (survey,0 ,sizeof (*survey)); - survey->noise = ch_info_ev.noise_floor; + survey->noise =ath11k_wmi_survey_noise_floor (ab, ch_info_ev.noise_floor); survey->filled =SURVEY_INFO_NOISE_DBM |SURVEY_INFO_TIME |SURVEY_INFO_TIME_BUSY ; survey->time =div_u64 (ch_info_ev.cycle_count, cc_freq_hz);
@@ -8099,7 +8115,7 @@ ath11k_pdev_bss_chan_info_event(struct ath11k_base *ab, struct sk_buff *skb) survey = &ar->survey[idx]; - survey->noise = bss_ch_info_ev.noise_floor; + survey->noise =ath11k_wmi_survey_noise_floor (ab, bss_ch_info_ev.noise_floor); survey->time =div_u64 (total, cc_freq_hz); survey->time_busy =div_u64 (busy, cc_freq_hz); survey->time_rx =div_u64 (rx_bss, cc_freq_hz);
Signature · 1 line
2.53.0