]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
Skip roaming based on signal level difference if current SNR is good
authorJouni Malinen <j@w1.fi>
Wed, 1 Jan 2020 14:56:40 +0000 (16:56 +0200)
committerJouni Malinen <j@w1.fi>
Wed, 1 Jan 2020 14:56:40 +0000 (16:56 +0200)
If the current SNR with the associated BSS is sufficiently good (better
than GREAT_SNR = 25), there is limited benefit from moving to another
BSS even if that BSS were to have a higher signal level. As such, skip
roaming based on the signal level difference between the selected BSS
from scan results and the current BSS for such cases.

Signed-off-by: Jouni Malinen <j@w1.fi>
wpa_supplicant/events.c

index 08c375fffb29832113c6116059618436a8c2a4b4..f7997d5fc2db73db7b68d93ff4ca90572c18532c 100644 (file)
@@ -1704,6 +1704,7 @@ static int wpa_supplicant_need_to_roam(struct wpa_supplicant *wpa_s,
        int cur_level;
        unsigned int cur_est, sel_est;
        struct wpa_signal_info si;
+       int cur_snr = 0;
 #endif /* CONFIG_NO_ROAMING */
 
        if (wpa_s->reassociate)
@@ -1774,19 +1775,17 @@ static int wpa_supplicant_need_to_roam(struct wpa_supplicant *wpa_s,
         */
        if (wpa_drv_signal_poll(wpa_s, &si) == 0 &&
            (si.avg_beacon_signal || si.avg_signal)) {
-               int snr;
-
                cur_level = si.avg_beacon_signal ? si.avg_beacon_signal :
                        si.avg_signal;
-               snr = wpas_get_snr_signal_info(si.frequency, cur_level,
-                                              si.current_noise);
+               cur_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,
-                                                              snr);
+                                                              cur_snr);
                wpa_dbg(wpa_s, MSG_DEBUG,
                        "Using signal poll values for the current BSS: level=%d snr=%d est_throughput=%u",
-                       cur_level, snr, cur_est);
+                       cur_level, cur_snr, cur_est);
        }
 
        if (selected->est_throughput > cur_est + 5000) {
@@ -1809,6 +1808,13 @@ static int wpa_supplicant_need_to_roam(struct wpa_supplicant *wpa_s,
                return 0;
        }
 
+       if (cur_snr > GREAT_SNR) {
+               wpa_dbg(wpa_s, MSG_DEBUG,
+                       "Skip roam - Current BSS has good SNR (%u > %u)",
+                       cur_snr, GREAT_SNR);
+               return 0;
+       }
+
        sel_est = selected->est_throughput;
        min_diff = 2;
        if (cur_level < 0) {