UPSTREAM: Interpolate rate calculation functions

Make max_*_rate() functions and rate calculation at the beginning of
wpas_get_est_tpt() more continuous. In wpa_supplicant_need_to_roam(), we
compare these values to make a roaming decision. However, at certain
SNRs, we see unrealistically large jumps in estimated throughput
according to these functions, leading us to make incorrect roaming
decisions. Perform linear interpolation where applicable to more
accurately reflect actual throughput.

Example:
wlan0: Current BSS: 88:3d:24:b4:95:d2 freq=2412 level=-69 snr=20 est_throughput=54000
wlan0: Selected BSS: 88:3d:24:b4:89:9e freq=2417 level=-67 snr=22 est_throughput=63500
wlan0: Using signal poll values for the current BSS: level=-69 snr=20 est_throughput=54000
wlan0: Allow reassociation - selected BSS has better estimated throughput

2 dB increase in RSSI likely isn't responsible for a 17% increase in
throughput.

(cherry picked from commit 22f0318dbdbddca3dd8a82d0065bc8c93deb23d1)

BUG=chromium:1014866,chromium:1049782
TEST=1) network_WiFi_RoamDiagnostics (WIP test) showed no regressions,
        but also no improvements. This is expected since it only affects
	edge cases (two APs are on opposite sides of a SNR threshold).
     2) https://paste.googleplex.com/5415639034363904?raw saw
	improvements from 14 roams without this change to 10 roams with.
     2) Normal roaming behavior walking around the building.

Signed-off-by: Matthew Wang <matthewmwang@chromium.org>
Change-Id: I7e2b0c71101466757a648f166c01b67d43429c55
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/hostap/+/2057977
Reviewed-by: Brian Norris <briannorris@chromium.org>
1 file changed