1 /******************************************************************************
3 * Copyright(c) 2007 - 2012 Realtek Corporation. All rights reserved.
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.
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
14 ******************************************************************************/
18 #define P80211CAPTURE_VERSION 0x80211001
20 /* This value is tested by WiFi 11n Test Plan 5.2.3.
21 * This test verifies the WLAN NIC can update the NAV through sending
22 * the CTS with large duration.
24 #define WiFiNavUpperUs 30000 /* 30 ms */
26 enum WIFI_FRAME_TYPE {
28 WIFI_CTRL_TYPE = (BIT(2)),
29 WIFI_DATA_TYPE = (BIT(3)),
30 WIFI_QOS_DATA_TYPE = (BIT(7)|BIT(3)), /* QoS Data */
33 enum WIFI_FRAME_SUBTYPE {
34 /* below is for mgt frame */
35 WIFI_ASSOCREQ = (0 | WIFI_MGT_TYPE),
36 WIFI_ASSOCRSP = (BIT(4) | WIFI_MGT_TYPE),
37 WIFI_REASSOCREQ = (BIT(5) | WIFI_MGT_TYPE),
38 WIFI_REASSOCRSP = (BIT(5) | BIT(4) | WIFI_MGT_TYPE),
39 WIFI_PROBEREQ = (BIT(6) | WIFI_MGT_TYPE),
40 WIFI_PROBERSP = (BIT(6) | BIT(4) | WIFI_MGT_TYPE),
41 WIFI_BEACON = (BIT(7) | WIFI_MGT_TYPE),
42 WIFI_ATIM = (BIT(7) | BIT(4) | WIFI_MGT_TYPE),
43 WIFI_DISASSOC = (BIT(7) | BIT(5) | WIFI_MGT_TYPE),
44 WIFI_AUTH = (BIT(7) | BIT(5) | BIT(4) | WIFI_MGT_TYPE),
45 WIFI_DEAUTH = (BIT(7) | BIT(6) | WIFI_MGT_TYPE),
46 WIFI_ACTION = (BIT(7) | BIT(6) | BIT(4) | WIFI_MGT_TYPE),
48 /* below is for control frame */
49 WIFI_PSPOLL = (BIT(7) | BIT(5) | WIFI_CTRL_TYPE),
50 WIFI_RTS = (BIT(7) | BIT(5) | BIT(4) | WIFI_CTRL_TYPE),
51 WIFI_CTS = (BIT(7) | BIT(6) | WIFI_CTRL_TYPE),
52 WIFI_ACK = (BIT(7) | BIT(6) | BIT(4) | WIFI_CTRL_TYPE),
53 WIFI_CFEND = (BIT(7) | BIT(6) | BIT(5) | WIFI_CTRL_TYPE),
54 WIFI_CFEND_CFACK = (BIT(7) | BIT(6) | BIT(5) | BIT(4) | WIFI_CTRL_TYPE),
56 /* below is for data frame */
57 WIFI_DATA = (0 | WIFI_DATA_TYPE),
58 WIFI_DATA_CFACK = (BIT(4) | WIFI_DATA_TYPE),
59 WIFI_DATA_CFPOLL = (BIT(5) | WIFI_DATA_TYPE),
60 WIFI_DATA_CFACKPOLL = (BIT(5) | BIT(4) | WIFI_DATA_TYPE),
61 WIFI_DATA_NULL = (BIT(6) | WIFI_DATA_TYPE),
62 WIFI_CF_ACK = (BIT(6) | BIT(4) | WIFI_DATA_TYPE),
63 WIFI_CF_POLL = (BIT(6) | BIT(5) | WIFI_DATA_TYPE),
64 WIFI_CF_ACKPOLL = (BIT(6) | BIT(5) | BIT(4) | WIFI_DATA_TYPE),
65 WIFI_QOS_DATA_NULL = (BIT(6) | WIFI_QOS_DATA_TYPE),
69 enum WIFI_REG_DOMAIN {
84 #define SetToDs(pbuf) \
85 (*(unsigned short *)(pbuf) |= cpu_to_le16(IEEE80211_FCTL_TODS))
87 #define SetFrDs(pbuf) \
88 (*(unsigned short *)(pbuf) |= cpu_to_le16(IEEE80211_FCTL_FROMDS))
90 #define get_tofr_ds(pframe) ((ieee80211_has_tods(pframe) << 1) | \
91 ieee80211_has_fromds(pframe))
93 #define SetMFrag(pbuf) \
94 (*(unsigned short *)(pbuf) |= cpu_to_le16(IEEE80211_FCTL_MOREFRAGS))
96 #define ClearMFrag(pbuf) \
97 (*(unsigned short *)(pbuf) &= (~cpu_to_le16(IEEE80211_FCTL_MOREFRAGS)))
99 #define SetRetry(pbuf) \
100 (*(unsigned short *)(pbuf) |= cpu_to_le16(IEEE80211_FCTL_RETRY))
102 #define SetPwrMgt(pbuf) \
103 (*(unsigned short *)(pbuf) |= cpu_to_le16(IEEE80211_FCTL_PM))
105 #define SetMData(pbuf) \
106 (*(unsigned short *)(pbuf) |= cpu_to_le16(IEEE80211_FCTL_MOREDATA))
108 #define SetPrivacy(pbuf) \
109 (*(unsigned short *)(pbuf) |= cpu_to_le16(IEEE80211_FCTL_PROTECTED))
111 #define SetFrameType(pbuf, type) \
113 *(unsigned short *)(pbuf) &= __constant_cpu_to_le16(~(BIT(3) | BIT(2))); \
114 *(unsigned short *)(pbuf) |= __constant_cpu_to_le16(type); \
117 #define SetFrameSubType(pbuf, type) \
119 *(unsigned short *)(pbuf) &= cpu_to_le16(~(BIT(7) | BIT(6) | BIT(5) | BIT(4) | BIT(3) | BIT(2))); \
120 *(unsigned short *)(pbuf) |= cpu_to_le16(type); \
123 #define GetTupleCache(pbuf) (cpu_to_le16(*(unsigned short *)((unsigned long)(pbuf) + 22)))
125 #define SetFragNum(pbuf, num) \
127 *(unsigned short *)((unsigned long)(pbuf) + 22) = \
128 ((*(unsigned short *)((unsigned long)(pbuf) + 22)) & le16_to_cpu(~(0x000f))) | \
129 cpu_to_le16(0x0f & (num)); \
132 #define SetSeqNum(pbuf, num) \
134 *(unsigned short *)((unsigned long)(pbuf) + 22) = \
135 ((*(unsigned short *)((unsigned long)(pbuf) + 22)) & le16_to_cpu((unsigned short)0x000f)) | \
136 le16_to_cpu((unsigned short)(0xfff0 & (num << 4))); \
139 #define SetDuration(pbuf, dur) \
140 (*(unsigned short *)((unsigned long)(pbuf) + 2) = \
141 cpu_to_le16(0xffff & (dur)))
143 #define SetPriority(pbuf, tid) \
144 (*(unsigned short *)(pbuf) |= cpu_to_le16(tid & 0xf))
146 #define SetEOSP(pbuf, eosp) \
147 (*(unsigned short *)(pbuf) |= cpu_to_le16((eosp & 1) << 4))
149 #define SetAckpolicy(pbuf, ack) \
150 (*(unsigned short *)(pbuf) |= cpu_to_le16((ack & 3) << 5))
152 #define SetAMsdu(pbuf, amsdu) \
153 (*(unsigned short *)(pbuf) |= cpu_to_le16((amsdu & 1) << 7))
155 #define GetAid(pbuf) \
156 (cpu_to_le16(*(unsigned short *)((unsigned long)(pbuf) + 2)) & \
159 #define GetTid(pbuf) \
160 (cpu_to_le16(*(unsigned short *)((unsigned long)(pbuf) + \
161 (((ieee80211_has_tods(pbuf)<<1) | \
162 ieee80211_has_fromds(pbuf)) == 3 ? 30 : 24))) & 0x000f)
164 static inline unsigned char *get_hdr_bssid(unsigned char *pframe)
167 unsigned int to_fr_ds;
168 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) pframe;
170 to_fr_ds = (ieee80211_has_tods(hdr->frame_control) << 1) |
171 ieee80211_has_fromds(hdr->frame_control);
174 case 0x00: /* ToDs=0, FromDs=0 */
177 case 0x01: /* ToDs=0, FromDs=1 */
180 case 0x02: /* ToDs=1, FromDs=0 */
183 case 0x03: /* ToDs=1, FromDs=1 */
193 /*-----------------------------------------------------------------------------
194 Below is for the security related definition
195 ------------------------------------------------------------------------------*/
196 #define _RESERVED_FRAME_TYPE_ 0
197 #define _SKB_FRAME_TYPE_ 2
198 #define _PRE_ALLOCMEM_ 1
199 #define _PRE_ALLOCHDR_ 3
200 #define _PRE_ALLOCLLCHDR_ 4
201 #define _PRE_ALLOCICVHDR_ 5
202 #define _PRE_ALLOCMICHDR_ 6
205 ((priv->pmib->dot11BssType.net_work_type & WIRELESS_11A) ? 16 : 10)
206 #define _ACKCTSLNG_ 14 /* 14 bytes long, including crclng */
209 #define _ASOCREQ_IE_OFFSET_ 4 /* excluding wlan_hdr */
210 #define _ASOCRSP_IE_OFFSET_ 6
211 #define _REASOCREQ_IE_OFFSET_ 10
212 #define _REASOCRSP_IE_OFFSET_ 6
213 #define _PROBEREQ_IE_OFFSET_ 0
214 #define _PROBERSP_IE_OFFSET_ 12
215 #define _AUTH_IE_OFFSET_ 6
216 #define _DEAUTH_IE_OFFSET_ 0
217 #define _BEACON_IE_OFFSET_ 12
218 #define _PUBLIC_ACTION_IE_OFFSET_ 8
220 #define _FIXED_IE_LENGTH_ _BEACON_IE_OFFSET_
223 #define _SUPPORTEDRATES_IE_ 1
226 #define _IBSS_PARA_IE_ 6
227 #define _COUNTRY_IE_ 7
228 #define _CHLGETXT_IE_ 16
229 #define _SUPPORTED_CH_IE_ 36
230 #define _CH_SWTICH_ANNOUNCE_ 37 /* Secondary Channel Offset */
231 #define _RSN_IE_2_ 48
232 #define _SSN_IE_1_ 221
233 #define _ERPINFO_IE_ 42
234 #define _EXT_SUPPORTEDRATES_IE_ 50
236 #define _HT_CAPABILITY_IE_ 45
238 #define _TIMEOUT_ITVL_IE_ 56
240 #define _HT_EXTRA_INFO_IE_ 61
241 #define _HT_ADD_INFO_IE_ 61 /* _HT_EXTRA_INFO_IE_ */
244 #define EID_BSSCoexistence 72 /* 20/40 BSS Coexistence */
245 #define EID_BSSIntolerantChlReport 73
246 #define _RIC_Descriptor_IE_ 75
248 #define _LINK_ID_IE_ 101
249 #define _CH_SWITCH_TIMING_ 104
250 #define _PTI_BUFFER_STATUS_ 106
251 #define _EXT_CAP_IE_ 127
252 #define _VENDOR_SPECIFIC_IE_ 221
254 #define _RESERVED47_ 47
256 /* ---------------------------------------------------------------------------
257 Below is the fixed elements...
258 -----------------------------------------------------------------------------*/
259 #define _AUTH_ALGM_NUM_ 2
260 #define _AUTH_SEQ_NUM_ 2
261 #define _BEACON_ITERVAL_ 2
262 #define _CAPABILITY_ 2
263 #define _CURRENT_APADDR_ 6
264 #define _LISTEN_INTERVAL_ 2
266 #define _STATUS_CODE_ 2
267 #define _TIMESTAMP_ 8
269 #define AUTH_ODD_TO 0
270 #define AUTH_EVEN_TO 1
272 #define WLAN_ETHCONV_ENCAP 1
273 #define WLAN_ETHCONV_RFC1042 2
274 #define WLAN_ETHCONV_8021h 3
276 #define cap_ESS BIT(0)
277 #define cap_IBSS BIT(1)
278 #define cap_CFPollable BIT(2)
279 #define cap_CFRequest BIT(3)
280 #define cap_Privacy BIT(4)
281 #define cap_ShortPremble BIT(5)
282 #define cap_PBCC BIT(6)
283 #define cap_ChAgility BIT(7)
284 #define cap_SpecMgmt BIT(8)
285 #define cap_QoS BIT(9)
286 #define cap_ShortSlot BIT(10)
288 /*-----------------------------------------------------------------------------
289 Below is the definition for 802.11i / 802.1x
290 ------------------------------------------------------------------------------*/
291 #define _IEEE8021X_MGT_ 1 /* WPA */
292 #define _IEEE8021X_PSK_ 2 /* WPA with pre-shared key */
295 #define _NO_PRIVACY_ 0
296 #define _WEP_40_PRIVACY_ 1
297 #define _TKIP_PRIVACY_ 2
298 #define _WRAP_PRIVACY_ 3
299 #define _CCMP_PRIVACY_ 4
300 #define _WEP_104_PRIVACY_ 5
301 #define _WEP_WPA_MIXED_PRIVACY_ 6 WEP + WPA
304 /*-----------------------------------------------------------------------------
305 Below is the definition for WMM
306 ------------------------------------------------------------------------------*/
307 #define _WMM_IE_Length_ 7 /* for WMM STA */
308 #define _WMM_Para_Element_Length_ 24
311 /*-----------------------------------------------------------------------------
312 Below is the definition for 802.11n
313 ------------------------------------------------------------------------------*/
315 #define SetOrderBit(pbuf) \
316 (*(unsigned short *)(pbuf) |= cpu_to_le16(_ORDER_))
318 #define GetOrderBit(pbuf) \
319 (((*(unsigned short *)(pbuf)) & le16_to_cpu(_ORDER_)) != 0)
322 /* struct rtw_ieee80211_ht_cap - HT additional information
324 * This structure refers to "HT information element" as
325 * described in 802.11n draft section 7.3.2.53
327 struct ieee80211_ht_addt_info {
328 unsigned char control_chan;
329 unsigned char ht_param;
330 unsigned short operation_mode;
331 unsigned short stbc_param;
332 unsigned char basic_set[16];
335 struct HT_caps_element {
338 unsigned short HT_caps_info;
339 unsigned char AMPDU_para;
340 unsigned char MCS_rate[16];
341 unsigned short HT_ext_caps;
342 unsigned int Beamforming_caps;
343 unsigned char ASEL_caps;
345 unsigned char HT_cap[26];
349 struct HT_info_element {
350 unsigned char primary_channel;
351 unsigned char infos[5];
352 unsigned char MCS_rate[16];
356 unsigned char ACI_AIFSN;
358 unsigned short TXOP_limit;
361 struct WMM_para_element {
362 unsigned char QoS_info;
363 unsigned char reserved;
364 struct AC_param ac_param[4];
367 struct ADDBA_request {
368 unsigned char dialog_token;
369 unsigned short BA_para_set;
370 unsigned short BA_timeout_value;
371 unsigned short BA_starting_seqctrl;
375 #define OP_MODE_PURE 0
376 #define OP_MODE_MAY_BE_LEGACY_STAS 1
377 #define OP_MODE_20MHZ_HT_STA_ASSOCED 2
378 #define OP_MODE_MIXED 3
380 #define HT_INFO_HT_PARAM_SECONDARY_CHNL_OFF_MASK ((u8) BIT(0) | BIT(1))
381 #define HT_INFO_HT_PARAM_SECONDARY_CHNL_ABOVE ((u8) BIT(0))
382 #define HT_INFO_HT_PARAM_SECONDARY_CHNL_BELOW ((u8) BIT(0) | BIT(1))
383 #define HT_INFO_HT_PARAM_REC_TRANS_CHNL_WIDTH ((u8) BIT(2))
384 #define HT_INFO_HT_PARAM_RIFS_MODE ((u8) BIT(3))
385 #define HT_INFO_HT_PARAM_CTRL_ACCESS_ONLY ((u8) BIT(4))
386 #define HT_INFO_HT_PARAM_SRV_INTERVAL_GRANULARITY ((u8) BIT(5))
388 #define HT_INFO_OPERATION_MODE_OP_MODE_MASK \
389 ((u16) (0x0001 | 0x0002))
390 #define HT_INFO_OPERATION_MODE_OP_MODE_OFFSET 0
391 #define HT_INFO_OPERATION_MODE_NON_GF_DEVS_PRESENT ((u8) BIT(2))
392 #define HT_INFO_OPERATION_MODE_TRANSMIT_BURST_LIMIT ((u8) BIT(3))
393 #define HT_INFO_OPERATION_MODE_NON_HT_STA_PRESENT ((u8) BIT(4))
395 #define HT_INFO_STBC_PARAM_DUAL_BEACON ((u16) BIT(6))
396 #define HT_INFO_STBC_PARAM_DUAL_STBC_PROTECT ((u16) BIT(7))
397 #define HT_INFO_STBC_PARAM_SECONDARY_BCN ((u16) BIT(8))
398 #define HT_INFO_STBC_PARAM_LSIG_TXOP_PROTECT_ALLOWED ((u16) BIT(9))
399 #define HT_INFO_STBC_PARAM_PCO_ACTIVE ((u16) BIT(10))
400 #define HT_INFO_STBC_PARAM_PCO_PHASE ((u16) BIT(11))
404 /* ===============WPS Section=============== */
406 #define WPSOUI 0x0050f204
407 /* WPS attribute ID */
408 #define WPS_ATTR_VER1 0x104A
409 #define WPS_ATTR_SIMPLE_CONF_STATE 0x1044
410 #define WPS_ATTR_RESP_TYPE 0x103B
411 #define WPS_ATTR_UUID_E 0x1047
412 #define WPS_ATTR_MANUFACTURER 0x1021
413 #define WPS_ATTR_MODEL_NAME 0x1023
414 #define WPS_ATTR_MODEL_NUMBER 0x1024
415 #define WPS_ATTR_SERIAL_NUMBER 0x1042
416 #define WPS_ATTR_PRIMARY_DEV_TYPE 0x1054
417 #define WPS_ATTR_SEC_DEV_TYPE_LIST 0x1055
418 #define WPS_ATTR_DEVICE_NAME 0x1011
419 #define WPS_ATTR_CONF_METHOD 0x1008
420 #define WPS_ATTR_RF_BANDS 0x103C
421 #define WPS_ATTR_DEVICE_PWID 0x1012
422 #define WPS_ATTR_REQUEST_TYPE 0x103A
423 #define WPS_ATTR_ASSOCIATION_STATE 0x1002
424 #define WPS_ATTR_CONFIG_ERROR 0x1009
425 #define WPS_ATTR_VENDOR_EXT 0x1049
426 #define WPS_ATTR_SELECTED_REGISTRAR 0x1041
428 /* Value of WPS attribute "WPS_ATTR_DEVICE_NAME */
429 #define WPS_MAX_DEVICE_NAME_LEN 32
431 /* Value of WPS Request Type Attribute */
432 #define WPS_REQ_TYPE_ENROLLEE_INFO_ONLY 0x00
433 #define WPS_REQ_TYPE_ENROLLEE_OPEN_8021X 0x01
434 #define WPS_REQ_TYPE_REGISTRAR 0x02
435 #define WPS_REQ_TYPE_WLAN_MANAGER_REGISTRAR 0x03
437 /* Value of WPS Response Type Attribute */
438 #define WPS_RESPONSE_TYPE_INFO_ONLY 0x00
439 #define WPS_RESPONSE_TYPE_8021X 0x01
440 #define WPS_RESPONSE_TYPE_REGISTRAR 0x02
441 #define WPS_RESPONSE_TYPE_AP 0x03
443 /* Value of WPS WiFi Simple Configuration State Attribute */
444 #define WPS_WSC_STATE_NOT_CONFIG 0x01
445 #define WPS_WSC_STATE_CONFIG 0x02
447 /* Value of WPS Version Attribute */
448 #define WPS_VERSION_1 0x10
450 /* Value of WPS Configuration Method Attribute */
451 #define WPS_CONFIG_METHOD_FLASH 0x0001
452 #define WPS_CONFIG_METHOD_ETHERNET 0x0002
453 #define WPS_CONFIG_METHOD_LABEL 0x0004
454 #define WPS_CONFIG_METHOD_DISPLAY 0x0008
455 #define WPS_CONFIG_METHOD_E_NFC 0x0010
456 #define WPS_CONFIG_METHOD_I_NFC 0x0020
457 #define WPS_CONFIG_METHOD_NFC 0x0040
458 #define WPS_CONFIG_METHOD_PBC 0x0080
459 #define WPS_CONFIG_METHOD_KEYPAD 0x0100
460 #define WPS_CONFIG_METHOD_VPBC 0x0280
461 #define WPS_CONFIG_METHOD_PPBC 0x0480
462 #define WPS_CONFIG_METHOD_VDISPLAY 0x2008
463 #define WPS_CONFIG_METHOD_PDISPLAY 0x4008
465 /* Value of Category ID of WPS Primary Device Type Attribute */
466 #define WPS_PDT_CID_DISPLAYS 0x0007
467 #define WPS_PDT_CID_MULIT_MEDIA 0x0008
468 #define WPS_PDT_CID_RTK_WIDI WPS_PDT_CID_MULIT_MEDIA
470 /* Value of Sub Category ID of WPS Primary Device Type Attribute */
471 #define WPS_PDT_SCID_MEDIA_SERVER 0x0005
472 #define WPS_PDT_SCID_RTK_DMP WPS_PDT_SCID_MEDIA_SERVER
474 /* Value of Device Password ID */
475 #define WPS_DPID_PIN 0x0000
476 #define WPS_DPID_USER_SPEC 0x0001
477 #define WPS_DPID_MACHINE_SPEC 0x0002
478 #define WPS_DPID_REKEY 0x0003
479 #define WPS_DPID_PBC 0x0004
480 #define WPS_DPID_REGISTRAR_SPEC 0x0005
482 /* Value of WPS RF Bands Attribute */
483 #define WPS_RF_BANDS_2_4_GHZ 0x01
484 #define WPS_RF_BANDS_5_GHZ 0x02
486 /* Value of WPS Association State Attribute */
487 #define WPS_ASSOC_STATE_NOT_ASSOCIATED 0x00
488 #define WPS_ASSOC_STATE_CONNECTION_SUCCESS 0x01
489 #define WPS_ASSOC_STATE_CONFIGURATION_FAILURE 0x02
490 #define WPS_ASSOC_STATE_ASSOCIATION_FAILURE 0x03
491 #define WPS_ASSOC_STATE_IP_FAILURE 0x04
493 /* =====================P2P Section===================== */
495 #define P2POUI 0x506F9A09
497 /* P2P Attribute ID */
498 #define P2P_ATTR_STATUS 0x00
499 #define P2P_ATTR_MINOR_REASON_CODE 0x01
500 #define P2P_ATTR_CAPABILITY 0x02
501 #define P2P_ATTR_DEVICE_ID 0x03
502 #define P2P_ATTR_GO_INTENT 0x04
503 #define P2P_ATTR_CONF_TIMEOUT 0x05
504 #define P2P_ATTR_LISTEN_CH 0x06
505 #define P2P_ATTR_GROUP_BSSID 0x07
506 #define P2P_ATTR_EX_LISTEN_TIMING 0x08
507 #define P2P_ATTR_INTENTED_IF_ADDR 0x09
508 #define P2P_ATTR_MANAGEABILITY 0x0A
509 #define P2P_ATTR_CH_LIST 0x0B
510 #define P2P_ATTR_NOA 0x0C
511 #define P2P_ATTR_DEVICE_INFO 0x0D
512 #define P2P_ATTR_GROUP_INFO 0x0E
513 #define P2P_ATTR_GROUP_ID 0x0F
514 #define P2P_ATTR_INTERFACE 0x10
515 #define P2P_ATTR_OPERATING_CH 0x11
516 #define P2P_ATTR_INVITATION_FLAGS 0x12
518 /* Value of Status Attribute */
519 #define P2P_STATUS_SUCCESS 0x00
520 #define P2P_STATUS_FAIL_INFO_UNAVAILABLE 0x01
521 #define P2P_STATUS_FAIL_INCOMPATIBLE_PARAM 0x02
522 #define P2P_STATUS_FAIL_LIMIT_REACHED 0x03
523 #define P2P_STATUS_FAIL_INVALID_PARAM 0x04
524 #define P2P_STATUS_FAIL_REQUEST_UNABLE 0x05
525 #define P2P_STATUS_FAIL_PREVOUS_PROTO_ERR 0x06
526 #define P2P_STATUS_FAIL_NO_COMMON_CH 0x07
527 #define P2P_STATUS_FAIL_UNKNOWN_P2PGROUP 0x08
528 #define P2P_STATUS_FAIL_BOTH_GOINTENT_15 0x09
529 #define P2P_STATUS_FAIL_INCOMPATIBLE_PROVSION 0x0A
530 #define P2P_STATUS_FAIL_USER_REJECT 0x0B
532 /* Value of Inviation Flags Attribute */
533 #define P2P_INVITATION_FLAGS_PERSISTENT BIT(0)
535 #define DMP_P2P_DEVCAP_SUPPORT (P2P_DEVCAP_SERVICE_DISCOVERY | \
536 P2P_DEVCAP_CLIENT_DISCOVERABILITY | \
537 P2P_DEVCAP_CONCURRENT_OPERATION | \
538 P2P_DEVCAP_INVITATION_PROC)
540 #define DMP_P2P_GRPCAP_SUPPORT (P2P_GRPCAP_INTRABSS)
542 /* Value of Device Capability Bitmap */
543 #define P2P_DEVCAP_SERVICE_DISCOVERY BIT(0)
544 #define P2P_DEVCAP_CLIENT_DISCOVERABILITY BIT(1)
545 #define P2P_DEVCAP_CONCURRENT_OPERATION BIT(2)
546 #define P2P_DEVCAP_INFRA_MANAGED BIT(3)
547 #define P2P_DEVCAP_DEVICE_LIMIT BIT(4)
548 #define P2P_DEVCAP_INVITATION_PROC BIT(5)
550 /* Value of Group Capability Bitmap */
551 #define P2P_GRPCAP_GO BIT(0)
552 #define P2P_GRPCAP_PERSISTENT_GROUP BIT(1)
553 #define P2P_GRPCAP_GROUP_LIMIT BIT(2)
554 #define P2P_GRPCAP_INTRABSS BIT(3)
555 #define P2P_GRPCAP_CROSS_CONN BIT(4)
556 #define P2P_GRPCAP_PERSISTENT_RECONN BIT(5)
557 #define P2P_GRPCAP_GROUP_FORMATION BIT(6)
559 /* P2P Public Action Frame ( Management Frame ) */
560 #define P2P_PUB_ACTION_ACTION 0x09
562 /* P2P Public Action Frame Type */
563 #define P2P_GO_NEGO_REQ 0
564 #define P2P_GO_NEGO_RESP 1
565 #define P2P_GO_NEGO_CONF 2
566 #define P2P_INVIT_REQ 3
567 #define P2P_INVIT_RESP 4
568 #define P2P_DEVDISC_REQ 5
569 #define P2P_DEVDISC_RESP 6
570 #define P2P_PROVISION_DISC_REQ 7
571 #define P2P_PROVISION_DISC_RESP 8
573 /* P2P Action Frame Type */
574 #define P2P_NOTICE_OF_ABSENCE 0
575 #define P2P_PRESENCE_REQUEST 1
576 #define P2P_PRESENCE_RESPONSE 2
577 #define P2P_GO_DISC_REQUEST 3
580 #define P2P_MAX_PERSISTENT_GROUP_NUM 10
582 #define P2P_PROVISIONING_SCAN_CNT 3
584 #define P2P_WILDCARD_SSID_LEN 7
586 #define P2P_FINDPHASE_EX_NONE 0 /* default value, used when: (1)p2p disabed or (2)p2p enabled but only do 1 scan phase */
587 #define P2P_FINDPHASE_EX_FULL 1 /* used when p2p enabled and want to do 1 scan phase and P2P_FINDPHASE_EX_MAX-1 find phase */
588 #define P2P_FINDPHASE_EX_SOCIAL_FIRST (P2P_FINDPHASE_EX_FULL+1)
589 #define P2P_FINDPHASE_EX_MAX 4
590 #define P2P_FINDPHASE_EX_SOCIAL_LAST P2P_FINDPHASE_EX_MAX
592 #define P2P_PROVISION_TIMEOUT 5000 /*5 sec timeout for sending the provision discovery request */
593 #define P2P_CONCURRENT_PROVISION_TIMEOUT 3000 /*3 sec timeout for sending the provision discovery request under concurrent mode */
594 #define P2P_GO_NEGO_TIMEOUT 5000 /*5 sec timeout for receiving the group negotation response */
595 #define P2P_CONCURRENT_GO_NEGO_TIMEOUT 3000 /*3 sec timeout for sending the negotiation request under concurrent mode */
596 #define P2P_TX_PRESCAN_TIMEOUT 100 /*100ms */
597 #define P2P_INVITE_TIMEOUT 5000 /*5 sec timeout for sending the invitation request */
598 #define P2P_CONCURRENT_INVITE_TIMEOUT 3000 /*3 sec timeout for sending the invitation request under concurrent mode */
599 #define P2P_RESET_SCAN_CH 25000 /*25 sec t/o to reset the scan channel ( based on channel plan ) */
600 #define P2P_MAX_INTENT 15
602 #define P2P_MAX_NOA_NUM 2
604 /* WPS Configuration Method */
605 #define WPS_CM_NONE 0x0000
606 #define WPS_CM_LABEL 0x0004
607 #define WPS_CM_DISPLYA 0x0008
608 #define WPS_CM_EXTERNAL_NFC_TOKEN 0x0010
609 #define WPS_CM_INTEGRATED_NFC_TOKEN 0x0020
610 #define WPS_CM_NFC_INTERFACE 0x0040
611 #define WPS_CM_PUSH_BUTTON 0x0080
612 #define WPS_CM_KEYPAD 0x0100
613 #define WPS_CM_SW_PUHS_BUTTON 0x0280
614 #define WPS_CM_HW_PUHS_BUTTON 0x0480
615 #define WPS_CM_SW_DISPLAY_PIN 0x2008
616 #define WPS_CM_LCD_DISPLAY_PIN 0x4008
619 P2P_ROLE_DISABLE = 0,
626 P2P_STATE_NONE = 0, /*P2P disable */
627 P2P_STATE_IDLE = 1, /*P2P had enabled and do nothing */
628 P2P_STATE_LISTEN = 2, /*In pure listen state */
629 P2P_STATE_SCAN = 3, /*In scan phase */
630 P2P_STATE_FIND_PHASE_LISTEN = 4, /*In the listen state of find phase */
631 P2P_STATE_FIND_PHASE_SEARCH = 5, /*In the search state of find phase */
632 P2P_STATE_TX_PROVISION_DIS_REQ = 6, /*In P2P provisioning discovery */
633 P2P_STATE_RX_PROVISION_DIS_RSP = 7,
634 P2P_STATE_RX_PROVISION_DIS_REQ = 8,
635 P2P_STATE_GONEGO_ING = 9, /*Doing the group owner negoitation handshake */
636 P2P_STATE_GONEGO_OK = 10, /*finish the group negoitation handshake with success */
637 P2P_STATE_GONEGO_FAIL = 11, /*finish the group negoitation handshake with failure */
638 P2P_STATE_RECV_INVITE_REQ_MATCH = 12, /*receiving the P2P Inviation request and match with the profile. */
639 P2P_STATE_PROVISIONING_ING = 13, /*Doing the P2P WPS */
640 P2P_STATE_PROVISIONING_DONE = 14, /*Finish the P2P WPS */
641 P2P_STATE_TX_INVITE_REQ = 15, /*Transmit the P2P Invitation request */
642 P2P_STATE_RX_INVITE_RESP_OK = 16, /*Receiving the P2P Invitation response */
643 P2P_STATE_RECV_INVITE_REQ_DISMATCH = 17,/*receiving the P2P Inviation request and dismatch with the profile. */
644 P2P_STATE_RECV_INVITE_REQ_GO = 18, /*receiving the P2P Inviation request and this wifi is GO. */
645 P2P_STATE_RECV_INVITE_REQ_JOIN = 19, /*receiving the P2P Inviation request to join an existing P2P Group. */
646 P2P_STATE_RX_INVITE_RESP_FAIL = 20, /*receiving the P2P Inviation response with failure */
647 P2P_STATE_RX_INFOR_NOREADY = 21, /*receiving p2p negotiation response with information is not available */
648 P2P_STATE_TX_INFOR_NOREADY = 22, /*sending p2p negotiation response with information is not available */
653 P2P_GOT_WPSINFO_PEER_DISPLAY_PIN = 1,
654 P2P_GOT_WPSINFO_SELF_DISPLAY_PIN = 2,
655 P2P_GOT_WPSINFO_PBC = 3,
658 #define P2P_PRIVATE_IOCTL_SET_LEN 64
660 enum P2P_PROTO_WK_ID {
661 P2P_FIND_PHASE_WK = 0,
662 P2P_RESTORE_STATE_WK = 1,
663 P2P_PRE_TX_PROVDISC_PROCESS_WK = 2,
664 P2P_PRE_TX_NEGOREQ_PROCESS_WK = 3,
665 P2P_PRE_TX_INVITEREQ_PROCESS_WK = 4,
666 P2P_AP_P2P_CH_SWITCH_PROCESS_WK = 5,
670 #ifdef CONFIG_8723AU_P2P
675 P2P_PS_SCAN_DONE = 3,
676 P2P_PS_ALLSTASLEEP = 4, /* for P2P GO */
683 P2P_PS_MIX = 3, /* CTWindow and NoA */
685 #endif /* CONFIG_8723AU_P2P */
687 /* =====================WFD Section===================== */
688 /* For Wi-Fi Display */
689 #define WFD_ATTR_DEVICE_INFO 0x00
690 #define WFD_ATTR_ASSOC_BSSID 0x01
691 #define WFD_ATTR_COUPLED_SINK_INFO 0x06
692 #define WFD_ATTR_LOCAL_IP_ADDR 0x08
693 #define WFD_ATTR_SESSION_INFO 0x09
694 #define WFD_ATTR_ALTER_MAC 0x0a
696 /* For WFD Device Information Attribute */
697 #define WFD_DEVINFO_SOURCE 0x0000
698 #define WFD_DEVINFO_PSINK 0x0001
699 #define WFD_DEVINFO_SSINK 0x0002
700 #define WFD_DEVINFO_DUAL 0x0003
702 #define WFD_DEVINFO_SESSION_AVAIL 0x0010
703 #define WFD_DEVINFO_WSD 0x0040
704 #define WFD_DEVINFO_PC_TDLS 0x0080
705 #define WFD_DEVINFO_HDCP_SUPPORT 0x0100
707 #endif /* _WIFI_H_ */