nl80211: MBSSID and EMA support in AP mode

Add new attributes to configure support for multiple BSSID
and advanced multi-BSSID advertisements (EMA) in AP mode.

- NL80211_ATTR_MBSSID_CONFIG used for per interface configuration.
- NL80211_ATTR_MBSSID_ELEMS used to MBSSID elements for beacons.

Memory for the elements is allocated dynamically. This change frees
the memory in existing functions which call nl80211_parse_beacon(),
a comment is added to indicate the new references to do the same.

Signed-off-by: John Crispin <john@phrozen.org>
Co-developed-by: Aloka Dixit <alokad@codeaurora.org>
Signed-off-by: Aloka Dixit <alokad@codeaurora.org>
Link: https://lore.kernel.org/r/20210916025437.29138-2-alokad@codeaurora.org
[don't leave ERR_PTR hanging around]
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
This commit is contained in:
John Crispin 2021-09-15 19:54:34 -07:00 committed by Johannes Berg
parent 05075fe745
commit dc1e3cb8da
3 changed files with 293 additions and 5 deletions

View file

@ -360,7 +360,10 @@
* @NL80211_CMD_DEL_INTERFACE: Virtual interface was deleted, has attributes
* %NL80211_ATTR_IFINDEX and %NL80211_ATTR_WIPHY. Can also be sent from
* userspace to request deletion of a virtual interface, then requires
* attribute %NL80211_ATTR_IFINDEX.
* attribute %NL80211_ATTR_IFINDEX. If multiple BSSID advertisements are
* enabled using %NL80211_ATTR_MBSSID_CONFIG, %NL80211_ATTR_MBSSID_ELEMS,
* and if this command is used for the transmitting interface, then all
* the non-transmitting interfaces are deleted as well.
*
* @NL80211_CMD_GET_KEY: Get sequence counter information for a key specified
* by %NL80211_ATTR_KEY_IDX and/or %NL80211_ATTR_MAC.
@ -2624,6 +2627,18 @@ enum nl80211_commands {
* @NL80211_ATTR_COLOR_CHANGE_ELEMS: Nested set of attributes containing the IE
* information for the time while performing a color switch.
*
* @NL80211_ATTR_MBSSID_CONFIG: Nested attribute for multiple BSSID
* advertisements (MBSSID) parameters in AP mode.
* Kernel uses this attribute to indicate the driver's support for MBSSID
* and enhanced multi-BSSID advertisements (EMA AP) to the userspace.
* Userspace should use this attribute to configure per interface MBSSID
* parameters.
* See &enum nl80211_mbssid_config_attributes for details.
*
* @NL80211_ATTR_MBSSID_ELEMS: Nested parameter to pass multiple BSSID elements.
* Mandatory parameter for the transmitting interface to enable MBSSID.
* Optional for the non-transmitting interfaces.
*
* @NUM_NL80211_ATTR: total number of nl80211_attrs available
* @NL80211_ATTR_MAX: highest attribute number currently defined
* @__NL80211_ATTR_AFTER_LAST: internal use
@ -3127,6 +3142,9 @@ enum nl80211_attrs {
NL80211_ATTR_COLOR_CHANGE_COLOR,
NL80211_ATTR_COLOR_CHANGE_ELEMS,
NL80211_ATTR_MBSSID_CONFIG,
NL80211_ATTR_MBSSID_ELEMS,
/* add attributes here, update the policy in nl80211.c */
__NL80211_ATTR_AFTER_LAST,
@ -7386,4 +7404,60 @@ enum nl80211_sar_specs_attrs {
NL80211_SAR_ATTR_SPECS_MAX = __NL80211_SAR_ATTR_SPECS_LAST - 1,
};
/**
* enum nl80211_mbssid_config_attributes - multiple BSSID (MBSSID) and enhanced
* multi-BSSID advertisements (EMA) in AP mode.
* Kernel uses some of these attributes to advertise driver's support for
* MBSSID and EMA.
* Remaining attributes should be used by the userspace to configure the
* features.
*
* @__NL80211_MBSSID_CONFIG_ATTR_INVALID: Invalid
*
* @NL80211_MBSSID_CONFIG_ATTR_MAX_INTERFACES: Used by the kernel to advertise
* the maximum number of MBSSID interfaces supported by the driver.
* Driver should indicate MBSSID support by setting
* wiphy->mbssid_max_interfaces to a value more than or equal to 2.
*
* @NL80211_MBSSID_CONFIG_ATTR_MAX_EMA_PROFILE_PERIODICITY: Used by the kernel
* to advertise the maximum profile periodicity supported by the driver
* if EMA is enabled. Driver should indicate EMA support to the userspace
* by setting wiphy->mbssid_max_ema_profile_periodicity to
* a non-zero value.
*
* @NL80211_MBSSID_CONFIG_ATTR_INDEX: Mandatory parameter to pass the index of
* this BSS (u8) in the multiple BSSID set.
* Value must be set to 0 for the transmitting interface and non-zero for
* all non-transmitting interfaces. The userspace will be responsible
* for using unique indices for the interfaces.
* Range: 0 to wiphy->mbssid_max_interfaces-1.
*
* @NL80211_MBSSID_CONFIG_ATTR_TX_IFINDEX: Mandatory parameter for
* a non-transmitted profile which provides the interface index (u32) of
* the transmitted profile. The value must match one of the interface
* indices advertised by the kernel. Optional if the interface being set up
* is the transmitting one, however, if provided then the value must match
* the interface index of the same.
*
* @NL80211_MBSSID_CONFIG_ATTR_EMA: Flag used to enable EMA AP feature.
* Setting this flag is permitted only if the driver advertises EMA support
* by setting wiphy->mbssid_max_ema_profile_periodicity to non-zero.
*
* @__NL80211_MBSSID_CONFIG_ATTR_LAST: Internal
* @NL80211_MBSSID_CONFIG_ATTR_MAX: highest attribute
*/
enum nl80211_mbssid_config_attributes {
__NL80211_MBSSID_CONFIG_ATTR_INVALID,
NL80211_MBSSID_CONFIG_ATTR_MAX_INTERFACES,
NL80211_MBSSID_CONFIG_ATTR_MAX_EMA_PROFILE_PERIODICITY,
NL80211_MBSSID_CONFIG_ATTR_INDEX,
NL80211_MBSSID_CONFIG_ATTR_TX_IFINDEX,
NL80211_MBSSID_CONFIG_ATTR_EMA,
/* keep last */
__NL80211_MBSSID_CONFIG_ATTR_LAST,
NL80211_MBSSID_CONFIG_ATTR_MAX = __NL80211_MBSSID_CONFIG_ATTR_LAST - 1,
};
#endif /* __LINUX_NL80211_H */