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 #define SetToDs(pbuf) \
70 (*(__le16 *)(pbuf) |= cpu_to_le16(IEEE80211_FCTL_TODS))
72 #define SetFrDs(pbuf) \
73 (*(__le16 *)(pbuf) |= cpu_to_le16(IEEE80211_FCTL_FROMDS))
75 #define SetPwrMgt(pbuf) \
76 (*(__le16 *)(pbuf) |= cpu_to_le16(IEEE80211_FCTL_PM))
78 #define SetMData(pbuf) \
79 (*(__le16 *)(pbuf) |= cpu_to_le16(IEEE80211_FCTL_MOREDATA))
81 #define SetPrivacy(pbuf) \
82 (*(__le16 *)(pbuf) |= cpu_to_le16(IEEE80211_FCTL_PROTECTED))
84 #define SetFrameType(pbuf, type) \
86 *(__le16 *)(pbuf) &= __constant_cpu_to_le16(~(BIT(3) | BIT(2))); \
87 *(__le16 *)(pbuf) |= __constant_cpu_to_le16(type); \
90 #define SetFrameSubType(pbuf, type) \
92 *(__le16 *)(pbuf) &= cpu_to_le16(~(BIT(7) | BIT(6) | BIT(5) | BIT(4) | BIT(3) | BIT(2))); \
93 *(__le16 *)(pbuf) |= cpu_to_le16(type); \
96 #define SetFragNum(pbuf, num) \
98 *(unsigned short *)((unsigned long)(pbuf) + 22) = \
99 ((*(unsigned short *)((unsigned long)(pbuf) + 22)) & le16_to_cpu(~(0x000f))) | \
100 cpu_to_le16(0x0f & (num)); \
103 #define SetDuration(pbuf, dur) \
104 (*(__le16 *)((unsigned long)(pbuf) + 2) = \
105 cpu_to_le16(0xffff & (dur)))
107 #define SetPriority(pbuf, tid) \
108 (*(__le16 *)(pbuf) |= cpu_to_le16(tid & 0xf))
110 #define SetEOSP(pbuf, eosp) \
111 (*(__le16 *)(pbuf) |= cpu_to_le16((eosp & 1) << 4))
113 #define SetAckpolicy(pbuf, ack) \
114 (*(__le16 *)(pbuf) |= cpu_to_le16((ack & 3) << 5))
116 #define _ASOCREQ_IE_OFFSET_ 4 /* excluding wlan_hdr */
117 #define _ASOCRSP_IE_OFFSET_ 6
118 #define _REASOCREQ_IE_OFFSET_ 10
119 #define _REASOCRSP_IE_OFFSET_ 6
120 #define _PROBEREQ_IE_OFFSET_ 0
121 #define _PROBERSP_IE_OFFSET_ 12
122 #define _AUTH_IE_OFFSET_ 6
123 #define _DEAUTH_IE_OFFSET_ 0
124 #define _BEACON_IE_OFFSET_ 12
125 #define _PUBLIC_ACTION_IE_OFFSET_ 8
127 #define _FIXED_IE_LENGTH_ _BEACON_IE_OFFSET_
130 #define EID_BSSIntolerantChlReport 73
132 /* ---------------------------------------------------------------------------
133 Below is the fixed elements...
134 -----------------------------------------------------------------------------*/
135 #define _AUTH_ALGM_NUM_ 2
136 #define _AUTH_SEQ_NUM_ 2
137 #define _BEACON_ITERVAL_ 2
138 #define _CAPABILITY_ 2
139 #define _CURRENT_APADDR_ 6
140 #define _LISTEN_INTERVAL_ 2
142 #define _STATUS_CODE_ 2
143 #define _TIMESTAMP_ 8
145 /*-----------------------------------------------------------------------------
146 Below is the definition for WMM
147 ------------------------------------------------------------------------------*/
148 #define _WMM_IE_Length_ 7 /* for WMM STA */
149 #define _WMM_Para_Element_Length_ 24
152 /*-----------------------------------------------------------------------------
153 Below is the definition for 802.11n
154 ------------------------------------------------------------------------------*/
156 /* struct rtw_ieee80211_ht_cap - HT additional information
158 * This structure refers to "HT information element" as
159 * described in 802.11n draft section 7.3.2.53
161 struct ieee80211_ht_addt_info {
162 unsigned char control_chan;
163 unsigned char ht_param;
164 unsigned short operation_mode;
165 unsigned short stbc_param;
166 unsigned char basic_set[16];
169 struct HT_caps_element {
172 unsigned short HT_caps_info;
173 unsigned char AMPDU_para;
174 unsigned char MCS_rate[16];
175 unsigned short HT_ext_caps;
176 unsigned int Beamforming_caps;
177 unsigned char ASEL_caps;
179 unsigned char HT_cap[26];
183 struct HT_info_element {
184 unsigned char primary_channel;
185 unsigned char infos[5];
186 unsigned char MCS_rate[16];
190 unsigned char ACI_AIFSN;
192 unsigned short TXOP_limit;
195 struct WMM_para_element {
196 unsigned char QoS_info;
197 unsigned char reserved;
198 struct AC_param ac_param[4];
201 struct ADDBA_request {
202 unsigned char dialog_token;
203 unsigned short BA_para_set;
204 unsigned short BA_timeout_value;
205 unsigned short BA_starting_seqctrl;
209 /* ===============WPS Section=============== */
210 /* WPS attribute ID */
211 #define WPS_ATTR_VER1 0x104A
212 #define WPS_ATTR_SIMPLE_CONF_STATE 0x1044
213 #define WPS_ATTR_RESP_TYPE 0x103B
214 #define WPS_ATTR_UUID_E 0x1047
215 #define WPS_ATTR_MANUFACTURER 0x1021
216 #define WPS_ATTR_MODEL_NAME 0x1023
217 #define WPS_ATTR_MODEL_NUMBER 0x1024
218 #define WPS_ATTR_SERIAL_NUMBER 0x1042
219 #define WPS_ATTR_PRIMARY_DEV_TYPE 0x1054
220 #define WPS_ATTR_SEC_DEV_TYPE_LIST 0x1055
221 #define WPS_ATTR_DEVICE_NAME 0x1011
222 #define WPS_ATTR_CONF_METHOD 0x1008
223 #define WPS_ATTR_RF_BANDS 0x103C
224 #define WPS_ATTR_DEVICE_PWID 0x1012
225 #define WPS_ATTR_REQUEST_TYPE 0x103A
226 #define WPS_ATTR_ASSOCIATION_STATE 0x1002
227 #define WPS_ATTR_CONFIG_ERROR 0x1009
228 #define WPS_ATTR_VENDOR_EXT 0x1049
229 #define WPS_ATTR_SELECTED_REGISTRAR 0x1041
231 /* WPS Configuration Method */
232 #define WPS_CM_NONE 0x0000
233 #define WPS_CM_LABEL 0x0004
234 #define WPS_CM_DISPLYA 0x0008
235 #define WPS_CM_EXTERNAL_NFC_TOKEN 0x0010
236 #define WPS_CM_INTEGRATED_NFC_TOKEN 0x0020
237 #define WPS_CM_NFC_INTERFACE 0x0040
238 #define WPS_CM_PUSH_BUTTON 0x0080
239 #define WPS_CM_KEYPAD 0x0100
240 #define WPS_CM_SW_PUHS_BUTTON 0x0280
241 #define WPS_CM_HW_PUHS_BUTTON 0x0480
242 #define WPS_CM_SW_DISPLAY_PIN 0x2008
243 #define WPS_CM_LCD_DISPLAY_PIN 0x4008
245 #endif /* _WIFI_H_ */