commit b4406cce82f49f5a1e32f0588468112e80b17844
parent 644586e27393dbd81c5baaa5458cb7afdf65d14a
Author: Marcel Holtmann <marcel@holtmann.org>
Date: Sun, 13 Nov 2022 15:07:35 +0100
scan: Add support for separate 6Ghz band modifier
Diffstat:
2 files changed, 18 insertions(+), 2 deletions(-)
diff --git a/src/iwd.config.rst b/src/iwd.config.rst
@@ -310,6 +310,13 @@ autoconnect purposes.
networks are highly RSSI sensitive, so it is still possible for IWD to
prefer 2.4Ghz APs in certain circumstances.
+ * - BandModifier6Ghz
+ - Values: floating point value (default: **1.0**)
+
+ Increase or decrease the preference for 6GHz access points by increasing
+ 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.
+
Scan
----
diff --git a/src/scan.c b/src/scan.c
@@ -54,6 +54,7 @@
/* User configurable options */
static double RANK_5G_FACTOR;
+static double RANK_6G_FACTOR;
static uint32_t SCAN_MAX_INTERVAL;
static uint32_t SCAN_INIT_INTERVAL;
@@ -1645,10 +1646,14 @@ static void scan_bss_compute_rank(struct scan_bss *bss)
rank = (double)bss->data_rate / max_rate * USHRT_MAX;
- /* Prefer 5G/6G networks over 2.4G */
- if (bss->frequency > 4000)
+ /* Prefer 5G networks over 2.4G and 6G */
+ if (bss->frequency >= 4900 && bss->frequency < 5900)
rank *= RANK_5G_FACTOR;
+ /* Prefer 6G networks over 2.4G and 5G */
+ if (bss->frequency >= 5900 && bss->frequency < 7200)
+ rank *= RANK_6G_FACTOR;
+
/* Rank loaded APs lower and lightly loaded APs higher */
if (bss->utilization >= 192)
rank *= RANK_HIGH_UTILIZATION_FACTOR;
@@ -2343,6 +2348,10 @@ static int scan_init(void)
&RANK_5G_FACTOR))
RANK_5G_FACTOR = 1.0;
+ if (!l_settings_get_double(config, "Rank", "BandModifier6Ghz",
+ &RANK_6G_FACTOR))
+ RANK_6G_FACTOR = 1.0;
+
if (!l_settings_get_uint(config, "Scan", "InitialPeriodicScanInterval",
&SCAN_INIT_INTERVAL))
SCAN_INIT_INTERVAL = 10;