git: c1c989588df6 - main - LinuxKPI: 802.11: add futher defines to ieee80211.h and nl80211.h

From: Bjoern A. Zeeb <bz_at_FreeBSD.org>
Date: Fri, 13 Sep 2024 00:27:49 UTC
The branch main has been updated by bz:

URL: https://cgit.FreeBSD.org/src/commit/?id=c1c989588df67396392edceb0e7e7028abc06c49

commit c1c989588df67396392edceb0e7e7028abc06c49
Author:     Bjoern A. Zeeb <bz@FreeBSD.org>
AuthorDate: 2024-09-12 20:34:49 +0000
Commit:     Bjoern A. Zeeb <bz@FreeBSD.org>
CommitDate: 2024-09-13 00:26:26 +0000

    LinuxKPI: 802.11: add futher defines to ieee80211.h and nl80211.h
    
    Upstream new defines, enum values, etc. for coming driver updates which
    are non-conflicting with the current state.
    
    The only notable change is the rename of the enum ieee80211_ap_reg_power
    but the enum name had not been used so far by any driver in the tree
    (only in mac80211.h) but an updated version of ath11k does use it so we
    need to correct our initial naming.
    
    Sponsored by:   The FreeBSD Foundation
    MFC after:      3 days
---
 .../linuxkpi/common/include/linux/ieee80211.h      | 63 ++++++++++++++++++++--
 sys/compat/linuxkpi/common/include/linux/nl80211.h | 18 ++++++-
 sys/compat/linuxkpi/common/include/net/mac80211.h  |  2 +-
 3 files changed, 76 insertions(+), 7 deletions(-)

diff --git a/sys/compat/linuxkpi/common/include/linux/ieee80211.h b/sys/compat/linuxkpi/common/include/linux/ieee80211.h
index aa1a0a4f3c5f..9a43a571d390 100644
--- a/sys/compat/linuxkpi/common/include/linux/ieee80211.h
+++ b/sys/compat/linuxkpi/common/include/linux/ieee80211.h
@@ -1,5 +1,5 @@
 /*-
- * Copyright (c) 2020-2023 The FreeBSD Foundation
+ * Copyright (c) 2020-2024 The FreeBSD Foundation
  *
  * This software was developed by Björn Zeeb under sponsorship from
  * the FreeBSD Foundation.
@@ -33,6 +33,7 @@
 #include <net80211/ieee80211.h>
 
 #include <asm/unaligned.h>
+#include <linux/kernel.h>
 #include <linux/bitops.h>
 #include <linux/if_ether.h>
 
@@ -125,8 +126,9 @@ enum wlan_ht_cap_sm_ps {
 	WLAN_HT_CAP_SM_PS_DISABLED,
 };
 
-#define	WLAN_MAX_KEY_LEN			32 /* TODO FIXME brcmfmac */
-#define	WLAN_PMKID_LEN				16 /* TODO FIXME brcmfmac */
+#define	WLAN_MAX_KEY_LEN			32
+#define	WLAN_PMKID_LEN				16
+#define	WLAN_PMK_LEN_SUITE_B_192		48
 
 #define	WLAN_KEY_LEN_WEP40			5
 #define	WLAN_KEY_LEN_WEP104			13
@@ -178,6 +180,7 @@ enum ieee80211_min_mpdu_start_spacing {
 #define	IEEE80211_STYPE_CTS			IEEE80211_FC0_SUBTYPE_CTS
 #define	IEEE80211_STYPE_RTS			IEEE80211_FC0_SUBTYPE_RTS
 #define	IEEE80211_STYPE_ACTION			IEEE80211_FC0_SUBTYPE_ACTION
+#define	IEEE80211_STYPE_DATA			IEEE80211_FC0_SUBTYPE_DATA
 #define	IEEE80211_STYPE_QOS_DATA		IEEE80211_FC0_SUBTYPE_QOS_DATA
 #define	IEEE80211_STYPE_QOS_NULLFUNC		IEEE80211_FC0_SUBTYPE_QOS_NULL
 #define	IEEE80211_STYPE_QOS_CFACK		0xd0	/* XXX-BZ reserved? */
@@ -277,6 +280,8 @@ enum ieee80211_ac_numbers {
 #define	IEEE80211_HT_MCS_MASK_LEN		10
 
 #define	IEEE80211_MLD_MAX_NUM_LINKS		15
+#define	IEEE80211_MLD_CAP_OP_TID_TO_LINK_MAP_NEG_SUPP		0x0060
+#define	IEEE80211_MLD_CAP_OP_TID_TO_LINK_MAP_NEG_SUPP_SAME	1
 
 struct ieee80211_mcs_info {
 	uint8_t		rx_mask[IEEE80211_HT_MCS_MASK_LEN];
@@ -328,6 +333,7 @@ enum ieee80211_chanctx_change_flags {
 	IEEE80211_CHANCTX_CHANGE_RX_CHAINS	= BIT(2),
 	IEEE80211_CHANCTX_CHANGE_WIDTH		= BIT(3),
 	IEEE80211_CHANCTX_CHANGE_CHANNEL	= BIT(4),
+	IEEE80211_CHANCTX_CHANGE_PUNCTURING	= BIT(5),
 };
 
 enum ieee80211_frame_release_type {
@@ -543,6 +549,7 @@ struct ieee80211_mgmt {
 				} wnm_timing_msr;
 			} u;
 		} action;
+		DECLARE_FLEX_ARRAY(uint8_t, body);
 	} u;
 };
 
@@ -567,6 +574,8 @@ struct ieee80211_rts {		/* net80211::ieee80211_frame_rts */
 
 #define	IEEE80211_SEQ_TO_SN(_seqn)	(((_seqn) & IEEE80211_SEQ_SEQ_MASK) >> \
 					    IEEE80211_SEQ_SEQ_SHIFT)
+#define	IEEE80211_SN_TO_SEQ(_sn)	(((_sn) << IEEE80211_SEQ_SEQ_SHIFT) & \
+					    IEEE80211_SEQ_SEQ_MASK)
 
 /* Time unit (TU) to .. See net80211: IEEE80211_DUR_TU */
 #define	TU_TO_JIFFIES(_tu)	(usecs_to_jiffies(_tu) * 1024)
@@ -640,10 +649,10 @@ struct ieee80211_trigger {
 /* Table 9-29c-Trigger Type subfield encoding */
 enum {
 	IEEE80211_TRIGGER_TYPE_BASIC		= 0x0,
+	IEEE80211_TRIGGER_TYPE_MU_BAR		= 0x2,
 #if 0
 	/* Not seen yet. */
 	BFRP					= 0x1,
-	MU-BAR					= 0x2,
 	MU-RTS					= 0x3,
 	BSRP					= 0x4,
 	GCR MU-BAR				= 0x5,
@@ -654,6 +663,12 @@ enum {
 	IEEE80211_TRIGGER_TYPE_MASK		= 0xf
 };
 
+#define	IEEE80211_TRIGGER_ULBW_MASK		0xc0000
+#define	IEEE80211_TRIGGER_ULBW_20MHZ		0x0
+#define	IEEE80211_TRIGGER_ULBW_40MHZ		0x1
+#define	IEEE80211_TRIGGER_ULBW_80MHZ		0x2
+#define	IEEE80211_TRIGGER_ULBW_160_80P80MHZ	0x3
+
 /* 802.11-2020, Figure 9-687-Control field format; 802.11ax-2021 */
 #define	IEEE80211_TWT_CONTROL_NEG_TYPE_BROADCAST	BIT(3)
 #define	IEEE80211_TWT_CONTROL_RX_DISABLED		BIT(4)
@@ -694,12 +709,50 @@ struct ieee80211_bssid_index {
 	int	bssid_index;
 };
 
-enum ieee80211_reg_ap_power {
+enum ieee80211_ap_reg_power {
+	IEEE80211_REG_UNSET_AP,
 	IEEE80211_REG_LPI_AP,
 	IEEE80211_REG_SP_AP,
 	IEEE80211_REG_VLP_AP,
 };
 
+/*
+ * 802.11ax-2021, Table 9-277-Meaning of Maximum Transmit Power Count subfield
+ * if Maximum Transmit Power Interpretation subfield is 1 or 3
+ */
+#define	IEEE80211_MAX_NUM_PWR_LEVEL		8
+
+/*
+ * 802.11ax-2021, Table 9-275a-Maximum Transmit Power Interpretation subfield
+ * encoding (4) * Table E-12-Regulatory Info subfield encoding in the
+ * United States (2)
+ */
+#define	IEEE80211_TPE_MAX_IE_NUM		8
+
+/* 802.11ax-2021, 9.4.2.161 Transmit Power Envelope element */
+struct ieee80211_tx_pwr_env {
+	uint8_t		tx_power_info;
+	uint8_t		tx_power[IEEE80211_MAX_NUM_PWR_LEVEL];
+};
+
+/* 802.11ax-2021, Figure 9-617-Transmit Power Information field format */
+/* These are field masks (3bit/3bit/2bit). */
+#define	IEEE80211_TX_PWR_ENV_INFO_COUNT		0x07
+#define	IEEE80211_TX_PWR_ENV_INFO_INTERPRET	0x38
+#define	IEEE80211_TX_PWR_ENV_INFO_CATEGORY	0xc0
+
+/*
+ * 802.11ax-2021, Table 9-275a-Maximum Transmit Power Interpretation subfield
+ * encoding
+ */
+enum ieee80211_tx_pwr_interpretation_subfield_enc {
+	IEEE80211_TPE_LOCAL_EIRP,
+	IEEE80211_TPE_LOCAL_EIRP_PSD,
+	IEEE80211_TPE_REG_CLIENT_EIRP,
+	IEEE80211_TPE_REG_CLIENT_EIRP_PSD,
+};
+
+
 /* net80211: IEEE80211_IS_CTL() */
 static __inline bool
 ieee80211_is_ctl(__le16 fc)
diff --git a/sys/compat/linuxkpi/common/include/linux/nl80211.h b/sys/compat/linuxkpi/common/include/linux/nl80211.h
index 5b43ff675e19..6916957731e2 100644
--- a/sys/compat/linuxkpi/common/include/linux/nl80211.h
+++ b/sys/compat/linuxkpi/common/include/linux/nl80211.h
@@ -1,5 +1,5 @@
 /*-
- * Copyright (c) 2020-2023 The FreeBSD Foundation
+ * Copyright (c) 2020-2024 The FreeBSD Foundation
  *
  * This software was developed by Björn Zeeb under sponsorship from
  * the FreeBSD Foundation.
@@ -80,6 +80,10 @@ enum nl80211_reg_rule_flags {
 	NL80211_RRF_NO_OFDM				= BIT(10),
 	NL80211_RRF_NO_320MHZ				= BIT(11),
 	NL80211_RRF_NO_EHT				= BIT(12),
+	NL80211_RRF_DFS_CONCURRENT			= BIT(13),
+	NL80211_RRF_NO_6GHZ_VLP_CLIENT			= BIT(14),
+	NL80211_RRF_NO_6GHZ_AFC_CLIENT			= BIT(15),
+	NL80211_RRF_PSD					= BIT(16),
 };
 #define	NL80211_RRF_NO_HT40	(NL80211_RRF_NO_HT40MINUS|NL80211_RRF_NO_HT40PLUS)
 
@@ -230,6 +234,13 @@ enum nl80211_ext_feature {
 	NL80211_EXT_FEATURE_BEACON_PROTECTION,
 	NL80211_EXT_FEATURE_SCAN_MIN_PREQ_CONTENT,
 	NL80211_EXT_FEATURE_PUNCT,
+	NL80211_EXT_FEATURE_DFS_CONCURRENT,
+	NL80211_EXT_FEATURE_MULTICAST_REGISTRATIONS,
+	NL80211_EXT_FEATURE_SPP_AMSDU_SUPPORT,
+	NL80211_EXT_FEATURE_SECURE_LTF,
+	NL80211_EXT_FEATURE_PROT_RANGE_NEGO_AND_MEASURE,
+	NL80211_EXT_FEATURE_4WAY_HANDSHAKE_AP_PSK,
+	NL80211_EXT_FEATURE_SAE_OFFLOAD_AP,
 
 	/* Keep this last. */
 	NUM_NL80211_EXT_FEATURES
@@ -241,6 +252,7 @@ enum nl80211_sta_info {
 	NL80211_STA_INFO_BEACON_SIGNAL_AVG,
 	NL80211_STA_INFO_BSS_PARAM,
 	NL80211_STA_INFO_CHAIN_SIGNAL,
+	NL80211_STA_INFO_CHAIN_SIGNAL_AVG,
 	NL80211_STA_INFO_CONNECTED_TIME,
 	NL80211_STA_INFO_INACTIVE_TIME,
 	NL80211_STA_INFO_SIGNAL,
@@ -416,6 +428,10 @@ enum nl80211_user_reg_hint_type {
 	NL80211_USER_REG_HINT_USER,
 };
 
+enum nl80211_hidden_ssid {
+	NL80211_HIDDEN_SSID_NOT_IN_USE,
+};
+
 #define	NL80211_KCK_LEN				16
 #define	NL80211_KCK_EXT_LEN			24
 #define	NL80211_KEK_LEN				16
diff --git a/sys/compat/linuxkpi/common/include/net/mac80211.h b/sys/compat/linuxkpi/common/include/net/mac80211.h
index c102ada6def2..29fb335a8db9 100644
--- a/sys/compat/linuxkpi/common/include/net/mac80211.h
+++ b/sys/compat/linuxkpi/common/include/net/mac80211.h
@@ -303,7 +303,7 @@ struct ieee80211_bss_conf {
 	int16_t					txpower;
 	uint32_t				basic_rates;
 	int					mcast_rate[NUM_NL80211_BANDS];
-	enum ieee80211_reg_ap_power 		power_type;
+	enum ieee80211_ap_reg_power 		power_type;
 	struct cfg80211_bitrate_mask		beacon_tx_rate;
 	struct mac80211_fils_discovery		fils_discovery;
 	struct ieee80211_chanctx_conf		*chanctx_conf;