Prefer 6 GHz APs for connection in BSS selection

Prefer 6 GHz APs when estimated throughputs are equal with APs from the
2.4/5 GHz bands while selecting APs for connection. Also add a 6 GHz
specific noise floor default value for the 6 GHz band (with the same
value as was used for 5 GHz previously) to make this step clearer.

Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
This commit is contained in:
Vamsi Krishna 2021-05-04 19:16:44 +05:30 committed by Jouni Malinen
parent 84008457ed
commit 46f8976196
2 changed files with 8 additions and 4 deletions

View file

@ -2047,6 +2047,8 @@ static int wpa_scan_result_compar(const void *a, const void *b)
} }
if ((snr_a && snr_b && abs(snr_b - snr_a) < 5) || if ((snr_a && snr_b && abs(snr_b - snr_a) < 5) ||
(wa->qual && wb->qual && abs(wb->qual - wa->qual) < 10)) { (wa->qual && wb->qual && abs(wb->qual - wa->qual) < 10)) {
if (is_6ghz_freq(wa->freq) ^ is_6ghz_freq(wb->freq))
return is_6ghz_freq(wa->freq) ? -1 : 1;
if (IS_5GHZ(wa->freq) ^ IS_5GHZ(wb->freq)) if (IS_5GHZ(wa->freq) ^ IS_5GHZ(wb->freq))
return IS_5GHZ(wa->freq) ? -1 : 1; return IS_5GHZ(wa->freq) ? -1 : 1;
} }
@ -2207,9 +2209,10 @@ void filter_scan_res(struct wpa_supplicant *wpa_s,
void scan_snr(struct wpa_scan_res *res) void scan_snr(struct wpa_scan_res *res)
{ {
if (res->flags & WPA_SCAN_NOISE_INVALID) { if (res->flags & WPA_SCAN_NOISE_INVALID) {
res->noise = IS_5GHZ(res->freq) ? res->noise = is_6ghz_freq(res->freq) ?
DEFAULT_NOISE_FLOOR_5GHZ : DEFAULT_NOISE_FLOOR_6GHZ :
DEFAULT_NOISE_FLOOR_2GHZ; (IS_5GHZ(res->freq) ?
DEFAULT_NOISE_FLOOR_5GHZ : DEFAULT_NOISE_FLOOR_2GHZ);
} }
if (res->flags & WPA_SCAN_LEVEL_DBM) { if (res->flags & WPA_SCAN_LEVEL_DBM) {

View file

@ -16,6 +16,7 @@
*/ */
#define DEFAULT_NOISE_FLOOR_2GHZ (-89) #define DEFAULT_NOISE_FLOOR_2GHZ (-89)
#define DEFAULT_NOISE_FLOOR_5GHZ (-92) #define DEFAULT_NOISE_FLOOR_5GHZ (-92)
#define DEFAULT_NOISE_FLOOR_6GHZ (-92)
/* /*
* Channels with a great SNR can operate at full rate. What is a great SNR? * Channels with a great SNR can operate at full rate. What is a great SNR?
@ -30,7 +31,7 @@
#define GREAT_SNR 25 #define GREAT_SNR 25
#define IS_2P4GHZ(n) (n >= 2412 && n <= 2484) #define IS_2P4GHZ(n) (n >= 2412 && n <= 2484)
#define IS_5GHZ(n) (n > 4000) #define IS_5GHZ(n) (n > 4000 && n < 5895)
int wpa_supplicant_enabled_networks(struct wpa_supplicant *wpa_s); int wpa_supplicant_enabled_networks(struct wpa_supplicant *wpa_s);
void wpa_supplicant_req_scan(struct wpa_supplicant *wpa_s, int sec, int usec); void wpa_supplicant_req_scan(struct wpa_supplicant *wpa_s, int sec, int usec);