mirror of
https://git.kernel.org/pub/scm/network/wireless/iwd.git
synced 2024-11-18 18:29:29 +01:00
wiphy: Add freq set constrain API
This commit is contained in:
parent
5be3de7484
commit
c44da22470
17
src/scan.c
17
src/scan.c
@ -1725,6 +1725,23 @@ void scan_freq_set_foreach(const struct scan_freq_set *freqs,
|
||||
}
|
||||
}
|
||||
|
||||
void scan_freq_set_constrain(struct scan_freq_set *set,
|
||||
const struct scan_freq_set *constraint)
|
||||
{
|
||||
struct l_uintset *intersection;
|
||||
|
||||
intersection = l_uintset_intersect(constraint->channels_5ghz,
|
||||
set->channels_5ghz);
|
||||
if (!intersection)
|
||||
/* This shouldn't ever be the case. */
|
||||
return;
|
||||
|
||||
l_uintset_free(set->channels_5ghz);
|
||||
set->channels_5ghz = intersection;
|
||||
|
||||
set->channels_2ghz &= constraint->channels_2ghz;
|
||||
}
|
||||
|
||||
bool scan_init(struct l_genl_family *in)
|
||||
{
|
||||
const struct l_settings *config = iwd_get_config();
|
||||
|
@ -126,6 +126,8 @@ void scan_freq_set_foreach(const struct scan_freq_set *freqs,
|
||||
scan_freq_set_func_t func, void *user_data);
|
||||
void scan_freq_set_merge(struct scan_freq_set *to,
|
||||
const struct scan_freq_set *from);
|
||||
void scan_freq_set_constrain(struct scan_freq_set *set,
|
||||
const struct scan_freq_set *constraint);
|
||||
|
||||
bool scan_ifindex_add(uint32_t ifindex);
|
||||
bool scan_ifindex_remove(uint32_t ifindex);
|
||||
|
12
src/wiphy.c
12
src/wiphy.c
@ -306,6 +306,18 @@ bool wiphy_supports_adhoc_rsn(struct wiphy *wiphy)
|
||||
return wiphy->support_adhoc_rsn;
|
||||
}
|
||||
|
||||
bool wiphy_constrain_freq_set(const struct wiphy *wiphy,
|
||||
struct scan_freq_set *set)
|
||||
{
|
||||
scan_freq_set_constrain(set, wiphy->supported_freqs);
|
||||
|
||||
if (!scan_freq_set_get_bands(set))
|
||||
/* The set is empty. */
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static char **wiphy_get_supported_iftypes(struct wiphy *wiphy, uint16_t mask)
|
||||
{
|
||||
uint16_t supported_mask = wiphy->supported_iftypes & mask;
|
||||
|
@ -25,6 +25,7 @@
|
||||
|
||||
struct wiphy;
|
||||
struct scan_bss;
|
||||
struct scan_freq_set;
|
||||
|
||||
enum wiphy_state_watch_event {
|
||||
WIPHY_STATE_WATCH_EVENT_POWERED,
|
||||
@ -50,6 +51,9 @@ struct wiphy *wiphy_create(uint32_t wiphy_id, const char *name);
|
||||
bool wiphy_destroy(struct wiphy *wiphy);
|
||||
void wiphy_update_from_genl(struct wiphy *wiphy, struct l_genl_msg *msg);
|
||||
|
||||
bool wiphy_constrain_freq_set(const struct wiphy *wiphy,
|
||||
struct scan_freq_set *set);
|
||||
|
||||
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(
|
||||
|
Loading…
Reference in New Issue
Block a user