($INBOX_DIR/description missing)
 help / color / mirror / Atom feed
From: James Prestwood <prestwoj@gmail.com>
To: iwd@lists.linux.dev
Cc: James Prestwood <prestwoj@gmail.com>
Subject: [PATCH 1/8] scan: add [Rank].BandModifier2_4Ghz
Date: Mon, 25 Sep 2023 11:54:15 -0700	[thread overview]
Message-ID: <20230925185422.2242494-1-prestwoj@gmail.com> (raw)

Similar to the 5/6Ghz options, allow modifying the rank for 2.4Ghz
scan results.
---
 src/scan.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/src/scan.c b/src/scan.c
index 5a972efb..3979dc03 100644
--- a/src/scan.c
+++ b/src/scan.c
@@ -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;
-- 
2.25.1


             reply	other threads:[~2023-09-25 18:54 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-25 18:54 James Prestwood [this message]
2023-09-25 18:54 ` [PATCH 2/8] doc: document [Rank].BandModifier2_4Ghz James Prestwood
2023-09-25 18:54 ` [PATCH 3/8] scan: add scan_get_band_rank_modifier James Prestwood
2023-09-25 18:54 ` [PATCH 4/8] wiphy: add wiphy_get_allowed_freqs James Prestwood
2023-09-25 18:54 ` [PATCH 5/8] scan: allow splitting of scans with defined frequencies James Prestwood
2023-09-27 19:52   ` Denis Kenzior
2023-09-28 11:37     ` James Prestwood
2023-09-25 18:54 ` [PATCH 6/8] scan: filter user-disabled bands for periodic scans James Prestwood
2023-09-27 20:29   ` Denis Kenzior
2023-09-25 18:54 ` [PATCH 7/8] station: support user-disabled bands James Prestwood
2023-09-27 20:49   ` Denis Kenzior
2023-09-28 11:35     ` James Prestwood
2023-09-25 18:54 ` [PATCH 8/8] doc: document disabling bands with a 0.0 modifier James Prestwood
2023-09-27 19:48 ` [PATCH 1/8] scan: add [Rank].BandModifier2_4Ghz 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=20230925185422.2242494-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).