xref: /freebsd/sys/net80211/ieee80211_radiotap.h (revision ab95bca9988ab15a2502efd03db43068a0a2b18b)
1 /* $NetBSD: ieee80211_radiotap.h,v 1.16 2007/01/06 05:51:15 dyoung Exp $ */
2 
3 /*-
4  * SPDX-License-Identifier: BSD-3-Clause
5  *
6  * Copyright (c) 2003, 2004 David Young.  All rights reserved.
7  *
8  * Redistribution and use in source and binary forms, with or without
9  * modification, are permitted provided that the following conditions
10  * are met:
11  * 1. Redistributions of source code must retain the above copyright
12  *    notice, this list of conditions and the following disclaimer.
13  * 2. Redistributions in binary form must reproduce the above copyright
14  *    notice, this list of conditions and the following disclaimer in the
15  *    documentation and/or other materials provided with the distribution.
16  * 3. The name of David Young may not be used to endorse or promote
17  *    products derived from this software without specific prior
18  *    written permission.
19  *
20  * THIS SOFTWARE IS PROVIDED BY DAVID YOUNG ``AS IS'' AND ANY
21  * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
22  * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
23  * PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL DAVID
24  * YOUNG BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
25  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
26  * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
28  * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
29  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
31  * OF SUCH DAMAGE.
32  */
33 #ifndef _NET80211_IEEE80211_RADIOTAP_H_
34 #define _NET80211_IEEE80211_RADIOTAP_H_
35 
36 /* A generic radio capture format is desirable. It must be
37  * rigidly defined (e.g., units for fields should be given),
38  * and easily extensible.
39  *
40  * The following is an extensible radio capture format. It is
41  * based on a bitmap indicating which fields are present.
42  *
43  * I am trying to describe precisely what the application programmer
44  * should expect in the following, and for that reason I tell the
45  * units and origin of each measurement (where it applies), or else I
46  * use sufficiently weaselly language ("is a monotonically nondecreasing
47  * function of...") that I cannot set false expectations for lawyerly
48  * readers.
49  */
50 #if defined(__KERNEL__) || defined(_KERNEL)
51 #ifndef DLT_IEEE802_11_RADIO
52 #define	DLT_IEEE802_11_RADIO	127	/* 802.11 plus WLAN header */
53 #endif
54 #endif /* defined(__KERNEL__) || defined(_KERNEL) */
55 
56 #define	IEEE80211_RADIOTAP_HDRLEN	64	/* XXX deprecated */
57 
58 struct ieee80211_radiotap_vendor_header {
59 	uint8_t		vh_oui[3];	/* 3 byte vendor OUI */
60 	uint8_t		vh_sub_ns;	/* Sub namespace of this section */
61 	uint16_t	vh_skip_len;	/* Length of this vendor section */
62 } __packed;
63 
64 /*
65  * The radio capture header precedes the 802.11 header.
66  *
67  * Note well: all radiotap fields are little-endian.
68  */
69 struct ieee80211_radiotap_header {
70 	uint8_t		it_version;	/* Version 0. Only increases
71 					 * for drastic changes,
72 					 * introduction of compatible
73 					 * new fields does not count.
74 					 */
75 	uint8_t		it_pad;
76 	uint16_t	it_len;		/* length of the whole
77 					 * header in bytes, including
78 					 * it_version, it_pad,
79 					 * it_len, and data fields.
80 					 */
81 	uint32_t	it_present;	/* A bitmap telling which
82 					 * fields are present. Set bit 31
83 					 * (0x80000000) to extend the
84 					 * bitmap by another 32 bits.
85 					 * Additional extensions are made
86 					 * by setting bit 31.
87 					 */
88 } __packed;
89 
90 /*
91  * Name                                 Data type       Units
92  * ----                                 ---------       -----
93  *
94  * IEEE80211_RADIOTAP_TSFT              uint64_t        microseconds
95  *
96  *      Value in microseconds of the MAC's 64-bit 802.11 Time
97  *      Synchronization Function timer when the first bit of the
98  *      MPDU arrived at the MAC. For received frames, only.
99  *
100  * IEEE80211_RADIOTAP_CHANNEL           2 x uint16_t    MHz, bitmap
101  *
102  *      Tx/Rx frequency in MHz, followed by flags (see below).
103  *
104  * IEEE80211_RADIOTAP_FHSS              uint16_t        see below
105  *
106  *      For frequency-hopping radios, the hop set (first byte)
107  *      and pattern (second byte).
108  *
109  * IEEE80211_RADIOTAP_RATE              uint8_t         500kb/s or index
110  *
111  *      Tx/Rx data rate.  If bit 0x80 is set then it represents an
112  *	an MCS index and not an IEEE rate.
113  *
114  * IEEE80211_RADIOTAP_DBM_ANTSIGNAL     int8_t          decibels from
115  *                                                      one milliwatt (dBm)
116  *
117  *      RF signal power at the antenna, decibel difference from
118  *      one milliwatt.
119  *
120  * IEEE80211_RADIOTAP_DBM_ANTNOISE      int8_t          decibels from
121  *                                                      one milliwatt (dBm)
122  *
123  *      RF noise power at the antenna, decibel difference from one
124  *      milliwatt.
125  *
126  * IEEE80211_RADIOTAP_DB_ANTSIGNAL      uint8_t         decibel (dB)
127  *
128  *      RF signal power at the antenna, decibel difference from an
129  *      arbitrary, fixed reference.
130  *
131  * IEEE80211_RADIOTAP_DB_ANTNOISE       uint8_t         decibel (dB)
132  *
133  *      RF noise power at the antenna, decibel difference from an
134  *      arbitrary, fixed reference point.
135  *
136  * IEEE80211_RADIOTAP_LOCK_QUALITY      uint16_t        unitless
137  *
138  *      Quality of Barker code lock. Unitless. Monotonically
139  *      nondecreasing with "better" lock strength. Called "Signal
140  *      Quality" in datasheets.  (Is there a standard way to measure
141  *      this?)
142  *
143  * IEEE80211_RADIOTAP_TX_ATTENUATION    uint16_t        unitless
144  *
145  *      Transmit power expressed as unitless distance from max
146  *      power set at factory calibration.  0 is max power.
147  *      Monotonically nondecreasing with lower power levels.
148  *
149  * IEEE80211_RADIOTAP_DB_TX_ATTENUATION uint16_t        decibels (dB)
150  *
151  *      Transmit power expressed as decibel distance from max power
152  *      set at factory calibration.  0 is max power.  Monotonically
153  *      nondecreasing with lower power levels.
154  *
155  * IEEE80211_RADIOTAP_DBM_TX_POWER      int8_t          decibels from
156  *                                                      one milliwatt (dBm)
157  *
158  *      Transmit power expressed as dBm (decibels from a 1 milliwatt
159  *      reference). This is the absolute power level measured at
160  *      the antenna port.
161  *
162  * IEEE80211_RADIOTAP_FLAGS             uint8_t         bitmap
163  *
164  *      Properties of transmitted and received frames. See flags
165  *      defined below.
166  *
167  * IEEE80211_RADIOTAP_ANTENNA           uint8_t         antenna index
168  *
169  *      Unitless indication of the Rx/Tx antenna for this packet.
170  *      The first antenna is antenna 0.
171  *
172  * IEEE80211_RADIOTAP_XCHANNEL          uint32_t        bitmap
173  *                                      uint16_t        MHz
174  *                                      uint8_t         channel number
175  *                                      int8_t          .5 dBm
176  *
177  *      Extended channel specification: flags (see below) followed by
178  *      frequency in MHz, the corresponding IEEE channel number, and
179  *      finally the maximum regulatory transmit power cap in .5 dBm
180  *      units.  This property supersedes IEEE80211_RADIOTAP_CHANNEL
181  *      and only one of the two should be present.
182  * IEEE80211_RADIOTAP_RX_FLAGS          guint16       bitmap
183  *
184  *     Properties of received frames. See flags defined below.
185  *
186  * IEEE80211_RADIOTAP_TX_FLAGS          guint16       bitmap
187  *
188  *     Properties of transmitted frames. See flags defined below.
189  *
190  * IEEE80211_RADIOTAP_RTS_RETRIES       u8           data
191  *
192  *     Number of rts retries a transmitted frame used.
193  *
194  * IEEE80211_RADIOTAP_DATA_RETRIES      u8           data
195  *
196  *     Number of unicast retries a transmitted frame used.
197  *
198  * IEEE80211_RADIOTAP_MCS       u8, u8, u8              unitless
199  *
200  *     Contains a bitmap of known fields/flags, the flags, and
201  *     the MCS index.
202  *
203  * IEEE80211_RADIOTAP_AMPDU_STATUS      u32, u16, u8, u8        unitlesss
204  *
205  *      Contains the AMPDU information for the subframe.
206  */
207 enum ieee80211_radiotap_type {
208 	IEEE80211_RADIOTAP_TSFT = 0,
209 	IEEE80211_RADIOTAP_FLAGS = 1,
210 	IEEE80211_RADIOTAP_RATE = 2,
211 	IEEE80211_RADIOTAP_CHANNEL = 3,
212 	IEEE80211_RADIOTAP_FHSS = 4,
213 	IEEE80211_RADIOTAP_DBM_ANTSIGNAL = 5,
214 	IEEE80211_RADIOTAP_DBM_ANTNOISE = 6,
215 	IEEE80211_RADIOTAP_LOCK_QUALITY = 7,
216 	IEEE80211_RADIOTAP_TX_ATTENUATION = 8,
217 	IEEE80211_RADIOTAP_DB_TX_ATTENUATION = 9,
218 	IEEE80211_RADIOTAP_DBM_TX_POWER = 10,
219 	IEEE80211_RADIOTAP_ANTENNA = 11,
220 	IEEE80211_RADIOTAP_DB_ANTSIGNAL = 12,
221 	IEEE80211_RADIOTAP_DB_ANTNOISE = 13,
222 	/*
223 	 * 14-17 are from Linux, they overlap the netbsd-specific
224 	 * fields.
225 	 */
226 	IEEE80211_RADIOTAP_RX_FLAGS = 14,
227 	IEEE80211_RADIOTAP_TX_FLAGS = 15,
228 	IEEE80211_RADIOTAP_RTS_RETRIES = 16,
229 	IEEE80211_RADIOTAP_DATA_RETRIES = 17,
230 
231 	IEEE80211_RADIOTAP_XCHANNEL = 18,
232 	IEEE80211_RADIOTAP_MCS = 19,
233 	IEEE80211_RADIOTAP_AMPDU_STATUS = 20,
234 	IEEE80211_RADIOTAP_VHT = 21,
235 
236 	IEEE80211_RADIOTAP_TLV = 28,
237         IEEE80211_RADIOTAP_RADIOTAP_NAMESPACE = 29,
238 	IEEE80211_RADIOTAP_VENDOREXT = 30,		/* obsolete? */
239 	IEEE80211_RADIOTAP_VENDOR_NAMESPACE = 30,
240 	IEEE80211_RADIOTAP_EXT = 31,
241 	IEEE80211_RADIOTAP_EHT_USIG = 33,
242 	IEEE80211_RADIOTAP_EHT = 34,
243 };
244 
245 #ifndef _KERNEL
246 /* channel attributes */
247 #define	IEEE80211_CHAN_TURBO	0x00000010 /* Turbo channel */
248 #define	IEEE80211_CHAN_CCK	0x00000020 /* CCK channel */
249 #define	IEEE80211_CHAN_OFDM	0x00000040 /* OFDM channel */
250 #define	IEEE80211_CHAN_2GHZ	0x00000080 /* 2 GHz spectrum channel. */
251 #define	IEEE80211_CHAN_5GHZ	0x00000100 /* 5 GHz spectrum channel */
252 #define	IEEE80211_CHAN_PASSIVE	0x00000200 /* Only passive scan allowed */
253 #define	IEEE80211_CHAN_DYN	0x00000400 /* Dynamic CCK-OFDM channel */
254 #define	IEEE80211_CHAN_GFSK	0x00000800 /* GFSK channel (FHSS PHY) */
255 #define	IEEE80211_CHAN_GSM	0x00001000 /* 900 MHz spectrum channel */
256 #define	IEEE80211_CHAN_STURBO	0x00002000 /* 11a static turbo channel only */
257 #define	IEEE80211_CHAN_HALF	0x00004000 /* Half rate channel */
258 #define	IEEE80211_CHAN_QUARTER	0x00008000 /* Quarter rate channel */
259 #endif /* !_KERNEL */
260 
261 /* For IEEE80211_RADIOTAP_FLAGS */
262 #define	IEEE80211_RADIOTAP_F_CFP	0x01	/* sent/received
263 						 * during CFP
264 						 */
265 #define	IEEE80211_RADIOTAP_F_SHORTPRE	0x02	/* sent/received
266 						 * with short
267 						 * preamble
268 						 */
269 #define	IEEE80211_RADIOTAP_F_WEP	0x04	/* sent/received
270 						 * with WEP encryption
271 						 */
272 #define	IEEE80211_RADIOTAP_F_FRAG	0x08	/* sent/received
273 						 * with fragmentation
274 						 */
275 #define	IEEE80211_RADIOTAP_F_FCS	0x10	/* frame includes FCS */
276 #define	IEEE80211_RADIOTAP_F_DATAPAD	0x20	/* frame has padding between
277 						 * 802.11 header and payload
278 						 * (to 32-bit boundary)
279 						 */
280 #define	IEEE80211_RADIOTAP_F_BADFCS	0x40	/* does not pass FCS check */
281 #define	IEEE80211_RADIOTAP_F_SHORTGI	0x80	/* HT short GI */
282 
283 /* For IEEE80211_RADIOTAP_RX_FLAGS */
284 #define	IEEE80211_RADIOTAP_F_RX_BADPLCP	0x0002	/* bad PLCP */
285 
286 /* For IEEE80211_RADIOTAP_TX_FLAGS */
287 #define	IEEE80211_RADIOTAP_F_TX_FAIL	0x0001	/* failed due to excessive
288 						 * retries */
289 #define	IEEE80211_RADIOTAP_F_TX_CTS	0x0002	/* used cts 'protection' */
290 #define	IEEE80211_RADIOTAP_F_TX_RTS	0x0004	/* used rts/cts handshake */
291 
292 /* For IEEE80211_RADIOTAP_MCS */
293 #define	IEEE80211_RADIOTAP_MCS_HAVE_BW		0x01
294 #define	IEEE80211_RADIOTAP_MCS_HAVE_MCS		0x02
295 #define	IEEE80211_RADIOTAP_MCS_HAVE_GI		0x04
296 #define	IEEE80211_RADIOTAP_MCS_HAVE_FMT		0x08
297 #define	IEEE80211_RADIOTAP_MCS_HAVE_FEC		0x10
298 #define	IEEE80211_RADIOTAP_MCS_HAVE_STBC	0x20
299 #define	IEEE80211_RADIOTAP_MCS_HAVE_NESS	0x40
300 #define	IEEE80211_RADIOTAP_MCS_NESS_BIT1	0x80
301 
302 #define	IEEE80211_RADIOTAP_MCS_BW_MASK		0x03
303 #define	    IEEE80211_RADIOTAP_MCS_BW_20	0
304 #define	    IEEE80211_RADIOTAP_MCS_BW_40	1
305 #define	 IEEE80211_RADIOTAP_MCS_BW_20L		2
306 #define	    IEEE80211_RADIOTAP_MCS_BW_20U	3
307 #define	IEEE80211_RADIOTAP_MCS_SGI		0x04
308 #define	IEEE80211_RADIOTAP_MCS_FMT_GF		0x08
309 #define	IEEE80211_RADIOTAP_MCS_FEC_LDPC		0x10
310 #define	IEEE80211_RADIOTAP_MCS_STBC_MASK	0x60
311 #define	IEEE80211_RADIOTAP_MCS_STBC_SHIFT	5
312 #define	    IEEE80211_RADIOTAP_MCS_STBC_1	1
313 #define	    IEEE80211_RADIOTAP_MCS_STBC_2	2
314 #define	    IEEE80211_RADIOTAP_MCS_STBC_3	3
315 #define	IEEE80211_RADIOTAP_MCS_NESS_BIT0	0x80
316 
317 /* For IEEE80211_RADIOTAP_AMPDU_STATUS */
318 #define	IEEE80211_RADIOTAP_AMPDU_REPORT_ZEROLEN		0x0001
319 #define	IEEE80211_RADIOTAP_AMPDU_IS_ZEROLEN		0x0002
320 #define	IEEE80211_RADIOTAP_AMPDU_LAST_KNOWN		0x0004
321 #define	IEEE80211_RADIOTAP_AMPDU_IS_LAST		0x0008
322 #define	IEEE80211_RADIOTAP_AMPDU_DELIM_CRC_ERR		0x0010
323 #define	IEEE80211_RADIOTAP_AMPDU_DELIM_CRC_KNOWN	0x0020
324 
325 /* For IEEE80211_RADIOTAP_VHT */
326 #define	IEEE80211_RADIOTAP_VHT_HAVE_STBC	0x0001
327 #define	IEEE80211_RADIOTAP_VHT_HAVE_TXOP_PS	0x0002
328 #define	IEEE80211_RADIOTAP_VHT_HAVE_GI		0x0004
329 #define	IEEE80211_RADIOTAP_VHT_HAVE_SGI_NSYM_DA	0x0008
330 #define	IEEE80211_RADIOTAP_VHT_HAVE_LDPC_EXTRA	0x0010
331 #define	IEEE80211_RADIOTAP_VHT_HAVE_BF		0x0020
332 #define	IEEE80211_RADIOTAP_VHT_HAVE_BW		0x0040
333 #define	IEEE80211_RADIOTAP_VHT_HAVE_GID		0x0080
334 #define	IEEE80211_RADIOTAP_VHT_HAVE_PAID	0x0100
335 #define	IEEE80211_RADIOTAP_VHT_STBC		0x01
336 #define	IEEE80211_RADIOTAP_VHT_TXOP_PS		0x02
337 #define	IEEE80211_RADIOTAP_VHT_SGI		0x04
338 #define	IEEE80211_RADIOTAP_VHT_SGI_NSYM_DA	0x08
339 #define	IEEE80211_RADIOTAP_VHT_LDPC_EXTRA	0x10
340 #define	IEEE80211_RADIOTAP_VHT_BF		0x20
341 #define	IEEE80211_RADIOTAP_VHT_NSS		0x0f
342 #define	IEEE80211_RADIOTAP_VHT_MCS		0xf0
343 #define	IEEE80211_RADIOTAP_VHT_CODING_LDPC	0x01
344 
345 #define	IEEE80211_RADIOTAP_VHT_BW_MASK		0x1f
346 #define	IEEE80211_RADIOTAP_VHT_BW_20		IEEE80211_RADIOTAP_MCS_BW_20
347 #define	IEEE80211_RADIOTAP_VHT_BW_40		IEEE80211_RADIOTAP_MCS_BW_40
348 #define	IEEE80211_RADIOTAP_VHT_BW_20L		IEEE80211_RADIOTAP_MCS_BW_20L
349 #define	IEEE80211_RADIOTAP_VHT_BW_20U		IEEE80211_RADIOTAP_MCS_BW_20U
350 #define	IEEE80211_RADIOTAP_VHT_BW_80		4
351 #define	IEEE80211_RADIOTAP_VHT_BW_40L		5
352 #define	IEEE80211_RADIOTAP_VHT_BW_40U		6
353 #define	IEEE80211_RADIOTAP_VHT_BW_20LL		7
354 #define	IEEE80211_RADIOTAP_VHT_BW_20LU		8
355 #define	IEEE80211_RADIOTAP_VHT_BW_20UL		9
356 #define	IEEE80211_RADIOTAP_VHT_BW_20UU		10
357 #define	IEEE80211_RADIOTAP_VHT_BW_160		11
358 #define	IEEE80211_RADIOTAP_VHT_BW_80L		12
359 #define	IEEE80211_RADIOTAP_VHT_BW_80U		13
360 #define	IEEE80211_RADIOTAP_VHT_BW_40LL		14
361 #define	IEEE80211_RADIOTAP_VHT_BW_40LU		15
362 #define	IEEE80211_RADIOTAP_VHT_BW_40UL		16
363 #define	IEEE80211_RADIOTAP_VHT_BW_40UU		17
364 #define	IEEE80211_RADIOTAP_VHT_BW_20LLL		18
365 #define	IEEE80211_RADIOTAP_VHT_BW_20LLU		19
366 #define	IEEE80211_RADIOTAP_VHT_BW_20LUL		20
367 #define	IEEE80211_RADIOTAP_VHT_BW_20LUU		21
368 #define	IEEE80211_RADIOTAP_VHT_BW_20ULL		22
369 #define	IEEE80211_RADIOTAP_VHT_BW_20ULU		23
370 #define	IEEE80211_RADIOTAP_VHT_BW_20UUL		24
371 #define	IEEE80211_RADIOTAP_VHT_BW_20UUU		25
372 
373 /*
374  * These are found in various drivers already so use them rather than
375  * going by our own names and changing everything.
376  */
377 
378 /* https://www.radiotap.org/fields/VHT.html */
379 #define	IEEE80211_RADIOTAP_VHT_KNOWN_STBC			0x0001	/* net80211::IEEE80211_RADIOTAP_VHT_HAVE_STBC */
380 #define	IEEE80211_RADIOTAP_VHT_KNOWN_BEAMFORMED			0x0020	/* net80211::IEEE80211_RADIOTAP_VHT_HAVE_BF */
381 
382 /* https://www.radiotap.org/fields/0-length-PSDU.html */
383 #define	IEEE80211_RADIOTAP_ZERO_LEN_PSDU_SOUNDING		0x00
384 #define	IEEE80211_RADIOTAP_ZERO_LEN_PSDU_NOT_CAPTURED		0x01
385 #define	IEEE80211_RADIOTAP_ZERO_LEN_PSDU_VENDOR			0xFF
386 
387 /* http://www.radiotap.org/fields/TLV.html */
388 struct ieee80211_radiotap_tlv {
389 	uint16_t	type;
390 	uint16_t	len;
391 	uint8_t		data[];
392 } __packed;
393 
394 struct ieee80211_radiotap_vendor_content {
395 	uint8_t		oui[3];
396 	uint8_t		oui_subtype;
397 	uint16_t	vendor_type;
398 	uint16_t	__padding;
399 	uint8_t		data[];
400 } __packed;
401 
402 /* https://www.radiotap.org/fields/HE.html */
403 struct ieee80211_radiotap_he {
404 	uint16_t	data1, data2, data3, data4, data5, data6;
405 } __packed;
406 
407 #define	IEEE80211_RADIOTAP_HE_DATA1_FORMAT_SU			0x0000
408 #define	IEEE80211_RADIOTAP_HE_DATA1_FORMAT_EXT_SU		0x0001
409 #define	IEEE80211_RADIOTAP_HE_DATA1_FORMAT_MU			0x0002
410 #define	IEEE80211_RADIOTAP_HE_DATA1_FORMAT_TRIG			0x0003
411 #define	IEEE80211_RADIOTAP_HE_DATA1_BSS_COLOR_KNOWN		0x0004
412 #define	IEEE80211_RADIOTAP_HE_DATA1_BEAM_CHANGE_KNOWN		0x0008
413 #define	IEEE80211_RADIOTAP_HE_DATA1_UL_DL_KNOWN			0x0010
414 #define	IEEE80211_RADIOTAP_HE_DATA1_DATA_MCS_KNOWN		0x0020
415 #define	IEEE80211_RADIOTAP_HE_DATA1_DATA_DCM_KNOWN		0x0040
416 #define	IEEE80211_RADIOTAP_HE_DATA1_CODING_KNOWN		0x0080
417 #define	IEEE80211_RADIOTAP_HE_DATA1_LDPC_XSYMSEG_KNOWN		0x0100
418 #define	IEEE80211_RADIOTAP_HE_DATA1_STBC_KNOWN			0x0200
419 #define	IEEE80211_RADIOTAP_HE_DATA1_SPTL_REUSE_KNOWN		0x0400
420 #define	IEEE80211_RADIOTAP_HE_DATA1_SPTL_REUSE2_KNOWN		0x0800
421 #define	IEEE80211_RADIOTAP_HE_DATA1_SPTL_REUSE3_KNOWN		0x1000
422 #define	IEEE80211_RADIOTAP_HE_DATA1_SPTL_REUSE4_KNOWN		0x2000
423 #define	IEEE80211_RADIOTAP_HE_DATA1_BW_RU_ALLOC_KNOWN		0x4000
424 #define	IEEE80211_RADIOTAP_HE_DATA1_DOPPLER_KNOWN		0x8000
425 
426 #define	IEEE80211_RADIOTAP_HE_DATA2_PRISEC_80_KNOWN		0x0001
427 #define	IEEE80211_RADIOTAP_HE_DATA2_GI_KNOWN			0x0002
428 #define	IEEE80211_RADIOTAP_HE_DATA2_NUM_LTF_SYMS_KNOWN		0x0004
429 #define	IEEE80211_RADIOTAP_HE_DATA2_PRE_FEC_PAD_KNOWN		0x0008
430 #define	IEEE80211_RADIOTAP_HE_DATA2_TXBF_KNOWN			0x0010
431 #define	IEEE80211_RADIOTAP_HE_DATA2_PE_DISAMBIG_KNOWN		0x0020
432 #define	IEEE80211_RADIOTAP_HE_DATA2_TXOP_KNOWN			0x0040
433 #define	IEEE80211_RADIOTAP_HE_DATA2_MIDAMBLE_KNOWN		0x0080
434 #define	IEEE80211_RADIOTAP_HE_DATA2_RU_OFFSET			0x3F00
435 #define	IEEE80211_RADIOTAP_HE_DATA2_RU_OFFSET_KNOWN		0x4000
436 #define	IEEE80211_RADIOTAP_HE_DATA2_PRISEC_80_SEC		0x8000
437 
438 #define	IEEE80211_RADIOTAP_HE_DATA3_BSS_COLOR			0x003F
439 #define	IEEE80211_RADIOTAP_HE_DATA3_BEAM_CHANGE			0x0040
440 #define	IEEE80211_RADIOTAP_HE_DATA3_UL_DL			0x0080
441 #define	IEEE80211_RADIOTAP_HE_DATA3_DATA_MCS			0x0F00
442 #define	IEEE80211_RADIOTAP_HE_DATA3_DATA_DCM			0x1000
443 #define	IEEE80211_RADIOTAP_HE_DATA3_CODING			0x2000
444 #define	IEEE80211_RADIOTAP_HE_DATA3_LDPC_XSYMSEG		0x4000
445 #define	IEEE80211_RADIOTAP_HE_DATA3_STBC			0x8000
446 
447 #define	IEEE80211_RADIOTAP_HE_DATA4_SU_MU_SPTL_REUSE		0x000F
448 #define	IEEE80211_RADIOTAP_HE_DATA4_MU_STA_ID			0x7FF0
449 #define	IEEE80211_RADIOTAP_HE_DATA4_TB_SPTL_REUSE1		0x000F
450 #define	IEEE80211_RADIOTAP_HE_DATA4_TB_SPTL_REUSE2		0x00F0
451 #define	IEEE80211_RADIOTAP_HE_DATA4_TB_SPTL_REUSE3		0x0F00
452 #define	IEEE80211_RADIOTAP_HE_DATA4_TB_SPTL_REUSE4		0xF000
453 
454 #define	IEEE80211_RADIOTAP_HE_DATA5_DATA_BW_RU_ALLOC		0x000F
455 #define	IEEE80211_RADIOTAP_HE_DATA5_GI				0x0030
456 #define	IEEE80211_RADIOTAP_HE_DATA5_LTF_SIZE			0x00C0
457 #define	IEEE80211_RADIOTAP_HE_DATA5_LTF_SIZE_UNKNOWN		0x0
458 #define	IEEE80211_RADIOTAP_HE_DATA5_LTF_SIZE_1X			0x1
459 #define	IEEE80211_RADIOTAP_HE_DATA5_LTF_SIZE_2X			0x2
460 #define	IEEE80211_RADIOTAP_HE_DATA5_LTF_SIZE_4X			0x3
461 #define	IEEE80211_RADIOTAP_HE_DATA5_NUM_LTF_SYMS		0x0700
462 #define	IEEE80211_RADIOTAP_HE_DATA5_PRE_FEC_PAD			0x3000
463 #define	IEEE80211_RADIOTAP_HE_DATA5_TXBF			0x4000
464 #define	IEEE80211_RADIOTAP_HE_DATA5_PE_DISAMBIG			0x8000
465 
466 #define	IEEE80211_RADIOTAP_HE_DATA6_NSTS			0x000F
467 #define	IEEE80211_RADIOTAP_HE_DATA6_DOPPLER			0x0010
468 /* 0x00e0 	(reserved) ; use these for the following undocumented. */
469 #define	IEEE80211_RADIOTAP_HE_DATA6_TB_PPDU_BW_KNOWN		0x0020
470 #define	IEEE80211_RADIOTAP_HE_DATA6_TB_PPDU_BW			0x00C0
471 #define	IEEE80211_RADIOTAP_HE_DATA6_TB_PPDU_BW_20MHZ		0x0
472 #define	IEEE80211_RADIOTAP_HE_DATA6_TB_PPDU_BW_40MHZ		0x1
473 #define	IEEE80211_RADIOTAP_HE_DATA6_TB_PPDU_BW_80MHZ		0x2
474 #define	IEEE80211_RADIOTAP_HE_DATA6_TB_PPDU_BW_160MHZ		0x3
475 #define	IEEE80211_RADIOTAP_HE_DATA6_TXOP			0x7F00
476 
477 /* https://www.radiotap.org/fields/HE-MU.html */
478 struct ieee80211_radiotap_he_mu {
479 	uint16_t	flags1;
480 	uint16_t	flags2;
481 	uint8_t		ru_ch1[4];
482 	uint8_t		ru_ch2[4];
483 } __packed;
484 
485 #define	IEEE80211_RADIOTAP_HE_MU_FLAGS1_SIG_B_MCS		0x000F
486 #define	IEEE80211_RADIOTAP_HE_MU_FLAGS1_SIG_B_MCS_KNOWN		0x0010
487 #define	IEEE80211_RADIOTAP_HE_MU_FLAGS1_SIG_B_DCM		0x0020
488 #define	IEEE80211_RADIOTAP_HE_MU_FLAGS1_SIG_B_DCM_KNOWN		0x0040
489 #define	IEEE80211_RADIOTAP_HE_MU_FLAGS1_CH2_CTR_26T_RU_KNOWN	0x0080
490 #define	IEEE80211_RADIOTAP_HE_MU_FLAGS1_CH1_RU_KNOWN		0x0100
491 #define	IEEE80211_RADIOTAP_HE_MU_FLAGS1_CH2_RU_KNOWN		0x0200
492 /* reserved 							0x0C00 */
493 #define	IEEE80211_RADIOTAP_HE_MU_FLAGS1_CH1_CTR_26T_RU_KNOWN	0x1000
494 #define	IEEE80211_RADIOTAP_HE_MU_FLAGS1_CH1_CTR_26T_RU		0x2000
495 #define	IEEE80211_RADIOTAP_HE_MU_FLAGS1_SIG_B_COMP_KNOWN	0x4000
496 #define	IEEE80211_RADIOTAP_HE_MU_FLAGS1_SIG_B_SYMS_USERS_KNOWN	0x8000
497 
498 #define	IEEE80211_RADIOTAP_HE_MU_FLAGS2_BW_FROM_SIG_A_BW	0x0003
499 #define	IEEE80211_RADIOTAP_HE_MU_FLAGS2_BW_FROM_SIG_A_BW_20MHZ	0x0000
500 #define	IEEE80211_RADIOTAP_HE_MU_FLAGS2_BW_FROM_SIG_A_BW_40MHZ	0x0001
501 #define	IEEE80211_RADIOTAP_HE_MU_FLAGS2_BW_FROM_SIG_A_BW_80MHZ	0x0002
502 #define	IEEE80211_RADIOTAP_HE_MU_FLAGS2_BW_FROM_SIG_A_BW_160MHZ	0x0003
503 #define	IEEE80211_RADIOTAP_HE_MU_FLAGS2_BW_FROM_SIG_A_BW_KNOWN	0x0004
504 #define	IEEE80211_RADIOTAP_HE_MU_FLAGS2_SIG_B_COMP		0x0008
505 #define	IEEE80211_RADIOTAP_HE_MU_FLAGS2_SIG_B_SYMS_USERS	0x00F0
506 #define	IEEE80211_RADIOTAP_HE_MU_FLAGS2_PUNC_FROM_SIG_A_BW	0x0300
507 #define	IEEE80211_RADIOTAP_HE_MU_FLAGS2_PUNC_FROM_SIG_A_BW_KNOWN 0x0400
508 #define	IEEE80211_RADIOTAP_HE_MU_FLAGS2_CH2_CTR_26T_RU		0x0800
509 
510 /* https://www.radiotap.org/fields/L-SIG.html */
511 struct ieee80211_radiotap_lsig {
512 	uint16_t	data1;
513 	uint16_t	data2;
514 } __packed;
515 #define	IEEE80211_RADIOTAP_LSIG_DATA1_LENGTH_KNOWN		0x0002
516 
517 #define	IEEE80211_RADIOTAP_LSIG_DATA2_LENGTH			0xFFF0
518 
519 /* https://www.radiotap.org/fields/MCS.html */
520 #define	IEEE80211_RADIOTAP_MCS_HAVE_FEC				0x10
521 #define	IEEE80211_RADIOTAP_MCS_HAVE_STBC			0x20
522 
523 /* https://www.radiotap.org/fields/timestamp.html */
524 #define	IEEE80211_RADIOTAP_TIMESTAMP_UNIT_US			0x01
525 #define	IEEE80211_RADIOTAP_TIMESTAMP_SPOS_PLCP_SIG_ACQ		0x10
526 
527 /* http://www.radiotap.org/fields/U-SIG.html */
528 struct ieee80211_radiotap_eht_usig {
529 	uint32_t	common;
530 	uint32_t	value;
531 	uint32_t	mask;
532 } __packed;
533 #define	IEEE80211_RADIOTAP_EHT_USIG_COMMON_PHY_VER_KNOWN	0x00000001
534 #define	IEEE80211_RADIOTAP_EHT_USIG_COMMON_BW_KNOWN		0x00000002
535 #define	IEEE80211_RADIOTAP_EHT_USIG_COMMON_UL_DL_KNOWN		0x00000004
536 #define	IEEE80211_RADIOTAP_EHT_USIG_COMMON_BSS_COLOR_KNOWN	0x00000008
537 #define	IEEE80211_RADIOTAP_EHT_USIG_COMMON_TXOP_KNOWN		0x00000010
538 #define	IEEE80211_RADIOTAP_EHT_USIG_COMMON_BAD_USIG_CRC		0x00000020
539 #define	IEEE80211_RADIOTAP_EHT_USIG_COMMON_VALIDATE_BITS_CHECKED	0x00000040
540 #define	IEEE80211_RADIOTAP_EHT_USIG_COMMON_VALIDATE_BITS_OK	0x00000080
541 #define	IEEE80211_RADIOTAP_EHT_USIG_COMMON_PHY_VER		0x00007000
542 #define	IEEE80211_RADIOTAP_EHT_USIG_COMMON_BW			0x00038000
543 #define	IEEE80211_RADIOTAP_EHT_USIG_COMMON_BW_20MHZ		0x0
544 #define	IEEE80211_RADIOTAP_EHT_USIG_COMMON_BW_40MHZ		0x1
545 #define	IEEE80211_RADIOTAP_EHT_USIG_COMMON_BW_80MHZ		0x2
546 #define	IEEE80211_RADIOTAP_EHT_USIG_COMMON_BW_160MHZ		0x3
547 #define	IEEE80211_RADIOTAP_EHT_USIG_COMMON_BW_320MHZ_1		0x4
548 #define	IEEE80211_RADIOTAP_EHT_USIG_COMMON_UL_DL		0x00040000
549 #define	IEEE80211_RADIOTAP_EHT_USIG_COMMON_BSS_COLOR		0x01f80000
550 #define	IEEE80211_RADIOTAP_EHT_USIG_COMMON_TXOP			0xfe000000
551 
552 #define	IEEE80211_RADIOTAP_EHT_USIG1_MU_B20_B24_DISREGARD	0x0000001f
553 #define	IEEE80211_RADIOTAP_EHT_USIG1_MU_B25_VALIDATE		0x00000020
554 #define	IEEE80211_RADIOTAP_EHT_USIG2_MU_B0_B1_PPDU_TYPE		0x000000c0
555 #define	IEEE80211_RADIOTAP_EHT_USIG2_MU_B2_VALIDATE		0x00000100
556 #define	IEEE80211_RADIOTAP_EHT_USIG2_MU_B3_B7_PUNCTURED_INFO	0x00003e00
557 #define	IEEE80211_RADIOTAP_EHT_USIG2_MU_B8_VALIDATE		0x00004000
558 #define	IEEE80211_RADIOTAP_EHT_USIG2_MU_B9_B10_SIG_MCS		0x00018000
559 #define	IEEE80211_RADIOTAP_EHT_USIG2_MU_B11_B15_EHT_SIG_SYMBOLS	0x003e0000
560 #define	IEEE80211_RADIOTAP_EHT_USIG2_MU_B16_B19_CRC		0x03c00000
561 #define	IEEE80211_RADIOTAP_EHT_USIG2_MU_B20_B25_TAIL		0xfc000000
562 
563 #define	IEEE80211_RADIOTAP_EHT_USIG1_TB_B20_B25_DISREGARD	0x0000003f
564 #define	IEEE80211_RADIOTAP_EHT_USIG2_TB_B0_B1_PPDU_TYPE		0x000000c0
565 #define	IEEE80211_RADIOTAP_EHT_USIG2_TB_B2_VALIDATE		0x00000100
566 #define	IEEE80211_RADIOTAP_EHT_USIG2_TB_B3_B6_SPATIAL_REUSE_1	0x00001e00
567 #define	IEEE80211_RADIOTAP_EHT_USIG2_TB_B7_B10_SPATIAL_REUSE_2	0x0001e000
568 #define	IEEE80211_RADIOTAP_EHT_USIG2_TB_B11_B15_DISREGARD	0x003e0000
569 #define	IEEE80211_RADIOTAP_EHT_USIG2_TB_B16_B19_CRC		0x03c00000
570 #define	IEEE80211_RADIOTAP_EHT_USIG2_TB_B20_B25_TAIL		0xfc000000
571 
572 /* http://www.radiotap.org/fields/EHT.html */
573 struct ieee80211_radiotap_eht {
574 	uint32_t	known;
575 	uint32_t	data[9];
576 	uint32_t	user_info[];
577 } __packed;
578 #define	IEEE80211_RADIOTAP_EHT_KNOWN_SPATIAL_REUSE		0x00000002
579 #define	IEEE80211_RADIOTAP_EHT_KNOWN_GI				0x00000004
580 #define	IEEE80211_RADIOTAP_EHT_KNOWN_EHT_LTF			0x00000010
581 #define	IEEE80211_RADIOTAP_EHT_KNOWN_LDPC_EXTRA_SYM_OM		0x00000020
582 #define	IEEE80211_RADIOTAP_EHT_KNOWN_PRE_PADD_FACOR_OM		0x00000040
583 #define	IEEE80211_RADIOTAP_EHT_KNOWN_PE_DISAMBIGUITY_OM		0x00000080
584 #define	IEEE80211_RADIOTAP_EHT_KNOWN_NSS_S			0x00020000
585 #define	IEEE80211_RADIOTAP_EHT_KNOWN_BEAMFORMED_S		0x00040000
586 #define	IEEE80211_RADIOTAP_EHT_KNOWN_NR_NON_OFDMA_USERS_M	0x00080000
587 #define	IEEE80211_RADIOTAP_EHT_KNOWN_RU_ALLOC_TB_FMT		0x01000000
588 #define	IEEE80211_RADIOTAP_EHT_KNOWN_PRIMARY_80			0x02000000
589 
590 #define	IEEE80211_RADIOTAP_EHT_DATA0_SPATIAL_REUSE		0x00000078
591 #define	IEEE80211_RADIOTAP_EHT_DATA0_GI				0x00000180
592 #define	IEEE80211_RADIOTAP_EHT_DATA0_LTF			0x00000600
593 #define	IEEE80211_RADIOTAP_EHT_DATA0_EHT_LTF			0x00003800
594 #define	IEEE80211_RADIOTAP_EHT_DATA0_LDPC_EXTRA_SYM_OM		0x00004000
595 #define	IEEE80211_RADIOTAP_EHT_DATA0_PRE_PADD_FACOR_OM		0x00018000
596 #define	IEEE80211_RADIOTAP_EHT_DATA0_PE_DISAMBIGUITY_OM		0x00020000
597 
598 #define	IEEE80211_RADIOTAP_EHT_DATA1_RU_ALLOC_CC_1_1_1		0x003fe000
599 #define	IEEE80211_RADIOTAP_EHT_DATA1_RU_ALLOC_CC_1_1_1_KNOWN	0x00400000
600 #define	IEEE80211_RADIOTAP_EHT_DATA1_PRIMARY_80			0xc0000000
601 
602 #define	IEEE80211_RADIOTAP_EHT_DATA2_RU_ALLOC_CC_2_1_1		0x000001ff
603 #define	IEEE80211_RADIOTAP_EHT_DATA2_RU_ALLOC_CC_2_1_1_KNOWN	0x00000200
604 #define	IEEE80211_RADIOTAP_EHT_DATA2_RU_ALLOC_CC_1_1_2		0x0007fc00
605 #define	IEEE80211_RADIOTAP_EHT_DATA2_RU_ALLOC_CC_1_1_2_KNOWN	0x00080000
606 #define	IEEE80211_RADIOTAP_EHT_DATA2_RU_ALLOC_CC_2_1_2		0x1ff00000
607 #define	IEEE80211_RADIOTAP_EHT_DATA2_RU_ALLOC_CC_2_1_2_KNOWN	0x20000000
608 
609 #define	IEEE80211_RADIOTAP_EHT_DATA3_RU_ALLOC_CC_1_2_1		0x000001ff
610 #define	IEEE80211_RADIOTAP_EHT_DATA3_RU_ALLOC_CC_1_2_1_KNOWN	0x00000200
611 #define	IEEE80211_RADIOTAP_EHT_DATA3_RU_ALLOC_CC_2_2_1		0x0007fc00
612 #define	IEEE80211_RADIOTAP_EHT_DATA3_RU_ALLOC_CC_2_2_1_KNOWN	0x00080000
613 #define	IEEE80211_RADIOTAP_EHT_DATA3_RU_ALLOC_CC_1_2_2		0x1ff00000
614 #define	IEEE80211_RADIOTAP_EHT_DATA3_RU_ALLOC_CC_1_2_2_KNOWN	0x20000000
615 
616 #define	IEEE80211_RADIOTAP_EHT_DATA4_RU_ALLOC_CC_2_2_2		0x000001ff
617 #define	IEEE80211_RADIOTAP_EHT_DATA4_RU_ALLOC_CC_2_2_2_KNOWN	0x00000200
618 
619 #define	IEEE80211_RADIOTAP_EHT_DATA7_NSS_S			0x0000f000
620 #define	IEEE80211_RADIOTAP_EHT_DATA7_BEAMFORMED_S		0x00010000
621 #define	IEEE80211_RADIOTAP_EHT_DATA7_NUM_OF_NON_OFDMA_USERS	0x000e0000
622 
623 #define	IEEE80211_RADIOTAP_EHT_DATA8_RU_ALLOC_TB_FMT_PS_160	0x00000001
624 #define	IEEE80211_RADIOTAP_EHT_DATA8_RU_ALLOC_TB_FMT_B0		0x00000002
625 #define	IEEE80211_RADIOTAP_EHT_DATA8_RU_ALLOC_TB_FMT_B7_B1	0x000001fc
626 
627 #define	IEEE80211_RADIOTAP_EHT_USER_INFO_STA_ID_KNOWN		0x00000001
628 #define	IEEE80211_RADIOTAP_EHT_USER_INFO_MCS_KNOWN		0x00000002
629 #define	IEEE80211_RADIOTAP_EHT_USER_INFO_CODING_KNOWN		0x00000004
630 #define	IEEE80211_RADIOTAP_EHT_USER_INFO_NSS_KNOWN_O		0x00000010
631 #define	IEEE80211_RADIOTAP_EHT_USER_INFO_BEAMFORMING_KNOWN_O	0x00000020
632 #define	IEEE80211_RADIOTAP_EHT_USER_INFO_DATA_FOR_USER		0x00000080
633 #define	IEEE80211_RADIOTAP_EHT_USER_INFO_STA_ID			0x0007ff00
634 #define	IEEE80211_RADIOTAP_EHT_USER_INFO_CODING			0x00080000
635 #define	IEEE80211_RADIOTAP_EHT_USER_INFO_MCS			0x00f00000
636 #define	IEEE80211_RADIOTAP_EHT_USER_INFO_NSS_O			0x0f000000
637 #define	IEEE80211_RADIOTAP_EHT_USER_INFO_BEAMFORMING_O		0x20000000
638 
639 #endif /* !_NET80211_IEEE80211_RADIOTAP_H_ */
640