Re: [PATCH 2/2] Interpolate rate calculation functions
Jouni Malinen <[email protected]>
| Newsgroups | gmane.linux.drivers.hostap |
|---|---|
| Message-ID | <[email protected]> |
On Mon, Mar 16, 2020 at 02:11:06PM -0700, Matthew Wang wrote:
> 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.
Thanks, both patches applied.
> diff --git a/wpa_supplicant/scan.c b/wpa_supplicant/scan.c
> @@ -2187,76 +2187,86 @@ void scan_snr(struct wpa_scan_res *res)
> static unsigned int max_ht20_rate(int snr, int vht)
> {
> - if (snr < 2)
> + if (snr < 0)
> return 0;
> + if (snr < 2)
> + return 0 + (snr - 0.0) / (2 - 0) * (6500 - 0); /* HT20 MCS0 */
> if (snr < 5)
> - return 6500; /* HT20 MCS0 */
> + return 6500 + (snr - 2.0) / (5 - 2) * (13000 - 6500); /* HT20 MCS1 */
I changed these to use a macro to make it clearer that the operations
were identical and to avoid having to specify the same values multiple
times. In addition, I replaced floating point arithmetic with integers
since that seemed to provide same results in practice.
--
Jouni Malinen PGP id EFC895FA