git: 51b461b3db33 - main - LinuxKPI: 802.11 update compat code for driver updates

From: Bjoern A. Zeeb <bz_at_FreeBSD.org>
Date: Sun, 09 Jan 2022 18:10:42 UTC
The branch main has been updated by bz:

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

commit 51b461b3db33b7cd7cbc62c9206568321f7298ad
Author:     Bjoern A. Zeeb <bz@FreeBSD.org>
AuthorDate: 2022-01-09 18:08:47 +0000
Commit:     Bjoern A. Zeeb <bz@FreeBSD.org>
CommitDate: 2022-01-09 18:08:47 +0000

    LinuxKPI: 802.11 update compat code for driver updates
    
    Add more (dummy in case of HE) defines, structs, functions and another
    mac80211 function pointer needed to update and support recent drivers.
    
    MFC after:      3 days
---
 .../linuxkpi/common/include/linux/ieee80211.h      |  6 +++
 sys/compat/linuxkpi/common/include/linux/nl80211.h |  6 +++
 sys/compat/linuxkpi/common/include/net/cfg80211.h  | 56 ++++++++++++++++++++--
 sys/compat/linuxkpi/common/include/net/mac80211.h  | 19 +++++++-
 4 files changed, 81 insertions(+), 6 deletions(-)

diff --git a/sys/compat/linuxkpi/common/include/linux/ieee80211.h b/sys/compat/linuxkpi/common/include/linux/ieee80211.h
index 714a682013ec..1fe295c2ae96 100644
--- a/sys/compat/linuxkpi/common/include/linux/ieee80211.h
+++ b/sys/compat/linuxkpi/common/include/linux/ieee80211.h
@@ -72,6 +72,8 @@ extern int debug_80211;
 #define	IEEE80211_P2P_OPPPS_CTWINDOW_MASK	0x7f
 #define	IEEE80211_P2P_OPPPS_ENABLE_BIT		BIT(7)
 
+#define	IEEE80211_QOS_CTL_TAG1D_MASK		0x0007
+#define	IEEE80211_QOS_CTL_EOSP			0x0010
 #define	IEEE80211_QOS_CTL_A_MSDU_PRESENT	0x0080	/* 9.2.4.5.1, Table 9-6 QoS Control Field */
 
 #define	IEEE80211_RATE_SHORT_PREAMBLE		BIT(0)
@@ -109,6 +111,7 @@ enum ieee80211_rate_control_changed_flags {
 
 /* 9.4.2.56.3, Table 9-163 Subfields of the A-MPDU Parameters field */
 enum ieee80211_min_mpdu_start_spacing {
+	IEEE80211_HT_MPDU_DENSITY_NONE		= 0,
 	IEEE80211_HT_MPDU_DENSITY_4		= 5,	/* 4us */
 	IEEE80211_HT_MPDU_DENSITY_16		= 7, 	/* 16us */
 };
@@ -117,6 +120,7 @@ enum ieee80211_min_mpdu_start_spacing {
 #define	IEEE80211_HT_STBC_PARAM_DUAL_CTS_PROT	0x0080	/* B24.. */
 
 #define	IEEE80211_FCTL_STYPE			IEEE80211_FC0_SUBTYPE_MASK
+#define	IEEE80211_FCTL_ORDER			(IEEE80211_FC1_ORDER << 8)
 
 #define	IEEE80211_STYPE_ASSOC_REQ		IEEE80211_FC0_SUBTYPE_ASSOC_REQ
 #define	IEEE80211_STYPE_REASSOC_REQ		IEEE80211_FC0_SUBTYPE_REASSOC_REQ
@@ -308,6 +312,8 @@ enum ieee80211_tx_rate_flags {
 	IEEE80211_TX_RC_VHT_MCS			= BIT(6),
 };
 
+#define	IEEE80211_HT_CTL_LEN	4
+
 struct ieee80211_hdr {		/* net80211::ieee80211_frame */
         __le16		frame_control;
         __le16		duration_id;
diff --git a/sys/compat/linuxkpi/common/include/linux/nl80211.h b/sys/compat/linuxkpi/common/include/linux/nl80211.h
index 4f0a55c9dbdb..d9d9ba4edba9 100644
--- a/sys/compat/linuxkpi/common/include/linux/nl80211.h
+++ b/sys/compat/linuxkpi/common/include/linux/nl80211.h
@@ -86,6 +86,7 @@ enum nl80211_scan_flags {
 	NL80211_SCAN_FLAG_OCE_PROBE_REQ_HIGH_TX_RATE	= BIT(2),
 	NL80211_SCAN_FLAG_RANDOM_ADDR			= BIT(3),
 	NL80211_SCAN_FLAG_COLOCATED_6GHZ		= BIT(4),
+	NL80211_SCAN_FLAG_RANDOM_SN			= BIT(5),
 };
 
 #define	NL80211_REGDOM_SET_BY_USER			1
@@ -208,6 +209,7 @@ enum nl80211_ext_feature {
 	NL80211_EXT_FEATURE_4WAY_HANDSHAKE_STA_1X,
 	NL80211_EXT_FEATURE_4WAY_HANDSHAKE_STA_PSK,
 	NL80211_EXT_FEATURE_BEACON_PROTECTION_CLIENT,
+	NL80211_EXT_FEATURE_SCAN_RANDOM_SN,
 
 	/* Keep this last. */
 	NUM_NL80211_EXT_FEATURES
@@ -305,4 +307,8 @@ enum nl80211_dfs_regions {
 	NL80211_DFS_JP,
 };
 
+enum nl80211_sar_type {
+	NL80211_SAR_TYPE_POWER,
+};
+
 #endif	/* _LINUXKPI_LINUX_NL80211_H */
diff --git a/sys/compat/linuxkpi/common/include/net/cfg80211.h b/sys/compat/linuxkpi/common/include/net/cfg80211.h
index edecf9bed8a2..d0de3ec95086 100644
--- a/sys/compat/linuxkpi/common/include/net/cfg80211.h
+++ b/sys/compat/linuxkpi/common/include/net/cfg80211.h
@@ -1,6 +1,6 @@
 /*-
  * Copyright (c) 2020-2021 The FreeBSD Foundation
- * Copyright (c) 2021 Bjoern A. Zeeb
+ * Copyright (c) 2021-2022 Bjoern A. Zeeb
  *
  * This software was developed by Björn Zeeb under sponsorship from
  * the FreeBSD Foundation.
@@ -122,6 +122,7 @@ struct cfg80211_bitrate_mask {
 		uint64_t	legacy;		/* XXX? */
 		uint8_t		ht_mcs[16];	/* XXX? */
 		uint16_t	vht_mcs[16];	/* XXX? */
+		uint16_t	he_mcs[16];	/* XXX? */
 		uint8_t		gi;		/* NL80211_TXRATE_FORCE_LGI enum? */
 	} control[NUM_NL80211_BANDS];
 };
@@ -315,6 +316,28 @@ struct cfg80211_pmsr_result {
 	struct cfg80211_pmsr_ftm_result		ftm;
 };
 
+struct cfg80211_sar_freq_ranges {
+	uint32_t				start_freq;
+	uint32_t				end_freq;
+};
+
+struct cfg80211_sar_sub_specs {
+	uint32_t				freq_range_index;
+	int					power;
+};
+
+struct cfg80211_sar_specs {
+	enum nl80211_sar_type			type;
+	uint32_t				num_sub_specs;
+	struct cfg80211_sar_sub_specs		sub_specs[];
+};
+
+struct cfg80211_sar_capa {
+	enum nl80211_sar_type			type;
+	uint32_t				num_freq_ranges;
+	const struct cfg80211_sar_freq_ranges	*freq_ranges;
+};
+
 struct cfg80211_ssid {
 	int	ssid_len;
 	uint8_t	ssid[IEEE80211_MAX_SSID_LEN];
@@ -600,18 +623,21 @@ struct linuxkpi_ieee80211_regdomain {
 #define	IEEE80211_HE_MAC_CAP2_BSR			0x4
 #define	IEEE80211_HE_MAC_CAP2_LINK_ADAPTATION		0x8
 #define	IEEE80211_HE_MAC_CAP2_BCAST_TWT			0x10
+#define	IEEE80211_HE_MAC_CAP2_ALL_ACK			0x20
 
 #define	IEEE80211_HE_MAC_CAP3_MAX_AMPDU_LEN_EXP_VHT_2	0x1
 #define	IEEE80211_HE_MAC_CAP3_OMI_CONTROL		0x2
 #define	IEEE80211_HE_MAC_CAP3_MAX_AMPDU_LEN_EXP_EXT_1	0x10
-#define	IEEE80211_HE_MAC_CAP3_MAX_AMPDU_LEN_EXP_EXT_3	0x20
-#define	IEEE80211_HE_MAC_CAP3_MAX_AMPDU_LEN_EXP_MASK	0x30
+#define	IEEE80211_HE_MAC_CAP3_MAX_AMPDU_LEN_EXP_EXT_2	0x20
+#define	IEEE80211_HE_MAC_CAP3_MAX_AMPDU_LEN_EXP_EXT_3	0x40
+#define	IEEE80211_HE_MAC_CAP3_MAX_AMPDU_LEN_EXP_MASK	0x70
 #define	IEEE80211_HE_MAC_CAP3_RX_CTRL_FRAME_TO_MULTIBSS	0x80
 
 #define	IEEE80211_HE_MAC_CAP4_AMDSU_IN_AMPDU		0x1
 #define	IEEE80211_HE_MAC_CAP4_BQR			0x2
 #define	IEEE80211_HE_MAC_CAP4_MULTI_TID_AGG_TX_QOS_B39	0x4
 #define	IEEE80211_HE_MAC_CAP4_AMSDU_IN_AMPDU		0x8
+#define	IEEE80211_HE_MAC_CAP4_OPS			0x10
 
 #define	IEEE80211_HE_MAC_CAP5_HE_DYNAMIC_SM_PS		0x1
 #define	IEEE80211_HE_MAC_CAP5_HT_VHT_TRIG_FRAME_RX	0x2
@@ -633,35 +659,51 @@ struct linuxkpi_ieee80211_regdomain {
 #define	IEEE80211_HE_PHY_CAP0_CHANNEL_WIDTH_SET_160MHZ_IN_5G		0x1
 #define	IEEE80211_HE_PHY_CAP0_CHANNEL_WIDTH_SET_40MHZ_80MHZ_IN_5G	0x2
 #define	IEEE80211_HE_PHY_CAP0_CHANNEL_WIDTH_SET_40MHZ_IN_2G		0x4
+#define	IEEE80211_HE_PHY_CAP0_CHANNEL_WIDTH_SET_80PLUS80_MHZ_IN_5G	0x8
 
 #define	IEEE80211_HE_PHY_CAP1_DEVICE_CLASS_A		0x1
 #define	IEEE80211_HE_PHY_CAP1_LDPC_CODING_IN_PAYLOAD	0x2
 #define	IEEE80211_HE_PHY_CAP1_MIDAMBLE_RX_TX_MAX_NSTS	0x4
 #define	IEEE80211_HE_PHY_CAP1_PREAMBLE_PUNC_RX_MASK	0x8
+#define	IEEE80211_HE_PHY_CAP1_HE_LTF_AND_GI_FOR_HE_PPDUS_0_8US	0x10
 
 #define	IEEE80211_HE_PHY_CAP2_MIDAMBLE_RX_TX_MAX_NSTS	0x1
 #define	IEEE80211_HE_PHY_CAP2_NDP_4x_LTF_AND_3_2US	0x2
 #define	IEEE80211_HE_PHY_CAP2_STBC_TX_UNDER_80MHZ	0x4
 #define	IEEE80211_HE_PHY_CAP2_STBC_RX_UNDER_80MHZ	0x8
+#define	IEEE80211_HE_PHY_CAP2_DOPPLER_TX		0x10
 
 #define	IEEE80211_HE_PHY_CAP3_DCM_MAX_CONST_RX_MASK	0x1
 #define	IEEE80211_HE_PHY_CAP3_DCM_MAX_CONST_RX_NO_DCM	0x2
 #define	IEEE80211_HE_PHY_CAP3_DCM_MAX_CONST_TX_NO_DCM	0x4
 #define	IEEE80211_HE_PHY_CAP3_DCM_MAX_RX_NSS_1		0x8
 #define	IEEE80211_HE_PHY_CAP3_DCM_MAX_TX_NSS_1		0x10
+#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_CAP4_BEAMFORMEE_MAX_STS_UNDER_80MHZ_8	0x1
 #define	IEEE80211_HE_PHY_CAP4_BEAMFORMEE_MAX_STS_ABOVE_80MHZ_8	0x2
 #define	IEEE80211_HE_PHY_CAP4_SU_BEAMFORMEE			0x4
+#define	IEEE80211_HE_PHY_CAP4_MU_BEAMFORMER			0x8
+#define	IEEE80211_HE_PHY_CAP4_BEAMFORMEE_MAX_STS_UNDER_80MHZ_4	0x10
 
 #define	IEEE80211_HE_PHY_CAP5_BEAMFORMEE_NUM_SND_DIM_ABOVE_80MHZ_2	0x1
 #define	IEEE80211_HE_PHY_CAP5_BEAMFORMEE_NUM_SND_DIM_UNDER_80MHZ_2	0x2
+#define	IEEE80211_HE_PHY_CAP5_BEAMFORMEE_NUM_SND_DIM_UNDER_80MHZ_MASK	0x4
+#define	IEEE80211_HE_PHY_CAP5_NG16_MU_FEEDBACK				0x8
+#define	IEEE80211_HE_PHY_CAP5_NG16_SU_FEEDBACK				0x10
 
 #define	IEEE80211_HE_PHY_CAP6_PPE_THRESHOLD_PRESENT	0x1
 #define	IEEE80211_HE_PHY_CAP6_TRIG_MU_BEAMFORMER_FB	0x2
 #define	IEEE80211_HE_PHY_CAP6_TRIG_SU_BEAMFORMER_FB	0x4
-#define	IEEE80211_HE_PHY_CAP6_TRIG_SU_BEAMFORMING_FB	0x10
+#define	IEEE80211_HE_PHY_CAP6_TRIG_SU_BEAMFORMING_FB	0x8
 #define	IEEE80211_HE_PHY_CAP6_TRIG_MU_BEAMFORMING_PARTIAL_BW_FB	0x20
+#define	IEEE80211_HE_PHY_CAP6_CODEBOOK_SIZE_42_SU	0x40
+#define	IEEE80211_HE_PHY_CAP6_CODEBOOK_SIZE_75_MU	0x80
+#define	IEEE80211_HE_PHY_CAP6_PARTIAL_BW_EXT_RANGE	0x80
 
 #define	IEEE80211_HE_PHY_CAP7_HE_SU_MU_PPDU_4XLTF_AND_08_US_GI	0x1
 #define	IEEE80211_HE_PHY_CAP7_MAX_NC_1				0x2
@@ -677,6 +719,8 @@ struct linuxkpi_ieee80211_regdomain {
 #define	IEEE80211_HE_PHY_CAP8_DCM_MAX_RU_2x996			0x8
 #define	IEEE80211_HE_PHY_CAP8_DCM_MAX_RU_242			0x10
 #define	IEEE80211_HE_PHY_CAP8_HE_ER_SU_PPDU_4XLTF_AND_08_US_GI	0x20
+#define	IEEE80211_HE_PHY_CAP8_DCM_MAX_RU_996			0x40
+#define	IEEE80211_HE_PHY_CAP8_HE_ER_SU_1XLTF_AND_08_US_GI	0x80
 
 #define	IEEE80211_HE_PHY_CAP9_NOMINAL_PKT_PADDING_0US		0x1
 #define	IEEE80211_HE_PHY_CAP9_NOMINAL_PKT_PADDING_16US		0x2
@@ -688,6 +732,7 @@ struct linuxkpi_ieee80211_regdomain {
 #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_CAP10_HE_MU_M1RU_MAX_LTF		0x1
 
@@ -850,6 +895,7 @@ struct wiphy {
 
 	/* XXX TODO */
 	const struct cfg80211_pmsr_capabilities	*pmsr_capa;
+	const struct cfg80211_sar_capa		*sar_capa;
 	const struct wiphy_iftype_ext_capab	*iftype_ext_capab;
 	const struct linuxkpi_ieee80211_regdomain *regd;
 	char					fw_version[64];		/* XXX TODO */
@@ -1144,7 +1190,7 @@ regulatory_set_wiphy_regd(struct wiphy *wiphy,
 }
 
 static __inline int
-regulatory_hint(struct wiphy *wiphy, uint8_t *alpha2)
+regulatory_hint(struct wiphy *wiphy, const uint8_t *alpha2)
 {
 	TODO();
 	return (-ENXIO);
diff --git a/sys/compat/linuxkpi/common/include/net/mac80211.h b/sys/compat/linuxkpi/common/include/net/mac80211.h
index ffba78be2fed..15ad25cf3a19 100644
--- a/sys/compat/linuxkpi/common/include/net/mac80211.h
+++ b/sys/compat/linuxkpi/common/include/net/mac80211.h
@@ -1,6 +1,6 @@
 /*-
  * Copyright (c) 2020-2021 The FreeBSD Foundation
- * Copyright (c) 2020-2021 Bjoern A. Zeeb
+ * Copyright (c) 2020-2022 Bjoern A. Zeeb
  *
  * This software was developed by Björn Zeeb under sponsorship from
  * the FreeBSD Foundation.
@@ -95,6 +95,7 @@ enum ieee80211_bss_changed {
 	BSS_CHANGED_PS			= BIT(16),
 	BSS_CHANGED_QOS			= BIT(17),
 	BSS_CHANGED_TXPOWER		= BIT(18),
+	BSS_CHANGED_HE_BSS_COLOR	= BIT(19),
 };
 
 /* 802.11 Figure 9-256 Suite selector format. [OUI(3), SUITE TYPE(1)] */
@@ -457,6 +458,7 @@ struct ieee80211_rx_status {
 #define	RATE_INFO_BW_160	0x08
 #define	RATE_INFO_BW_HE_RU	0x10
 	u8	encoding;
+#define	RX_ENC_LEGACY		0x00
 #define	RX_ENC_HE		0x01
 #define	RX_ENC_HT		0x02
 #define	RX_ENC_VHT		0x04
@@ -782,6 +784,8 @@ struct ieee80211_ops {
 	int  (*join_ibss)(struct ieee80211_hw *, struct ieee80211_vif *);
 	void (*leave_ibss)(struct ieee80211_hw *, struct ieee80211_vif *);
 
+	int (*set_sar_specs)(struct ieee80211_hw *, const struct cfg80211_sar_specs *);
+
 	/* XXX TODO: get_et_sset_count, get_et_stats, get_et_strings */
 };
 
@@ -1830,6 +1834,13 @@ ieee80211_tx_status_irqsafe(struct ieee80211_hw *hw, struct sk_buff *skb)
 	ieee80211_tx_status(hw, skb);
 }
 
+static __inline void
+ieee80211_tx_status_ni(struct ieee80211_hw *hw, struct sk_buff *skb)
+{
+	IMPROVE();
+	ieee80211_tx_status(hw, skb);
+}
+
 static __inline int
 ieee80211_start_tx_ba_session(struct ieee80211_sta *sta, uint8_t tid, int x)
 {
@@ -1971,6 +1982,12 @@ ieee80211_txq_schedule_start(struct ieee80211_hw *hw, uint32_t ac)
 	TODO();
 }
 
+static __inline void
+ieee80211_schedule_txq(struct ieee80211_hw *hw, struct ieee80211_txq *txq)
+{
+	TODO();
+}
+
 static __inline void
 ieee80211_beacon_set_cntdwn(struct ieee80211_vif *vif, u8 counter)
 {