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

wiphy: Add wiphy_get_ext_feature

Save the extended features reported by the wiphy in the NEW_WIPHY event
or GET_WIPHY dump and allow netdev to query it with
wiphy_get_ext_feature()
This commit is contained in:
Andrew Zaborowski 2017-05-19 03:39:31 +02:00 committed by Denis Kenzior
parent a2b9cd0726
commit fd4ab5d3df
2 changed files with 15 additions and 0 deletions

View File

@ -43,6 +43,7 @@
#include "src/rfkill.h" #include "src/rfkill.h"
#include "src/wiphy.h" #include "src/wiphy.h"
#include "src/storage.h" #include "src/storage.h"
#include "src/util.h"
static struct l_genl_family *nl80211 = NULL; static struct l_genl_family *nl80211 = NULL;
static struct l_hwdb *hwdb; static struct l_hwdb *hwdb;
@ -53,6 +54,7 @@ struct wiphy {
uint32_t id; uint32_t id;
char name[20]; char name[20];
uint32_t feature_flags; uint32_t feature_flags;
uint8_t ext_features[2];
bool support_scheduled_scan:1; bool support_scheduled_scan:1;
bool support_rekey_offload:1; bool support_rekey_offload:1;
uint16_t supported_ciphers; uint16_t supported_ciphers;
@ -179,6 +181,12 @@ bool wiphy_can_connect(struct wiphy *wiphy, struct scan_bss *bss)
return true; return true;
} }
bool wiphy_get_ext_feature(struct wiphy *wiphy, unsigned int idx)
{
return idx < sizeof(wiphy->ext_features) * 8 &&
util_is_bit_set(wiphy->ext_features[idx >> 3], idx & 7);
}
static void wiphy_print_basic_info(struct wiphy *wiphy) static void wiphy_print_basic_info(struct wiphy *wiphy)
{ {
uint32_t bands; uint32_t bands;
@ -339,6 +347,12 @@ static void wiphy_parse_attributes(struct wiphy *wiphy,
else else
wiphy->feature_flags = *((uint32_t *) data); wiphy->feature_flags = *((uint32_t *) data);
break;
case NL80211_ATTR_EXT_FEATURES:
if (len > sizeof(wiphy->ext_features))
len = sizeof(wiphy->ext_features);
memcpy(wiphy->ext_features, data, len);
break; break;
case NL80211_ATTR_SUPPORTED_COMMANDS: case NL80211_ATTR_SUPPORTED_COMMANDS:
if (l_genl_attr_recurse(attr, &nested)) if (l_genl_attr_recurse(attr, &nested))

View File

@ -34,6 +34,7 @@ struct wiphy *wiphy_find(int wiphy_id);
const char *wiphy_get_path(struct wiphy *wiphy); const char *wiphy_get_path(struct wiphy *wiphy);
uint32_t wiphy_get_supported_bands(struct wiphy *wiphy); uint32_t wiphy_get_supported_bands(struct wiphy *wiphy);
bool wiphy_can_connect(struct wiphy *wiphy, struct scan_bss *bss); bool wiphy_can_connect(struct wiphy *wiphy, struct scan_bss *bss);
bool wiphy_get_ext_feature(struct wiphy *wiphy, unsigned int idx);
bool wiphy_init(struct l_genl_family *in, const char *whitelist, bool wiphy_init(struct l_genl_family *in, const char *whitelist,
const char *blacklist); const char *blacklist);