mirror of
https://git.kernel.org/pub/scm/network/wireless/iwd.git
synced 2024-12-22 04:32:37 +01:00
network: Use is_known to save queue lookups
Now that the is_known field is back use it instead of searching the "networks" queue where possible.
This commit is contained in:
parent
7e7bf126d3
commit
da96b5c51c
@ -103,11 +103,6 @@ bool network_info_match(const void *a, const void *b)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool network_info_ptr_match(const void *a, const void *b)
|
|
||||||
{
|
|
||||||
return a == b;
|
|
||||||
}
|
|
||||||
|
|
||||||
static bool network_secret_check_cacheable(void *data, void *user_data)
|
static bool network_secret_check_cacheable(void *data, void *user_data)
|
||||||
{
|
{
|
||||||
struct eap_secret_info *secret = data;
|
struct eap_secret_info *secret = data;
|
||||||
@ -273,11 +268,11 @@ static void network_info_put(struct network_info *network)
|
|||||||
if (--network->seen_count)
|
if (--network->seen_count)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!networks)
|
if (!networks || network->is_known)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (l_queue_remove(networks, network))
|
l_queue_remove(networks, network);
|
||||||
network_info_free(network);
|
network_info_free(network);
|
||||||
}
|
}
|
||||||
|
|
||||||
struct network *network_create(struct device *device, const char *ssid,
|
struct network *network_create(struct device *device, const char *ssid,
|
||||||
@ -1276,9 +1271,7 @@ void network_rank_update(struct network *network)
|
|||||||
n = L_ARRAY_SIZE(rankmod_table) - 1;
|
n = L_ARRAY_SIZE(rankmod_table) - 1;
|
||||||
|
|
||||||
rank = rankmod_table[n] * best_bss->rank + USHRT_MAX;
|
rank = rankmod_table[n] * best_bss->rank + USHRT_MAX;
|
||||||
} else if (!l_queue_find(networks, network_info_ptr_match,
|
} else if (network->info->is_known)
|
||||||
network->info))
|
|
||||||
/* Is a known network */
|
|
||||||
rank = best_bss->rank;
|
rank = best_bss->rank;
|
||||||
else
|
else
|
||||||
rank = (int) best_bss->rank - USHRT_MAX; /* Negative rank */
|
rank = (int) best_bss->rank - USHRT_MAX; /* Negative rank */
|
||||||
|
Loading…
Reference in New Issue
Block a user