xref: /freebsd/contrib/wpa/src/common/ieee802_11_defs.h (revision 39beb93c3f8bdbf72a61fda42300b5ebed7390c8)
1 /*
2  * IEEE 802.11 Frame type definitions
3  * Copyright (c) 2002-2007, Jouni Malinen <j@w1.fi>
4  * Copyright (c) 2007-2008 Intel Corporation
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License version 2 as
8  * published by the Free Software Foundation.
9  *
10  * Alternatively, this software may be distributed under the terms of BSD
11  * license.
12  *
13  * See README and COPYING for more details.
14  */
15 
16 #ifndef IEEE802_11_DEFS_H
17 #define IEEE802_11_DEFS_H
18 
19 /* IEEE 802.11 defines */
20 
21 #define WLAN_FC_PVER		0x0003
22 #define WLAN_FC_TODS		0x0100
23 #define WLAN_FC_FROMDS		0x0200
24 #define WLAN_FC_MOREFRAG	0x0400
25 #define WLAN_FC_RETRY		0x0800
26 #define WLAN_FC_PWRMGT		0x1000
27 #define WLAN_FC_MOREDATA	0x2000
28 #define WLAN_FC_ISWEP		0x4000
29 #define WLAN_FC_ORDER		0x8000
30 
31 #define WLAN_FC_GET_TYPE(fc)	(((fc) & 0x000c) >> 2)
32 #define WLAN_FC_GET_STYPE(fc)	(((fc) & 0x00f0) >> 4)
33 
34 #define WLAN_GET_SEQ_FRAG(seq) ((seq) & (BIT(3) | BIT(2) | BIT(1) | BIT(0)))
35 #define WLAN_GET_SEQ_SEQ(seq) \
36 	(((seq) & (~(BIT(3) | BIT(2) | BIT(1) | BIT(0)))) >> 4)
37 
38 #define WLAN_FC_TYPE_MGMT		0
39 #define WLAN_FC_TYPE_CTRL		1
40 #define WLAN_FC_TYPE_DATA		2
41 
42 /* management */
43 #define WLAN_FC_STYPE_ASSOC_REQ		0
44 #define WLAN_FC_STYPE_ASSOC_RESP	1
45 #define WLAN_FC_STYPE_REASSOC_REQ	2
46 #define WLAN_FC_STYPE_REASSOC_RESP	3
47 #define WLAN_FC_STYPE_PROBE_REQ		4
48 #define WLAN_FC_STYPE_PROBE_RESP	5
49 #define WLAN_FC_STYPE_BEACON		8
50 #define WLAN_FC_STYPE_ATIM		9
51 #define WLAN_FC_STYPE_DISASSOC		10
52 #define WLAN_FC_STYPE_AUTH		11
53 #define WLAN_FC_STYPE_DEAUTH		12
54 #define WLAN_FC_STYPE_ACTION		13
55 
56 /* control */
57 #define WLAN_FC_STYPE_PSPOLL		10
58 #define WLAN_FC_STYPE_RTS		11
59 #define WLAN_FC_STYPE_CTS		12
60 #define WLAN_FC_STYPE_ACK		13
61 #define WLAN_FC_STYPE_CFEND		14
62 #define WLAN_FC_STYPE_CFENDACK		15
63 
64 /* data */
65 #define WLAN_FC_STYPE_DATA		0
66 #define WLAN_FC_STYPE_DATA_CFACK	1
67 #define WLAN_FC_STYPE_DATA_CFPOLL	2
68 #define WLAN_FC_STYPE_DATA_CFACKPOLL	3
69 #define WLAN_FC_STYPE_NULLFUNC		4
70 #define WLAN_FC_STYPE_CFACK		5
71 #define WLAN_FC_STYPE_CFPOLL		6
72 #define WLAN_FC_STYPE_CFACKPOLL		7
73 #define WLAN_FC_STYPE_QOS_DATA		8
74 
75 /* Authentication algorithms */
76 #define WLAN_AUTH_OPEN			0
77 #define WLAN_AUTH_SHARED_KEY		1
78 #define WLAN_AUTH_FT			2
79 #define WLAN_AUTH_LEAP			128
80 
81 #define WLAN_AUTH_CHALLENGE_LEN 128
82 
83 #define WLAN_CAPABILITY_ESS BIT(0)
84 #define WLAN_CAPABILITY_IBSS BIT(1)
85 #define WLAN_CAPABILITY_CF_POLLABLE BIT(2)
86 #define WLAN_CAPABILITY_CF_POLL_REQUEST BIT(3)
87 #define WLAN_CAPABILITY_PRIVACY BIT(4)
88 #define WLAN_CAPABILITY_SHORT_PREAMBLE BIT(5)
89 #define WLAN_CAPABILITY_PBCC BIT(6)
90 #define WLAN_CAPABILITY_CHANNEL_AGILITY BIT(7)
91 #define WLAN_CAPABILITY_SPECTRUM_MGMT BIT(8)
92 #define WLAN_CAPABILITY_SHORT_SLOT_TIME BIT(10)
93 #define WLAN_CAPABILITY_DSSS_OFDM BIT(13)
94 
95 /* Status codes (IEEE 802.11-2007, 7.3.1.9, Table 7-23) */
96 #define WLAN_STATUS_SUCCESS 0
97 #define WLAN_STATUS_UNSPECIFIED_FAILURE 1
98 #define WLAN_STATUS_CAPS_UNSUPPORTED 10
99 #define WLAN_STATUS_REASSOC_NO_ASSOC 11
100 #define WLAN_STATUS_ASSOC_DENIED_UNSPEC 12
101 #define WLAN_STATUS_NOT_SUPPORTED_AUTH_ALG 13
102 #define WLAN_STATUS_UNKNOWN_AUTH_TRANSACTION 14
103 #define WLAN_STATUS_CHALLENGE_FAIL 15
104 #define WLAN_STATUS_AUTH_TIMEOUT 16
105 #define WLAN_STATUS_AP_UNABLE_TO_HANDLE_NEW_STA 17
106 #define WLAN_STATUS_ASSOC_DENIED_RATES 18
107 /* IEEE 802.11b */
108 #define WLAN_STATUS_ASSOC_DENIED_NOSHORT 19
109 #define WLAN_STATUS_ASSOC_DENIED_NOPBCC 20
110 #define WLAN_STATUS_ASSOC_DENIED_NOAGILITY 21
111 /* IEEE 802.11h */
112 #define WLAN_STATUS_SPEC_MGMT_REQUIRED 22
113 #define WLAN_STATUS_PWR_CAPABILITY_NOT_VALID 23
114 #define WLAN_STATUS_SUPPORTED_CHANNEL_NOT_VALID 24
115 /* IEEE 802.11g */
116 #define WLAN_STATUS_ASSOC_DENIED_NO_SHORT_SLOT_TIME 25
117 #define WLAN_STATUS_ASSOC_DENIED_NO_ER_PBCC 26
118 #define WLAN_STATUS_ASSOC_DENIED_NO_DSSS_OFDM 27
119 /* IEEE 802.11w */
120 #define WLAN_STATUS_ASSOC_REJECTED_TEMPORARILY 30
121 #define WLAN_STATUS_ROBUST_MGMT_FRAME_POLICY_VIOLATION 31
122 /* IEEE 802.11i */
123 #define WLAN_STATUS_INVALID_IE 40
124 #define WLAN_STATUS_GROUP_CIPHER_NOT_VALID 41
125 #define WLAN_STATUS_PAIRWISE_CIPHER_NOT_VALID 42
126 #define WLAN_STATUS_AKMP_NOT_VALID 43
127 #define WLAN_STATUS_UNSUPPORTED_RSN_IE_VERSION 44
128 #define WLAN_STATUS_INVALID_RSN_IE_CAPAB 45
129 #define WLAN_STATUS_CIPHER_REJECTED_PER_POLICY 46
130 #define WLAN_STATUS_TS_NOT_CREATED 47
131 #define WLAN_STATUS_DIRECT_LINK_NOT_ALLOWED 48
132 #define WLAN_STATUS_DEST_STA_NOT_PRESENT 49
133 #define WLAN_STATUS_DEST_STA_NOT_QOS_STA 50
134 #define WLAN_STATUS_ASSOC_DENIED_LISTEN_INT_TOO_LARGE 51
135 /* IEEE 802.11r */
136 #define WLAN_STATUS_INVALID_FT_ACTION_FRAME_COUNT 52
137 #define WLAN_STATUS_EXPECTED_RESOURCE_REQ_FT 53
138 #define WLAN_STATUS_INVALID_PMKID 54
139 #define WLAN_STATUS_INVALID_MDIE 55
140 #define WLAN_STATUS_INVALID_FTIE 56
141 
142 /* Reason codes (IEEE 802.11-2007, 7.3.1.7, Table 7-22) */
143 #define WLAN_REASON_UNSPECIFIED 1
144 #define WLAN_REASON_PREV_AUTH_NOT_VALID 2
145 #define WLAN_REASON_DEAUTH_LEAVING 3
146 #define WLAN_REASON_DISASSOC_DUE_TO_INACTIVITY 4
147 #define WLAN_REASON_DISASSOC_AP_BUSY 5
148 #define WLAN_REASON_CLASS2_FRAME_FROM_NONAUTH_STA 6
149 #define WLAN_REASON_CLASS3_FRAME_FROM_NONASSOC_STA 7
150 #define WLAN_REASON_DISASSOC_STA_HAS_LEFT 8
151 #define WLAN_REASON_STA_REQ_ASSOC_WITHOUT_AUTH 9
152 /* IEEE 802.11h */
153 #define WLAN_REASON_PWR_CAPABILITY_NOT_VALID 10
154 #define WLAN_REASON_SUPPORTED_CHANNEL_NOT_VALID 11
155 /* IEEE 802.11i */
156 #define WLAN_REASON_INVALID_IE 13
157 #define WLAN_REASON_MICHAEL_MIC_FAILURE 14
158 #define WLAN_REASON_4WAY_HANDSHAKE_TIMEOUT 15
159 #define WLAN_REASON_GROUP_KEY_UPDATE_TIMEOUT 16
160 #define WLAN_REASON_IE_IN_4WAY_DIFFERS 17
161 #define WLAN_REASON_GROUP_CIPHER_NOT_VALID 18
162 #define WLAN_REASON_PAIRWISE_CIPHER_NOT_VALID 19
163 #define WLAN_REASON_AKMP_NOT_VALID 20
164 #define WLAN_REASON_UNSUPPORTED_RSN_IE_VERSION 21
165 #define WLAN_REASON_INVALID_RSN_IE_CAPAB 22
166 #define WLAN_REASON_IEEE_802_1X_AUTH_FAILED 23
167 #define WLAN_REASON_CIPHER_SUITE_REJECTED 24
168 
169 
170 /* Information Element IDs */
171 #define WLAN_EID_SSID 0
172 #define WLAN_EID_SUPP_RATES 1
173 #define WLAN_EID_FH_PARAMS 2
174 #define WLAN_EID_DS_PARAMS 3
175 #define WLAN_EID_CF_PARAMS 4
176 #define WLAN_EID_TIM 5
177 #define WLAN_EID_IBSS_PARAMS 6
178 #define WLAN_EID_COUNTRY 7
179 #define WLAN_EID_CHALLENGE 16
180 /* EIDs defined by IEEE 802.11h - START */
181 #define WLAN_EID_PWR_CONSTRAINT 32
182 #define WLAN_EID_PWR_CAPABILITY 33
183 #define WLAN_EID_TPC_REQUEST 34
184 #define WLAN_EID_TPC_REPORT 35
185 #define WLAN_EID_SUPPORTED_CHANNELS 36
186 #define WLAN_EID_CHANNEL_SWITCH 37
187 #define WLAN_EID_MEASURE_REQUEST 38
188 #define WLAN_EID_MEASURE_REPORT 39
189 #define WLAN_EID_QUITE 40
190 #define WLAN_EID_IBSS_DFS 41
191 /* EIDs defined by IEEE 802.11h - END */
192 #define WLAN_EID_ERP_INFO 42
193 #define WLAN_EID_HT_CAP 45
194 #define WLAN_EID_RSN 48
195 #define WLAN_EID_EXT_SUPP_RATES 50
196 #define WLAN_EID_MOBILITY_DOMAIN 54
197 #define WLAN_EID_FAST_BSS_TRANSITION 55
198 #define WLAN_EID_TIMEOUT_INTERVAL 56
199 #define WLAN_EID_RIC_DATA 57
200 #define WLAN_EID_HT_OPERATION 61
201 #define WLAN_EID_SECONDARY_CHANNEL_OFFSET 62
202 #define WLAN_EID_20_40_BSS_COEXISTENCE 72
203 #define WLAN_EID_20_40_BSS_INTOLERANT 73
204 #define WLAN_EID_OVERLAPPING_BSS_SCAN_PARAMS 74
205 #define WLAN_EID_MMIE 76
206 #define WLAN_EID_VENDOR_SPECIFIC 221
207 
208 
209 /* Action frame categories (IEEE 802.11-2007, 7.3.1.11, Table 7-24) */
210 #define WLAN_ACTION_SPECTRUM_MGMT 0
211 #define WLAN_ACTION_QOS 1
212 #define WLAN_ACTION_DLS 2
213 #define WLAN_ACTION_BLOCK_ACK 3
214 #define WLAN_ACTION_RADIO_MEASUREMENT 5
215 #define WLAN_ACTION_FT 6
216 #define WLAN_ACTION_SA_QUERY 8
217 #define WLAN_ACTION_WMM 17
218 
219 /* SA Query Action frame (IEEE 802.11w/D7.0, 7.4.9) */
220 #define WLAN_SA_QUERY_REQUEST 0
221 #define WLAN_SA_QUERY_RESPONSE 1
222 
223 #define WLAN_SA_QUERY_TR_ID_LEN 16
224 
225 /* Timeout Interval Type */
226 #define WLAN_TIMEOUT_REASSOC_DEADLINE 1
227 #define WLAN_TIMEOUT_KEY_LIFETIME 2
228 #define WLAN_TIMEOUT_ASSOC_COMEBACK 3
229 
230 
231 #ifdef _MSC_VER
232 #pragma pack(push, 1)
233 #endif /* _MSC_VER */
234 
235 struct ieee80211_mgmt {
236 	le16 frame_control;
237 	le16 duration;
238 	u8 da[6];
239 	u8 sa[6];
240 	u8 bssid[6];
241 	le16 seq_ctrl;
242 	union {
243 		struct {
244 			le16 auth_alg;
245 			le16 auth_transaction;
246 			le16 status_code;
247 			/* possibly followed by Challenge text */
248 			u8 variable[0];
249 		} STRUCT_PACKED auth;
250 		struct {
251 			le16 reason_code;
252 		} STRUCT_PACKED deauth;
253 		struct {
254 			le16 capab_info;
255 			le16 listen_interval;
256 			/* followed by SSID and Supported rates */
257 			u8 variable[0];
258 		} STRUCT_PACKED assoc_req;
259 		struct {
260 			le16 capab_info;
261 			le16 status_code;
262 			le16 aid;
263 			/* followed by Supported rates */
264 			u8 variable[0];
265 		} STRUCT_PACKED assoc_resp, reassoc_resp;
266 		struct {
267 			le16 capab_info;
268 			le16 listen_interval;
269 			u8 current_ap[6];
270 			/* followed by SSID and Supported rates */
271 			u8 variable[0];
272 		} STRUCT_PACKED reassoc_req;
273 		struct {
274 			le16 reason_code;
275 		} STRUCT_PACKED disassoc;
276 		struct {
277 			u8 timestamp[8];
278 			le16 beacon_int;
279 			le16 capab_info;
280 			/* followed by some of SSID, Supported rates,
281 			 * FH Params, DS Params, CF Params, IBSS Params, TIM */
282 			u8 variable[0];
283 		} STRUCT_PACKED beacon;
284 		struct {
285 			/* only variable items: SSID, Supported rates */
286 			u8 variable[0];
287 		} STRUCT_PACKED probe_req;
288 		struct {
289 			u8 timestamp[8];
290 			le16 beacon_int;
291 			le16 capab_info;
292 			/* followed by some of SSID, Supported rates,
293 			 * FH Params, DS Params, CF Params, IBSS Params */
294 			u8 variable[0];
295 		} STRUCT_PACKED probe_resp;
296 		struct {
297 			u8 category;
298 			union {
299 				struct {
300 					u8 action_code;
301 					u8 dialog_token;
302 					u8 status_code;
303 					u8 variable[0];
304 				} STRUCT_PACKED wme_action;
305 				struct{
306 					u8 action_code;
307 					u8 element_id;
308 					u8 length;
309 					u8 switch_mode;
310 					u8 new_chan;
311 					u8 switch_count;
312 				} STRUCT_PACKED chan_switch;
313 				struct {
314 					u8 action;
315 					u8 sta_addr[ETH_ALEN];
316 					u8 target_ap_addr[ETH_ALEN];
317 					u8 variable[0]; /* FT Request */
318 				} STRUCT_PACKED ft_action_req;
319 				struct {
320 					u8 action;
321 					u8 sta_addr[ETH_ALEN];
322 					u8 target_ap_addr[ETH_ALEN];
323 					le16 status_code;
324 					u8 variable[0]; /* FT Request */
325 				} STRUCT_PACKED ft_action_resp;
326 				struct {
327 					u8 action;
328 					u8 trans_id[WLAN_SA_QUERY_TR_ID_LEN];
329 				} STRUCT_PACKED sa_query_req;
330 				struct {
331 					u8 action; /* */
332 					u8 trans_id[WLAN_SA_QUERY_TR_ID_LEN];
333 				} STRUCT_PACKED sa_query_resp;
334 			} u;
335 		} STRUCT_PACKED action;
336 	} u;
337 } STRUCT_PACKED;
338 
339 #ifdef _MSC_VER
340 #pragma pack(pop)
341 #endif /* _MSC_VER */
342 
343 #define ERP_INFO_NON_ERP_PRESENT BIT(0)
344 #define ERP_INFO_USE_PROTECTION BIT(1)
345 #define ERP_INFO_BARKER_PREAMBLE_MODE BIT(2)
346 
347 
348 /* HT Capability element */
349 
350 enum {
351 	MAX_RX_AMPDU_FACTOR_8KB = 0,
352 	MAX_RX_AMPDU_FACTOR_16KB,
353 	MAX_RX_AMPDU_FACTOR_32KB,
354 	MAX_RX_AMPDU_FACTOR_64KB
355 };
356 
357 enum {
358 	CALIBRATION_NOT_SUPPORTED = 0,
359 	CALIBRATION_CANNOT_INIT,
360 	CALIBRATION_CAN_INIT,
361 	CALIBRATION_FULL_SUPPORT
362 };
363 
364 enum {
365 	MCS_FEEDBACK_NOT_PROVIDED = 0,
366 	MCS_FEEDBACK_UNSOLICITED,
367 	MCS_FEEDBACK_MRQ_RESPONSE
368 };
369 
370 
371 struct ieee80211_ht_capability {
372 	le16 capabilities_info;
373 	u8 mac_ht_params_info;
374 	u8 supported_mcs_set[16];
375 	le16 extended_ht_capability_info;
376 	le32 tx_BF_capability_info;
377 	u8 antenna_selection_info;
378 } STRUCT_PACKED;
379 
380 
381 struct ieee80211_ht_operation {
382 	u8 control_chan;
383 	u8 ht_param;
384 	le16 operation_mode;
385 	le16 stbc_param;
386 	u8 basic_set[16];
387 } STRUCT_PACKED;
388 
389 /* auxiliary bit manipulation macros FIXME: move it to common later... */
390 #define SET_2BIT_U8(_ptr_, _shift_, _val_)				\
391 	((*(_ptr_) &= ~(3 << (_shift_))),				\
392 	 (*(_ptr_) |= (*(_ptr_) & (((u8)3) << (_shift_))) |		\
393 		      (((u8)(_val_) & 3) << _shift_)))
394 
395 #define GET_2BIT_U8(_var_, _shift_)	\
396 	(((_var_) & (((u8)3) << (_shift_))) >> (_shift_))
397 
398 #define SET_2BIT_LE16(_u16ptr_, _shift_, _val_)				\
399 	((*(_u16ptr_) &= ~(3 << (_shift_))),				\
400 	 (*(_u16ptr_) |= 						\
401 		(((*(_u16ptr_)) & (((u16)3) << ((u16)_shift_))) |	\
402 		(((u16)(_val_) & (u16)3) << (u16)(_shift_)))))
403 
404 #define GET_2BIT_LE16(_var_, _shift_)	\
405 	(((_var_) & (((u16)3) << (_shift_))) >> (_shift_))
406 
407 #define SET_2BIT_LE32(_u32ptr_, _shift_, _val_)				\
408 	((*(_u32ptr_) &= ~(3 << (_shift_))),				\
409 	 (*(_u32ptr_) |= (((*(_u32ptr_)) & (((u32)3) << (_shift_))) |	\
410 			(((u32)(_val_) & 3) << _shift_))))
411 
412 #define GET_2BIT_LE32(_var_, _shift_)	\
413 	(((_var_) & (((u32)3) << (_shift_))) >> (_shift_))
414 
415 #define SET_3BIT_LE16(_u16ptr_, _shift_, _val_)				\
416 	((*(_u16ptr_) &= ~(7 << (_shift_))),				\
417 	(*(_u16ptr_) |= (((*(_u16ptr_)) & (((u16)7) << (_shift_))) |	\
418 			(((u16)(_val_) & 7) << _shift_))))
419 
420 #define GET_3BIT_LE16(_var_, _shift_)	\
421 	(((_var_) & (((u16)7) << (_shift_))) >> (_shift_))
422 
423 #define SET_3BIT_LE32(_u32ptr_, _shift_, _val_)				\
424 	((*(_u32ptr_) &= ~(7 << (_shift_))),				\
425 	 (*(_u32ptr_) |= (((*(_u32ptr_)) & (((u32)7) << (_shift_))) |	\
426 			(((u32)(_val_) & 7) << _shift_))))
427 
428 #define GET_3BIT_LE32(_var_, _shift_)	\
429 	(((_var_) & (((u32)7) << (_shift_))) >> (_shift_))
430 
431 
432 #define HT_CAP_INFO_LDPC_CODING_CAP		((u16) BIT(0))
433 #define HT_CAP_INFO_SUPP_CHANNEL_WIDTH_SET	((u16) BIT(1))
434 #define HT_CAP_INFO_SMPS_MASK			((u16) (BIT(2) | BIT(3)))
435 #define HT_CAP_INFO_SMPS_STATIC			((u16) 0)
436 #define HT_CAP_INFO_SMPS_DYNAMIC		((u16) BIT(2))
437 #define HT_CAP_INFO_SMPS_DISABLED		((u16) (BIT(2) | BIT(3)))
438 #define HT_CAP_INFO_GREEN_FIELD			((u16) BIT(4))
439 #define HT_CAP_INFO_SHORT_GI20MHZ		((u16) BIT(5))
440 #define HT_CAP_INFO_SHORT_GI40MHZ		((u16) BIT(6))
441 #define HT_CAP_INFO_TX_STBC			((u16) BIT(7))
442 #define HT_CAP_INFO_RX_STBC_MASK		((u16) (BIT(8) | BIT(9)))
443 #define HT_CAP_INFO_RX_STBC_1			((u16) BIT(8))
444 #define HT_CAP_INFO_RX_STBC_12			((u16) BIT(9))
445 #define HT_CAP_INFO_RX_STBC_123			((u16) (BIT(8) | BIT(9)))
446 #define HT_CAP_INFO_DELAYED_BA			((u16) BIT(10))
447 #define HT_CAP_INFO_MAX_AMSDU_SIZE		((u16) BIT(11))
448 #define HT_CAP_INFO_DSSS_CCK40MHZ		((u16) BIT(12))
449 #define HT_CAP_INFO_PSMP_SUPP			((u16) BIT(13))
450 #define HT_CAP_INFO_40MHZ_INTOLERANT		((u16) BIT(14))
451 #define HT_CAP_INFO_LSIG_TXOP_PROTECT_SUPPORT	((u16) BIT(15))
452 
453 
454 #define MAC_HT_PARAM_INFO_MAX_RX_AMPDU_FACTOR_OFFSET	0
455 #define MAC_HT_PARAM_INFO_MAX_MPDU_DENSITY_OFFSET	2
456 
457 #define EXT_HT_CAP_INFO_PCO			((u16) BIT(0))
458 #define EXT_HT_CAP_INFO_TRANS_TIME_OFFSET	1
459 #define EXT_HT_CAP_INFO_MCS_FEEDBACK_OFFSET	8
460 #define EXT_HT_CAP_INFO_HTC_SUPPORTED		((u16) BIT(10))
461 #define EXT_HT_CAP_INFO_RD_RESPONDER		((u16) BIT(11))
462 
463 
464 #define TX_BEAMFORM_CAP_TXBF_CAP ((u32) BIT(0))
465 #define TX_BEAMFORM_CAP_RX_STAGGERED_SOUNDING_CAP ((u32) BIT(1))
466 #define TX_BEAMFORM_CAP_TX_STAGGERED_SOUNDING_CAP ((u32) BIT(2))
467 #define TX_BEAMFORM_CAP_RX_ZLF_CAP ((u32) BIT(3))
468 #define TX_BEAMFORM_CAP_TX_ZLF_CAP ((u32) BIT(4))
469 #define TX_BEAMFORM_CAP_IMPLICIT_ZLF_CAP ((u32) BIT(5))
470 #define TX_BEAMFORM_CAP_CALIB_OFFSET 6
471 #define TX_BEAMFORM_CAP_EXPLICIT_CSI_TXBF_CAP ((u32) BIT(8))
472 #define TX_BEAMFORM_CAP_EXPLICIT_UNCOMPR_STEERING_MATRIX_CAP ((u32) BIT(9))
473 #define TX_BEAMFORM_CAP_EXPLICIT_BF_CSI_FEEDBACK_CAP ((u32) BIT(10))
474 #define TX_BEAMFORM_CAP_EXPLICIT_BF_CSI_FEEDBACK_OFFSET 11
475 #define TX_BEAMFORM_CAP_EXPLICIT_UNCOMPR_STEERING_MATRIX_FEEDBACK_OFFSET 13
476 #define TX_BEAMFORM_CAP_EXPLICIT_COMPRESSED_STEERING_MATRIX_FEEDBACK_OFFSET 15
477 #define TX_BEAMFORM_CAP_MINIMAL_GROUPING_OFFSET 17
478 #define TX_BEAMFORM_CAP_CSI_NUM_BEAMFORMER_ANT_OFFSET 19
479 #define TX_BEAMFORM_CAP_UNCOMPRESSED_STEERING_MATRIX_BEAMFORMER_ANT_OFFSET 21
480 #define TX_BEAMFORM_CAP_COMPRESSED_STEERING_MATRIX_BEAMFORMER_ANT_OFFSET 23
481 #define TX_BEAMFORM_CAP_SCI_MAX_OF_ROWS_BEANFORMER_SUPPORTED_OFFSET 25
482 
483 
484 #define ASEL_CAPABILITY_ASEL_CAPABLE ((u8) BIT(0))
485 #define ASEL_CAPABILITY_EXPLICIT_CSI_FEEDBACK_BASED_TX_AS_CAP ((u8) BIT(1))
486 #define ASEL_CAPABILITY_ANT_INDICES_FEEDBACK_BASED_TX_AS_CAP ((u8) BIT(2))
487 #define ASEL_CAPABILITY_EXPLICIT_CSI_FEEDBACK_CAP ((u8) BIT(3))
488 #define ASEL_CAPABILITY_ANT_INDICES_FEEDBACK_CAP ((u8) BIT(4))
489 #define ASEL_CAPABILITY_RX_AS_CAP ((u8) BIT(5))
490 #define ASEL_CAPABILITY_TX_SOUND_PPDUS_CAP ((u8) BIT(6))
491 
492 
493 struct ht_cap_ie {
494 	u8 id;
495 	u8 length;
496 	struct ieee80211_ht_capability data;
497 } STRUCT_PACKED;
498 
499 
500 #define REC_TRANS_CHNL_WIDTH_20     0
501 #define REC_TRANS_CHNL_WIDTH_ANY    1
502 
503 #define OP_MODE_PURE                    0
504 #define OP_MODE_MAY_BE_LEGACY_STAS      1
505 #define OP_MODE_20MHZ_HT_STA_ASSOCED    2
506 #define OP_MODE_MIXED                   3
507 
508 #define HT_INFO_HT_PARAM_SECONDARY_CHNL_OFF_MASK	((u8) BIT(0) | BIT(1))
509 #define HT_INFO_HT_PARAM_SECONDARY_CHNL_ABOVE		((u8) BIT(0))
510 #define HT_INFO_HT_PARAM_SECONDARY_CHNL_BELOW		((u8) BIT(0) | BIT(1))
511 #define HT_INFO_HT_PARAM_REC_TRANS_CHNL_WIDTH		((u8) BIT(2))
512 #define HT_INFO_HT_PARAM_RIFS_MODE			((u8) BIT(3))
513 #define HT_INFO_HT_PARAM_CTRL_ACCESS_ONLY		((u8) BIT(4))
514 #define HT_INFO_HT_PARAM_SRV_INTERVAL_GRANULARITY	((u8) BIT(5))
515 
516 #define HT_INFO_OPERATION_MODE_OP_MODE_MASK	\
517 		((le16) (0x0001 | 0x0002))
518 #define HT_INFO_OPERATION_MODE_OP_MODE_OFFSET		0
519 #define HT_INFO_OPERATION_MODE_NON_GF_DEVS_PRESENT	((u8) BIT(2))
520 #define HT_INFO_OPERATION_MODE_TRANSMIT_BURST_LIMIT	((u8) BIT(3))
521 #define HT_INFO_OPERATION_MODE_NON_HT_STA_PRESENT	((u8) BIT(4))
522 
523 #define HT_INFO_STBC_PARAM_DUAL_BEACON			((u16) BIT(6))
524 #define HT_INFO_STBC_PARAM_DUAL_STBC_PROTECT		((u16) BIT(7))
525 #define HT_INFO_STBC_PARAM_SECONDARY_BCN		((u16) BIT(8))
526 #define HT_INFO_STBC_PARAM_LSIG_TXOP_PROTECT_ALLOWED	((u16) BIT(9))
527 #define HT_INFO_STBC_PARAM_PCO_ACTIVE			((u16) BIT(10))
528 #define HT_INFO_STBC_PARAM_PCO_PHASE			((u16) BIT(11))
529 
530 
531 /* Secondary channel offset element */
532 #define SECONDARY_CHANNEL_OFFSET_NONE	0
533 #define SECONDARY_CHANNEL_OFFSET_ABOVE	1
534 #define SECONDARY_CHANNEL_OFFSET_BELOW	3
535 struct secondary_channel_offset_ie {
536 	u8 id;
537 	u8 length;
538 	u8 secondary_offset_offset;
539 } STRUCT_PACKED;
540 
541 
542 /* body of Recommended Transmit Channel Width action frame */
543 #define CHANNEL_WIDTH_20	0
544 #define CHANNEL_WIDTH_ANY	1
545 struct recommended_tx_channel_width_action {
546 	u8 category;
547 	u8 action;
548 	u8 channel_width;
549 } STRUCT_PACKED;
550 
551 /* body of MIMO Power Save action frame */
552 #define PWR_SAVE_MODE_STATIC	0
553 #define PWR_SAVE_MODE_DYNAMIC	1
554 struct mimo_pwr_save_action {
555 	u8 category;
556 	u8 action;
557 	u8 enable;
558 	u8 mode;
559 } STRUCT_PACKED;
560 
561 
562 #define OUI_MICROSOFT 0x0050f2 /* Microsoft (also used in Wi-Fi specs)
563 				* 00:50:F2 */
564 
565 #define WME_OUI_TYPE 2
566 #define WME_OUI_SUBTYPE_INFORMATION_ELEMENT 0
567 #define WME_OUI_SUBTYPE_PARAMETER_ELEMENT 1
568 #define WME_OUI_SUBTYPE_TSPEC_ELEMENT 2
569 #define WME_VERSION 1
570 
571 #define WME_ACTION_CODE_SETUP_REQUEST 0
572 #define WME_ACTION_CODE_SETUP_RESPONSE 1
573 #define WME_ACTION_CODE_TEARDOWN 2
574 
575 #define WME_SETUP_RESPONSE_STATUS_ADMISSION_ACCEPTED 0
576 #define WME_SETUP_RESPONSE_STATUS_INVALID_PARAMETERS 1
577 #define WME_SETUP_RESPONSE_STATUS_REFUSED 3
578 
579 #define WME_TSPEC_DIRECTION_UPLINK 0
580 #define WME_TSPEC_DIRECTION_DOWNLINK 1
581 #define WME_TSPEC_DIRECTION_BI_DIRECTIONAL 3
582 
583 
584 #define OUI_BROADCOM 0x00904c /* Broadcom (Epigram) */
585 
586 #define VENDOR_HT_CAPAB_OUI_TYPE 0x33 /* 00-90-4c:0x33 */
587 
588 #endif /* IEEE802_11_DEFS_H */
589