git: 4dbf04a81da3 - stable/13 - net80211: update (parts of) frame types and subtypes and annotate

From: Bjoern A. Zeeb <bz_at_FreeBSD.org>
Date: Wed, 21 Sep 2022 14:01:35 UTC
The branch stable/13 has been updated by bz:

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

commit 4dbf04a81da33eb5463ca0e603e6ace291358659
Author:     Bjoern A. Zeeb <bz@FreeBSD.org>
AuthorDate: 2022-08-31 22:26:28 +0000
Commit:     Bjoern A. Zeeb <bz@FreeBSD.org>
CommitDate: 2022-09-21 11:46:47 +0000

    net80211: update (parts of) frame types and subtypes and annotate
    
    Update to the full list of frame type and subtype values based on
    802.11-2020 with 11ax and 11ay extensions. This includes the 4th type
    "Extension" (IEEE80211_FC0_TYPE_EXT).
    While here annotate them with descriptions which should help matching
    names (as at times things get confusing with LinuxKPI).
    Also remove some 802.11-1997 values Reserved nowadays.
    
    No functional changes.
    
    Sponsored by:   The FreeBSD Foundation
    Reviewed by:    adrian
    Differential Revision: https://reviews.freebsd.org/D36410
    
    (cherry picked from commit fb47649ebc5a667739e8bd834b993af3c8d1b89f)
---
 sys/net80211/ieee80211.h | 117 ++++++++++++++++++++++++++++++-----------------
 1 file changed, 74 insertions(+), 43 deletions(-)

diff --git a/sys/net80211/ieee80211.h b/sys/net80211/ieee80211.h
index 38f15a810d4f..84a147ccdde3 100644
--- a/sys/net80211/ieee80211.h
+++ b/sys/net80211/ieee80211.h
@@ -117,52 +117,80 @@ struct ieee80211_qosframe_addr4 {
 #define	IEEE80211_FC0_VERSION_0			0x00
 #define	IEEE80211_FC0_TYPE_MASK			0x0c
 #define	IEEE80211_FC0_TYPE_SHIFT		2
-#define	IEEE80211_FC0_TYPE_MGT			0x00
-#define	IEEE80211_FC0_TYPE_CTL			0x04
-#define	IEEE80211_FC0_TYPE_DATA			0x08
+#define	IEEE80211_FC0_TYPE_MGT			0x00	/* Management */
+#define	IEEE80211_FC0_TYPE_CTL			0x04	/* Control */
+#define	IEEE80211_FC0_TYPE_DATA			0x08	/* Data */
+#define	IEEE80211_FC0_TYPE_EXT			0x0c	/* Extension */
 
 #define	IEEE80211_FC0_SUBTYPE_MASK		0xf0
 #define	IEEE80211_FC0_SUBTYPE_SHIFT		4
-/* for TYPE_MGT */
-#define	IEEE80211_FC0_SUBTYPE_ASSOC_REQ		0x00
-#define	IEEE80211_FC0_SUBTYPE_ASSOC_RESP	0x10
-#define	IEEE80211_FC0_SUBTYPE_REASSOC_REQ	0x20
-#define	IEEE80211_FC0_SUBTYPE_REASSOC_RESP	0x30
-#define	IEEE80211_FC0_SUBTYPE_PROBE_REQ		0x40
-#define	IEEE80211_FC0_SUBTYPE_PROBE_RESP	0x50
-#define	IEEE80211_FC0_SUBTYPE_TIMING_ADV	0x60
-#define	IEEE80211_FC0_SUBTYPE_BEACON		0x80
-#define	IEEE80211_FC0_SUBTYPE_ATIM		0x90
-#define	IEEE80211_FC0_SUBTYPE_DISASSOC		0xa0
-#define	IEEE80211_FC0_SUBTYPE_AUTH		0xb0
-#define	IEEE80211_FC0_SUBTYPE_DEAUTH		0xc0
-#define	IEEE80211_FC0_SUBTYPE_ACTION		0xd0
-#define	IEEE80211_FC0_SUBTYPE_ACTION_NOACK	0xe0
-/* for TYPE_CTL */
-#define	IEEE80211_FC0_SUBTYPE_TRIGGER		0x20
-#define	IEEE80211_FC0_SUBTYPE_CONTROL_WRAP	0x70
-#define	IEEE80211_FC0_SUBTYPE_BAR		0x80
-#define	IEEE80211_FC0_SUBTYPE_BA		0x90
-#define	IEEE80211_FC0_SUBTYPE_PS_POLL		0xa0
-#define	IEEE80211_FC0_SUBTYPE_RTS		0xb0
-#define	IEEE80211_FC0_SUBTYPE_CTS		0xc0
-#define	IEEE80211_FC0_SUBTYPE_ACK		0xd0
-#define	IEEE80211_FC0_SUBTYPE_CF_END		0xe0
-#define	IEEE80211_FC0_SUBTYPE_CF_END_ACK	0xf0
-/* for TYPE_DATA (bit combination) */
-#define	IEEE80211_FC0_SUBTYPE_DATA		0x00
-#define	IEEE80211_FC0_SUBTYPE_CF_ACK		0x10
-#define	IEEE80211_FC0_SUBTYPE_CF_POLL		0x20
-#define	IEEE80211_FC0_SUBTYPE_CF_ACPL		0x30
-#define	IEEE80211_FC0_SUBTYPE_NODATA		0x40
-#define	IEEE80211_FC0_SUBTYPE_CFACK		0x50
-#define	IEEE80211_FC0_SUBTYPE_CFPOLL		0x60
-#define	IEEE80211_FC0_SUBTYPE_CF_ACK_CF_ACK	0x70
-#define	IEEE80211_FC0_SUBTYPE_QOS_DATA		0x80
-#define	IEEE80211_FC0_SUBTYPE_QOS_DATA_CFACK	0x90
-#define	IEEE80211_FC0_SUBTYPE_QOS_DATA_CFPOLL	0xa0
-#define	IEEE80211_FC0_SUBTYPE_QOS_DATA_CFACKPOLL 0xb0
-#define	IEEE80211_FC0_SUBTYPE_QOS_NULL		0xc0
+/* 802.11-2020 Table 9-1-Valid type and subtype combinations */
+/* For type 00 Management (IEEE80211_FC0_TYPE_MGT) */
+#define	IEEE80211_FC0_SUBTYPE_ASSOC_REQ		0x00	/* Association Request */
+#define	IEEE80211_FC0_SUBTYPE_ASSOC_RESP	0x10	/* Association Response */
+#define	IEEE80211_FC0_SUBTYPE_REASSOC_REQ	0x20	/* Reassociation Request */
+#define	IEEE80211_FC0_SUBTYPE_REASSOC_RESP	0x30	/* Reassociation Response */
+#define	IEEE80211_FC0_SUBTYPE_PROBE_REQ		0x40	/* Probe Request */
+#define	IEEE80211_FC0_SUBTYPE_PROBE_RESP	0x50	/* Probe Response */
+#define	IEEE80211_FC0_SUBTYPE_TIMING_ADV	0x60	/* Timing Advertisement */
+/* 0111 Reserved				0x70 */
+#define	IEEE80211_FC0_SUBTYPE_BEACON		0x80	/* Beacon */
+#define	IEEE80211_FC0_SUBTYPE_ATIM		0x90	/* ATIM */
+#define	IEEE80211_FC0_SUBTYPE_DISASSOC		0xa0	/* Disassociation */
+#define	IEEE80211_FC0_SUBTYPE_AUTH		0xb0	/* Authentication */
+#define	IEEE80211_FC0_SUBTYPE_DEAUTH		0xc0	/* Deauthentication */
+#define	IEEE80211_FC0_SUBTYPE_ACTION		0xd0	/* Action */
+#define	IEEE80211_FC0_SUBTYPE_ACTION_NOACK	0xe0	/* Action No Ack */
+/* 1111 Reserved				0xf0 */
+/* For type 01 Control (IEEE80211_FC0_TYPE_CTL) */
+/* 0000-0001 Reserved				0x00-0x10 */
+#define	IEEE80211_FC0_SUBTYPE_TRIGGER		0x20	/* Trigger, 80211ax-2021 */
+#define	IEEE80211_FC0_SUBTYPE_TACK		0x30	/* TACK */
+#define	IEEE80211_FC0_SUBTYPE_BF_REPORT_POLL	0x40	/* Beamforming Report Poll */
+#define	IEEE80211_FC0_SUBTYPE_VHT_HE_NDP	0x50	/* VHT/HE NDP Announcement, 80211ac/ax-2013/2021 */
+#define	IEEE80211_FC0_SUBTYPE_CTL_EXT		0x60	/* Control Frame Extension */
+#define	IEEE80211_FC0_SUBTYPE_CONTROL_WRAP	0x70	/* Control Wrapper */
+#define	IEEE80211_FC0_SUBTYPE_BAR		0x80	/* Block Ack Request (BlockAckReq) */
+#define	IEEE80211_FC0_SUBTYPE_BA		0x90	/* Block Ack (BlockAck) */
+#define	IEEE80211_FC0_SUBTYPE_PS_POLL		0xa0	/* PS-Poll */
+#define	IEEE80211_FC0_SUBTYPE_RTS		0xb0	/* RTS */
+#define	IEEE80211_FC0_SUBTYPE_CTS		0xc0	/* CTS */
+#define	IEEE80211_FC0_SUBTYPE_ACK		0xd0	/* Ack */
+#define	IEEE80211_FC0_SUBTYPE_CF_END		0xe0	/* CF-End */
+#define	IEEE80211_FC0_SUBTYPE_CF_END_ACK	0xf0	/* 1111 Reserved - what was CF_END_ACK? */
+/* For type 10 Data (IEEE80211_FC0_TYPE_DATA) */
+#define	IEEE80211_FC0_SUBTYPE_DATA		0x00	/* Data */
+/* 0001-0011 Reserved				0x10-0x30 */	/* Were: CF_ACK, CF_POLL, CF_ACPL */
+#define	IEEE80211_FC0_SUBTYPE_NODATA		0x40	/* Null */
+/* 0101-0111 Reserved				0x50-0x70 */	/* Were: CFACK, CFPOLL, CF_ACK_CF_ACK */
+#define	IEEE80211_FC0_SUBTYPE_QOS_DATA		0x80	/* QoS Data */
+#define	IEEE80211_FC0_SUBTYPE_QOS_DATA_CFACK	0x90	/* QoS Data +CF-Ack */
+#define	IEEE80211_FC0_SUBTYPE_QOS_DATA_CFPOLL	0xa0	/* QoS Data +CF-Poll */
+#define	IEEE80211_FC0_SUBTYPE_QOS_DATA_CFACKPOLL 0xb0	/* QoS Data +CF-Ack +CF-Poll */
+#define	IEEE80211_FC0_SUBTYPE_QOS_NULL		0xc0	/* QoS Null */
+/* 1101 Reserved				0xd0 */
+#define	IEEE80211_FC0_SUBTYPE_QOS_CFPOLL	0xe0	/* QoS CF-Poll */
+#define	IEEE80211_FC0_SUBTYPE_QOS_CFACKPOLL	0xf0	/* QoS CF-Ack +CF-Poll */
+/* For type 11 Extension (IEEE80211_FC0_TYPE_EXT) */
+#define	IEEE80211_FC0_SUBTYPE_DMG_BEACON	0x00	/* DMG Beacon */
+#define	IEEE80211_FC0_SUBTYPE_S1G_BEACON	0x10	/* S1G Beacon */
+/* 0010-1111 Reserved				0x20-0xff */
+
+/* 802.11-2020 Table 9-2-Control Frame Extension */
+/* Reusing B11..B8, part of FC1 */
+#define	IEEE80211_CTL_EXT_SECTOR_ACK		0x00	/* Sector Ack, 80211ay-2021 */
+#define	IEEE80211_CTL_EXT_BA_SCHED		0x01	/* Block Ack Schedule, 80211ay-2021 */
+#define	IEEE80211_CTL_EXT_POLL			0x02	/* Poll */
+#define	IEEE80211_CTL_EXT_SPR			0x03	/* SPR */
+#define	IEEE80211_CTL_EXT_GRANT			0x04	/* Grant */
+#define	IEEE80211_CTL_EXT_DMG_CTS		0x05	/* DMG CTS */
+#define	IEEE80211_CTL_EXT_DMG_DTS		0x06	/* DMG DTS */
+#define	IEEE80211_CTL_EXT_GRANT_ACK		0x07	/* Grant Ack */
+#define	IEEE80211_CTL_EXT_SSW			0x08	/* SSW */
+#define	IEEE80211_CTL_EXT_SSW_FBACK		0x09	/* SSW-Feedback */
+#define	IEEE80211_CTL_EXT_SSW_ACK		0x0a	/* SSW-Ack */
+#define	IEEE80211_CTL_EXT_TDD_BF		0x0b	/* TDD Beamforming, 80211ay-2021 */
+/* 1100-1111 Reserved				0xc-0xf */
 
 #define	IEEE80211_IS_MGMT(wh)					\
 	(!! (((wh)->i_fc[0] & IEEE80211_FC0_TYPE_MASK)		\
@@ -173,6 +201,9 @@ struct ieee80211_qosframe_addr4 {
 #define	IEEE80211_IS_DATA(wh)					\
 	(!! (((wh)->i_fc[0] & IEEE80211_FC0_TYPE_MASK)		\
 	    == IEEE80211_FC0_TYPE_DATA))
+#define	IEEE80211_IS_EXT(wh)					\
+	(!! (((wh)->i_fc[0] & IEEE80211_FC0_TYPE_MASK)		\
+	    == IEEE80211_FC0_TYPE_EXT))
 
 #define	IEEE80211_FC0_QOSDATA \
 	(IEEE80211_FC0_TYPE_DATA|IEEE80211_FC0_SUBTYPE_QOS_DATA|IEEE80211_FC0_VERSION_0)