Improve roaming logic

Currently, wpa_supplicant may roam too aggressively; the need_to_roam()
function will return early with a roaming decision if the difference in
signal level or throughput between the current and selected APs is
"sufficiently large." In particular, if the selected AP's estimated
throughput is more than 5k greater than the current AP's estimated
throughput, wpa_supplicant will decide to roam. Otherwise, if the
selected AP's signal level is less than the current AP's signal level,
or the selected AP's estimated throughput is at least 5k less than the
current AP's estimated throughput, wpa_supplicant will skip the roam.
These decisions are based only on one factor and can lead to poor
roaming choices (e.g., a roam should not happen if the selected AP's
estimated throughput meets the threshold but the current signal and
throughput are already good, whereas a roam should happen if the signal
is slightly worse but the estimated throughput is significantly better).

This change standardizes the roaming heuristic for signal strength
difference requirements and will hopefully improve user experience. The
change can be summarized as follows: based on the current signal level,
a certain roaming difficulty is assigned. Based on the selected AP's
estimated throughput relative to the current AP's estimated throughput,
the difficulty is adjusted up or down. If the difference in signal level
meets the threshold, a roam happens.

The hard-coded values were selected purely based on the previous version
of this function. They may eventually need to be fine-tuned for optimal
performance.

Signed-off-by: Matthew Wang <matthewmwang@chromium.org>
This commit is contained in:
Matthew Wang 2018-07-17 10:56:21 -07:00 committed by Jouni Malinen
parent 9c8d550b77
commit a2c1bebd43

View file

@ -1829,32 +1829,28 @@ static int wpa_supplicant_need_to_roam(struct wpa_supplicant *wpa_s,
min_diff = 4; min_diff = 4;
else else
min_diff = 5; min_diff = 5;
if (cur_est > sel_est * 1.5)
min_diff += 10;
else if (cur_est > sel_est * 1.2)
min_diff += 5;
else if (cur_est > sel_est * 1.1)
min_diff += 2;
else if (cur_est > sel_est)
min_diff++;
} }
if (to_5ghz) {
int reduce = 2;
/* Make it easier to move to 5 GHz band */ if (cur_est > sel_est * 1.5)
if (sel_est > cur_est * 1.5) min_diff += 10;
reduce = 5; else if (cur_est > sel_est * 1.2)
else if (sel_est > cur_est * 1.2) min_diff += 5;
reduce = 4; else if (cur_est > sel_est * 1.1)
else if (sel_est > cur_est * 1.1) min_diff += 2;
reduce = 3; else if (cur_est > sel_est)
min_diff++;
else if (sel_est > cur_est * 1.5)
min_diff -= 10;
else if (sel_est > cur_est * 1.2)
min_diff -= 5;
else if (sel_est > cur_est * 1.1)
min_diff -= 2;
else if (sel_est > cur_est)
min_diff--;
if (min_diff > reduce) if (to_5ghz)
min_diff -= reduce; min_diff -= 2;
else diff = selected->level - current_bss->level;
min_diff = 0;
}
diff = abs(cur_level - selected->level);
if (diff < min_diff) { if (diff < min_diff) {
wpa_dbg(wpa_s, MSG_DEBUG, wpa_dbg(wpa_s, MSG_DEBUG,
"Skip roam - too small difference in signal level (%d < %d)", "Skip roam - too small difference in signal level (%d < %d)",