scan: add [Rank].BandModifier2_4Ghz
PATCH 1/8 scan: add [Rank].BandModifier2_4Ghz
Similar to the 5/6Ghz options, allow modifying the rank for 2.4Ghz scan results.
--- src/scan.c | 8 ++++++++ 1 file changed, 8 insertions(+)
src/scan.c +8 -0
@@ -53,6 +53,7 @@#include "src/scan.h" /* User configurable options */ +static double RANK_2G_FACTOR ;static double RANK_5G_FACTOR ;static double RANK_6G_FACTOR ;static uint32_t SCAN_MAX_INTERVAL ;
@@ -1634,6 +1635,9 @@ static void scan_bss_compute_rank(struct scan_bss *bss) rank = (double )bss->data_rate / max_rate *USHRT_MAX ; +if (bss->frequency <3000 ) + rank *=RANK_2G_FACTOR ; +/* Prefer 5G networks over 2.4G and 6G */ if (bss->frequency >=4900 && bss->frequency <5900 ) rank *=RANK_5G_FACTOR ;
@@ -2355,6 +2359,10 @@ static int scan_init(void) scan_contexts =l_queue_new (); +if (!l_settings_get_double (config,"Rank" ,"BandModifier2_4Ghz" , + &RANK_2G_FACTOR )) +RANK_2G_FACTOR =1.0 ; +if (!l_settings_get_double (config,"Rank" ,"BandModifier5Ghz" , &RANK_5G_FACTOR ))RANK_5G_FACTOR =1.0 ;
Signature · 1 line
2.25.1
PATCH 2/8 doc: document [Rank].BandModifier2_4Ghz
--- src/iwd.config.rst | 6 ++++++ 1 file changed, 6 insertions(+)
src/iwd.config.rst +6 -0
@@ -291,6 +291,12 @@ autoconnect purposes. :widths: 20 80 :align: left + * - BandModifier2_4Ghz + - Values: floating point value (default: **1.0**) + + Increase or decrease the preference for 2.4GHz access points by + increasing or decreasing the value of this modifier. + * - BandModifier5Ghz - Values: floating point value (default: **1.0**)
Signature · 1 line
2.25.1
PATCH 3/8 scan: add scan_get_band_rank_modifier
In reply to James PrestwoodThis exposes the [Rank].BandModifier* settings so other modules can use then. Doing this will allow user-disabling of certain bands by setting these modifier values to 0.0.
--- src/scan.c | 41 ++++++++++++++++++++++++++++++----------- src/scan.h | 3 +++ 2 files changed, 33 insertions(+), 11 deletions(-)
src/scan.c +30 -11
@@ -2310,6 +2310,33 @@ bool scan_get_firmware_scan(uint64_t wdev_id, scan_notify_func_t notify,return true; } +double scan_get_band_rank_modifier (enum band_freq band) +{ +const struct l_settings *config =iwd_get_config (); +double modifier; +char *str; + +switch (band) { +case BAND_FREQ_2_4_GHZ : + str ="BandModifier2_4Ghz" ; +break ; +case BAND_FREQ_5_GHZ : + str ="BandModifier5Ghz" ; +break ; +case BAND_FREQ_6_GHZ : + str ="BandModifier6Ghz" ; +break ; +default : +l_warn ("Unhandled band %u" , band); +return 0.0 ; + } + +if (!l_settings_get_double (config,"Rank" , str, &modifier)) + modifier =1.0 ; + +return modifier; +} +bool scan_wdev_add (uint64_t wdev_id) {struct scan_context *sc;
@@ -2359,17 +2386,9 @@ static int scan_init(void) scan_contexts =l_queue_new (); -if (!l_settings_get_double (config,"Rank" ,"BandModifier2_4Ghz" , - &RANK_2G_FACTOR )) -RANK_2G_FACTOR =1.0 ; - -if (!l_settings_get_double (config,"Rank" ,"BandModifier5Ghz" , - &RANK_5G_FACTOR )) -RANK_5G_FACTOR =1.0 ; - -if (!l_settings_get_double (config,"Rank" ,"BandModifier6Ghz" , - &RANK_6G_FACTOR )) -RANK_6G_FACTOR =1.0 ; +RANK_2G_FACTOR =scan_get_band_rank_modifier (BAND_FREQ_2_4_GHZ ); +RANK_5G_FACTOR =scan_get_band_rank_modifier (BAND_FREQ_5_GHZ ); +RANK_6G_FACTOR =scan_get_band_rank_modifier (BAND_FREQ_6_GHZ );if (!l_settings_get_uint (config,"Scan" ,"InitialPeriodicScanInterval" , &SCAN_INIT_INTERVAL ))
src/scan.h +3 -0
@@ -29,6 +29,7 @@ struct p2p_beacon;struct mmpdu_header ;struct wiphy ;enum security ; +enum band_freq ;enum scan_state {SCAN_STATE_NOT_RUNNING ,
@@ -170,5 +171,7 @@ struct scan_bss *scan_bss_new_from_probe_req(const struct mmpdu_header *mpdu,size_t body_len, uint32_t frequency, int rssi); +double scan_get_band_rank_modifier (enum band_freq band); +bool scan_wdev_add (uint64_t wdev_id);bool scan_wdev_remove (uint64_t wdev_id);
Signature · 1 line
2.25.1
PATCH 4/8 wiphy: add wiphy_get_allowed_freqs
In reply to James PrestwoodThis is more or less copied from scan_get_allowed_freqs but is going to be needed by station (basically just saves the need for station to do the same clone/constrain sequence itself).
One slight alteration is now a band mask can be passed in which provides more flexibility for additional filtering.
--- src/wiphy.c | 15 +++++++++++++++ src/wiphy.h | 2 ++ 2 files changed, 17 insertions(+)
src/wiphy.c +15 -0
@@ -500,6 +500,21 @@ const struct scan_freq_set *wiphy_get_supported_freqs(return wiphy->supported_freqs; } +struct scan_freq_set *wiphy_get_allowed_freqs (const struct wiphy *wiphy, +uint32_t band_mask) +{ +struct scan_freq_set *allowed =scan_freq_set_clone ( + wiphy->supported_freqs, + band_mask); + +if (!wiphy_constrain_freq_set (wiphy, allowed)) { +scan_freq_set_free (allowed); + allowed =NULL ; + } + +return allowed; +} +static struct band *wiphy_get_band (const struct wiphy *wiphy,enum band_freq band) {switch (band) {
src/wiphy.h +2 -0
@@ -100,6 +100,8 @@ const char *wiphy_get_path(struct wiphy *wiphy);uint32_t wiphy_get_supported_bands (struct wiphy *wiphy);const struct scan_freq_set *wiphy_get_supported_freqs (const struct wiphy *wiphy); +struct scan_freq_set *wiphy_get_allowed_freqs (const struct wiphy *wiphy, +uint32_t band_mask); const struct band_freq_attrs *wiphy_get_frequency_info( const struct wiphy *wiphy,
Signature · 1 line
2.25.1
PATCH 5/8 scan: allow splitting of scans with defined frequencies
In reply to James PrestwoodCurrently the only way a scan can be split is if the request does not specify any frequencies, implying the request should scan the entire spectrum. This allows the scan logic to issue an extra request if 6GHz becomes available during the 2.4 or 5GHz scans. This restriction was somewhat arbitrary and done to let periodic scans pick up 6GHz APs through a single scan request.
But now with the addition of allowing user-disabled bands periodic scans will need to specify a frequency list in case a given band has been disabled. This will break the scan splitting code which is why this prep work is being done.
The main difference now is the original scan frequencies are tracked with the scan request. The reason for this is so if a request comes in with a limited set of 6GHz frequences IWD won't end up scanning the full 6GHz spectrum later on.
--- src/scan.c | 53 ++++++++++++++++++++++------------------------------- 1 file changed, 22 insertions(+), 31 deletions(-)
src/scan.c +22 -31
@@ -107,6 +107,8 @@ struct scan_request {* and save these since there may be additional scan commands to run. */ struct scan_freq_set *freqs_scanned; +/* Entire list of frequencies to scan */ +struct scan_freq_set *scan_freqs; };struct scan_context {
@@ -170,6 +172,7 @@ static void scan_request_free(struct wiphy_radio_work_item *item)l_queue_destroy (sr->cmds, (l_queue_destroy_func_t ) l_genl_msg_unref);scan_freq_set_free (sr->freqs_scanned); +scan_freq_set_free (sr->scan_freqs);l_free (sr); }
@@ -341,20 +344,6 @@ static bool scan_mac_address_randomization_is_disabled(void)return disabled; } -static struct scan_freq_set *scan_get_allowed_freqs (struct scan_context *sc) -{ -struct scan_freq_set *allowed =scan_freq_set_new (); - -scan_freq_set_merge (allowed,wiphy_get_supported_freqs (sc->wiphy)); - -if (!wiphy_constrain_freq_set (sc->wiphy, allowed)) { -scan_freq_set_free (allowed); - allowed =NULL ; - } - -return allowed; -} - static struct l_genl_msg *scan_build_cmd(struct scan_context *sc, bool ignore_flush_flag, bool is_passive, const struct scan_parameters *params,
@@ -582,22 +571,29 @@ static void scan_cmds_add(struct scan_request *sr, struct scan_context *sc,bool passive, const struct scan_parameters *params) { + uint32_t bands = BAND_FREQ_2_4_GHZ | BAND_FREQ_5_GHZ | BAND_FREQ_6_GHZ;unsigned int i;struct scan_freq_set *subsets[2 ] = {0 }; -struct scan_freq_set *allowed =scan_get_allowed_freqs (sc); +struct scan_freq_set *allowed =wiphy_get_allowed_freqs (sc->wiphy, + bands);const struct scan_freq_set *supported =wiphy_get_supported_freqs (sc->wiphy);/* -* If 6GHz is not possible, or already allowed, or the frequencies are -* explicit don't break up the request. +* No frequencies, just include the entire supported list and let the +* kernel filter out any disabled frequencies */ +if (!params->freqs) + sr->scan_freqs =scan_freq_set_clone (supported, bands); +else + sr->scan_freqs =scan_freq_set_clone (params->freqs, bands); + +/* If 6GHz is not possible or already allowed don't split the request */ if (!(scan_freq_set_get_bands (supported) &BAND_FREQ_6_GHZ ) || - (scan_freq_set_get_bands (allowed) &BAND_FREQ_6_GHZ ) || - params->freqs) { + (scan_freq_set_get_bands (allowed) &BAND_FREQ_6_GHZ )) {scan_freq_set_free (allowed);scan_build_next_cmd (sr->cmds, sc, passive, - params, params->freqs); + params, sr->scan_freqs);return ; }
@@ -613,8 +609,8 @@ static void scan_cmds_add(struct scan_request *sr, struct scan_context *sc,* extra 6GHz-only passive scan can be appended to this request * at that time. */ - subsets[0 ] =scan_freq_set_clone (allowed,BAND_FREQ_2_4_GHZ ); - subsets[1 ] =scan_freq_set_clone (allowed,BAND_FREQ_5_GHZ ); + subsets[0 ] =scan_freq_set_clone (sr->scan_freqs,BAND_FREQ_2_4_GHZ ); + subsets[1 ] =scan_freq_set_clone (sr->scan_freqs,BAND_FREQ_5_GHZ );scan_freq_set_free (allowed);
@@ -1918,9 +1914,8 @@ static void scan_wiphy_watch(struct wiphy *wiphy,struct scan_request *sr =NULL ;struct l_genl_msg *msg =NULL ;struct scan_parameters params = {0 }; -struct scan_freq_set *freqs_6ghz;struct scan_freq_set *allowed; -bool allow_6g; + _auto_(scan_freq_set_free) struct scan_freq_set *freqs_6ghz = NULL;/* Only care about completed regulatory dumps */ if (event !=WIPHY_STATE_WATCH_EVENT_REGDOM_DONE )
@@ -1934,14 +1929,14 @@ static void scan_wiphy_watch(struct wiphy *wiphy,if (!sr)return ; - allowed =scan_get_allowed_freqs (sc); - allow_6g =scan_freq_set_get_bands (allowed) &BAND_FREQ_6_GHZ ; + allowed =wiphy_get_allowed_freqs (sc->wiphy,BAND_FREQ_6_GHZ ); + freqs_6ghz =scan_freq_set_clone (sr->scan_freqs,BAND_FREQ_6_GHZ );/* * This update did not allow 6GHz, or the original request was * not expecting 6GHz. The periodic scan should now be ended. */ -if (!allow_6g || !sr->split) { +if (!allowed ||scan_freq_set_isempty (freqs_6ghz) || !sr->split) {scan_get_results (sc, sr, sr->freqs_scanned); goto free_allowed; }
@@ -1951,13 +1946,9 @@ static void scan_wiphy_watch(struct wiphy *wiphy,* Create a new 6GHz passive scan request and append to the * command list */ - freqs_6ghz =scan_freq_set_clone (allowed,BAND_FREQ_6_GHZ ); - msg =scan_build_cmd (sc, false, true, ¶ms, freqs_6ghz);l_queue_push_tail (sr->cmds, msg); -scan_freq_set_free (freqs_6ghz); -/* * If this periodic scan is at the top of the queue, continue * running it.
Signature · 1 line
2.25.1
Re: [PATCH 5/8] scan: allow splitting of scans with defined frequencies
Hi James,
Quoted 12 lines · James Prestwood
Currently the only way a scan can be split is if the request does not specify any frequencies, implying the request should scan the entire spectrum. This allows the scan logic to issue an extra request if 6GHz becomes available during the 2.4 or 5GHz scans. This restriction was somewhat arbitrary and done to let periodic scans pick up 6GHz APs through a single scan request.
But now with the addition of allowing user-disabled bands periodic scans will need to specify a frequency list in case a given band has been disabled. This will break the scan splitting code which is why this prep work is being done.
Quoted 8 lines
The main difference now is the original scan frequencies are tracked with the scan request. The reason for this is so if a request comes in with a limited set of 6GHz frequences IWD won't end up scanning the full 6GHz spectrum later on.
--- src/scan.c | 53 ++++++++++++++++++++++------------------------------- 1 file changed, 22 insertions(+), 31 deletions(-)
Looks good, mostly just nits:
src/scan.c static void scan_cmds_add(struct scan_request *sr, struct scan_context *sc, · line 578
Quoted 10 lines
src/scan.c +3
-1@@ -582,22 +571,29 @@ static void scan_cmds_add(struct scan_request *sr, struct scan_context *sc,bool passive, const struct scan_parameters *params) { + uint32_t bands = BAND_FREQ_2_4_GHZ | BAND_FREQ_5_GHZ | BAND_FREQ_6_GHZ;unsigned int i;struct scan_freq_set *subsets[2 ] = {0 }; -struct scan_freq_set *allowed =scan_get_allowed_freqs (sc); +struct scan_freq_set *allowed =wiphy_get_allowed_freqs (sc->wiphy, + bands);
Maybe use _auto_ here?
src/scan.c static void scan_cmds_add(struct scan_request *sr, struct scan_context *sc, · line 587
Quoted 11 lines
src/scan.c +4
-2const struct scan_freq_set *supported =wiphy_get_supported_freqs (sc->wiphy);/* -* If 6GHz is not possible, or already allowed, or the frequencies are -* explicit don't break up the request. +* No frequencies, just include the entire supported list and let the +* kernel filter out any disabled frequencies */ +if (!params->freqs) + sr->scan_freqs =scan_freq_set_clone (supported, bands);
Maybe l_steal_ptr(&allowed)? You went through the trouble of calculating it already?
Quoted 5 lines
src/scan.c +4
-0+else + sr->scan_freqs =scan_freq_set_clone (params->freqs, bands); + +/* If 6GHz is not possible or already allowed don't split the request */ if (!(scan_freq_set_get_bands(supported) & BAND_FREQ_6_GHZ) ||
src/scan.c static void scan_cmds_add(struct scan_request *sr, struct scan_context *sc, · line 599
Quoted 10 lines
src/scan.c +2
-3- (scan_freq_set_get_bands(allowed) & BAND_FREQ_6_GHZ) || - params->freqs) { + (scan_freq_set_get_bands(allowed) & BAND_FREQ_6_GHZ)) {scan_freq_set_free (allowed);scan_build_next_cmd (sr->cmds, sc, passive, - params, params->freqs); + params, sr->scan_freqs);return ; }
Regards,
-Denis
Re: [PATCH 5/8] scan: allow splitting of scans with defined frequencies
Hi Denis,
Quoted 54 lines · Denis Kenzior
Hi James,
Quoted 12 lines · James Prestwood
Currently the only way a scan can be split is if the request does not specify any frequencies, implying the request should scan the entire spectrum. This allows the scan logic to issue an extra request if 6GHz becomes available during the 2.4 or 5GHz scans. This restriction was somewhat arbitrary and done to let periodic scans pick up 6GHz APs through a single scan request.
But now with the addition of allowing user-disabled bands periodic scans will need to specify a frequency list in case a given band has been disabled. This will break the scan splitting code which is why this prep work is being done.
Quoted 8 lines
The main difference now is the original scan frequencies are tracked with the scan request. The reason for this is so if a request comes in with a limited set of 6GHz frequences IWD won't end up scanning the full 6GHz spectrum later on.
---
src/scan.c| 53 ++++++++++++++++++++++-------------------------------1 file changed, 22 insertions(+), 31 deletions(-)Looks good, mostly just nits:
src/scan.c static void scan_cmds_add(struct scan_request · line 580
Quoted 12 lines
src/scan.c +3
-1@@ -582,22 +571,29 @@ static void scan_cmds_add(struct scan_request *sr, struct scan_context *sc, bool passive, const struct scan_parameters *params) { + uint32_t bands = BAND_FREQ_2_4_GHZ | BAND_FREQ_5_GHZ |BAND_FREQ_6_GHZ ; unsigned int i; struct scan_freq_set *subsets[2] = { 0 }; - struct scan_freq_set *allowed = scan_get_allowed_freqs(sc); + struct scan_freq_set *allowed = wiphy_get_allowed_freqs(sc->wiphy, + bands);Maybe use _auto_ here?
Quoted 4 lines
const struct
scan_freq_set*supported =wiphy_get_supported_freqs(sc->wiphy); /*
- * If 6GHz is not possible, or already allowed, or theQuoted 8 lines
frequencies are
- * explicit don't break up the request.
+ * No frequencies, just include the entire supported list and let the
+ * kernel filter out any disabled frequencies
*/
+ if (!params->freqs)
+sr->scan_freqs=scan_freq_set_clone(supported, bands);
Quoted 1 line
Maybe l_steal_ptr(&allowed)? You went through the trouble of calculating it already?
In this case "allowed" is only used to check if 6Ghz is already supported so we know whether or not to split, not define the frequencies to scan. (I'll make it _auto_ though).
Quoted 20 lines
Quoted 16 lines
+ else
+sr->scan_freqs=scan_freq_set_clone(params->freqs, bands); +
+ /* If 6GHz is not possible or already allowed don't split the request */
if (!(scan_freq_set_get_bands(supported) &BAND_FREQ_6_GHZ) || - (scan_freq_set_get_bands(allowed)&BAND_FREQ_6_GHZ) || -params->freqs) {
+ (scan_freq_set_get_bands(allowed)&BAND_FREQ_6_GHZ)) {scan_freq_set_free(allowed); scan_build_next_cmd(sr->cmds, sc, passive,
- params,params->freqs);
+ params,sr->scan_freqs);
return;
}Regards,
-Denis
PATCH 6/8 scan: filter user-disabled bands for periodic scans.
In reply to James PrestwoodTo support user-disabled bands periodic scans need to specify a frequency list filtered by any bands that are disabled. This was needed in scan.c since periodic scans don't provide a frequency list in the scan request.
If no bands are disabled the allowed freqs API should still result in the same scan behavior as if a frequency list is left out i.e. IWD just filters the frequencies as opposed to the kernel.
--- src/scan.c | 46 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+)
src/scan.c +46 -0
@@ -990,9 +990,53 @@ static void scan_periodic_destroy(void *user_data) sc->sp.id =0 ; } +static struct scan_freq_set *scan_periodic_get_freqs (struct scan_context *sc) +{ +struct scan_freq_set *allowed; +struct scan_freq_set *band_6g; +const struct scan_freq_set *supported = +wiphy_get_supported_freqs (sc->wiphy); +uint32_t band_mask =0 ; + +if (RANK_2G_FACTOR ) + band_mask |=BAND_FREQ_2_4_GHZ ; +if (RANK_5G_FACTOR ) + band_mask |=BAND_FREQ_5_GHZ ; + + allowed =wiphy_get_allowed_freqs (sc->wiphy, band_mask); +if (!RANK_6G_FACTOR ) +return allowed; + +/* 2.4 and 5Ghz are disabled, this is not a workable configuration */ +if (!allowed) +return NULL ; + +/* +* 6GHz is special because initially its disabled until the regdom is +* established so (unless user disabled) we should always include those +* frequencies for periodic scans. +*/ + band_6g =scan_freq_set_clone (supported,BAND_FREQ_6_GHZ ); +scan_freq_set_merge (allowed, band_6g); +scan_freq_set_free (band_6g); + +return allowed; +} +static bool scan_periodic_queue (struct scan_context *sc) {struct scan_parameters params = {}; +struct scan_freq_set *freqs =scan_periodic_get_freqs (sc); + +/* +* If this happens its due to the user disabling all bands. This will +* cause IWD to never issue another periodic scan so warn the user of +* this. +*/ +if (L_WARN_ON (!freqs)) +return false; + + params.freqs = freqs;if (sc->sp.needs_active_scan &&known_networks_has_hidden ()) { params.randomize_mac_addr_hint = true;
@@ -1010,6 +1054,8 @@ static bool scan_periodic_queue(struct scan_context *sc) scan_periodic_notify, sc, scan_periodic_destroy); +scan_freq_set_free (freqs); +return sc->sp.id !=0 ; }
Signature · 1 line
2.25.1
Re: [PATCH 6/8] scan: filter user-disabled bands for periodic scans.
Hi James,
Quoted 23 lines · James Prestwood
To support user-disabled bands periodic scans need to specify a frequency list filtered by any bands that are disabled. This was needed in
scan.csince periodic scans don't provide a frequency list in the scan request.If no bands are disabled the allowed freqs API should still result in the same scan behavior as if a frequency list is left out i.e. IWD just filters the frequencies as opposed to the kernel.
--- src/scan.c | 46 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+)src/scan.c +3
-0@@ -990,9 +990,53 @@ static void scan_periodic_destroy(void *user_data) sc->sp.id =0 ; } +static struct scan_freq_set *scan_periodic_get_freqs (struct scan_context *sc) +{ +struct scan_freq_set *allowed;
src/scan.c static void scan_periodic_destroy(void *user_data) · line 1005
Quoted 10 lines
src/scan.c +10
-0+struct scan_freq_set *band_6g; +const struct scan_freq_set *supported = +wiphy_get_supported_freqs (sc->wiphy); +uint32_t band_mask =0 ; + +if (RANK_2G_FACTOR ) + band_mask |=BAND_FREQ_2_4_GHZ ; +if (RANK_5G_FACTOR ) + band_mask |=BAND_FREQ_5_GHZ ; +
If we're letting the kernel filter allowed frequencies, should this be just a clone of supported_freqs with band_mask set appropriately? Might make the logic here a bit simpler.
Quoted 10 lines
src/scan.c +10
-0+ allowed =wiphy_get_allowed_freqs (sc->wiphy, band_mask); +if (!RANK_6G_FACTOR ) +return allowed; + +/* 2.4 and 5Ghz are disabled, this is not a workable configuration */ +if (!allowed) +return NULL ; + +/* +* 6GHz is special because initially its disabled until the regdom is
src/scan.c static void scan_periodic_destroy(void *user_data) · line 1025
Quoted 10 lines
src/scan.c +10
-0+* established so (unless user disabled) we should always include those +* frequencies for periodic scans. +*/ + band_6g =scan_freq_set_clone (supported,BAND_FREQ_6_GHZ ); +scan_freq_set_merge (allowed, band_6g); +scan_freq_set_free (band_6g); + +return allowed; +} +
Regards,
-Denis
PATCH 7/8 station: support user-disabled bands
In reply to James PrestwoodThis adds support to allow users to disable entire bands, preventing scanning and connecting on those frequencies. If the [Rank].BandModifier* options are set to 0.0 it will imply those bands should not be used for scanning, connecting or roaming. This now applies to autoconnect, quick, hidden, roam, and dbus scans.
This is a station only feature meaning other modules like RRM, DPP, WSC or P2P may still utilize those bands. Trying to limit bands in those modules may sometimes conflict with the spec which is why it was not added there. In addition modules like DPP/WSC are only used in limited capacity for connecting so there is little benefit gained to disallowing those bands.
--- src/station.c | 134 +++++++++++++++++++++++++++++++++++++++++--------- 1 file changed, 110 insertions(+), 24 deletions(-)
src/station.c +110 -24
@@ -73,6 +73,9 @@ static bool supports_arp_evict_nocarrier;static bool supports_ndisc_evict_nocarrier;static struct watchlist event_watches;static uint32_t known_networks_watch; +static bool band_2_4ghz_disabled; +static bool band_5ghz_disabled; +static bool band_6ghz_disabled;struct station {enum station_state state;
@@ -1326,6 +1329,20 @@ static bool station_needs_hidden_network_scan(struct station *station)return !l_queue_isempty (station->hidden_bss_list_sorted); } +static struct scan_freq_set *station_get_allowed_freqs (struct station *station) +{ +uint32_t band_mask =0 ; + +if (!band_2_4ghz_disabled) + band_mask |=BAND_FREQ_2_4_GHZ ; +if (!band_5ghz_disabled) + band_mask |=BAND_FREQ_5_GHZ ; +if (!band_6ghz_disabled) + band_mask |=BAND_FREQ_6_GHZ ; + +return wiphy_get_allowed_freqs (station->wiphy, band_mask); +} + static uint32_t station_scan_trigger(struct station *station, struct scan_freq_set *freqs, scan_trigger_func_t triggered,
@@ -1411,6 +1428,7 @@ static void station_quick_scan_destroy(void *userdata)static int station_quick_scan_trigger (struct station *station) { _auto_(scan_freq_set_free) struct scan_freq_set *known_freq_set = NULL; + _auto_(scan_freq_set_free) struct scan_freq_set *allowed = NULL;bool known_6ghz;if (wiphy_regdom_is_updating (station->wiphy)) {
@@ -1440,9 +1458,14 @@ static int station_quick_scan_trigger(struct station *station) known_6ghz)return -ENOTSUP ; -if (!wiphy_constrain_freq_set (station->wiphy, known_freq_set)) { + allowed =station_get_allowed_freqs (station); +if (L_WARN_ON (!allowed)) +return -ENOTSUP ; + +scan_freq_set_constrain (known_freq_set, allowed); + +if (scan_freq_set_isempty (known_freq_set))return -ENOTSUP ; - } station->quick_scan_id = station_scan_trigger(station, known_freq_set,
@@ -2656,6 +2679,11 @@ static int station_roam_scan(struct station *station, struct scan_freq_set *freq_set) {struct scan_parameters params = { .freqs = freq_set, .flush = true }; + _auto_(scan_freq_set_free) struct scan_freq_set *allowed = +station_get_allowed_freqs (station); + +if (L_WARN_ON (!allowed)) +return -ENOTSUP ;l_debug ("ifindex: %u" ,netdev_get_ifindex (station->netdev));
@@ -2666,8 +2694,14 @@ static int station_roam_scan(struct station *station, params.ssid_len =strlen (ssid); } -if (!freq_set) +if (!freq_set) { station->roam_scan_full = true; + params.freqs = allowed; + }else +scan_freq_set_constrain (freq_set, allowed); + +if (L_WARN_ON (scan_freq_set_isempty (params.freqs))) +return -ENOTSUP ; station->roam_scan_id = scan_active_full(netdev_get_wdev_id(station->netdev), ¶ms,
@@ -3597,6 +3631,7 @@ static struct l_dbus_message *station_dbus_connect_hidden_network( };const char *ssid;struct network *network; + _auto_(scan_freq_set_free) struct scan_freq_set *allowed = NULL;l_debug ("" );
@@ -3647,6 +3682,11 @@ not_hidden:return dbus_error_not_hidden (message); } + allowed =station_get_allowed_freqs (station); +if (L_WARN_ON (!allowed)) +return dbus_error_not_supported (message); + + params.freqs = allowed; params.ssid = (const uint8_t *)ssid; params.ssid_len =strlen (ssid);
@@ -4268,38 +4308,77 @@ int station_hide_network(struct station *station, struct network *network)return 0 ; } -static void station_add_one_freq (uint32_t freq,void *user_data) +static void station_add_6ghz_freq (uint32_t freq,void *user_data) { -struct station *station = user_data; +struct scan_freq_set *set = user_data; -if (freq >3000 ) -scan_freq_set_add (station->scan_freqs_order[1 ], freq); -else if (!scan_freq_set_contains (station->scan_freqs_order[0 ], freq)) -scan_freq_set_add (station->scan_freqs_order[2 ], freq); +if (freq >5935 ) +scan_freq_set_add (set, freq); +} + +static void station_add_5ghz_freq (uint32_t freq,void *user_data) +{ +struct scan_freq_set *set = user_data; + +if (freq >3000 && freq <5935 ) +scan_freq_set_add (set, freq); +} + +static void station_add_2_4ghz_freq (uint32_t freq,void *user_data) +{ +struct scan_freq_set *set = user_data; + +/* exclude social channels added in initial scan request */ +if (freq <3000 && freq !=2412 && freq !=2437 && freq !=2462 ) +scan_freq_set_add (set, freq); }static void station_fill_scan_freq_subsets (struct station *station) { -const struct scan_freq_set *supported = -wiphy_get_supported_freqs (station->wiphy); + _auto_(scan_freq_set_free) struct scan_freq_set *allowed = +station_get_allowed_freqs (station); +unsigned int subset_idx =0 ; +if (L_WARN_ON (!allowed)) +return ;/* * Scan the 2.4GHz "social channels" first, 5GHz second, if supported, * all other 2.4GHz channels last. To be refined as needed. */ - station->scan_freqs_order[0 ] =scan_freq_set_new (); -scan_freq_set_add (station->scan_freqs_order[0 ],2412 ); -scan_freq_set_add (station->scan_freqs_order[0 ],2437 ); -scan_freq_set_add (station->scan_freqs_order[0 ],2462 ); - - station->scan_freqs_order[1 ] =scan_freq_set_new (); - station->scan_freqs_order[2 ] =scan_freq_set_new (); -scan_freq_set_foreach (supported, station_add_one_freq, station); - -if (scan_freq_set_isempty (station->scan_freqs_order[1 ])) { -scan_freq_set_free (station->scan_freqs_order[1 ]); - station->scan_freqs_order[1 ] = station->scan_freqs_order[2 ]; - station->scan_freqs_order[2 ] =NULL ; +if (!band_2_4ghz_disabled) { + station->scan_freqs_order[subset_idx] =scan_freq_set_new (); +scan_freq_set_add (station->scan_freqs_order[subset_idx],2412 ); +scan_freq_set_add (station->scan_freqs_order[subset_idx],2437 ); +scan_freq_set_add (station->scan_freqs_order[subset_idx],2462 ); + subset_idx++; + } + +/* +* TODO: It may might sense to split up 5 and 6ghz into separate subsets +* since the channel set is so large. +*/ +if (!band_5ghz_disabled || !band_6ghz_disabled) { +struct scan_freq_set *set =scan_freq_set_new (); + +if (!band_5ghz_disabled) +scan_freq_set_foreach (allowed, + station_add_5ghz_freq, set); +if (!band_6ghz_disabled) +scan_freq_set_foreach (allowed, + station_add_6ghz_freq, set); + +/* 5/6ghz didn't add any frequencies */ +if (scan_freq_set_isempty (set)) { +scan_freq_set_free (set); + }else + station->scan_freqs_order[subset_idx++] = set; + } + +/* Add remaining 2.4ghz channels to subset */ +if (!band_2_4ghz_disabled) { + station->scan_freqs_order[subset_idx] =scan_freq_set_new (); +scan_freq_set_foreach (allowed, station_add_2_4ghz_freq, + station->scan_freqs_order[subset_idx]); } }
@@ -5194,6 +5273,13 @@ static int station_init(void) station_known_networks_changed, NULL, NULL); + band_2_4ghz_disabled = +scan_get_band_rank_modifier (BAND_FREQ_2_4_GHZ ) ==0.0 ; + band_5ghz_disabled = +scan_get_band_rank_modifier (BAND_FREQ_5_GHZ ) ==0.0 ; + band_6ghz_disabled = +scan_get_band_rank_modifier (BAND_FREQ_6_GHZ ) ==0.0 ; +return 0 ; }
Signature · 1 line
2.25.1
Re: [PATCH 7/8] station: support user-disabled bands
Hi James,
Quoted 16 lines · James Prestwood
This adds support to allow users to disable entire bands, preventing scanning and connecting on those frequencies. If the [Rank].BandModifier* options are set to 0.0 it will imply those bands should not be used for scanning, connecting or roaming. This now applies to autoconnect, quick, hidden, roam, and dbus scans.
This is a station only feature meaning other modules like RRM, DPP, WSC or P2P may still utilize those bands. Trying to limit bands in those modules may sometimes conflict with the spec which is why it was not added there. In addition modules like DPP/WSC are only used in limited capacity for connecting so there is little benefit gained to disallowing those bands.
--- src/station.c | 134 +++++++++++++++++++++++++++++++++++++++++--------- 1 file changed, 110 insertions(+), 24 deletions(-)
<snip>
Quoted 4 lines
src/station.c +0
-0@@ -1326,6 +1329,20 @@ static bool station_needs_hidden_network_scan(struct station *station)return !l_queue_isempty (station->hidden_bss_list_sorted); }
src/station.c static bool station_needs_hidden_network_scan(struct station *station) · line 1341
Quoted 10 lines
src/station.c +10
-0+static struct scan_freq_set *station_get_allowed_freqs (struct station *station) +{ +uint32_t band_mask =0 ; + +if (!band_2_4ghz_disabled) + band_mask |=BAND_FREQ_2_4_GHZ ; +if (!band_5ghz_disabled) + band_mask |=BAND_FREQ_5_GHZ ; +if (!band_6ghz_disabled) + band_mask |=BAND_FREQ_6_GHZ ;
You might as well compute the band_mask in station_init directly.
Review static bool station_needs_hidden_network_scan(struct station *station) · line 1343
Quoted 2 lines
(quoted diff) +2
-0+ + return wiphy_get_allowed_freqs(station->wiphy, band_mask);
Same question here as the previous patch, should this be supported instead of allowed?
Quoted 14 lines
src/station.c +3
-0+} + static uint32_t station_scan_trigger(struct station *station, struct scan_freq_set *freqs, scan_trigger_func_t triggered,@@ -1411,6 +1428,7 @@ static void station_quick_scan_destroy(void *userdata)static int station_quick_scan_trigger (struct station *station) { _auto_(scan_freq_set_free) struct scan_freq_set *known_freq_set = NULL; + _auto_(scan_freq_set_free) struct scan_freq_set *allowed = NULL;bool known_6ghz;if (wiphy_regdom_is_updating (station->wiphy)) {
src/station.c static int station_quick_scan_trigger(struct station *station) · line 1465
Quoted 9 lines
src/station.c +5
-1@@ -1440,9 +1458,14 @@ static int station_quick_scan_trigger(struct station *station) known_6ghz)return -ENOTSUP ; -if (!wiphy_constrain_freq_set (station->wiphy, known_freq_set)) { + allowed =station_get_allowed_freqs (station); +if (L_WARN_ON (!allowed)) +return -ENOTSUP ; + +scan_freq_set_constrain (known_freq_set, allowed);
This looks fine, but does bring up the question. If we're now enabling 6G frequencies to be put into scan requests (even if they're not allowed now, in hope that regdom allows them after the split scan) should this logic be using supported frequencies and not allowed ones?
Quoted 20 lines
src/station.c +7
-1+ +if (scan_freq_set_isempty (known_freq_set))return -ENOTSUP ; - } station->quick_scan_id = station_scan_trigger(station, known_freq_set,@@ -2656,6 +2679,11 @@ static int station_roam_scan(struct station *station, struct scan_freq_set *freq_set) {struct scan_parameters params = { .freqs = freq_set, .flush = true }; + _auto_(scan_freq_set_free) struct scan_freq_set *allowed = +station_get_allowed_freqs (station); + +if (L_WARN_ON (!allowed)) +return -ENOTSUP ;l_debug ("ifindex: %u" ,netdev_get_ifindex (station->netdev));
src/station.c static int station_roam_scan(struct station *station, · line 2702
Quoted 10 lines
src/station.c +5
-1@@ -2666,8 +2694,14 @@ static int station_roam_scan(struct station *station, params.ssid_len =strlen (ssid); } -if (!freq_set) +if (!freq_set) { station->roam_scan_full = true; + params.freqs = allowed; + }else +scan_freq_set_constrain (freq_set, allowed); +
Same as above?
Quoted 5 lines
src/station.c +2
-0+if (L_WARN_ON (scan_freq_set_isempty (params.freqs))) +return -ENOTSUP ; station->roam_scan_id = scan_active_full(netdev_get_wdev_id(station->netdev), ¶ms,
<snip>
Quoted 73 lines
src/station.c +37
-21@@ -4268,38 +4308,77 @@ int station_hide_network(struct station *station, struct network *network)return 0 ; } -static void station_add_one_freq (uint32_t freq,void *user_data) +static void station_add_6ghz_freq (uint32_t freq,void *user_data) { -struct station *station = user_data; +struct scan_freq_set *set = user_data; -if (freq >3000 ) -scan_freq_set_add (station->scan_freqs_order[1 ], freq); -else if (!scan_freq_set_contains (station->scan_freqs_order[0 ], freq)) -scan_freq_set_add (station->scan_freqs_order[2 ], freq); +if (freq >5935 ) +scan_freq_set_add (set, freq); +} + +static void station_add_5ghz_freq (uint32_t freq,void *user_data) +{ +struct scan_freq_set *set = user_data; + +if (freq >3000 && freq <5935 ) +scan_freq_set_add (set, freq); +} + +static void station_add_2_4ghz_freq (uint32_t freq,void *user_data) +{ +struct scan_freq_set *set = user_data; + +/* exclude social channels added in initial scan request */ +if (freq <3000 && freq !=2412 && freq !=2437 && freq !=2462 ) +scan_freq_set_add (set, freq); }static void station_fill_scan_freq_subsets (struct station *station) { -const struct scan_freq_set *supported = -wiphy_get_supported_freqs (station->wiphy); + _auto_(scan_freq_set_free) struct scan_freq_set *allowed = +station_get_allowed_freqs (station); +unsigned int subset_idx =0 ; +if (L_WARN_ON (!allowed)) +return ;/* * Scan the 2.4GHz "social channels" first, 5GHz second, if supported, * all other 2.4GHz channels last. To be refined as needed. */ - station->scan_freqs_order[0 ] =scan_freq_set_new (); -scan_freq_set_add (station->scan_freqs_order[0 ],2412 ); -scan_freq_set_add (station->scan_freqs_order[0 ],2437 ); -scan_freq_set_add (station->scan_freqs_order[0 ],2462 ); - - station->scan_freqs_order[1 ] =scan_freq_set_new (); - station->scan_freqs_order[2 ] =scan_freq_set_new (); -scan_freq_set_foreach (supported, station_add_one_freq, station); - -if (scan_freq_set_isempty (station->scan_freqs_order[1 ])) { -scan_freq_set_free (station->scan_freqs_order[1 ]); - station->scan_freqs_order[1 ] = station->scan_freqs_order[2 ]; - station->scan_freqs_order[2 ] =NULL ; +if (!band_2_4ghz_disabled) { + station->scan_freqs_order[subset_idx] =scan_freq_set_new (); +scan_freq_set_add (station->scan_freqs_order[subset_idx],2412 ); +scan_freq_set_add (station->scan_freqs_order[subset_idx],2437 ); +scan_freq_set_add (station->scan_freqs_order[subset_idx],2462 ); + subset_idx++; + } + +/* +* TODO: It may might sense to split up 5 and 6ghz into separate subsets +* since the channel set is so large.
src/station.c int station_hide_network(struct station *station, struct network *network) · line 4368
Quoted 10 lines
src/station.c +10
-0+*/ +if (!band_5ghz_disabled || !band_6ghz_disabled) { +struct scan_freq_set *set =scan_freq_set_new (); + +if (!band_5ghz_disabled) +scan_freq_set_foreach (allowed, + station_add_5ghz_freq, set); +if (!band_6ghz_disabled) +scan_freq_set_foreach (allowed, + station_add_6ghz_freq, set);
Is there a better way to generate 5G/6G freqs than scan_freq_set_foreach? Isn't this wiphy_get_allowed_freqs() with a relevant band_mask?
Quoted 6 lines
src/station.c +6
-0+ +/* 5/6ghz didn't add any frequencies */ +if (scan_freq_set_isempty (set)) { +scan_freq_set_free (set); + }else + station->scan_freqs_order[subset_idx++] = set;
src/station.c int station_hide_network(struct station *station, struct network *network) · line 4384
Quoted 10 lines
src/station.c +7
-0+ } + +/* Add remaining 2.4ghz channels to subset */ +if (!band_2_4ghz_disabled) { + station->scan_freqs_order[subset_idx] =scan_freq_set_new (); +scan_freq_set_foreach (allowed, station_add_2_4ghz_freq, + station->scan_freqs_order[subset_idx]); } }
Regards,
-Denis
Re: [PATCH 7/8] station: support user-disabled bands
Hi Denis,
Quoted 62 lines · Denis Kenzior
Hi James,
Quoted 16 lines · James Prestwood
This adds support to allow users to disable entire bands, preventing scanning and connecting on those frequencies. If the [Rank].BandModifier* options are set to 0.0 it will imply those bands should not be used for scanning, connecting or roaming. This now applies to autoconnect, quick, hidden, roam, and dbus scans.
This is a station only feature meaning other modules like RRM, DPP, WSC or P2P may still utilize those bands. Trying to limit bands in those modules may sometimes conflict with the spec which is why it was not added there. In addition modules like DPP/WSC are only used in limited capacity for connecting so there is little benefit gained to disallowing those bands.
---
src/station.c| 134 +++++++++++++++++++++++++++++++++++++++++---------1 file changed, 110 insertions(+), 24 deletions(-)<snip>
Quoted 5 lines
src/station.c +1
-0@@ -1326,6 +1329,20 @@ static bool station_needs_hidden_network_scan(struct station *station) return !l_queue_isempty(station->hidden_bss_list_sorted); } +static struct scan_freq_set *station_get_allowed_freqs(struct stationsrc/station.c static bool · line 1342
Quoted 10 lines
src/station.c +9
-0*station) +{ + uint32_t band_mask = 0; + + if (!band_2_4ghz_disabled) + band_mask |= BAND_FREQ_2_4_GHZ; + if (!band_5ghz_disabled) + band_mask |= BAND_FREQ_5_GHZ; + if (!band_6ghz_disabled) + band_mask |= BAND_FREQ_6_GHZ;You might as well compute the
band_maskinstation_initdirectly.Review static bool · line 1344
Quoted 2 lines
(quoted diff) +2
-0+ + return wiphy_get_allowed_freqs(station->wiphy, band_mask);Same question here as the previous patch, should this be supported instead of allowed?
Quoted 17 lines
src/station.c +2
-0+} + static uint32_t station_scan_trigger(struct station *station, struct scan_freq_set *freqs,
scan_trigger_func_ttriggered,src/station.c +1
-0@@ -1411,6 +1428,7 @@ static void station_quick_scan_destroy(void *userdata) static int station_quick_scan_trigger(struct station *station) { _auto_(scan_freq_set_free) struct scan_freq_set *known_freq_set = NULL; + _auto_(scan_freq_set_free) struct scan_freq_set *allowed = NULL; bool known_6ghz; if (wiphy_regdom_is_updating(station->wiphy)) {@@ -1440,9 +1458,14 @@ static int station_quick_scan_trigger(struct station *station) known_6ghz) return -ENOTSUP;
Quoted 8 lines
src/station.c static int station_quick_scan_trigger(struct station *station) · line 1465
Quoted 6 lines
src/station.c +5
-1- if (!wiphy_constrain_freq_set(station->wiphy, known_freq_set)) { + allowed = station_get_allowed_freqs(station); + if (L_WARN_ON(!allowed)) + return -ENOTSUP; + + scan_freq_set_constrain(known_freq_set, allowed);This looks fine, but does bring up the question. If we're now enabling 6G frequencies to be put into scan requests (even if they're not allowed now, in hope that regdom allows them after the split scan) should this logic be using supported frequencies and not allowed ones?
I suppose there isn't any harm in that. I was more or less keeping things the same as they were, where only periodic scans are responsible for splitting and re-issuing 6ghz scans. But if IWD is doing a full scan via roaming, dbus, hidden etc. we might as well try and use 6ghz.
And here specifically, yes, I should retain 6ghz frequencies in the set.
Quoted 142 lines
Quoted 19 lines
src/station.c +7
-1+ + if (scan_freq_set_isempty(known_freq_set)) return -ENOTSUP; - } station->quick_scan_id = station_scan_trigger(station, known_freq_set,@@ -2656,6 +2679,11 @@ static int station_roam_scan(struct station *station, struct scan_freq_set *freq_set) { struct scan_parameters params = { .freqs = freq_set, .flush = true }; + _auto_(scan_freq_set_free) struct scan_freq_set *allowed = + station_get_allowed_freqs(station); + + if (L_WARN_ON(!allowed)) + return -ENOTSUP; l_debug("ifindex: %u", netdev_get_ifindex(station->netdev));src/station.c static int station_roam_scan(struct station · line 2702
Quoted 10 lines
src/station.c +5
-1@@ -2666,8 +2694,14 @@ static int station_roam_scan(struct station *station, params.ssid_len = strlen(ssid); } - if (!freq_set) + if (!freq_set) { station->roam_scan_full = true; + params.freqs = allowed; + } else + scan_freq_set_constrain(freq_set, allowed); +Same as above?
Quoted 4 lines
src/station.c +2
-0+ if (L_WARN_ON(scan_freq_set_isempty(params.freqs))) + return -ENOTSUP;
station->roam_scan_id= scan_active_full(netdev_get_wdev_id(station->netdev), ¶ms,<snip>
Quoted 74 lines
src/station.c +36
-21@@ -4268,38 +4308,77 @@ int station_hide_network(struct station *station, struct network *network) return 0; } -static void station_add_one_freq (uint32_t freq,void *user_data) +static void station_add_6ghz_freq (uint32_t freq,void *user_data) { - struct station *station = user_data; + struct scan_freq_set *set = user_data; - if (freq > 3000) - scan_freq_set_add(station->scan_freqs_order[1], freq); - else if (!scan_freq_set_contains(station->scan_freqs_order[0], freq)) - scan_freq_set_add(station->scan_freqs_order[2], freq); + if (freq > 5935) + scan_freq_set_add(set, freq); +} + +static void station_add_5ghz_freq (uint32_t freq,void *user_data) +{ + struct scan_freq_set *set = user_data; + + if (freq > 3000 && freq < 5935) + scan_freq_set_add(set, freq); +} + +static void station_add_2_4ghz_freq (uint32_t freq,void *user_data) +{ + struct scan_freq_set *set = user_data; + + /* exclude social channels added in initial scan request */ + if (freq < 3000 && freq != 2412 && freq != 2437 && freq != 2462) + scan_freq_set_add(set, freq); } static void station_fill_scan_freq_subsets(struct station *station) { - const struct scan_freq_set *supported = - wiphy_get_supported_freqs(station->wiphy); + _auto_(scan_freq_set_free) struct scan_freq_set *allowed = + station_get_allowed_freqs(station); + unsigned int subset_idx = 0; + if (L_WARN_ON(!allowed)) + return; /* * Scan the 2.4GHz "social channels" first, 5GHz second, if supported, * all other 2.4GHz channels last. To be refined as needed. */ - station->scan_freqs_order[0] = scan_freq_set_new(); - scan_freq_set_add(station->scan_freqs_order[0], 2412); - scan_freq_set_add(station->scan_freqs_order[0], 2437); - scan_freq_set_add(station->scan_freqs_order[0], 2462); - - station->scan_freqs_order[1] = scan_freq_set_new(); - station->scan_freqs_order[2] = scan_freq_set_new(); - scan_freq_set_foreach(supported, station_add_one_freq, station); - - if (scan_freq_set_isempty(station->scan_freqs_order[1])) { - scan_freq_set_free(station->scan_freqs_order[1]); - station->scan_freqs_order[1] = station->scan_freqs_order[2]; - station->scan_freqs_order[2] = NULL; + if (!band_2_4ghz_disabled) { + station->scan_freqs_order[subset_idx] = scan_freq_set_new(); + scan_freq_set_add(station->scan_freqs_order[subset_idx], 2412); + scan_freq_set_add(station->scan_freqs_order[subset_idx], 2437); + scan_freq_set_add(station->scan_freqs_order[subset_idx], 2462); + subset_idx++; + } + + /* +* TODO: It may might sense to split up 5 and 6ghz into separate subsets
+ * since the channel set is so large. + */
+ if (!band_5ghz_disabled || !band_6ghz_disabled) {Quoted 8 lines
+ struct
scan_freq_set*set =scan_freq_set_new(); +
+ if (!band_5ghz_disabled)
+ scan_freq_set_foreach(allowed,
+station_add_5ghz_freq, set); + if (!band_6ghz_disabled)
+ scan_freq_set_foreach(allowed,
+station_add_6ghz_freq, set);Is there a better way to generate 5G/6G freqs than scan_freq_set_foreach? Isn't this
wiphy_get_allowed_freqs()with a relevantband_mask?Quoted 13 lines
src/station.c +13
-0+ + /* 5/6ghz didn't add any frequencies */ + if (scan_freq_set_isempty(set)) { + scan_freq_set_free(set); + } else + station->scan_freqs_order[subset_idx++] = set; + } + + /* Add remaining 2.4ghz channels to subset */ + if (!band_2_4ghz_disabled) { + station->scan_freqs_order[subset_idx] = scan_freq_set_new(); + scan_freq_set_foreach(allowed, station_add_2_4ghz_freq, + station->scan_freqs_order[subset_idx]);Quoted 2 lines
}
}Regards,
-Denis
PATCH 8/8 doc: document disabling bands with a 0.0 modifier
In reply to James Prestwood--- src/iwd.config.rst | 9 +++++++++ 1 file changed, 9 insertions(+)
src/iwd.config.rst +9 -0
@@ -297,6 +297,9 @@ autoconnect purposes. Increase or decrease the preference for 2.4GHz access points by increasing or decreasing the value of this modifier. + A value of 0.0 will disable the 2.4GHz band and prevent scanning or + connecting on those frequencies. + * - BandModifier5Ghz - Values: floating point value (default: **1.0**)
@@ -306,6 +309,9 @@ autoconnect purposes. networks are highly RSSI sensitive, so it is still possible for IWD to prefer 2.4Ghz APs in certain circumstances. + A value of 0.0 will disable the 5GHz band and prevent scanning or + connecting on those frequencies. + * - BandModifier6Ghz - Values: floating point value (default: **1.0**)
@@ -313,6 +319,9 @@ autoconnect purposes. or decreasing the value of this modifier. Since 6GHz networks are highly RSSI sensitive, this gives an option to prefer 6GHz APs over 5GHz APs. + A value of 0.0 will disable the 6GHz band and prevent scanning or + connecting on those frequencies. + Scan ----
Signature · 1 line
2.25.1
Hi James,
Quoted 5 lines · James Prestwood
Similar to the 5/6Ghz options, allow modifying the rank for 2.4Ghz scan results.
--- src/scan.c | 8 ++++++++ 1 file changed, 8 insertions(+)
Patches 1-4 applied, thanks.
Regards,
-Denis