From: Jouni Malinen Date: Thu, 16 Feb 2017 09:09:04 +0000 (+0200) Subject: Use throughput estimate-based BSS selection with larger SNR difference X-Git-Tag: hostap_2_7~1590 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b4d56efb1a237e4ed91de97b1615747082de7fd3;p=thirdparty%2Fhostap.git Use throughput estimate-based BSS selection with larger SNR difference Previously, the est_throughput comparison was done only when SNR difference was less than 5 dB. Since the throughput estimation take into account SNR, this can be done in more cases. For now, add a conservative 2 dB more to the difference so that any SNR difference below 7 dB results in BSS selection based on throughput estimates. In addition, the throughput estimates require SNR values to be available, so separate this from the 5 GHz preference that can be done based on either SNR or qual values. Signed-off-by: Jouni Malinen --- diff --git a/wpa_supplicant/scan.c b/wpa_supplicant/scan.c index 7345c9b0b..3a100cd20 100644 --- a/wpa_supplicant/scan.c +++ b/wpa_supplicant/scan.c @@ -1841,10 +1841,12 @@ static int wpa_scan_result_compar(const void *a, const void *b) } /* if SNR is close, decide by max rate or frequency band */ - if ((snr_a && snr_b && abs(snr_b - snr_a) < 5) || - (wa->qual && wb->qual && abs(wb->qual - wa->qual) < 10)) { + if (snr_a && snr_b && abs(snr_b - snr_a) < 7) { if (wa->est_throughput != wb->est_throughput) return wb->est_throughput - wa->est_throughput; + } + if ((snr_a && snr_b && abs(snr_b - snr_a) < 5) || + (wa->qual && wb->qual && abs(wb->qual - wa->qual) < 10)) { if (IS_5GHZ(wa->freq) ^ IS_5GHZ(wb->freq)) return IS_5GHZ(wa->freq) ? -1 : 1; }