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:
parent
9c8d550b77
commit
a2c1bebd43
1 changed files with 19 additions and 23 deletions
|
@ -1829,6 +1829,8 @@ 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)
|
if (cur_est > sel_est * 1.5)
|
||||||
min_diff += 10;
|
min_diff += 10;
|
||||||
else if (cur_est > sel_est * 1.2)
|
else if (cur_est > sel_est * 1.2)
|
||||||
|
@ -1837,24 +1839,18 @@ static int wpa_supplicant_need_to_roam(struct wpa_supplicant *wpa_s,
|
||||||
min_diff += 2;
|
min_diff += 2;
|
||||||
else if (cur_est > sel_est)
|
else if (cur_est > sel_est)
|
||||||
min_diff++;
|
min_diff++;
|
||||||
}
|
else if (sel_est > cur_est * 1.5)
|
||||||
if (to_5ghz) {
|
min_diff -= 10;
|
||||||
int reduce = 2;
|
|
||||||
|
|
||||||
/* Make it easier to move to 5 GHz band */
|
|
||||||
if (sel_est > cur_est * 1.5)
|
|
||||||
reduce = 5;
|
|
||||||
else if (sel_est > cur_est * 1.2)
|
else if (sel_est > cur_est * 1.2)
|
||||||
reduce = 4;
|
min_diff -= 5;
|
||||||
else if (sel_est > cur_est * 1.1)
|
else if (sel_est > cur_est * 1.1)
|
||||||
reduce = 3;
|
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)",
|
||||||
|
|
Loading…
Reference in a new issue