.. | .. |
---|
35 | 35 | WIFI_MGT_TYPE = (0), |
---|
36 | 36 | WIFI_CTRL_TYPE = (BIT(2)), |
---|
37 | 37 | WIFI_DATA_TYPE = (BIT(3)), |
---|
38 | | - WIFI_QOS_DATA_TYPE = (BIT(7)|BIT(3)), /* QoS Data */ |
---|
| 38 | + WIFI_QOS_DATA_TYPE = (BIT(7) | BIT(3)), /* QoS Data */ |
---|
39 | 39 | }; |
---|
40 | 40 | |
---|
41 | 41 | enum WIFI_FRAME_SUBTYPE { |
---|
.. | .. |
---|
72 | 72 | WIFI_CF_POLL = (BIT(6) | BIT(5) | WIFI_DATA_TYPE), |
---|
73 | 73 | WIFI_CF_ACKPOLL = (BIT(6) | BIT(5) | BIT(4) | WIFI_DATA_TYPE), |
---|
74 | 74 | WIFI_QOS_DATA_NULL = (BIT(6) | WIFI_QOS_DATA_TYPE), |
---|
75 | | -}; |
---|
76 | | - |
---|
77 | | -enum WIFI_REASON_CODE { |
---|
78 | | - _RSON_RESERVED_ = 0, |
---|
79 | | - _RSON_UNSPECIFIED_ = 1, |
---|
80 | | - _RSON_AUTH_NO_LONGER_VALID_ = 2, |
---|
81 | | - _RSON_DEAUTH_STA_LEAVING_ = 3, |
---|
82 | | - _RSON_INACTIVITY_ = 4, |
---|
83 | | - _RSON_UNABLE_HANDLE_ = 5, |
---|
84 | | - _RSON_CLS2_ = 6, |
---|
85 | | - _RSON_CLS3_ = 7, |
---|
86 | | - _RSON_DISAOC_STA_LEAVING_ = 8, |
---|
87 | | - _RSON_ASOC_NOT_AUTH_ = 9, |
---|
88 | | - |
---|
89 | | - /* WPA reason */ |
---|
90 | | - _RSON_INVALID_IE_ = 13, |
---|
91 | | - _RSON_MIC_FAILURE_ = 14, |
---|
92 | | - _RSON_4WAY_HNDSHK_TIMEOUT_ = 15, |
---|
93 | | - _RSON_GROUP_KEY_UPDATE_TIMEOUT_ = 16, |
---|
94 | | - _RSON_DIFF_IE_ = 17, |
---|
95 | | - _RSON_MLTCST_CIPHER_NOT_VALID_ = 18, |
---|
96 | | - _RSON_UNICST_CIPHER_NOT_VALID_ = 19, |
---|
97 | | - _RSON_AKMP_NOT_VALID_ = 20, |
---|
98 | | - _RSON_UNSUPPORT_RSNE_VER_ = 21, |
---|
99 | | - _RSON_INVALID_RSNE_CAP_ = 22, |
---|
100 | | - _RSON_IEEE_802DOT1X_AUTH_FAIL_ = 23, |
---|
101 | | - |
---|
102 | | - /* belowing are Realtek definition */ |
---|
103 | | - _RSON_PMK_NOT_AVAILABLE_ = 24, |
---|
104 | | - _RSON_TDLS_TEAR_TOOFAR_ = 25, |
---|
105 | | - _RSON_TDLS_TEAR_UN_RSN_ = 26, |
---|
106 | 75 | }; |
---|
107 | 76 | |
---|
108 | 77 | enum WIFI_STATUS_CODE { |
---|
.. | .. |
---|
159 | 128 | *(__le16 *)(pbuf) &= (~cpu_to_le16(_FROM_DS_)) |
---|
160 | 129 | |
---|
161 | 130 | #define get_tofr_ds(pframe) ((GetToDs(pframe) << 1) | GetFrDs(pframe)) |
---|
162 | | - |
---|
163 | 131 | |
---|
164 | 132 | #define SetMFrag(pbuf) \ |
---|
165 | 133 | *(__le16 *)(pbuf) |= cpu_to_le16(_MORE_FRAG_) |
---|
.. | .. |
---|
231 | 199 | #define SetDuration(pbuf, dur) \ |
---|
232 | 200 | *(__le16 *)((size_t)(pbuf) + 2) = cpu_to_le16(0xffff & (dur)) |
---|
233 | 201 | |
---|
234 | | - |
---|
235 | 202 | #define SetPriority(pbuf, tid) \ |
---|
236 | 203 | *(__le16 *)(pbuf) |= cpu_to_le16(tid & 0xf) |
---|
237 | 204 | |
---|
.. | .. |
---|
256 | 223 | #define GetAddr3Ptr(pbuf) ((unsigned char *)((size_t)(pbuf) + 16)) |
---|
257 | 224 | |
---|
258 | 225 | #define GetAddr4Ptr(pbuf) ((unsigned char *)((size_t)(pbuf) + 24)) |
---|
259 | | - |
---|
260 | | -static inline int IS_MCAST(unsigned char *da) |
---|
261 | | -{ |
---|
262 | | - if ((*da) & 0x01) |
---|
263 | | - return true; |
---|
264 | | - else |
---|
265 | | - return false; |
---|
266 | | -} |
---|
267 | 226 | |
---|
268 | 227 | static inline unsigned char *get_da(unsigned char *pframe) |
---|
269 | 228 | { |
---|
.. | .. |
---|
336 | 295 | |
---|
337 | 296 | static inline int IsFrameTypeCtrl(unsigned char *pframe) |
---|
338 | 297 | { |
---|
339 | | - if (WIFI_CTRL_TYPE == GetFrameType(pframe)) |
---|
| 298 | + if (GetFrameType(pframe) == WIFI_CTRL_TYPE) |
---|
340 | 299 | return true; |
---|
341 | 300 | else |
---|
342 | 301 | return false; |
---|
343 | 302 | } |
---|
| 303 | + |
---|
344 | 304 | /*----------------------------------------------------------------------------- |
---|
345 | 305 | Below is for the security related definition |
---|
346 | 306 | ------------------------------------------------------------------------------*/ |
---|
.. | .. |
---|
391 | 351 | #define _HT_EXTRA_INFO_IE_ 61 |
---|
392 | 352 | #define _HT_ADD_INFO_IE_ 61 /* _HT_EXTRA_INFO_IE_ */ |
---|
393 | 353 | #define _WAPI_IE_ 68 |
---|
394 | | - |
---|
395 | 354 | |
---|
396 | 355 | #define EID_BSSCoexistence 72 /* 20/40 BSS Coexistence */ |
---|
397 | 356 | #define EID_BSSIntolerantChlReport 73 |
---|
.. | .. |
---|
460 | 419 | #define _WMM_IE_Length_ 7 /* for WMM STA */ |
---|
461 | 420 | #define _WMM_Para_Element_Length_ 24 |
---|
462 | 421 | |
---|
463 | | - |
---|
464 | 422 | /*----------------------------------------------------------------------------- |
---|
465 | 423 | Below is the definition for 802.11n |
---|
466 | 424 | ------------------------------------------------------------------------------*/ |
---|
467 | | - |
---|
468 | | -/* 802.11 BAR control masks */ |
---|
469 | | -#define IEEE80211_BAR_CTRL_ACK_POLICY_NORMAL 0x0000 |
---|
470 | | -#define IEEE80211_BAR_CTRL_CBMTID_COMPRESSED_BA 0x0004 |
---|
471 | 425 | |
---|
472 | 426 | /** |
---|
473 | 427 | * struct rtw_ieee80211_ht_cap - HT additional information |
---|
.. | .. |
---|
514 | 468 | MAX_AMPDU_FACTOR_32K = 2, |
---|
515 | 469 | MAX_AMPDU_FACTOR_64K = 3, |
---|
516 | 470 | }; |
---|
517 | | - |
---|
518 | | -/* 802.11n HT capabilities masks */ |
---|
519 | | -#define IEEE80211_HT_CAP_SUP_WIDTH 0x0002 |
---|
520 | | -#define IEEE80211_HT_CAP_SM_PS 0x000C |
---|
521 | | -#define IEEE80211_HT_CAP_GRN_FLD 0x0010 |
---|
522 | | -#define IEEE80211_HT_CAP_SGI_20 0x0020 |
---|
523 | | -#define IEEE80211_HT_CAP_SGI_40 0x0040 |
---|
524 | | -#define IEEE80211_HT_CAP_TX_STBC 0x0080 |
---|
525 | | -#define IEEE80211_HT_CAP_RX_STBC 0x0300 |
---|
526 | | -#define IEEE80211_HT_CAP_DELAY_BA 0x0400 |
---|
527 | | -#define IEEE80211_HT_CAP_MAX_AMSDU 0x0800 |
---|
528 | | -#define IEEE80211_HT_CAP_DSSSCCK40 0x1000 |
---|
529 | | -/* 802.11n HT capability AMPDU settings */ |
---|
530 | | -#define IEEE80211_HT_CAP_AMPDU_FACTOR 0x03 |
---|
531 | | -#define IEEE80211_HT_CAP_AMPDU_DENSITY 0x1C |
---|
532 | | -/* 802.11n HT capability MSC set */ |
---|
533 | | -#define IEEE80211_SUPP_MCS_SET_UEQM 4 |
---|
534 | | -#define IEEE80211_HT_CAP_MAX_STREAMS 4 |
---|
535 | | -#define IEEE80211_SUPP_MCS_SET_LEN 10 |
---|
536 | | -/* maximum streams the spec allows */ |
---|
537 | | -#define IEEE80211_HT_CAP_MCS_TX_DEFINED 0x01 |
---|
538 | | -#define IEEE80211_HT_CAP_MCS_TX_RX_DIFF 0x02 |
---|
539 | | -#define IEEE80211_HT_CAP_MCS_TX_STREAMS 0x0C |
---|
540 | | -#define IEEE80211_HT_CAP_MCS_TX_UEQM 0x10 |
---|
541 | | -/* 802.11n HT IE masks */ |
---|
542 | | -#define IEEE80211_HT_IE_CHA_SEC_OFFSET 0x03 |
---|
543 | | -#define IEEE80211_HT_IE_CHA_SEC_NONE 0x00 |
---|
544 | | -#define IEEE80211_HT_IE_CHA_SEC_ABOVE 0x01 |
---|
545 | | -#define IEEE80211_HT_IE_CHA_SEC_BELOW 0x03 |
---|
546 | | -#define IEEE80211_HT_IE_CHA_WIDTH 0x04 |
---|
547 | | -#define IEEE80211_HT_IE_HT_PROTECTION 0x0003 |
---|
548 | | -#define IEEE80211_HT_IE_NON_GF_STA_PRSNT 0x0004 |
---|
549 | | -#define IEEE80211_HT_IE_NON_HT_STA_PRSNT 0x0010 |
---|
550 | | - |
---|
551 | | -/* block-ack parameters */ |
---|
552 | | -#define IEEE80211_ADDBA_PARAM_POLICY_MASK 0x0002 |
---|
553 | | -#define IEEE80211_ADDBA_PARAM_TID_MASK 0x003C |
---|
554 | | -#define RTW_IEEE80211_ADDBA_PARAM_BUF_SIZE_MASK 0xFFC0 |
---|
555 | | -#define IEEE80211_DELBA_PARAM_TID_MASK 0xF000 |
---|
556 | | -#define IEEE80211_DELBA_PARAM_INITIATOR_MASK 0x0800 |
---|
557 | | - |
---|
558 | | -/* |
---|
559 | | - * A-PMDU buffer sizes |
---|
560 | | - * According to IEEE802.11n spec size varies from 8K to 64K (in powers of 2) |
---|
561 | | - */ |
---|
562 | | -#define IEEE80211_MIN_AMPDU_BUF 0x8 |
---|
563 | | - |
---|
564 | 471 | |
---|
565 | 472 | #define OP_MODE_PURE 0 |
---|
566 | 473 | #define OP_MODE_MAY_BE_LEGACY_STAS 1 |
---|
.. | .. |
---|
675 | 582 | #define WPS_ASSOC_STATE_ASSOCIATION_FAILURE 0x03 |
---|
676 | 583 | #define WPS_ASSOC_STATE_IP_FAILURE 0x04 |
---|
677 | 584 | |
---|
678 | | -/* =====================P2P Section===================== */ |
---|
679 | | -/* For P2P */ |
---|
680 | | -#define P2POUI 0x506F9A09 |
---|
681 | | - |
---|
682 | | -/* P2P Attribute ID */ |
---|
683 | | -#define P2P_ATTR_STATUS 0x00 |
---|
684 | | -#define P2P_ATTR_MINOR_REASON_CODE 0x01 |
---|
685 | | -#define P2P_ATTR_CAPABILITY 0x02 |
---|
686 | | -#define P2P_ATTR_DEVICE_ID 0x03 |
---|
687 | | -#define P2P_ATTR_GO_INTENT 0x04 |
---|
688 | | -#define P2P_ATTR_CONF_TIMEOUT 0x05 |
---|
689 | | -#define P2P_ATTR_LISTEN_CH 0x06 |
---|
690 | | -#define P2P_ATTR_GROUP_BSSID 0x07 |
---|
691 | | -#define P2P_ATTR_EX_LISTEN_TIMING 0x08 |
---|
692 | | -#define P2P_ATTR_INTENTED_IF_ADDR 0x09 |
---|
693 | | -#define P2P_ATTR_MANAGEABILITY 0x0A |
---|
694 | | -#define P2P_ATTR_CH_LIST 0x0B |
---|
695 | | -#define P2P_ATTR_NOA 0x0C |
---|
696 | | -#define P2P_ATTR_DEVICE_INFO 0x0D |
---|
697 | | -#define P2P_ATTR_GROUP_INFO 0x0E |
---|
698 | | -#define P2P_ATTR_GROUP_ID 0x0F |
---|
699 | | -#define P2P_ATTR_INTERFACE 0x10 |
---|
700 | | -#define P2P_ATTR_OPERATING_CH 0x11 |
---|
701 | | -#define P2P_ATTR_INVITATION_FLAGS 0x12 |
---|
702 | | - |
---|
703 | | -/* Value of Status Attribute */ |
---|
704 | | -#define P2P_STATUS_SUCCESS 0x00 |
---|
705 | | -#define P2P_STATUS_FAIL_INFO_UNAVAILABLE 0x01 |
---|
706 | | -#define P2P_STATUS_FAIL_INCOMPATIBLE_PARAM 0x02 |
---|
707 | | -#define P2P_STATUS_FAIL_LIMIT_REACHED 0x03 |
---|
708 | | -#define P2P_STATUS_FAIL_INVALID_PARAM 0x04 |
---|
709 | | -#define P2P_STATUS_FAIL_REQUEST_UNABLE 0x05 |
---|
710 | | -#define P2P_STATUS_FAIL_PREVOUS_PROTO_ERR 0x06 |
---|
711 | | -#define P2P_STATUS_FAIL_NO_COMMON_CH 0x07 |
---|
712 | | -#define P2P_STATUS_FAIL_UNKNOWN_P2PGROUP 0x08 |
---|
713 | | -#define P2P_STATUS_FAIL_BOTH_GOINTENT_15 0x09 |
---|
714 | | -#define P2P_STATUS_FAIL_INCOMPATIBLE_PROVSION 0x0A |
---|
715 | | -#define P2P_STATUS_FAIL_USER_REJECT 0x0B |
---|
716 | | - |
---|
717 | | -/* Value of Invitation Flags Attribute */ |
---|
718 | | - |
---|
719 | | -/* Value of Device Capability Bitmap */ |
---|
720 | | -#define P2P_DEVCAP_SERVICE_DISCOVERY BIT(0) |
---|
721 | | -#define P2P_DEVCAP_CLIENT_DISCOVERABILITY BIT(1) |
---|
722 | | -#define P2P_DEVCAP_CONCURRENT_OPERATION BIT(2) |
---|
723 | | -#define P2P_DEVCAP_INFRA_MANAGED BIT(3) |
---|
724 | | -#define P2P_DEVCAP_DEVICE_LIMIT BIT(4) |
---|
725 | | -#define P2P_DEVCAP_INVITATION_PROC BIT(5) |
---|
726 | | - |
---|
727 | | -/* Value of Group Capability Bitmap */ |
---|
728 | | -#define P2P_GRPCAP_GO BIT(0) |
---|
729 | | -#define P2P_GRPCAP_PERSISTENT_GROUP BIT(1) |
---|
730 | | -#define P2P_GRPCAP_GROUP_LIMIT BIT(2) |
---|
731 | | -#define P2P_GRPCAP_INTRABSS BIT(3) |
---|
732 | | -#define P2P_GRPCAP_CROSS_CONN BIT(4) |
---|
733 | | -#define P2P_GRPCAP_PERSISTENT_RECONN BIT(5) |
---|
734 | | -#define P2P_GRPCAP_GROUP_FORMATION BIT(6) |
---|
735 | | - |
---|
736 | | -/* P2P Public Action Frame (Management Frame) */ |
---|
737 | | -#define P2P_PUB_ACTION_ACTION 0x09 |
---|
738 | | - |
---|
739 | | -/* P2P Public Action Frame Type */ |
---|
740 | | -#define P2P_GO_NEGO_REQ 0 |
---|
741 | | -#define P2P_GO_NEGO_RESP 1 |
---|
742 | | -#define P2P_GO_NEGO_CONF 2 |
---|
743 | | -#define P2P_INVIT_REQ 3 |
---|
744 | | -#define P2P_INVIT_RESP 4 |
---|
745 | | -#define P2P_DEVDISC_REQ 5 |
---|
746 | | -#define P2P_DEVDISC_RESP 6 |
---|
747 | | -#define P2P_PROVISION_DISC_REQ 7 |
---|
748 | | -#define P2P_PROVISION_DISC_RESP 8 |
---|
749 | | - |
---|
750 | | -/* P2P Action Frame Type */ |
---|
751 | | -#define P2P_NOTICE_OF_ABSENCE 0 |
---|
752 | | -#define P2P_PRESENCE_REQUEST 1 |
---|
753 | | -#define P2P_PRESENCE_RESPONSE 2 |
---|
754 | | -#define P2P_GO_DISC_REQUEST 3 |
---|
755 | | - |
---|
756 | | -#define P2P_PROVISIONING_SCAN_CNT 3 |
---|
757 | | - |
---|
758 | | -/* default value, used when: (1)p2p disabled or (2)p2p enabled |
---|
759 | | - * but only do 1 scan phase |
---|
760 | | - */ |
---|
761 | | -#define P2P_FINDPHASE_EX_NONE 0 |
---|
762 | | -/* used when p2p enabled and want to do 1 scan phase and |
---|
763 | | - * P2P_FINDPHASE_EX_MAX-1 find phase |
---|
764 | | - */ |
---|
765 | | -#define P2P_FINDPHASE_EX_FULL 1 |
---|
766 | | -#define P2P_FINDPHASE_EX_SOCIAL_FIRST (P2P_FINDPHASE_EX_FULL+1) |
---|
767 | | -#define P2P_FINDPHASE_EX_MAX 4 |
---|
768 | | -#define P2P_FINDPHASE_EX_SOCIAL_LAST P2P_FINDPHASE_EX_MAX |
---|
769 | | - |
---|
770 | | -/* 5 seconds timeout for sending the provision discovery request */ |
---|
771 | | -#define P2P_PROVISION_TIMEOUT 5000 |
---|
772 | | -/* 3 seconds timeout for sending the prov disc request concurrent mode */ |
---|
773 | | -#define P2P_CONCURRENT_PROVISION_TIME 3000 |
---|
774 | | -/* 5 seconds timeout for receiving the group negotiation response */ |
---|
775 | | -#define P2P_GO_NEGO_TIMEOUT 5000 |
---|
776 | | -/* 3 seconds timeout for sending the negotiation request under concurrent mode */ |
---|
777 | | -#define P2P_CONCURRENT_GO_NEGO_TIME 3000 |
---|
778 | | -/* 100ms */ |
---|
779 | | -#define P2P_TX_PRESCAN_TIMEOUT 100 |
---|
780 | | -/* 5 seconds timeout for sending the invitation request */ |
---|
781 | | -#define P2P_INVITE_TIMEOUT 5000 |
---|
782 | | -/* 3 seconds timeout for sending the invitation request under concurrent mode */ |
---|
783 | | -#define P2P_CONCURRENT_INVITE_TIME 3000 |
---|
784 | | -/* 25 seconds timeout to reset the scan channel (based on channel plan) */ |
---|
785 | | -#define P2P_RESET_SCAN_CH 25000 |
---|
786 | | -#define P2P_MAX_INTENT 15 |
---|
787 | | - |
---|
788 | 585 | /* WPS Configuration Method */ |
---|
789 | 586 | #define WPS_CM_NONE 0x0000 |
---|
790 | 587 | #define WPS_CM_LABEL 0x0004 |
---|
.. | .. |
---|
798 | 595 | #define WPS_CM_HW_PUHS_BUTTON 0x0480 |
---|
799 | 596 | #define WPS_CM_SW_DISPLAY_P 0x2008 |
---|
800 | 597 | #define WPS_CM_LCD_DISPLAY_P 0x4008 |
---|
801 | | - |
---|
802 | | -#define P2P_PRIVATE_IOCTL_SET_LEN 64 |
---|
803 | | - |
---|
804 | | -enum P2P_PROTO_WK_ID { |
---|
805 | | - P2P_FIND_PHASE_WK = 0, |
---|
806 | | - P2P_RESTORE_STATE_WK = 1, |
---|
807 | | - P2P_PRE_TX_PROVDISC_PROCESS_WK = 2, |
---|
808 | | - P2P_PRE_TX_NEGOREQ_PROCESS_WK = 3, |
---|
809 | | - P2P_PRE_TX_INVITEREQ_PROCESS_WK = 4, |
---|
810 | | - P2P_AP_P2P_CH_SWITCH_PROCESS_WK = 5, |
---|
811 | | - P2P_RO_CH_WK = 6, |
---|
812 | | -}; |
---|
813 | | - |
---|
814 | | -/* =====================WFD Section===================== */ |
---|
815 | | -/* For Wi-Fi Display */ |
---|
816 | | -#define WFD_ATTR_DEVICE_INFO 0x00 |
---|
817 | | -#define WFD_ATTR_ASSOC_BSSID 0x01 |
---|
818 | | -#define WFD_ATTR_COUPLED_SINK_INFO 0x06 |
---|
819 | | -#define WFD_ATTR_LOCAL_IP_ADDR 0x08 |
---|
820 | | -#define WFD_ATTR_SESSION_INFO 0x09 |
---|
821 | | -#define WFD_ATTR_ALTER_MAC 0x0a |
---|
822 | | - |
---|
823 | | -/* For WFD Device Information Attribute */ |
---|
824 | | -#define WFD_DEVINFO_SOURCE 0x0000 |
---|
825 | | -#define WFD_DEVINFO_PSINK 0x0001 |
---|
826 | | -#define WFD_DEVINFO_SSINK 0x0002 |
---|
827 | | -#define WFD_DEVINFO_DUAL 0x0003 |
---|
828 | | - |
---|
829 | | -#define WFD_DEVINFO_SESSION_AVAIL 0x0010 |
---|
830 | | -#define WFD_DEVINFO_WSD 0x0040 |
---|
831 | | -#define WFD_DEVINFO_PC_TDLS 0x0080 |
---|
832 | | -#define WFD_DEVINFO_HDCP_SUPPORT 0x0100 |
---|
833 | 598 | |
---|
834 | 599 | #define IP_MCAST_MAC(mac) \ |
---|
835 | 600 | ((mac[0] == 0x01) && (mac[1] == 0x00) && (mac[2] == 0x5e)) |
---|