Commit | Line | Data |
---|---|---|
71e9bd3f | 1 | /* SPDX-License-Identifier: GPL-2.0 */ |
9a602711 LF |
2 | /****************************************************************************** |
3 | * | |
4 | * Copyright(c) 2007 - 2012 Realtek Corporation. All rights reserved. | |
5 | * | |
9a602711 LF |
6 | ******************************************************************************/ |
7 | #ifndef _WIFI_H_ | |
8 | #define _WIFI_H_ | |
9 | ||
9a602711 | 10 | #define WLAN_IEEE_OUI_LEN 3 |
9a602711 LF |
11 | #define WLAN_CRC_LEN 4 |
12 | #define WLAN_BSSID_LEN 6 | |
13 | #define WLAN_BSS_TS_LEN 8 | |
14 | #define WLAN_HDR_A3_LEN 24 | |
15 | #define WLAN_HDR_A4_LEN 30 | |
16 | #define WLAN_HDR_A3_QOS_LEN 26 | |
17 | #define WLAN_HDR_A4_QOS_LEN 32 | |
9a602711 LF |
18 | #define WLAN_DATA_MAXLEN 2312 |
19 | ||
20 | #define WLAN_A3_PN_OFFSET 24 | |
21 | #define WLAN_A4_PN_OFFSET 30 | |
22 | ||
23 | #define WLAN_MIN_ETHFRM_LEN 60 | |
24 | #define WLAN_MAX_ETHFRM_LEN 1514 | |
9a602711 LF |
25 | |
26 | #define P80211CAPTURE_VERSION 0x80211001 | |
27 | ||
28 | /* This value is tested by WiFi 11n Test Plan 5.2.3. */ | |
29 | /* This test verifies the WLAN NIC can update the NAV through sending | |
f6cadc1b AG |
30 | * the CTS with large duration. |
31 | */ | |
9a602711 LF |
32 | #define WiFiNavUpperUs 30000 /* 30 ms */ |
33 | ||
34 | enum WIFI_FRAME_TYPE { | |
35 | WIFI_MGT_TYPE = (0), | |
36 | WIFI_CTRL_TYPE = (BIT(2)), | |
37 | WIFI_DATA_TYPE = (BIT(3)), | |
31511657 | 38 | WIFI_QOS_DATA_TYPE = (BIT(7) | BIT(3)), /* QoS Data */ |
9a602711 LF |
39 | }; |
40 | ||
41 | enum WIFI_FRAME_SUBTYPE { | |
42 | /* below is for mgt frame */ | |
43 | WIFI_ASSOCREQ = (0 | WIFI_MGT_TYPE), | |
44 | WIFI_ASSOCRSP = (BIT(4) | WIFI_MGT_TYPE), | |
45 | WIFI_REASSOCREQ = (BIT(5) | WIFI_MGT_TYPE), | |
46 | WIFI_REASSOCRSP = (BIT(5) | BIT(4) | WIFI_MGT_TYPE), | |
47 | WIFI_PROBEREQ = (BIT(6) | WIFI_MGT_TYPE), | |
48 | WIFI_PROBERSP = (BIT(6) | BIT(4) | WIFI_MGT_TYPE), | |
49 | WIFI_BEACON = (BIT(7) | WIFI_MGT_TYPE), | |
50 | WIFI_ATIM = (BIT(7) | BIT(4) | WIFI_MGT_TYPE), | |
51 | WIFI_DISASSOC = (BIT(7) | BIT(5) | WIFI_MGT_TYPE), | |
52 | WIFI_AUTH = (BIT(7) | BIT(5) | BIT(4) | WIFI_MGT_TYPE), | |
53 | WIFI_DEAUTH = (BIT(7) | BIT(6) | WIFI_MGT_TYPE), | |
54 | WIFI_ACTION = (BIT(7) | BIT(6) | BIT(4) | WIFI_MGT_TYPE), | |
55 | ||
56 | /* below is for control frame */ | |
57 | WIFI_PSPOLL = (BIT(7) | BIT(5) | WIFI_CTRL_TYPE), | |
58 | WIFI_RTS = (BIT(7) | BIT(5) | BIT(4) | WIFI_CTRL_TYPE), | |
59 | WIFI_CTS = (BIT(7) | BIT(6) | WIFI_CTRL_TYPE), | |
60 | WIFI_ACK = (BIT(7) | BIT(6) | BIT(4) | WIFI_CTRL_TYPE), | |
61 | WIFI_CFEND = (BIT(7) | BIT(6) | BIT(5) | WIFI_CTRL_TYPE), | |
62 | WIFI_CFEND_CFACK = (BIT(7) | BIT(6) | BIT(5) | BIT(4) | | |
63 | WIFI_CTRL_TYPE), | |
64 | ||
65 | /* below is for data frame */ | |
66 | WIFI_DATA = (0 | WIFI_DATA_TYPE), | |
67 | WIFI_DATA_CFACK = (BIT(4) | WIFI_DATA_TYPE), | |
68 | WIFI_DATA_CFPOLL = (BIT(5) | WIFI_DATA_TYPE), | |
69 | WIFI_DATA_CFACKPOLL = (BIT(5) | BIT(4) | WIFI_DATA_TYPE), | |
70 | WIFI_DATA_NULL = (BIT(6) | WIFI_DATA_TYPE), | |
71 | WIFI_CF_ACK = (BIT(6) | BIT(4) | WIFI_DATA_TYPE), | |
72 | WIFI_CF_POLL = (BIT(6) | BIT(5) | WIFI_DATA_TYPE), | |
73 | WIFI_CF_ACKPOLL = (BIT(6) | BIT(5) | BIT(4) | WIFI_DATA_TYPE), | |
74 | WIFI_QOS_DATA_NULL = (BIT(6) | WIFI_QOS_DATA_TYPE), | |
75 | }; | |
76 | ||
9a602711 LF |
77 | enum WIFI_REG_DOMAIN { |
78 | DOMAIN_FCC = 1, | |
79 | DOMAIN_IC = 2, | |
80 | DOMAIN_ETSI = 3, | |
81 | DOMAIN_SPA = 4, | |
82 | DOMAIN_FRANCE = 5, | |
83 | DOMAIN_MKK = 6, | |
84 | DOMAIN_ISRAEL = 7, | |
85 | DOMAIN_MKK1 = 8, | |
86 | DOMAIN_MKK2 = 9, | |
87 | DOMAIN_MKK3 = 10, | |
88 | DOMAIN_MAX | |
89 | }; | |
90 | ||
91 | #define _TO_DS_ BIT(8) | |
92 | #define _FROM_DS_ BIT(9) | |
93 | #define _MORE_FRAG_ BIT(10) | |
94 | #define _RETRY_ BIT(11) | |
95 | #define _PWRMGT_ BIT(12) | |
96 | #define _MORE_DATA_ BIT(13) | |
97 | #define _PRIVACY_ BIT(14) | |
98 | #define _ORDER_ BIT(15) | |
99 | ||
100 | #define SetToDs(pbuf) \ | |
101 | *(__le16 *)(pbuf) |= cpu_to_le16(_TO_DS_) | |
102 | ||
103 | #define GetToDs(pbuf) (((*(__le16 *)(pbuf)) & cpu_to_le16(_TO_DS_)) != 0) | |
104 | ||
105 | #define ClearToDs(pbuf) \ | |
106 | *(__le16 *)(pbuf) &= (~cpu_to_le16(_TO_DS_)) | |
107 | ||
108 | #define SetFrDs(pbuf) \ | |
109 | *(__le16 *)(pbuf) |= cpu_to_le16(_FROM_DS_) | |
110 | ||
111 | #define GetFrDs(pbuf) (((*(__le16 *)(pbuf)) & cpu_to_le16(_FROM_DS_)) != 0) | |
112 | ||
113 | #define ClearFrDs(pbuf) \ | |
114 | *(__le16 *)(pbuf) &= (~cpu_to_le16(_FROM_DS_)) | |
115 | ||
116 | #define get_tofr_ds(pframe) ((GetToDs(pframe) << 1) | GetFrDs(pframe)) | |
117 | ||
9a602711 LF |
118 | #define SetMFrag(pbuf) \ |
119 | *(__le16 *)(pbuf) |= cpu_to_le16(_MORE_FRAG_) | |
120 | ||
121 | #define GetMFrag(pbuf) (((*(__le16 *)(pbuf)) & cpu_to_le16(_MORE_FRAG_)) != 0) | |
122 | ||
123 | #define ClearMFrag(pbuf) \ | |
124 | *(__le16 *)(pbuf) &= (~cpu_to_le16(_MORE_FRAG_)) | |
125 | ||
126 | #define SetRetry(pbuf) \ | |
127 | *(__le16 *)(pbuf) |= cpu_to_le16(_RETRY_) | |
128 | ||
129 | #define GetRetry(pbuf) (((*(__le16 *)(pbuf)) & cpu_to_le16(_RETRY_)) != 0) | |
130 | ||
131 | #define ClearRetry(pbuf) \ | |
132 | *(__le16 *)(pbuf) &= (~cpu_to_le16(_RETRY_)) | |
133 | ||
134 | #define SetPwrMgt(pbuf) \ | |
135 | *(__le16 *)(pbuf) |= cpu_to_le16(_PWRMGT_) | |
136 | ||
137 | #define GetPwrMgt(pbuf) (((*(__le16 *)(pbuf)) & cpu_to_le16(_PWRMGT_)) != 0) | |
138 | ||
139 | #define ClearPwrMgt(pbuf) \ | |
140 | *(__le16 *)(pbuf) &= (~cpu_to_le16(_PWRMGT_)) | |
141 | ||
142 | #define SetMData(pbuf) \ | |
143 | *(__le16 *)(pbuf) |= cpu_to_le16(_MORE_DATA_) | |
144 | ||
145 | #define GetMData(pbuf) (((*(__le16 *)(pbuf)) & cpu_to_le16(_MORE_DATA_)) != 0) | |
146 | ||
147 | #define ClearMData(pbuf) \ | |
148 | *(__le16 *)(pbuf) &= (~cpu_to_le16(_MORE_DATA_)) | |
149 | ||
150 | #define SetPrivacy(pbuf) \ | |
151 | *(__le16 *)(pbuf) |= cpu_to_le16(_PRIVACY_) | |
152 | ||
153 | #define GetPrivacy(pbuf) \ | |
154 | (((*(__le16 *)(pbuf)) & cpu_to_le16(_PRIVACY_)) != 0) | |
155 | ||
9a602711 LF |
156 | #define GetOrder(pbuf) \ |
157 | (((*(__le16 *)(pbuf)) & cpu_to_le16(_ORDER_)) != 0) | |
158 | ||
159 | #define GetFrameType(pbuf) \ | |
160 | (le16_to_cpu(*(__le16 *)(pbuf)) & (BIT(3) | BIT(2))) | |
161 | ||
9a602711 LF |
162 | #define GetFrameSubType(pbuf) (le16_to_cpu(*(__le16 *)(pbuf)) & (BIT(7) |\ |
163 | BIT(6) | BIT(5) | BIT(4) | BIT(3) | BIT(2))) | |
164 | ||
165 | #define SetFrameSubType(pbuf, type) \ | |
166 | do { \ | |
167 | *(__le16 *)(pbuf) &= cpu_to_le16(~(BIT(7) | BIT(6) | \ | |
168 | BIT(5) | BIT(4) | BIT(3) | BIT(2))); \ | |
169 | *(__le16 *)(pbuf) |= cpu_to_le16(type); \ | |
170 | } while (0) | |
171 | ||
172 | #define GetSequence(pbuf) \ | |
173 | (le16_to_cpu(*(__le16 *)((size_t)(pbuf) + 22)) >> 4) | |
174 | ||
175 | #define GetFragNum(pbuf) \ | |
176 | (le16_to_cpu(*(__le16 *)((size_t)(pbuf) + 22)) & 0x0f) | |
177 | ||
9a602711 LF |
178 | #define SetSeqNum(pbuf, num) \ |
179 | do { \ | |
180 | *(__le16 *)((size_t)(pbuf) + 22) = \ | |
181 | ((*(__le16 *)((size_t)(pbuf) + 22)) & cpu_to_le16((unsigned short)0x000f)) | \ | |
182 | cpu_to_le16((unsigned short)(0xfff0 & (num << 4))); \ | |
183 | } while (0) | |
184 | ||
185 | #define SetDuration(pbuf, dur) \ | |
186 | *(__le16 *)((size_t)(pbuf) + 2) = cpu_to_le16(0xffff & (dur)) | |
187 | ||
9a602711 LF |
188 | #define SetPriority(pbuf, tid) \ |
189 | *(__le16 *)(pbuf) |= cpu_to_le16(tid & 0xf) | |
190 | ||
191 | #define GetPriority(pbuf) ((le16_to_cpu(*(__le16 *)(pbuf))) & 0xf) | |
192 | ||
193 | #define SetEOSP(pbuf, eosp) \ | |
194 | *(__le16 *)(pbuf) |= cpu_to_le16((eosp & 1) << 4) | |
195 | ||
196 | #define SetAckpolicy(pbuf, ack) \ | |
197 | *(__le16 *)(pbuf) |= cpu_to_le16((ack & 3) << 5) | |
198 | ||
199 | #define GetAckpolicy(pbuf) (((le16_to_cpu(*(__le16 *)pbuf)) >> 5) & 0x3) | |
200 | ||
201 | #define GetAMsdu(pbuf) (((le16_to_cpu(*(__le16 *)pbuf)) >> 7) & 0x1) | |
202 | ||
9a602711 LF |
203 | #define GetAid(pbuf) (le16_to_cpu(*(__le16 *)((size_t)(pbuf) + 2)) & 0x3fff) |
204 | ||
9a602711 LF |
205 | #define GetAddr1Ptr(pbuf) ((unsigned char *)((size_t)(pbuf) + 4)) |
206 | ||
207 | #define GetAddr2Ptr(pbuf) ((unsigned char *)((size_t)(pbuf) + 10)) | |
208 | ||
209 | #define GetAddr3Ptr(pbuf) ((unsigned char *)((size_t)(pbuf) + 16)) | |
210 | ||
211 | #define GetAddr4Ptr(pbuf) ((unsigned char *)((size_t)(pbuf) + 24)) | |
212 | ||
9a602711 LF |
213 | static inline unsigned char *get_da(unsigned char *pframe) |
214 | { | |
215 | unsigned char *da; | |
216 | unsigned int to_fr_ds = (GetToDs(pframe) << 1) | GetFrDs(pframe); | |
217 | ||
218 | switch (to_fr_ds) { | |
219 | case 0x00: /* ToDs=0, FromDs=0 */ | |
220 | da = GetAddr1Ptr(pframe); | |
221 | break; | |
222 | case 0x01: /* ToDs=0, FromDs=1 */ | |
223 | da = GetAddr1Ptr(pframe); | |
224 | break; | |
225 | case 0x02: /* ToDs=1, FromDs=0 */ | |
226 | da = GetAddr3Ptr(pframe); | |
227 | break; | |
228 | default: /* ToDs=1, FromDs=1 */ | |
229 | da = GetAddr3Ptr(pframe); | |
230 | break; | |
231 | } | |
232 | return da; | |
233 | } | |
234 | ||
235 | static inline unsigned char *get_sa(unsigned char *pframe) | |
236 | { | |
237 | unsigned char *sa; | |
238 | unsigned int to_fr_ds = (GetToDs(pframe) << 1) | GetFrDs(pframe); | |
239 | ||
240 | switch (to_fr_ds) { | |
241 | case 0x00: /* ToDs=0, FromDs=0 */ | |
242 | sa = GetAddr2Ptr(pframe); | |
243 | break; | |
244 | case 0x01: /* ToDs=0, FromDs=1 */ | |
245 | sa = GetAddr3Ptr(pframe); | |
246 | break; | |
247 | case 0x02: /* ToDs=1, FromDs=0 */ | |
248 | sa = GetAddr2Ptr(pframe); | |
249 | break; | |
250 | default: /* ToDs=1, FromDs=1 */ | |
251 | sa = GetAddr4Ptr(pframe); | |
252 | break; | |
253 | } | |
254 | return sa; | |
255 | } | |
256 | ||
257 | static inline unsigned char *get_hdr_bssid(unsigned char *pframe) | |
258 | { | |
259 | unsigned char *sa; | |
260 | unsigned int to_fr_ds = (GetToDs(pframe) << 1) | GetFrDs(pframe); | |
261 | ||
262 | switch (to_fr_ds) { | |
263 | case 0x00: /* ToDs=0, FromDs=0 */ | |
264 | sa = GetAddr3Ptr(pframe); | |
265 | break; | |
266 | case 0x01: /* ToDs=0, FromDs=1 */ | |
267 | sa = GetAddr2Ptr(pframe); | |
268 | break; | |
269 | case 0x02: /* ToDs=1, FromDs=0 */ | |
270 | sa = GetAddr1Ptr(pframe); | |
271 | break; | |
272 | case 0x03: /* ToDs=1, FromDs=1 */ | |
273 | sa = GetAddr1Ptr(pframe); | |
274 | break; | |
275 | default: | |
276 | sa = NULL; /* */ | |
277 | break; | |
278 | } | |
279 | return sa; | |
280 | } | |
281 | ||
282 | static inline int IsFrameTypeCtrl(unsigned char *pframe) | |
283 | { | |
2d5f72b0 | 284 | if (GetFrameType(pframe) == WIFI_CTRL_TYPE) |
9a602711 LF |
285 | return true; |
286 | else | |
287 | return false; | |
288 | } | |
4effb03d | 289 | |
9a602711 LF |
290 | /*----------------------------------------------------------------------------- |
291 | Below is for the security related definition | |
292 | ------------------------------------------------------------------------------*/ | |
293 | #define _RESERVED_FRAME_TYPE_ 0 | |
294 | #define _SKB_FRAME_TYPE_ 2 | |
295 | #define _PRE_ALLOCMEM_ 1 | |
296 | #define _PRE_ALLOCHDR_ 3 | |
297 | #define _PRE_ALLOCLLCHDR_ 4 | |
298 | #define _PRE_ALLOCICVHDR_ 5 | |
299 | #define _PRE_ALLOCMICHDR_ 6 | |
300 | ||
301 | #define _SIFSTIME_ \ | |
302 | ((priv->pmib->dot11BssType.net_work_type & WIRELESS_11A) ? 16 : 10) | |
303 | #define _ACKCTSLNG_ 14 /* 14 bytes long, including crclng */ | |
304 | #define _CRCLNG_ 4 | |
305 | ||
306 | #define _ASOCREQ_IE_OFFSET_ 4 /* excluding wlan_hdr */ | |
307 | #define _ASOCRSP_IE_OFFSET_ 6 | |
308 | #define _REASOCREQ_IE_OFFSET_ 10 | |
309 | #define _REASOCRSP_IE_OFFSET_ 6 | |
310 | #define _PROBEREQ_IE_OFFSET_ 0 | |
311 | #define _PROBERSP_IE_OFFSET_ 12 | |
312 | #define _AUTH_IE_OFFSET_ 6 | |
313 | #define _DEAUTH_IE_OFFSET_ 0 | |
314 | #define _BEACON_IE_OFFSET_ 12 | |
315 | #define _PUBLIC_ACTION_IE_OFFSET_ 8 | |
316 | ||
317 | #define _FIXED_IE_LENGTH_ _BEACON_IE_OFFSET_ | |
318 | ||
9a602711 LF |
319 | /* --------------------------------------------------------------------------- |
320 | Below is the fixed elements... | |
321 | -----------------------------------------------------------------------------*/ | |
322 | #define _AUTH_ALGM_NUM_ 2 | |
323 | #define _AUTH_SEQ_NUM_ 2 | |
324 | #define _BEACON_ITERVAL_ 2 | |
325 | #define _CAPABILITY_ 2 | |
326 | #define _CURRENT_APADDR_ 6 | |
327 | #define _LISTEN_INTERVAL_ 2 | |
328 | #define _RSON_CODE_ 2 | |
329 | #define _ASOC_ID_ 2 | |
330 | #define _STATUS_CODE_ 2 | |
331 | #define _TIMESTAMP_ 8 | |
332 | ||
333 | #define AUTH_ODD_TO 0 | |
334 | #define AUTH_EVEN_TO 1 | |
335 | ||
336 | #define WLAN_ETHCONV_ENCAP 1 | |
337 | #define WLAN_ETHCONV_RFC1042 2 | |
338 | #define WLAN_ETHCONV_8021h 3 | |
339 | ||
340 | #define cap_ESS BIT(0) | |
341 | #define cap_IBSS BIT(1) | |
342 | #define cap_CFPollable BIT(2) | |
343 | #define cap_CFRequest BIT(3) | |
344 | #define cap_Privacy BIT(4) | |
345 | #define cap_ShortPremble BIT(5) | |
346 | #define cap_PBCC BIT(6) | |
347 | #define cap_ChAgility BIT(7) | |
348 | #define cap_SpecMgmt BIT(8) | |
349 | #define cap_QoSi BIT(9) | |
350 | #define cap_ShortSlot BIT(10) | |
351 | ||
352 | /*----------------------------------------------------------------------------- | |
353 | Below is the definition for 802.11i / 802.1x | |
354 | ------------------------------------------------------------------------------*/ | |
355 | #define _IEEE8021X_MGT_ 1 /* WPA */ | |
356 | #define _IEEE8021X_PSK_ 2 /* WPA with pre-shared key */ | |
357 | ||
358 | /* | |
f6cadc1b AG |
359 | * #define _NO_PRIVACY_ 0 |
360 | * #define _WEP_40_PRIVACY_ 1 | |
361 | * #define _TKIP_PRIVACY_ 2 | |
362 | * #define _WRAP_PRIVACY_ 3 | |
363 | * #define _CCMP_PRIVACY_ 4 | |
364 | * #define _WEP_104_PRIVACY_ 5 | |
365 | * #define _WEP_WPA_MIXED_PRIVACY_ 6 WEP + WPA | |
366 | */ | |
9a602711 LF |
367 | |
368 | /*----------------------------------------------------------------------------- | |
369 | Below is the definition for WMM | |
370 | ------------------------------------------------------------------------------*/ | |
371 | #define _WMM_IE_Length_ 7 /* for WMM STA */ | |
372 | #define _WMM_Para_Element_Length_ 24 | |
373 | ||
9a602711 LF |
374 | /*----------------------------------------------------------------------------- |
375 | Below is the definition for 802.11n | |
376 | ------------------------------------------------------------------------------*/ | |
377 | ||
9a602711 LF |
378 | /** |
379 | * struct rtw_ieee80211_ht_cap - HT additional information | |
380 | * | |
381 | * This structure refers to "HT information element" as | |
382 | * described in 802.11n draft section 7.3.2.53 | |
383 | */ | |
384 | struct ieee80211_ht_addt_info { | |
385 | unsigned char control_chan; | |
386 | unsigned char ht_param; | |
387 | unsigned short operation_mode; | |
388 | unsigned short stbc_param; | |
389 | unsigned char basic_set[16]; | |
390 | } __packed; | |
391 | ||
9a602711 LF |
392 | struct HT_info_element { |
393 | unsigned char primary_channel; | |
394 | unsigned char infos[5]; | |
395 | unsigned char MCS_rate[16]; | |
396 | } __packed; | |
397 | ||
398 | struct AC_param { | |
399 | unsigned char ACI_AIFSN; | |
400 | unsigned char CW; | |
401 | __le16 TXOP_limit; | |
402 | } __packed; | |
403 | ||
404 | struct WMM_para_element { | |
405 | unsigned char QoS_info; | |
406 | unsigned char reserved; | |
407 | struct AC_param ac_param[4]; | |
408 | } __packed; | |
409 | ||
410 | struct ADDBA_request { | |
411 | unsigned char dialog_token; | |
c6b2dcdc | 412 | __le16 BA_para_set; |
9a602711 LF |
413 | unsigned short BA_timeout_value; |
414 | unsigned short BA_starting_seqctrl; | |
415 | } __packed; | |
416 | ||
417 | enum ht_cap_ampdu_factor { | |
418 | MAX_AMPDU_FACTOR_8K = 0, | |
419 | MAX_AMPDU_FACTOR_16K = 1, | |
420 | MAX_AMPDU_FACTOR_32K = 2, | |
421 | MAX_AMPDU_FACTOR_64K = 3, | |
422 | }; | |
423 | ||
9a602711 LF |
424 | #define OP_MODE_PURE 0 |
425 | #define OP_MODE_MAY_BE_LEGACY_STAS 1 | |
426 | #define OP_MODE_20MHZ_HT_STA_ASSOCED 2 | |
427 | #define OP_MODE_MIXED 3 | |
428 | ||
7be921a2 JH |
429 | #define HT_INFO_HT_PARAM_SECONDARY_CHNL_OFF_MASK ((u8)BIT(0) | BIT(1)) |
430 | #define HT_INFO_HT_PARAM_SECONDARY_CHNL_ABOVE ((u8)BIT(0)) | |
431 | #define HT_INFO_HT_PARAM_SECONDARY_CHNL_BELOW ((u8)BIT(0) | BIT(1)) | |
432 | #define HT_INFO_HT_PARAM_REC_TRANS_CHNL_WIDTH ((u8)BIT(2)) | |
433 | #define HT_INFO_HT_PARAM_RIFS_MODE ((u8)BIT(3)) | |
434 | #define HT_INFO_HT_PARAM_CTRL_ACCESS_ONLY ((u8)BIT(4)) | |
435 | #define HT_INFO_HT_PARAM_SRV_INTERVAL_GRANULARITY ((u8)BIT(5)) | |
9a602711 LF |
436 | |
437 | #define HT_INFO_OPERATION_MODE_OP_MODE_MASK \ | |
7be921a2 | 438 | ((u16)(0x0001 | 0x0002)) |
9a602711 | 439 | #define HT_INFO_OPERATION_MODE_OP_MODE_OFFSET 0 |
7be921a2 JH |
440 | #define HT_INFO_OPERATION_MODE_NON_GF_DEVS_PRESENT ((u8)BIT(2)) |
441 | #define HT_INFO_OPERATION_MODE_TRANSMIT_BURST_LIMIT ((u8)BIT(3)) | |
442 | #define HT_INFO_OPERATION_MODE_NON_HT_STA_PRESENT ((u8)BIT(4)) | |
443 | ||
444 | #define HT_INFO_STBC_PARAM_DUAL_BEACON ((u16)BIT(6)) | |
445 | #define HT_INFO_STBC_PARAM_DUAL_STBC_PROTECT ((u16)BIT(7)) | |
446 | #define HT_INFO_STBC_PARAM_SECONDARY_BC ((u16)BIT(8)) | |
447 | #define HT_INFO_STBC_PARAM_LSIG_TXOP_PROTECT_ALLOWED ((u16)BIT(9)) | |
448 | #define HT_INFO_STBC_PARAM_PCO_ACTIVE ((u16)BIT(10)) | |
449 | #define HT_INFO_STBC_PARAM_PCO_PHASE ((u16)BIT(11)) | |
9a602711 LF |
450 | |
451 | /* ===============WPS Section=============== */ | |
452 | /* For WPSv1.0 */ | |
453 | #define WPSOUI 0x0050f204 | |
454 | /* WPS attribute ID */ | |
455 | #define WPS_ATTR_VER1 0x104A | |
456 | #define WPS_ATTR_SIMPLE_CONF_STATE 0x1044 | |
457 | #define WPS_ATTR_RESP_TYPE 0x103B | |
458 | #define WPS_ATTR_UUID_E 0x1047 | |
459 | #define WPS_ATTR_MANUFACTURER 0x1021 | |
460 | #define WPS_ATTR_MODEL_NAME 0x1023 | |
461 | #define WPS_ATTR_MODEL_NUMBER 0x1024 | |
462 | #define WPS_ATTR_SERIAL_NUMBER 0x1042 | |
463 | #define WPS_ATTR_PRIMARY_DEV_TYPE 0x1054 | |
464 | #define WPS_ATTR_SEC_DEV_TYPE_LIST 0x1055 | |
465 | #define WPS_ATTR_DEVICE_NAME 0x1011 | |
466 | #define WPS_ATTR_CONF_METHOD 0x1008 | |
467 | #define WPS_ATTR_RF_BANDS 0x103C | |
468 | #define WPS_ATTR_DEVICE_PWID 0x1012 | |
469 | #define WPS_ATTR_REQUEST_TYPE 0x103A | |
470 | #define WPS_ATTR_ASSOCIATION_STATE 0x1002 | |
471 | #define WPS_ATTR_CONFIG_ERROR 0x1009 | |
472 | #define WPS_ATTR_VENDOR_EXT 0x1049 | |
473 | #define WPS_ATTR_SELECTED_REGISTRAR 0x1041 | |
474 | ||
9a602711 LF |
475 | /* Value of WPS Request Type Attribute */ |
476 | #define WPS_REQ_TYPE_ENROLLEE_INFO_ONLY 0x00 | |
477 | #define WPS_REQ_TYPE_ENROLLEE_OPEN_8021X 0x01 | |
478 | #define WPS_REQ_TYPE_REGISTRAR 0x02 | |
479 | #define WPS_REQ_TYPE_WLAN_MANAGER_REGISTRAR 0x03 | |
480 | ||
481 | /* Value of WPS Response Type Attribute */ | |
482 | #define WPS_RESPONSE_TYPE_INFO_ONLY 0x00 | |
483 | #define WPS_RESPONSE_TYPE_8021X 0x01 | |
484 | #define WPS_RESPONSE_TYPE_REGISTRAR 0x02 | |
485 | #define WPS_RESPONSE_TYPE_AP 0x03 | |
486 | ||
487 | /* Value of WPS WiFi Simple Configuration State Attribute */ | |
488 | #define WPS_WSC_STATE_NOT_CONFIG 0x01 | |
489 | #define WPS_WSC_STATE_CONFIG 0x02 | |
490 | ||
491 | /* Value of WPS Version Attribute */ | |
492 | #define WPS_VERSION_1 0x10 | |
493 | ||
494 | /* Value of WPS Configuration Method Attribute */ | |
495 | #define WPS_CONFIG_METHOD_FLASH 0x0001 | |
496 | #define WPS_CONFIG_METHOD_ETHERNET 0x0002 | |
497 | #define WPS_CONFIG_METHOD_LABEL 0x0004 | |
498 | #define WPS_CONFIG_METHOD_DISPLAY 0x0008 | |
499 | #define WPS_CONFIG_METHOD_E_NFC 0x0010 | |
500 | #define WPS_CONFIG_METHOD_I_NFC 0x0020 | |
501 | #define WPS_CONFIG_METHOD_NFC 0x0040 | |
502 | #define WPS_CONFIG_METHOD_PBC 0x0080 | |
503 | #define WPS_CONFIG_METHOD_KEYPAD 0x0100 | |
504 | #define WPS_CONFIG_METHOD_VPBC 0x0280 | |
505 | #define WPS_CONFIG_METHOD_PPBC 0x0480 | |
506 | #define WPS_CONFIG_METHOD_VDISPLAY 0x2008 | |
507 | #define WPS_CONFIG_METHOD_PDISPLAY 0x4008 | |
508 | ||
509 | /* Value of Category ID of WPS Primary Device Type Attribute */ | |
510 | #define WPS_PDT_CID_DISPLAYS 0x0007 | |
511 | #define WPS_PDT_CID_MULIT_MEDIA 0x0008 | |
512 | #define WPS_PDT_CID_RTK_WIDI WPS_PDT_CID_MULIT_MEDIA | |
513 | ||
514 | /* Value of Sub Category ID of WPS Primary Device Type Attribute */ | |
515 | #define WPS_PDT_SCID_MEDIA_SERVER 0x0005 | |
516 | #define WPS_PDT_SCID_RTK_DMP WPS_PDT_SCID_MEDIA_SERVER | |
517 | ||
518 | /* Value of Device Password ID */ | |
519 | #define WPS_DPID_P 0x0000 | |
520 | #define WPS_DPID_USER_SPEC 0x0001 | |
521 | #define WPS_DPID_MACHINE_SPEC 0x0002 | |
522 | #define WPS_DPID_REKEY 0x0003 | |
523 | #define WPS_DPID_PBC 0x0004 | |
524 | #define WPS_DPID_REGISTRAR_SPEC 0x0005 | |
525 | ||
526 | /* Value of WPS RF Bands Attribute */ | |
527 | #define WPS_RF_BANDS_2_4_GHZ 0x01 | |
528 | #define WPS_RF_BANDS_5_GHZ 0x02 | |
529 | ||
530 | /* Value of WPS Association State Attribute */ | |
531 | #define WPS_ASSOC_STATE_NOT_ASSOCIATED 0x00 | |
532 | #define WPS_ASSOC_STATE_CONNECTION_SUCCESS 0x01 | |
533 | #define WPS_ASSOC_STATE_CONFIGURATION_FAILURE 0x02 | |
534 | #define WPS_ASSOC_STATE_ASSOCIATION_FAILURE 0x03 | |
535 | #define WPS_ASSOC_STATE_IP_FAILURE 0x04 | |
536 | ||
9a602711 LF |
537 | /* WPS Configuration Method */ |
538 | #define WPS_CM_NONE 0x0000 | |
539 | #define WPS_CM_LABEL 0x0004 | |
540 | #define WPS_CM_DISPLYA 0x0008 | |
541 | #define WPS_CM_EXTERNAL_NFC_TOKEN 0x0010 | |
542 | #define WPS_CM_INTEGRATED_NFC_TOKEN 0x0020 | |
543 | #define WPS_CM_NFC_INTERFACE 0x0040 | |
544 | #define WPS_CM_PUSH_BUTTON 0x0080 | |
545 | #define WPS_CM_KEYPAD 0x0100 | |
546 | #define WPS_CM_SW_PUHS_BUTTON 0x0280 | |
547 | #define WPS_CM_HW_PUHS_BUTTON 0x0480 | |
548 | #define WPS_CM_SW_DISPLAY_P 0x2008 | |
549 | #define WPS_CM_LCD_DISPLAY_P 0x4008 | |
550 | ||
9a602711 LF |
551 | #define IP_MCAST_MAC(mac) \ |
552 | ((mac[0] == 0x01) && (mac[1] == 0x00) && (mac[2] == 0x5e)) | |
553 | #define ICMPV6_MCAST_MAC(mac) \ | |
554 | ((mac[0] == 0x33) && (mac[1] == 0x33) && (mac[2] != 0xff)) | |
555 | ||
556 | #endif /* _WIFI_H_ */ |