Skip to content

Conversation

@IWDTestBot
Copy link
Owner

Return the number of freqs in a scan_freq_set, useful for knowing how
big the set is.

src/util.c | 11 +++++++++++
src/util.h | 1 +
2 files changed, 12 insertions(+)

jprestwo and others added 13 commits August 27, 2025 17:45
This is taken care of by the individual cache items and
if none exist, tar fails.
Return the number of freqs in a scan_freq_set, useful for knowing how
big the set is.
Splits the scan frequencies into more subsets that have been ordered
such that the more common frequencies appear first, and the more uncommon
frequencies last. Non-DFS channels are also added to the earlier
subsets to prioritize fast-scanning frequencies.

This approach allows iwd to scan the frequencies with the statistically
highest chance for BSSes first, resulting in shorter scan times until a
good BSS is found. In future patches this will also be used when
roaming.
When iwd decides to roam, it scans either neighbor freqs or known freqs
(if neighbors are not available). If it fails to roam after getting the
scan results, it scans ALL freqs. There's a high chance that both
neighbor and/or known scans fail to roam and we end up scanning all
freqs. This is very slow and if you're already moving away from the
current BSS, there's a high chance you will lose connection
completely before the scan is finished.

Instead of scanning all freqs at once, use the already-defined subsets
to optimize the scans. The subsets contain a handful of freqs each and
are ordered to increase the chance of finding a good BSS early. In order
to not scan the same freq multiple times, use a list (scanned_freqs) to
keep track of which freqs have been scanned in the current roam attempt.

When a roam scan is triggered, add the most prioritized freqs to the
list of freqs that should be scanned. The order of priority is:

1. Neighbor freqs
2. Known freqs
3. Subsets, starting with index 0 and incrementing if the subset is
   exhausted

A freq is only added to the scan if it has not yet been scanned in the
current roam attempt. An exception to this are neighbor freqs. They have
a higher chance of containing good BSSes, so they're scanned every 3rd
scan (defined by STATION_SCANS_BEFORE_NEIGHBOR_SCAN).

This approach results in more scans, but fewer freqs per scan, leading
to shorter delays between scan results. It also avoids scanning the same
freqs back-to-back, which is generally not very useful. In combination
with the subset ordering, this increases the chance of finding a good
BSS early and results in better roaming performance.
@IWDTestBot
Copy link
Owner Author

Fetch PR
Test ID: fetch
Desc: Fetch the PR commits for this CI run
Duration: 2.48 seconds
Result: PASS

GitLint
Test ID: gitlint
Desc: Run gitlint with rule in .gitlint
Duration: 2.79 seconds
Result: PASS

Prep - Setup ELL
Test ID: setupell
Desc: Clone, build, and install ELL
Duration: 18.59 seconds
Result: PASS

Make Distcheck
Test ID: makedistcheck
Desc: Run distcheck to check the distribution
Duration: 38.51 seconds
Result: PASS

Build - Configure
Test ID: build
Desc: Configure the BlueZ source tree
Duration: 10.16 seconds
Result: PASS

Make Check
Test ID: makecheck
Desc: Run 'make check'
Duration: 0.00 seconds
Result: SKIP

Output:

makecheck was skipped

Make Check w/Valgrind
Test ID: makecheckvalgrind
Desc: Run 'make check' with Valgrind
Duration: 17.59 seconds
Result: FAIL

Output:

src/station.c: In function ‘station_populate_roam_scan_freqs’:
src/station.c:3111:9: error: ISO C90 forbids mixed declarations and code [-Werror=declaration-after-statement]
 3111 |         const struct network_info *info = network_get_info(
      |         ^~~~~
src/station.c: In function ‘station_start_roam’:
src/station.c:3140:13: error: unused variable ‘r’ [-Werror=unused-variable]
 3140 |         int r;
      |             ^
At top level:
src/station.c:5037:13: error: ‘station_add_2_4ghz_freq’ defined but not used [-Werror=unused-function]
 5037 | static void station_add_2_4ghz_freq(uint32_t freq, void *user_data)
      |             ^~~~~~~~~~~~~~~~~~~~~~~
cc1: all warnings being treated as errors
make[1]: *** [Makefile:2662: src/station.o] Error 1
make[1]: *** Waiting for unfinished jobs....
make: *** [Makefile:1799: all] Error 2

Incremental Build with patches
Test ID: incremental_build
Desc: Incremental build per patch in the series
Duration: 48.49 seconds
Result: FAIL

Output:

src/station.c:5057:13: error: ‘station_add_2_4ghz_freq’ defined but not used [-Werror=unused-function]
 5057 | static void station_add_2_4ghz_freq(uint32_t freq, void *user_data)
      |             ^~~~~~~~~~~~~~~~~~~~~~~
cc1: all warnings being treated as errors
make[1]: *** [Makefile:2662: src/station.o] Error 1
make[1]: *** Waiting for unfinished jobs....
make: *** [Makefile:1799: all] Error 2

Autotest Runner
Test ID: testrunner
Desc: Runs IWD's autotest framework
Duration: 0.00 seconds
Result: SKIP

Output:

testrunner was skipped

Clang Build
Test ID: clang
Desc: Build IWD using clang compiler
Duration: 20.75 seconds
Result: FAIL

Output:

src/station.c:3111:29: error: mixing declarations and code is incompatible with standards before C99 [-Werror,-Wdeclaration-after-statement]
        const struct network_info *info = network_get_info(
                                   ^
src/station.c:3140:6: error: unused variable 'r' [-Werror,-Wunused-variable]
        int r;
            ^
2 errors generated.
make[1]: *** [Makefile:2662: src/station.o] Error 1
make[1]: *** Waiting for unfinished jobs....
make: *** [Makefile:1799: all] Error 2

@IWDTestBot
Copy link
Owner Author

Fetch PR
Test ID: fetch
Desc: Fetch the PR commits for this CI run
Duration: 3.11 seconds
Result: PASS

Prep - Setup ELL
Test ID: setupell
Desc: Clone, build, and install ELL
Duration: 25.56 seconds
Result: PASS

Make Distcheck
Test ID: makedistcheck
Desc: Run distcheck to check the distribution
Duration: 55.32 seconds
Result: PASS

Build - Configure
Test ID: build
Desc: Configure the BlueZ source tree
Duration: 12.23 seconds
Result: PASS

Make Check
Test ID: makecheck
Desc: Run 'make check'
Duration: 0.00 seconds
Result: SKIP

Output:

makecheck was skipped

Make Check w/Valgrind
Test ID: makecheckvalgrind
Desc: Run 'make check' with Valgrind
Duration: 22.27 seconds
Result: FAIL

Output:

src/station.c: In function 'station_populate_roam_scan_freqs':
src/station.c:3111:9: error: ISO C90 forbids mixed declarations and code [-Werror=declaration-after-statement]
 3111 |         const struct network_info *info = network_get_info(
      |         ^~~~~
src/station.c: In function 'station_start_roam':
src/station.c:3140:13: error: unused variable 'r' [-Werror=unused-variable]
 3140 |         int r;
      |             ^
At top level:
src/station.c:5037:13: error: 'station_add_2_4ghz_freq' defined but not used [-Werror=unused-function]
 5037 | static void station_add_2_4ghz_freq(uint32_t freq, void *user_data)
      |             ^~~~~~~~~~~~~~~~~~~~~~~
cc1: all warnings being treated as errors
make[1]: *** [Makefile:2663: src/station.o] Error 1
make[1]: *** Waiting for unfinished jobs....
make: *** [Makefile:1800: all] Error 2

Incremental Build with patches
Test ID: incremental_build
Desc: Incremental build per patch in the series
Duration: 70.60 seconds
Result: FAIL

Output:

src/station.c:5057:13: error: 'station_add_2_4ghz_freq' defined but not used [-Werror=unused-function]
 5057 | static void station_add_2_4ghz_freq(uint32_t freq, void *user_data)
      |             ^~~~~~~~~~~~~~~~~~~~~~~
cc1: all warnings being treated as errors
make[1]: *** [Makefile:2663: src/station.o] Error 1
make[1]: *** Waiting for unfinished jobs....
make: *** [Makefile:1800: all] Error 2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants