git: 6b4cac814e32 - main - LinuxKPI: add 802.11 compat code

From: Bjoern A. Zeeb <bz_at_FreeBSD.org>
Date: Mon, 27 Dec 2021 19:11:45 UTC
The branch main has been updated by bz:

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

commit 6b4cac814e32f3b307720d6b880939fb1f21f3ac
Author:     Bjoern A. Zeeb <bz@FreeBSD.org>
AuthorDate: 2021-12-26 18:52:51 +0000
Commit:     Bjoern A. Zeeb <bz@FreeBSD.org>
CommitDate: 2021-12-27 18:47:25 +0000

    LinuxKPI: add 802.11 compat code
    
    Add 802.11 compat code for mac80211 and to a minimal degree cfg80211.
    This allows us to compile and use basic functionality of wireless
    drivers such as iwlwifi.
    
    This is a constant work in progress but having it in the tree will
    allow others to test and more easy to track changes and avoid having
    snapshots no longer applying to branches.
    
    Sponsored by:   The FreeBSD Foundation
    MFC after:      3 days
---
 .../linuxkpi/common/include/linux/ieee80211.h      |  511 +++
 sys/compat/linuxkpi/common/include/linux/nl80211.h |  308 ++
 sys/compat/linuxkpi/common/include/net/cfg80211.h  | 1489 ++++++++
 .../common/include/net/ieee80211_radiotap.h        |    2 -
 sys/compat/linuxkpi/common/include/net/mac80211.h  | 2028 +++++++++++
 sys/compat/linuxkpi/common/src/linux_80211.c       | 3576 ++++++++++++++++++++
 sys/compat/linuxkpi/common/src/linux_80211.h       |  235 ++
 .../linuxkpi/common/src/linux_80211_macops.c       |  615 ++++
 sys/conf/files                                     |    4 +
 sys/modules/Makefile                               |    1 +
 sys/modules/linuxkpi_wlan/Makefile                 |   15 +
 11 files changed, 8782 insertions(+), 2 deletions(-)

diff --git a/sys/compat/linuxkpi/common/include/linux/ieee80211.h b/sys/compat/linuxkpi/common/include/linux/ieee80211.h
new file mode 100644
index 000000000000..714a682013ec
--- /dev/null
+++ b/sys/compat/linuxkpi/common/include/linux/ieee80211.h
@@ -0,0 +1,511 @@
+/*-
+ * Copyright (c) 2020-2021 The FreeBSD Foundation
+ *
+ * This software was developed by Björn Zeeb under sponsorship from
+ * the FreeBSD Foundation.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * $FreeBSD$
+ */
+
+#ifndef	_LINUXKPI_LINUX_IEEE80211_H
+#define	_LINUXKPI_LINUX_IEEE80211_H
+
+#include <sys/types.h>
+#include <net80211/ieee80211.h>
+
+#include <asm/unaligned.h>
+#include <linux/bitops.h>
+#include <linux/if_ether.h>
+
+/* linux_80211.c */
+extern int debug_80211;
+
+
+#define	IEEE80211_CCMP_HDR_LEN			8	/* 802.11i .. net80211 comment */
+#define	IEEE80211_CCMP_PN_LEN			6
+#define	IEEE80211_CCMP_MIC_LEN			8	/* || 16 */
+#define	IEEE80211_GCMP_HDR_LEN			8
+#define	IEEE80211_GCMP_PN_LEN			6
+#define	IEEE80211_GMAC_PN_LEN			6
+
+#define	IEEE80211_MAX_PN_LEN			16
+
+#define	IEEE80211_INVAL_HW_QUEUE		((uint8_t)-1)
+
+#define	IEEE80211_MAX_AMPDU_BUF_HT		0x40
+#define	IEEE80211_MAX_AMPDU_BUF			256	/* for HE? */
+
+#define	IEEE80211_MAX_DATA_LEN			(2300 + IEEE80211_CRC_LEN)
+
+#define	IEEE80211_MAX_MPDU_LEN_HT_BA		4095	/* 9.3.2.1 Format of Data frames; non-VHT non-DMG STA */
+#define	IEEE80211_MAX_MPDU_LEN_HT_3839		3839
+#define	IEEE80211_MAX_MPDU_LEN_VHT_3895		3895
+#define	IEEE80211_MAX_MPDU_LEN_VHT_7991		7991
+#define	IEEE80211_MAX_MPDU_LEN_VHT_11454	11454
+
+#define	IEEE80211_MAX_RTS_THRESHOLD		2346	/* net80211::IEEE80211_RTS_MAX */
+
+#define	IEEE80211_MIN_ACTION_SIZE		23	/* ? */
+
+/* Wi-Fi Peer-to-Peer (P2P) Technical Specification */
+#define	IEEE80211_P2P_OPPPS_CTWINDOW_MASK	0x7f
+#define	IEEE80211_P2P_OPPPS_ENABLE_BIT		BIT(7)
+
+#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)
+
+enum ieee80211_rate_control_changed_flags {
+	IEEE80211_RC_BW_CHANGED			= BIT(0),
+	IEEE80211_RC_NSS_CHANGED		= BIT(1),
+	IEEE80211_RC_SUPP_RATES_CHANGED		= BIT(2),
+};
+
+#define	IEEE80211_SCTL_FRAG			IEEE80211_SEQ_FRAG_MASK
+#define	IEEE80211_SCTL_SEQ			IEEE80211_SEQ_SEQ_MASK
+
+#define	IEEE80211_TKIP_ICV_LEN			4
+#define	IEEE80211_TKIP_IV_LEN			8	/* WEP + KID + EXT */
+
+#define	IEEE80211_VHT_EXT_NSS_BW_CAPABLE	(1 << 13)	/* assigned to tx_highest */
+
+#define	IEEE80211_VHT_MAX_AMPDU_1024K		7	/* 9.4.2.56.3 A-MPDU Parameters field, Table 9-163 */
+
+#define	IEEE80211_WEP_IV_LEN			3	/* net80211: IEEE80211_WEP_IVLEN */
+#define	IEEE80211_WEP_ICV_LEN			4
+
+#define	WLAN_AUTH_OPEN				__LINE__ /* TODO FIXME brcmfmac */
+#define	WLAN_CAPABILITY_IBSS			__LINE__ /* TODO FIXME no longer used? */
+#define	WLAN_CAPABILITY_SHORT_PREAMBLE		__LINE__ /* TODO FIXME brcmfmac */
+#define	WLAN_CAPABILITY_SHORT_SLOT_TIME		__LINE__ /* TODO FIXME brcmfmac */
+
+
+#define	WLAN_MAX_KEY_LEN			32 /* TODO FIXME brcmfmac */
+#define	WLAN_PMKID_LEN				16 /* TODO FIXME brcmfmac */
+
+#define	WLAN_KEY_LEN_CCMP			16
+#define	WLAN_KEY_LEN_GCMP_256			32
+
+/* 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_4		= 5,	/* 4us */
+	IEEE80211_HT_MPDU_DENSITY_16		= 7, 	/* 16us */
+};
+
+/* 9.4.2.57, Table 9-168, HT Operation element fields and subfields */
+#define	IEEE80211_HT_STBC_PARAM_DUAL_CTS_PROT	0x0080	/* B24.. */
+
+#define	IEEE80211_FCTL_STYPE			IEEE80211_FC0_SUBTYPE_MASK
+
+#define	IEEE80211_STYPE_ASSOC_REQ		IEEE80211_FC0_SUBTYPE_ASSOC_REQ
+#define	IEEE80211_STYPE_REASSOC_REQ		IEEE80211_FC0_SUBTYPE_REASSOC_REQ
+#define	IEEE80211_STYPE_PROBE_REQ		IEEE80211_FC0_SUBTYPE_PROBE_REQ
+#define	IEEE80211_STYPE_DISASSOC		IEEE80211_FC0_SUBTYPE_DISASSOC
+#define	IEEE80211_STYPE_AUTH			IEEE80211_FC0_SUBTYPE_AUTH
+#define	IEEE80211_STYPE_DEAUTH			IEEE80211_FC0_SUBTYPE_DEAUTH
+#define	IEEE80211_STYPE_ACTION			IEEE80211_FC0_SUBTYPE_ACTION
+
+#define	IEEE80211_NUM_ACS			4	/* net8021::WME_NUM_AC */
+
+#define	IEEE80211_MAX_SSID_LEN			32	/* 9.4.2.2 SSID element, net80211: IEEE80211_NWID_LEN */
+
+
+/* Figure 9-27, BAR Control field */
+#define	IEEE80211_BAR_CTRL_TID_INFO_MASK	0xf000
+#define	IEEE80211_BAR_CTRL_TID_INFO_SHIFT	12
+
+#define	IEEE80211_PPE_THRES_INFO_PPET_SIZE		1 /* TODO FIXME ax? */
+#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_HT_OP_MODE_PROTECTION			0x03	/* MASK */
+#define	IEEE80211_HT_OP_MODE_PROTECTION_NONE		0x00
+#define	IEEE80211_HT_OP_MODE_PROTECTION_20MHZ		0x01
+#define	IEEE80211_HT_OP_MODE_PROTECTION_NONHT_MIXED	0x02
+#define	IEEE80211_HT_OP_MODE_PROTECTION_NONMEMBER	0x03
+
+
+/* 9.6.13.1, Table 9-342 TDLS Action field values. */
+enum ieee80211_tdls_action_code {
+	WLAN_TDLS_SETUP_REQUEST			= 0,
+	WLAN_TDLS_SETUP_RESPONSE		= 1,
+	WLAN_TDLS_SETUP_CONFIRM			= 2,
+	WLAN_TDLS_TEARDOWN			= 3,
+	WLAN_TDLS_PEER_TRAFFIC_INDICATION	= 4,
+	WLAN_TDLS_CHANNEL_SWITCH_REQUEST	= 5,
+	WLAN_TDLS_CHANNEL_SWITCH_RESPONSE	= 6,
+	WLAN_TDLS_PEER_PSM_REQUEST		= 7,
+	WLAN_TDLS_PEER_PSM_RESPONSE		= 8,
+	WLAN_TDLS_PEER_TRAFFIC_RESPONSE		= 9,
+	WLAN_TDLS_DISCOVERY_REQUEST		= 10,
+	/* 11-255 reserved */
+};
+
+/* 9.4.2.27, Table 9-135. Extended Capabilities field. */
+/* This is split up into octets CAPA1 = octet 1, ... */
+#define	WLAN_EXT_CAPA1_EXT_CHANNEL_SWITCHING			BIT(2  % 8)
+#define	WLAN_EXT_CAPA3_MULTI_BSSID_SUPPORT			BIT(22 % 8)
+#define	WLAN_EXT_CAPA8_OPMODE_NOTIF				BIT(62 % 8)
+#define	WLAN_EXT_CAPA10_TWT_REQUESTER_SUPPORT			BIT(5)		/* XXX */
+#define	WLAN_EXT_CAPA10_OBSS_NARROW_BW_RU_TOLERANCE_SUPPORT	BIT(7)		/* XXX */
+
+
+/* iwlwifi/mvm/utils:: for (ac = IEEE80211_AC_VO; ac <= IEEE80211_AC_VI; ac++) */
+/* Would be so much easier if we'd define constants to the same. */
+enum ieee80211_ac_numbers {
+	IEEE80211_AC_VO = 0,			/* net80211::WME_AC_VO */
+	IEEE80211_AC_VI = 1,			/* net80211::WME_AC_VI */
+	IEEE80211_AC_BE = 2,			/* net80211::WME_AC_BE */
+	IEEE80211_AC_BK = 3,			/* net80211::WME_AC_BK */
+};
+
+#define	IEEE80211_MAX_QUEUES			16	/* Assume IEEE80211_NUM_TIDS for the moment. */
+
+#define	IEEE80211_WMM_IE_STA_QOSINFO_AC_VO	1
+#define	IEEE80211_WMM_IE_STA_QOSINFO_AC_VI	2
+#define	IEEE80211_WMM_IE_STA_QOSINFO_AC_BK	4
+#define	IEEE80211_WMM_IE_STA_QOSINFO_AC_BE	8
+#define	IEEE80211_WMM_IE_STA_QOSINFO_SP_ALL	0xf
+
+struct vht_mcs {
+	uint16_t	rx_mcs_map;
+	uint16_t	rx_highest;
+	uint16_t	tx_mcs_map;
+	uint16_t	tx_highest;
+};
+
+struct ieee80211_vht_cap {
+	struct vht_mcs				supp_mcs;;
+	__le32					vht_cap_info;
+};
+
+enum ieee80211_ht_max_ampdu_len {
+	IEEE80211_HT_MAX_AMPDU_64K
+};
+
+enum ieee80211_ampdu_mlme_action {
+	IEEE80211_AMPDU_RX_START,
+	IEEE80211_AMPDU_RX_STOP,
+	IEEE80211_AMPDU_TX_OPERATIONAL,
+	IEEE80211_AMPDU_TX_START,
+	IEEE80211_AMPDU_TX_START_DELAY_ADDBA,
+	IEEE80211_AMPDU_TX_START_IMMEDIATE,
+	IEEE80211_AMPDU_TX_STOP_CONT,
+	IEEE80211_AMPDU_TX_STOP_FLUSH,
+	IEEE80211_AMPDU_TX_STOP_FLUSH_CONT
+};
+
+enum ieee80211_chanctx_switch_mode {
+	CHANCTX_SWMODE_REASSIGN_VIF,
+	CHANCTX_SWMODE_SWAP_CONTEXTS,
+};
+
+enum ieee80211_chanctx_change_flags {
+	IEEE80211_CHANCTX_CHANGE_MIN_WIDTH	= BIT(0),
+	IEEE80211_CHANCTX_CHANGE_RADAR		= BIT(1),
+	IEEE80211_CHANCTX_CHANGE_RX_CHAINS	= BIT(2),
+	IEEE80211_CHANCTX_CHANGE_WIDTH		= BIT(3),
+};
+
+enum ieee80211_frame_release_type {
+	IEEE80211_FRAME_RELEASE_PSPOLL		= 1,
+	IEEE80211_FRAME_RELEASE_UAPSD		= 2,
+};
+
+enum ieee80211_p2p_attr_ids {
+	IEEE80211_P2P_ATTR_DEVICE_ID,
+	IEEE80211_P2P_ATTR_DEVICE_INFO,
+	IEEE80211_P2P_ATTR_GROUP_ID,
+	IEEE80211_P2P_ATTR_LISTEN_CHANNEL,
+};
+
+enum ieee80211_reconfig_type {
+	IEEE80211_RECONFIG_TYPE_RESTART,
+	IEEE80211_RECONFIG_TYPE_SUSPEND,
+};
+
+enum ieee80211_roc_type {
+	IEEE80211_ROC_TYPE_MGMT_TX,
+	IEEE80211_ROC_TYPE_NORMAL,
+};
+
+enum ieee80211_smps_mode {
+	IEEE80211_SMPS_OFF,
+	IEEE80211_SMPS_STATIC,
+	IEEE80211_SMPS_DYNAMIC,
+	IEEE80211_SMPS_AUTOMATIC,
+	IEEE80211_SMPS_NUM_MODES,
+};
+
+/* net80211::IEEE80211_S_* different but represents the state machine. */
+/* Note: order here is important! */
+enum ieee80211_sta_state {
+	IEEE80211_STA_NOTEXIST,
+	IEEE80211_STA_NONE,
+	IEEE80211_STA_AUTH,
+	IEEE80211_STA_ASSOC,
+	IEEE80211_STA_AUTHORIZED,		/* 802.1x */
+};
+
+enum ieee80211_sta_rx_bw {
+	IEEE80211_STA_RX_BW_20,
+	IEEE80211_STA_RX_BW_40,
+	IEEE80211_STA_RX_BW_80,
+	IEEE80211_STA_RX_BW_160,
+};
+
+enum ieee80211_tx_info_flags {
+	/* XXX TODO .. right shift numbers - not sure where that came from? */
+	IEEE80211_TX_CTL_AMPDU			= BIT(0),
+	IEEE80211_TX_CTL_ASSIGN_SEQ		= BIT(1),
+	IEEE80211_TX_CTL_NO_ACK			= BIT(2),
+	IEEE80211_TX_CTL_SEND_AFTER_DTIM	= BIT(3),
+	IEEE80211_TX_CTL_TX_OFFCHAN		= BIT(4),
+	IEEE80211_TX_CTL_REQ_TX_STATUS		= BIT(5),
+	IEEE80211_TX_STATUS_EOSP		= BIT(6),
+	IEEE80211_TX_STAT_ACK			= BIT(7),
+	IEEE80211_TX_STAT_AMPDU			= BIT(8),
+	IEEE80211_TX_STAT_AMPDU_NO_BACK		= BIT(9),
+	IEEE80211_TX_STAT_TX_FILTERED		= BIT(10),
+	IEEE80211_TX_STAT_NOACK_TRANSMITTED	= BIT(11),
+};
+
+enum ieee80211_tx_control_flags {
+	/* XXX TODO .. right shift numbers */
+	IEEE80211_TX_CTRL_PORT_CTRL_PROTO	= BIT(0),
+};
+
+enum ieee80211_tx_rate_flags {
+	/* XXX TODO .. right shift numbers */
+	IEEE80211_TX_RC_40_MHZ_WIDTH		= BIT(0),
+	IEEE80211_TX_RC_80_MHZ_WIDTH		= BIT(1),
+	IEEE80211_TX_RC_160_MHZ_WIDTH		= BIT(2),
+	IEEE80211_TX_RC_GREEN_FIELD		= BIT(3),
+	IEEE80211_TX_RC_MCS			= BIT(4),
+	IEEE80211_TX_RC_SHORT_GI		= BIT(5),
+	IEEE80211_TX_RC_VHT_MCS			= BIT(6),
+};
+
+struct ieee80211_hdr {		/* net80211::ieee80211_frame */
+        __le16		frame_control;
+        __le16		duration_id;
+	uint8_t		addr1[ETH_ALEN];
+	uint8_t		addr2[ETH_ALEN];
+	uint8_t		addr3[ETH_ALEN];
+	__le16		seq_ctrl;
+	uint8_t		addr4[ETH_ALEN];
+};
+
+struct ieee80211_vendor_ie {
+};
+
+/* 9.3.3.2 Format of Management frames */
+struct ieee80211_mgmt {
+	__le16		frame_control;
+        __le16		duration_id;
+	uint8_t		da[ETH_ALEN];
+	uint8_t		sa[ETH_ALEN];
+	uint8_t		bssid[ETH_ALEN];
+	__le16		seq_ctrl;
+	union {
+		/* 9.3.3.3 Beacon frame format */
+		struct {
+			uint64_t	timestamp;
+			uint16_t	beacon_int;
+			uint16_t	capab_info;
+			uint8_t		variable[0];
+		} beacon;
+		/* 9.3.3.10 Probe Request frame format */
+		struct {
+			uint8_t		variable[0];
+		} probe_req;
+		/* 9.3.3.11 Probe Response frame format */
+		struct {
+			uint64_t	timestamp;
+			uint16_t	beacon_int;
+			uint16_t	capab_info;
+			uint8_t		variable[0];
+		} probe_resp;
+		/* 9.3.3.14 Action frame format */
+		struct {
+			/* 9.4.1.11 Action field */
+			uint8_t		category;
+			/* 9.6.8 Public Action details */
+			union {
+				/* 9.6.8.33 Fine Timing Measurement frame format */
+				struct {
+					uint8_t	dialog_token;
+					uint8_t	follow_up;
+					uint8_t	tod[6];
+					uint8_t	toa[6];
+					uint16_t tod_error;
+					uint16_t toa_error;
+					uint8_t variable[0];
+				} ftm;
+			} u;
+		} action;
+	} u;
+};
+
+#define	MHZ_TO_KHZ(_f)		((_f) * 1000)
+#define	DBI_TO_MBI(_g)		((_g) * 100)
+#define	MBI_TO_DBI(_x)		((_x) / 100)
+#define	DBM_TO_MBM(_g)		((_g) * 100)
+#define	MBM_TO_DBM(_x)		((_x) / 100)
+
+#define	IEEE80211_SEQ_TO_SN(_seqn)	(((_seqn) & IEEE80211_SEQ_SEQ_MASK) >> \
+					    IEEE80211_SEQ_SEQ_SHIFT)
+
+/* Time unit (TU) to .. See net80211: IEEE80211_DUR_TU */
+#define	TU_TO_JIFFIES(_tu)	(usecs_to_jiffies(_tu) * 1024)
+#define	TU_TO_EXP_TIME(_tu)	(jiffies + TU_TO_JIFFIES(_tu))
+
+/* 9.4.2.21.1, Table 9-82. */
+#define	IEEE80211_SPCT_MSR_RPRT_TYPE_LCI	8
+#define	IEEE80211_SPCT_MSR_RPRT_TYPE_CIVIC	11
+
+/* 9.4.2.1, Table 9-77. Element IDs. */
+enum ieee80211_eid {
+	WLAN_EID_SSID				= 0,
+	WLAN_EID_SUPP_RATES			= 1,
+	WLAN_EID_DS_PARAMS			= 3,
+	WLAN_EID_TIM				= 5,
+	WLAN_EID_COUNTRY			= 7, /* IEEE80211_ELEMID_COUNTRY */
+	WLAN_EID_REQUEST			= 10,
+	WLAN_EID_CHANNEL_SWITCH			= 37,
+	WLAN_EID_MEASURE_REPORT			= 39,
+	WLAN_EID_RSN				= 48, /* IEEE80211_ELEMID_RSN */
+	WLAN_EID_EXT_SUPP_RATES			= 50,
+	WLAN_EID_EXT_CHANSWITCH_ANN		= 60,
+	WLAN_EID_EXT_CAPABILITY			= 127,
+	WLAN_EID_VENDOR_SPECIFIC		= 221,
+};
+
+/* 9.4.1.7, Table 9-45. Reason codes. */
+enum ieee80211_reason_code {
+	/* reserved				= 0, */
+	WLAN_REASON_UNSPECIFIED			= 1,
+	WLAN_REASON_DEAUTH_LEAVING		= 3,	/* LEAVING_NETWORK_DEAUTH */
+	WLAN_REASON_TDLS_TEARDOWN_UNSPECIFIED	= 26,
+};
+
+/* 9.4.1.9, Table 9-46. Status codes. */
+enum ieee80211_status_code {
+	WLAN_STATUS_SUCCESS			= 0,
+	WLAN_STATUS_AUTH_TIMEOUT		= 16,	/* REJECTED_SEQUENCE_TIMEOUT */
+};
+
+/* net80211: IEEE80211_IS_CTL() */
+static __inline bool
+ieee80211_is_ctl(__le16 fc)
+{
+	__le16 v;
+
+	fc &= htole16(IEEE80211_FC0_TYPE_MASK);
+	v = htole16(IEEE80211_FC0_TYPE_CTL);
+
+	return (fc == v);
+}
+
+/* net80211: IEEE80211_IS_DATA() */
+static __inline bool
+ieee80211_is_data(__le16 fc)
+{
+	__le16 v;
+
+	fc &= htole16(IEEE80211_FC0_TYPE_MASK);
+	v = htole16(IEEE80211_FC0_TYPE_DATA);
+
+	return (fc == v);
+}
+
+/* net80211: IEEE80211_IS_QOSDATA() */
+static __inline bool
+ieee80211_is_data_qos(__le16 fc)
+{
+	__le16 v;
+
+	fc &= htole16(IEEE80211_FC0_SUBTYPE_QOS | IEEE80211_FC0_TYPE_MASK |
+	    IEEE80211_FC0_VERSION_MASK);
+	v = htole16(IEEE80211_FC0_QOSDATA);
+
+	return (fc == v);
+}
+
+/* net80211: IEEE80211_IS_MGMT() */
+static __inline bool
+ieee80211_is_mgmt(__le16 fc)
+{
+	__le16 v;
+
+	fc &= htole16(IEEE80211_FC0_TYPE_MASK);
+	v = htole16(IEEE80211_FC0_TYPE_MGT);
+
+	return (fc == v);
+}
+
+
+/* Derived from net80211::ieee80211_anyhdrsize. */
+static __inline unsigned int
+ieee80211_hdrlen(__le16 fc)
+{
+	unsigned int size;
+
+	if (ieee80211_is_ctl(fc)) {
+		switch (fc & htole16(IEEE80211_FC0_SUBTYPE_MASK)) {
+		case htole16(IEEE80211_FC0_SUBTYPE_CTS):
+		case htole16(IEEE80211_FC0_SUBTYPE_ACK):
+			return sizeof(struct ieee80211_frame_ack);
+		case htole16(IEEE80211_FC0_SUBTYPE_BAR):
+			return sizeof(struct ieee80211_frame_bar);
+		}
+		return (sizeof(struct ieee80211_frame_min));
+	}
+
+	size = sizeof(struct ieee80211_frame);
+	if (ieee80211_is_data(fc)) {
+		if ((fc & htole16(IEEE80211_FC1_DIR_MASK << 8)) ==
+		    htole16(IEEE80211_FC1_DIR_DSTODS << 8))
+			size += IEEE80211_ADDR_LEN;
+		if ((fc & htole16(IEEE80211_FC0_SUBTYPE_QOS |
+		    IEEE80211_FC0_TYPE_MASK)) ==
+		    htole16(IEEE80211_FC0_SUBTYPE_QOS |
+		    IEEE80211_FC0_TYPE_DATA))
+			size += sizeof(uint16_t);
+	}
+
+	if (ieee80211_is_mgmt(fc)) {
+#ifdef __notyet__
+		if (debug_80211 > 0)
+			printf("XXX-BZ %s: TODO? fc %#04x size %u\n",
+			    __func__, fc, size);
+#endif
+		;
+	}
+
+	return (size);
+}
+
+#endif	/* _LINUXKPI_LINUX_IEEE80211_H */
diff --git a/sys/compat/linuxkpi/common/include/linux/nl80211.h b/sys/compat/linuxkpi/common/include/linux/nl80211.h
new file mode 100644
index 000000000000..4f0a55c9dbdb
--- /dev/null
+++ b/sys/compat/linuxkpi/common/include/linux/nl80211.h
@@ -0,0 +1,308 @@
+/*-
+ * Copyright (c) 2020-2021 The FreeBSD Foundation
+ *
+ * This software was developed by Björn Zeeb under sponsorship from
+ * the FreeBSD Foundation.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * $FreeBSD$
+ */
+
+#ifndef	_LINUXKPI_LINUX_NL80211_H
+#define	_LINUXKPI_LINUX_NL80211_H
+
+#include <linux/bitops.h>
+
+enum nl80211_feature_flags {
+	NL80211_FEATURE_AP_MODE_CHAN_WIDTH_CHANGE	= BIT(0),
+	NL80211_FEATURE_DS_PARAM_SET_IE_IN_PROBES	= BIT(1),
+	NL80211_FEATURE_HT_IBSS				= BIT(2),
+	NL80211_FEATURE_LOW_PRIORITY_SCAN		= BIT(3),
+	NL80211_FEATURE_ND_RANDOM_MAC_ADDR		= BIT(4),
+	NL80211_FEATURE_P2P_GO_CTWIN			= BIT(5),
+	NL80211_FEATURE_P2P_GO_OPPPS			= BIT(6),
+	NL80211_FEATURE_QUIET				= BIT(7),
+	NL80211_FEATURE_SCAN_RANDOM_MAC_ADDR		= BIT(8),
+	NL80211_FEATURE_SCHED_SCAN_RANDOM_MAC_ADDR	= BIT(9),
+	NL80211_FEATURE_DYNAMIC_SMPS			= BIT(10),
+	NL80211_FEATURE_STATIC_SMPS			= BIT(11),
+	NL80211_FEATURE_SUPPORTS_WMM_ADMISSION		= BIT(12),
+	NL80211_FEATURE_TDLS_CHANNEL_SWITCH		= BIT(13),
+	NL80211_FEATURE_TX_POWER_INSERTION		= BIT(14),
+	NL80211_FEATURE_WFA_TPC_IE_IN_PROBES		= BIT(15),
+};
+
+enum nl80211_pmsr_ftm_failure_flags {
+	NL80211_PMSR_FTM_FAILURE_NO_RESPONSE		= BIT(0),
+	NL80211_PMSR_FTM_FAILURE_PEER_BUSY		= BIT(1),
+	NL80211_PMSR_FTM_FAILURE_UNSPECIFIED		= BIT(2),
+};
+
+enum nl80211_pmsr_status_flags {
+	NL80211_PMSR_STATUS_FAILURE			= BIT(0),
+	NL80211_PMSR_STATUS_SUCCESS			= BIT(1),
+	NL80211_PMSR_STATUS_TIMEOUT			= BIT(2),
+};
+
+#define	NL80211_PMSR_TYPE_FTM				1
+
+enum nl80211_reg_rule_flags {
+	NL80211_RRF_AUTO_BW				= BIT(0),
+	NL80211_RRF_DFS					= BIT(1),
+	NL80211_RRF_GO_CONCURRENT			= BIT(2),
+	NL80211_RRF_NO_IR				= BIT(3),
+	NL80211_RRF_NO_OUTDOOR				= BIT(4),
+	NL80211_RRF_NO_HT40MINUS			= BIT(5),
+	NL80211_RRF_NO_HT40PLUS				= BIT(6),
+	NL80211_RRF_NO_80MHZ				= BIT(7),
+	NL80211_RRF_NO_160MHZ				= BIT(8),
+	NL80211_RRF_NO_HE				= BIT(9),
+};
+#define	NL80211_RRF_NO_HT40	(NL80211_RRF_NO_HT40MINUS|NL80211_RRF_NO_HT40PLUS)
+
+enum nl80211_scan_flags {
+	NL80211_SCAN_FLAG_FILS_MAX_CHANNEL_TIME		= BIT(0),
+	NL80211_SCAN_FLAG_OCE_PROBE_REQ_DEFERRAL_SUPPRESSION	= BIT(1),
+	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),
+};
+
+#define	NL80211_REGDOM_SET_BY_USER			1
+#define	NL80211_REGDOM_SET_BY_DRIVER			2
+
+#define	NL80211_MAX_SUPP_REG_RULES			512	/* TODO FIXME, random */
+
+#define	NL80211_BSS_CHAN_WIDTH_20			__LINE__ /* TODO FIXME, brcmfmac */
+
+enum nl80211_wpa_versions {
+	NL80211_WPA_VERSION_1	= 1,
+	NL80211_WPA_VERSION_2,
+	NL80211_WPA_VERSION_3,
+};
+
+enum nl80211_bss_select_attr {
+	__NL80211_BSS_SELECT_ATTR_INVALID	= 0,
+	NL80211_BSS_SELECT_ATTR_BAND_PREF,
+	NL80211_BSS_SELECT_ATTR_RSSI,
+	NL80211_BSS_SELECT_ATTR_RSSI_ADJUST,
+};
+
+enum nl80211_sta_flag {
+	/* XXX TODO */
+	NL80211_STA_FLAG_ASSOCIATED,
+	NL80211_STA_FLAG_AUTHENTICATED,
+	NL80211_STA_FLAG_AUTHORIZED,
+	NL80211_STA_FLAG_TDLS_PEER,
+	NL80211_STA_FLAG_WME,
+};
+
+enum nl80211_band {
+	/* XXX TODO */
+	NL80211_BAND_2GHZ	= 0,
+	NL80211_BAND_5GHZ,
+	NL80211_BAND_60GHZ,
+	NL80211_BAND_6GHZ,
+
+	/* Keep this last. */
+	NUM_NL80211_BANDS
+};
+
+enum nl80211_chan_flags {
+	/* XXX TODO */
+	NL80211_CHAN_NO_HT,
+};
+
+enum nl80211_chan_width {
+	/* XXX TODO */
+	NL80211_CHAN_WIDTH_20_NOHT,
+	NL80211_CHAN_WIDTH_20,
+	NL80211_CHAN_WIDTH_40,
+	NL80211_CHAN_WIDTH_80,
+	NL80211_CHAN_WIDTH_80P80,
+	NL80211_CHAN_WIDTH_160,
+	NL80211_CHAN_WIDTH_5,
+	NL80211_CHAN_WIDTH_10,
+};
+
+enum nl80211_iftype {
+	/* XXX TODO */
+	NL80211_IFTYPE_UNSPECIFIED,
+	NL80211_IFTYPE_ADHOC,
+	NL80211_IFTYPE_STATION,
+	NL80211_IFTYPE_AP,
+	NL80211_IFTYPE_AP_VLAN,
+	NL80211_IFTYPE_MONITOR,
+	NL80211_IFTYPE_P2P_CLIENT,
+	NL80211_IFTYPE_P2P_DEVICE,
+	NL80211_IFTYPE_P2P_GO,
+	NL80211_IFTYPE_MESH_POINT,
+	NL80211_IFTYPE_WDS,
+
+	/* Keep this last. */
+	NUM_NL80211_IFTYPES
+};
+
+enum nl80211_preamble {
+	/* XXX TODO */
+	NL80211_PREAMBLE_LEGACY,
+	NL80211_PREAMBLE_HT,
+	NL80211_PREAMBLE_VHT,
+	NL80211_PREAMBLE_HE,
+};
+
+enum nl80211_tdls_operation {
+	/* XXX TODO */
+	NL80211_TDLS_SETUP,
+	NL80211_TDLS_TEARDOWN,
+	NL80211_TDLS_ENABLE_LINK,
+	NL80211_TDLS_DISABLE_LINK,
+	NL80211_TDLS_DISCOVERY_REQ,
+	NL80211_TKIP_DATA_OFFSET_RX_MIC_KEY,
+	NL80211_TKIP_DATA_OFFSET_TX_MIC_KEY,
+};
+
+enum nl80211_cqm_rssi_threshold_event {
+	/* XXX TODO */
+	NL80211_CQM_RSSI_THRESHOLD_EVENT_LOW,
+	NL80211_CQM_RSSI_THRESHOLD_EVENT_HIGH,
+};
+
+enum nl80211_ext_feature {
+	/* XXX TODO */
+	NL80211_EXT_FEATURE_ACCEPT_BCAST_PROBE_RESP,
+	NL80211_EXT_FEATURE_BSS_PARENT_TSF,
+	NL80211_EXT_FEATURE_CAN_REPLACE_PTK0,
+	NL80211_EXT_FEATURE_DFS_OFFLOAD,
+	NL80211_EXT_FEATURE_ENABLE_FTM_RESPONDER,
+	NL80211_EXT_FEATURE_EXT_KEY_ID,
+	NL80211_EXT_FEATURE_FILS_MAX_CHANNEL_TIME,
+	NL80211_EXT_FEATURE_MU_MIMO_AIR_SNIFFER,
+	NL80211_EXT_FEATURE_OCE_PROBE_REQ_DEFERRAL_SUPPRESSION,
+	NL80211_EXT_FEATURE_OCE_PROBE_REQ_HIGH_TX_RATE,
+	NL80211_EXT_FEATURE_PROTECTED_TWT,
+	NL80211_EXT_FEATURE_SAE_OFFLOAD,
+	NL80211_EXT_FEATURE_SCAN_START_TIME,
+	NL80211_EXT_FEATURE_SET_SCAN_DWELL,
+	NL80211_EXT_FEATURE_VHT_IBSS,
+	NL80211_EXT_FEATURE_4WAY_HANDSHAKE_STA_1X,
+	NL80211_EXT_FEATURE_4WAY_HANDSHAKE_STA_PSK,
+	NL80211_EXT_FEATURE_BEACON_PROTECTION_CLIENT,
+
+	/* Keep this last. */
+	NUM_NL80211_EXT_FEATURES
+};
+
+enum nl80211_sta_info {
+	/* XXX TODO */
+	NL80211_STA_INFO_BEACON_RX,
+	NL80211_STA_INFO_BEACON_SIGNAL_AVG,
+	NL80211_STA_INFO_BSS_PARAM,
+	NL80211_STA_INFO_CHAIN_SIGNAL,
+	NL80211_STA_INFO_CONNECTED_TIME,
+	NL80211_STA_INFO_INACTIVE_TIME,
+	NL80211_STA_INFO_SIGNAL,
+	NL80211_STA_INFO_SIGNAL_AVG,
+	NL80211_STA_INFO_STA_FLAGS,
+	NL80211_STA_INFO_RX_BITRATE,
+	NL80211_STA_INFO_RX_PACKETS,
+	NL80211_STA_INFO_RX_BYTES,
+	NL80211_STA_INFO_RX_DROP_MISC,
+	NL80211_STA_INFO_TX_BITRATE,
+	NL80211_STA_INFO_TX_PACKETS,
+	NL80211_STA_INFO_TX_BYTES,
+	NL80211_STA_INFO_TX_FAILED,
+};
+
+enum nl80211_ftm_stats {
+	/* XXX TODO */
+	NL80211_FTM_STATS_ASAP_NUM,
+	NL80211_FTM_STATS_FAILED_NUM,
+	NL80211_FTM_STATS_NON_ASAP_NUM,
+	NL80211_FTM_STATS_OUT_OF_WINDOW_TRIGGERS_NUM,
+	NL80211_FTM_STATS_PARTIAL_NUM,
+	NL80211_FTM_STATS_RESCHEDULE_REQUESTS_NUM,
+	NL80211_FTM_STATS_SUCCESS_NUM,
+	NL80211_FTM_STATS_TOTAL_DURATION_MSEC,
+	NL80211_FTM_STATS_UNKNOWN_TRIGGERS_NUM,
+};
+
+enum nl80211_reg_initiator {
+	/* XXX TODO */
+	_XXX_FXIME_RTW88_USES_ENUM,
+};
+
+struct nl80211_sta_flag_update {
+	/* XXX TODO */
+	int     mask, set;
+
+};
+
+enum nl80211_tx_power_setting {
+	/* XXX TODO */
+	NL80211_TX_POWER_AUTOMATIC,
+	NL80211_TX_POWER_FIXED,
+	NL80211_TX_POWER_LIMITED,
+};
+
+enum nl80211_crit_proto_id {
+	/* XXX TODO */
+	NL80211_CRIT_PROTO_DHCP,
+};
+
+enum nl80211_auth_type {
+	NL80211_AUTHTYPE_AUTOMATIC,
+	NL80211_AUTHTYPE_OPEN_SYSTEM,
+	NL80211_AUTHTYPE_SHARED_KEY,
+	NL80211_AUTHTYPE_SAE,
+};
+
+enum nl80211_key_type {
+	NL80211_KEYTYPE_GROUP,
+	NL80211_KEYTYPE_PAIRWISE,
+};
+
+enum nl80211_rate_info_he_ru_alloc {
+	NL80211_RATE_INFO_HE_RU_ALLOC_26,
+	NL80211_RATE_INFO_HE_RU_ALLOC_52,
+	NL80211_RATE_INFO_HE_RU_ALLOC_106,
+	NL80211_RATE_INFO_HE_RU_ALLOC_242,
+	NL80211_RATE_INFO_HE_RU_ALLOC_484,
+	NL80211_RATE_INFO_HE_RU_ALLOC_996,
+	NL80211_RATE_INFO_HE_RU_ALLOC_2x996,
+};
+
+enum nl80211_rate_info_he_gi {
+	NL80211_RATE_INFO_HE_GI_0_8,
+	NL80211_RATE_INFO_HE_GI_1_6,
+	NL80211_RATE_INFO_HE_GI_3_2,
+};
+
+enum nl80211_dfs_regions {
+	NL80211_DFS_UNSET,
+	NL80211_DFS_FCC,
+	NL80211_DFS_ETSI,
+	NL80211_DFS_JP,
+};
+
+#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
new file mode 100644
index 000000000000..595d65a6ad71
--- /dev/null
+++ b/sys/compat/linuxkpi/common/include/net/cfg80211.h
@@ -0,0 +1,1489 @@
+/*-
+ * Copyright (c) 2020-2021 The FreeBSD Foundation
+ * Copyright (c) 2021 Bjoern A. Zeeb
+ *
+ * This software was developed by Björn Zeeb under sponsorship from
+ * the FreeBSD Foundation.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * $FreeBSD$
+ */
+
+#ifndef	_LINUXKPI_NET_CFG80211_H
+#define	_LINUXKPI_NET_CFG80211_H
+
+#include <linux/types.h>
+#include <linux/nl80211.h>
+#include <linux/ieee80211.h>
+#include <linux/if_ether.h>
+#include <linux/device.h>
+#include <linux/netdevice.h>
+#include <linux/random.h>
+#include <linux/skbuff.h>
+
+/* linux_80211.c */
+extern int debug_80211;
+#ifndef	D80211_TODO
+#define	D80211_TODO		0x1
+#endif
+#ifndef	D80211_IMPROVE
+#define	D80211_IMPROVE		0x2
+#endif
+#define	TODO()		if (debug_80211 & D80211_TODO)			\
+    printf("%s:%d: XXX LKPI80211 TODO\n", __func__, __LINE__)
+#define	IMPROVE(...)	if (debug_80211 & D80211_IMPROVE)		\
+    printf("%s:%d: XXX LKPI80211 IMPROVE\n", __func__, __LINE__)
+
+#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 */
+#define	WIPHY_PARAM_RTS_THRESHOLD			__LINE__ /* TODO FIXME brcmfmac */
+
+#define	CFG80211_SIGNAL_TYPE_MBM			__LINE__ /* TODO FIXME brcmfmac */
+
+#define	UPDATE_ASSOC_IES	1
+
+#define	IEEE80211_MAX_CHAINS	4		/* net80211: IEEE80211_MAX_CHAINS copied */
+
+enum cfg80211_rate_info_flags {
+	RATE_INFO_FLAGS_SHORT_GI	= BIT(0),
+	RATE_INFO_FLAGS_MCS		= BIT(1),
+	RATE_INFO_FLAGS_VHT_MCS		= BIT(2),
+	RATE_INFO_FLAGS_HE_MCS		= BIT(3),
+};
+
+extern const uint8_t rfc1042_header[6];
+
+enum cfg80211_bss_ftypes {
+	CFG80211_BSS_FTYPE_UNKNOWN,
+};
+
+enum ieee80211_channel_flags {
+	IEEE80211_CHAN_DISABLED			= 1,
+	IEEE80211_CHAN_INDOOR_ONLY,
+	IEEE80211_CHAN_IR_CONCURRENT,
+	IEEE80211_CHAN_RADAR,
+	IEEE80211_CHAN_NO_IR,
+	IEEE80211_CHAN_NO_HT40MINUS,
+	IEEE80211_CHAN_NO_HT40PLUS,
+	IEEE80211_CHAN_NO_80MHZ,
+	IEEE80211_CHAN_NO_160MHZ,
+};
+#define	IEEE80211_CHAN_NO_HT40	(IEEE80211_CHAN_NO_HT40MINUS|IEEE80211_CHAN_NO_HT40PLUS)
+
+struct ieee80211_txrx_stypes {
+	uint16_t	tx;
+	uint16_t	rx;
+};
+
+/* XXX net80211 has an ieee80211_channel as well. */
+struct linuxkpi_ieee80211_channel {
+	/* TODO FIXME */
+	uint32_t				hw_value;	/* ic_ieee */
+	uint32_t				center_freq;	/* ic_freq */
+	enum ieee80211_channel_flags		flags;		/* ic_flags */
+	enum nl80211_band			band;
+	int8_t					max_power;	/* ic_maxpower */
+	bool					beacon_found;
+	int     max_antenna_gain, max_reg_power;
+	int     orig_flags;
+};
+
+enum ieee80211_vht_mcs_support {
+	LKPI_IEEE80211_VHT_MCS_SUPPORT_0_7,
+	LKPI_IEEE80211_VHT_MCS_SUPPORT_0_8,
*** 7912 LINES SKIPPED ***