Commit 3b3e808c authored by David S. Miller's avatar David S. Miller
Browse files

Merge tag 'mac80211-next-for-net-next-2020-02-24' of...

Merge tag 'mac80211-next-for-net-next-2020-02-24' of git://git.kernel.org/pub/scm/linux/kernel/git/jberg/mac80211-next



Johannes Berg says:

====================
A new set of changes:
 * lots of small documentation fixes, from Jérôme Pouiller
 * beacon protection (BIGTK) support from Jouni Malinen
 * some initial code for TID configuration, from Tamizh chelvam
 * I reverted some new API before it's actually used, because
   it's wrong to mix controlled port and preauth
 * a few other cleanups/fixes
====================

Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parents 13ef6ae8 370f51d5
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -2947,6 +2947,7 @@ static int mac80211_hwsim_new_radio(struct genl_info *info,
			       NL80211_FEATURE_DYNAMIC_SMPS |
			       NL80211_FEATURE_SCAN_RANDOM_MAC_ADDR;
	wiphy_ext_feature_set(hw->wiphy, NL80211_EXT_FEATURE_VHT_IBSS);
	wiphy_ext_feature_set(hw->wiphy, NL80211_EXT_FEATURE_BEACON_PROTECTION);

	hw->wiphy->interface_modes = param->iftypes;

+81 −41
Original line number Diff line number Diff line
@@ -626,6 +626,41 @@ struct cfg80211_chan_def {
	struct ieee80211_edmg edmg;
};

/**
 * struct cfg80211_tid_cfg - TID specific configuration
 * @config_override: Flag to notify driver to reset TID configuration
 *	of the peer.
 * @tids: bitmap of TIDs to modify
 * @mask: bitmap of attributes indicating which parameter changed,
 *	similar to &nl80211_tid_config_supp.
 * @noack: noack configuration value for the TID
 * @retry_long: retry count value
 * @retry_short: retry count value
 * @ampdu: Enable/Disable aggregation
 * @rtscts: Enable/Disable RTS/CTS
 */
struct cfg80211_tid_cfg {
	bool config_override;
	u8 tids;
	u32 mask;
	enum nl80211_tid_config noack;
	u8 retry_long, retry_short;
	enum nl80211_tid_config ampdu;
	enum nl80211_tid_config rtscts;
};

/**
 * struct cfg80211_tid_config - TID configuration
 * @peer: Station's MAC address
 * @n_tid_conf: Number of TID specific configurations to be applied
 * @tid_conf: Configuration change info
 */
struct cfg80211_tid_config {
	const u8 *peer;
	u32 n_tid_conf;
	struct cfg80211_tid_cfg tid_conf[];
};

/**
 * cfg80211_get_chandef_type - return old channel type from chandef
 * @chandef: the channel definition
@@ -3369,6 +3404,8 @@ struct cfg80211_update_owe_info {
 * @set_default_key: set the default key on an interface
 *
 * @set_default_mgmt_key: set the default management frame key on an interface

 * @set_default_beacon_key: set the default Beacon frame key on an interface
 *
 * @set_rekey_data: give the data necessary for GTK rekeying to the driver
 *
@@ -3669,6 +3706,10 @@ struct cfg80211_update_owe_info {
 *
 * @probe_mesh_link: Probe direct Mesh peer's link quality by sending data frame
 *	and overrule HWMP path selection algorithm.
 * @set_tid_config: TID specific configuration, this can be peer or BSS specific
 *	This callback may sleep.
 * @reset_tid_config: Reset TID specific configuration for the peer, for the
 *	given TIDs. This callback may sleep.
 */
struct cfg80211_ops {
	int	(*suspend)(struct wiphy *wiphy, struct cfg80211_wowlan *wow);
@@ -3702,6 +3743,9 @@ struct cfg80211_ops {
	int	(*set_default_mgmt_key)(struct wiphy *wiphy,
					struct net_device *netdev,
					u8 key_index);
	int	(*set_default_beacon_key)(struct wiphy *wiphy,
					  struct net_device *netdev,
					  u8 key_index);

	int	(*start_ap)(struct wiphy *wiphy, struct net_device *dev,
			    struct cfg80211_ap_settings *settings);
@@ -3974,8 +4018,7 @@ struct cfg80211_ops {
	int	(*tx_control_port)(struct wiphy *wiphy,
				   struct net_device *dev,
				   const u8 *buf, size_t len,
				   const u8 *dest, const u8 *src,
				   const __be16 proto,
				   const u8 *dest, const __be16 proto,
				   const bool noencrypt);

	int	(*get_ftm_responder_stats)(struct wiphy *wiphy,
@@ -3990,6 +4033,10 @@ struct cfg80211_ops {
				   struct cfg80211_update_owe_info *owe_info);
	int	(*probe_mesh_link)(struct wiphy *wiphy, struct net_device *dev,
				   const u8 *buf, size_t len);
	int     (*set_tid_config)(struct wiphy *wiphy, struct net_device *dev,
				  struct cfg80211_tid_config *tid_conf);
	int	(*reset_tid_config)(struct wiphy *wiphy, struct net_device *dev,
				    const u8 *peer, u8 tids);
};

/*
@@ -4463,10 +4510,11 @@ struct wiphy_iftype_akm_suites {
 *	the same number of arbitrary MAC addresses.
 * @registered: protects ->resume and ->suspend sysfs callbacks against
 *	unregister hardware
 * @debugfsdir: debugfs directory used for this wiphy, will be renamed
 *	automatically on wiphy renames
 * @dev: (virtual) struct device for this wiphy
 * @registered: helps synchronize suspend/resume with wiphy unregister
 * @debugfsdir: debugfs directory used for this wiphy (ieee80211/<wiphyname>).
 *	It will be renamed automatically on wiphy renames
 * @dev: (virtual) struct device for this wiphy. The item in
 *	/sys/class/ieee80211/ points to this. You need use set_wiphy_dev()
 *	(see below).
 * @wext: wireless extension handlers
 * @priv: driver private data (sized according to wiphy_new() parameter)
 * @interface_modes: bitmask of interfaces types valid for this wiphy,
@@ -4577,12 +4625,6 @@ struct wiphy_iftype_akm_suites {
 *	and probe responses.  This value should be set if the driver
 *	wishes to limit the number of csa counters. Default (0) means
 *	infinite.
 * @max_adj_channel_rssi_comp: max offset of between the channel on which the
 *	frame was sent and the channel on which the frame was heard for which
 *	the reported rssi is still valid. If a driver is able to compensate the
 *	low rssi when a frame is heard on different channel, then it should set
 *	this variable to the maximal offset for which it can compensate.
 *	This value should be set in MHz.
 * @bss_select_support: bitmask indicating the BSS selection criteria supported
 *	by the driver in the .connect() callback. The bit position maps to the
 *	attribute indices defined in &enum nl80211_bss_select_attr.
@@ -4602,11 +4644,19 @@ struct wiphy_iftype_akm_suites {
 *	@support_mbssid must be set for this to have any effect.
 *
 * @pmsr_capa: peer measurement capabilities
 *
 * @tid_config_support: describes the per-TID config support that the
 *	device has
 * @tid_config_support.vif: bitmap of attributes (configurations)
 *	supported by the driver for each vif
 * @tid_config_support.peer: bitmap of attributes (configurations)
 *	supported by the driver for each peer
 * @tid_config_support.max_retry: maximum supported retry count for
 *	long/short retry configuration
 */
struct wiphy {
	/* assign these fields before you register the wiphy */

	/* permanent MAC address(es) */
	u8 perm_addr[ETH_ALEN];
	u8 addr_mask[ETH_ALEN];

@@ -4673,11 +4723,6 @@ struct wiphy {
	u32 available_antennas_tx;
	u32 available_antennas_rx;

	/*
	 * Bitmap of supported protocols for probe response offloading
	 * see &enum nl80211_probe_resp_offload_support_attr. Only valid
	 * when the wiphy flag @WIPHY_FLAG_AP_PROBE_RESP_OFFLOAD is set.
	 */
	u32 probe_resp_offload;

	const u8 *extended_capabilities, *extended_capabilities_mask;
@@ -4686,16 +4731,10 @@ struct wiphy {
	const struct wiphy_iftype_ext_capab *iftype_ext_capab;
	unsigned int num_iftype_ext_capab;

	/* If multiple wiphys are registered and you're handed e.g.
	 * a regular netdev with assigned ieee80211_ptr, you won't
	 * know whether it points to a wiphy your driver has registered
	 * or not. Assign this to something global to your driver to
	 * help determine whether you own this wiphy or not. */
	const void *privid;

	struct ieee80211_supported_band *bands[NUM_NL80211_BANDS];

	/* Lets us get back the wiphy on the callback */
	void (*reg_notifier)(struct wiphy *wiphy,
			     struct regulatory_request *request);

@@ -4703,14 +4742,10 @@ struct wiphy {

	const struct ieee80211_regdomain __rcu *regd;

	/* the item in /sys/class/ieee80211/ points to this,
	 * you need use set_wiphy_dev() (see below) */
	struct device dev;

	/* protects ->resume, ->suspend sysfs callbacks against unregister hw */
	bool registered;

	/* dir in debugfs: ieee80211/<wiphyname> */
	struct dentry *debugfsdir;

	const struct ieee80211_ht_cap *ht_capa_mod_mask;
@@ -4718,7 +4753,6 @@ struct wiphy {

	struct list_head wdev_list;

	/* the network namespace this phy lives in currently */
	possible_net_t _net;

#ifdef CONFIG_CFG80211_WEXT
@@ -4734,7 +4768,6 @@ struct wiphy {
	u16 max_ap_assoc_sta;

	u8 max_num_csa_counters;
	u8 max_adj_channel_rssi_comp;

	u32 bss_select_support;

@@ -4751,6 +4784,13 @@ struct wiphy {

	const struct cfg80211_pmsr_capabilities *pmsr_capa;

	struct {
		u64 peer, vif;
		u8 max_retry;
	} tid_config_support;

	u8 max_data_retry_count;

	char priv[0] __aligned(NETDEV_ALIGN);
};

+10 −0
Original line number Diff line number Diff line
@@ -3776,6 +3776,9 @@ enum ieee80211_reconfig_type {
 *
 * @start_pmsr: start peer measurement (e.g. FTM) (this call can sleep)
 * @abort_pmsr: abort peer measurement (this call can sleep)
 * @set_tid_config: Apply TID specific configurations. This callback may sleep.
 * @reset_tid_config: Reset TID specific configuration for the peer.
 *	This callback may sleep.
 */
struct ieee80211_ops {
	void (*tx)(struct ieee80211_hw *hw,
@@ -4080,6 +4083,13 @@ struct ieee80211_ops {
			  struct cfg80211_pmsr_request *request);
	void (*abort_pmsr)(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
			   struct cfg80211_pmsr_request *request);
	int (*set_tid_config)(struct ieee80211_hw *hw,
			      struct ieee80211_vif *vif,
			      struct ieee80211_sta *sta,
			      struct cfg80211_tid_config *tid_conf);
	int (*reset_tid_config)(struct ieee80211_hw *hw,
				struct ieee80211_vif *vif,
				struct ieee80211_sta *sta, u8 tids);
};

/**
+102 −12
Original line number Diff line number Diff line
@@ -264,6 +264,29 @@
 * %NL80211_ATTR_VLAN_ID.
 */

/**
 * DOC: TID configuration
 *
 * TID config support can be checked in the %NL80211_ATTR_TID_CONFIG
 * attribute given in wiphy capabilities.
 *
 * The necessary configuration parameters are mentioned in
 * &enum nl80211_tid_config_attr and it will be passed to the
 * %NL80211_CMD_SET_TID_CONFIG command in %NL80211_ATTR_TID_CONFIG.
 *
 * If the configuration needs to be applied for specific peer then the MAC
 * address of the peer needs to be passed in %NL80211_ATTR_MAC, otherwise the
 * configuration will be applied for all the connected peers in the vif except
 * any peers that have peer specific configuration for the TID by default; if
 * the %NL80211_TID_CONFIG_ATTR_OVERRIDE flag is set, peer specific values
 * will be overwritten.
 *
 * All this configuration is valid only for STA's current connection
 * i.e. the configuration will be reset to default when the STA connects back
 * after disconnection/roaming, and this configuration will be cleared when
 * the interface goes down.
 */

/**
 * enum nl80211_commands - supported nl80211 commands
 *
@@ -1039,14 +1062,11 @@
 *	a control port frame and as a notification that a control port frame
 *	has been received. %NL80211_ATTR_FRAME is used to specify the
 *	frame contents.  The frame is the raw EAPoL data, without ethernet or
 *	802.11 headers. An optional %NL80211_ATTR_SRC_MAC can be used to send
 *	pre-auth frames to STAs on behalf of other APs.
 *	802.11 headers.
 *	When used as an event indication %NL80211_ATTR_CONTROL_PORT_ETHERTYPE,
 *	%NL80211_ATTR_CONTROL_PORT_NO_ENCRYPT and %NL80211_ATTR_MAC are added
 *	indicating the protocol type of the received frame; whether the frame
 *	was received unencrypted and the MAC address of the peer respectively.
 *	%NL80211_ATTR_DST_MAC can be used to forward pre-auth frames in
 *	userspace while using AP mode.
 *
 * @NL80211_CMD_RELOAD_REGDB: Request that the regdb firmware file is reloaded.
 *
@@ -1128,6 +1148,9 @@
 *	peer MAC address and %NL80211_ATTR_FRAME is used to specify the frame
 *	content. The frame is ethernet data.
 *
 * @NL80211_CMD_SET_TID_CONFIG: Data frame TID specific configuration
 *	is passed using %NL80211_ATTR_TID_CONFIG attribute.
 *
 * @NL80211_CMD_MAX: highest used command number
 * @__NL80211_CMD_AFTER_LAST: internal use
 */
@@ -1352,6 +1375,8 @@ enum nl80211_commands {

	NL80211_CMD_PROBE_MESH_LINK,

	NL80211_CMD_SET_TID_CONFIG,

	/* add new commands above here */

	/* used to define NL80211_CMD_MAX below */
@@ -2412,8 +2437,10 @@ enum nl80211_commands {
 *	%NL80211_ATTR_AKM_SUITES are default capabilities if AKM suites not
 *	advertised for a specific interface type.
 *
 * @NL80211_ATTR_SRC_MAC: MAC address used in control port over nl80211 transmit
 * @NL80211_ATTR_DST_MAC: MAC address used in control port over nl80211 receive
 * @NL80211_ATTR_TID_CONFIG: TID specific configuration in a
 *	nested attribute with &enum nl80211_tid_config_attr sub-attributes;
 *	on output (in wiphy attributes) it contains only the feature sub-
 *	attributes.
 *
 * @NUM_NL80211_ATTR: total number of nl80211_attrs available
 * @NL80211_ATTR_MAX: highest attribute number currently defined
@@ -2883,8 +2910,7 @@ enum nl80211_attrs {

	NL80211_ATTR_IFTYPE_AKM_SUITES,

	NL80211_ATTR_SRC_MAC,
	NL80211_ATTR_DST_MAC,
	NL80211_ATTR_TID_CONFIG,

	/* add attributes here, update the policy in nl80211.c */

@@ -4559,6 +4585,7 @@ enum nl80211_key_default_types {
 *	See &enum nl80211_key_default_types.
 * @NL80211_KEY_MODE: the mode from enum nl80211_key_mode.
 *	Defaults to @NL80211_KEY_RX_TX.
 * @NL80211_KEY_DEFAULT_BEACON: flag indicating default Beacon frame key
 *
 * @__NL80211_KEY_AFTER_LAST: internal
 * @NL80211_KEY_MAX: highest key attribute
@@ -4574,6 +4601,7 @@ enum nl80211_key_attributes {
	NL80211_KEY_TYPE,
	NL80211_KEY_DEFAULT_TYPES,
	NL80211_KEY_MODE,
	NL80211_KEY_DEFAULT_BEACON,

	/* keep last */
	__NL80211_KEY_AFTER_LAST,
@@ -4729,6 +4757,69 @@ enum nl80211_tx_power_setting {
	NL80211_TX_POWER_FIXED,
};

/**
 * enum nl80211_tid_config - TID config state
 * @NL80211_TID_CONFIG_ENABLE: Enable config for the TID
 * @NL80211_TID_CONFIG_DISABLE: Disable config for the TID
 */
enum nl80211_tid_config {
	NL80211_TID_CONFIG_ENABLE,
	NL80211_TID_CONFIG_DISABLE,
};

/* enum nl80211_tid_config_attr - TID specific configuration.
 * @NL80211_TID_CONFIG_ATTR_PAD: pad attribute for 64-bit values
 * @NL80211_TID_CONFIG_ATTR_VIF_SUPP: a bitmap (u64) of attributes supported
 *	for per-vif configuration; doesn't list the ones that are generic
 *	(%NL80211_TID_CONFIG_ATTR_TIDS, %NL80211_TID_CONFIG_ATTR_OVERRIDE).
 * @NL80211_TID_CONFIG_ATTR_PEER_SUPP: same as the previous per-vif one, but
 *	per peer instead.
 * @NL80211_TID_CONFIG_ATTR_OVERRIDE: flag attribue, if no peer
 *	is selected, if set indicates that the new configuration overrides
 *	all previous peer configurations, otherwise previous peer specific
 *	configurations should be left untouched. If peer is selected then
 *	it will reset particular TID configuration of that peer and it will
 *	not accept other TID config attributes along with peer.
 * @NL80211_TID_CONFIG_ATTR_TIDS: a bitmask value of TIDs (bit 0 to 7)
 *	Its type is u16.
 * @NL80211_TID_CONFIG_ATTR_NOACK: Configure ack policy for the TID.
 *	specified in %NL80211_TID_CONFIG_ATTR_TID. see %enum nl80211_tid_config.
 *	Its type is u8.
 * @NL80211_TID_CONFIG_ATTR_RETRY_SHORT: Number of retries used with data frame
 *	transmission, user-space sets this configuration in
 *	&NL80211_CMD_SET_TID_CONFIG. It is u8 type, min value is 1 and
 *	the max value is advertised by the driver in this attribute on
 *	output in wiphy capabilities.
 * @NL80211_TID_CONFIG_ATTR_RETRY_LONG: Number of retries used with data frame
 *	transmission, user-space sets this configuration in
 *	&NL80211_CMD_SET_TID_CONFIG. Its type is u8, min value is 1 and
 *	the max value is advertised by the driver in this attribute on
 *	output in wiphy capabilities.
 * @NL80211_TID_CONFIG_ATTR_AMPDU_CTRL: Enable/Disable aggregation for the TIDs
 *	specified in %NL80211_TID_CONFIG_ATTR_TIDS. Its type is u8, using
 *	the values from &nl80211_tid_config.
 * @NL80211_TID_CONFIG_ATTR_RTSCTS_CTRL: Enable/Disable RTS_CTS for the TIDs
 *	specified in %NL80211_TID_CONFIG_ATTR_TIDS. It is u8 type, using
 *	the values from &nl80211_tid_config.
 */
enum nl80211_tid_config_attr {
	__NL80211_TID_CONFIG_ATTR_INVALID,
	NL80211_TID_CONFIG_ATTR_PAD,
	NL80211_TID_CONFIG_ATTR_VIF_SUPP,
	NL80211_TID_CONFIG_ATTR_PEER_SUPP,
	NL80211_TID_CONFIG_ATTR_OVERRIDE,
	NL80211_TID_CONFIG_ATTR_TIDS,
	NL80211_TID_CONFIG_ATTR_NOACK,
	NL80211_TID_CONFIG_ATTR_RETRY_SHORT,
	NL80211_TID_CONFIG_ATTR_RETRY_LONG,
	NL80211_TID_CONFIG_ATTR_AMPDU_CTRL,
	NL80211_TID_CONFIG_ATTR_RTSCTS_CTRL,

	/* keep last */
	__NL80211_TID_CONFIG_ATTR_AFTER_LAST,
	NL80211_TID_CONFIG_ATTR_MAX = __NL80211_TID_CONFIG_ATTR_AFTER_LAST - 1
};

/**
 * enum nl80211_packet_pattern_attr - packet pattern attribute
 * @__NL80211_PKTPAT_INVALID: invalid number for nested attribute
@@ -5548,9 +5639,8 @@ enum nl80211_feature_flags {
 *	feature, which prevents bufferbloat by using the expected transmission
 *	time to limit the amount of data buffered in the hardware.
 *
 * @NL80211_EXT_FEATURE_CONTROL_PORT_OVER_NL80211_MAC_ADDRS: The driver
 *	can use src and dst MAC addresses with control port over nl80211 rx
 *	and tx operations.
 * @NL80211_EXT_FEATURE_BEACON_PROTECTION: The driver supports Beacon protection
 *	and can receive key configuration for BIGTK using key indexes 6 and 7.
 *
 * @NUM_NL80211_EXT_FEATURES: number of extended features.
 * @MAX_NL80211_EXT_FEATURES: highest extended feature index.
@@ -5599,7 +5689,7 @@ enum nl80211_ext_feature_index {
	NL80211_EXT_FEATURE_SAE_OFFLOAD,
	NL80211_EXT_FEATURE_VLAN_OFFLOAD,
	NL80211_EXT_FEATURE_AQL,
	NL80211_EXT_FEATURE_CONTROL_PORT_OVER_NL80211_MAC_ADDRS,
	NL80211_EXT_FEATURE_BEACON_PROTECTION,

	/* add new features before the definition below */
	NUM_NL80211_EXT_FEATURES,
+19 −2
Original line number Diff line number Diff line
@@ -26,12 +26,20 @@ void ieee80211_aes_cmac(struct crypto_shash *tfm, const u8 *aad,
{
	SHASH_DESC_ON_STACK(desc, tfm);
	u8 out[AES_BLOCK_SIZE];
	const __le16 *fc;

	desc->tfm = tfm;

	crypto_shash_init(desc);
	crypto_shash_update(desc, aad, AAD_LEN);
	fc = (const __le16 *)aad;
	if (ieee80211_is_beacon(*fc)) {
		/* mask Timestamp field to zero */
		crypto_shash_update(desc, zero, 8);
		crypto_shash_update(desc, data + 8, data_len - 8 - CMAC_TLEN);
	} else {
		crypto_shash_update(desc, data, data_len - CMAC_TLEN);
	}
	crypto_shash_finup(desc, zero, CMAC_TLEN, out);

	memcpy(mic, out, CMAC_TLEN);
@@ -41,12 +49,21 @@ void ieee80211_aes_cmac_256(struct crypto_shash *tfm, const u8 *aad,
			    const u8 *data, size_t data_len, u8 *mic)
{
	SHASH_DESC_ON_STACK(desc, tfm);
	const __le16 *fc;

	desc->tfm = tfm;

	crypto_shash_init(desc);
	crypto_shash_update(desc, aad, AAD_LEN);
	fc = (const __le16 *)aad;
	if (ieee80211_is_beacon(*fc)) {
		/* mask Timestamp field to zero */
		crypto_shash_update(desc, zero, 8);
		crypto_shash_update(desc, data + 8,
				    data_len - 8 - CMAC_TLEN_256);
	} else {
		crypto_shash_update(desc, data, data_len - CMAC_TLEN_256);
	}
	crypto_shash_finup(desc, zero, CMAC_TLEN_256, mic);
}

Loading