git: e596e01cc998 - stable/13 - LinuxKPI: update 802.11 headers

From: Bjoern A. Zeeb <bz_at_FreeBSD.org>
Date: Sun, 27 Feb 2022 23:43:35 UTC
The branch stable/13 has been updated by bz:

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

commit e596e01cc99874d9b696f713790125dd0402b5ca
Author:     Bjoern A. Zeeb <bz@FreeBSD.org>
AuthorDate: 2022-02-22 22:57:31 +0000
Commit:     Bjoern A. Zeeb <bz@FreeBSD.org>
CommitDate: 2022-02-27 23:41:54 +0000

    LinuxKPI: update 802.11 headers
    
    Add new defines, struct members, and (stub) functions needed for an
    updated iwlwifi.  Most of the defines are for rfkill or HE.
    
    Pull in a case statement from the upcoming iwlwifi update to
    not break the build.
    
    Sponsored by:   The FreeBSD Foundation
    
    (cherry picked from commit d875aa1587ce7d1651cabe395ed991f2384795cd)
    (cherry picked from commit 9ad210c15933e5a49c51fba134e77d84cfdba94f)
---
 .../linuxkpi/common/include/linux/ieee80211.h      |  3 ++
 sys/compat/linuxkpi/common/include/linux/nl80211.h |  1 +
 sys/compat/linuxkpi/common/include/net/cfg80211.h  | 56 ++++++++++++++++++----
 sys/compat/linuxkpi/common/include/net/mac80211.h  |  6 +++
 sys/contrib/dev/iwlwifi/mvm/sta.c                  |  1 +
 5 files changed, 59 insertions(+), 8 deletions(-)

diff --git a/sys/compat/linuxkpi/common/include/linux/ieee80211.h b/sys/compat/linuxkpi/common/include/linux/ieee80211.h
index 4b8c3243b26a..55e31a7a88ae 100644
--- a/sys/compat/linuxkpi/common/include/linux/ieee80211.h
+++ b/sys/compat/linuxkpi/common/include/linux/ieee80211.h
@@ -67,6 +67,7 @@ struct ieee80211_mmie_16 {
 
 #define	IEEE80211_MAX_AMPDU_BUF_HT		0x40
 #define	IEEE80211_MAX_AMPDU_BUF			256	/* for HE? */
+#define	IEEE80211_MAX_AMPDU_BUF_HE		256
 
 #define	IEEE80211_MAX_FRAME_LEN			2352
 #define	IEEE80211_MAX_DATA_LEN			(2300 + IEEE80211_CRC_LEN)
@@ -170,6 +171,7 @@ enum ieee80211_min_mpdu_start_spacing {
 #define	IEEE80211_PPE_THRES_NSS_MASK			2 /* TODO FIXME ax? */
 #define	IEEE80211_PPE_THRES_RU_INDEX_BITMASK_POS	3 /* TODO FIXME ax? */
 #define	IEEE80211_PPE_THRES_RU_INDEX_BITMASK_MASK	8 /* TODO FIXME ax? */
+#define	IEEE80211_HE_PPE_THRES_INFO_HEADER_SIZE		16	/* TODO FIXME ax? */
 
 #define	IEEE80211_HT_OP_MODE_PROTECTION			0x03	/* MASK */
 #define	IEEE80211_HT_OP_MODE_PROTECTION_NONE		0x00
@@ -309,6 +311,7 @@ enum ieee80211_sta_rx_bw {
 	IEEE80211_STA_RX_BW_40,
 	IEEE80211_STA_RX_BW_80,
 	IEEE80211_STA_RX_BW_160,
+	IEEE80211_STA_RX_BW_320,
 };
 
 enum ieee80211_tx_info_flags {
diff --git a/sys/compat/linuxkpi/common/include/linux/nl80211.h b/sys/compat/linuxkpi/common/include/linux/nl80211.h
index 3a97879e2fd4..f6572cc8f6b8 100644
--- a/sys/compat/linuxkpi/common/include/linux/nl80211.h
+++ b/sys/compat/linuxkpi/common/include/linux/nl80211.h
@@ -89,6 +89,7 @@ enum nl80211_scan_flags {
 	NL80211_SCAN_FLAG_RANDOM_ADDR			= BIT(3),
 	NL80211_SCAN_FLAG_COLOCATED_6GHZ		= BIT(4),
 	NL80211_SCAN_FLAG_RANDOM_SN			= BIT(5),
+	NL80211_SCAN_FLAG_ACCEPT_BCAST_PROBE_RESP	= BIT(6),
 };
 
 #define	NL80211_MAX_SUPP_REG_RULES			512	/* TODO FIXME, random */
diff --git a/sys/compat/linuxkpi/common/include/net/cfg80211.h b/sys/compat/linuxkpi/common/include/net/cfg80211.h
index d8b852ec7a6d..896559247620 100644
--- a/sys/compat/linuxkpi/common/include/net/cfg80211.h
+++ b/sys/compat/linuxkpi/common/include/net/cfg80211.h
@@ -56,6 +56,10 @@ extern int debug_80211;
 #define	IMPROVE(...)	if (debug_80211 & D80211_IMPROVE)		\
     printf("%s:%d: XXX LKPI80211 IMPROVE\n", __func__, __LINE__)
 
+enum rfkill_hard_block_reasons {
+	RFKILL_HARD_BLOCK_NOT_OWNER		= BIT(0),
+};
+
 #define	WIPHY_PARAM_FRAG_THRESHOLD			__LINE__ /* TODO FIXME brcmfmac */
 #define	WIPHY_PARAM_RETRY_LONG				__LINE__ /* TODO FIXME brcmfmac */
 #define	WIPHY_PARAM_RETRY_SHORT				__LINE__ /* TODO FIXME brcmfmac */
@@ -693,8 +697,11 @@ struct linuxkpi_ieee80211_regdomain {
 #define	IEEE80211_HE_PHY_CAP3_SU_BEAMFORMER		0x20
 #define	IEEE80211_HE_PHY_CAP3_DCM_MAX_CONST_RX_16_QAM	0x40
 #define	IEEE80211_HE_PHY_CAP3_DCM_MAX_CONST_TX_16_QAM	0x80
-#define	IEEE80211_HE_PHY_CAP3_DCM_MAX_TX_NSS_2		0x100
-#define	IEEE80211_HE_PHY_CAP3_RX_PARTIAL_BW_SU_IN_20MHZ_MU	0x200
+#define	IEEE80211_HE_PHY_CAP3_DCM_MAX_TX_NSS_2		0x10
+#define	IEEE80211_HE_PHY_CAP3_RX_PARTIAL_BW_SU_IN_20MHZ_MU	0x20
+#define	IEEE80211_HE_PHY_CAP3_DCM_MAX_CONST_RX_BPSK	0x40
+#define	IEEE80211_HE_PHY_CAP3_DCM_MAX_CONST_TX_BPSK	0x80
+#define	IEEE80211_HE_PHY_CAP3_DCM_MAX_CONST_TX_MASK	0x80
 
 #define	IEEE80211_HE_PHY_CAP4_BEAMFORMEE_MAX_STS_UNDER_80MHZ_8	0x1
 #define	IEEE80211_HE_PHY_CAP4_BEAMFORMEE_MAX_STS_ABOVE_80MHZ_8	0x2
@@ -739,12 +746,13 @@ struct linuxkpi_ieee80211_regdomain {
 #define	IEEE80211_HE_PHY_CAP9_NOMINAL_PKT_PADDING_8US		0x4
 #define	IEEE80211_HE_PHY_CAP9_NOMINAL_PKT_PADDING_MASK		0x8
 #define	IEEE80211_HE_PHY_CAP9_NOMINAL_PKT_PADDING_RESERVED	0x10
+#define	IEEE80211_HE_PHY_CAP9_NOMINAL_PKT_PADDING_POS		0x0
 #define	IEEE80211_HE_PHY_CAP9_NON_TRIGGERED_CQI_FEEDBACK	0x20
-#define	IEEE80211_HE_PHY_CAP9_RX_FULL_BW_SU_USING_MU_WITH_COMP_SIGB	0x40
-#define	IEEE80211_HE_PHY_CAP9_RX_FULL_BW_SU_USING_MU_WITH_NON_COMP_SIGB	0x80
-#define	IEEE80211_HE_PHY_CAP9_RX_1024_QAM_LESS_THAN_242_TONE_RU	0x100
-#define	IEEE80211_HE_PHY_CAP9_TX_1024_QAM_LESS_THAN_242_TONE_RU	0x200
-#define	IEEE80211_HE_PHY_CAP9_LONGER_THAN_16_SIGB_OFDM_SYM	0x400
+#define	IEEE80211_HE_PHY_CAP9_RX_FULL_BW_SU_USING_MU_WITH_COMP_SIGB	0x4
+#define	IEEE80211_HE_PHY_CAP9_RX_FULL_BW_SU_USING_MU_WITH_NON_COMP_SIGB	0x8
+#define	IEEE80211_HE_PHY_CAP9_RX_1024_QAM_LESS_THAN_242_TONE_RU	0x10
+#define	IEEE80211_HE_PHY_CAP9_TX_1024_QAM_LESS_THAN_242_TONE_RU	0x20
+#define	IEEE80211_HE_PHY_CAP9_LONGER_THAN_16_SIGB_OFDM_SYM	0x40
 
 #define	IEEE80211_HE_PHY_CAP10_HE_MU_M1RU_MAX_LTF		0x1
 
@@ -952,7 +960,7 @@ struct wiphy {
 	int	max_ap_assoc_sta, probe_resp_offload, software_iftypes;
 	int     bss_select_support, max_num_pmkids, retry_long, retry_short, signal_type;
 	int	max_data_retry_count;
-	int     tx_queue_len;
+	int     tx_queue_len, rfkill;
 
 	unsigned long				ext_features[BITS_TO_LONGS(NUM_NL80211_EXT_FEATURES)];
 	struct dentry				*debugfsdir;
@@ -1081,8 +1089,34 @@ wiphy_dereference(struct wiphy *wiphy,
         return (NULL);
 }
 
+static __inline void
+wiphy_lock(struct wiphy *wiphy)
+{
+	TODO();
+}
+
+static __inline void
+wiphy_unlock(struct wiphy *wiphy)
+{
+	TODO();
+}
+
+static __inline void
+wiphy_rfkill_set_hw_state_reason(struct wiphy *wiphy, bool blocked,
+    enum rfkill_hard_block_reasons reason)
+{
+	TODO();
+}
+
 /* -------------------------------------------------------------------------- */
 
+static __inline bool
+rfkill_blocked(int rfkill)		/* argument type? */
+{
+	TODO();
+	return (false);
+}
+
 static __inline int
 reg_query_regdb_wmm(uint8_t *alpha2, uint32_t center_freq,
     struct ieee80211_reg_rule *rule)
@@ -1569,6 +1603,12 @@ get_random_mask_addr(uint8_t *dst, const uint8_t *addr, const uint8_t *mask)
 		dst[i] = (dst[i] & ~(mask[i])) | (addr[i] & mask[i]);
 }
 
+static __inline void
+cfg80211_shutdown_all_interfaces(struct wiphy *wiphy)
+{
+	TODO();
+}
+
 #ifndef LINUXKPI_NET80211
 #define	ieee80211_channel		linuxkpi_ieee80211_channel
 #define	ieee80211_regdomain		linuxkpi_ieee80211_regdomain
diff --git a/sys/compat/linuxkpi/common/include/net/mac80211.h b/sys/compat/linuxkpi/common/include/net/mac80211.h
index e6aac3639299..11e8b031a97e 100644
--- a/sys/compat/linuxkpi/common/include/net/mac80211.h
+++ b/sys/compat/linuxkpi/common/include/net/mac80211.h
@@ -2083,6 +2083,12 @@ ieee80211_disconnect(struct ieee80211_vif *vif, bool _x)
 	TODO();
 }
 
+static __inline void
+ieee80211_channel_switch_disconnect(struct ieee80211_vif *vif, bool _x)
+{
+	TODO();
+}
+
 static __inline const struct ieee80211_sta_he_cap *
 ieee80211_get_he_iftype_cap(const struct ieee80211_supported_band *band,
     enum nl80211_iftype type)
diff --git a/sys/contrib/dev/iwlwifi/mvm/sta.c b/sys/contrib/dev/iwlwifi/mvm/sta.c
index 70267a6cd4b4..dcac03ddc26d 100644
--- a/sys/contrib/dev/iwlwifi/mvm/sta.c
+++ b/sys/contrib/dev/iwlwifi/mvm/sta.c
@@ -90,6 +90,7 @@ int iwl_mvm_sta_send_to_fw(struct iwl_mvm *mvm, struct ieee80211_sta *sta,
 	}
 
 	switch (sta->bandwidth) {
+	case IEEE80211_STA_RX_BW_320:
 	case IEEE80211_STA_RX_BW_160:
 		add_sta_cmd.station_flags |= cpu_to_le32(STA_FLG_FAT_EN_160MHZ);
 		fallthrough;