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