cfg80211: add extensible feature flag attribute

*ported from kernel 3.18

With the wiphy::features flag being used up this patch adds a
new field wiphy::ext_features. Considering extensibility this
new field is declared as a byte array. This extensible flag is
exposed to user-space by NL80211_ATTR_EXT_FEATURES.

Cc: Avinash Patil <patila@marvell.com>
Signed-off-by: Gautam (Gautam Kumar) Shukla <gautams@broadcom.com>
Signed-off-by: Arend van Spriel <arend@broadcom.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Git-commit: d75bb06b61cb69ee6223d791d3bb230e68623b20
Git-repo: git://git.kernel.org/pub/scm/linux/kernel/git/jberg/mac80211-next.git
CRs-Fixed: 1098230
Change-Id: Ice288928b17340a571c1acca719325fbf1020072
This commit is contained in:
Gautam Kumar Shukla
2021-10-10 23:46:46 +02:00
committed by Francescodario Cuzzocrea
parent 124fa8b668
commit 73f11d4d96
3 changed files with 66 additions and 0 deletions
+22
View File
@@ -1481,6 +1481,13 @@ enum nl80211_commands {
* @NL80211_ATTR_TDLS_PEER_CAPABILITY: flags for TDLS peer capabilities, u32.
* As specified in the &enum nl80211_tdls_peer_capability.
*
* @NL80211_ATTR_EXT_FEATURES: extended feature flags contained in a byte
* array. The feature flags are identified by their bit index (see &enum
* nl80211_ext_feature_index). The bit index is ordered starting at the
* least-significant bit of the first byte in the array, ie. bit index 0
* is located at bit 0 of byte 0. bit index 25 would be located at bit 1
* of byte 3 (u8 array).
*
* @NL80211_ATTR_MAX: highest attribute number currently defined
* @__NL80211_ATTR_AFTER_LAST: internal use
*/
@@ -1817,6 +1824,8 @@ enum nl80211_attrs {
NL80211_ATTR_TDLS_PEER_CAPABILITY,
NL80211_ATTR_EXT_FEATURES,
/* add attributes here, update the policy in nl80211.c */
__NL80211_ATTR_AFTER_LAST,
@@ -3235,6 +3244,19 @@ enum nl80211_feature_flags {
NL80211_FEATURE_INACTIVITY_TIMER = 1 << 2,
};
/**
* enum nl80211_ext_feature_index - bit index of extended features.
*
* @NUM_NL80211_EXT_FEATURES: number of extended features.
* @MAX_NL80211_EXT_FEATURES: highest extended feature index.
*/
enum nl80211_ext_feature_index {
/* add new features before the definition below */
NUM_NL80211_EXT_FEATURES,
MAX_NL80211_EXT_FEATURES = NUM_NL80211_EXT_FEATURES - 1
};
/**
* enum nl80211_probe_resp_offload_support_attr - optional supported
* protocols for probe-response offloading by the driver/FW.
+39
View File
@@ -2184,6 +2184,8 @@ struct wiphy_vendor_command {
* subject to any restrictions since they are purely managed in SW.
* @flags: wiphy flags, see &enum wiphy_flags
* @features: features advertised to nl80211, see &enum nl80211_feature_flags.
* @ext_features: extended features advertised to nl80211, see
* &enum nl80211_ext_feature_index.
* @bss_priv_size: each BSS struct has private data allocated with it,
* this variable determines its size
* @max_scan_ssids: maximum number of SSIDs the device can scan for in
@@ -2270,6 +2272,7 @@ struct wiphy {
u16 max_acl_mac_addrs;
u32 flags, features;
u8 ext_features[DIV_ROUND_UP(NUM_NL80211_EXT_FEATURES, 8)];
u32 ap_sme_capa;
@@ -3805,6 +3808,42 @@ void cfg80211_ft_event(struct net_device *netdev,
struct cfg80211_ft_event_params *ft_event);
/**
* wiphy_ext_feature_set - set the extended feature flag
*
* @wiphy: the wiphy to modify.
* @ftidx: extended feature bit index.
*
* The extended features are flagged in multiple bytes (see
* &struct wiphy.@ext_features)
*/
static inline void wiphy_ext_feature_set(struct wiphy *wiphy,
enum nl80211_ext_feature_index ftidx)
{
u8 *ft_byte;
ft_byte = &wiphy->ext_features[ftidx / 8];
*ft_byte |= BIT(ftidx % 8);
}
/**
* wiphy_ext_feature_isset - check the extended feature flag
*
* @wiphy: the wiphy to modify.
* @ftidx: extended feature bit index.
*
* The extended features are flagged in multiple bytes (see
* &struct wiphy.@ext_features)
*/
static inline bool
wiphy_ext_feature_isset(struct wiphy *wiphy,
enum nl80211_ext_feature_index ftidx)
{
u8 ft_byte;
ft_byte = wiphy->ext_features[ftidx / 8];
return (ft_byte & BIT(ftidx % 8)) != 0;
}
/**
* cfg80211_ap_stopped - notify userspace that AP mode stopped
+5
View File
@@ -1163,6 +1163,11 @@ static int nl80211_send_wiphy(struct sk_buff *msg, u32 pid, u32 seq, int flags,
nla_nest_end(msg, nested);
}
if (nla_put(msg, NL80211_ATTR_EXT_FEATURES,
sizeof(*dev->wiphy.ext_features),
dev->wiphy.ext_features))
goto nla_put_failure;
return genlmsg_end(msg, hdr);
nla_put_failure: