From f4f7600adf880f473057d6278c0317c19ae06cd4 Mon Sep 17 00:00:00 2001 From: Jouni Malinen Date: Wed, 1 Jan 2020 13:38:11 +0200 Subject: [PATCH] Use signal_poll noise information for roaming, if available Using average signal strength from the driver and hardcoded noise floor does not look like an ideal design since there can be significant differences in the driver-reported noise floor values. Furthermore, even though the current noise floor is a snapshot from the driver, it is common for drivers to use a noise floor value from a longer calibration step and that should not prevent the driver provided value from being used. This makes the comparisons of the signal strengths between the current AP (signal_poll) and other APs (scan) more accurate. As an example, test runs in home environment showed 5 dB difference between the driver reported noise floor and the hardcoded value and this could result in significant differences in estimated throughput calculation. Signed-off-by: Jouni Malinen --- wpa_supplicant/events.c | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/wpa_supplicant/events.c b/wpa_supplicant/events.c index cc6cb6716..08c375fff 100644 --- a/wpa_supplicant/events.c +++ b/wpa_supplicant/events.c @@ -1672,17 +1672,11 @@ static void wpa_supplicant_rsn_preauth_scan_results( } -static int wpas_get_snr_signal_info(u32 frequency, int avg_signal) +static int wpas_get_snr_signal_info(u32 frequency, int avg_signal, int noise) { - int noise = IS_5GHZ(frequency) ? - DEFAULT_NOISE_FLOOR_5GHZ : - DEFAULT_NOISE_FLOOR_2GHZ; - - /* - * Since we take the average beacon signal, we can't use - * the current noise measurement (average vs. snapshot), - * so use the default values instead. - */ + if (noise == WPA_INVALID_NOISE) + noise = IS_5GHZ(frequency) ? DEFAULT_NOISE_FLOOR_5GHZ : + DEFAULT_NOISE_FLOOR_2GHZ; return avg_signal - noise; } @@ -1784,7 +1778,8 @@ static int wpa_supplicant_need_to_roam(struct wpa_supplicant *wpa_s, cur_level = si.avg_beacon_signal ? si.avg_beacon_signal : si.avg_signal; - snr = wpas_get_snr_signal_info(si.frequency, cur_level); + snr = wpas_get_snr_signal_info(si.frequency, cur_level, + si.current_noise); cur_est = wpas_get_est_throughput_from_bss_snr(wpa_s, current_bss,