blob: a08a2e045e594a9f63d7b7d2f8939e4278c5d24c [file] [log] [blame]
Larry Finger9a602712013-08-21 22:34:14 -05001/******************************************************************************
2 *
3 * Copyright(c) 2007 - 2012 Realtek Corporation. All rights reserved.
4 *
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of version 2 of the GNU General Public License as
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * You should have received a copy of the GNU General Public License along with
15 * this program; if not, write to the Free Software Foundation, Inc.,
16 * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
17 *
18 *
19 ******************************************************************************/
20#ifndef _WIFI_H_
21#define _WIFI_H_
22
23
24#ifdef BIT
25/* error "BIT define occurred earlier elsewhere!\n" */
26#undef BIT
27#endif
28#define BIT(x) (1 << (x))
29
30
31#define WLAN_ETHHDR_LEN 14
32#define WLAN_ETHADDR_LEN 6
33#define WLAN_IEEE_OUI_LEN 3
34#define WLAN_ADDR_LEN 6
35#define WLAN_CRC_LEN 4
36#define WLAN_BSSID_LEN 6
37#define WLAN_BSS_TS_LEN 8
38#define WLAN_HDR_A3_LEN 24
39#define WLAN_HDR_A4_LEN 30
40#define WLAN_HDR_A3_QOS_LEN 26
41#define WLAN_HDR_A4_QOS_LEN 32
42#define WLAN_SSID_MAXLEN 32
43#define WLAN_DATA_MAXLEN 2312
44
45#define WLAN_A3_PN_OFFSET 24
46#define WLAN_A4_PN_OFFSET 30
47
48#define WLAN_MIN_ETHFRM_LEN 60
49#define WLAN_MAX_ETHFRM_LEN 1514
50#define WLAN_ETHHDR_LEN 14
51
52#define P80211CAPTURE_VERSION 0x80211001
53
54/* This value is tested by WiFi 11n Test Plan 5.2.3. */
55/* This test verifies the WLAN NIC can update the NAV through sending
56 * the CTS with large duration. */
57#define WiFiNavUpperUs 30000 /* 30 ms */
58
59enum WIFI_FRAME_TYPE {
60 WIFI_MGT_TYPE = (0),
61 WIFI_CTRL_TYPE = (BIT(2)),
62 WIFI_DATA_TYPE = (BIT(3)),
63 WIFI_QOS_DATA_TYPE = (BIT(7)|BIT(3)), /* QoS Data */
64};
65
66enum WIFI_FRAME_SUBTYPE {
67 /* below is for mgt frame */
68 WIFI_ASSOCREQ = (0 | WIFI_MGT_TYPE),
69 WIFI_ASSOCRSP = (BIT(4) | WIFI_MGT_TYPE),
70 WIFI_REASSOCREQ = (BIT(5) | WIFI_MGT_TYPE),
71 WIFI_REASSOCRSP = (BIT(5) | BIT(4) | WIFI_MGT_TYPE),
72 WIFI_PROBEREQ = (BIT(6) | WIFI_MGT_TYPE),
73 WIFI_PROBERSP = (BIT(6) | BIT(4) | WIFI_MGT_TYPE),
74 WIFI_BEACON = (BIT(7) | WIFI_MGT_TYPE),
75 WIFI_ATIM = (BIT(7) | BIT(4) | WIFI_MGT_TYPE),
76 WIFI_DISASSOC = (BIT(7) | BIT(5) | WIFI_MGT_TYPE),
77 WIFI_AUTH = (BIT(7) | BIT(5) | BIT(4) | WIFI_MGT_TYPE),
78 WIFI_DEAUTH = (BIT(7) | BIT(6) | WIFI_MGT_TYPE),
79 WIFI_ACTION = (BIT(7) | BIT(6) | BIT(4) | WIFI_MGT_TYPE),
80
81 /* below is for control frame */
82 WIFI_PSPOLL = (BIT(7) | BIT(5) | WIFI_CTRL_TYPE),
83 WIFI_RTS = (BIT(7) | BIT(5) | BIT(4) | WIFI_CTRL_TYPE),
84 WIFI_CTS = (BIT(7) | BIT(6) | WIFI_CTRL_TYPE),
85 WIFI_ACK = (BIT(7) | BIT(6) | BIT(4) | WIFI_CTRL_TYPE),
86 WIFI_CFEND = (BIT(7) | BIT(6) | BIT(5) | WIFI_CTRL_TYPE),
87 WIFI_CFEND_CFACK = (BIT(7) | BIT(6) | BIT(5) | BIT(4) |
88 WIFI_CTRL_TYPE),
89
90 /* below is for data frame */
91 WIFI_DATA = (0 | WIFI_DATA_TYPE),
92 WIFI_DATA_CFACK = (BIT(4) | WIFI_DATA_TYPE),
93 WIFI_DATA_CFPOLL = (BIT(5) | WIFI_DATA_TYPE),
94 WIFI_DATA_CFACKPOLL = (BIT(5) | BIT(4) | WIFI_DATA_TYPE),
95 WIFI_DATA_NULL = (BIT(6) | WIFI_DATA_TYPE),
96 WIFI_CF_ACK = (BIT(6) | BIT(4) | WIFI_DATA_TYPE),
97 WIFI_CF_POLL = (BIT(6) | BIT(5) | WIFI_DATA_TYPE),
98 WIFI_CF_ACKPOLL = (BIT(6) | BIT(5) | BIT(4) | WIFI_DATA_TYPE),
99 WIFI_QOS_DATA_NULL = (BIT(6) | WIFI_QOS_DATA_TYPE),
100};
101
102enum WIFI_REASON_CODE {
103 _RSON_RESERVED_ = 0,
104 _RSON_UNSPECIFIED_ = 1,
105 _RSON_AUTH_NO_LONGER_VALID_ = 2,
106 _RSON_DEAUTH_STA_LEAVING_ = 3,
107 _RSON_INACTIVITY_ = 4,
108 _RSON_UNABLE_HANDLE_ = 5,
109 _RSON_CLS2_ = 6,
110 _RSON_CLS3_ = 7,
111 _RSON_DISAOC_STA_LEAVING_ = 8,
112 _RSON_ASOC_NOT_AUTH_ = 9,
113
114 /* WPA reason */
115 _RSON_INVALID_IE_ = 13,
116 _RSON_MIC_FAILURE_ = 14,
117 _RSON_4WAY_HNDSHK_TIMEOUT_ = 15,
118 _RSON_GROUP_KEY_UPDATE_TIMEOUT_ = 16,
119 _RSON_DIFF_IE_ = 17,
120 _RSON_MLTCST_CIPHER_NOT_VALID_ = 18,
121 _RSON_UNICST_CIPHER_NOT_VALID_ = 19,
122 _RSON_AKMP_NOT_VALID_ = 20,
123 _RSON_UNSUPPORT_RSNE_VER_ = 21,
124 _RSON_INVALID_RSNE_CAP_ = 22,
125 _RSON_IEEE_802DOT1X_AUTH_FAIL_ = 23,
126
127 /* belowing are Realtek definition */
128 _RSON_PMK_NOT_AVAILABLE_ = 24,
129 _RSON_TDLS_TEAR_TOOFAR_ = 25,
130 _RSON_TDLS_TEAR_UN_RSN_ = 26,
131};
132
Larry Finger9a602712013-08-21 22:34:14 -0500133enum WIFI_STATUS_CODE {
134 _STATS_SUCCESSFUL_ = 0,
135 _STATS_FAILURE_ = 1,
136 _STATS_CAP_FAIL_ = 10,
137 _STATS_NO_ASOC_ = 11,
138 _STATS_OTHER_ = 12,
139 _STATS_NO_SUPP_ALG_ = 13,
140 _STATS_OUT_OF_AUTH_SEQ_ = 14,
141 _STATS_CHALLENGE_FAIL_ = 15,
142 _STATS_AUTH_TIMEOUT_ = 16,
143 _STATS_UNABLE_HANDLE_STA_ = 17,
144 _STATS_RATE_FAIL_ = 18,
145};
146
Larry Finger9a602712013-08-21 22:34:14 -0500147enum WIFI_REG_DOMAIN {
148 DOMAIN_FCC = 1,
149 DOMAIN_IC = 2,
150 DOMAIN_ETSI = 3,
151 DOMAIN_SPA = 4,
152 DOMAIN_FRANCE = 5,
153 DOMAIN_MKK = 6,
154 DOMAIN_ISRAEL = 7,
155 DOMAIN_MKK1 = 8,
156 DOMAIN_MKK2 = 9,
157 DOMAIN_MKK3 = 10,
158 DOMAIN_MAX
159};
160
161#define _TO_DS_ BIT(8)
162#define _FROM_DS_ BIT(9)
163#define _MORE_FRAG_ BIT(10)
164#define _RETRY_ BIT(11)
165#define _PWRMGT_ BIT(12)
166#define _MORE_DATA_ BIT(13)
167#define _PRIVACY_ BIT(14)
168#define _ORDER_ BIT(15)
169
170#define SetToDs(pbuf) \
171 *(__le16 *)(pbuf) |= cpu_to_le16(_TO_DS_)
172
173#define GetToDs(pbuf) (((*(__le16 *)(pbuf)) & cpu_to_le16(_TO_DS_)) != 0)
174
175#define ClearToDs(pbuf) \
176 *(__le16 *)(pbuf) &= (~cpu_to_le16(_TO_DS_))
177
178#define SetFrDs(pbuf) \
179 *(__le16 *)(pbuf) |= cpu_to_le16(_FROM_DS_)
180
181#define GetFrDs(pbuf) (((*(__le16 *)(pbuf)) & cpu_to_le16(_FROM_DS_)) != 0)
182
183#define ClearFrDs(pbuf) \
184 *(__le16 *)(pbuf) &= (~cpu_to_le16(_FROM_DS_))
185
186#define get_tofr_ds(pframe) ((GetToDs(pframe) << 1) | GetFrDs(pframe))
187
188
189#define SetMFrag(pbuf) \
190 *(__le16 *)(pbuf) |= cpu_to_le16(_MORE_FRAG_)
191
192#define GetMFrag(pbuf) (((*(__le16 *)(pbuf)) & cpu_to_le16(_MORE_FRAG_)) != 0)
193
194#define ClearMFrag(pbuf) \
195 *(__le16 *)(pbuf) &= (~cpu_to_le16(_MORE_FRAG_))
196
197#define SetRetry(pbuf) \
198 *(__le16 *)(pbuf) |= cpu_to_le16(_RETRY_)
199
200#define GetRetry(pbuf) (((*(__le16 *)(pbuf)) & cpu_to_le16(_RETRY_)) != 0)
201
202#define ClearRetry(pbuf) \
203 *(__le16 *)(pbuf) &= (~cpu_to_le16(_RETRY_))
204
205#define SetPwrMgt(pbuf) \
206 *(__le16 *)(pbuf) |= cpu_to_le16(_PWRMGT_)
207
208#define GetPwrMgt(pbuf) (((*(__le16 *)(pbuf)) & cpu_to_le16(_PWRMGT_)) != 0)
209
210#define ClearPwrMgt(pbuf) \
211 *(__le16 *)(pbuf) &= (~cpu_to_le16(_PWRMGT_))
212
213#define SetMData(pbuf) \
214 *(__le16 *)(pbuf) |= cpu_to_le16(_MORE_DATA_)
215
216#define GetMData(pbuf) (((*(__le16 *)(pbuf)) & cpu_to_le16(_MORE_DATA_)) != 0)
217
218#define ClearMData(pbuf) \
219 *(__le16 *)(pbuf) &= (~cpu_to_le16(_MORE_DATA_))
220
221#define SetPrivacy(pbuf) \
222 *(__le16 *)(pbuf) |= cpu_to_le16(_PRIVACY_)
223
224#define GetPrivacy(pbuf) \
225 (((*(__le16 *)(pbuf)) & cpu_to_le16(_PRIVACY_)) != 0)
226
Larry Finger9a602712013-08-21 22:34:14 -0500227#define GetOrder(pbuf) \
228 (((*(__le16 *)(pbuf)) & cpu_to_le16(_ORDER_)) != 0)
229
230#define GetFrameType(pbuf) \
231 (le16_to_cpu(*(__le16 *)(pbuf)) & (BIT(3) | BIT(2)))
232
Larry Finger9a602712013-08-21 22:34:14 -0500233#define GetFrameSubType(pbuf) (le16_to_cpu(*(__le16 *)(pbuf)) & (BIT(7) |\
234 BIT(6) | BIT(5) | BIT(4) | BIT(3) | BIT(2)))
235
236#define SetFrameSubType(pbuf, type) \
237 do { \
238 *(__le16 *)(pbuf) &= cpu_to_le16(~(BIT(7) | BIT(6) | \
239 BIT(5) | BIT(4) | BIT(3) | BIT(2))); \
240 *(__le16 *)(pbuf) |= cpu_to_le16(type); \
241 } while (0)
242
243#define GetSequence(pbuf) \
244 (le16_to_cpu(*(__le16 *)((size_t)(pbuf) + 22)) >> 4)
245
246#define GetFragNum(pbuf) \
247 (le16_to_cpu(*(__le16 *)((size_t)(pbuf) + 22)) & 0x0f)
248
Larry Finger9a602712013-08-21 22:34:14 -0500249#define SetSeqNum(pbuf, num) \
250 do { \
251 *(__le16 *)((size_t)(pbuf) + 22) = \
252 ((*(__le16 *)((size_t)(pbuf) + 22)) & cpu_to_le16((unsigned short)0x000f)) | \
253 cpu_to_le16((unsigned short)(0xfff0 & (num << 4))); \
254 } while (0)
255
256#define SetDuration(pbuf, dur) \
257 *(__le16 *)((size_t)(pbuf) + 2) = cpu_to_le16(0xffff & (dur))
258
259
260#define SetPriority(pbuf, tid) \
261 *(__le16 *)(pbuf) |= cpu_to_le16(tid & 0xf)
262
263#define GetPriority(pbuf) ((le16_to_cpu(*(__le16 *)(pbuf))) & 0xf)
264
265#define SetEOSP(pbuf, eosp) \
266 *(__le16 *)(pbuf) |= cpu_to_le16((eosp & 1) << 4)
267
268#define SetAckpolicy(pbuf, ack) \
269 *(__le16 *)(pbuf) |= cpu_to_le16((ack & 3) << 5)
270
271#define GetAckpolicy(pbuf) (((le16_to_cpu(*(__le16 *)pbuf)) >> 5) & 0x3)
272
273#define GetAMsdu(pbuf) (((le16_to_cpu(*(__le16 *)pbuf)) >> 7) & 0x1)
274
Larry Finger9a602712013-08-21 22:34:14 -0500275#define GetAid(pbuf) (le16_to_cpu(*(__le16 *)((size_t)(pbuf) + 2)) & 0x3fff)
276
Larry Finger9a602712013-08-21 22:34:14 -0500277#define GetAddr1Ptr(pbuf) ((unsigned char *)((size_t)(pbuf) + 4))
278
279#define GetAddr2Ptr(pbuf) ((unsigned char *)((size_t)(pbuf) + 10))
280
281#define GetAddr3Ptr(pbuf) ((unsigned char *)((size_t)(pbuf) + 16))
282
283#define GetAddr4Ptr(pbuf) ((unsigned char *)((size_t)(pbuf) + 24))
284
285#define MacAddr_isBcst(addr) \
286 ( \
287 ((addr[0] == 0xff) && (addr[1] == 0xff) && \
288 (addr[2] == 0xff) && (addr[3] == 0xff) && \
289 (addr[4] == 0xff) && (addr[5] == 0xff)) ? true : false \
290)
291
292static inline int IS_MCAST(unsigned char *da)
293{
294 if ((*da) & 0x01)
295 return true;
296 else
297 return false;
298}
299
300static inline unsigned char *get_da(unsigned char *pframe)
301{
302 unsigned char *da;
303 unsigned int to_fr_ds = (GetToDs(pframe) << 1) | GetFrDs(pframe);
304
305 switch (to_fr_ds) {
306 case 0x00: /* ToDs=0, FromDs=0 */
307 da = GetAddr1Ptr(pframe);
308 break;
309 case 0x01: /* ToDs=0, FromDs=1 */
310 da = GetAddr1Ptr(pframe);
311 break;
312 case 0x02: /* ToDs=1, FromDs=0 */
313 da = GetAddr3Ptr(pframe);
314 break;
315 default: /* ToDs=1, FromDs=1 */
316 da = GetAddr3Ptr(pframe);
317 break;
318 }
319 return da;
320}
321
322static inline unsigned char *get_sa(unsigned char *pframe)
323{
324 unsigned char *sa;
325 unsigned int to_fr_ds = (GetToDs(pframe) << 1) | GetFrDs(pframe);
326
327 switch (to_fr_ds) {
328 case 0x00: /* ToDs=0, FromDs=0 */
329 sa = GetAddr2Ptr(pframe);
330 break;
331 case 0x01: /* ToDs=0, FromDs=1 */
332 sa = GetAddr3Ptr(pframe);
333 break;
334 case 0x02: /* ToDs=1, FromDs=0 */
335 sa = GetAddr2Ptr(pframe);
336 break;
337 default: /* ToDs=1, FromDs=1 */
338 sa = GetAddr4Ptr(pframe);
339 break;
340 }
341 return sa;
342}
343
344static inline unsigned char *get_hdr_bssid(unsigned char *pframe)
345{
346 unsigned char *sa;
347 unsigned int to_fr_ds = (GetToDs(pframe) << 1) | GetFrDs(pframe);
348
349 switch (to_fr_ds) {
350 case 0x00: /* ToDs=0, FromDs=0 */
351 sa = GetAddr3Ptr(pframe);
352 break;
353 case 0x01: /* ToDs=0, FromDs=1 */
354 sa = GetAddr2Ptr(pframe);
355 break;
356 case 0x02: /* ToDs=1, FromDs=0 */
357 sa = GetAddr1Ptr(pframe);
358 break;
359 case 0x03: /* ToDs=1, FromDs=1 */
360 sa = GetAddr1Ptr(pframe);
361 break;
362 default:
363 sa = NULL; /* */
364 break;
365 }
366 return sa;
367}
368
369static inline int IsFrameTypeCtrl(unsigned char *pframe)
370{
371 if (WIFI_CTRL_TYPE == GetFrameType(pframe))
372 return true;
373 else
374 return false;
375}
376/*-----------------------------------------------------------------------------
377 Below is for the security related definition
378------------------------------------------------------------------------------*/
379#define _RESERVED_FRAME_TYPE_ 0
380#define _SKB_FRAME_TYPE_ 2
381#define _PRE_ALLOCMEM_ 1
382#define _PRE_ALLOCHDR_ 3
383#define _PRE_ALLOCLLCHDR_ 4
384#define _PRE_ALLOCICVHDR_ 5
385#define _PRE_ALLOCMICHDR_ 6
386
387#define _SIFSTIME_ \
388 ((priv->pmib->dot11BssType.net_work_type & WIRELESS_11A) ? 16 : 10)
389#define _ACKCTSLNG_ 14 /* 14 bytes long, including crclng */
390#define _CRCLNG_ 4
391
392#define _ASOCREQ_IE_OFFSET_ 4 /* excluding wlan_hdr */
393#define _ASOCRSP_IE_OFFSET_ 6
394#define _REASOCREQ_IE_OFFSET_ 10
395#define _REASOCRSP_IE_OFFSET_ 6
396#define _PROBEREQ_IE_OFFSET_ 0
397#define _PROBERSP_IE_OFFSET_ 12
398#define _AUTH_IE_OFFSET_ 6
399#define _DEAUTH_IE_OFFSET_ 0
400#define _BEACON_IE_OFFSET_ 12
401#define _PUBLIC_ACTION_IE_OFFSET_ 8
402
403#define _FIXED_IE_LENGTH_ _BEACON_IE_OFFSET_
404
405#define _SSID_IE_ 0
406#define _SUPPORTEDRATES_IE_ 1
407#define _DSSET_IE_ 3
408#define _TIM_IE_ 5
409#define _IBSS_PARA_IE_ 6
410#define _COUNTRY_IE_ 7
411#define _CHLGETXT_IE_ 16
412#define _SUPPORTED_CH_IE_ 36
413#define _CH_SWTICH_ANNOUNCE_ 37 /* Secondary Channel Offset */
414#define _RSN_IE_2_ 48
415#define _SSN_IE_1_ 221
416#define _ERPINFO_IE_ 42
417#define _EXT_SUPPORTEDRATES_IE_ 50
418
419#define _HT_CAPABILITY_IE_ 45
420#define _FTIE_ 55
421#define _TIMEOUT_ITVL_IE_ 56
422#define _SRC_IE_ 59
423#define _HT_EXTRA_INFO_IE_ 61
424#define _HT_ADD_INFO_IE_ 61 /* _HT_EXTRA_INFO_IE_ */
425#define _WAPI_IE_ 68
426
427
428#define EID_BSSCoexistence 72 /* 20/40 BSS Coexistence */
429#define EID_BSSIntolerantChlReport 73
430#define _RIC_Descriptor_IE_ 75
431
432#define _LINK_ID_IE_ 101
433#define _CH_SWITCH_TIMING_ 104
434#define _PTI_BUFFER_STATUS_ 106
435#define _EXT_CAP_IE_ 127
436#define _VENDOR_SPECIFIC_IE_ 221
437
438#define _RESERVED47_ 47
439
440/* ---------------------------------------------------------------------------
441 Below is the fixed elements...
442-----------------------------------------------------------------------------*/
443#define _AUTH_ALGM_NUM_ 2
444#define _AUTH_SEQ_NUM_ 2
445#define _BEACON_ITERVAL_ 2
446#define _CAPABILITY_ 2
447#define _CURRENT_APADDR_ 6
448#define _LISTEN_INTERVAL_ 2
449#define _RSON_CODE_ 2
450#define _ASOC_ID_ 2
451#define _STATUS_CODE_ 2
452#define _TIMESTAMP_ 8
453
454#define AUTH_ODD_TO 0
455#define AUTH_EVEN_TO 1
456
457#define WLAN_ETHCONV_ENCAP 1
458#define WLAN_ETHCONV_RFC1042 2
459#define WLAN_ETHCONV_8021h 3
460
461#define cap_ESS BIT(0)
462#define cap_IBSS BIT(1)
463#define cap_CFPollable BIT(2)
464#define cap_CFRequest BIT(3)
465#define cap_Privacy BIT(4)
466#define cap_ShortPremble BIT(5)
467#define cap_PBCC BIT(6)
468#define cap_ChAgility BIT(7)
469#define cap_SpecMgmt BIT(8)
470#define cap_QoSi BIT(9)
471#define cap_ShortSlot BIT(10)
472
473/*-----------------------------------------------------------------------------
474 Below is the definition for 802.11i / 802.1x
475------------------------------------------------------------------------------*/
476#define _IEEE8021X_MGT_ 1 /* WPA */
477#define _IEEE8021X_PSK_ 2 /* WPA with pre-shared key */
478
479/*
480#define _NO_PRIVACY_ 0
481#define _WEP_40_PRIVACY_ 1
482#define _TKIP_PRIVACY_ 2
483#define _WRAP_PRIVACY_ 3
484#define _CCMP_PRIVACY_ 4
485#define _WEP_104_PRIVACY_ 5
486#define _WEP_WPA_MIXED_PRIVACY_ 6 WEP + WPA
487*/
488
489/*-----------------------------------------------------------------------------
490 Below is the definition for WMM
491------------------------------------------------------------------------------*/
492#define _WMM_IE_Length_ 7 /* for WMM STA */
493#define _WMM_Para_Element_Length_ 24
494
495
496/*-----------------------------------------------------------------------------
497 Below is the definition for 802.11n
498------------------------------------------------------------------------------*/
499
500#define SetOrderBit(pbuf) \
501 do { \
502 *(unsigned short *)(pbuf) |= cpu_to_le16(_ORDER_); \
503 } while (0)
504
505#define GetOrderBit(pbuf) \
506 (((*(unsigned short *)(pbuf)) & le16_to_cpu(_ORDER_)) != 0)
507
508
509/**
510 * struct rtw_ieee80211_bar - HT Block Ack Request
511 *
512 * This structure refers to "HT BlockAckReq" as
513 * described in 802.11n draft section 7.2.1.7.1
514 */
515struct rtw_ieee80211_bar {
516 unsigned short frame_control;
517 unsigned short duration;
518 unsigned char ra[6];
519 unsigned char ta[6];
520 unsigned short control;
521 unsigned short start_seq_num;
522} __packed;
523
524/* 802.11 BAR control masks */
525#define IEEE80211_BAR_CTRL_ACK_POLICY_NORMAL 0x0000
526#define IEEE80211_BAR_CTRL_CBMTID_COMPRESSED_BA 0x0004
527
528 /**
529 * struct rtw_ieee80211_ht_cap - HT capabilities
530 *
531 * This structure refers to "HT capabilities element" as
532 * described in 802.11n draft section 7.3.2.52
533 */
534
535struct rtw_ieee80211_ht_cap {
536 unsigned short cap_info;
537 unsigned char ampdu_params_info;
538 unsigned char supp_mcs_set[16];
539 unsigned short extended_ht_cap_info;
540 unsigned int tx_BF_cap_info;
541 unsigned char antenna_selection_info;
542} __packed;
543
544/**
545 * struct rtw_ieee80211_ht_cap - HT additional information
546 *
547 * This structure refers to "HT information element" as
548 * described in 802.11n draft section 7.3.2.53
549 */
550struct ieee80211_ht_addt_info {
551 unsigned char control_chan;
552 unsigned char ht_param;
553 unsigned short operation_mode;
554 unsigned short stbc_param;
555 unsigned char basic_set[16];
556} __packed;
557
558struct HT_caps_element {
559 union {
560 struct {
561 __le16 HT_caps_info;
562 unsigned char AMPDU_para;
563 unsigned char MCS_rate[16];
564 unsigned short HT_ext_caps;
565 unsigned int Beamforming_caps;
566 unsigned char ASEL_caps;
567 } HT_cap_element;
568 unsigned char HT_cap[26];
569 } u;
570} __packed;
571
572struct HT_info_element {
573 unsigned char primary_channel;
574 unsigned char infos[5];
575 unsigned char MCS_rate[16];
576} __packed;
577
578struct AC_param {
579 unsigned char ACI_AIFSN;
580 unsigned char CW;
581 __le16 TXOP_limit;
582} __packed;
583
584struct WMM_para_element {
585 unsigned char QoS_info;
586 unsigned char reserved;
587 struct AC_param ac_param[4];
588} __packed;
589
590struct ADDBA_request {
591 unsigned char dialog_token;
Monam Agarwalc6b2dcd2014-03-06 03:33:59 +0530592 __le16 BA_para_set;
Larry Finger9a602712013-08-21 22:34:14 -0500593 unsigned short BA_timeout_value;
594 unsigned short BA_starting_seqctrl;
595} __packed;
596
597enum ht_cap_ampdu_factor {
598 MAX_AMPDU_FACTOR_8K = 0,
599 MAX_AMPDU_FACTOR_16K = 1,
600 MAX_AMPDU_FACTOR_32K = 2,
601 MAX_AMPDU_FACTOR_64K = 3,
602};
603
604/* 802.11n HT capabilities masks */
605#define IEEE80211_HT_CAP_SUP_WIDTH 0x0002
606#define IEEE80211_HT_CAP_SM_PS 0x000C
607#define IEEE80211_HT_CAP_GRN_FLD 0x0010
608#define IEEE80211_HT_CAP_SGI_20 0x0020
609#define IEEE80211_HT_CAP_SGI_40 0x0040
610#define IEEE80211_HT_CAP_TX_STBC 0x0080
611#define IEEE80211_HT_CAP_RX_STBC 0x0300
612#define IEEE80211_HT_CAP_DELAY_BA 0x0400
613#define IEEE80211_HT_CAP_MAX_AMSDU 0x0800
614#define IEEE80211_HT_CAP_DSSSCCK40 0x1000
615/* 802.11n HT capability AMPDU settings */
616#define IEEE80211_HT_CAP_AMPDU_FACTOR 0x03
617#define IEEE80211_HT_CAP_AMPDU_DENSITY 0x1C
618/* 802.11n HT capability MSC set */
619#define IEEE80211_SUPP_MCS_SET_UEQM 4
620#define IEEE80211_HT_CAP_MAX_STREAMS 4
621#define IEEE80211_SUPP_MCS_SET_LEN 10
622/* maximum streams the spec allows */
623#define IEEE80211_HT_CAP_MCS_TX_DEFINED 0x01
624#define IEEE80211_HT_CAP_MCS_TX_RX_DIFF 0x02
625#define IEEE80211_HT_CAP_MCS_TX_STREAMS 0x0C
626#define IEEE80211_HT_CAP_MCS_TX_UEQM 0x10
627/* 802.11n HT IE masks */
628#define IEEE80211_HT_IE_CHA_SEC_OFFSET 0x03
629#define IEEE80211_HT_IE_CHA_SEC_NONE 0x00
630#define IEEE80211_HT_IE_CHA_SEC_ABOVE 0x01
631#define IEEE80211_HT_IE_CHA_SEC_BELOW 0x03
632#define IEEE80211_HT_IE_CHA_WIDTH 0x04
633#define IEEE80211_HT_IE_HT_PROTECTION 0x0003
634#define IEEE80211_HT_IE_NON_GF_STA_PRSNT 0x0004
635#define IEEE80211_HT_IE_NON_HT_STA_PRSNT 0x0010
636
637/* block-ack parameters */
638#define IEEE80211_ADDBA_PARAM_POLICY_MASK 0x0002
639#define IEEE80211_ADDBA_PARAM_TID_MASK 0x003C
640#define RTW_IEEE80211_ADDBA_PARAM_BUF_SIZE_MASK 0xFFC0
641#define IEEE80211_DELBA_PARAM_TID_MASK 0xF000
642#define IEEE80211_DELBA_PARAM_INITIATOR_MASK 0x0800
643
644/*
645 * A-PMDU buffer sizes
646 * According to IEEE802.11n spec size varies from 8K to 64K (in powers of 2)
647 */
648#define IEEE80211_MIN_AMPDU_BUF 0x8
649#define IEEE80211_MAX_AMPDU_BUF 0x40
650
651
652/* Spatial Multiplexing Power Save Modes */
653#define WLAN_HT_CAP_SM_PS_STATIC 0
654#define WLAN_HT_CAP_SM_PS_DYNAMIC 1
655#define WLAN_HT_CAP_SM_PS_INVALID 2
656#define WLAN_HT_CAP_SM_PS_DISABLED 3
657
658
659#define OP_MODE_PURE 0
660#define OP_MODE_MAY_BE_LEGACY_STAS 1
661#define OP_MODE_20MHZ_HT_STA_ASSOCED 2
662#define OP_MODE_MIXED 3
663
Jia He7be921a22014-11-04 09:39:58 +0800664#define HT_INFO_HT_PARAM_SECONDARY_CHNL_OFF_MASK ((u8)BIT(0) | BIT(1))
665#define HT_INFO_HT_PARAM_SECONDARY_CHNL_ABOVE ((u8)BIT(0))
666#define HT_INFO_HT_PARAM_SECONDARY_CHNL_BELOW ((u8)BIT(0) | BIT(1))
667#define HT_INFO_HT_PARAM_REC_TRANS_CHNL_WIDTH ((u8)BIT(2))
668#define HT_INFO_HT_PARAM_RIFS_MODE ((u8)BIT(3))
669#define HT_INFO_HT_PARAM_CTRL_ACCESS_ONLY ((u8)BIT(4))
670#define HT_INFO_HT_PARAM_SRV_INTERVAL_GRANULARITY ((u8)BIT(5))
Larry Finger9a602712013-08-21 22:34:14 -0500671
672#define HT_INFO_OPERATION_MODE_OP_MODE_MASK \
Jia He7be921a22014-11-04 09:39:58 +0800673 ((u16)(0x0001 | 0x0002))
Larry Finger9a602712013-08-21 22:34:14 -0500674#define HT_INFO_OPERATION_MODE_OP_MODE_OFFSET 0
Jia He7be921a22014-11-04 09:39:58 +0800675#define HT_INFO_OPERATION_MODE_NON_GF_DEVS_PRESENT ((u8)BIT(2))
676#define HT_INFO_OPERATION_MODE_TRANSMIT_BURST_LIMIT ((u8)BIT(3))
677#define HT_INFO_OPERATION_MODE_NON_HT_STA_PRESENT ((u8)BIT(4))
Larry Finger9a602712013-08-21 22:34:14 -0500678
Jia He7be921a22014-11-04 09:39:58 +0800679#define HT_INFO_STBC_PARAM_DUAL_BEACON ((u16)BIT(6))
680#define HT_INFO_STBC_PARAM_DUAL_STBC_PROTECT ((u16)BIT(7))
681#define HT_INFO_STBC_PARAM_SECONDARY_BC ((u16)BIT(8))
682#define HT_INFO_STBC_PARAM_LSIG_TXOP_PROTECT_ALLOWED ((u16)BIT(9))
683#define HT_INFO_STBC_PARAM_PCO_ACTIVE ((u16)BIT(10))
684#define HT_INFO_STBC_PARAM_PCO_PHASE ((u16)BIT(11))
Larry Finger9a602712013-08-21 22:34:14 -0500685
686/* ===============WPS Section=============== */
687/* For WPSv1.0 */
688#define WPSOUI 0x0050f204
689/* WPS attribute ID */
690#define WPS_ATTR_VER1 0x104A
691#define WPS_ATTR_SIMPLE_CONF_STATE 0x1044
692#define WPS_ATTR_RESP_TYPE 0x103B
693#define WPS_ATTR_UUID_E 0x1047
694#define WPS_ATTR_MANUFACTURER 0x1021
695#define WPS_ATTR_MODEL_NAME 0x1023
696#define WPS_ATTR_MODEL_NUMBER 0x1024
697#define WPS_ATTR_SERIAL_NUMBER 0x1042
698#define WPS_ATTR_PRIMARY_DEV_TYPE 0x1054
699#define WPS_ATTR_SEC_DEV_TYPE_LIST 0x1055
700#define WPS_ATTR_DEVICE_NAME 0x1011
701#define WPS_ATTR_CONF_METHOD 0x1008
702#define WPS_ATTR_RF_BANDS 0x103C
703#define WPS_ATTR_DEVICE_PWID 0x1012
704#define WPS_ATTR_REQUEST_TYPE 0x103A
705#define WPS_ATTR_ASSOCIATION_STATE 0x1002
706#define WPS_ATTR_CONFIG_ERROR 0x1009
707#define WPS_ATTR_VENDOR_EXT 0x1049
708#define WPS_ATTR_SELECTED_REGISTRAR 0x1041
709
710/* Value of WPS attribute "WPS_ATTR_DEVICE_NAME */
711#define WPS_MAX_DEVICE_NAME_LEN 32
712
713/* Value of WPS Request Type Attribute */
714#define WPS_REQ_TYPE_ENROLLEE_INFO_ONLY 0x00
715#define WPS_REQ_TYPE_ENROLLEE_OPEN_8021X 0x01
716#define WPS_REQ_TYPE_REGISTRAR 0x02
717#define WPS_REQ_TYPE_WLAN_MANAGER_REGISTRAR 0x03
718
719/* Value of WPS Response Type Attribute */
720#define WPS_RESPONSE_TYPE_INFO_ONLY 0x00
721#define WPS_RESPONSE_TYPE_8021X 0x01
722#define WPS_RESPONSE_TYPE_REGISTRAR 0x02
723#define WPS_RESPONSE_TYPE_AP 0x03
724
725/* Value of WPS WiFi Simple Configuration State Attribute */
726#define WPS_WSC_STATE_NOT_CONFIG 0x01
727#define WPS_WSC_STATE_CONFIG 0x02
728
729/* Value of WPS Version Attribute */
730#define WPS_VERSION_1 0x10
731
732/* Value of WPS Configuration Method Attribute */
733#define WPS_CONFIG_METHOD_FLASH 0x0001
734#define WPS_CONFIG_METHOD_ETHERNET 0x0002
735#define WPS_CONFIG_METHOD_LABEL 0x0004
736#define WPS_CONFIG_METHOD_DISPLAY 0x0008
737#define WPS_CONFIG_METHOD_E_NFC 0x0010
738#define WPS_CONFIG_METHOD_I_NFC 0x0020
739#define WPS_CONFIG_METHOD_NFC 0x0040
740#define WPS_CONFIG_METHOD_PBC 0x0080
741#define WPS_CONFIG_METHOD_KEYPAD 0x0100
742#define WPS_CONFIG_METHOD_VPBC 0x0280
743#define WPS_CONFIG_METHOD_PPBC 0x0480
744#define WPS_CONFIG_METHOD_VDISPLAY 0x2008
745#define WPS_CONFIG_METHOD_PDISPLAY 0x4008
746
747/* Value of Category ID of WPS Primary Device Type Attribute */
748#define WPS_PDT_CID_DISPLAYS 0x0007
749#define WPS_PDT_CID_MULIT_MEDIA 0x0008
750#define WPS_PDT_CID_RTK_WIDI WPS_PDT_CID_MULIT_MEDIA
751
752/* Value of Sub Category ID of WPS Primary Device Type Attribute */
753#define WPS_PDT_SCID_MEDIA_SERVER 0x0005
754#define WPS_PDT_SCID_RTK_DMP WPS_PDT_SCID_MEDIA_SERVER
755
756/* Value of Device Password ID */
757#define WPS_DPID_P 0x0000
758#define WPS_DPID_USER_SPEC 0x0001
759#define WPS_DPID_MACHINE_SPEC 0x0002
760#define WPS_DPID_REKEY 0x0003
761#define WPS_DPID_PBC 0x0004
762#define WPS_DPID_REGISTRAR_SPEC 0x0005
763
764/* Value of WPS RF Bands Attribute */
765#define WPS_RF_BANDS_2_4_GHZ 0x01
766#define WPS_RF_BANDS_5_GHZ 0x02
767
768/* Value of WPS Association State Attribute */
769#define WPS_ASSOC_STATE_NOT_ASSOCIATED 0x00
770#define WPS_ASSOC_STATE_CONNECTION_SUCCESS 0x01
771#define WPS_ASSOC_STATE_CONFIGURATION_FAILURE 0x02
772#define WPS_ASSOC_STATE_ASSOCIATION_FAILURE 0x03
773#define WPS_ASSOC_STATE_IP_FAILURE 0x04
774
775/* =====================P2P Section===================== */
776/* For P2P */
777#define P2POUI 0x506F9A09
778
779/* P2P Attribute ID */
780#define P2P_ATTR_STATUS 0x00
781#define P2P_ATTR_MINOR_REASON_CODE 0x01
782#define P2P_ATTR_CAPABILITY 0x02
783#define P2P_ATTR_DEVICE_ID 0x03
784#define P2P_ATTR_GO_INTENT 0x04
785#define P2P_ATTR_CONF_TIMEOUT 0x05
786#define P2P_ATTR_LISTEN_CH 0x06
787#define P2P_ATTR_GROUP_BSSID 0x07
788#define P2P_ATTR_EX_LISTEN_TIMING 0x08
789#define P2P_ATTR_INTENTED_IF_ADDR 0x09
790#define P2P_ATTR_MANAGEABILITY 0x0A
791#define P2P_ATTR_CH_LIST 0x0B
792#define P2P_ATTR_NOA 0x0C
793#define P2P_ATTR_DEVICE_INFO 0x0D
794#define P2P_ATTR_GROUP_INFO 0x0E
795#define P2P_ATTR_GROUP_ID 0x0F
796#define P2P_ATTR_INTERFACE 0x10
797#define P2P_ATTR_OPERATING_CH 0x11
798#define P2P_ATTR_INVITATION_FLAGS 0x12
799
800/* Value of Status Attribute */
801#define P2P_STATUS_SUCCESS 0x00
802#define P2P_STATUS_FAIL_INFO_UNAVAILABLE 0x01
803#define P2P_STATUS_FAIL_INCOMPATIBLE_PARAM 0x02
804#define P2P_STATUS_FAIL_LIMIT_REACHED 0x03
805#define P2P_STATUS_FAIL_INVALID_PARAM 0x04
806#define P2P_STATUS_FAIL_REQUEST_UNABLE 0x05
807#define P2P_STATUS_FAIL_PREVOUS_PROTO_ERR 0x06
808#define P2P_STATUS_FAIL_NO_COMMON_CH 0x07
809#define P2P_STATUS_FAIL_UNKNOWN_P2PGROUP 0x08
810#define P2P_STATUS_FAIL_BOTH_GOINTENT_15 0x09
811#define P2P_STATUS_FAIL_INCOMPATIBLE_PROVSION 0x0A
812#define P2P_STATUS_FAIL_USER_REJECT 0x0B
813
Yannick Guerrini8895f042015-02-26 17:36:33 +0100814/* Value of Invitation Flags Attribute */
Larry Finger9a602712013-08-21 22:34:14 -0500815#define P2P_INVITATION_FLAGS_PERSISTENT BIT(0)
816
817#define DMP_P2P_DEVCAP_SUPPORT (P2P_DEVCAP_SERVICE_DISCOVERY | \
818 P2P_DEVCAP_CLIENT_DISCOVERABILITY | \
819 P2P_DEVCAP_CONCURRENT_OPERATION | \
820 P2P_DEVCAP_INVITATION_PROC)
821
822#define DMP_P2P_GRPCAP_SUPPORT (P2P_GRPCAP_INTRABSS)
823
824/* Value of Device Capability Bitmap */
825#define P2P_DEVCAP_SERVICE_DISCOVERY BIT(0)
826#define P2P_DEVCAP_CLIENT_DISCOVERABILITY BIT(1)
827#define P2P_DEVCAP_CONCURRENT_OPERATION BIT(2)
828#define P2P_DEVCAP_INFRA_MANAGED BIT(3)
829#define P2P_DEVCAP_DEVICE_LIMIT BIT(4)
830#define P2P_DEVCAP_INVITATION_PROC BIT(5)
831
832/* Value of Group Capability Bitmap */
833#define P2P_GRPCAP_GO BIT(0)
834#define P2P_GRPCAP_PERSISTENT_GROUP BIT(1)
835#define P2P_GRPCAP_GROUP_LIMIT BIT(2)
836#define P2P_GRPCAP_INTRABSS BIT(3)
837#define P2P_GRPCAP_CROSS_CONN BIT(4)
838#define P2P_GRPCAP_PERSISTENT_RECONN BIT(5)
839#define P2P_GRPCAP_GROUP_FORMATION BIT(6)
840
841/* P2P Public Action Frame (Management Frame) */
842#define P2P_PUB_ACTION_ACTION 0x09
843
844/* P2P Public Action Frame Type */
845#define P2P_GO_NEGO_REQ 0
846#define P2P_GO_NEGO_RESP 1
847#define P2P_GO_NEGO_CONF 2
848#define P2P_INVIT_REQ 3
849#define P2P_INVIT_RESP 4
850#define P2P_DEVDISC_REQ 5
851#define P2P_DEVDISC_RESP 6
852#define P2P_PROVISION_DISC_REQ 7
853#define P2P_PROVISION_DISC_RESP 8
854
855/* P2P Action Frame Type */
856#define P2P_NOTICE_OF_ABSENCE 0
857#define P2P_PRESENCE_REQUEST 1
858#define P2P_PRESENCE_RESPONSE 2
859#define P2P_GO_DISC_REQUEST 3
860
861
862#define P2P_MAX_PERSISTENT_GROUP_NUM 10
863
864#define P2P_PROVISIONING_SCAN_CNT 3
865
866#define P2P_WILDCARD_SSID_LEN 7
867
Yannick Guerrini8895f042015-02-26 17:36:33 +0100868/* default value, used when: (1)p2p disabled or (2)p2p enabled
Larry Finger9a602712013-08-21 22:34:14 -0500869 * but only do 1 scan phase */
870#define P2P_FINDPHASE_EX_NONE 0
871/* used when p2p enabled and want to do 1 scan phase and
872 * P2P_FINDPHASE_EX_MAX-1 find phase */
873#define P2P_FINDPHASE_EX_FULL 1
874#define P2P_FINDPHASE_EX_SOCIAL_FIRST (P2P_FINDPHASE_EX_FULL+1)
875#define P2P_FINDPHASE_EX_MAX 4
876#define P2P_FINDPHASE_EX_SOCIAL_LAST P2P_FINDPHASE_EX_MAX
877
878/* 5 seconds timeout for sending the provision discovery request */
879#define P2P_PROVISION_TIMEOUT 5000
880/* 3 seconds timeout for sending the prov disc request concurrent mode */
881#define P2P_CONCURRENT_PROVISION_TIME 3000
Masanari Iidaf7bba922013-09-27 00:11:43 +0900882/* 5 seconds timeout for receiving the group negotiation response */
Larry Finger9a602712013-08-21 22:34:14 -0500883#define P2P_GO_NEGO_TIMEOUT 5000
884/* 3 seconds timeout for sending the negotiation request under concurrent mode */
885#define P2P_CONCURRENT_GO_NEGO_TIME 3000
886/* 100ms */
887#define P2P_TX_PRESCAN_TIMEOUT 100
888/* 5 seconds timeout for sending the invitation request */
889#define P2P_INVITE_TIMEOUT 5000
890/* 3 seconds timeout for sending the invitation request under concurrent mode */
891#define P2P_CONCURRENT_INVITE_TIME 3000
892/* 25 seconds timeout to reset the scan channel (based on channel plan) */
893#define P2P_RESET_SCAN_CH 25000
894#define P2P_MAX_INTENT 15
895
896#define P2P_MAX_NOA_NUM 2
897
898/* WPS Configuration Method */
899#define WPS_CM_NONE 0x0000
900#define WPS_CM_LABEL 0x0004
901#define WPS_CM_DISPLYA 0x0008
902#define WPS_CM_EXTERNAL_NFC_TOKEN 0x0010
903#define WPS_CM_INTEGRATED_NFC_TOKEN 0x0020
904#define WPS_CM_NFC_INTERFACE 0x0040
905#define WPS_CM_PUSH_BUTTON 0x0080
906#define WPS_CM_KEYPAD 0x0100
907#define WPS_CM_SW_PUHS_BUTTON 0x0280
908#define WPS_CM_HW_PUHS_BUTTON 0x0480
909#define WPS_CM_SW_DISPLAY_P 0x2008
910#define WPS_CM_LCD_DISPLAY_P 0x4008
911
912enum P2P_ROLE {
913 P2P_ROLE_DISABLE = 0,
914 P2P_ROLE_DEVICE = 1,
915 P2P_ROLE_CLIENT = 2,
916 P2P_ROLE_GO = 3
917};
918
919enum P2P_STATE {
920 P2P_STATE_NONE = 0, /* P2P disable */
921 /* P2P had enabled and do nothing */
922 P2P_STATE_IDLE = 1,
923 P2P_STATE_LISTEN = 2, /* In pure listen state */
924 P2P_STATE_SCAN = 3, /* In scan phase */
925 /* In the listen state of find phase */
926 P2P_STATE_FIND_PHASE_LISTEN = 4,
927 /* In the search state of find phase */
928 P2P_STATE_FIND_PHASE_SEARCH = 5,
929 /* In P2P provisioning discovery */
930 P2P_STATE_TX_PROVISION_DIS_REQ = 6,
931 P2P_STATE_RX_PROVISION_DIS_RSP = 7,
932 P2P_STATE_RX_PROVISION_DIS_REQ = 8,
Yannick Guerrini8895f042015-02-26 17:36:33 +0100933 /* Doing the group owner negotiation handshake */
Larry Finger9a602712013-08-21 22:34:14 -0500934 P2P_STATE_GONEGO_ING = 9,
Yannick Guerrini8895f042015-02-26 17:36:33 +0100935 /* finish the group negotiation handshake with success */
Larry Finger9a602712013-08-21 22:34:14 -0500936 P2P_STATE_GONEGO_OK = 10,
Yannick Guerrini8895f042015-02-26 17:36:33 +0100937 /* finish the group negotiation handshake with failure */
Larry Finger9a602712013-08-21 22:34:14 -0500938 P2P_STATE_GONEGO_FAIL = 11,
Yannick Guerrini8895f042015-02-26 17:36:33 +0100939 /* receiving the P2P Invitation request and match with the profile. */
Larry Finger9a602712013-08-21 22:34:14 -0500940 P2P_STATE_RECV_INVITE_REQ_MATCH = 12,
941 /* Doing the P2P WPS */
942 P2P_STATE_PROVISIONING_ING = 13,
943 /* Finish the P2P WPS */
944 P2P_STATE_PROVISIONING_DONE = 14,
945 /* Transmit the P2P Invitation request */
946 P2P_STATE_TX_INVITE_REQ = 15,
947 /* Receiving the P2P Invitation response */
948 P2P_STATE_RX_INVITE_RESP_OK = 16,
Yannick Guerrini8895f042015-02-26 17:36:33 +0100949 /* receiving the P2P Invitation request and dismatch with the profile. */
Larry Finger9a602712013-08-21 22:34:14 -0500950 P2P_STATE_RECV_INVITE_REQ_DISMATCH = 17,
Yannick Guerrini8895f042015-02-26 17:36:33 +0100951 /* receiving the P2P Invitation request and this wifi is GO. */
Larry Finger9a602712013-08-21 22:34:14 -0500952 P2P_STATE_RECV_INVITE_REQ_GO = 18,
Yannick Guerrini8895f042015-02-26 17:36:33 +0100953 /* receiving the P2P Invitation request to join an existing P2P Group. */
Larry Finger9a602712013-08-21 22:34:14 -0500954 P2P_STATE_RECV_INVITE_REQ_JOIN = 19,
Yannick Guerrini8895f042015-02-26 17:36:33 +0100955 /* receiving the P2P Invitation response with failure */
Larry Finger9a602712013-08-21 22:34:14 -0500956 P2P_STATE_RX_INVITE_RESP_FAIL = 20,
Yannick Guerrini8895f042015-02-26 17:36:33 +0100957 /* receiving p2p negotiation response with information is not available */
Larry Finger9a602712013-08-21 22:34:14 -0500958 P2P_STATE_RX_INFOR_NOREADY = 21,
Yannick Guerrini8895f042015-02-26 17:36:33 +0100959 /* sending p2p negotiation response with information is not available */
Larry Finger9a602712013-08-21 22:34:14 -0500960 P2P_STATE_TX_INFOR_NOREADY = 22,
961};
962
963enum P2P_WPSINFO {
964 P2P_NO_WPSINFO = 0,
965 P2P_GOT_WPSINFO_PEER_DISPLAY_PIN = 1,
966 P2P_GOT_WPSINFO_SELF_DISPLAY_PIN = 2,
967 P2P_GOT_WPSINFO_PBC = 3,
968};
969
970#define P2P_PRIVATE_IOCTL_SET_LEN 64
971
972enum P2P_PROTO_WK_ID {
973 P2P_FIND_PHASE_WK = 0,
974 P2P_RESTORE_STATE_WK = 1,
975 P2P_PRE_TX_PROVDISC_PROCESS_WK = 2,
976 P2P_PRE_TX_NEGOREQ_PROCESS_WK = 3,
977 P2P_PRE_TX_INVITEREQ_PROCESS_WK = 4,
Tim Jester-Pfadt3f35c7f2014-01-12 00:55:25 +0100978 P2P_AP_P2P_CH_SWITCH_PROCESS_WK = 5,
Larry Finger9a602712013-08-21 22:34:14 -0500979 P2P_RO_CH_WK = 6,
980};
981
982enum P2P_PS_STATE {
983 P2P_PS_DISABLE = 0,
984 P2P_PS_ENABLE = 1,
985 P2P_PS_SCAN = 2,
986 P2P_PS_SCAN_DONE = 3,
987 P2P_PS_ALLSTASLEEP = 4, /* for P2P GO */
988};
989
990enum P2P_PS_MODE {
991 P2P_PS_NONE = 0,
992 P2P_PS_CTWINDOW = 1,
993 P2P_PS_NOA = 2,
994 P2P_PS_MIX = 3, /* CTWindow and NoA */
995};
996
997/* =====================WFD Section===================== */
998/* For Wi-Fi Display */
999#define WFD_ATTR_DEVICE_INFO 0x00
1000#define WFD_ATTR_ASSOC_BSSID 0x01
1001#define WFD_ATTR_COUPLED_SINK_INFO 0x06
1002#define WFD_ATTR_LOCAL_IP_ADDR 0x08
1003#define WFD_ATTR_SESSION_INFO 0x09
1004#define WFD_ATTR_ALTER_MAC 0x0a
1005
1006/* For WFD Device Information Attribute */
1007#define WFD_DEVINFO_SOURCE 0x0000
1008#define WFD_DEVINFO_PSINK 0x0001
1009#define WFD_DEVINFO_SSINK 0x0002
1010#define WFD_DEVINFO_DUAL 0x0003
1011
1012#define WFD_DEVINFO_SESSION_AVAIL 0x0010
1013#define WFD_DEVINFO_WSD 0x0040
1014#define WFD_DEVINFO_PC_TDLS 0x0080
1015#define WFD_DEVINFO_HDCP_SUPPORT 0x0100
1016
1017#define IP_MCAST_MAC(mac) \
1018 ((mac[0] == 0x01) && (mac[1] == 0x00) && (mac[2] == 0x5e))
1019#define ICMPV6_MCAST_MAC(mac) \
1020 ((mac[0] == 0x33) && (mac[1] == 0x33) && (mac[2] != 0xff))
1021
1022#endif /* _WIFI_H_ */