import PULS_20160108
[GitHub/mt8127/android_kernel_alcatel_ttab.git] / drivers / misc / mediatek / connectivity / combo / drv_wlan / mt6628 / wlan / os / linux / include / gl_wext.h
1 /*
2 ** $Id: //Department/DaVinci/BRANCHES/MT6620_WIFI_DRIVER_V2_3/os/linux/include/gl_wext.h#1 $
3 */
4
5 /*! \file gl_wext.h
6 \brief This file is for Portable Driver linux wireless extension support.
7 */
8
9
10
11 /*
12 ** $Log: gl_wext.h $
13 *
14 * 10 12 2011 wh.su
15 * [WCXRP00001036] [MT6620 Wi-Fi][Driver][FW] Adding the 802.11w code for MFP
16 * adding the 802.11w related function and define .
17 *
18 * 09 20 2011 chinglan.wang
19 * [WCXRP00000989] [WiFi Direct] [Driver] Add a new io control API to start the formation for the sigma test.
20 * .
21 *
22 * 09 20 2011 chinglan.wang
23 * [WCXRP00000989] [WiFi Direct] [Driver] Add a new io control API to start the formation for the sigma test.
24 * .
25 *
26 * 01 11 2011 chinglan.wang
27 * NULL
28 * Modify to reslove the CR :[ALPS00028994] Use WEP security to connect Marvell 11N AP. Connection establish successfully.
29 * Use the WPS function to connect AP, the privacy bit always is set to 1. .
30 *
31 * 09 27 2010 wh.su
32 * NULL
33 * [WCXRP00000067][MT6620 Wi-Fi][Driver] Support the android+ WAPI function.
34 *
35 * 07 08 2010 cp.wu
36 *
37 * [WPD00003833] [MT6620 and MT5931] Driver migration - move to new repository.
38 *
39 * 06 06 2010 kevin.huang
40 * [WPD00003832][MT6620 5931] Create driver base
41 * [MT6620 5931] Create driver base
42 *
43 * 03 31 2010 wh.su
44 * [WPD00003816][MT6620 Wi-Fi] Adding the security support
45 * modify the wapi related code for new driver's design.
46 *
47 * 03 24 2010 jeffrey.chang
48 * [WPD00003826]Initial import for Linux port
49 * initial import for Linux port
50 ** \main\maintrunk.MT5921\12 2009-10-20 17:38:33 GMT mtk01090
51 ** Refine driver unloading and clean up procedure. Block requests, stop main thread and clean up queued requests, and then stop hw.
52 ** \main\maintrunk.MT5921\11 2009-09-28 20:19:28 GMT mtk01090
53 ** Add private ioctl to carry OID structures. Restructure public/private ioctl interfaces to Linux kernel.
54 ** \main\maintrunk.MT5921\10 2009-09-03 12:12:35 GMT mtk01088
55 ** adding the function declaration
56 ** \main\maintrunk.MT5921\9 2009-08-18 22:57:17 GMT mtk01090
57 ** Add Linux SDIO (with mmc core) support.
58 ** Add Linux 2.6.21, 2.6.25, 2.6.26.
59 ** Fix compile warning in Linux.
60 ** \main\maintrunk.MT5921\8 2008-08-29 16:59:07 GMT mtk01088
61 ** fixed compiling error
62 ** \main\maintrunk.MT5921\7 2008-08-29 14:13:28 GMT mtk01088
63 ** adjust the header file for code refine
64 ** \main\maintrunk.MT5921\6 2008-03-28 10:40:31 GMT mtk01461
65 ** Add set desired rate in Linux STD IOCTL
66 ** \main\maintrunk.MT5921\5 2008-03-11 14:51:08 GMT mtk01461
67 ** Refine private IOCTL functions
68 ** \main\maintrunk.MT5921\4 2008-02-12 23:45:45 GMT mtk01461
69 ** Add Set Frequency & Channel oid support for Linux
70 ** \main\maintrunk.MT5921\3 2007-11-06 19:36:19 GMT mtk01088
71 ** add the WPS related code
72 */
73
74 #ifndef _GL_WEXT_H
75 #define _GL_WEXT_H
76
77 #ifdef WIRELESS_EXT
78 /*******************************************************************************
79 * C O M P I L E R F L A G S
80 ********************************************************************************
81 */
82
83 /*******************************************************************************
84 * E X T E R N A L R E F E R E N C E S
85 ********************************************************************************
86 */
87
88 /*******************************************************************************
89 * C O N S T A N T S
90 ********************************************************************************
91 */
92 #define KILO 1000
93 #define RATE_5_5M 11 /* 5.5M */
94
95 /*******************************************************************************
96 * D A T A T Y P E S
97 ********************************************************************************
98 */
99 typedef struct _PARAM_FIXED_IEs {
100 UINT_8 aucTimestamp[8];
101 UINT_16 u2BeaconInterval;
102 UINT_16 u2Capabilities;
103 } PARAM_FIXED_IEs;
104
105 typedef struct _PARAM_VARIABLE_IE_T {
106 UINT_8 ucElementID;
107 UINT_8 ucLength;
108 UINT_8 aucData[1];
109 } PARAM_VARIABLE_IE_T, *P_PARAM_VARIABLE_IE_T;
110
111
112 #if WIRELESS_EXT < 18
113
114 #define SIOCSIWMLME 0x8B16 /* request MLME operation; uses struct iw_mlme */
115 /* MLME requests (SIOCSIWMLME / struct iw_mlme) */
116 #define IW_MLME_DEAUTH 0
117 #define IW_MLME_DISASSOC 1
118
119 /*! \brief SIOCSIWMLME data */
120 struct iw_mlme {
121 __u16 cmd; /*!< IW_MLME_* */
122 __u16 reason_code;
123 struct sockaddr addr;
124 };
125
126 #define SIOCSIWAUTH 0x8B32 /* set authentication mode params */
127 #define SIOCGIWAUTH 0x8B33 /* get authentication mode params */
128 /* SIOCSIWAUTH/SIOCGIWAUTH struct iw_param flags */
129 #define IW_AUTH_INDEX 0x0FFF
130 #define IW_AUTH_FLAGS 0xF000
131 /* SIOCSIWAUTH/SIOCGIWAUTH parameters (0 .. 4095)
132 * (IW_AUTH_INDEX mask in struct iw_param flags; this is the index of the
133 * parameter that is being set/get to; value will be read/written to
134 * struct iw_param value field) */
135 #define IW_AUTH_WPA_VERSION 0
136 #define IW_AUTH_CIPHER_PAIRWISE 1
137 #define IW_AUTH_CIPHER_GROUP 2
138 #define IW_AUTH_KEY_MGMT 3
139 #define IW_AUTH_TKIP_COUNTERMEASURES 4
140 #define IW_AUTH_DROP_UNENCRYPTED 5
141 #define IW_AUTH_80211_AUTH_ALG 6
142 #define IW_AUTH_WPA_ENABLED 7
143 #define IW_AUTH_RX_UNENCRYPTED_EAPOL 8
144 #define IW_AUTH_ROAMING_CONTROL 9
145 #define IW_AUTH_PRIVACY_INVOKED 10
146 #if CFG_SUPPORT_802_11W
147 #define IW_AUTH_MFP 12
148
149 #define IW_AUTH_MFP_DISABLED 0 /* MFP disabled */
150 #define IW_AUTH_MFP_OPTIONAL 1 /* MFP optional */
151 #define IW_AUTH_MFP_REQUIRED 2 /* MFP required */
152 #endif
153
154 /* IW_AUTH_WPA_VERSION values (bit field) */
155 #define IW_AUTH_WPA_VERSION_DISABLED 0x00000001
156 #define IW_AUTH_WPA_VERSION_WPA 0x00000002
157 #define IW_AUTH_WPA_VERSION_WPA2 0x00000004
158
159 /* IW_AUTH_PAIRWISE_CIPHER and IW_AUTH_GROUP_CIPHER values (bit field) */
160 #define IW_AUTH_CIPHER_NONE 0x00000001
161 #define IW_AUTH_CIPHER_WEP40 0x00000002
162 #define IW_AUTH_CIPHER_TKIP 0x00000004
163 #define IW_AUTH_CIPHER_CCMP 0x00000008
164 #define IW_AUTH_CIPHER_WEP104 0x00000010
165
166 /* IW_AUTH_KEY_MGMT values (bit field) */
167 #define IW_AUTH_KEY_MGMT_802_1X 1
168 #define IW_AUTH_KEY_MGMT_PSK 2
169 #define IW_AUTH_KEY_MGMT_WPA_NONE 4
170
171 /* IW_AUTH_80211_AUTH_ALG values (bit field) */
172 #define IW_AUTH_ALG_OPEN_SYSTEM 0x00000001
173 #define IW_AUTH_ALG_SHARED_KEY 0x00000002
174 #define IW_AUTH_ALG_LEAP 0x00000004
175
176 /* IW_AUTH_ROAMING_CONTROL values */
177 #define IW_AUTH_ROAMING_ENABLE 0 /* driver/firmware based roaming */
178 #define IW_AUTH_ROAMING_DISABLE 1 /* user space program used for roaming
179 * control */
180
181 #define SIOCSIWENCODEEXT 0x8B34 /* set encoding token & mode */
182 #define SIOCGIWENCODEEXT 0x8B35 /* get encoding token & mode */
183 /* SIOCSIWENCODEEXT definitions */
184 #define IW_ENCODE_SEQ_MAX_SIZE 8
185 /* struct iw_encode_ext ->alg */
186 #define IW_ENCODE_ALG_NONE 0
187 #define IW_ENCODE_ALG_WEP 1
188 #define IW_ENCODE_ALG_TKIP 2
189 #define IW_ENCODE_ALG_CCMP 3
190 #if CFG_SUPPORT_802_11W
191 #define IW_ENCODE_ALG_AES_CMAC 5
192 #endif
193
194 /* struct iw_encode_ext ->ext_flags */
195 #define IW_ENCODE_EXT_TX_SEQ_VALID 0x00000001
196 #define IW_ENCODE_EXT_RX_SEQ_VALID 0x00000002
197 #define IW_ENCODE_EXT_GROUP_KEY 0x00000004
198 #define IW_ENCODE_EXT_SET_TX_KEY 0x00000008
199
200 struct iw_encode_ext {
201 __u32 ext_flags; /*!< IW_ENCODE_EXT_* */
202 __u8 tx_seq[IW_ENCODE_SEQ_MAX_SIZE]; /*!< LSB first */
203 __u8 rx_seq[IW_ENCODE_SEQ_MAX_SIZE]; /*!< LSB first */
204 struct sockaddr addr; /*!< ff:ff:ff:ff:ff:ff for broadcast/multicast
205 * (group) keys or unicast address for
206 * individual keys */
207 __u16 alg; /*!< IW_ENCODE_ALG_* */
208 __u16 key_len;
209 __u8 key[0];
210 };
211
212 #define SIOCSIWPMKSA 0x8B36 /* PMKSA cache operation */
213 #define IW_PMKSA_ADD 1
214 #define IW_PMKSA_REMOVE 2
215 #define IW_PMKSA_FLUSH 3
216
217 #define IW_PMKID_LEN 16
218
219 struct iw_pmksa {
220 __u32 cmd; /*!< IW_PMKSA_* */
221 struct sockaddr bssid;
222 __u8 pmkid[IW_PMKID_LEN];
223 };
224
225 #define IWEVGENIE 0x8C05 /* Generic IE (WPA, RSN, WMM, ..)
226 * (scan results); This includes id and
227 * length fields. One IWEVGENIE may
228 * contain more than one IE. Scan
229 * results may contain one or more
230 * IWEVGENIE events. */
231 #define IWEVMICHAELMICFAILURE 0x8C06 /* Michael MIC failure
232 * (struct iw_michaelmicfailure)
233 */
234 #define IWEVASSOCREQIE 0x8C07 /* IEs used in (Re)Association Request.
235 * The data includes id and length
236 * fields and may contain more than one
237 * IE. This event is required in
238 * Managed mode if the driver
239 * generates its own WPA/RSN IE. This
240 * should be sent just before
241 * IWEVREGISTERED event for the
242 * association. */
243 #define IWEVASSOCRESPIE 0x8C08 /* IEs used in (Re)Association
244 * Response. The data includes id and
245 * length fields and may contain more
246 * than one IE. This may be sent
247 * between IWEVASSOCREQIE and
248 * IWEVREGISTERED events for the
249 * association. */
250 #define IWEVPMKIDCAND 0x8C09 /* PMKID candidate for RSN
251 * pre-authentication
252 * (struct iw_pmkid_cand) */
253
254 #endif /* WIRELESS_EXT < 18 */
255
256 #if WIRELESS_EXT < 17
257 /* Statistics flags (bitmask in updated) */
258 #define IW_QUAL_QUAL_UPDATED 0x1 /* Value was updated since last read */
259 #define IW_QUAL_LEVEL_UPDATED 0x2
260 #define IW_QUAL_NOISE_UPDATED 0x4
261 #define IW_QUAL_QUAL_INVALID 0x10 /* Driver doesn't provide value */
262 #define IW_QUAL_LEVEL_INVALID 0x20
263 #define IW_QUAL_NOISE_INVALID 0x40
264 #endif
265
266 enum {
267 IEEE80211_FILTER_TYPE_BEACON = 1 << 0,
268 IEEE80211_FILTER_TYPE_PROBE_REQ = 1 << 1,
269 IEEE80211_FILTER_TYPE_PROBE_RESP = 1 << 2,
270 IEEE80211_FILTER_TYPE_ASSOC_REQ = 1 << 3,
271 IEEE80211_FILTER_TYPE_ASSOC_RESP = 1 << 4,
272 IEEE80211_FILTER_TYPE_AUTH = 1 << 5,
273 IEEE80211_FILTER_TYPE_DEAUTH = 1 << 6,
274 IEEE80211_FILTER_TYPE_DISASSOC = 1 << 7,
275 IEEE80211_FILTER_TYPE_ALL = 0xFF /* used to check the valid filter bits */
276 };
277
278 #if CFG_SUPPORT_WAPI
279 #define IW_AUTH_WAPI_ENABLED 0x20
280 #define IW_ENCODE_ALG_SMS4 0x20
281 #endif
282
283 #if CFG_SUPPORT_WAPI /* Android+ */
284 #define IW_AUTH_KEY_MGMT_WAPI_PSK 3
285 #define IW_AUTH_KEY_MGMT_WAPI_CERT 4
286 #endif
287 #define IW_AUTH_KEY_MGMT_WPS 5
288
289 #if CFG_SUPPORT_802_11W
290 #define IW_AUTH_KEY_MGMT_802_1X_SHA256 7
291 #define IW_AUTH_KEY_MGMT_PSK_SHA256 8
292 #endif
293
294
295 /*******************************************************************************
296 * P U B L I C D A T A
297 ********************************************************************************
298 */
299 extern const struct iw_handler_def wext_handler_def;
300
301 /*******************************************************************************
302 * P R I V A T E D A T A
303 ********************************************************************************
304 */
305
306 /*******************************************************************************
307 * M A C R O S
308 ********************************************************************************
309 */
310
311 /*******************************************************************************
312 * F U N C T I O N D E C L A R A T I O N S
313 ********************************************************************************
314 */
315 /* wireless extensions' ioctls */
316 int wext_support_ioctl(IN struct net_device *prDev, IN struct ifreq *prIfReq, IN int i4Cmd);
317
318 int
319 wext_set_rate(IN struct net_device *prNetDev,
320 IN struct iw_request_info *prIwReqInfo, IN struct iw_param *prRate, IN char *pcExtra);
321
322 void
323 wext_indicate_wext_event(IN P_GLUE_INFO_T prGlueInfo,
324 IN unsigned int u4Cmd,
325 IN unsigned char *pucData, IN unsigned int u4DataLen);
326
327 struct iw_statistics *wext_get_wireless_stats(struct net_device *prDev);
328
329 int wext_get_priv(IN struct net_device *prNetDev, IN struct ifreq *prIfReq);
330
331 BOOLEAN
332 wextSrchDesiredWPAIE(IN PUINT_8 pucIEStart,
333 IN INT_32 i4TotalIeLen,
334 IN UINT_8 ucDesiredElemId, OUT PUINT_8 * ppucDesiredIE);
335
336 #if CFG_SUPPORT_WPS
337 BOOLEAN
338 wextSrchDesiredWPSIE(IN PUINT_8 pucIEStart,
339 IN INT_32 i4TotalIeLen,
340 IN UINT_8 ucDesiredElemId, OUT PUINT_8 * ppucDesiredIE);
341 #endif
342
343 #if CFG_SUPPORT_WAPI
344 BOOLEAN
345 wextSrchDesiredWAPIIE(IN PUINT_8 pucIEStart, IN INT_32 i4TotalIeLen, OUT PUINT_8 * ppucDesiredIE);
346 #endif
347
348 /*******************************************************************************
349 * F U N C T I O N S
350 ********************************************************************************
351 */
352
353 #endif /* WIRELESS_EXT */
354
355 #endif /* _GL_WEXT_H */