]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
Use throughput estimate-based BSS selection with larger SNR difference
authorJouni Malinen <j@w1.fi>
Thu, 16 Feb 2017 09:09:04 +0000 (11:09 +0200)
committerJouni Malinen <j@w1.fi>
Thu, 16 Feb 2017 10:05:10 +0000 (12:05 +0200)
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 <j@w1.fi>
wpa_supplicant/scan.c

index 7345c9b0b148fb4cba55445ef31db35303a28bc6..3a100cd20fa83800ec90d5c085ec57c7e18c4bc7 100644 (file)
@@ -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;
        }