]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
Use signal_poll noise information for roaming, if available
authorJouni Malinen <j@w1.fi>
Wed, 1 Jan 2020 11:38:11 +0000 (13:38 +0200)
committerJouni Malinen <j@w1.fi>
Wed, 1 Jan 2020 11:38:11 +0000 (13:38 +0200)
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 <j@w1.fi>
wpa_supplicant/events.c

index cc6cb6716bbe0541a3ab44881764e99be4cb1f42..08c375fffb29832113c6116059618436a8c2a4b4 100644 (file)
@@ -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,