From: James Prestwood <prestwoj@gmail.com>
To: iwd@lists.linux.dev
Cc: James Prestwood <prestwoj@gmail.com>
Subject: [PATCH v2 1/4] knownnetworks: pass scan_bss to known_network_add_frequency
Date: Wed, 24 Jan 2024 05:39:58 -0800 [thread overview]
Message-ID: <20240124134001.20453-1-prestwoj@gmail.com> (raw)
This prepares to store known frequencies sorted by BSS rank.
---
src/knownnetworks.c | 6 +++---
src/knownnetworks.h | 3 ++-
src/network.c | 6 +++---
3 files changed, 8 insertions(+), 7 deletions(-)
diff --git a/src/knownnetworks.c b/src/knownnetworks.c
index 04ce74ec..f6284fdc 100644
--- a/src/knownnetworks.c
+++ b/src/knownnetworks.c
@@ -566,7 +566,7 @@ static bool known_frequency_match(const void *a, const void *b)
* Adds a frequency to the 'known' set of frequencies that this network
* operates on. The list is sorted according to most-recently seen
*/
-int known_network_add_frequency(struct network_info *info, uint32_t frequency)
+int known_network_add_frequency(struct network_info *info, struct scan_bss *bss)
{
struct known_frequency *known_freq;
@@ -574,10 +574,10 @@ int known_network_add_frequency(struct network_info *info, uint32_t frequency)
info->known_frequencies = l_queue_new();
known_freq = l_queue_remove_if(info->known_frequencies,
- known_frequency_match, &frequency);
+ known_frequency_match, &bss->frequency);
if (!known_freq) {
known_freq = l_new(struct known_frequency, 1);
- known_freq->frequency = frequency;
+ known_freq->frequency = bss->frequency;
}
l_queue_push_head(info->known_frequencies, known_freq);
diff --git a/src/knownnetworks.h b/src/knownnetworks.h
index e8ffac0b..9f81e308 100644
--- a/src/knownnetworks.h
+++ b/src/knownnetworks.h
@@ -114,7 +114,8 @@ struct network_info *known_networks_find(const char *ssid,
struct scan_freq_set *known_networks_get_recent_frequencies(
uint8_t num_networks_tosearch);
-int known_network_add_frequency(struct network_info *info, uint32_t frequency);
+int known_network_add_frequency(struct network_info *info,
+ struct scan_bss *bss);
void known_network_frequency_sync(struct network_info *info);
uint32_t known_networks_watch_add(known_networks_watch_func_t func,
diff --git a/src/network.c b/src/network.c
index 4723334e..81315746 100644
--- a/src/network.c
+++ b/src/network.c
@@ -807,7 +807,7 @@ 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);
+ known_network_add_frequency(info, bss);
}
void network_set_info(struct network *network, struct network_info *info)
@@ -1094,7 +1094,7 @@ bool network_bss_add(struct network *network, struct scan_bss *bss)
return false;
if (network->info)
- known_network_add_frequency(network->info, bss->frequency);
+ known_network_add_frequency(network->info, bss);
/* Done if BSS is not HS20 or we already have network_info set */
if (!bss->hs20_capable)
@@ -1131,7 +1131,7 @@ bool network_bss_update(struct network *network, struct scan_bss *bss)
/* Sync frequency for already known networks */
if (network->info) {
- known_network_add_frequency(network->info, bss->frequency);
+ known_network_add_frequency(network->info, bss);
known_network_frequency_sync(network->info);
}
--
2.34.1
next reply other threads:[~2024-01-24 13:40 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-01-24 13:39 James Prestwood [this message]
2024-01-24 13:39 ` [PATCH v2 2/4] knownnetworks: sort known frequencies by BSS rank James Prestwood
2024-01-24 18:10 ` Denis Kenzior
2024-01-24 18:33 ` James Prestwood
2024-01-24 18:44 ` Denis Kenzior
2024-01-24 18:55 ` James Prestwood
2024-01-24 19:06 ` Denis Kenzior
2024-01-25 13:21 ` James Prestwood
2024-01-25 15:39 ` Denis Kenzior
2024-01-24 13:40 ` [PATCH v2 3/4] station: knownnetworks: limit quick scans to 5 freqs per network James Prestwood
2024-01-24 18:21 ` Denis Kenzior
2024-01-24 13:40 ` [PATCH v2 4/4] auto-t: add test for known frequency sorting/maximum James Prestwood
2024-01-24 18:16 ` [PATCH v2 1/4] knownnetworks: pass scan_bss to known_network_add_frequency Denis Kenzior
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240124134001.20453-1-prestwoj@gmail.com \
--to=prestwoj@gmail.com \
--cc=iwd@lists.linux.dev \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).