From 9fafefb9e5fdd9467bb78d4cc83951d2f4667b8b Mon Sep 17 00:00:00 2001 From: Jouni Malinen Date: Wed, 1 Jan 2020 16:56:40 +0200 Subject: [PATCH] Skip roaming based on signal level difference if current SNR is good 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 --- wpa_supplicant/events.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/wpa_supplicant/events.c b/wpa_supplicant/events.c index 08c375fff..f7997d5fc 100644 --- a/wpa_supplicant/events.c +++ b/wpa_supplicant/events.c @@ -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) {