scan: add flag if BSS load was advertised

For ranking purposes the utilization was defaulted to a valid (127)
which would not change the rank if that IE was not found in the
scan results. Historically this was printed (debug) as part of the
scan results but that was removed as it was somewhat confusing. i.e.
did the AP _really_ have a utilization of 127? or was the IE not
found?

Since it is useful to see the BSS load if that is advertised add a
flag to the scan_bss struct to indicate if the IE was present which
can be checked.
This commit is contained in:
James Prestwood 2024-06-18 09:58:53 -07:00 committed by Denis Kenzior
parent 35808debae
commit 8de70b1952
2 changed files with 9 additions and 6 deletions

View File

@ -1344,6 +1344,8 @@ static bool scan_parse_bss_information_elements(struct scan_bss *bss,
NULL) < 0)
l_warn("Unable to parse BSS Load IE for "
MAC, MAC_STR(bss->addr));
else
bss->have_utilization = true;
break;
case IE_TYPE_VENDOR_SPECIFIC:
@ -1533,7 +1535,6 @@ static struct scan_bss *scan_parse_attr_bss(struct l_genl_attr *attr,
size_t beacon_ies_len;
bss = l_new(struct scan_bss, 1);
bss->utilization = 127;
bss->source_frame = SCAN_BSS_BEACON;
while (l_genl_attr_next(attr, &type, &len, &data)) {
@ -1704,10 +1705,12 @@ static void scan_bss_compute_rank(struct scan_bss *bss)
rank *= RANK_6G_FACTOR;
/* Rank loaded APs lower and lightly loaded APs higher */
if (bss->utilization >= 192)
rank *= RANK_HIGH_UTILIZATION_FACTOR;
else if (bss->utilization <= 63)
rank *= RANK_LOW_UTILIZATION_FACTOR;
if (bss->have_utilization) {
if (bss->utilization >= 192)
rank *= RANK_HIGH_UTILIZATION_FACTOR;
else if (bss->utilization <= 63)
rank *= RANK_LOW_UTILIZATION_FACTOR;
}
if (bss->have_snr) {
if (bss->snr <= 15)
@ -1734,7 +1737,6 @@ struct scan_bss *scan_bss_new_from_probe_req(const struct mmpdu_header *mpdu,
bss = l_new(struct scan_bss, 1);
memcpy(bss->addr, mpdu->address_2, 6);
bss->utilization = 127;
bss->source_frame = SCAN_BSS_PROBE_REQ;
bss->frequency = frequency;
bss->signal_strength = rssi;

View File

@ -91,6 +91,7 @@ struct scan_bss {
bool sae_pw_id_used : 1;
bool sae_pw_id_exclusive : 1;
bool have_snr : 1;
bool have_utilization : 1;
};
struct scan_parameters {