staging: rtl8188eu: rename HalSetBrateCfg() - style
[linux/fpc-iii.git] / include / net / ieee80211_radiotap.h
blobfeef706e1158256569b08aa0fb1b24534ceebaac
1 /*
2 * Copyright (c) 2017 Intel Deutschland GmbH
3 * Copyright (c) 2018 Intel Corporation
5 * Permission to use, copy, modify, and/or distribute this software for any
6 * purpose with or without fee is hereby granted, provided that the above
7 * copyright notice and this permission notice appear in all copies.
9 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17 #ifndef __RADIOTAP_H
18 #define __RADIOTAP_H
20 #include <linux/kernel.h>
21 #include <asm/unaligned.h>
23 /**
24 * struct ieee82011_radiotap_header - base radiotap header
26 struct ieee80211_radiotap_header {
27 /**
28 * @it_version: radiotap version, always 0
30 uint8_t it_version;
32 /**
33 * @it_pad: padding (or alignment)
35 uint8_t it_pad;
37 /**
38 * @it_len: overall radiotap header length
40 __le16 it_len;
42 /**
43 * @it_present: (first) present word
45 __le32 it_present;
46 } __packed;
48 /* version is always 0 */
49 #define PKTHDR_RADIOTAP_VERSION 0
51 /* see the radiotap website for the descriptions */
52 enum ieee80211_radiotap_presence {
53 IEEE80211_RADIOTAP_TSFT = 0,
54 IEEE80211_RADIOTAP_FLAGS = 1,
55 IEEE80211_RADIOTAP_RATE = 2,
56 IEEE80211_RADIOTAP_CHANNEL = 3,
57 IEEE80211_RADIOTAP_FHSS = 4,
58 IEEE80211_RADIOTAP_DBM_ANTSIGNAL = 5,
59 IEEE80211_RADIOTAP_DBM_ANTNOISE = 6,
60 IEEE80211_RADIOTAP_LOCK_QUALITY = 7,
61 IEEE80211_RADIOTAP_TX_ATTENUATION = 8,
62 IEEE80211_RADIOTAP_DB_TX_ATTENUATION = 9,
63 IEEE80211_RADIOTAP_DBM_TX_POWER = 10,
64 IEEE80211_RADIOTAP_ANTENNA = 11,
65 IEEE80211_RADIOTAP_DB_ANTSIGNAL = 12,
66 IEEE80211_RADIOTAP_DB_ANTNOISE = 13,
67 IEEE80211_RADIOTAP_RX_FLAGS = 14,
68 IEEE80211_RADIOTAP_TX_FLAGS = 15,
69 IEEE80211_RADIOTAP_RTS_RETRIES = 16,
70 IEEE80211_RADIOTAP_DATA_RETRIES = 17,
71 /* 18 is XChannel, but it's not defined yet */
72 IEEE80211_RADIOTAP_MCS = 19,
73 IEEE80211_RADIOTAP_AMPDU_STATUS = 20,
74 IEEE80211_RADIOTAP_VHT = 21,
75 IEEE80211_RADIOTAP_TIMESTAMP = 22,
76 IEEE80211_RADIOTAP_HE = 23,
77 IEEE80211_RADIOTAP_HE_MU = 24,
79 /* valid in every it_present bitmap, even vendor namespaces */
80 IEEE80211_RADIOTAP_RADIOTAP_NAMESPACE = 29,
81 IEEE80211_RADIOTAP_VENDOR_NAMESPACE = 30,
82 IEEE80211_RADIOTAP_EXT = 31
85 /* for IEEE80211_RADIOTAP_FLAGS */
86 enum ieee80211_radiotap_flags {
87 IEEE80211_RADIOTAP_F_CFP = 0x01,
88 IEEE80211_RADIOTAP_F_SHORTPRE = 0x02,
89 IEEE80211_RADIOTAP_F_WEP = 0x04,
90 IEEE80211_RADIOTAP_F_FRAG = 0x08,
91 IEEE80211_RADIOTAP_F_FCS = 0x10,
92 IEEE80211_RADIOTAP_F_DATAPAD = 0x20,
93 IEEE80211_RADIOTAP_F_BADFCS = 0x40,
96 /* for IEEE80211_RADIOTAP_CHANNEL */
97 enum ieee80211_radiotap_channel_flags {
98 IEEE80211_CHAN_CCK = 0x0020,
99 IEEE80211_CHAN_OFDM = 0x0040,
100 IEEE80211_CHAN_2GHZ = 0x0080,
101 IEEE80211_CHAN_5GHZ = 0x0100,
102 IEEE80211_CHAN_DYN = 0x0400,
103 IEEE80211_CHAN_HALF = 0x4000,
104 IEEE80211_CHAN_QUARTER = 0x8000,
107 /* for IEEE80211_RADIOTAP_RX_FLAGS */
108 enum ieee80211_radiotap_rx_flags {
109 IEEE80211_RADIOTAP_F_RX_BADPLCP = 0x0002,
112 /* for IEEE80211_RADIOTAP_TX_FLAGS */
113 enum ieee80211_radiotap_tx_flags {
114 IEEE80211_RADIOTAP_F_TX_FAIL = 0x0001,
115 IEEE80211_RADIOTAP_F_TX_CTS = 0x0002,
116 IEEE80211_RADIOTAP_F_TX_RTS = 0x0004,
117 IEEE80211_RADIOTAP_F_TX_NOACK = 0x0008,
120 /* for IEEE80211_RADIOTAP_MCS "have" flags */
121 enum ieee80211_radiotap_mcs_have {
122 IEEE80211_RADIOTAP_MCS_HAVE_BW = 0x01,
123 IEEE80211_RADIOTAP_MCS_HAVE_MCS = 0x02,
124 IEEE80211_RADIOTAP_MCS_HAVE_GI = 0x04,
125 IEEE80211_RADIOTAP_MCS_HAVE_FMT = 0x08,
126 IEEE80211_RADIOTAP_MCS_HAVE_FEC = 0x10,
127 IEEE80211_RADIOTAP_MCS_HAVE_STBC = 0x20,
130 enum ieee80211_radiotap_mcs_flags {
131 IEEE80211_RADIOTAP_MCS_BW_MASK = 0x03,
132 IEEE80211_RADIOTAP_MCS_BW_20 = 0,
133 IEEE80211_RADIOTAP_MCS_BW_40 = 1,
134 IEEE80211_RADIOTAP_MCS_BW_20L = 2,
135 IEEE80211_RADIOTAP_MCS_BW_20U = 3,
137 IEEE80211_RADIOTAP_MCS_SGI = 0x04,
138 IEEE80211_RADIOTAP_MCS_FMT_GF = 0x08,
139 IEEE80211_RADIOTAP_MCS_FEC_LDPC = 0x10,
140 IEEE80211_RADIOTAP_MCS_STBC_MASK = 0x60,
141 IEEE80211_RADIOTAP_MCS_STBC_1 = 1,
142 IEEE80211_RADIOTAP_MCS_STBC_2 = 2,
143 IEEE80211_RADIOTAP_MCS_STBC_3 = 3,
144 IEEE80211_RADIOTAP_MCS_STBC_SHIFT = 5,
147 /* for IEEE80211_RADIOTAP_AMPDU_STATUS */
148 enum ieee80211_radiotap_ampdu_flags {
149 IEEE80211_RADIOTAP_AMPDU_REPORT_ZEROLEN = 0x0001,
150 IEEE80211_RADIOTAP_AMPDU_IS_ZEROLEN = 0x0002,
151 IEEE80211_RADIOTAP_AMPDU_LAST_KNOWN = 0x0004,
152 IEEE80211_RADIOTAP_AMPDU_IS_LAST = 0x0008,
153 IEEE80211_RADIOTAP_AMPDU_DELIM_CRC_ERR = 0x0010,
154 IEEE80211_RADIOTAP_AMPDU_DELIM_CRC_KNOWN = 0x0020,
155 IEEE80211_RADIOTAP_AMPDU_EOF = 0x0040,
156 IEEE80211_RADIOTAP_AMPDU_EOF_KNOWN = 0x0080,
159 /* for IEEE80211_RADIOTAP_VHT */
160 enum ieee80211_radiotap_vht_known {
161 IEEE80211_RADIOTAP_VHT_KNOWN_STBC = 0x0001,
162 IEEE80211_RADIOTAP_VHT_KNOWN_TXOP_PS_NA = 0x0002,
163 IEEE80211_RADIOTAP_VHT_KNOWN_GI = 0x0004,
164 IEEE80211_RADIOTAP_VHT_KNOWN_SGI_NSYM_DIS = 0x0008,
165 IEEE80211_RADIOTAP_VHT_KNOWN_LDPC_EXTRA_OFDM_SYM = 0x0010,
166 IEEE80211_RADIOTAP_VHT_KNOWN_BEAMFORMED = 0x0020,
167 IEEE80211_RADIOTAP_VHT_KNOWN_BANDWIDTH = 0x0040,
168 IEEE80211_RADIOTAP_VHT_KNOWN_GROUP_ID = 0x0080,
169 IEEE80211_RADIOTAP_VHT_KNOWN_PARTIAL_AID = 0x0100,
172 enum ieee80211_radiotap_vht_flags {
173 IEEE80211_RADIOTAP_VHT_FLAG_STBC = 0x01,
174 IEEE80211_RADIOTAP_VHT_FLAG_TXOP_PS_NA = 0x02,
175 IEEE80211_RADIOTAP_VHT_FLAG_SGI = 0x04,
176 IEEE80211_RADIOTAP_VHT_FLAG_SGI_NSYM_M10_9 = 0x08,
177 IEEE80211_RADIOTAP_VHT_FLAG_LDPC_EXTRA_OFDM_SYM = 0x10,
178 IEEE80211_RADIOTAP_VHT_FLAG_BEAMFORMED = 0x20,
181 enum ieee80211_radiotap_vht_coding {
182 IEEE80211_RADIOTAP_CODING_LDPC_USER0 = 0x01,
183 IEEE80211_RADIOTAP_CODING_LDPC_USER1 = 0x02,
184 IEEE80211_RADIOTAP_CODING_LDPC_USER2 = 0x04,
185 IEEE80211_RADIOTAP_CODING_LDPC_USER3 = 0x08,
188 /* for IEEE80211_RADIOTAP_TIMESTAMP */
189 enum ieee80211_radiotap_timestamp_unit_spos {
190 IEEE80211_RADIOTAP_TIMESTAMP_UNIT_MASK = 0x000F,
191 IEEE80211_RADIOTAP_TIMESTAMP_UNIT_MS = 0x0000,
192 IEEE80211_RADIOTAP_TIMESTAMP_UNIT_US = 0x0001,
193 IEEE80211_RADIOTAP_TIMESTAMP_UNIT_NS = 0x0003,
194 IEEE80211_RADIOTAP_TIMESTAMP_SPOS_MASK = 0x00F0,
195 IEEE80211_RADIOTAP_TIMESTAMP_SPOS_BEGIN_MDPU = 0x0000,
196 IEEE80211_RADIOTAP_TIMESTAMP_SPOS_PLCP_SIG_ACQ = 0x0010,
197 IEEE80211_RADIOTAP_TIMESTAMP_SPOS_EO_PPDU = 0x0020,
198 IEEE80211_RADIOTAP_TIMESTAMP_SPOS_EO_MPDU = 0x0030,
199 IEEE80211_RADIOTAP_TIMESTAMP_SPOS_UNKNOWN = 0x00F0,
202 enum ieee80211_radiotap_timestamp_flags {
203 IEEE80211_RADIOTAP_TIMESTAMP_FLAG_64BIT = 0x00,
204 IEEE80211_RADIOTAP_TIMESTAMP_FLAG_32BIT = 0x01,
205 IEEE80211_RADIOTAP_TIMESTAMP_FLAG_ACCURACY = 0x02,
208 struct ieee80211_radiotap_he {
209 __le16 data1, data2, data3, data4, data5, data6;
212 enum ieee80211_radiotap_he_bits {
213 IEEE80211_RADIOTAP_HE_DATA1_FORMAT_MASK = 3,
214 IEEE80211_RADIOTAP_HE_DATA1_FORMAT_SU = 0,
215 IEEE80211_RADIOTAP_HE_DATA1_FORMAT_EXT_SU = 1,
216 IEEE80211_RADIOTAP_HE_DATA1_FORMAT_MU = 2,
217 IEEE80211_RADIOTAP_HE_DATA1_FORMAT_TRIG = 3,
219 IEEE80211_RADIOTAP_HE_DATA1_BSS_COLOR_KNOWN = 0x0004,
220 IEEE80211_RADIOTAP_HE_DATA1_BEAM_CHANGE_KNOWN = 0x0008,
221 IEEE80211_RADIOTAP_HE_DATA1_UL_DL_KNOWN = 0x0010,
222 IEEE80211_RADIOTAP_HE_DATA1_DATA_MCS_KNOWN = 0x0020,
223 IEEE80211_RADIOTAP_HE_DATA1_DATA_DCM_KNOWN = 0x0040,
224 IEEE80211_RADIOTAP_HE_DATA1_CODING_KNOWN = 0x0080,
225 IEEE80211_RADIOTAP_HE_DATA1_LDPC_XSYMSEG_KNOWN = 0x0100,
226 IEEE80211_RADIOTAP_HE_DATA1_STBC_KNOWN = 0x0200,
227 IEEE80211_RADIOTAP_HE_DATA1_SPTL_REUSE_KNOWN = 0x0400,
228 IEEE80211_RADIOTAP_HE_DATA1_SPTL_REUSE2_KNOWN = 0x0800,
229 IEEE80211_RADIOTAP_HE_DATA1_SPTL_REUSE3_KNOWN = 0x1000,
230 IEEE80211_RADIOTAP_HE_DATA1_SPTL_REUSE4_KNOWN = 0x2000,
231 IEEE80211_RADIOTAP_HE_DATA1_BW_RU_ALLOC_KNOWN = 0x4000,
232 IEEE80211_RADIOTAP_HE_DATA1_DOPPLER_KNOWN = 0x8000,
234 IEEE80211_RADIOTAP_HE_DATA2_PRISEC_80_KNOWN = 0x0001,
235 IEEE80211_RADIOTAP_HE_DATA2_GI_KNOWN = 0x0002,
236 IEEE80211_RADIOTAP_HE_DATA2_NUM_LTF_SYMS_KNOWN = 0x0004,
237 IEEE80211_RADIOTAP_HE_DATA2_PRE_FEC_PAD_KNOWN = 0x0008,
238 IEEE80211_RADIOTAP_HE_DATA2_TXBF_KNOWN = 0x0010,
239 IEEE80211_RADIOTAP_HE_DATA2_PE_DISAMBIG_KNOWN = 0x0020,
240 IEEE80211_RADIOTAP_HE_DATA2_TXOP_KNOWN = 0x0040,
241 IEEE80211_RADIOTAP_HE_DATA2_MIDAMBLE_KNOWN = 0x0080,
242 IEEE80211_RADIOTAP_HE_DATA2_RU_OFFSET = 0x3f00,
243 IEEE80211_RADIOTAP_HE_DATA2_RU_OFFSET_KNOWN = 0x4000,
244 IEEE80211_RADIOTAP_HE_DATA2_PRISEC_80_SEC = 0x8000,
246 IEEE80211_RADIOTAP_HE_DATA3_BSS_COLOR = 0x003f,
247 IEEE80211_RADIOTAP_HE_DATA3_BEAM_CHANGE = 0x0040,
248 IEEE80211_RADIOTAP_HE_DATA3_UL_DL = 0x0080,
249 IEEE80211_RADIOTAP_HE_DATA3_DATA_MCS = 0x0f00,
250 IEEE80211_RADIOTAP_HE_DATA3_DATA_DCM = 0x1000,
251 IEEE80211_RADIOTAP_HE_DATA3_CODING = 0x2000,
252 IEEE80211_RADIOTAP_HE_DATA3_LDPC_XSYMSEG = 0x4000,
253 IEEE80211_RADIOTAP_HE_DATA3_STBC = 0x8000,
255 IEEE80211_RADIOTAP_HE_DATA4_SU_MU_SPTL_REUSE = 0x000f,
256 IEEE80211_RADIOTAP_HE_DATA4_MU_STA_ID = 0x7ff0,
257 IEEE80211_RADIOTAP_HE_DATA4_TB_SPTL_REUSE1 = 0x000f,
258 IEEE80211_RADIOTAP_HE_DATA4_TB_SPTL_REUSE2 = 0x00f0,
259 IEEE80211_RADIOTAP_HE_DATA4_TB_SPTL_REUSE3 = 0x0f00,
260 IEEE80211_RADIOTAP_HE_DATA4_TB_SPTL_REUSE4 = 0xf000,
262 IEEE80211_RADIOTAP_HE_DATA5_DATA_BW_RU_ALLOC = 0x000f,
263 IEEE80211_RADIOTAP_HE_DATA5_DATA_BW_RU_ALLOC_20MHZ = 0,
264 IEEE80211_RADIOTAP_HE_DATA5_DATA_BW_RU_ALLOC_40MHZ = 1,
265 IEEE80211_RADIOTAP_HE_DATA5_DATA_BW_RU_ALLOC_80MHZ = 2,
266 IEEE80211_RADIOTAP_HE_DATA5_DATA_BW_RU_ALLOC_160MHZ = 3,
267 IEEE80211_RADIOTAP_HE_DATA5_DATA_BW_RU_ALLOC_26T = 4,
268 IEEE80211_RADIOTAP_HE_DATA5_DATA_BW_RU_ALLOC_52T = 5,
269 IEEE80211_RADIOTAP_HE_DATA5_DATA_BW_RU_ALLOC_106T = 6,
270 IEEE80211_RADIOTAP_HE_DATA5_DATA_BW_RU_ALLOC_242T = 7,
271 IEEE80211_RADIOTAP_HE_DATA5_DATA_BW_RU_ALLOC_484T = 8,
272 IEEE80211_RADIOTAP_HE_DATA5_DATA_BW_RU_ALLOC_996T = 9,
273 IEEE80211_RADIOTAP_HE_DATA5_DATA_BW_RU_ALLOC_2x996T = 10,
275 IEEE80211_RADIOTAP_HE_DATA5_GI = 0x0030,
276 IEEE80211_RADIOTAP_HE_DATA5_GI_0_8 = 0,
277 IEEE80211_RADIOTAP_HE_DATA5_GI_1_6 = 1,
278 IEEE80211_RADIOTAP_HE_DATA5_GI_3_2 = 2,
280 IEEE80211_RADIOTAP_HE_DATA5_LTF_SIZE = 0x00c0,
281 IEEE80211_RADIOTAP_HE_DATA5_LTF_SIZE_UNKNOWN = 0,
282 IEEE80211_RADIOTAP_HE_DATA5_LTF_SIZE_1X = 1,
283 IEEE80211_RADIOTAP_HE_DATA5_LTF_SIZE_2X = 2,
284 IEEE80211_RADIOTAP_HE_DATA5_LTF_SIZE_4X = 3,
285 IEEE80211_RADIOTAP_HE_DATA5_NUM_LTF_SYMS = 0x0700,
286 IEEE80211_RADIOTAP_HE_DATA5_PRE_FEC_PAD = 0x3000,
287 IEEE80211_RADIOTAP_HE_DATA5_TXBF = 0x4000,
288 IEEE80211_RADIOTAP_HE_DATA5_PE_DISAMBIG = 0x8000,
290 IEEE80211_RADIOTAP_HE_DATA6_NSTS = 0x000f,
291 IEEE80211_RADIOTAP_HE_DATA6_DOPPLER = 0x0010,
292 IEEE80211_RADIOTAP_HE_DATA6_TXOP = 0x7f00,
293 IEEE80211_RADIOTAP_HE_DATA6_MIDAMBLE_PDCTY = 0x8000,
296 struct ieee80211_radiotap_he_mu {
297 __le16 flags1, flags2;
298 u8 ru_ch1[4];
299 u8 ru_ch2[4];
302 enum ieee80211_radiotap_he_mu_bits {
303 IEEE80211_RADIOTAP_HE_MU_FLAGS1_SIG_B_MCS = 0x000f,
304 IEEE80211_RADIOTAP_HE_MU_FLAGS1_SIG_B_MCS_KNOWN = 0x0010,
305 IEEE80211_RADIOTAP_HE_MU_FLAGS1_SIG_B_DCM = 0x0020,
306 IEEE80211_RADIOTAP_HE_MU_FLAGS1_SIG_B_DCM_KNOWN = 0x0040,
307 IEEE80211_RADIOTAP_HE_MU_FLAGS1_CH2_CTR_26T_RU_KNOWN = 0x0080,
308 IEEE80211_RADIOTAP_HE_MU_FLAGS1_CH1_RU_KNOWN = 0x0100,
309 IEEE80211_RADIOTAP_HE_MU_FLAGS1_CH2_RU_KNOWN = 0x0200,
310 IEEE80211_RADIOTAP_HE_MU_FLAGS1_CH1_CTR_26T_RU_KNOWN = 0x1000,
311 IEEE80211_RADIOTAP_HE_MU_FLAGS1_CH1_CTR_26T_RU = 0x2000,
312 IEEE80211_RADIOTAP_HE_MU_FLAGS1_SIG_B_COMP_KNOWN = 0x4000,
313 IEEE80211_RADIOTAP_HE_MU_FLAGS1_SIG_B_SYMS_USERS_KNOWN = 0x8000,
315 IEEE80211_RADIOTAP_HE_MU_FLAGS2_BW_FROM_SIG_A_BW = 0x0003,
316 IEEE80211_RADIOTAP_HE_MU_FLAGS2_BW_FROM_SIG_A_BW_20MHZ = 0x0000,
317 IEEE80211_RADIOTAP_HE_MU_FLAGS2_BW_FROM_SIG_A_BW_40MHZ = 0x0001,
318 IEEE80211_RADIOTAP_HE_MU_FLAGS2_BW_FROM_SIG_A_BW_80MHZ = 0x0002,
319 IEEE80211_RADIOTAP_HE_MU_FLAGS2_BW_FROM_SIG_A_BW_160MHZ = 0x0003,
320 IEEE80211_RADIOTAP_HE_MU_FLAGS2_BW_FROM_SIG_A_BW_KNOWN = 0x0004,
321 IEEE80211_RADIOTAP_HE_MU_FLAGS2_SIG_B_COMP = 0x0008,
322 IEEE80211_RADIOTAP_HE_MU_FLAGS2_SIG_B_SYMS_USERS = 0x00f0,
323 IEEE80211_RADIOTAP_HE_MU_FLAGS2_PUNC_FROM_SIG_A_BW = 0x0300,
324 IEEE80211_RADIOTAP_HE_MU_FLAGS2_PUNC_FROM_SIG_A_BW_KNOWN= 0x0400,
325 IEEE80211_RADIOTAP_HE_MU_FLAGS2_CH2_CTR_26T_RU = 0x0800,
329 * ieee80211_get_radiotap_len - get radiotap header length
331 static inline u16 ieee80211_get_radiotap_len(const char *data)
333 struct ieee80211_radiotap_header *hdr = (void *)data;
335 return get_unaligned_le16(&hdr->it_len);
338 #endif /* __RADIOTAP_H */