mirror of
https://git.kernel.org/pub/scm/network/wireless/iwd.git
synced 2025-01-03 10:32:33 +01:00
scan: add scan_get_band_rank_modifier
This 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.
This commit is contained in:
parent
043a050e57
commit
e4fb9786c5
41
src/scan.c
41
src/scan.c
@ -2310,6 +2310,33 @@ bool scan_get_firmware_scan(uint64_t wdev_id, scan_notify_func_t notify,
|
|||||||
return true;
|
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)
|
bool scan_wdev_add(uint64_t wdev_id)
|
||||||
{
|
{
|
||||||
struct scan_context *sc;
|
struct scan_context *sc;
|
||||||
@ -2359,17 +2386,9 @@ static int scan_init(void)
|
|||||||
|
|
||||||
scan_contexts = l_queue_new();
|
scan_contexts = l_queue_new();
|
||||||
|
|
||||||
if (!l_settings_get_double(config, "Rank", "BandModifier2_4Ghz",
|
RANK_2G_FACTOR = scan_get_band_rank_modifier(BAND_FREQ_2_4_GHZ);
|
||||||
&RANK_2G_FACTOR))
|
RANK_5G_FACTOR = scan_get_band_rank_modifier(BAND_FREQ_5_GHZ);
|
||||||
RANK_2G_FACTOR = 1.0;
|
RANK_6G_FACTOR = scan_get_band_rank_modifier(BAND_FREQ_6_GHZ);
|
||||||
|
|
||||||
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;
|
|
||||||
|
|
||||||
if (!l_settings_get_uint(config, "Scan", "InitialPeriodicScanInterval",
|
if (!l_settings_get_uint(config, "Scan", "InitialPeriodicScanInterval",
|
||||||
&SCAN_INIT_INTERVAL))
|
&SCAN_INIT_INTERVAL))
|
||||||
|
@ -29,6 +29,7 @@ struct p2p_beacon;
|
|||||||
struct mmpdu_header;
|
struct mmpdu_header;
|
||||||
struct wiphy;
|
struct wiphy;
|
||||||
enum security;
|
enum security;
|
||||||
|
enum band_freq;
|
||||||
|
|
||||||
enum scan_state {
|
enum scan_state {
|
||||||
SCAN_STATE_NOT_RUNNING,
|
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,
|
size_t body_len,
|
||||||
uint32_t frequency, int rssi);
|
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_add(uint64_t wdev_id);
|
||||||
bool scan_wdev_remove(uint64_t wdev_id);
|
bool scan_wdev_remove(uint64_t wdev_id);
|
||||||
|
Loading…
Reference in New Issue
Block a user