]> git.karo-electronics.de Git - karo-tx-linux.git/blob - drivers/staging/rtl8723au/include/wifi.h
staging: rtl8723au: Get rid of obsolete SetPriority()/SetEOSP()/SetAckpolicy()
[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 #define SetToDs(pbuf)   \
70         (*(__le16 *)(pbuf) |= cpu_to_le16(IEEE80211_FCTL_TODS))
71
72 #define SetFrDs(pbuf)   \
73         (*(__le16 *)(pbuf) |= cpu_to_le16(IEEE80211_FCTL_FROMDS))
74
75 #define SetFrameType(pbuf, type)        \
76         do {    \
77                 *(__le16 *)(pbuf) &= __constant_cpu_to_le16(~(BIT(3) | BIT(2))); \
78                 *(__le16 *)(pbuf) |= __constant_cpu_to_le16(type); \
79         } while (0)
80
81 #define SetFrameSubType(pbuf, type) \
82         do {    \
83                 *(__le16 *)(pbuf) &= cpu_to_le16(~(BIT(7) | BIT(6) | BIT(5) | BIT(4) | BIT(3) | BIT(2))); \
84                 *(__le16 *)(pbuf) |= cpu_to_le16(type); \
85         } while (0)
86
87 #define _ASOCREQ_IE_OFFSET_             4       /*  excluding wlan_hdr */
88 #define _ASOCRSP_IE_OFFSET_             6
89 #define _REASOCREQ_IE_OFFSET_           10
90 #define _REASOCRSP_IE_OFFSET_           6
91 #define _PROBEREQ_IE_OFFSET_            0
92 #define _PROBERSP_IE_OFFSET_            12
93 #define _AUTH_IE_OFFSET_                6
94 #define _DEAUTH_IE_OFFSET_              0
95 #define _BEACON_IE_OFFSET_              12
96 #define _PUBLIC_ACTION_IE_OFFSET_       8
97
98 #define _FIXED_IE_LENGTH_               _BEACON_IE_OFFSET_
99
100
101 #define EID_BSSIntolerantChlReport      73
102
103 /* ---------------------------------------------------------------------------
104                                         Below is the fixed elements...
105 -----------------------------------------------------------------------------*/
106 #define _AUTH_ALGM_NUM_         2
107 #define _AUTH_SEQ_NUM_          2
108 #define _BEACON_ITERVAL_        2
109 #define _CAPABILITY_            2
110 #define _CURRENT_APADDR_        6
111 #define _LISTEN_INTERVAL_       2
112 #define _ASOC_ID_               2
113 #define _STATUS_CODE_           2
114 #define _TIMESTAMP_             8
115
116 /*-----------------------------------------------------------------------------
117                                 Below is the definition for WMM
118 ------------------------------------------------------------------------------*/
119 #define _WMM_IE_Length_                         7  /*  for WMM STA */
120 #define _WMM_Para_Element_Length_               24
121
122
123 /*-----------------------------------------------------------------------------
124                                 Below is the definition for 802.11n
125 ------------------------------------------------------------------------------*/
126
127 /* struct rtw_ieee80211_ht_cap - HT additional information
128  *
129  * This structure refers to "HT information element" as
130  * described in 802.11n draft section 7.3.2.53
131  */
132 struct ieee80211_ht_addt_info {
133         unsigned char   control_chan;
134         unsigned char   ht_param;
135         unsigned short  operation_mode;
136         unsigned short  stbc_param;
137         unsigned char   basic_set[16];
138 } __packed;
139
140 struct HT_caps_element {
141         union {
142                 struct {
143                         unsigned short  HT_caps_info;
144                         unsigned char   AMPDU_para;
145                         unsigned char   MCS_rate[16];
146                         unsigned short  HT_ext_caps;
147                         unsigned int    Beamforming_caps;
148                         unsigned char   ASEL_caps;
149                 } HT_cap_element;
150                 unsigned char HT_cap[26];
151         } u;
152 } __packed;
153
154 struct HT_info_element {
155         unsigned char   primary_channel;
156         unsigned char   infos[5];
157         unsigned char   MCS_rate[16];
158 }  __packed;
159
160 struct AC_param {
161         unsigned char           ACI_AIFSN;
162         unsigned char           CW;
163         unsigned short  TXOP_limit;
164 }  __packed;
165
166 struct WMM_para_element {
167         unsigned char           QoS_info;
168         unsigned char           reserved;
169         struct AC_param ac_param[4];
170 }  __packed;
171
172 struct ADDBA_request {
173         unsigned char           dialog_token;
174         unsigned short  BA_para_set;
175         unsigned short  BA_timeout_value;
176         unsigned short  BA_starting_seqctrl;
177 }  __packed;
178
179
180 /*      ===============WPS Section=============== */
181 /*      WPS attribute ID */
182 #define WPS_ATTR_VER1                           0x104A
183 #define WPS_ATTR_SIMPLE_CONF_STATE              0x1044
184 #define WPS_ATTR_RESP_TYPE                      0x103B
185 #define WPS_ATTR_UUID_E                         0x1047
186 #define WPS_ATTR_MANUFACTURER                   0x1021
187 #define WPS_ATTR_MODEL_NAME                     0x1023
188 #define WPS_ATTR_MODEL_NUMBER                   0x1024
189 #define WPS_ATTR_SERIAL_NUMBER                  0x1042
190 #define WPS_ATTR_PRIMARY_DEV_TYPE               0x1054
191 #define WPS_ATTR_SEC_DEV_TYPE_LIST              0x1055
192 #define WPS_ATTR_DEVICE_NAME                    0x1011
193 #define WPS_ATTR_CONF_METHOD                    0x1008
194 #define WPS_ATTR_RF_BANDS                       0x103C
195 #define WPS_ATTR_DEVICE_PWID                    0x1012
196 #define WPS_ATTR_REQUEST_TYPE                   0x103A
197 #define WPS_ATTR_ASSOCIATION_STATE              0x1002
198 #define WPS_ATTR_CONFIG_ERROR                   0x1009
199 #define WPS_ATTR_VENDOR_EXT                     0x1049
200 #define WPS_ATTR_SELECTED_REGISTRAR             0x1041
201
202 /*      WPS Configuration Method */
203 #define WPS_CM_NONE                                     0x0000
204 #define WPS_CM_LABEL                                    0x0004
205 #define WPS_CM_DISPLYA                                  0x0008
206 #define WPS_CM_EXTERNAL_NFC_TOKEN                       0x0010
207 #define WPS_CM_INTEGRATED_NFC_TOKEN                     0x0020
208 #define WPS_CM_NFC_INTERFACE                            0x0040
209 #define WPS_CM_PUSH_BUTTON                              0x0080
210 #define WPS_CM_KEYPAD                                   0x0100
211 #define WPS_CM_SW_PUHS_BUTTON                           0x0280
212 #define WPS_CM_HW_PUHS_BUTTON                           0x0480
213 #define WPS_CM_SW_DISPLAY_PIN                           0x2008
214 #define WPS_CM_LCD_DISPLAY_PIN                          0x4008
215
216 #endif /*  _WIFI_H_ */