diff mbox series

[7/7] knownnetworks: limit 5 recent frequencies per network

Message ID 20231220131200.267489-8-prestwoj@gmail.com (mailing list archive)
State New
Headers show
Series Reduce and optimize quick/roam scan frequencies | expand

Checks

Context Check Description
tedd_an/pre-ci_am success Success
prestwoj/iwd-ci-gitlint success GitLint

Commit Message

James Prestwood Dec. 20, 2023, 1:12 p.m. UTC
Since this is meant to be used for quick/roam scans we should be
putting a cap on the frequencies scanned. For large networks with
many BSS's this could end up scanning quite a few frequencies which
isn't very 'quick' as it should be.

Since the known frequency list is now sorted in most recently used
order we can grab the first 5 frequencies per network and be
somewhat confident that this will result in a BSS to connect to.
---
 src/knownnetworks.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/src/knownnetworks.c b/src/knownnetworks.c
index e44109fd..ecdd79a1 100644
--- a/src/knownnetworks.c
+++ b/src/knownnetworks.c
@@ -540,10 +540,12 @@  struct scan_freq_set *known_networks_get_recent_frequencies(
 				network_entry = network_entry->next,
 						num_networks_tosearch--) {
 		const struct network_info *network = network_entry->data;
+		uint8_t num_freqs = 5;
 
 		for (freq_entry = l_queue_get_entries(
 						network->known_frequencies);
-				freq_entry; freq_entry = freq_entry->next) {
+				freq_entry && num_freqs;
+				freq_entry = freq_entry->next, num_freqs--) {
 			const struct known_frequency *known_freq =
 							freq_entry->data;