]> git.karo-electronics.de Git - karo-tx-linux.git/blob - drivers/staging/rtl8723au/include/wifi.h
staging: rtl8723au: wifi.h: Remove unused SetRetry() + SetAMsdu() macros
[karo-tx-linux.git] / drivers / staging / rtl8723au / include / wifi.h
1 /******************************************************************************
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  ******************************************************************************/
15 #ifndef _WIFI_H_
16 #define _WIFI_H_
17
18 #define P80211CAPTURE_VERSION   0x80211001
19
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.
23  */
24 #define WiFiNavUpperUs          30000   /*  30 ms */
25
26 enum WIFI_FRAME_TYPE {
27         WIFI_MGT_TYPE  =        (0),
28         WIFI_CTRL_TYPE =        (BIT(2)),
29         WIFI_DATA_TYPE =        (BIT(3)),
30         WIFI_QOS_DATA_TYPE      = (BIT(7)|BIT(3)),      /*  QoS Data */
31 };
32
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),
47
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),
55
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),
66 };
67
68
69 enum WIFI_REG_DOMAIN {
70         DOMAIN_FCC              = 1,
71         DOMAIN_IC               = 2,
72         DOMAIN_ETSI             = 3,
73         DOMAIN_SPAIN            = 4,
74         DOMAIN_FRANCE           = 5,
75         DOMAIN_MKK              = 6,
76         DOMAIN_ISRAEL           = 7,
77         DOMAIN_MKK1             = 8,
78         DOMAIN_MKK2             = 9,
79         DOMAIN_MKK3             = 10,
80         DOMAIN_MAX
81 };
82
83
84 #define SetToDs(pbuf)   \
85         (*(__le16 *)(pbuf) |= cpu_to_le16(IEEE80211_FCTL_TODS))
86
87 #define SetFrDs(pbuf)   \
88         (*(__le16 *)(pbuf) |= cpu_to_le16(IEEE80211_FCTL_FROMDS))
89
90 #define SetPwrMgt(pbuf) \
91         (*(__le16 *)(pbuf) |= cpu_to_le16(IEEE80211_FCTL_PM))
92
93 #define SetMData(pbuf)  \
94         (*(__le16 *)(pbuf) |= cpu_to_le16(IEEE80211_FCTL_MOREDATA))
95
96 #define SetPrivacy(pbuf)        \
97         (*(__le16 *)(pbuf) |= cpu_to_le16(IEEE80211_FCTL_PROTECTED))
98
99 #define SetFrameType(pbuf, type)        \
100         do {    \
101                 *(__le16 *)(pbuf) &= __constant_cpu_to_le16(~(BIT(3) | BIT(2))); \
102                 *(__le16 *)(pbuf) |= __constant_cpu_to_le16(type); \
103         } while (0)
104
105 #define SetFrameSubType(pbuf, type) \
106         do {    \
107                 *(__le16 *)(pbuf) &= cpu_to_le16(~(BIT(7) | BIT(6) | BIT(5) | BIT(4) | BIT(3) | BIT(2))); \
108                 *(__le16 *)(pbuf) |= cpu_to_le16(type); \
109         } while (0)
110
111 #define SetFragNum(pbuf, num) \
112         do {    \
113                 *(unsigned short *)((unsigned long)(pbuf) + 22) = \
114                         ((*(unsigned short *)((unsigned long)(pbuf) + 22)) & le16_to_cpu(~(0x000f))) | \
115                         cpu_to_le16(0x0f & (num));     \
116         } while (0)
117
118 #define SetSeqNum(pbuf, num) \
119         do {    \
120                 *(__le16 *)((size_t)(pbuf) + 22) = \
121                         ((*(__le16 *)((size_t)(pbuf) + 22)) & cpu_to_le16((unsigned short)0x000f)) | \
122                         cpu_to_le16((unsigned short)(0xfff0 & (num << 4))); \
123         } while (0)
124
125 #define SetDuration(pbuf, dur) \
126         (*(__le16 *)((unsigned long)(pbuf) + 2) =               \
127          cpu_to_le16(0xffff & (dur)))
128
129 #define SetPriority(pbuf, tid)  \
130         (*(__le16 *)(pbuf) |= cpu_to_le16(tid & 0xf))
131
132 #define SetEOSP(pbuf, eosp)     \
133         (*(__le16 *)(pbuf) |= cpu_to_le16((eosp & 1) << 4))
134
135 #define SetAckpolicy(pbuf, ack) \
136         (*(__le16 *)(pbuf) |= cpu_to_le16((ack & 3) << 5))
137
138 #define _ASOCREQ_IE_OFFSET_             4       /*  excluding wlan_hdr */
139 #define _ASOCRSP_IE_OFFSET_             6
140 #define _REASOCREQ_IE_OFFSET_           10
141 #define _REASOCRSP_IE_OFFSET_           6
142 #define _PROBEREQ_IE_OFFSET_            0
143 #define _PROBERSP_IE_OFFSET_            12
144 #define _AUTH_IE_OFFSET_                6
145 #define _DEAUTH_IE_OFFSET_              0
146 #define _BEACON_IE_OFFSET_              12
147 #define _PUBLIC_ACTION_IE_OFFSET_       8
148
149 #define _FIXED_IE_LENGTH_               _BEACON_IE_OFFSET_
150
151
152 #define EID_BSSIntolerantChlReport      73
153
154 /* ---------------------------------------------------------------------------
155                                         Below is the fixed elements...
156 -----------------------------------------------------------------------------*/
157 #define _AUTH_ALGM_NUM_         2
158 #define _AUTH_SEQ_NUM_          2
159 #define _BEACON_ITERVAL_        2
160 #define _CAPABILITY_            2
161 #define _CURRENT_APADDR_        6
162 #define _LISTEN_INTERVAL_       2
163 #define _ASOC_ID_               2
164 #define _STATUS_CODE_           2
165 #define _TIMESTAMP_             8
166
167 #define cap_ESS         BIT(0)
168 #define cap_IBSS        BIT(1)
169 #define cap_CFPollable  BIT(2)
170 #define cap_CFRequest   BIT(3)
171 #define cap_Privacy     BIT(4)
172 #define cap_ShortPremble BIT(5)
173 #define cap_PBCC        BIT(6)
174 #define cap_ChAgility   BIT(7)
175 #define cap_SpecMgmt    BIT(8)
176 #define cap_QoS         BIT(9)
177 #define cap_ShortSlot   BIT(10)
178
179 /*-----------------------------------------------------------------------------
180                                 Below is the definition for WMM
181 ------------------------------------------------------------------------------*/
182 #define _WMM_IE_Length_                         7  /*  for WMM STA */
183 #define _WMM_Para_Element_Length_               24
184
185
186 /*-----------------------------------------------------------------------------
187                                 Below is the definition for 802.11n
188 ------------------------------------------------------------------------------*/
189
190 /* struct rtw_ieee80211_ht_cap - HT additional information
191  *
192  * This structure refers to "HT information element" as
193  * described in 802.11n draft section 7.3.2.53
194  */
195 struct ieee80211_ht_addt_info {
196         unsigned char   control_chan;
197         unsigned char   ht_param;
198         unsigned short  operation_mode;
199         unsigned short  stbc_param;
200         unsigned char   basic_set[16];
201 } __packed;
202
203 struct HT_caps_element {
204         union {
205                 struct {
206                         unsigned short  HT_caps_info;
207                         unsigned char   AMPDU_para;
208                         unsigned char   MCS_rate[16];
209                         unsigned short  HT_ext_caps;
210                         unsigned int    Beamforming_caps;
211                         unsigned char   ASEL_caps;
212                 } HT_cap_element;
213                 unsigned char HT_cap[26];
214         } u;
215 } __packed;
216
217 struct HT_info_element {
218         unsigned char   primary_channel;
219         unsigned char   infos[5];
220         unsigned char   MCS_rate[16];
221 }  __packed;
222
223 struct AC_param {
224         unsigned char           ACI_AIFSN;
225         unsigned char           CW;
226         unsigned short  TXOP_limit;
227 }  __packed;
228
229 struct WMM_para_element {
230         unsigned char           QoS_info;
231         unsigned char           reserved;
232         struct AC_param ac_param[4];
233 }  __packed;
234
235 struct ADDBA_request {
236         unsigned char           dialog_token;
237         unsigned short  BA_para_set;
238         unsigned short  BA_timeout_value;
239         unsigned short  BA_starting_seqctrl;
240 }  __packed;
241
242
243 #define OP_MODE_PURE                    0
244 #define OP_MODE_MAY_BE_LEGACY_STAS      1
245 #define OP_MODE_20MHZ_HT_STA_ASSOCED    2
246 #define OP_MODE_MIXED                   3
247
248 #define HT_INFO_HT_PARAM_SECONDARY_CHNL_OFF_MASK        ((u8) BIT(0) | BIT(1))
249 #define HT_INFO_HT_PARAM_SECONDARY_CHNL_ABOVE           ((u8) BIT(0))
250 #define HT_INFO_HT_PARAM_SECONDARY_CHNL_BELOW           ((u8) BIT(0) | BIT(1))
251 #define HT_INFO_HT_PARAM_REC_TRANS_CHNL_WIDTH           ((u8) BIT(2))
252 #define HT_INFO_HT_PARAM_RIFS_MODE                      ((u8) BIT(3))
253 #define HT_INFO_HT_PARAM_CTRL_ACCESS_ONLY               ((u8) BIT(4))
254 #define HT_INFO_HT_PARAM_SRV_INTERVAL_GRANULARITY       ((u8) BIT(5))
255
256 #define HT_INFO_OPERATION_MODE_OP_MODE_MASK     \
257                 ((u16) (0x0001 | 0x0002))
258 #define HT_INFO_OPERATION_MODE_OP_MODE_OFFSET           0
259 #define HT_INFO_OPERATION_MODE_NON_GF_DEVS_PRESENT      ((u8) BIT(2))
260 #define HT_INFO_OPERATION_MODE_TRANSMIT_BURST_LIMIT     ((u8) BIT(3))
261 #define HT_INFO_OPERATION_MODE_NON_HT_STA_PRESENT       ((u8) BIT(4))
262
263 #define HT_INFO_STBC_PARAM_DUAL_BEACON          ((u16) BIT(6))
264 #define HT_INFO_STBC_PARAM_DUAL_STBC_PROTECT    ((u16) BIT(7))
265 #define HT_INFO_STBC_PARAM_SECONDARY_BCN        ((u16) BIT(8))
266 #define HT_INFO_STBC_PARAM_LSIG_TXOP_PROTECT_ALLOWED    ((u16) BIT(9))
267 #define HT_INFO_STBC_PARAM_PCO_ACTIVE           ((u16) BIT(10))
268 #define HT_INFO_STBC_PARAM_PCO_PHASE            ((u16) BIT(11))
269
270
271
272 /*      ===============WPS Section=============== */
273 /*      For WPSv1.0 */
274 #define WPSOUI                                  0x0050f204
275 /*      WPS attribute ID */
276 #define WPS_ATTR_VER1                           0x104A
277 #define WPS_ATTR_SIMPLE_CONF_STATE              0x1044
278 #define WPS_ATTR_RESP_TYPE                      0x103B
279 #define WPS_ATTR_UUID_E                         0x1047
280 #define WPS_ATTR_MANUFACTURER                   0x1021
281 #define WPS_ATTR_MODEL_NAME                     0x1023
282 #define WPS_ATTR_MODEL_NUMBER                   0x1024
283 #define WPS_ATTR_SERIAL_NUMBER                  0x1042
284 #define WPS_ATTR_PRIMARY_DEV_TYPE               0x1054
285 #define WPS_ATTR_SEC_DEV_TYPE_LIST              0x1055
286 #define WPS_ATTR_DEVICE_NAME                    0x1011
287 #define WPS_ATTR_CONF_METHOD                    0x1008
288 #define WPS_ATTR_RF_BANDS                       0x103C
289 #define WPS_ATTR_DEVICE_PWID                    0x1012
290 #define WPS_ATTR_REQUEST_TYPE                   0x103A
291 #define WPS_ATTR_ASSOCIATION_STATE              0x1002
292 #define WPS_ATTR_CONFIG_ERROR                   0x1009
293 #define WPS_ATTR_VENDOR_EXT                     0x1049
294 #define WPS_ATTR_SELECTED_REGISTRAR             0x1041
295
296 /*      Value of WPS attribute "WPS_ATTR_DEVICE_NAME */
297 #define WPS_MAX_DEVICE_NAME_LEN                 32
298
299 /*      Value of WPS Request Type Attribute */
300 #define WPS_REQ_TYPE_ENROLLEE_INFO_ONLY         0x00
301 #define WPS_REQ_TYPE_ENROLLEE_OPEN_8021X        0x01
302 #define WPS_REQ_TYPE_REGISTRAR                  0x02
303 #define WPS_REQ_TYPE_WLAN_MANAGER_REGISTRAR     0x03
304
305 /*      Value of WPS Response Type Attribute */
306 #define WPS_RESPONSE_TYPE_INFO_ONLY             0x00
307 #define WPS_RESPONSE_TYPE_8021X                 0x01
308 #define WPS_RESPONSE_TYPE_REGISTRAR             0x02
309 #define WPS_RESPONSE_TYPE_AP                    0x03
310
311 /*      Value of WPS WiFi Simple Configuration State Attribute */
312 #define WPS_WSC_STATE_NOT_CONFIG                0x01
313 #define WPS_WSC_STATE_CONFIG                    0x02
314
315 /*      Value of WPS Version Attribute */
316 #define WPS_VERSION_1                           0x10
317
318 /*      Value of WPS Configuration Method Attribute */
319 #define WPS_CONFIG_METHOD_FLASH                 0x0001
320 #define WPS_CONFIG_METHOD_ETHERNET              0x0002
321 #define WPS_CONFIG_METHOD_LABEL                 0x0004
322 #define WPS_CONFIG_METHOD_DISPLAY               0x0008
323 #define WPS_CONFIG_METHOD_E_NFC                 0x0010
324 #define WPS_CONFIG_METHOD_I_NFC                 0x0020
325 #define WPS_CONFIG_METHOD_NFC                   0x0040
326 #define WPS_CONFIG_METHOD_PBC                   0x0080
327 #define WPS_CONFIG_METHOD_KEYPAD                0x0100
328 #define WPS_CONFIG_METHOD_VPBC                  0x0280
329 #define WPS_CONFIG_METHOD_PPBC                  0x0480
330 #define WPS_CONFIG_METHOD_VDISPLAY              0x2008
331 #define WPS_CONFIG_METHOD_PDISPLAY              0x4008
332
333 /*      Value of Category ID of WPS Primary Device Type Attribute */
334 #define WPS_PDT_CID_DISPLAYS                    0x0007
335 #define WPS_PDT_CID_MULIT_MEDIA                 0x0008
336 #define WPS_PDT_CID_RTK_WIDI                    WPS_PDT_CID_MULIT_MEDIA
337
338 /*      Value of Sub Category ID of WPS Primary Device Type Attribute */
339 #define WPS_PDT_SCID_MEDIA_SERVER               0x0005
340 #define WPS_PDT_SCID_RTK_DMP                    WPS_PDT_SCID_MEDIA_SERVER
341
342 /*      Value of Device Password ID */
343 #define WPS_DPID_PIN                            0x0000
344 #define WPS_DPID_USER_SPEC                      0x0001
345 #define WPS_DPID_MACHINE_SPEC                   0x0002
346 #define WPS_DPID_REKEY                          0x0003
347 #define WPS_DPID_PBC                            0x0004
348 #define WPS_DPID_REGISTRAR_SPEC                 0x0005
349
350 /*      Value of WPS RF Bands Attribute */
351 #define WPS_RF_BANDS_2_4_GHZ                    0x01
352 #define WPS_RF_BANDS_5_GHZ                      0x02
353
354 /*      Value of WPS Association State Attribute */
355 #define WPS_ASSOC_STATE_NOT_ASSOCIATED          0x00
356 #define WPS_ASSOC_STATE_CONNECTION_SUCCESS      0x01
357 #define WPS_ASSOC_STATE_CONFIGURATION_FAILURE   0x02
358 #define WPS_ASSOC_STATE_ASSOCIATION_FAILURE     0x03
359 #define WPS_ASSOC_STATE_IP_FAILURE              0x04
360
361 /*      P2P Public Action Frame ( Management Frame ) */
362 #define P2P_PUB_ACTION_ACTION                   0x09
363
364 /*      P2P Public Action Frame Type */
365 #define P2P_GO_NEGO_REQ                         0
366 #define P2P_GO_NEGO_RESP                        1
367 #define P2P_GO_NEGO_CONF                        2
368 #define P2P_INVIT_REQ                           3
369 #define P2P_INVIT_RESP                          4
370 #define P2P_DEVDISC_REQ                         5
371 #define P2P_DEVDISC_RESP                        6
372 #define P2P_PROVISION_DISC_REQ                  7
373 #define P2P_PROVISION_DISC_RESP                 8
374
375 /*      WPS Configuration Method */
376 #define WPS_CM_NONE                                     0x0000
377 #define WPS_CM_LABEL                                    0x0004
378 #define WPS_CM_DISPLYA                                  0x0008
379 #define WPS_CM_EXTERNAL_NFC_TOKEN                       0x0010
380 #define WPS_CM_INTEGRATED_NFC_TOKEN                     0x0020
381 #define WPS_CM_NFC_INTERFACE                            0x0040
382 #define WPS_CM_PUSH_BUTTON                              0x0080
383 #define WPS_CM_KEYPAD                                   0x0100
384 #define WPS_CM_SW_PUHS_BUTTON                           0x0280
385 #define WPS_CM_HW_PUHS_BUTTON                           0x0480
386 #define WPS_CM_SW_DISPLAY_PIN                           0x2008
387 #define WPS_CM_LCD_DISPLAY_PIN                          0x4008
388
389 #endif /*  _WIFI_H_ */