PageRenderTime 65ms CodeModel.GetById 23ms RepoModel.GetById 0ms app.codeStats 0ms

/drivers/misc/mediatek/connectivity/conn_soc/drv_wlan/mt_wifi/wlan/os/linux/include/gl_wext.h

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