Make min_diff determination from cur_level more readable

This handles both the dBm and unspecified unit cases.

Signed-off-by: Jouni Malinen <j@w1.fi>
This commit is contained in:
Jouni Malinen 2020-01-01 17:46:03 +02:00
parent 41f72d7356
commit a8ad9c31db

View file

@ -1817,19 +1817,18 @@ static int wpa_supplicant_need_to_roam(struct wpa_supplicant *wpa_s,
return 0; return 0;
} }
min_diff = 2; if (cur_level < -85) /* ..-86 dBm */
if (cur_level < 0) { min_diff = 1;
if (cur_level < -85) else if (cur_level < -80) /* -85..-81 dBm */
min_diff = 1; min_diff = 2;
else if (cur_level < -80) else if (cur_level < -75) /* -80..-76 dBm */
min_diff = 2; min_diff = 3;
else if (cur_level < -75) else if (cur_level < -70) /* -75..-71 dBm */
min_diff = 3; min_diff = 4;
else if (cur_level < -70) else if (cur_level < 0) /* -70..-1 dBm */
min_diff = 4; min_diff = 5;
else else /* unspecified units (not in dBm) */
min_diff = 5; min_diff = 2;
}
if (cur_est > sel_est * 1.5) if (cur_est > sel_est * 1.5)
min_diff += 10; min_diff += 10;