mirror of
https://git.kernel.org/pub/scm/network/wireless/iwd.git
synced 2024-11-25 09:39:25 +01:00
network: add network_update_known_frequencies
In order to support an ordered list of known frequencies the list should be in order of last seen BSS frequencies with the highest ranked ones first. To accomplish this without adding a lot of complexity the frequencies can be pushed into the list as long as they are pushed in reverse rank order (lowest rank first, highest last). This ensures that very high ranked BSS's will always get superseded by subsequent scans if not seen. This adds a new network API to update the known frequency list based on the current newtork->bss_list. This assumes that station always wipes the BSS list on scans and populates with only fresh BSS entries. After the scan this API can be called and it will reverse the list, then add each frequency.
This commit is contained in:
parent
4b3e82f742
commit
d03b06db85
@ -802,21 +802,13 @@ const struct network_info *network_get_info(const struct network *network)
|
||||
return network->info;
|
||||
}
|
||||
|
||||
static void add_known_frequency(void *data, void *user_data)
|
||||
{
|
||||
struct scan_bss *bss = data;
|
||||
struct network_info *info = user_data;
|
||||
|
||||
known_network_add_frequency(info, bss->frequency);
|
||||
}
|
||||
|
||||
void network_set_info(struct network *network, struct network_info *info)
|
||||
{
|
||||
if (info) {
|
||||
network->info = info;
|
||||
network->info->seen_count++;
|
||||
|
||||
l_queue_foreach(network->bss_list, add_known_frequency, info);
|
||||
network_update_known_frequencies(network);
|
||||
} else {
|
||||
network->info->seen_count--;
|
||||
network->info = NULL;
|
||||
@ -1087,6 +1079,33 @@ static bool match_hotspot_network(const struct network_info *info,
|
||||
return true;
|
||||
}
|
||||
|
||||
bool network_update_known_frequencies(struct network *network)
|
||||
{
|
||||
const struct l_queue_entry *e;
|
||||
struct l_queue *reversed;
|
||||
|
||||
if (!network->info)
|
||||
return false;
|
||||
|
||||
reversed = l_queue_new();
|
||||
|
||||
for (e = l_queue_get_entries(network->bss_list); e; e = e->next) {
|
||||
struct scan_bss *bss = e->data;
|
||||
|
||||
l_queue_push_head(reversed, bss);
|
||||
}
|
||||
|
||||
for (e = l_queue_get_entries(reversed); e; e = e->next) {
|
||||
struct scan_bss *bss = e->data;
|
||||
|
||||
known_network_add_frequency(network->info, bss->frequency);
|
||||
}
|
||||
|
||||
l_queue_destroy(reversed, NULL);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool network_bss_add(struct network *network, struct scan_bss *bss)
|
||||
{
|
||||
if (!l_queue_insert(network->bss_list, bss, scan_bss_rank_compare,
|
||||
|
@ -61,6 +61,8 @@ void network_set_info(struct network *network, struct network_info *info);
|
||||
void network_set_force_default_owe_group(struct network *network);
|
||||
bool network_get_force_default_owe_group(struct network *network);
|
||||
|
||||
bool network_update_known_frequencies(struct network *network);
|
||||
|
||||
int network_can_connect_bss(struct network *network,
|
||||
const struct scan_bss *bss);
|
||||
int network_autoconnect(struct network *network, struct scan_bss *bss);
|
||||
|
Loading…
Reference in New Issue
Block a user