wifi.h 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587
  1. /******************************************************************************
  2. *
  3. * Copyright(c) 2007 - 2010 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. * You should have received a copy of the GNU General Public License along with
  15. * this program; if not, write to the Free Software Foundation, Inc.,
  16. * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
  17. *
  18. * Modifications for inclusion into the Linux staging tree are
  19. * Copyright(c) 2010 Larry Finger. All rights reserved.
  20. *
  21. * Contact information:
  22. * WLAN FAE <wlanfae@realtek.com>
  23. * Larry Finger <Larry.Finger@lwfinger.net>
  24. *
  25. ******************************************************************************/
  26. #ifndef _WIFI_H_
  27. #define _WIFI_H_
  28. #include <linux/compiler.h>
  29. #define WLAN_IEEE_OUI_LEN 3
  30. #define WLAN_CRC_LEN 4
  31. #define WLAN_BSSID_LEN 6
  32. #define WLAN_BSS_TS_LEN 8
  33. #define WLAN_HDR_A3_LEN 24
  34. #define WLAN_HDR_A4_LEN 30
  35. #define WLAN_HDR_A3_QOS_LEN 26
  36. #define WLAN_HDR_A4_QOS_LEN 32
  37. #define WLAN_SSID_MAXLEN 32
  38. #define WLAN_DATA_MAXLEN 2312
  39. #define WLAN_A3_PN_OFFSET 24
  40. #define WLAN_A4_PN_OFFSET 30
  41. #define WLAN_MIN_ETHFRM_LEN 60
  42. #define WLAN_MAX_ETHFRM_LEN 1514
  43. #define P80211CAPTURE_VERSION 0x80211001
  44. enum WIFI_FRAME_TYPE {
  45. WIFI_MGT_TYPE = (0),
  46. WIFI_CTRL_TYPE = (BIT(2)),
  47. WIFI_DATA_TYPE = (BIT(3)),
  48. WIFI_QOS_DATA_TYPE = (BIT(7)|BIT(3)), /*!< QoS Data */
  49. };
  50. enum WIFI_FRAME_SUBTYPE {
  51. /* below is for mgt frame */
  52. WIFI_ASSOCREQ = (0 | WIFI_MGT_TYPE),
  53. WIFI_ASSOCRSP = (BIT(4) | WIFI_MGT_TYPE),
  54. WIFI_REASSOCREQ = (BIT(5) | WIFI_MGT_TYPE),
  55. WIFI_REASSOCRSP = (BIT(5) | BIT(4) | WIFI_MGT_TYPE),
  56. WIFI_PROBEREQ = (BIT(6) | WIFI_MGT_TYPE),
  57. WIFI_PROBERSP = (BIT(6) | BIT(4) | WIFI_MGT_TYPE),
  58. WIFI_BEACON = (BIT(7) | WIFI_MGT_TYPE),
  59. WIFI_ATIM = (BIT(7) | BIT(4) | WIFI_MGT_TYPE),
  60. WIFI_DISASSOC = (BIT(7) | BIT(5) | WIFI_MGT_TYPE),
  61. WIFI_AUTH = (BIT(7) | BIT(5) | BIT(4) | WIFI_MGT_TYPE),
  62. WIFI_DEAUTH = (BIT(7) | BIT(6) | WIFI_MGT_TYPE),
  63. WIFI_ACTION = (BIT(7) | BIT(6) | BIT(4) | WIFI_MGT_TYPE),
  64. /* below is for control frame */
  65. WIFI_PSPOLL = (BIT(7) | BIT(5) | WIFI_CTRL_TYPE),
  66. WIFI_RTS = (BIT(7) | BIT(5) | BIT(4) | WIFI_CTRL_TYPE),
  67. WIFI_CTS = (BIT(7) | BIT(6) | WIFI_CTRL_TYPE),
  68. WIFI_ACK = (BIT(7) | BIT(6) | BIT(4) | WIFI_CTRL_TYPE),
  69. WIFI_CFEND = (BIT(7) | BIT(6) | BIT(5) | WIFI_CTRL_TYPE),
  70. WIFI_CFEND_CFACK = (BIT(7) | BIT(6) | BIT(5) | BIT(4) | WIFI_CTRL_TYPE),
  71. /* below is for data frame */
  72. WIFI_DATA = (0 | WIFI_DATA_TYPE),
  73. WIFI_DATA_CFACK = (BIT(4) | WIFI_DATA_TYPE),
  74. WIFI_DATA_CFPOLL = (BIT(5) | WIFI_DATA_TYPE),
  75. WIFI_DATA_CFACKPOLL = (BIT(5) | BIT(4) | WIFI_DATA_TYPE),
  76. WIFI_DATA_NULL = (BIT(6) | WIFI_DATA_TYPE),
  77. WIFI_CF_ACK = (BIT(6) | BIT(4) | WIFI_DATA_TYPE),
  78. WIFI_CF_POLL = (BIT(6) | BIT(5) | WIFI_DATA_TYPE),
  79. WIFI_CF_ACKPOLL = (BIT(6) | BIT(5) | BIT(4) | WIFI_DATA_TYPE),
  80. };
  81. enum WIFI_REASON_CODE {
  82. _RSON_RESERVED_ = 0,
  83. _RSON_UNSPECIFIED_ = 1,
  84. _RSON_AUTH_NO_LONGER_VALID_ = 2,
  85. _RSON_DEAUTH_STA_LEAVING_ = 3,
  86. _RSON_INACTIVITY_ = 4,
  87. _RSON_UNABLE_HANDLE_ = 5,
  88. _RSON_CLS2_ = 6,
  89. _RSON_CLS3_ = 7,
  90. _RSON_DISAOC_STA_LEAVING_ = 8,
  91. _RSON_ASOC_NOT_AUTH_ = 9,
  92. /* WPA reason */
  93. _RSON_INVALID_IE_ = 13,
  94. _RSON_MIC_FAILURE_ = 14,
  95. _RSON_4WAY_HNDSHK_TIMEOUT_ = 15,
  96. _RSON_GROUP_KEY_UPDATE_TIMEOUT_ = 16,
  97. _RSON_DIFF_IE_ = 17,
  98. _RSON_MLTCST_CIPHER_NOT_VALID_ = 18,
  99. _RSON_UNICST_CIPHER_NOT_VALID_ = 19,
  100. _RSON_AKMP_NOT_VALID_ = 20,
  101. _RSON_UNSUPPORT_RSNE_VER_ = 21,
  102. _RSON_INVALID_RSNE_CAP_ = 22,
  103. _RSON_IEEE_802DOT1X_AUTH_FAIL_ = 23,
  104. /* below are Realtek definitions */
  105. _RSON_PMK_NOT_AVAILABLE_ = 24,
  106. };
  107. enum WIFI_STATUS_CODE {
  108. _STATS_SUCCESSFUL_ = 0,
  109. _STATS_FAILURE_ = 1,
  110. _STATS_CAP_FAIL_ = 10,
  111. _STATS_NO_ASOC_ = 11,
  112. _STATS_OTHER_ = 12,
  113. _STATS_NO_SUPP_ALG_ = 13,
  114. _STATS_OUT_OF_AUTH_SEQ_ = 14,
  115. _STATS_CHALLENGE_FAIL_ = 15,
  116. _STATS_AUTH_TIMEOUT_ = 16,
  117. _STATS_UNABLE_HANDLE_STA_ = 17,
  118. _STATS_RATE_FAIL_ = 18,
  119. };
  120. enum WIFI_REG_DOMAIN {
  121. DOMAIN_FCC = 1,
  122. DOMAIN_IC = 2,
  123. DOMAIN_ETSI = 3,
  124. DOMAIN_SPAIN = 4,
  125. DOMAIN_FRANCE = 5,
  126. DOMAIN_MKK = 6,
  127. DOMAIN_ISRAEL = 7,
  128. DOMAIN_MKK1 = 8,
  129. DOMAIN_MKK2 = 9,
  130. DOMAIN_MKK3 = 10,
  131. DOMAIN_MAX
  132. };
  133. #define _TO_DS_ BIT(8)
  134. #define _FROM_DS_ BIT(9)
  135. #define _MORE_FRAG_ BIT(10)
  136. #define _RETRY_ BIT(11)
  137. #define _PWRMGT_ BIT(12)
  138. #define _MORE_DATA_ BIT(13)
  139. #define _PRIVACY_ BIT(14)
  140. #define _ORDER_ BIT(15)
  141. #define SetToDs(pbuf) ({ \
  142. *(__le16 *)(pbuf) |= cpu_to_le16(_TO_DS_); \
  143. })
  144. #define GetToDs(pbuf) (((*(__le16 *)(pbuf)) & cpu_to_le16(_TO_DS_)) != 0)
  145. #define ClearToDs(pbuf) ({ \
  146. *(__le16 *)(pbuf) &= (~cpu_to_le16(_TO_DS_)); \
  147. })
  148. #define SetFrDs(pbuf) ({ \
  149. *(__le16 *)(pbuf) |= cpu_to_le16(_FROM_DS_); \
  150. })
  151. #define GetFrDs(pbuf) (((*(__le16 *)(pbuf)) & cpu_to_le16(_FROM_DS_)) != 0)
  152. #define ClearFrDs(pbuf) ({ \
  153. *(__le16 *)(pbuf) &= (~cpu_to_le16(_FROM_DS_)); \
  154. })
  155. static inline unsigned char get_tofr_ds(unsigned char *pframe)
  156. {
  157. return ((GetToDs(pframe) << 1) | GetFrDs(pframe));
  158. }
  159. #define SetMFrag(pbuf) ({ \
  160. *(__le16 *)(pbuf) |= cpu_to_le16(_MORE_FRAG_); \
  161. })
  162. #define GetMFrag(pbuf) (((*(__le16 *)(pbuf)) & cpu_to_le16(_MORE_FRAG_)) != 0)
  163. #define ClearMFrag(pbuf) ({ \
  164. *(__le16 *)(pbuf) &= (~cpu_to_le16(_MORE_FRAG_)); \
  165. })
  166. #define SetRetry(pbuf) ({ \
  167. *(__le16 *)(pbuf) |= cpu_to_le16(_RETRY_); \
  168. })
  169. #define GetRetry(pbuf) (((*(__le16 *)(pbuf)) & cpu_to_le16(_RETRY_)) != 0)
  170. #define ClearRetry(pbuf) ({ \
  171. *(__le16 *)(pbuf) &= (~cpu_to_le16(_RETRY_)); \
  172. })
  173. #define SetPwrMgt(pbuf) ({ \
  174. *(__le16 *)(pbuf) |= cpu_to_le16(_PWRMGT_); \
  175. })
  176. #define GetPwrMgt(pbuf) (((*(__le16 *)(pbuf)) & \
  177. cpu_to_le16(_PWRMGT_)) != 0)
  178. #define ClearPwrMgt(pbuf) ({ \
  179. *(__le16 *)(pbuf) &= (~cpu_to_le16(_PWRMGT_)); \
  180. })
  181. #define SetMData(pbuf) ({ \
  182. *(__le16 *)(pbuf) |= cpu_to_le16(_MORE_DATA_); \
  183. })
  184. #define GetMData(pbuf) (((*(__le16 *)(pbuf)) & \
  185. cpu_to_le16(_MORE_DATA_)) != 0)
  186. #define ClearMData(pbuf) ({ \
  187. *(__le16 *)(pbuf) &= (~cpu_to_le16(_MORE_DATA_)); \
  188. })
  189. #define SetPrivacy(pbuf) ({ \
  190. *(__le16 *)(pbuf) |= cpu_to_le16(_PRIVACY_); \
  191. })
  192. #define GetPrivacy(pbuf) (((*(__le16 *)(pbuf)) & \
  193. cpu_to_le16(_PRIVACY_)) != 0)
  194. #define GetOrder(pbuf) (((*(__le16 *)(pbuf)) & \
  195. cpu_to_le16(_ORDER_)) != 0)
  196. #define GetFrameType(pbuf) (le16_to_cpu(*(__le16 *)(pbuf)) & \
  197. (BIT(3) | BIT(2)))
  198. #define SetFrameType(pbuf, type) \
  199. do { \
  200. *(__le16 *)(pbuf) &= cpu_to_le16(~(BIT(3) | \
  201. BIT(2))); \
  202. *(__le16 *)(pbuf) |= cpu_to_le16(type); \
  203. } while (0)
  204. #define GetFrameSubType(pbuf) (le16_to_cpu(*(__le16 *)(pbuf)) & \
  205. (BIT(7) | BIT(6) | BIT(5) | BIT(4) | BIT(3) | \
  206. BIT(2)))
  207. #define SetFrameSubType(pbuf, type) \
  208. do { \
  209. *(__le16 *)(pbuf) &= cpu_to_le16(~(BIT(7) | BIT(6) | \
  210. BIT(5) | BIT(4) | BIT(3) | BIT(2))); \
  211. *(__le16 *)(pbuf) |= cpu_to_le16(type); \
  212. } while (0)
  213. #define GetSequence(pbuf) (le16_to_cpu(*(__le16 *)\
  214. ((addr_t)(pbuf) + 22)) >> 4)
  215. #define GetFragNum(pbuf) (le16_to_cpu(*(__le16 *)((addr_t)\
  216. (pbuf) + 22)) & 0x0f)
  217. #define SetSeqNum(pbuf, num) ({ \
  218. *(__le16 *)((addr_t)(pbuf) + 22) = \
  219. cpu_to_le16((le16_to_cpu(*(__le16 *)((addr_t)(pbuf) + 22)) & \
  220. 0x000f) | (0xfff0 & (num << 4))); \
  221. })
  222. #define SetDuration(pbuf, dur) ({ \
  223. *(__le16 *)((addr_t)(pbuf) + 2) |= \
  224. cpu_to_le16(0xffff & (dur)); \
  225. })
  226. #define SetPriority(pbuf, tid) ({ \
  227. *(__le16 *)(pbuf) |= cpu_to_le16(tid & 0xf); \
  228. })
  229. #define GetPriority(pbuf) ((le16_to_cpu(*(__le16 *)(pbuf))) & 0xf)
  230. #define SetAckpolicy(pbuf, ack) ({ \
  231. *(__le16 *)(pbuf) |= cpu_to_le16((ack & 3) << 5); \
  232. })
  233. #define GetAckpolicy(pbuf) (((le16_to_cpu(*(__le16 *)pbuf)) >> 5) & 0x3)
  234. #define GetAMsdu(pbuf) (((le16_to_cpu(*(__le16 *)pbuf)) >> 7) & 0x1)
  235. #define GetAid(pbuf) (cpu_to_le16(*(__le16 *)((addr_t)(pbuf) + 2)) \
  236. & 0x3fff)
  237. #define GetAddr1Ptr(pbuf) ((unsigned char *)((addr_t)(pbuf) + 4))
  238. #define GetAddr2Ptr(pbuf) ((unsigned char *)((addr_t)(pbuf) + 10))
  239. #define GetAddr3Ptr(pbuf) ((unsigned char *)((addr_t)(pbuf) + 16))
  240. #define GetAddr4Ptr(pbuf) ((unsigned char *)((addr_t)(pbuf) + 24))
  241. static inline int IS_MCAST(unsigned char *da)
  242. {
  243. if ((*da) & 0x01)
  244. return true;
  245. else
  246. return false;
  247. }
  248. static inline unsigned char *get_da(unsigned char *pframe)
  249. {
  250. unsigned char *da;
  251. unsigned int to_fr_ds = (GetToDs(pframe) << 1) | GetFrDs(pframe);
  252. switch (to_fr_ds) {
  253. case 0x00: /* ToDs=0, FromDs=0 */
  254. da = GetAddr1Ptr(pframe);
  255. break;
  256. case 0x01: /* ToDs=0, FromDs=1 */
  257. da = GetAddr1Ptr(pframe);
  258. break;
  259. case 0x02: /* ToDs=1, FromDs=0 */
  260. da = GetAddr3Ptr(pframe);
  261. break;
  262. default: /* ToDs=1, FromDs=1 */
  263. da = GetAddr3Ptr(pframe);
  264. break;
  265. }
  266. return da;
  267. }
  268. static inline unsigned char *get_sa(unsigned char *pframe)
  269. {
  270. unsigned char *sa;
  271. unsigned int to_fr_ds = (GetToDs(pframe) << 1) | GetFrDs(pframe);
  272. switch (to_fr_ds) {
  273. case 0x00: /* ToDs=0, FromDs=0 */
  274. sa = GetAddr2Ptr(pframe);
  275. break;
  276. case 0x01: /* ToDs=0, FromDs=1 */
  277. sa = GetAddr3Ptr(pframe);
  278. break;
  279. case 0x02: /* ToDs=1, FromDs=0 */
  280. sa = GetAddr2Ptr(pframe);
  281. break;
  282. default: /* ToDs=1, FromDs=1 */
  283. sa = GetAddr4Ptr(pframe);
  284. break;
  285. }
  286. return sa;
  287. }
  288. static inline unsigned char *get_hdr_bssid(unsigned char *pframe)
  289. {
  290. unsigned char *sa;
  291. unsigned int to_fr_ds = (GetToDs(pframe) << 1) | GetFrDs(pframe);
  292. switch (to_fr_ds) {
  293. case 0x00: /* ToDs=0, FromDs=0 */
  294. sa = GetAddr3Ptr(pframe);
  295. break;
  296. case 0x01: /* ToDs=0, FromDs=1 */
  297. sa = GetAddr2Ptr(pframe);
  298. break;
  299. case 0x02: /* ToDs=1, FromDs=0 */
  300. sa = GetAddr1Ptr(pframe);
  301. break;
  302. default: /* ToDs=1, FromDs=1 */
  303. sa = NULL;
  304. break;
  305. }
  306. return sa;
  307. }
  308. /*-----------------------------------------------------------------------------
  309. * Below is for the security related definition
  310. *-----------------------------------------------------------------------------
  311. */
  312. #define _RESERVED_FRAME_TYPE_ 0
  313. #define _SKB_FRAME_TYPE_ 2
  314. #define _PRE_ALLOCMEM_ 1
  315. #define _PRE_ALLOCHDR_ 3
  316. #define _PRE_ALLOCLLCHDR_ 4
  317. #define _PRE_ALLOCICVHDR_ 5
  318. #define _PRE_ALLOCMICHDR_ 6
  319. #define _SIFSTIME_ ((priv->pmib->BssType.net_work_type & \
  320. WIRELESS_11A) ? 16 : 10)
  321. #define _ACKCTSLNG_ 14 /*14 bytes long, including crclng */
  322. #define _CRCLNG_ 4
  323. #define _ASOCREQ_IE_OFFSET_ 4 /* excluding wlan_hdr */
  324. #define _ASOCRSP_IE_OFFSET_ 6
  325. #define _REASOCREQ_IE_OFFSET_ 10
  326. #define _REASOCRSP_IE_OFFSET_ 6
  327. #define _PROBEREQ_IE_OFFSET_ 0
  328. #define _PROBERSP_IE_OFFSET_ 12
  329. #define _AUTH_IE_OFFSET_ 6
  330. #define _DEAUTH_IE_OFFSET_ 0
  331. #define _BEACON_IE_OFFSET_ 12
  332. #define _FIXED_IE_LENGTH_ _BEACON_IE_OFFSET_
  333. #define _SSID_IE_ 0
  334. #define _SUPPORTEDRATES_IE_ 1
  335. #define _DSSET_IE_ 3
  336. #define _IBSS_PARA_IE_ 6
  337. #define _ERPINFO_IE_ 42
  338. #define _EXT_SUPPORTEDRATES_IE_ 50
  339. #define _HT_CAPABILITY_IE_ 45
  340. #define _HT_EXTRA_INFO_IE_ 61
  341. #define _HT_ADD_INFO_IE_ 61 /* _HT_EXTRA_INFO_IE_ */
  342. #define _VENDOR_SPECIFIC_IE_ 221
  343. #define _RESERVED47_ 47
  344. /* ---------------------------------------------------------------------------
  345. * Below is the fixed elements...
  346. * ---------------------------------------------------------------------------
  347. */
  348. #define _AUTH_ALGM_NUM_ 2
  349. #define _AUTH_SEQ_NUM_ 2
  350. #define _BEACON_ITERVAL_ 2
  351. #define _CAPABILITY_ 2
  352. #define _CURRENT_APADDR_ 6
  353. #define _LISTEN_INTERVAL_ 2
  354. #define _RSON_CODE_ 2
  355. #define _ASOC_ID_ 2
  356. #define _STATUS_CODE_ 2
  357. #define _TIMESTAMP_ 8
  358. #define AUTH_ODD_TO 0
  359. #define AUTH_EVEN_TO 1
  360. #define WLAN_ETHCONV_ENCAP 1
  361. #define WLAN_ETHCONV_RFC1042 2
  362. #define WLAN_ETHCONV_8021h 3
  363. #define cap_ESS BIT(0)
  364. #define cap_IBSS BIT(1)
  365. #define cap_CFPollable BIT(2)
  366. #define cap_CFRequest BIT(3)
  367. #define cap_Privacy BIT(4)
  368. #define cap_ShortPremble BIT(5)
  369. /*-----------------------------------------------------------------------------
  370. * Below is the definition for 802.11i / 802.1x
  371. *------------------------------------------------------------------------------
  372. */
  373. #define _IEEE8021X_MGT_ 1 /*WPA */
  374. #define _IEEE8021X_PSK_ 2 /* WPA with pre-shared key */
  375. /*-----------------------------------------------------------------------------
  376. * Below is the definition for WMM
  377. *------------------------------------------------------------------------------
  378. */
  379. #define _WMM_IE_Length_ 7 /* for WMM STA */
  380. #define _WMM_Para_Element_Length_ 24
  381. /*-----------------------------------------------------------------------------
  382. * Below is the definition for 802.11n
  383. *------------------------------------------------------------------------------
  384. */
  385. /* block-ack parameters */
  386. #define IEEE80211_ADDBA_PARAM_POLICY_MASK 0x0002
  387. #define IEEE80211_ADDBA_PARAM_TID_MASK 0x003C
  388. #define IEEE80211_ADDBA_PARAM_BUF_SIZE_MASK 0xFFA0
  389. #define IEEE80211_DELBA_PARAM_TID_MASK 0xF000
  390. #define IEEE80211_DELBA_PARAM_INITIATOR_MASK 0x0800
  391. #define SetOrderBit(pbuf) ({ \
  392. *(__le16 *)(pbuf) |= cpu_to_le16(_ORDER_); \
  393. })
  394. #define GetOrderBit(pbuf) (((*(__le16 *)(pbuf)) & \
  395. le16_to_cpu(_ORDER_)) != 0)
  396. /**
  397. * struct ieee80211_bar - HT Block Ack Request
  398. *
  399. * This structure refers to "HT BlockAckReq" as
  400. * described in 802.11n draft section 7.2.1.7.1
  401. */
  402. struct ieee80211_bar {
  403. __le16 frame_control;
  404. __le16 duration;
  405. unsigned char ra[6];
  406. unsigned char ta[6];
  407. __le16 control;
  408. __le16 start_seq_num;
  409. } __packed;
  410. /* 802.11 BAR control masks */
  411. #define IEEE80211_BAR_CTRL_ACK_POLICY_NORMAL 0x0000
  412. #define IEEE80211_BAR_CTRL_CBMTID_COMPRESSED_BA 0x0004
  413. /*
  414. * struct ieee80211_ht_cap - HT capabilities
  415. *
  416. * This structure refers to "HT capabilities element" as
  417. * described in 802.11n draft section 7.3.2.52
  418. */
  419. struct ieee80211_ht_cap {
  420. __le16 cap_info;
  421. unsigned char ampdu_params_info;
  422. unsigned char supp_mcs_set[16];
  423. __le16 extended_ht_cap_info;
  424. __le32 tx_BF_cap_info;
  425. unsigned char antenna_selection_info;
  426. } __packed;
  427. /**
  428. * struct ieee80211_ht_cap - HT additional information
  429. *
  430. * This structure refers to "HT information element" as
  431. * described in 802.11n draft section 7.3.2.53
  432. */
  433. struct ieee80211_ht_addt_info {
  434. unsigned char control_chan;
  435. unsigned char ht_param;
  436. __le16 operation_mode;
  437. __le16 stbc_param;
  438. unsigned char basic_set[16];
  439. } __packed;
  440. /* 802.11n HT capabilities masks */
  441. #define IEEE80211_HT_CAP_SUP_WIDTH 0x0002
  442. #define IEEE80211_HT_CAP_SM_PS 0x000C
  443. #define IEEE80211_HT_CAP_GRN_FLD 0x0010
  444. #define IEEE80211_HT_CAP_SGI_20 0x0020
  445. #define IEEE80211_HT_CAP_SGI_40 0x0040
  446. #define IEEE80211_HT_CAP_TX_STBC 0x0080
  447. #define IEEE80211_HT_CAP_DELAY_BA 0x0400
  448. #define IEEE80211_HT_CAP_MAX_AMSDU 0x0800
  449. #define IEEE80211_HT_CAP_DSSSCCK40 0x1000
  450. /* 802.11n HT capability AMPDU settings */
  451. #define IEEE80211_HT_CAP_AMPDU_FACTOR 0x03
  452. #define IEEE80211_HT_CAP_AMPDU_DENSITY 0x1C
  453. /* 802.11n HT capability MSC set */
  454. #define IEEE80211_SUPP_MCS_SET_UEQM 4
  455. #define IEEE80211_HT_CAP_MAX_STREAMS 4
  456. #define IEEE80211_SUPP_MCS_SET_LEN 10
  457. /* maximum streams the spec allows */
  458. #define IEEE80211_HT_CAP_MCS_TX_DEFINED 0x01
  459. #define IEEE80211_HT_CAP_MCS_TX_RX_DIFF 0x02
  460. #define IEEE80211_HT_CAP_MCS_TX_STREAMS 0x0C
  461. #define IEEE80211_HT_CAP_MCS_TX_UEQM 0x10
  462. /* 802.11n HT IE masks */
  463. #define IEEE80211_HT_IE_CHA_SEC_OFFSET 0x03
  464. #define IEEE80211_HT_IE_CHA_SEC_NONE 0x00
  465. #define IEEE80211_HT_IE_CHA_SEC_ABOVE 0x01
  466. #define IEEE80211_HT_IE_CHA_SEC_BELOW 0x03
  467. #define IEEE80211_HT_IE_CHA_WIDTH 0x04
  468. #define IEEE80211_HT_IE_HT_PROTECTION 0x0003
  469. #define IEEE80211_HT_IE_NON_GF_STA_PRSNT 0x0004
  470. #define IEEE80211_HT_IE_NON_HT_STA_PRSNT 0x0010
  471. /* block-ack parameters */
  472. #define IEEE80211_ADDBA_PARAM_POLICY_MASK 0x0002
  473. #define IEEE80211_ADDBA_PARAM_TID_MASK 0x003C
  474. #define IEEE80211_ADDBA_PARAM_BUF_SIZE_MASK 0xFFA0
  475. #define IEEE80211_DELBA_PARAM_TID_MASK 0xF000
  476. #define IEEE80211_DELBA_PARAM_INITIATOR_MASK 0x0800
  477. /*
  478. * A-PMDU buffer sizes
  479. * According to IEEE802.11n spec size varies from 8K to 64K (in powers of 2)
  480. */
  481. #define IEEE80211_MIN_AMPDU_BUF 0x8
  482. /* Spatial Multiplexing Power Save Modes */
  483. #define WLAN_HT_CAP_SM_PS_STATIC 0
  484. #define WLAN_HT_CAP_SM_PS_DYNAMIC 1
  485. #define WLAN_HT_CAP_SM_PS_INVALID 2
  486. #define WLAN_HT_CAP_SM_PS_DISABLED 3
  487. #endif /* _WIFI_H_ */