3
0
mirror of https://git.kernel.org/pub/scm/network/wireless/iwd.git synced 2024-12-23 06:02:37 +01:00

scan: allow 5G factor to be user configurable

Some users may need their own control over 2.4/5GHz preference. This
adds a new user option, 'rank_5g_factor', which allows users to increase
or decrease their 5G preference.
This commit is contained in:
James Prestwood 2019-02-26 10:31:58 -08:00 committed by Denis Kenzior
parent 569ffdd508
commit a0d8511331

View File

@ -1015,13 +1015,15 @@ static struct scan_bss *scan_parse_result(struct l_genl_msg *msg,
return bss;
}
/* User configurable options */
static double RANK_5G_FACTOR;
static void scan_bss_compute_rank(struct scan_bss *bss)
{
static const double RANK_RSNE_FACTOR = 1.2;
static const double RANK_WPA_FACTOR = 1.0;
static const double RANK_OPEN_FACTOR = 0.5;
static const double RANK_NO_PRIVACY_FACTOR = 0.5;
static const double RANK_5G_FACTOR = 1.1;
static const double RANK_HIGH_UTILIZATION_FACTOR = 0.8;
static const double RANK_LOW_UTILIZATION_FACTOR = 1.2;
static const double RANK_MIN_SUPPORTED_RATE_FACTOR = 0.8;
@ -1710,6 +1712,8 @@ void scan_freq_set_foreach(struct scan_freq_set *freqs,
bool scan_init(struct l_genl_family *in)
{
const struct l_settings *config = iwd_get_config();
nl80211 = in;
scan_id = l_genl_family_register(nl80211, "scan", scan_notify,
NULL, NULL);
@ -1721,6 +1725,10 @@ bool scan_init(struct l_genl_family *in)
scan_contexts = l_queue_new();
if (!l_settings_get_double(config, "Rank", "rank_5g_factor",
&RANK_5G_FACTOR))
RANK_5G_FACTOR = 1.0;
return true;
}