Use local variables for current BSS signal strength in roaming

This is a step towards allowing these values to be determined based on
signal poll instead of scan results.

Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
This commit is contained in:
Emmanuel Grumbach 2019-12-06 14:27:47 -08:00 committed by Jouni Malinen
parent 7aa03cfa7b
commit 98ea9d5d51

View file

@ -1680,7 +1680,8 @@ static int wpa_supplicant_need_to_roam(struct wpa_supplicant *wpa_s,
#ifndef CONFIG_NO_ROAMING
int min_diff, diff;
int to_5ghz;
int cur_est, sel_est;
int cur_level;
unsigned int cur_est, sel_est;
#endif /* CONFIG_NO_ROAMING */
if (wpa_s->reassociate)
@ -1731,7 +1732,10 @@ static int wpa_supplicant_need_to_roam(struct wpa_supplicant *wpa_s,
return 1;
}
if (selected->est_throughput > current_bss->est_throughput + 5000) {
cur_level = current_bss->level;
cur_est = current_bss->est_throughput;
if (selected->est_throughput > cur_est + 5000) {
wpa_dbg(wpa_s, MSG_DEBUG,
"Allow reassociation - selected BSS has better estimated throughput");
return 1;
@ -1739,30 +1743,28 @@ static int wpa_supplicant_need_to_roam(struct wpa_supplicant *wpa_s,
to_5ghz = selected->freq > 4000 && current_bss->freq < 4000;
if (current_bss->level < 0 &&
current_bss->level > selected->level + to_5ghz * 2) {
if (cur_level < 0 && cur_level > selected->level + to_5ghz * 2) {
wpa_dbg(wpa_s, MSG_DEBUG, "Skip roam - Current BSS has better "
"signal level");
return 0;
}
if (current_bss->est_throughput > selected->est_throughput + 5000) {
if (cur_est > selected->est_throughput + 5000) {
wpa_dbg(wpa_s, MSG_DEBUG,
"Skip roam - Current BSS has better estimated throughput");
return 0;
}
cur_est = current_bss->est_throughput;
sel_est = selected->est_throughput;
min_diff = 2;
if (current_bss->level < 0) {
if (current_bss->level < -85)
if (cur_level < 0) {
if (cur_level < -85)
min_diff = 1;
else if (current_bss->level < -80)
else if (cur_level < -80)
min_diff = 2;
else if (current_bss->level < -75)
else if (cur_level < -75)
min_diff = 3;
else if (current_bss->level < -70)
else if (cur_level < -70)
min_diff = 4;
else
min_diff = 5;
@ -1791,7 +1793,7 @@ static int wpa_supplicant_need_to_roam(struct wpa_supplicant *wpa_s,
else
min_diff = 0;
}
diff = abs(current_bss->level - selected->level);
diff = abs(cur_level - selected->level);
if (diff < min_diff) {
wpa_dbg(wpa_s, MSG_DEBUG,
"Skip roam - too small difference in signal level (%d < %d)",