PageRenderTime 59ms CodeModel.GetById 19ms RepoModel.GetById 0ms app.codeStats 1ms

/source/kernel/android-2.6.35/drivers/staging/rtl8192u/ieee80211.h

https://bitbucket.org/tfzxyinhao/kindle-fire
C++ Header | 2595 lines | 1860 code | 363 blank | 372 comment | 53 complexity | ba9d79e57485d506aa2540044f2e7911 MD5 | raw file
Possible License(s): AGPL-1.0, LGPL-3.0, 0BSD, MPL-2.0-no-copyleft-exception, GPL-2.0, LGPL-2.0, BSD-3-Clause, LGPL-2.1, Apache-2.0, AGPL-3.0, GPL-3.0

Large files files are truncated, but you can click here to view the full file

  1. /*
  2. * Merged with mainline ieee80211.h in Aug 2004. Original ieee802_11
  3. * remains copyright by the original authors
  4. *
  5. * Portions of the merged code are based on Host AP (software wireless
  6. * LAN access point) driver for Intersil Prism2/2.5/3.
  7. *
  8. * Copyright (c) 2001-2002, SSH Communications Security Corp and Jouni Malinen
  9. * <jkmaline@cc.hut.fi>
  10. * Copyright (c) 2002-2003, Jouni Malinen <jkmaline@cc.hut.fi>
  11. *
  12. * Adaption to a generic IEEE 802.11 stack by James Ketrenos
  13. * <jketreno@linux.intel.com>
  14. * Copyright (c) 2004, Intel Corporation
  15. *
  16. * Modified for Realtek's wi-fi cards by Andrea Merello
  17. * <andreamrl@tiscali.it>
  18. *
  19. * This program is free software; you can redistribute it and/or modify
  20. * it under the terms of the GNU General Public License version 2 as
  21. * published by the Free Software Foundation. See README and COPYING for
  22. * more details.
  23. */
  24. #ifndef IEEE80211_H
  25. #define IEEE80211_H
  26. #include <linux/if_ether.h> /* ETH_ALEN */
  27. #include <linux/kernel.h> /* ARRAY_SIZE */
  28. #include <linux/version.h>
  29. #include <linux/module.h>
  30. #include <linux/jiffies.h>
  31. #include <linux/timer.h>
  32. #include <linux/sched.h>
  33. #include <linux/delay.h>
  34. #include <linux/wireless.h>
  35. #include "ieee80211/rtl819x_HT.h"
  36. #include "ieee80211/rtl819x_BA.h"
  37. #include "ieee80211/rtl819x_TS.h"
  38. #ifndef IW_MODE_MONITOR
  39. #define IW_MODE_MONITOR 6
  40. #endif
  41. #ifndef IWEVCUSTOM
  42. #define IWEVCUSTOM 0x8c02
  43. #endif
  44. #ifndef container_of
  45. /**
  46. * container_of - cast a member of a structure out to the containing structure
  47. *
  48. * @ptr: the pointer to the member.
  49. * @type: the type of the container struct this is embedded in.
  50. * @member: the name of the member within the struct.
  51. *
  52. */
  53. #define container_of(ptr, type, member) ({ \
  54. const typeof(((type *)0)->member) (*__mptr = (ptr)); \
  55. (type *)((char *)__mptr - offsetof(type, member)); })
  56. #endif
  57. #define KEY_TYPE_NA 0x0
  58. #define KEY_TYPE_WEP40 0x1
  59. #define KEY_TYPE_TKIP 0x2
  60. #define KEY_TYPE_CCMP 0x4
  61. #define KEY_TYPE_WEP104 0x5
  62. /* added for rtl819x tx procedure */
  63. #define MAX_QUEUE_SIZE 0x10
  64. /*
  65. * 8190 queue mapping
  66. */
  67. #define BK_QUEUE 0
  68. #define BE_QUEUE 1
  69. #define VI_QUEUE 2
  70. #define VO_QUEUE 3
  71. #define HCCA_QUEUE 4
  72. #define TXCMD_QUEUE 5
  73. #define MGNT_QUEUE 6
  74. #define HIGH_QUEUE 7
  75. #define BEACON_QUEUE 8
  76. #define LOW_QUEUE BE_QUEUE
  77. #define NORMAL_QUEUE MGNT_QUEUE
  78. /* added by amy for ps */
  79. #define SWRF_TIMEOUT 50
  80. /* added by amy for LEAP related */
  81. #define IE_CISCO_FLAG_POSITION 0x08 /* Flag byte: byte 8, numbered from 0. */
  82. #define SUPPORT_CKIP_MIC 0x08 /* bit3 */
  83. #define SUPPORT_CKIP_PK 0x10 /* bit4 */
  84. /* defined for skb cb field */
  85. /* At most 28 byte */
  86. typedef struct cb_desc {
  87. /* Tx Desc Related flags (8-9) */
  88. u8 bLastIniPkt:1;
  89. u8 bCmdOrInit:1;
  90. u8 bFirstSeg:1;
  91. u8 bLastSeg:1;
  92. u8 bEncrypt:1;
  93. u8 bTxDisableRateFallBack:1;
  94. u8 bTxUseDriverAssingedRate:1;
  95. u8 bHwSec:1; /* indicate whether use Hw security. WB */
  96. u8 reserved1;
  97. /* Tx Firmware Relaged flags (10-11)*/
  98. u8 bCTSEnable:1;
  99. u8 bRTSEnable:1;
  100. u8 bUseShortGI:1;
  101. u8 bUseShortPreamble:1;
  102. u8 bTxEnableFwCalcDur:1;
  103. u8 bAMPDUEnable:1;
  104. u8 bRTSSTBC:1;
  105. u8 RTSSC:1;
  106. u8 bRTSBW:1;
  107. u8 bPacketBW:1;
  108. u8 bRTSUseShortPreamble:1;
  109. u8 bRTSUseShortGI:1;
  110. u8 bMulticast:1;
  111. u8 bBroadcast:1;
  112. u8 drv_agg_enable:1;
  113. u8 reserved2:1;
  114. /* Tx Desc related element(12-19) */
  115. u8 rata_index;
  116. u8 queue_index;
  117. u16 txbuf_size;
  118. u8 RATRIndex;
  119. u8 reserved6;
  120. u8 reserved7;
  121. u8 reserved8;
  122. /* Tx firmware related element(20-27) */
  123. u8 data_rate;
  124. u8 rts_rate;
  125. u8 ampdu_factor;
  126. u8 ampdu_density;
  127. u8 DrvAggrNum;
  128. u16 pkt_size;
  129. u8 reserved12;
  130. } cb_desc, *pcb_desc;
  131. /*--------------------------Define -------------------------------------------*/
  132. #define MGN_1M 0x02
  133. #define MGN_2M 0x04
  134. #define MGN_5_5M 0x0b
  135. #define MGN_11M 0x16
  136. #define MGN_6M 0x0c
  137. #define MGN_9M 0x12
  138. #define MGN_12M 0x18
  139. #define MGN_18M 0x24
  140. #define MGN_24M 0x30
  141. #define MGN_36M 0x48
  142. #define MGN_48M 0x60
  143. #define MGN_54M 0x6c
  144. #define MGN_MCS0 0x80
  145. #define MGN_MCS1 0x81
  146. #define MGN_MCS2 0x82
  147. #define MGN_MCS3 0x83
  148. #define MGN_MCS4 0x84
  149. #define MGN_MCS5 0x85
  150. #define MGN_MCS6 0x86
  151. #define MGN_MCS7 0x87
  152. #define MGN_MCS8 0x88
  153. #define MGN_MCS9 0x89
  154. #define MGN_MCS10 0x8a
  155. #define MGN_MCS11 0x8b
  156. #define MGN_MCS12 0x8c
  157. #define MGN_MCS13 0x8d
  158. #define MGN_MCS14 0x8e
  159. #define MGN_MCS15 0x8f
  160. /*
  161. * 802.11 Management frame Reason Code field
  162. */
  163. enum _ReasonCode{
  164. unspec_reason = 0x1,
  165. auth_not_valid = 0x2,
  166. deauth_lv_ss = 0x3,
  167. inactivity = 0x4,
  168. ap_overload = 0x5,
  169. class2_err = 0x6,
  170. class3_err = 0x7,
  171. disas_lv_ss = 0x8,
  172. asoc_not_auth = 0x9,
  173. /* ----MIC_CHECK */
  174. mic_failure = 0xe,
  175. /* ----END MIC_CHECK */
  176. /* Reason code defined in 802.11i D10.0 p.28. */
  177. invalid_IE = 0x0d,
  178. four_way_tmout = 0x0f,
  179. two_way_tmout = 0x10,
  180. IE_dismatch = 0x11,
  181. invalid_Gcipher = 0x12,
  182. invalid_Pcipher = 0x13,
  183. invalid_AKMP = 0x14,
  184. unsup_RSNIEver = 0x15,
  185. invalid_RSNIE = 0x16,
  186. auth_802_1x_fail = 0x17,
  187. ciper_reject = 0x18,
  188. /* Reason code defined in 7.3.1.7, 802.1e D13.0, p.42. */
  189. QoS_unspec = 0x20, /* 32 */
  190. QAP_bandwidth = 0x21, /* 33 */
  191. poor_condition = 0x22, /* 34 */
  192. no_facility = 0x23, /* 35 */
  193. /* Where is 36??? */
  194. req_declined = 0x25, /* 37 */
  195. invalid_param = 0x26, /* 38 */
  196. req_not_honored = 0x27, /* 39 */
  197. TS_not_created = 0x2F, /* 47 */
  198. DL_not_allowed = 0x30, /* 48 */
  199. dest_not_exist = 0x31, /* 49 */
  200. dest_not_QSTA = 0x32, /* 50 */
  201. };
  202. #define aSifsTime ((priv->ieee80211->current_network.mode == IEEE_A) || \
  203. (priv->ieee80211->current_network.mode == IEEE_N_24G) || \
  204. (priv->ieee80211->current_network.mode == IEEE_N_5G)) ? 16 : 10
  205. #define MGMT_QUEUE_NUM 5
  206. #define IEEE_CMD_SET_WPA_PARAM 1
  207. #define IEEE_CMD_SET_WPA_IE 2
  208. #define IEEE_CMD_SET_ENCRYPTION 3
  209. #define IEEE_CMD_MLME 4
  210. #define IEEE_PARAM_WPA_ENABLED 1
  211. #define IEEE_PARAM_TKIP_COUNTERMEASURES 2
  212. #define IEEE_PARAM_DROP_UNENCRYPTED 3
  213. #define IEEE_PARAM_PRIVACY_INVOKED 4
  214. #define IEEE_PARAM_AUTH_ALGS 5
  215. #define IEEE_PARAM_IEEE_802_1X 6
  216. /* It should consistent with the driver_XXX.c */
  217. #define IEEE_PARAM_WPAX_SELECT 7
  218. /* Added for notify the encryption type selection */
  219. #define IEEE_PROTO_WPA 1
  220. #define IEEE_PROTO_RSN 2
  221. /* Added for notify the encryption type selection */
  222. #define IEEE_WPAX_USEGROUP 0
  223. #define IEEE_WPAX_WEP40 1
  224. #define IEEE_WPAX_TKIP 2
  225. #define IEEE_WPAX_WRAP 3
  226. #define IEEE_WPAX_CCMP 4
  227. #define IEEE_WPAX_WEP104 5
  228. #define IEEE_KEY_MGMT_IEEE8021X 1
  229. #define IEEE_KEY_MGMT_PSK 2
  230. #define IEEE_MLME_STA_DEAUTH 1
  231. #define IEEE_MLME_STA_DISASSOC 2
  232. #define IEEE_CRYPT_ERR_UNKNOWN_ALG 2
  233. #define IEEE_CRYPT_ERR_UNKNOWN_ADDR 3
  234. #define IEEE_CRYPT_ERR_CRYPT_INIT_FAILED 4
  235. #define IEEE_CRYPT_ERR_KEY_SET_FAILED 5
  236. #define IEEE_CRYPT_ERR_TX_KEY_SET_FAILED 6
  237. #define IEEE_CRYPT_ERR_CARD_CONF_FAILED 7
  238. #define IEEE_CRYPT_ALG_NAME_LEN 16
  239. #define MAX_IE_LEN 0xff
  240. /* added for kernel conflict */
  241. #define ieee80211_crypt_deinit_entries ieee80211_crypt_deinit_entries_rsl
  242. #define ieee80211_crypt_deinit_handler ieee80211_crypt_deinit_handler_rsl
  243. #define ieee80211_crypt_delayed_deinit ieee80211_crypt_delayed_deinit_rsl
  244. #define ieee80211_register_crypto_ops ieee80211_register_crypto_ops_rsl
  245. #define ieee80211_unregister_crypto_ops ieee80211_unregister_crypto_ops_rsl
  246. #define ieee80211_get_crypto_ops ieee80211_get_crypto_ops_rsl
  247. #define ieee80211_ccmp_null ieee80211_ccmp_null_rsl
  248. #define ieee80211_tkip_null ieee80211_tkip_null_rsl
  249. #define ieee80211_wep_null ieee80211_wep_null_rsl
  250. #define free_ieee80211 free_ieee80211_rsl
  251. #define alloc_ieee80211 alloc_ieee80211_rsl
  252. #define ieee80211_rx ieee80211_rx_rsl
  253. #define ieee80211_rx_mgt ieee80211_rx_mgt_rsl
  254. #define ieee80211_get_beacon ieee80211_get_beacon_rsl
  255. #define ieee80211_wake_queue ieee80211_wake_queue_rsl
  256. #define ieee80211_stop_queue ieee80211_stop_queue_rsl
  257. #define ieee80211_reset_queue ieee80211_reset_queue_rsl
  258. #define ieee80211_softmac_stop_protocol ieee80211_softmac_stop_protocol_rsl
  259. #define ieee80211_softmac_start_protocol ieee80211_softmac_start_protocol_rsl
  260. #define ieee80211_is_shortslot ieee80211_is_shortslot_rsl
  261. #define ieee80211_is_54g ieee80211_is_54g_rsl
  262. #define ieee80211_wpa_supplicant_ioctl ieee80211_wpa_supplicant_ioctl_rsl
  263. #define ieee80211_ps_tx_ack ieee80211_ps_tx_ack_rsl
  264. #define ieee80211_softmac_xmit ieee80211_softmac_xmit_rsl
  265. #define ieee80211_stop_send_beacons ieee80211_stop_send_beacons_rsl
  266. #define notify_wx_assoc_event notify_wx_assoc_event_rsl
  267. #define SendDisassociation SendDisassociation_rsl
  268. #define ieee80211_disassociate ieee80211_disassociate_rsl
  269. #define ieee80211_start_send_beacons ieee80211_start_send_beacons_rsl
  270. #define ieee80211_stop_scan ieee80211_stop_scan_rsl
  271. #define ieee80211_send_probe_requests ieee80211_send_probe_requests_rsl
  272. #define ieee80211_softmac_scan_syncro ieee80211_softmac_scan_syncro_rsl
  273. #define ieee80211_start_scan_syncro ieee80211_start_scan_syncro_rsl
  274. #define ieee80211_wx_get_essid ieee80211_wx_get_essid_rsl
  275. #define ieee80211_wx_set_essid ieee80211_wx_set_essid_rsl
  276. #define ieee80211_wx_set_rate ieee80211_wx_set_rate_rsl
  277. #define ieee80211_wx_get_rate ieee80211_wx_get_rate_rsl
  278. #define ieee80211_wx_set_wap ieee80211_wx_set_wap_rsl
  279. #define ieee80211_wx_get_wap ieee80211_wx_get_wap_rsl
  280. #define ieee80211_wx_set_mode ieee80211_wx_set_mode_rsl
  281. #define ieee80211_wx_get_mode ieee80211_wx_get_mode_rsl
  282. #define ieee80211_wx_set_scan ieee80211_wx_set_scan_rsl
  283. #define ieee80211_wx_get_freq ieee80211_wx_get_freq_rsl
  284. #define ieee80211_wx_set_freq ieee80211_wx_set_freq_rsl
  285. #define ieee80211_wx_set_rawtx ieee80211_wx_set_rawtx_rsl
  286. #define ieee80211_wx_get_name ieee80211_wx_get_name_rsl
  287. #define ieee80211_wx_set_power ieee80211_wx_set_power_rsl
  288. #define ieee80211_wx_get_power ieee80211_wx_get_power_rsl
  289. #define ieee80211_wlan_frequencies ieee80211_wlan_frequencies_rsl
  290. #define ieee80211_wx_set_rts ieee80211_wx_set_rts_rsl
  291. #define ieee80211_wx_get_rts ieee80211_wx_get_rts_rsl
  292. #define ieee80211_txb_free ieee80211_txb_free_rsl
  293. #define ieee80211_wx_set_gen_ie ieee80211_wx_set_gen_ie_rsl
  294. #define ieee80211_wx_get_scan ieee80211_wx_get_scan_rsl
  295. #define ieee80211_wx_set_encode ieee80211_wx_set_encode_rsl
  296. #define ieee80211_wx_get_encode ieee80211_wx_get_encode_rsl
  297. #if WIRELESS_EXT >= 18
  298. #define ieee80211_wx_set_mlme ieee80211_wx_set_mlme_rsl
  299. #define ieee80211_wx_set_auth ieee80211_wx_set_auth_rsl
  300. #define ieee80211_wx_set_encode_ext ieee80211_wx_set_encode_ext_rsl
  301. #define ieee80211_wx_get_encode_ext ieee80211_wx_get_encode_ext_rsl
  302. #endif
  303. typedef struct ieee_param {
  304. u32 cmd;
  305. u8 sta_addr[ETH_ALEN];
  306. union {
  307. struct {
  308. u8 name;
  309. u32 value;
  310. } wpa_param;
  311. struct {
  312. u32 len;
  313. u8 reserved[32];
  314. u8 data[0];
  315. } wpa_ie;
  316. struct{
  317. int command;
  318. int reason_code;
  319. } mlme;
  320. struct {
  321. u8 alg[IEEE_CRYPT_ALG_NAME_LEN];
  322. u8 set_tx;
  323. u32 err;
  324. u8 idx;
  325. u8 seq[8]; /* sequence counter (set: RX, get: TX) */
  326. u16 key_len;
  327. u8 key[0];
  328. } crypt;
  329. } u;
  330. } ieee_param;
  331. #if WIRELESS_EXT < 17
  332. #define IW_QUAL_QUAL_INVALID 0x10
  333. #define IW_QUAL_LEVEL_INVALID 0x20
  334. #define IW_QUAL_NOISE_INVALID 0x40
  335. #define IW_QUAL_QUAL_UPDATED 0x1
  336. #define IW_QUAL_LEVEL_UPDATED 0x2
  337. #define IW_QUAL_NOISE_UPDATED 0x4
  338. #endif
  339. /* linux under 2.6.9 release may not support it, so modify it for common use */
  340. #define MSECS(t) msecs_to_jiffies(t)
  341. #define msleep_interruptible_rsl msleep_interruptible
  342. #define IEEE80211_DATA_LEN 2304
  343. /* Maximum size for the MA-UNITDATA primitive, 802.11 standard section
  344. 6.2.1.1.2.
  345. The figure in section 7.1.2 suggests a body size of up to 2312
  346. bytes is allowed, which is a bit confusing, I suspect this
  347. represents the 2304 bytes of real data, plus a possible 8 bytes of
  348. WEP IV and ICV. (this interpretation suggested by Ramiro Barreiro) */
  349. #define IEEE80211_1ADDR_LEN 10
  350. #define IEEE80211_2ADDR_LEN 16
  351. #define IEEE80211_3ADDR_LEN 24
  352. #define IEEE80211_4ADDR_LEN 30
  353. #define IEEE80211_FCS_LEN 4
  354. #define IEEE80211_HLEN (IEEE80211_4ADDR_LEN)
  355. #define IEEE80211_FRAME_LEN (IEEE80211_DATA_LEN + IEEE80211_HLEN)
  356. #define IEEE80211_MGMT_HDR_LEN 24
  357. #define IEEE80211_DATA_HDR3_LEN 24
  358. #define IEEE80211_DATA_HDR4_LEN 30
  359. #define MIN_FRAG_THRESHOLD 256U
  360. #define MAX_FRAG_THRESHOLD 2346U
  361. /* Frame control field constants */
  362. #define IEEE80211_FCTL_VERS 0x0003
  363. #define IEEE80211_FCTL_FTYPE 0x000c
  364. #define IEEE80211_FCTL_STYPE 0x00f0
  365. #define IEEE80211_FCTL_FRAMETYPE 0x00fc
  366. #define IEEE80211_FCTL_TODS 0x0100
  367. #define IEEE80211_FCTL_FROMDS 0x0200
  368. #define IEEE80211_FCTL_DSTODS 0x0300
  369. #define IEEE80211_FCTL_MOREFRAGS 0x0400
  370. #define IEEE80211_FCTL_RETRY 0x0800
  371. #define IEEE80211_FCTL_PM 0x1000
  372. #define IEEE80211_FCTL_MOREDATA 0x2000
  373. #define IEEE80211_FCTL_WEP 0x4000
  374. #define IEEE80211_FCTL_ORDER 0x8000
  375. #define IEEE80211_FTYPE_MGMT 0x0000
  376. #define IEEE80211_FTYPE_CTL 0x0004
  377. #define IEEE80211_FTYPE_DATA 0x0008
  378. /* management */
  379. #define IEEE80211_STYPE_ASSOC_REQ 0x0000
  380. #define IEEE80211_STYPE_ASSOC_RESP 0x0010
  381. #define IEEE80211_STYPE_REASSOC_REQ 0x0020
  382. #define IEEE80211_STYPE_REASSOC_RESP 0x0030
  383. #define IEEE80211_STYPE_PROBE_REQ 0x0040
  384. #define IEEE80211_STYPE_PROBE_RESP 0x0050
  385. #define IEEE80211_STYPE_BEACON 0x0080
  386. #define IEEE80211_STYPE_ATIM 0x0090
  387. #define IEEE80211_STYPE_DISASSOC 0x00A0
  388. #define IEEE80211_STYPE_AUTH 0x00B0
  389. #define IEEE80211_STYPE_DEAUTH 0x00C0
  390. #define IEEE80211_STYPE_MANAGE_ACT 0x00D0
  391. /* control */
  392. #define IEEE80211_STYPE_PSPOLL 0x00A0
  393. #define IEEE80211_STYPE_RTS 0x00B0
  394. #define IEEE80211_STYPE_CTS 0x00C0
  395. #define IEEE80211_STYPE_ACK 0x00D0
  396. #define IEEE80211_STYPE_CFEND 0x00E0
  397. #define IEEE80211_STYPE_CFENDACK 0x00F0
  398. #define IEEE80211_STYPE_BLOCKACK 0x0094
  399. /* data */
  400. #define IEEE80211_STYPE_DATA 0x0000
  401. #define IEEE80211_STYPE_DATA_CFACK 0x0010
  402. #define IEEE80211_STYPE_DATA_CFPOLL 0x0020
  403. #define IEEE80211_STYPE_DATA_CFACKPOLL 0x0030
  404. #define IEEE80211_STYPE_NULLFUNC 0x0040
  405. #define IEEE80211_STYPE_CFACK 0x0050
  406. #define IEEE80211_STYPE_CFPOLL 0x0060
  407. #define IEEE80211_STYPE_CFACKPOLL 0x0070
  408. #define IEEE80211_STYPE_QOS_DATA 0x0080
  409. #define IEEE80211_STYPE_QOS_NULL 0x00C0
  410. #define IEEE80211_SCTL_FRAG 0x000F
  411. #define IEEE80211_SCTL_SEQ 0xFFF0
  412. /* QOS control */
  413. #define IEEE80211_QCTL_TID 0x000F
  414. #define FC_QOS_BIT BIT7
  415. #define IsDataFrame(pdu) (((pdu[0] & 0x0C) == 0x08) ? true : false)
  416. #define IsLegacyDataFrame(pdu) (IsDataFrame(pdu) && (!(pdu[0]&FC_QOS_BIT)))
  417. #define IsQoSDataFrame(pframe) ((*(u16 *)pframe&(IEEE80211_STYPE_QOS_DATA|IEEE80211_FTYPE_DATA)) == (IEEE80211_STYPE_QOS_DATA|IEEE80211_FTYPE_DATA))
  418. #define Frame_Order(pframe) (*(u16 *)pframe&IEEE80211_FCTL_ORDER)
  419. #define SN_LESS(a, b) (((a-b)&0x800) != 0)
  420. #define SN_EQUAL(a, b) (a == b)
  421. #define MAX_DEV_ADDR_SIZE 8
  422. typedef enum _ACT_CATEGORY{
  423. ACT_CAT_QOS = 1,
  424. ACT_CAT_DLS = 2,
  425. ACT_CAT_BA = 3,
  426. ACT_CAT_HT = 7,
  427. ACT_CAT_WMM = 17,
  428. } ACT_CATEGORY, *PACT_CATEGORY;
  429. typedef enum _TS_ACTION{
  430. ACT_ADDTSREQ = 0,
  431. ACT_ADDTSRSP = 1,
  432. ACT_DELTS = 2,
  433. ACT_SCHEDULE = 3,
  434. } TS_ACTION, *PTS_ACTION;
  435. typedef enum _BA_ACTION{
  436. ACT_ADDBAREQ = 0,
  437. ACT_ADDBARSP = 1,
  438. ACT_DELBA = 2,
  439. } BA_ACTION, *PBA_ACTION;
  440. typedef enum _InitialGainOpType{
  441. IG_Backup = 0,
  442. IG_Restore,
  443. IG_Max
  444. } InitialGainOpType;
  445. /* debug macros */
  446. #define CONFIG_IEEE80211_DEBUG
  447. #ifdef CONFIG_IEEE80211_DEBUG
  448. extern u32 ieee80211_debug_level;
  449. #define IEEE80211_DEBUG(level, fmt, args...) \
  450. do { if (ieee80211_debug_level & (level)) \
  451. printk(KERN_DEBUG "ieee80211: " fmt, ## args); } while (0)
  452. /* wb added to debug out data buf
  453. * if you want print DATA buffer related BA, please set ieee80211_debug_level
  454. * to DATA|BA
  455. */
  456. #define IEEE80211_DEBUG_DATA(level, data, datalen) \
  457. do { if ((ieee80211_debug_level & (level)) == (level)) { \
  458. int i; \
  459. u8* pdata = (u8 *) data; \
  460. printk(KERN_DEBUG "ieee80211: %s()\n", __FUNCTION__); \
  461. for (i = 0; i < (int)(datalen); i++) { \
  462. printk("%2x ", pdata[i]); \
  463. if ((i+1)%16 == 0) \
  464. printk("\n"); \
  465. } \
  466. printk("\n"); \
  467. } \
  468. } while (0)
  469. #else
  470. #define IEEE80211_DEBUG(level, fmt, args...) do {} while (0)
  471. #define IEEE80211_DEBUG_DATA(level, data, datalen) do {} while (0)
  472. #endif /* CONFIG_IEEE80211_DEBUG */
  473. /* debug macros not dependent on CONFIG_IEEE80211_DEBUG */
  474. /*
  475. * To use the debug system;
  476. *
  477. * If you are defining a new debug classification, simply add it to the #define
  478. * list here in the form of:
  479. *
  480. * #define IEEE80211_DL_xxxx VALUE
  481. *
  482. * shifting value to the left one bit from the previous entry. xxxx should be
  483. * the name of the classification (for example, WEP)
  484. *
  485. * You then need to either add a IEEE80211_xxxx_DEBUG() macro definition for your
  486. * classification, or use IEEE80211_DEBUG(IEEE80211_DL_xxxx, ...) whenever you want
  487. * to send output to that classification.
  488. *
  489. * To add your debug level to the list of levels seen when you perform
  490. *
  491. * % cat /proc/net/ipw/debug_level
  492. *
  493. * you simply need to add your entry to the ipw_debug_levels array.
  494. *
  495. * If you do not see debug_level in /proc/net/ipw then you do not have
  496. * CONFIG_IEEE80211_DEBUG defined in your kernel configuration
  497. *
  498. */
  499. #define IEEE80211_DL_INFO (1<<0)
  500. #define IEEE80211_DL_WX (1<<1)
  501. #define IEEE80211_DL_SCAN (1<<2)
  502. #define IEEE80211_DL_STATE (1<<3)
  503. #define IEEE80211_DL_MGMT (1<<4)
  504. #define IEEE80211_DL_FRAG (1<<5)
  505. #define IEEE80211_DL_EAP (1<<6)
  506. #define IEEE80211_DL_DROP (1<<7)
  507. #define IEEE80211_DL_TX (1<<8)
  508. #define IEEE80211_DL_RX (1<<9)
  509. #define IEEE80211_DL_HT (1<<10) /* HT */
  510. #define IEEE80211_DL_BA (1<<11) /* ba */
  511. #define IEEE80211_DL_TS (1<<12) /* TS */
  512. #define IEEE80211_DL_QOS (1<<13)
  513. #define IEEE80211_DL_REORDER (1<<14)
  514. #define IEEE80211_DL_IOT (1<<15)
  515. #define IEEE80211_DL_IPS (1<<16)
  516. #define IEEE80211_DL_TRACE (1<<29) /* trace function, need to user net_ratelimit() together in order not to print too much to the screen */
  517. #define IEEE80211_DL_DATA (1<<30) /* use this flag to control whether print data buf out. */
  518. #define IEEE80211_DL_ERR (1<<31) /* always open */
  519. #define IEEE80211_ERROR(f, a...) printk(KERN_ERR "ieee80211: " f, ## a)
  520. #define IEEE80211_WARNING(f, a...) printk(KERN_WARNING "ieee80211: " f, ## a)
  521. #define IEEE80211_DEBUG_INFO(f, a...) IEEE80211_DEBUG(IEEE80211_DL_INFO, f, ## a)
  522. #define IEEE80211_DEBUG_WX(f, a...) IEEE80211_DEBUG(IEEE80211_DL_WX, f, ## a)
  523. #define IEEE80211_DEBUG_SCAN(f, a...) IEEE80211_DEBUG(IEEE80211_DL_SCAN, f, ## a)
  524. #define IEEE80211_DEBUG_STATE(f, a...) IEEE80211_DEBUG(IEEE80211_DL_STATE, f, ## a)
  525. #define IEEE80211_DEBUG_MGMT(f, a...) IEEE80211_DEBUG(IEEE80211_DL_MGMT, f, ## a)
  526. #define IEEE80211_DEBUG_FRAG(f, a...) IEEE80211_DEBUG(IEEE80211_DL_FRAG, f, ## a)
  527. #define IEEE80211_DEBUG_EAP(f, a...) IEEE80211_DEBUG(IEEE80211_DL_EAP, f, ## a)
  528. #define IEEE80211_DEBUG_DROP(f, a...) IEEE80211_DEBUG(IEEE80211_DL_DROP, f, ## a)
  529. #define IEEE80211_DEBUG_TX(f, a...) IEEE80211_DEBUG(IEEE80211_DL_TX, f, ## a)
  530. #define IEEE80211_DEBUG_RX(f, a...) IEEE80211_DEBUG(IEEE80211_DL_RX, f, ## a)
  531. #define IEEE80211_DEBUG_QOS(f, a...) IEEE80211_DEBUG(IEEE80211_DL_QOS, f, ## a)
  532. #ifdef CONFIG_IEEE80211_DEBUG
  533. /* Added by Annie, 2005-11-22. */
  534. #define MAX_STR_LEN 64
  535. /* I want to see ASCII 33 to 126 only. Otherwise, I print '?'. Annie, 2005-11-22.*/
  536. #define PRINTABLE(_ch) (_ch > '!' && _ch < '~')
  537. #define IEEE80211_PRINT_STR(_Comp, _TitleString, _Ptr, _Len) \
  538. if ((_Comp) & level) { \
  539. int __i; \
  540. u8 buffer[MAX_STR_LEN]; \
  541. int length = (_Len < MAX_STR_LEN) ? _Len : (MAX_STR_LEN - 1); \
  542. memset(buffer, 0, MAX_STR_LEN); \
  543. memcpy(buffer, (u8 *)_Ptr, length); \
  544. for (__i = 0; __i < MAX_STR_LEN; __i++) { \
  545. if (!PRINTABLE(buffer[__i])) \
  546. buffer[__i] = '?'; \
  547. } \
  548. buffer[length] = '\0'; \
  549. printk("Rtl819x: "); \
  550. printk(_TitleString); \
  551. printk(": %d, <%s>\n", _Len, buffer); \
  552. }
  553. #else
  554. #define IEEE80211_PRINT_STR(_Comp, _TitleString, _Ptr, _Len) do {} while (0)
  555. #endif
  556. #include <linux/netdevice.h>
  557. #include <linux/if_arp.h> /* ARPHRD_ETHER */
  558. #ifndef WIRELESS_SPY
  559. #define WIRELESS_SPY /* enable iwspy support */
  560. #endif
  561. #include <net/iw_handler.h> /* new driver API */
  562. #ifndef ETH_P_PAE
  563. #define ETH_P_PAE 0x888E /* Port Access Entity (IEEE 802.1X) */
  564. #endif /* ETH_P_PAE */
  565. #define ETH_P_PREAUTH 0x88C7 /* IEEE 802.11i pre-authentication */
  566. #ifndef ETH_P_80211_RAW
  567. #define ETH_P_80211_RAW (ETH_P_ECONET + 1)
  568. #endif
  569. /* IEEE 802.11 defines */
  570. #define P80211_OUI_LEN 3
  571. struct ieee80211_snap_hdr {
  572. u8 dsap; /* always 0xAA */
  573. u8 ssap; /* always 0xAA */
  574. u8 ctrl; /* always 0x03 */
  575. u8 oui[P80211_OUI_LEN]; /* organizational universal id */
  576. } __attribute__ ((packed));
  577. #define SNAP_SIZE sizeof(struct ieee80211_snap_hdr)
  578. #define WLAN_FC_GET_VERS(fc) ((fc) & IEEE80211_FCTL_VERS)
  579. #define WLAN_FC_GET_TYPE(fc) ((fc) & IEEE80211_FCTL_FTYPE)
  580. #define WLAN_FC_GET_STYPE(fc) ((fc) & IEEE80211_FCTL_STYPE)
  581. #define WLAN_FC_GET_FRAMETYPE(fc) ((fc) & IEEE80211_FCTL_FRAMETYPE)
  582. #define WLAN_GET_SEQ_FRAG(seq) ((seq) & IEEE80211_SCTL_FRAG)
  583. #define WLAN_GET_SEQ_SEQ(seq) (((seq) & IEEE80211_SCTL_SEQ) >> 4)
  584. /* Authentication algorithms */
  585. #define WLAN_AUTH_OPEN 0
  586. #define WLAN_AUTH_SHARED_KEY 1
  587. #define WLAN_AUTH_LEAP 2
  588. #define WLAN_AUTH_CHALLENGE_LEN 128
  589. #define WLAN_CAPABILITY_BSS (1<<0)
  590. #define WLAN_CAPABILITY_IBSS (1<<1)
  591. #define WLAN_CAPABILITY_CF_POLLABLE (1<<2)
  592. #define WLAN_CAPABILITY_CF_POLL_REQUEST (1<<3)
  593. #define WLAN_CAPABILITY_PRIVACY (1<<4)
  594. #define WLAN_CAPABILITY_SHORT_PREAMBLE (1<<5)
  595. #define WLAN_CAPABILITY_PBCC (1<<6)
  596. #define WLAN_CAPABILITY_CHANNEL_AGILITY (1<<7)
  597. #define WLAN_CAPABILITY_SPECTRUM_MGMT (1<<8)
  598. #define WLAN_CAPABILITY_QOS (1<<9)
  599. #define WLAN_CAPABILITY_SHORT_SLOT (1<<10)
  600. #define WLAN_CAPABILITY_DSSS_OFDM (1<<13)
  601. /* 802.11g ERP information element */
  602. #define WLAN_ERP_NON_ERP_PRESENT (1<<0)
  603. #define WLAN_ERP_USE_PROTECTION (1<<1)
  604. #define WLAN_ERP_BARKER_PREAMBLE (1<<2)
  605. /* Status codes */
  606. enum ieee80211_statuscode {
  607. WLAN_STATUS_SUCCESS = 0,
  608. WLAN_STATUS_UNSPECIFIED_FAILURE = 1,
  609. WLAN_STATUS_CAPS_UNSUPPORTED = 10,
  610. WLAN_STATUS_REASSOC_NO_ASSOC = 11,
  611. WLAN_STATUS_ASSOC_DENIED_UNSPEC = 12,
  612. WLAN_STATUS_NOT_SUPPORTED_AUTH_ALG = 13,
  613. WLAN_STATUS_UNKNOWN_AUTH_TRANSACTION = 14,
  614. WLAN_STATUS_CHALLENGE_FAIL = 15,
  615. WLAN_STATUS_AUTH_TIMEOUT = 16,
  616. WLAN_STATUS_AP_UNABLE_TO_HANDLE_NEW_STA = 17,
  617. WLAN_STATUS_ASSOC_DENIED_RATES = 18,
  618. /* 802.11b */
  619. WLAN_STATUS_ASSOC_DENIED_NOSHORTPREAMBLE = 19,
  620. WLAN_STATUS_ASSOC_DENIED_NOPBCC = 20,
  621. WLAN_STATUS_ASSOC_DENIED_NOAGILITY = 21,
  622. /* 802.11h */
  623. WLAN_STATUS_ASSOC_DENIED_NOSPECTRUM = 22,
  624. WLAN_STATUS_ASSOC_REJECTED_BAD_POWER = 23,
  625. WLAN_STATUS_ASSOC_REJECTED_BAD_SUPP_CHAN = 24,
  626. /* 802.11g */
  627. WLAN_STATUS_ASSOC_DENIED_NOSHORTTIME = 25,
  628. WLAN_STATUS_ASSOC_DENIED_NODSSSOFDM = 26,
  629. /* 802.11i */
  630. WLAN_STATUS_INVALID_IE = 40,
  631. WLAN_STATUS_INVALID_GROUP_CIPHER = 41,
  632. WLAN_STATUS_INVALID_PAIRWISE_CIPHER = 42,
  633. WLAN_STATUS_INVALID_AKMP = 43,
  634. WLAN_STATUS_UNSUPP_RSN_VERSION = 44,
  635. WLAN_STATUS_INVALID_RSN_IE_CAP = 45,
  636. WLAN_STATUS_CIPHER_SUITE_REJECTED = 46,
  637. };
  638. /* Reason codes */
  639. enum ieee80211_reasoncode {
  640. WLAN_REASON_UNSPECIFIED = 1,
  641. WLAN_REASON_PREV_AUTH_NOT_VALID = 2,
  642. WLAN_REASON_DEAUTH_LEAVING = 3,
  643. WLAN_REASON_DISASSOC_DUE_TO_INACTIVITY = 4,
  644. WLAN_REASON_DISASSOC_AP_BUSY = 5,
  645. WLAN_REASON_CLASS2_FRAME_FROM_NONAUTH_STA = 6,
  646. WLAN_REASON_CLASS3_FRAME_FROM_NONASSOC_STA = 7,
  647. WLAN_REASON_DISASSOC_STA_HAS_LEFT = 8,
  648. WLAN_REASON_STA_REQ_ASSOC_WITHOUT_AUTH = 9,
  649. /* 802.11h */
  650. WLAN_REASON_DISASSOC_BAD_POWER = 10,
  651. WLAN_REASON_DISASSOC_BAD_SUPP_CHAN = 11,
  652. /* 802.11i */
  653. WLAN_REASON_INVALID_IE = 13,
  654. WLAN_REASON_MIC_FAILURE = 14,
  655. WLAN_REASON_4WAY_HANDSHAKE_TIMEOUT = 15,
  656. WLAN_REASON_GROUP_KEY_HANDSHAKE_TIMEOUT = 16,
  657. WLAN_REASON_IE_DIFFERENT = 17,
  658. WLAN_REASON_INVALID_GROUP_CIPHER = 18,
  659. WLAN_REASON_INVALID_PAIRWISE_CIPHER = 19,
  660. WLAN_REASON_INVALID_AKMP = 20,
  661. WLAN_REASON_UNSUPP_RSN_VERSION = 21,
  662. WLAN_REASON_INVALID_RSN_IE_CAP = 22,
  663. WLAN_REASON_IEEE8021X_FAILED = 23,
  664. WLAN_REASON_CIPHER_SUITE_REJECTED = 24,
  665. };
  666. #define IEEE80211_STATMASK_SIGNAL (1<<0)
  667. #define IEEE80211_STATMASK_RSSI (1<<1)
  668. #define IEEE80211_STATMASK_NOISE (1<<2)
  669. #define IEEE80211_STATMASK_RATE (1<<3)
  670. #define IEEE80211_STATMASK_WEMASK 0x7
  671. #define IEEE80211_CCK_MODULATION (1<<0)
  672. #define IEEE80211_OFDM_MODULATION (1<<1)
  673. #define IEEE80211_24GHZ_BAND (1<<0)
  674. #define IEEE80211_52GHZ_BAND (1<<1)
  675. #define IEEE80211_CCK_RATE_LEN 4
  676. #define IEEE80211_CCK_RATE_1MB 0x02
  677. #define IEEE80211_CCK_RATE_2MB 0x04
  678. #define IEEE80211_CCK_RATE_5MB 0x0B
  679. #define IEEE80211_CCK_RATE_11MB 0x16
  680. #define IEEE80211_OFDM_RATE_LEN 8
  681. #define IEEE80211_OFDM_RATE_6MB 0x0C
  682. #define IEEE80211_OFDM_RATE_9MB 0x12
  683. #define IEEE80211_OFDM_RATE_12MB 0x18
  684. #define IEEE80211_OFDM_RATE_18MB 0x24
  685. #define IEEE80211_OFDM_RATE_24MB 0x30
  686. #define IEEE80211_OFDM_RATE_36MB 0x48
  687. #define IEEE80211_OFDM_RATE_48MB 0x60
  688. #define IEEE80211_OFDM_RATE_54MB 0x6C
  689. #define IEEE80211_BASIC_RATE_MASK 0x80
  690. #define IEEE80211_CCK_RATE_1MB_MASK (1<<0)
  691. #define IEEE80211_CCK_RATE_2MB_MASK (1<<1)
  692. #define IEEE80211_CCK_RATE_5MB_MASK (1<<2)
  693. #define IEEE80211_CCK_RATE_11MB_MASK (1<<3)
  694. #define IEEE80211_OFDM_RATE_6MB_MASK (1<<4)
  695. #define IEEE80211_OFDM_RATE_9MB_MASK (1<<5)
  696. #define IEEE80211_OFDM_RATE_12MB_MASK (1<<6)
  697. #define IEEE80211_OFDM_RATE_18MB_MASK (1<<7)
  698. #define IEEE80211_OFDM_RATE_24MB_MASK (1<<8)
  699. #define IEEE80211_OFDM_RATE_36MB_MASK (1<<9)
  700. #define IEEE80211_OFDM_RATE_48MB_MASK (1<<10)
  701. #define IEEE80211_OFDM_RATE_54MB_MASK (1<<11)
  702. #define IEEE80211_CCK_RATES_MASK 0x0000000F
  703. #define IEEE80211_CCK_BASIC_RATES_MASK (IEEE80211_CCK_RATE_1MB_MASK | \
  704. IEEE80211_CCK_RATE_2MB_MASK)
  705. #define IEEE80211_CCK_DEFAULT_RATES_MASK (IEEE80211_CCK_BASIC_RATES_MASK | \
  706. IEEE80211_CCK_RATE_5MB_MASK | \
  707. IEEE80211_CCK_RATE_11MB_MASK)
  708. #define IEEE80211_OFDM_RATES_MASK 0x00000FF0
  709. #define IEEE80211_OFDM_BASIC_RATES_MASK (IEEE80211_OFDM_RATE_6MB_MASK | \
  710. IEEE80211_OFDM_RATE_12MB_MASK | \
  711. IEEE80211_OFDM_RATE_24MB_MASK)
  712. #define IEEE80211_OFDM_DEFAULT_RATES_MASK (IEEE80211_OFDM_BASIC_RATES_MASK | \
  713. IEEE80211_OFDM_RATE_9MB_MASK | \
  714. IEEE80211_OFDM_RATE_18MB_MASK | \
  715. IEEE80211_OFDM_RATE_36MB_MASK | \
  716. IEEE80211_OFDM_RATE_48MB_MASK | \
  717. IEEE80211_OFDM_RATE_54MB_MASK)
  718. #define IEEE80211_DEFAULT_RATES_MASK (IEEE80211_OFDM_DEFAULT_RATES_MASK | \
  719. IEEE80211_CCK_DEFAULT_RATES_MASK)
  720. #define IEEE80211_NUM_OFDM_RATES 8
  721. #define IEEE80211_NUM_CCK_RATES 4
  722. #define IEEE80211_OFDM_SHIFT_MASK_A 4
  723. /* this is stolen and modified from the madwifi driver*/
  724. #define IEEE80211_FC0_TYPE_MASK 0x0c
  725. #define IEEE80211_FC0_TYPE_DATA 0x08
  726. #define IEEE80211_FC0_SUBTYPE_MASK 0xB0
  727. #define IEEE80211_FC0_SUBTYPE_QOS 0x80
  728. #define IEEE80211_QOS_HAS_SEQ(fc) \
  729. (((fc) & (IEEE80211_FC0_TYPE_MASK | IEEE80211_FC0_SUBTYPE_MASK)) == \
  730. (IEEE80211_FC0_TYPE_DATA | IEEE80211_FC0_SUBTYPE_QOS))
  731. /* this is stolen from ipw2200 driver */
  732. #define IEEE_IBSS_MAC_HASH_SIZE 31
  733. struct ieee_ibss_seq {
  734. u8 mac[ETH_ALEN];
  735. u16 seq_num[17];
  736. u16 frag_num[17];
  737. unsigned long packet_time[17];
  738. struct list_head list;
  739. };
  740. /* NOTE: This data is for statistical purposes; not all hardware provides this
  741. * information for frames received. Not setting these will not cause
  742. * any adverse affects. */
  743. struct ieee80211_rx_stats {
  744. u32 mac_time[2];
  745. s8 rssi;
  746. u8 signal;
  747. u8 noise;
  748. u16 rate; /* in 100 kbps */
  749. u8 received_channel;
  750. u8 control;
  751. u8 mask;
  752. u8 freq;
  753. u16 len;
  754. u64 tsf;
  755. u32 beacon_time;
  756. u8 nic_type;
  757. u16 Length;
  758. u8 SignalQuality; /* in 0-100 index. */
  759. s32 RecvSignalPower; /* Real power in dBm for this packet, no beautification and aggregation. */
  760. s8 RxPower; /* in dBm Translate from PWdB */
  761. u8 SignalStrength; /* in 0-100 index. */
  762. u16 bHwError:1;
  763. u16 bCRC:1;
  764. u16 bICV:1;
  765. u16 bShortPreamble:1;
  766. u16 Antenna:1; /* for rtl8185 */
  767. u16 Decrypted:1; /* for rtl8185, rtl8187 */
  768. u16 Wakeup:1; /* for rtl8185 */
  769. u16 Reserved0:1; /* for rtl8185 */
  770. u8 AGC;
  771. u32 TimeStampLow;
  772. u32 TimeStampHigh;
  773. bool bShift;
  774. bool bIsQosData;
  775. u8 UserPriority;
  776. /*
  777. * 1Attention Please!!!<11n or 8190 specific code should be put below this line>
  778. */
  779. u8 RxDrvInfoSize;
  780. u8 RxBufShift;
  781. bool bIsAMPDU;
  782. bool bFirstMPDU;
  783. bool bContainHTC;
  784. bool RxIs40MHzPacket;
  785. u32 RxPWDBAll;
  786. u8 RxMIMOSignalStrength[4]; /* in 0~100 index */
  787. s8 RxMIMOSignalQuality[2];
  788. bool bPacketMatchBSSID;
  789. bool bIsCCK;
  790. bool bPacketToSelf;
  791. u8 *virtual_address;
  792. u16 packetlength; /* Total packet length: Must equal to sum of all FragLength */
  793. u16 fraglength; /* FragLength should equal to PacketLength in non-fragment case */
  794. u16 fragoffset; /* Data offset for this fragment */
  795. u16 ntotalfrag;
  796. bool bisrxaggrsubframe;
  797. bool bPacketBeacon; /* cosa add for rssi */
  798. bool bToSelfBA; /* cosa add for rssi */
  799. char cck_adc_pwdb[4]; /* cosa add for rx path selection */
  800. u16 Seq_Num;
  801. };
  802. /* IEEE 802.11 requires that STA supports concurrent reception of at least
  803. * three fragmented frames. This define can be increased to support more
  804. * concurrent frames, but it should be noted that each entry can consume about
  805. * 2 kB of RAM and increasing cache size will slow down frame reassembly. */
  806. #define IEEE80211_FRAG_CACHE_LEN 4
  807. struct ieee80211_frag_entry {
  808. unsigned long first_frag_time;
  809. unsigned int seq;
  810. unsigned int last_frag;
  811. struct sk_buff *skb;
  812. u8 src_addr[ETH_ALEN];
  813. u8 dst_addr[ETH_ALEN];
  814. };
  815. struct ieee80211_stats {
  816. unsigned int tx_unicast_frames;
  817. unsigned int tx_multicast_frames;
  818. unsigned int tx_fragments;
  819. unsigned int tx_unicast_octets;
  820. unsigned int tx_multicast_octets;
  821. unsigned int tx_deferred_transmissions;
  822. unsigned int tx_single_retry_frames;
  823. unsigned int tx_multiple_retry_frames;
  824. unsigned int tx_retry_limit_exceeded;
  825. unsigned int tx_discards;
  826. unsigned int rx_unicast_frames;
  827. unsigned int rx_multicast_frames;
  828. unsigned int rx_fragments;
  829. unsigned int rx_unicast_octets;
  830. unsigned int rx_multicast_octets;
  831. unsigned int rx_fcs_errors;
  832. unsigned int rx_discards_no_buffer;
  833. unsigned int tx_discards_wrong_sa;
  834. unsigned int rx_discards_undecryptable;
  835. unsigned int rx_message_in_msg_fragments;
  836. unsigned int rx_message_in_bad_msg_fragments;
  837. };
  838. struct ieee80211_device;
  839. #include "ieee80211_crypt.h"
  840. #define SEC_KEY_1 (1<<0)
  841. #define SEC_KEY_2 (1<<1)
  842. #define SEC_KEY_3 (1<<2)
  843. #define SEC_KEY_4 (1<<3)
  844. #define SEC_ACTIVE_KEY (1<<4)
  845. #define SEC_AUTH_MODE (1<<5)
  846. #define SEC_UNICAST_GROUP (1<<6)
  847. #define SEC_LEVEL (1<<7)
  848. #define SEC_ENABLED (1<<8)
  849. #define SEC_ENCRYPT (1<<9)
  850. #define SEC_LEVEL_0 0 /* None */
  851. #define SEC_LEVEL_1 1 /* WEP 40 and 104 bit */
  852. #define SEC_LEVEL_2 2 /* Level 1 + TKIP */
  853. #define SEC_LEVEL_2_CKIP 3 /* Level 1 + CKIP */
  854. #define SEC_LEVEL_3 4 /* Level 2 + CCMP */
  855. #define SEC_ALG_NONE 0
  856. #define SEC_ALG_WEP 1
  857. #define SEC_ALG_TKIP 2
  858. #define SEC_ALG_CCMP 3
  859. #define WEP_KEYS 4
  860. #define WEP_KEY_LEN 13
  861. #define SCM_KEY_LEN 32
  862. #define SCM_TEMPORAL_KEY_LENGTH 16
  863. struct ieee80211_security {
  864. u16 active_key:2,
  865. enabled:1,
  866. auth_mode:2,
  867. auth_algo:4,
  868. unicast_uses_group:1,
  869. encrypt:1;
  870. u8 key_sizes[WEP_KEYS];
  871. u8 keys[WEP_KEYS][SCM_KEY_LEN];
  872. u8 level;
  873. u16 flags;
  874. } __attribute__ ((packed));
  875. /*
  876. 802.11 data frame from AP
  877. ,-------------------------------------------------------------------.
  878. Bytes | 2 | 2 | 6 | 6 | 6 | 2 | 0..2312 | 4 |
  879. |------|------|---------|---------|---------|------|---------|------|
  880. Desc. | ctrl | dura | DA/RA | TA | SA | Sequ | frame | fcs |
  881. | | tion | (BSSID) | | | ence | data | |
  882. `-------------------------------------------------------------------'
  883. Total: 28-2340 bytes
  884. */
  885. /* Management Frame Information Element Types */
  886. enum ieee80211_mfie {
  887. MFIE_TYPE_SSID = 0,
  888. MFIE_TYPE_RATES = 1,
  889. MFIE_TYPE_FH_SET = 2,
  890. MFIE_TYPE_DS_SET = 3,
  891. MFIE_TYPE_CF_SET = 4,
  892. MFIE_TYPE_TIM = 5,
  893. MFIE_TYPE_IBSS_SET = 6,
  894. MFIE_TYPE_COUNTRY = 7,
  895. MFIE_TYPE_HOP_PARAMS = 8,
  896. MFIE_TYPE_HOP_TABLE = 9,
  897. MFIE_TYPE_REQUEST = 10,
  898. MFIE_TYPE_CHALLENGE = 16,
  899. MFIE_TYPE_POWER_CONSTRAINT = 32,
  900. MFIE_TYPE_POWER_CAPABILITY = 33,
  901. MFIE_TYPE_TPC_REQUEST = 34,
  902. MFIE_TYPE_TPC_REPORT = 35,
  903. MFIE_TYPE_SUPP_CHANNELS = 36,
  904. MFIE_TYPE_CSA = 37,
  905. MFIE_TYPE_MEASURE_REQUEST = 38,
  906. MFIE_TYPE_MEASURE_REPORT = 39,
  907. MFIE_TYPE_QUIET = 40,
  908. MFIE_TYPE_IBSS_DFS = 41,
  909. MFIE_TYPE_ERP = 42,
  910. MFIE_TYPE_RSN = 48,
  911. MFIE_TYPE_RATES_EX = 50,
  912. MFIE_TYPE_HT_CAP = 45,
  913. MFIE_TYPE_HT_INFO = 61,
  914. MFIE_TYPE_AIRONET = 133,
  915. MFIE_TYPE_GENERIC = 221,
  916. MFIE_TYPE_QOS_PARAMETER = 222,
  917. };
  918. /* Minimal header; can be used for passing 802.11 frames with sufficient
  919. * information to determine what type of underlying data type is actually
  920. * stored in the data. */
  921. struct ieee80211_hdr {
  922. __le16 frame_ctl;
  923. __le16 duration_id;
  924. u8 payload[0];
  925. } __attribute__ ((packed));
  926. struct ieee80211_hdr_1addr {
  927. __le16 frame_ctl;
  928. __le16 duration_id;
  929. u8 addr1[ETH_ALEN];
  930. u8 payload[0];
  931. } __attribute__ ((packed));
  932. struct ieee80211_hdr_2addr {
  933. __le16 frame_ctl;
  934. __le16 duration_id;
  935. u8 addr1[ETH_ALEN];
  936. u8 addr2[ETH_ALEN];
  937. u8 payload[0];
  938. } __attribute__ ((packed));
  939. struct ieee80211_hdr_3addr {
  940. __le16 frame_ctl;
  941. __le16 duration_id;
  942. u8 addr1[ETH_ALEN];
  943. u8 addr2[ETH_ALEN];
  944. u8 addr3[ETH_ALEN];
  945. __le16 seq_ctl;
  946. u8 payload[0];
  947. } __attribute__ ((packed));
  948. struct ieee80211_hdr_4addr {
  949. __le16 frame_ctl;
  950. __le16 duration_id;
  951. u8 addr1[ETH_ALEN];
  952. u8 addr2[ETH_ALEN];
  953. u8 addr3[ETH_ALEN];
  954. __le16 seq_ctl;
  955. u8 addr4[ETH_ALEN];
  956. u8 payload[0];
  957. } __attribute__ ((packed));
  958. struct ieee80211_hdr_3addrqos {
  959. __le16 frame_ctl;
  960. __le16 duration_id;
  961. u8 addr1[ETH_ALEN];
  962. u8 addr2[ETH_ALEN];
  963. u8 addr3[ETH_ALEN];
  964. __le16 seq_ctl;
  965. u8 payload[0];
  966. __le16 qos_ctl;
  967. } __attribute__ ((packed));
  968. struct ieee80211_hdr_4addrqos {
  969. __le16 frame_ctl;
  970. __le16 duration_id;
  971. u8 addr1[ETH_ALEN];
  972. u8 addr2[ETH_ALEN];
  973. u8 addr3[ETH_ALEN];
  974. __le16 seq_ctl;
  975. u8 addr4[ETH_ALEN];
  976. u8 payload[0];
  977. __le16 qos_ctl;
  978. } __attribute__ ((packed));
  979. struct ieee80211_info_element {
  980. u8 id;
  981. u8 len;
  982. u8 data[0];
  983. } __attribute__ ((packed));
  984. struct ieee80211_authentication {
  985. struct ieee80211_hdr_3addr header;
  986. __le16 algorithm;
  987. __le16 transaction;
  988. __le16 status;
  989. /*challenge*/
  990. struct ieee80211_info_element info_element[0];
  991. } __attribute__ ((packed));
  992. struct ieee80211_disassoc {
  993. struct ieee80211_hdr_3addr header;
  994. __le16 reason;
  995. } __attribute__ ((packed));
  996. struct ieee80211_probe_request {
  997. struct ieee80211_hdr_3addr header;
  998. /* SSID, supported rates */
  999. struct ieee80211_info_element info_element[0];
  1000. } __attribute__ ((packed));
  1001. struct ieee80211_probe_response {
  1002. struct ieee80211_hdr_3addr header;
  1003. u32 time_stamp[2];
  1004. __le16 beacon_interval;
  1005. __le16 capability;
  1006. /* SSID, supported rates, FH params, DS params,
  1007. * CF params, IBSS params, TIM (if beacon), RSN */
  1008. struct ieee80211_info_element info_element[0];
  1009. } __attribute__ ((packed));
  1010. /* Alias beacon for probe_response */
  1011. #define ieee80211_beacon ieee80211_probe_response
  1012. struct ieee80211_assoc_request_frame {
  1013. struct ieee80211_hdr_3addr header;
  1014. __le16 capability;
  1015. __le16 listen_interval;
  1016. /* SSID, supported rates, RSN */
  1017. struct ieee80211_info_element info_element[0];
  1018. } __attribute__ ((packed));
  1019. struct ieee80211_reassoc_request_frame {
  1020. struct ieee80211_hdr_3addr header;
  1021. __le16 capability;
  1022. __le16 listen_interval;
  1023. u8 current_ap[ETH_ALEN];
  1024. /* SSID, supported rates, RSN */
  1025. struct ieee80211_info_element info_element[0];
  1026. } __attribute__ ((packed));
  1027. struct ieee80211_assoc_response_frame {
  1028. struct ieee80211_hdr_3addr header;
  1029. __le16 capability;
  1030. __le16 status;
  1031. __le16 aid;
  1032. struct ieee80211_info_element info_element[0]; /* supported rates */
  1033. } __attribute__ ((packed));
  1034. struct ieee80211_txb {
  1035. u8 nr_frags;
  1036. u8 encrypted;
  1037. u8 queue_index;
  1038. u8 rts_included;
  1039. u16 reserved;
  1040. __le16 frag_size;
  1041. __le16 payload_size;
  1042. struct sk_buff *fragments[0];
  1043. };
  1044. #define MAX_TX_AGG_COUNT 16
  1045. struct ieee80211_drv_agg_txb {
  1046. u8 nr_drv_agg_frames;
  1047. struct sk_buff *tx_agg_frames[MAX_TX_AGG_COUNT];
  1048. } __attribute__((packed));
  1049. #define MAX_SUBFRAME_COUNT 64
  1050. struct ieee80211_rxb {
  1051. u8 nr_subframes;
  1052. struct sk_buff *subframes[MAX_SUBFRAME_COUNT];
  1053. u8 dst[ETH_ALEN];
  1054. u8 src[ETH_ALEN];
  1055. } __attribute__((packed));
  1056. typedef union _frameqos {
  1057. u16 shortdata;
  1058. u8 chardata[2];
  1059. struct {
  1060. u16 tid:4;
  1061. u16 eosp:1;
  1062. u16 ack_policy:2;
  1063. u16 reserved:1;
  1064. u16 txop:8;
  1065. } field;
  1066. } frameqos, *pframeqos;
  1067. /* SWEEP TABLE ENTRIES NUMBER*/
  1068. #define MAX_SWEEP_TAB_ENTRIES 42
  1069. #define MAX_SWEEP_TAB_ENTRIES_PER_PACKET 7
  1070. /* MAX_RATES_LENGTH needs to be 12. The spec says 8, and many APs
  1071. * only use 8, and then use extended rates for the remaining supported
  1072. * rates. Other APs, however, stick all of their supported rates on the
  1073. * main rates information element... */
  1074. #define MAX_RATES_LENGTH ((u8)12)
  1075. #define MAX_RATES_EX_LENGTH ((u8)16)
  1076. #define MAX_NETWORK_COUNT 128
  1077. #define MAX_CHANNEL_NUMBER 161
  1078. #define IEEE80211_SOFTMAC_SCAN_TIME 100
  1079. /* (HZ / 2) */
  1080. #define IEEE80211_SOFTMAC_ASSOC_RETRY_TIME (HZ * 2)
  1081. #define CRC_LENGTH 4U
  1082. #define MAX_WPA_IE_LEN 64
  1083. #define NETWORK_EMPTY_ESSID (1<<0)
  1084. #define NETWORK_HAS_OFDM (1<<1)
  1085. #define NETWORK_HAS_CCK (1<<2)
  1086. /* QoS structure */
  1087. #define NETWORK_HAS_QOS_PARAMETERS (1<<3)
  1088. #define NETWORK_HAS_QOS_INFORMATION (1<<4)
  1089. #define NETWORK_HAS_QOS_MASK (NETWORK_HAS_QOS_PARAMETERS | \
  1090. NETWORK_HAS_QOS_INFORMATION)
  1091. /* 802.11h */
  1092. #define NETWORK_HAS_POWER_CONSTRAINT (1<<5)
  1093. #define NETWORK_HAS_CSA (1<<6)
  1094. #define NETWORK_HAS_QUIET (1<<7)
  1095. #define NETWORK_HAS_IBSS_DFS (1<<8)
  1096. #define NETWORK_HAS_TPC_REPORT (1<<9)
  1097. #define NETWORK_HAS_ERP_VALUE (1<<10)
  1098. #define QOS_QUEUE_NUM 4
  1099. #define QOS_OUI_LEN 3
  1100. #define QOS_OUI_TYPE 2
  1101. #define QOS_ELEMENT_ID 221
  1102. #define QOS_OUI_INFO_SUB_TYPE 0
  1103. #define QOS_OUI_PARAM_SUB_TYPE 1
  1104. #define QOS_VERSION_1 1
  1105. #define QOS_AIFSN_MIN_VALUE 2
  1106. struct ieee80211_qos_information_element {
  1107. u8 elementID;
  1108. u8 length;
  1109. u8 qui[QOS_OUI_LEN];
  1110. u8 qui_type;
  1111. u8 qui_subtype;
  1112. u8 version;
  1113. u8 ac_info;
  1114. } __attribute__ ((packed));
  1115. struct ieee80211_qos_ac_parameter {
  1116. u8 aci_aifsn;
  1117. u8 ecw_min_max;
  1118. __le16 tx_op_limit;
  1119. } __attribute__ ((packed));
  1120. struct ieee80211_qos_parameter_info {
  1121. struct ieee80211_qos_information_element info_element;
  1122. u8 reserved;
  1123. struct ieee80211_qos_ac_parameter ac_params_record[QOS_QUEUE_NUM];
  1124. } __attribute__ ((packed));
  1125. struct ieee80211_qos_parameters {
  1126. __le16 cw_min[QOS_QUEUE_NUM];
  1127. __le16 cw_max[QOS_QUEUE_NUM];
  1128. u8 aifs[QOS_QUEUE_NUM];
  1129. u8 flag[QOS_QUEUE_NUM];
  1130. __le16 tx_op_limit[QOS_QUEUE_NUM];
  1131. } __attribute__ ((packed));
  1132. struct ieee80211_qos_data {
  1133. struct ieee80211_qos_parameters parameters;
  1134. int active;
  1135. int supported;
  1136. u8 param_count;
  1137. u8 old_param_count;
  1138. };
  1139. struct ieee80211_tim_parameters {
  1140. u8 tim_count;
  1141. u8 tim_period;
  1142. } __attribute__ ((packed));
  1143. struct ieee80211_wmm_ac_param {
  1144. u8 ac_aci_acm_aifsn;
  1145. u8 ac_ecwmin_ecwmax;
  1146. u16 ac_txop_limit;
  1147. };
  1148. struct ieee80211_wmm_ts_info {
  1149. u8 ac_dir_tid;
  1150. u8 ac_up_psb;
  1151. u8 reserved;
  1152. } __attribute__ ((packed));
  1153. struct ieee80211_wmm_tspec_elem {
  1154. struct ieee80211_wmm_ts_info ts_info;
  1155. u16 norm_msdu_size;
  1156. u16 max_msdu_size;
  1157. u32 min_serv_inter;
  1158. u32 max_serv_inter;
  1159. u32 inact_inter;
  1160. u32 suspen_inter;
  1161. u32 serv_start_time;
  1162. u32 min_data_rate;
  1163. u32 mean_data_rate;
  1164. u32 peak_data_rate;
  1165. u32 max_burst_size;
  1166. u32 delay_bound;
  1167. u32 min_phy_rate;
  1168. u16 surp_band_allow;
  1169. u16 medium_time;
  1170. } __attribute__((packed));
  1171. enum eap_type {
  1172. EAP_PACKET = 0,
  1173. EAPOL_START,
  1174. EAPOL_LOGOFF,
  1175. EAPOL_KEY,
  1176. EAPOL_ENCAP_ASF_ALERT
  1177. };
  1178. static const char *eap_types[] = {
  1179. [EAP_PACKET] = "EAP-Packet",
  1180. [EAPOL_START] = "EAPOL-Start",
  1181. [EAPOL_LOGOFF] = "EAPOL-Logoff",
  1182. [EAPOL_KEY] = "EAPOL-Key",
  1183. [EAPOL_ENCAP_ASF_ALERT] = "EAPOL-Encap-ASF-Alert"
  1184. };
  1185. static inline const char *eap_get_type(int type)
  1186. {
  1187. return ((u32)type >= ARRAY_SIZE(eap_types)) ? "Unknown" : eap_types[type];
  1188. }
  1189. static inline u8 Frame_QoSTID(u8 *buf)
  1190. {
  1191. struct ieee80211_hdr_3addr *hdr;
  1192. u16 fc;
  1193. hdr = (struct ieee80211_hdr_3addr *)buf;
  1194. fc = le16_to_cpu(hdr->frame_ctl);
  1195. return (u8)((frameqos *)(buf + (((fc & IEEE80211_FCTL_TODS) && (fc & IEEE80211_FCTL_FROMDS)) ? 30 : 24)))->field.tid;
  1196. }
  1197. struct eapol {
  1198. u8 snap[6];
  1199. u16 ethertype;
  1200. u8 version;
  1201. u8 type;
  1202. u16 length;
  1203. } __attribute__ ((packed));
  1204. struct ieee80211_softmac_stats{
  1205. unsigned int rx_ass_ok;
  1206. unsigned int rx_ass_err;
  1207. unsigned int rx_probe_rq;
  1208. unsigned int tx_probe_rs;
  1209. unsigned int tx_beacons;
  1210. unsigned int rx_auth_rq;
  1211. unsigned int rx_auth_rs_ok;
  1212. unsigned int rx_auth_rs_err;
  1213. unsigned int tx_auth_rq;
  1214. unsigned int no_auth_rs;
  1215. unsigned int no_ass_rs;
  1216. unsigned int tx_ass_rq;
  1217. unsigned int rx_ass_rq;
  1218. unsigned int tx_probe_rq;
  1219. unsigned int reassoc;
  1220. unsigned int swtxstop;
  1221. unsigned int swtxawake;
  1222. unsigned char CurrentShowTxate;
  1223. unsigned char last_packet_rate;
  1224. unsigned int txretrycount;
  1225. };
  1226. #define BEACON_PROBE_SSID_ID_POSITION 12
  1227. struct ieee80211_info_element_hdr {
  1228. u8 id;
  1229. u8 len;
  1230. } __attribute__ ((packed));
  1231. /*
  1232. * These are the data types that can make up management packets
  1233. *
  1234. u16 auth_algorithm;
  1235. u16 auth_sequence;
  1236. u16 beacon_interval;
  1237. u16 capability;
  1238. u8 current_ap[ETH_ALEN];
  1239. u16 listen_interval;
  1240. struct {
  1241. u16 association_id:14, reserved:2;
  1242. } __attribute__ ((packed));
  1243. u32 time_stamp[2];
  1244. u16 reason;
  1245. u16 status;
  1246. */
  1247. #define IEEE80211_DEFAULT_TX_ESSID "Penguin"
  1248. #define IEEE80211_DEFAULT_BASIC_RATE 2 /* 1Mbps */
  1249. enum {WMM_all_frame, WMM_two_frame, WMM_four_frame, WMM_six_frame};
  1250. #define MAX_SP_Len (WMM_all_frame << 4)
  1251. #define IEEE80211_QOS_TID 0x0f
  1252. #define QOS_CTL_NOTCONTAIN_ACK (0x01 << 5)
  1253. #define IEEE80211_DTIM_MBCAST 4
  1254. #define IEEE80211_DTIM_UCAST 2
  1255. #define IEEE80211_DTIM_VALID 1
  1256. #define IEEE80211_DTIM_INVALID 0
  1257. #define IEEE80211_PS_DISABLED 0
  1258. #define IEEE80211_PS_UNICAST IEEE80211_DTIM_UCAST
  1259. #define IEEE80211_PS_MBCAST IEEE80211_DTIM_MBCAST
  1260. #ifdef WMM_Hang_8187
  1261. #undef WMM_Hang_8187
  1262. #endif
  1263. #define WME_AC_BK 0x00
  1264. #define WME_AC_BE 0x01
  1265. #define WME_AC_VI 0x02
  1266. #define WME_AC_VO 0x03
  1267. #define WME_ACI_MASK 0x03
  1268. #define WME_AIFSN_MASK 0x03
  1269. #define WME_AC_PRAM_LEN 16
  1270. #define MAX_RECEIVE_BUFFER_SIZE 9100
  1271. /* UP Mapping to AC, using in MgntQuery_SequenceNumber() and maybe for DSCP */
  1272. #define UP2AC(up) ( \
  1273. ((up) < 1) ? WME_AC_BE : \
  1274. ((up) < 3) ? WME_AC_BK : \
  1275. ((up) < 4) ? WME_AC_BE : \
  1276. ((up) < 6) ? WME_AC_VI : \
  1277. WME_AC_VO)
  1278. /* AC Mapping to UP, using in Tx part for selecting the corresponding TX queue */
  1279. #define AC2UP(_ac) ( \
  1280. ((_ac) == WME_AC_VO) ? 6 : \
  1281. ((_ac) == WME_AC_VI) ? 5 : \
  1282. ((_ac) == WME_AC_BK) ? 1 : \
  1283. 0)
  1284. #define ETHER_ADDR_LEN 6 /* length of an Ethernet address */
  1285. #define ETHERNET_HEADER_SIZE 14 /* length of two Ethernet address plus ether type*/
  1286. struct ether_header {
  1287. u8 ether_dhost[ETHER_ADDR_LEN];
  1288. u8 ether_shost[ETHER_ADDR_LEN];
  1289. u16 ether_type;
  1290. } __attribute__((packed));
  1291. #ifndef ETHERTYPE_PAE
  1292. #define ETHERTYPE_PAE 0x888e /* EAPOL PAE/802.1x */
  1293. #endif
  1294. #ifndef ETHERTYPE_IP
  1295. #define ETHERTYPE_IP 0x0800 /* IP protocol */
  1296. #endif
  1297. typedef struct _bss_ht{
  1298. bool support_ht;
  1299. /* HT related elements */
  1300. u8 ht_cap_buf[32];
  1301. u16 ht_cap_len;
  1302. u8 ht_info_buf[32];
  1303. u16 ht_info_len;
  1304. HT_SPEC_VER ht_spec_ver;
  1305. /* HT_CAPABILITY_ELE bdHTCapEle; */
  1306. /* HT_INFORMATION_ELE bdHTInfoEle; */
  1307. bool aggregation;
  1308. bool long_slot_time;
  1309. } bss_ht, *pbss_ht;
  1310. typedef enum _erp_t{
  1311. ERP_NonERPpresent = 0x01,
  1312. ERP_UseProtection = 0x02,
  1313. ERP_BarkerPreambleMode = 0x04,
  1314. } erp_t;
  1315. struct ieee80211_network {
  1316. /* These entries are used to identify a unique network */
  1317. u8 bssid[ETH_ALEN];
  1318. u8 channel;
  1319. /* Ensure null-terminated for any debug msgs */
  1320. u8 ssid[IW_ESSID_MAX_SIZE + 1];
  1321. u8 ssid_len;
  1322. struct ieee80211_qos_data qos_data;
  1323. bool bWithAironetIE;
  1324. bool bCkipSupported;
  1325. bool bCcxRmEnable;
  1326. u16 CcxRmState[2];
  1327. /* CCXv4 S59, MBSSID. */
  1328. bool bMBssidValid;
  1329. u8 MBssidMask;
  1330. u8 MBssid[6];
  1331. /* CCX 2 S38, WLAN Device Version Number element. */
  1332. bool bWithCcxVerNum;
  1333. u8 BssCcxVerNumber;
  1334. /* These are network statistics */
  1335. struct ieee80211_rx_stats stats;
  1336. u16 capability;
  1337. u8 rates[MAX_RATES_LENGTH];
  1338. u8 rates_len;
  1339. u8 rates_ex[MAX_RATES_EX_LENGTH];
  1340. u8 rates_ex_len;
  1341. unsigned long last_scanned;
  1342. u8 mode;
  1343. u32 flags;
  1344. u32 last_associate;
  1345. u32 time_stamp[2];
  1346. u16 beacon_interval;
  1347. u16 listen_interval;
  1348. u16 atim_window;
  1349. u8 erp_value;
  1350. u8 wpa_ie[MAX_WPA_IE_LEN];
  1351. size_t wpa_ie_len;
  1352. u8 rsn_ie[MAX_WPA_IE_LEN];
  1353. size_t rsn_ie_len;
  1354. struct ieee80211_tim_parameters tim;
  1355. u8 dtim_period;
  1356. u8 dtim_data;
  1357. u32 last_dtim_sta_time[2];
  1358. /* appeded for QoS */
  1359. u8 wmm_info;
  1360. struct ieee80211_wmm_ac_param wmm_param[4];
  1361. u8 QoS_Enable;
  1362. #ifdef THOMAS_TURBO
  1363. u8 Turbo_Enable;/* enable turbo mode, added by thomas */
  1364. #endif
  1365. #ifdef ENABLE_DOT11D
  1366. u16 CountryIeLen;
  1367. u8 CountryIeBuf[MAX_IE_LEN];
  1368. #endif
  1369. /* HT Related */
  1370. BSS_HT bssht;
  1371. /* Add to handle broadcom AP management frame CCK rate. */
  1372. bool broadcom_cap_exist;
  1373. bool ralink_cap_exist;
  1374. bool atheros_cap_exist;
  1375. bool cisco_cap_exist;
  1376. bool unknown_cap_exist;
  1377. bool berp_info_valid;
  1378. bool buseprotection;
  1379. /* put at the end of the structure. */
  1380. struct list_head list;
  1381. };
  1382. enum ieee80211_state {
  1383. /* the card is not linked at all */
  1384. IEEE80211_NOLINK = 0,
  1385. /* IEEE80211_ASSOCIATING* are for BSS client mode
  1386. * the driver shall not perform RX filtering unless
  1387. * the state is LINKED.
  1388. * The driver shall just check for the state LINKED and
  1389. * defaults to NOLINK for ALL the other states (including
  1390. * LINKED_SCANNING)
  1391. */
  1392. /* the association procedure will start (wq scheduling)*/
  1393. IEEE80211_ASSOCIATING,
  1394. IEEE80211_ASSOCIATING_RETRY,
  1395. /* the association procedure is sending AUTH request*/
  1396. IEEE80211_ASSOCIATING_AUTHENTICATING,
  1397. /* the association procedure has successfully authentcated
  1398. * and is sending association request
  1399. */
  1400. IEEE80211_ASSOCIATING_AUTHENTICATED,
  1401. /* the link is ok. the card associated to a BSS or linked
  1402. * to a ibss cell or acting as an AP and creating the bss
  1403. */
  1404. IEEE80211_LINKED,
  1405. /* same as LINKED, but the driver shall apply RX filter
  1406. * rules as we are in NO_LINK mode. As the card is still
  1407. * logically linked, but it is doing a syncro site survey
  1408. * then it will be back to LINKED state.
  1409. */
  1410. IEEE80211_LINKED_SCANNING,
  1411. };
  1412. #define DEFAULT_MAX_SCAN_AGE (15 * HZ)
  1413. #define DEFAULT_FTS 2346
  1414. #define CFG_IEEE80211_RESERVE_FCS (1<<0)
  1415. #define CFG_IEEE80211_COMPUTE_FCS (1<<1)
  1416. #define CFG_IEEE80211_RTS (1<<2)
  1417. #define IEEE80211_24GHZ_MIN_CHANNEL 1
  1418. #define IEEE80211_24GHZ_MAX_CHANNEL 14
  1419. #define IEEE80211_24GHZ_CHANNELS (IEEE80211_24GHZ_MAX_CHANNEL - \
  1420. IEEE80211_24GHZ_MIN_CHANNEL + 1)
  1421. #define IEEE80211_52GHZ_MIN_CHANNEL 34
  1422. #define IEEE80211_52GHZ_MAX_CHANNEL 165
  1423. #define IEEE80211_52GHZ_CHANNELS (IEEE80211_52GHZ_MAX_CHANNEL - \
  1424. IEEE80211_52GHZ_MIN_CHANNEL + 1)
  1425. typedef struct tx_pending_t{
  1426. int frag;
  1427. struct ieee80211_txb *txb;
  1428. } tx_pending_t;
  1429. typedef struct _bandwidth_autoswitch {
  1430. long threshold_20Mhzto40Mhz;
  1431. long threshold_40Mhzto20Mhz;
  1432. bool bforced_tx20Mhz;
  1433. bool bautoswitch_enable;
  1434. } bandwidth_autoswitch, *pbandwidth_autoswitch;
  1435. #define REORDER_WIN_SIZE 128
  1436. #define REORDER_ENTRY_NUM 128
  1437. typedef struct _RX_REORDER_ENTRY {
  1438. struct list_head List;
  1439. u16 SeqNum;
  1440. struct ieee80211_rxb *prxb;
  1441. } RX_REORDER_ENTRY, *PRX_REORDER_ENTRY;
  1442. typedef enum _Fsync_State {
  1443. Default_Fsync,
  1444. HW_Fsync,
  1445. SW_Fsync
  1446. } Fsync_State;
  1447. /* Power save mode configured. */
  1448. typedef enum _RT_PS_MODE {
  1449. eActive, /* Active/Continuous access. */
  1450. eMaxPs, /* Max power save mode. */
  1451. eFastPs /* Fast power save mode. */
  1452. } RT_PS_MODE;
  1453. typedef enum _IPS_CALLBACK_FUNCION {
  1454. IPS_CALLBACK_NONE = 0,
  1455. IPS_CALLBACK_MGNT_LINK_REQUEST = 1,
  1456. IPS_CALLBACK_JOIN_REQUEST = 2,
  1457. } IPS_CALLBACK_FUNCION;
  1458. typedef enum _RT_JOIN_ACTION {
  1459. RT_JOIN_INFRA = 1,
  1460. RT_JOIN_IBSS = 2,
  1461. RT_START_IBSS = 3,
  1462. RT_NO_ACTION = 4,
  1463. } RT_JOIN_ACTION;
  1464. typedef struct _IbssParms {
  1465. u16 atimWin;
  1466. } IbssParms, *PIbssParms;
  1467. #define MAX_NUM_RATES 264 /* Max num of support rates element: 8, Max num of ext. support rate: 255. 061122, by rcnjko. */
  1468. /* RF state. */
  1469. typedef enum _RT_RF_POWER_STAT

Large files files are truncated, but you can click here to view the full file