PageRenderTime 71ms CodeModel.GetById 22ms RepoModel.GetById 1ms app.codeStats 0ms

/drivers/staging/rtl8192u/ieee80211/ieee80211.h

https://bitbucket.org/wisechild/galaxy-nexus
C++ Header | 2629 lines | 1857 code | 362 blank | 410 comment | 47 complexity | 006213e659d9390599261c51f9f50a47 MD5 | raw file
Possible License(s): GPL-2.0, LGPL-2.0, AGPL-1.0
  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/semaphore.h>
  34. #include <linux/delay.h>
  35. #include <linux/wireless.h>
  36. #include "rtl819x_HT.h"
  37. #include "rtl819x_BA.h"
  38. #include "rtl819x_TS.h"
  39. #ifndef IW_MODE_MONITOR
  40. #define IW_MODE_MONITOR 6
  41. #endif
  42. #ifndef IWEVCUSTOM
  43. #define IWEVCUSTOM 0x8c02
  44. #endif
  45. #ifndef container_of
  46. /**
  47. * container_of - cast a member of a structure out to the containing structure
  48. *
  49. * @ptr: the pointer to the member.
  50. * @type: the type of the container struct this is embedded in.
  51. * @member: the name of the member within the struct.
  52. *
  53. */
  54. #define container_of(ptr, type, member) ({ \
  55. const typeof( ((type *)0)->member ) *__mptr = (ptr); \
  56. (type *)( (char *)__mptr - offsetof(type,member) );})
  57. #endif
  58. #define KEY_TYPE_NA 0x0
  59. #define KEY_TYPE_WEP40 0x1
  60. #define KEY_TYPE_TKIP 0x2
  61. #define KEY_TYPE_CCMP 0x4
  62. #define KEY_TYPE_WEP104 0x5
  63. /* added for rtl819x tx procedure */
  64. #define MAX_QUEUE_SIZE 0x10
  65. //
  66. // 8190 queue mapping
  67. //
  68. #define BK_QUEUE 0
  69. #define BE_QUEUE 1
  70. #define VI_QUEUE 2
  71. #define VO_QUEUE 3
  72. #define HCCA_QUEUE 4
  73. #define TXCMD_QUEUE 5
  74. #define MGNT_QUEUE 6
  75. #define HIGH_QUEUE 7
  76. #define BEACON_QUEUE 8
  77. #define LOW_QUEUE BE_QUEUE
  78. #define NORMAL_QUEUE MGNT_QUEUE
  79. //added by amy for ps
  80. #define SWRF_TIMEOUT 50
  81. //added by amy for LEAP related
  82. #define IE_CISCO_FLAG_POSITION 0x08 // Flag byte: byte 8, numbered from 0.
  83. #define SUPPORT_CKIP_MIC 0x08 // bit3
  84. #define SUPPORT_CKIP_PK 0x10 // bit4
  85. /* defined for skb cb field */
  86. /* At most 28 byte */
  87. typedef struct cb_desc {
  88. /* Tx Desc Related flags (8-9) */
  89. u8 bLastIniPkt:1;
  90. u8 bCmdOrInit:1;
  91. u8 bFirstSeg:1;
  92. u8 bLastSeg:1;
  93. u8 bEncrypt:1;
  94. u8 bTxDisableRateFallBack:1;
  95. u8 bTxUseDriverAssingedRate:1;
  96. u8 bHwSec:1; //indicate whether use Hw security. WB
  97. u8 reserved1;
  98. /* Tx Firmware Relaged flags (10-11)*/
  99. u8 bCTSEnable:1;
  100. u8 bRTSEnable:1;
  101. u8 bUseShortGI:1;
  102. u8 bUseShortPreamble:1;
  103. u8 bTxEnableFwCalcDur:1;
  104. u8 bAMPDUEnable:1;
  105. u8 bRTSSTBC:1;
  106. u8 RTSSC:1;
  107. u8 bRTSBW:1;
  108. u8 bPacketBW:1;
  109. u8 bRTSUseShortPreamble:1;
  110. u8 bRTSUseShortGI:1;
  111. u8 bMulticast:1;
  112. u8 bBroadcast:1;
  113. //u8 reserved2:2;
  114. u8 drv_agg_enable:1;
  115. u8 reserved2:1;
  116. /* Tx Desc related element(12-19) */
  117. u8 rata_index;
  118. u8 queue_index;
  119. //u8 reserved3;
  120. //u8 reserved4;
  121. u16 txbuf_size;
  122. //u8 reserved5;
  123. u8 RATRIndex;
  124. u8 reserved6;
  125. u8 reserved7;
  126. u8 reserved8;
  127. /* Tx firmware related element(20-27) */
  128. u8 data_rate;
  129. u8 rts_rate;
  130. u8 ampdu_factor;
  131. u8 ampdu_density;
  132. //u8 reserved9;
  133. //u8 reserved10;
  134. //u8 reserved11;
  135. u8 DrvAggrNum;
  136. u16 pkt_size;
  137. u8 reserved12;
  138. }cb_desc, *pcb_desc;
  139. /*--------------------------Define -------------------------------------------*/
  140. #define MGN_1M 0x02
  141. #define MGN_2M 0x04
  142. #define MGN_5_5M 0x0b
  143. #define MGN_11M 0x16
  144. #define MGN_6M 0x0c
  145. #define MGN_9M 0x12
  146. #define MGN_12M 0x18
  147. #define MGN_18M 0x24
  148. #define MGN_24M 0x30
  149. #define MGN_36M 0x48
  150. #define MGN_48M 0x60
  151. #define MGN_54M 0x6c
  152. #define MGN_MCS0 0x80
  153. #define MGN_MCS1 0x81
  154. #define MGN_MCS2 0x82
  155. #define MGN_MCS3 0x83
  156. #define MGN_MCS4 0x84
  157. #define MGN_MCS5 0x85
  158. #define MGN_MCS6 0x86
  159. #define MGN_MCS7 0x87
  160. #define MGN_MCS8 0x88
  161. #define MGN_MCS9 0x89
  162. #define MGN_MCS10 0x8a
  163. #define MGN_MCS11 0x8b
  164. #define MGN_MCS12 0x8c
  165. #define MGN_MCS13 0x8d
  166. #define MGN_MCS14 0x8e
  167. #define MGN_MCS15 0x8f
  168. //----------------------------------------------------------------------------
  169. // 802.11 Management frame Reason Code field
  170. //----------------------------------------------------------------------------
  171. enum _ReasonCode{
  172. unspec_reason = 0x1,
  173. auth_not_valid = 0x2,
  174. deauth_lv_ss = 0x3,
  175. inactivity = 0x4,
  176. ap_overload = 0x5,
  177. class2_err = 0x6,
  178. class3_err = 0x7,
  179. disas_lv_ss = 0x8,
  180. asoc_not_auth = 0x9,
  181. //----MIC_CHECK
  182. mic_failure = 0xe,
  183. //----END MIC_CHECK
  184. // Reason code defined in 802.11i D10.0 p.28.
  185. invalid_IE = 0x0d,
  186. four_way_tmout = 0x0f,
  187. two_way_tmout = 0x10,
  188. IE_dismatch = 0x11,
  189. invalid_Gcipher = 0x12,
  190. invalid_Pcipher = 0x13,
  191. invalid_AKMP = 0x14,
  192. unsup_RSNIEver = 0x15,
  193. invalid_RSNIE = 0x16,
  194. auth_802_1x_fail= 0x17,
  195. ciper_reject = 0x18,
  196. // Reason code defined in 7.3.1.7, 802.1e D13.0, p.42. Added by Annie, 2005-11-15.
  197. QoS_unspec = 0x20, // 32
  198. QAP_bandwidth = 0x21, // 33
  199. poor_condition = 0x22, // 34
  200. no_facility = 0x23, // 35
  201. // Where is 36???
  202. req_declined = 0x25, // 37
  203. invalid_param = 0x26, // 38
  204. req_not_honored= 0x27, // 39
  205. TS_not_created = 0x2F, // 47
  206. DL_not_allowed = 0x30, // 48
  207. dest_not_exist = 0x31, // 49
  208. dest_not_QSTA = 0x32, // 50
  209. };
  210. #define aSifsTime ((priv->ieee80211->current_network.mode == IEEE_A)||(priv->ieee80211->current_network.mode == IEEE_N_24G)||(priv->ieee80211->current_network.mode == IEEE_N_5G))? 16 : 10
  211. #define MGMT_QUEUE_NUM 5
  212. #define IEEE_CMD_SET_WPA_PARAM 1
  213. #define IEEE_CMD_SET_WPA_IE 2
  214. #define IEEE_CMD_SET_ENCRYPTION 3
  215. #define IEEE_CMD_MLME 4
  216. #define IEEE_PARAM_WPA_ENABLED 1
  217. #define IEEE_PARAM_TKIP_COUNTERMEASURES 2
  218. #define IEEE_PARAM_DROP_UNENCRYPTED 3
  219. #define IEEE_PARAM_PRIVACY_INVOKED 4
  220. #define IEEE_PARAM_AUTH_ALGS 5
  221. #define IEEE_PARAM_IEEE_802_1X 6
  222. //It should consistent with the driver_XXX.c
  223. // David, 2006.9.26
  224. #define IEEE_PARAM_WPAX_SELECT 7
  225. //Added for notify the encryption type selection
  226. // David, 2006.9.26
  227. #define IEEE_PROTO_WPA 1
  228. #define IEEE_PROTO_RSN 2
  229. //Added for notify the encryption type selection
  230. // David, 2006.9.26
  231. #define IEEE_WPAX_USEGROUP 0
  232. #define IEEE_WPAX_WEP40 1
  233. #define IEEE_WPAX_TKIP 2
  234. #define IEEE_WPAX_WRAP 3
  235. #define IEEE_WPAX_CCMP 4
  236. #define IEEE_WPAX_WEP104 5
  237. #define IEEE_KEY_MGMT_IEEE8021X 1
  238. #define IEEE_KEY_MGMT_PSK 2
  239. #define IEEE_MLME_STA_DEAUTH 1
  240. #define IEEE_MLME_STA_DISASSOC 2
  241. #define IEEE_CRYPT_ERR_UNKNOWN_ALG 2
  242. #define IEEE_CRYPT_ERR_UNKNOWN_ADDR 3
  243. #define IEEE_CRYPT_ERR_CRYPT_INIT_FAILED 4
  244. #define IEEE_CRYPT_ERR_KEY_SET_FAILED 5
  245. #define IEEE_CRYPT_ERR_TX_KEY_SET_FAILED 6
  246. #define IEEE_CRYPT_ERR_CARD_CONF_FAILED 7
  247. #define IEEE_CRYPT_ALG_NAME_LEN 16
  248. #define MAX_IE_LEN 0xff
  249. // added for kernel conflict
  250. #define ieee80211_crypt_deinit_entries ieee80211_crypt_deinit_entries_rsl
  251. #define ieee80211_crypt_deinit_handler ieee80211_crypt_deinit_handler_rsl
  252. #define ieee80211_crypt_delayed_deinit ieee80211_crypt_delayed_deinit_rsl
  253. #define ieee80211_register_crypto_ops ieee80211_register_crypto_ops_rsl
  254. #define ieee80211_unregister_crypto_ops ieee80211_unregister_crypto_ops_rsl
  255. #define ieee80211_get_crypto_ops ieee80211_get_crypto_ops_rsl
  256. #define ieee80211_ccmp_null ieee80211_ccmp_null_rsl
  257. #define ieee80211_tkip_null ieee80211_tkip_null_rsl
  258. #define ieee80211_wep_null ieee80211_wep_null_rsl
  259. #define free_ieee80211 free_ieee80211_rsl
  260. #define alloc_ieee80211 alloc_ieee80211_rsl
  261. #define ieee80211_rx ieee80211_rx_rsl
  262. #define ieee80211_rx_mgt ieee80211_rx_mgt_rsl
  263. #define ieee80211_get_beacon ieee80211_get_beacon_rsl
  264. #define ieee80211_wake_queue ieee80211_wake_queue_rsl
  265. #define ieee80211_stop_queue ieee80211_stop_queue_rsl
  266. #define ieee80211_reset_queue ieee80211_reset_queue_rsl
  267. #define ieee80211_softmac_stop_protocol ieee80211_softmac_stop_protocol_rsl
  268. #define ieee80211_softmac_start_protocol ieee80211_softmac_start_protocol_rsl
  269. #define ieee80211_is_shortslot ieee80211_is_shortslot_rsl
  270. #define ieee80211_is_54g ieee80211_is_54g_rsl
  271. #define ieee80211_wpa_supplicant_ioctl ieee80211_wpa_supplicant_ioctl_rsl
  272. #define ieee80211_ps_tx_ack ieee80211_ps_tx_ack_rsl
  273. #define ieee80211_softmac_xmit ieee80211_softmac_xmit_rsl
  274. #define ieee80211_stop_send_beacons ieee80211_stop_send_beacons_rsl
  275. #define notify_wx_assoc_event notify_wx_assoc_event_rsl
  276. #define SendDisassociation SendDisassociation_rsl
  277. #define ieee80211_disassociate ieee80211_disassociate_rsl
  278. #define ieee80211_start_send_beacons ieee80211_start_send_beacons_rsl
  279. #define ieee80211_stop_scan ieee80211_stop_scan_rsl
  280. #define ieee80211_send_probe_requests ieee80211_send_probe_requests_rsl
  281. #define ieee80211_softmac_scan_syncro ieee80211_softmac_scan_syncro_rsl
  282. #define ieee80211_start_scan_syncro ieee80211_start_scan_syncro_rsl
  283. #define ieee80211_wx_get_essid ieee80211_wx_get_essid_rsl
  284. #define ieee80211_wx_set_essid ieee80211_wx_set_essid_rsl
  285. #define ieee80211_wx_set_rate ieee80211_wx_set_rate_rsl
  286. #define ieee80211_wx_get_rate ieee80211_wx_get_rate_rsl
  287. #define ieee80211_wx_set_wap ieee80211_wx_set_wap_rsl
  288. #define ieee80211_wx_get_wap ieee80211_wx_get_wap_rsl
  289. #define ieee80211_wx_set_mode ieee80211_wx_set_mode_rsl
  290. #define ieee80211_wx_get_mode ieee80211_wx_get_mode_rsl
  291. #define ieee80211_wx_set_scan ieee80211_wx_set_scan_rsl
  292. #define ieee80211_wx_get_freq ieee80211_wx_get_freq_rsl
  293. #define ieee80211_wx_set_freq ieee80211_wx_set_freq_rsl
  294. #define ieee80211_wx_set_rawtx ieee80211_wx_set_rawtx_rsl
  295. #define ieee80211_wx_get_name ieee80211_wx_get_name_rsl
  296. #define ieee80211_wx_set_power ieee80211_wx_set_power_rsl
  297. #define ieee80211_wx_get_power ieee80211_wx_get_power_rsl
  298. #define ieee80211_wlan_frequencies ieee80211_wlan_frequencies_rsl
  299. #define ieee80211_wx_set_rts ieee80211_wx_set_rts_rsl
  300. #define ieee80211_wx_get_rts ieee80211_wx_get_rts_rsl
  301. #define ieee80211_txb_free ieee80211_txb_free_rsl
  302. #define ieee80211_wx_set_gen_ie ieee80211_wx_set_gen_ie_rsl
  303. #define ieee80211_wx_get_scan ieee80211_wx_get_scan_rsl
  304. #define ieee80211_wx_set_encode ieee80211_wx_set_encode_rsl
  305. #define ieee80211_wx_get_encode ieee80211_wx_get_encode_rsl
  306. #if WIRELESS_EXT >= 18
  307. #define ieee80211_wx_set_mlme ieee80211_wx_set_mlme_rsl
  308. #define ieee80211_wx_set_auth ieee80211_wx_set_auth_rsl
  309. #define ieee80211_wx_set_encode_ext ieee80211_wx_set_encode_ext_rsl
  310. #define ieee80211_wx_get_encode_ext ieee80211_wx_get_encode_ext_rsl
  311. #endif
  312. typedef struct ieee_param {
  313. u32 cmd;
  314. u8 sta_addr[ETH_ALEN];
  315. union {
  316. struct {
  317. u8 name;
  318. u32 value;
  319. } wpa_param;
  320. struct {
  321. u32 len;
  322. u8 reserved[32];
  323. u8 data[0];
  324. } wpa_ie;
  325. struct{
  326. int command;
  327. int reason_code;
  328. } mlme;
  329. struct {
  330. u8 alg[IEEE_CRYPT_ALG_NAME_LEN];
  331. u8 set_tx;
  332. u32 err;
  333. u8 idx;
  334. u8 seq[8]; /* sequence counter (set: RX, get: TX) */
  335. u16 key_len;
  336. u8 key[0];
  337. } crypt;
  338. } u;
  339. }ieee_param;
  340. #if WIRELESS_EXT < 17
  341. #define IW_QUAL_QUAL_INVALID 0x10
  342. #define IW_QUAL_LEVEL_INVALID 0x20
  343. #define IW_QUAL_NOISE_INVALID 0x40
  344. #define IW_QUAL_QUAL_UPDATED 0x1
  345. #define IW_QUAL_LEVEL_UPDATED 0x2
  346. #define IW_QUAL_NOISE_UPDATED 0x4
  347. #endif
  348. // linux under 2.6.9 release may not support it, so modify it for common use
  349. #define MSECS(t) msecs_to_jiffies(t)
  350. #define msleep_interruptible_rsl msleep_interruptible
  351. #define IEEE80211_DATA_LEN 2304
  352. /* Maximum size for the MA-UNITDATA primitive, 802.11 standard section
  353. 6.2.1.1.2.
  354. The figure in section 7.1.2 suggests a body size of up to 2312
  355. bytes is allowed, which is a bit confusing, I suspect this
  356. represents the 2304 bytes of real data, plus a possible 8 bytes of
  357. WEP IV and ICV. (this interpretation suggested by Ramiro Barreiro) */
  358. #define IEEE80211_1ADDR_LEN 10
  359. #define IEEE80211_2ADDR_LEN 16
  360. #define IEEE80211_3ADDR_LEN 24
  361. #define IEEE80211_4ADDR_LEN 30
  362. #define IEEE80211_FCS_LEN 4
  363. #define IEEE80211_HLEN (IEEE80211_4ADDR_LEN)
  364. #define IEEE80211_FRAME_LEN (IEEE80211_DATA_LEN + IEEE80211_HLEN)
  365. #define IEEE80211_MGMT_HDR_LEN 24
  366. #define IEEE80211_DATA_HDR3_LEN 24
  367. #define IEEE80211_DATA_HDR4_LEN 30
  368. #define MIN_FRAG_THRESHOLD 256U
  369. #define MAX_FRAG_THRESHOLD 2346U
  370. /* Frame control field constants */
  371. #define IEEE80211_FCTL_VERS 0x0003
  372. #define IEEE80211_FCTL_FTYPE 0x000c
  373. #define IEEE80211_FCTL_STYPE 0x00f0
  374. #define IEEE80211_FCTL_FRAMETYPE 0x00fc
  375. #define IEEE80211_FCTL_TODS 0x0100
  376. #define IEEE80211_FCTL_FROMDS 0x0200
  377. #define IEEE80211_FCTL_DSTODS 0x0300 //added by david
  378. #define IEEE80211_FCTL_MOREFRAGS 0x0400
  379. #define IEEE80211_FCTL_RETRY 0x0800
  380. #define IEEE80211_FCTL_PM 0x1000
  381. #define IEEE80211_FCTL_MOREDATA 0x2000
  382. #define IEEE80211_FCTL_WEP 0x4000
  383. #define IEEE80211_FCTL_ORDER 0x8000
  384. #define IEEE80211_FTYPE_MGMT 0x0000
  385. #define IEEE80211_FTYPE_CTL 0x0004
  386. #define IEEE80211_FTYPE_DATA 0x0008
  387. /* management */
  388. #define IEEE80211_STYPE_ASSOC_REQ 0x0000
  389. #define IEEE80211_STYPE_ASSOC_RESP 0x0010
  390. #define IEEE80211_STYPE_REASSOC_REQ 0x0020
  391. #define IEEE80211_STYPE_REASSOC_RESP 0x0030
  392. #define IEEE80211_STYPE_PROBE_REQ 0x0040
  393. #define IEEE80211_STYPE_PROBE_RESP 0x0050
  394. #define IEEE80211_STYPE_BEACON 0x0080
  395. #define IEEE80211_STYPE_ATIM 0x0090
  396. #define IEEE80211_STYPE_DISASSOC 0x00A0
  397. #define IEEE80211_STYPE_AUTH 0x00B0
  398. #define IEEE80211_STYPE_DEAUTH 0x00C0
  399. #define IEEE80211_STYPE_MANAGE_ACT 0x00D0
  400. /* control */
  401. #define IEEE80211_STYPE_PSPOLL 0x00A0
  402. #define IEEE80211_STYPE_RTS 0x00B0
  403. #define IEEE80211_STYPE_CTS 0x00C0
  404. #define IEEE80211_STYPE_ACK 0x00D0
  405. #define IEEE80211_STYPE_CFEND 0x00E0
  406. #define IEEE80211_STYPE_CFENDACK 0x00F0
  407. #define IEEE80211_STYPE_BLOCKACK 0x0094
  408. /* data */
  409. #define IEEE80211_STYPE_DATA 0x0000
  410. #define IEEE80211_STYPE_DATA_CFACK 0x0010
  411. #define IEEE80211_STYPE_DATA_CFPOLL 0x0020
  412. #define IEEE80211_STYPE_DATA_CFACKPOLL 0x0030
  413. #define IEEE80211_STYPE_NULLFUNC 0x0040
  414. #define IEEE80211_STYPE_CFACK 0x0050
  415. #define IEEE80211_STYPE_CFPOLL 0x0060
  416. #define IEEE80211_STYPE_CFACKPOLL 0x0070
  417. #define IEEE80211_STYPE_QOS_DATA 0x0080 //added for WMM 2006/8/2
  418. #define IEEE80211_STYPE_QOS_NULL 0x00C0
  419. #define IEEE80211_SCTL_FRAG 0x000F
  420. #define IEEE80211_SCTL_SEQ 0xFFF0
  421. /* QOS control */
  422. #define IEEE80211_QCTL_TID 0x000F
  423. #define FC_QOS_BIT BIT7
  424. #define IsDataFrame(pdu) ( ((pdu[0] & 0x0C)==0x08) ? true : false )
  425. #define IsLegacyDataFrame(pdu) (IsDataFrame(pdu) && (!(pdu[0]&FC_QOS_BIT)) )
  426. //added by wb. Is this right?
  427. #define IsQoSDataFrame(pframe) ((*(u16*)pframe&(IEEE80211_STYPE_QOS_DATA|IEEE80211_FTYPE_DATA)) == (IEEE80211_STYPE_QOS_DATA|IEEE80211_FTYPE_DATA))
  428. #define Frame_Order(pframe) (*(u16*)pframe&IEEE80211_FCTL_ORDER)
  429. #define SN_LESS(a, b) (((a-b)&0x800)!=0)
  430. #define SN_EQUAL(a, b) (a == b)
  431. #define MAX_DEV_ADDR_SIZE 8
  432. typedef enum _ACT_CATEGORY{
  433. ACT_CAT_QOS = 1,
  434. ACT_CAT_DLS = 2,
  435. ACT_CAT_BA = 3,
  436. ACT_CAT_HT = 7,
  437. ACT_CAT_WMM = 17,
  438. } ACT_CATEGORY, *PACT_CATEGORY;
  439. typedef enum _TS_ACTION{
  440. ACT_ADDTSREQ = 0,
  441. ACT_ADDTSRSP = 1,
  442. ACT_DELTS = 2,
  443. ACT_SCHEDULE = 3,
  444. } TS_ACTION, *PTS_ACTION;
  445. typedef enum _BA_ACTION{
  446. ACT_ADDBAREQ = 0,
  447. ACT_ADDBARSP = 1,
  448. ACT_DELBA = 2,
  449. } BA_ACTION, *PBA_ACTION;
  450. typedef enum _InitialGainOpType{
  451. IG_Backup=0,
  452. IG_Restore,
  453. IG_Max
  454. }InitialGainOpType;
  455. /* debug macros */
  456. #define CONFIG_IEEE80211_DEBUG
  457. #ifdef CONFIG_IEEE80211_DEBUG
  458. extern u32 ieee80211_debug_level;
  459. #define IEEE80211_DEBUG(level, fmt, args...) \
  460. do { if (ieee80211_debug_level & (level)) \
  461. printk(KERN_DEBUG "ieee80211: " fmt, ## args); } while (0)
  462. //wb added to debug out data buf
  463. //if you want print DATA buffer related BA, please set ieee80211_debug_level to DATA|BA
  464. #define IEEE80211_DEBUG_DATA(level, data, datalen) \
  465. do{ if ((ieee80211_debug_level & (level)) == (level)) \
  466. { \
  467. int i; \
  468. u8* pdata = (u8*) data; \
  469. printk(KERN_DEBUG "ieee80211: %s()\n", __FUNCTION__); \
  470. for(i=0; i<(int)(datalen); i++) \
  471. { \
  472. printk("%2x ", pdata[i]); \
  473. if ((i+1)%16 == 0) printk("\n"); \
  474. } \
  475. printk("\n"); \
  476. } \
  477. } while (0)
  478. #else
  479. #define IEEE80211_DEBUG(level, fmt, args...) do {} while (0)
  480. #define IEEE80211_DEBUG_DATA(level, data, datalen) do {} while(0)
  481. #endif /* CONFIG_IEEE80211_DEBUG */
  482. /* debug macros not dependent on CONFIG_IEEE80211_DEBUG */
  483. /*
  484. * To use the debug system;
  485. *
  486. * If you are defining a new debug classification, simply add it to the #define
  487. * list here in the form of:
  488. *
  489. * #define IEEE80211_DL_xxxx VALUE
  490. *
  491. * shifting value to the left one bit from the previous entry. xxxx should be
  492. * the name of the classification (for example, WEP)
  493. *
  494. * You then need to either add a IEEE80211_xxxx_DEBUG() macro definition for your
  495. * classification, or use IEEE80211_DEBUG(IEEE80211_DL_xxxx, ...) whenever you want
  496. * to send output to that classification.
  497. *
  498. * To add your debug level to the list of levels seen when you perform
  499. *
  500. * % cat /proc/net/ipw/debug_level
  501. *
  502. * you simply need to add your entry to the ipw_debug_levels array.
  503. *
  504. * If you do not see debug_level in /proc/net/ipw then you do not have
  505. * CONFIG_IEEE80211_DEBUG defined in your kernel configuration
  506. *
  507. */
  508. #define IEEE80211_DL_INFO (1<<0)
  509. #define IEEE80211_DL_WX (1<<1)
  510. #define IEEE80211_DL_SCAN (1<<2)
  511. #define IEEE80211_DL_STATE (1<<3)
  512. #define IEEE80211_DL_MGMT (1<<4)
  513. #define IEEE80211_DL_FRAG (1<<5)
  514. #define IEEE80211_DL_EAP (1<<6)
  515. #define IEEE80211_DL_DROP (1<<7)
  516. #define IEEE80211_DL_TX (1<<8)
  517. #define IEEE80211_DL_RX (1<<9)
  518. #define IEEE80211_DL_HT (1<<10) //HT
  519. #define IEEE80211_DL_BA (1<<11) //ba
  520. #define IEEE80211_DL_TS (1<<12) //TS
  521. #define IEEE80211_DL_QOS (1<<13)
  522. #define IEEE80211_DL_REORDER (1<<14)
  523. #define IEEE80211_DL_IOT (1<<15)
  524. #define IEEE80211_DL_IPS (1<<16)
  525. #define IEEE80211_DL_TRACE (1<<29) //trace function, need to user net_ratelimit() together in order not to print too much to the screen
  526. #define IEEE80211_DL_DATA (1<<30) //use this flag to control whether print data buf out.
  527. #define IEEE80211_DL_ERR (1<<31) //always open
  528. #define IEEE80211_ERROR(f, a...) printk(KERN_ERR "ieee80211: " f, ## a)
  529. #define IEEE80211_WARNING(f, a...) printk(KERN_WARNING "ieee80211: " f, ## a)
  530. #define IEEE80211_DEBUG_INFO(f, a...) IEEE80211_DEBUG(IEEE80211_DL_INFO, f, ## a)
  531. #define IEEE80211_DEBUG_WX(f, a...) IEEE80211_DEBUG(IEEE80211_DL_WX, f, ## a)
  532. #define IEEE80211_DEBUG_SCAN(f, a...) IEEE80211_DEBUG(IEEE80211_DL_SCAN, f, ## a)
  533. #define IEEE80211_DEBUG_STATE(f, a...) IEEE80211_DEBUG(IEEE80211_DL_STATE, f, ## a)
  534. #define IEEE80211_DEBUG_MGMT(f, a...) IEEE80211_DEBUG(IEEE80211_DL_MGMT, f, ## a)
  535. #define IEEE80211_DEBUG_FRAG(f, a...) IEEE80211_DEBUG(IEEE80211_DL_FRAG, f, ## a)
  536. #define IEEE80211_DEBUG_EAP(f, a...) IEEE80211_DEBUG(IEEE80211_DL_EAP, f, ## a)
  537. #define IEEE80211_DEBUG_DROP(f, a...) IEEE80211_DEBUG(IEEE80211_DL_DROP, f, ## a)
  538. #define IEEE80211_DEBUG_TX(f, a...) IEEE80211_DEBUG(IEEE80211_DL_TX, f, ## a)
  539. #define IEEE80211_DEBUG_RX(f, a...) IEEE80211_DEBUG(IEEE80211_DL_RX, f, ## a)
  540. #define IEEE80211_DEBUG_QOS(f, a...) IEEE80211_DEBUG(IEEE80211_DL_QOS, f, ## a)
  541. #ifdef CONFIG_IEEE80211_DEBUG
  542. /* Added by Annie, 2005-11-22. */
  543. #define MAX_STR_LEN 64
  544. /* I want to see ASCII 33 to 126 only. Otherwise, I print '?'. Annie, 2005-11-22.*/
  545. #define PRINTABLE(_ch) (_ch>'!' && _ch<'~')
  546. #define IEEE80211_PRINT_STR(_Comp, _TitleString, _Ptr, _Len) \
  547. if((_Comp) & level) \
  548. { \
  549. int __i; \
  550. u8 buffer[MAX_STR_LEN]; \
  551. int length = (_Len<MAX_STR_LEN)? _Len : (MAX_STR_LEN-1) ; \
  552. memset(buffer, 0, MAX_STR_LEN); \
  553. memcpy(buffer, (u8 *)_Ptr, length ); \
  554. for( __i=0; __i<MAX_STR_LEN; __i++ ) \
  555. { \
  556. if( !PRINTABLE(buffer[__i]) ) buffer[__i] = '?'; \
  557. } \
  558. buffer[length] = '\0'; \
  559. printk("Rtl819x: "); \
  560. printk(_TitleString); \
  561. printk(": %d, <%s>\n", _Len, buffer); \
  562. }
  563. #else
  564. #define IEEE80211_PRINT_STR(_Comp, _TitleString, _Ptr, _Len) do {} while (0)
  565. #endif
  566. #include <linux/netdevice.h>
  567. #include <linux/if_arp.h> /* ARPHRD_ETHER */
  568. #ifndef WIRELESS_SPY
  569. #define WIRELESS_SPY // enable iwspy support
  570. #endif
  571. #include <net/iw_handler.h> // new driver API
  572. #ifndef ETH_P_PAE
  573. #define ETH_P_PAE 0x888E /* Port Access Entity (IEEE 802.1X) */
  574. #endif /* ETH_P_PAE */
  575. #define ETH_P_PREAUTH 0x88C7 /* IEEE 802.11i pre-authentication */
  576. #ifndef ETH_P_80211_RAW
  577. #define ETH_P_80211_RAW (ETH_P_ECONET + 1)
  578. #endif
  579. /* IEEE 802.11 defines */
  580. #define P80211_OUI_LEN 3
  581. struct ieee80211_snap_hdr {
  582. u8 dsap; /* always 0xAA */
  583. u8 ssap; /* always 0xAA */
  584. u8 ctrl; /* always 0x03 */
  585. u8 oui[P80211_OUI_LEN]; /* organizational universal id */
  586. } __attribute__ ((packed));
  587. #define SNAP_SIZE sizeof(struct ieee80211_snap_hdr)
  588. #define WLAN_FC_GET_VERS(fc) ((fc) & IEEE80211_FCTL_VERS)
  589. #define WLAN_FC_GET_TYPE(fc) ((fc) & IEEE80211_FCTL_FTYPE)
  590. #define WLAN_FC_GET_STYPE(fc) ((fc) & IEEE80211_FCTL_STYPE)
  591. #define WLAN_FC_GET_FRAMETYPE(fc) ((fc) & IEEE80211_FCTL_FRAMETYPE)
  592. #define WLAN_GET_SEQ_FRAG(seq) ((seq) & IEEE80211_SCTL_FRAG)
  593. #define WLAN_GET_SEQ_SEQ(seq) (((seq) & IEEE80211_SCTL_SEQ) >> 4)
  594. /* Authentication algorithms */
  595. #define WLAN_AUTH_OPEN 0
  596. #define WLAN_AUTH_SHARED_KEY 1
  597. #define WLAN_AUTH_LEAP 2
  598. #define WLAN_AUTH_CHALLENGE_LEN 128
  599. #define WLAN_CAPABILITY_BSS (1<<0)
  600. #define WLAN_CAPABILITY_IBSS (1<<1)
  601. #define WLAN_CAPABILITY_CF_POLLABLE (1<<2)
  602. #define WLAN_CAPABILITY_CF_POLL_REQUEST (1<<3)
  603. #define WLAN_CAPABILITY_PRIVACY (1<<4)
  604. #define WLAN_CAPABILITY_SHORT_PREAMBLE (1<<5)
  605. #define WLAN_CAPABILITY_PBCC (1<<6)
  606. #define WLAN_CAPABILITY_CHANNEL_AGILITY (1<<7)
  607. #define WLAN_CAPABILITY_SPECTRUM_MGMT (1<<8)
  608. #define WLAN_CAPABILITY_QOS (1<<9)
  609. #define WLAN_CAPABILITY_SHORT_SLOT (1<<10)
  610. #define WLAN_CAPABILITY_DSSS_OFDM (1<<13)
  611. /* 802.11g ERP information element */
  612. #define WLAN_ERP_NON_ERP_PRESENT (1<<0)
  613. #define WLAN_ERP_USE_PROTECTION (1<<1)
  614. #define WLAN_ERP_BARKER_PREAMBLE (1<<2)
  615. /* Status codes */
  616. enum ieee80211_statuscode {
  617. WLAN_STATUS_SUCCESS = 0,
  618. WLAN_STATUS_UNSPECIFIED_FAILURE = 1,
  619. WLAN_STATUS_CAPS_UNSUPPORTED = 10,
  620. WLAN_STATUS_REASSOC_NO_ASSOC = 11,
  621. WLAN_STATUS_ASSOC_DENIED_UNSPEC = 12,
  622. WLAN_STATUS_NOT_SUPPORTED_AUTH_ALG = 13,
  623. WLAN_STATUS_UNKNOWN_AUTH_TRANSACTION = 14,
  624. WLAN_STATUS_CHALLENGE_FAIL = 15,
  625. WLAN_STATUS_AUTH_TIMEOUT = 16,
  626. WLAN_STATUS_AP_UNABLE_TO_HANDLE_NEW_STA = 17,
  627. WLAN_STATUS_ASSOC_DENIED_RATES = 18,
  628. /* 802.11b */
  629. WLAN_STATUS_ASSOC_DENIED_NOSHORTPREAMBLE = 19,
  630. WLAN_STATUS_ASSOC_DENIED_NOPBCC = 20,
  631. WLAN_STATUS_ASSOC_DENIED_NOAGILITY = 21,
  632. /* 802.11h */
  633. WLAN_STATUS_ASSOC_DENIED_NOSPECTRUM = 22,
  634. WLAN_STATUS_ASSOC_REJECTED_BAD_POWER = 23,
  635. WLAN_STATUS_ASSOC_REJECTED_BAD_SUPP_CHAN = 24,
  636. /* 802.11g */
  637. WLAN_STATUS_ASSOC_DENIED_NOSHORTTIME = 25,
  638. WLAN_STATUS_ASSOC_DENIED_NODSSSOFDM = 26,
  639. /* 802.11i */
  640. WLAN_STATUS_INVALID_IE = 40,
  641. WLAN_STATUS_INVALID_GROUP_CIPHER = 41,
  642. WLAN_STATUS_INVALID_PAIRWISE_CIPHER = 42,
  643. WLAN_STATUS_INVALID_AKMP = 43,
  644. WLAN_STATUS_UNSUPP_RSN_VERSION = 44,
  645. WLAN_STATUS_INVALID_RSN_IE_CAP = 45,
  646. WLAN_STATUS_CIPHER_SUITE_REJECTED = 46,
  647. };
  648. /* Reason codes */
  649. enum ieee80211_reasoncode {
  650. WLAN_REASON_UNSPECIFIED = 1,
  651. WLAN_REASON_PREV_AUTH_NOT_VALID = 2,
  652. WLAN_REASON_DEAUTH_LEAVING = 3,
  653. WLAN_REASON_DISASSOC_DUE_TO_INACTIVITY = 4,
  654. WLAN_REASON_DISASSOC_AP_BUSY = 5,
  655. WLAN_REASON_CLASS2_FRAME_FROM_NONAUTH_STA = 6,
  656. WLAN_REASON_CLASS3_FRAME_FROM_NONASSOC_STA = 7,
  657. WLAN_REASON_DISASSOC_STA_HAS_LEFT = 8,
  658. WLAN_REASON_STA_REQ_ASSOC_WITHOUT_AUTH = 9,
  659. /* 802.11h */
  660. WLAN_REASON_DISASSOC_BAD_POWER = 10,
  661. WLAN_REASON_DISASSOC_BAD_SUPP_CHAN = 11,
  662. /* 802.11i */
  663. WLAN_REASON_INVALID_IE = 13,
  664. WLAN_REASON_MIC_FAILURE = 14,
  665. WLAN_REASON_4WAY_HANDSHAKE_TIMEOUT = 15,
  666. WLAN_REASON_GROUP_KEY_HANDSHAKE_TIMEOUT = 16,
  667. WLAN_REASON_IE_DIFFERENT = 17,
  668. WLAN_REASON_INVALID_GROUP_CIPHER = 18,
  669. WLAN_REASON_INVALID_PAIRWISE_CIPHER = 19,
  670. WLAN_REASON_INVALID_AKMP = 20,
  671. WLAN_REASON_UNSUPP_RSN_VERSION = 21,
  672. WLAN_REASON_INVALID_RSN_IE_CAP = 22,
  673. WLAN_REASON_IEEE8021X_FAILED = 23,
  674. WLAN_REASON_CIPHER_SUITE_REJECTED = 24,
  675. };
  676. #define IEEE80211_STATMASK_SIGNAL (1<<0)
  677. #define IEEE80211_STATMASK_RSSI (1<<1)
  678. #define IEEE80211_STATMASK_NOISE (1<<2)
  679. #define IEEE80211_STATMASK_RATE (1<<3)
  680. #define IEEE80211_STATMASK_WEMASK 0x7
  681. #define IEEE80211_CCK_MODULATION (1<<0)
  682. #define IEEE80211_OFDM_MODULATION (1<<1)
  683. #define IEEE80211_24GHZ_BAND (1<<0)
  684. #define IEEE80211_52GHZ_BAND (1<<1)
  685. #define IEEE80211_CCK_RATE_LEN 4
  686. #define IEEE80211_CCK_RATE_1MB 0x02
  687. #define IEEE80211_CCK_RATE_2MB 0x04
  688. #define IEEE80211_CCK_RATE_5MB 0x0B
  689. #define IEEE80211_CCK_RATE_11MB 0x16
  690. #define IEEE80211_OFDM_RATE_LEN 8
  691. #define IEEE80211_OFDM_RATE_6MB 0x0C
  692. #define IEEE80211_OFDM_RATE_9MB 0x12
  693. #define IEEE80211_OFDM_RATE_12MB 0x18
  694. #define IEEE80211_OFDM_RATE_18MB 0x24
  695. #define IEEE80211_OFDM_RATE_24MB 0x30
  696. #define IEEE80211_OFDM_RATE_36MB 0x48
  697. #define IEEE80211_OFDM_RATE_48MB 0x60
  698. #define IEEE80211_OFDM_RATE_54MB 0x6C
  699. #define IEEE80211_BASIC_RATE_MASK 0x80
  700. #define IEEE80211_CCK_RATE_1MB_MASK (1<<0)
  701. #define IEEE80211_CCK_RATE_2MB_MASK (1<<1)
  702. #define IEEE80211_CCK_RATE_5MB_MASK (1<<2)
  703. #define IEEE80211_CCK_RATE_11MB_MASK (1<<3)
  704. #define IEEE80211_OFDM_RATE_6MB_MASK (1<<4)
  705. #define IEEE80211_OFDM_RATE_9MB_MASK (1<<5)
  706. #define IEEE80211_OFDM_RATE_12MB_MASK (1<<6)
  707. #define IEEE80211_OFDM_RATE_18MB_MASK (1<<7)
  708. #define IEEE80211_OFDM_RATE_24MB_MASK (1<<8)
  709. #define IEEE80211_OFDM_RATE_36MB_MASK (1<<9)
  710. #define IEEE80211_OFDM_RATE_48MB_MASK (1<<10)
  711. #define IEEE80211_OFDM_RATE_54MB_MASK (1<<11)
  712. #define IEEE80211_CCK_RATES_MASK 0x0000000F
  713. #define IEEE80211_CCK_BASIC_RATES_MASK (IEEE80211_CCK_RATE_1MB_MASK | \
  714. IEEE80211_CCK_RATE_2MB_MASK)
  715. #define IEEE80211_CCK_DEFAULT_RATES_MASK (IEEE80211_CCK_BASIC_RATES_MASK | \
  716. IEEE80211_CCK_RATE_5MB_MASK | \
  717. IEEE80211_CCK_RATE_11MB_MASK)
  718. #define IEEE80211_OFDM_RATES_MASK 0x00000FF0
  719. #define IEEE80211_OFDM_BASIC_RATES_MASK (IEEE80211_OFDM_RATE_6MB_MASK | \
  720. IEEE80211_OFDM_RATE_12MB_MASK | \
  721. IEEE80211_OFDM_RATE_24MB_MASK)
  722. #define IEEE80211_OFDM_DEFAULT_RATES_MASK (IEEE80211_OFDM_BASIC_RATES_MASK | \
  723. IEEE80211_OFDM_RATE_9MB_MASK | \
  724. IEEE80211_OFDM_RATE_18MB_MASK | \
  725. IEEE80211_OFDM_RATE_36MB_MASK | \
  726. IEEE80211_OFDM_RATE_48MB_MASK | \
  727. IEEE80211_OFDM_RATE_54MB_MASK)
  728. #define IEEE80211_DEFAULT_RATES_MASK (IEEE80211_OFDM_DEFAULT_RATES_MASK | \
  729. IEEE80211_CCK_DEFAULT_RATES_MASK)
  730. #define IEEE80211_NUM_OFDM_RATES 8
  731. #define IEEE80211_NUM_CCK_RATES 4
  732. #define IEEE80211_OFDM_SHIFT_MASK_A 4
  733. /* this is stolen and modified from the madwifi driver*/
  734. #define IEEE80211_FC0_TYPE_MASK 0x0c
  735. #define IEEE80211_FC0_TYPE_DATA 0x08
  736. #define IEEE80211_FC0_SUBTYPE_MASK 0xB0
  737. #define IEEE80211_FC0_SUBTYPE_QOS 0x80
  738. #define IEEE80211_QOS_HAS_SEQ(fc) \
  739. (((fc) & (IEEE80211_FC0_TYPE_MASK | IEEE80211_FC0_SUBTYPE_MASK)) == \
  740. (IEEE80211_FC0_TYPE_DATA | IEEE80211_FC0_SUBTYPE_QOS))
  741. /* this is stolen from ipw2200 driver */
  742. #define IEEE_IBSS_MAC_HASH_SIZE 31
  743. struct ieee_ibss_seq {
  744. u8 mac[ETH_ALEN];
  745. u16 seq_num[17];
  746. u16 frag_num[17];
  747. unsigned long packet_time[17];
  748. struct list_head list;
  749. };
  750. /* NOTE: This data is for statistical purposes; not all hardware provides this
  751. * information for frames received. Not setting these will not cause
  752. * any adverse affects. */
  753. struct ieee80211_rx_stats {
  754. u32 mac_time[2];
  755. s8 rssi;
  756. u8 signal;
  757. u8 noise;
  758. u16 rate; /* in 100 kbps */
  759. u8 received_channel;
  760. u8 control;
  761. u8 mask;
  762. u8 freq;
  763. u16 len;
  764. u64 tsf;
  765. u32 beacon_time;
  766. u8 nic_type;
  767. u16 Length;
  768. // u8 DataRate; // In 0.5 Mbps
  769. u8 SignalQuality; // in 0-100 index.
  770. s32 RecvSignalPower; // Real power in dBm for this packet, no beautification and aggregation.
  771. s8 RxPower; // in dBm Translate from PWdB
  772. u8 SignalStrength; // in 0-100 index.
  773. u16 bHwError:1;
  774. u16 bCRC:1;
  775. u16 bICV:1;
  776. u16 bShortPreamble:1;
  777. u16 Antenna:1; //for rtl8185
  778. u16 Decrypted:1; //for rtl8185, rtl8187
  779. u16 Wakeup:1; //for rtl8185
  780. u16 Reserved0:1; //for rtl8185
  781. u8 AGC;
  782. u32 TimeStampLow;
  783. u32 TimeStampHigh;
  784. bool bShift;
  785. bool bIsQosData; // Added by Annie, 2005-12-22.
  786. u8 UserPriority;
  787. //1!!!!!!!!!!!!!!!!!!!!!!!!!!!
  788. //1Attention Please!!!<11n or 8190 specific code should be put below this line>
  789. //1!!!!!!!!!!!!!!!!!!!!!!!!!!!
  790. u8 RxDrvInfoSize;
  791. u8 RxBufShift;
  792. bool bIsAMPDU;
  793. bool bFirstMPDU;
  794. bool bContainHTC;
  795. bool RxIs40MHzPacket;
  796. u32 RxPWDBAll;
  797. u8 RxMIMOSignalStrength[4]; // in 0~100 index
  798. s8 RxMIMOSignalQuality[2];
  799. bool bPacketMatchBSSID;
  800. bool bIsCCK;
  801. bool bPacketToSelf;
  802. //added by amy
  803. u8* virtual_address;
  804. u16 packetlength; // Total packet length: Must equal to sum of all FragLength
  805. u16 fraglength; // FragLength should equal to PacketLength in non-fragment case
  806. u16 fragoffset; // Data offset for this fragment
  807. u16 ntotalfrag;
  808. bool bisrxaggrsubframe;
  809. bool bPacketBeacon; //cosa add for rssi
  810. bool bToSelfBA; //cosa add for rssi
  811. char cck_adc_pwdb[4]; //cosa add for rx path selection
  812. u16 Seq_Num;
  813. };
  814. /* IEEE 802.11 requires that STA supports concurrent reception of at least
  815. * three fragmented frames. This define can be increased to support more
  816. * concurrent frames, but it should be noted that each entry can consume about
  817. * 2 kB of RAM and increasing cache size will slow down frame reassembly. */
  818. #define IEEE80211_FRAG_CACHE_LEN 4
  819. struct ieee80211_frag_entry {
  820. unsigned long first_frag_time;
  821. unsigned int seq;
  822. unsigned int last_frag;
  823. struct sk_buff *skb;
  824. u8 src_addr[ETH_ALEN];
  825. u8 dst_addr[ETH_ALEN];
  826. };
  827. struct ieee80211_stats {
  828. unsigned int tx_unicast_frames;
  829. unsigned int tx_multicast_frames;
  830. unsigned int tx_fragments;
  831. unsigned int tx_unicast_octets;
  832. unsigned int tx_multicast_octets;
  833. unsigned int tx_deferred_transmissions;
  834. unsigned int tx_single_retry_frames;
  835. unsigned int tx_multiple_retry_frames;
  836. unsigned int tx_retry_limit_exceeded;
  837. unsigned int tx_discards;
  838. unsigned int rx_unicast_frames;
  839. unsigned int rx_multicast_frames;
  840. unsigned int rx_fragments;
  841. unsigned int rx_unicast_octets;
  842. unsigned int rx_multicast_octets;
  843. unsigned int rx_fcs_errors;
  844. unsigned int rx_discards_no_buffer;
  845. unsigned int tx_discards_wrong_sa;
  846. unsigned int rx_discards_undecryptable;
  847. unsigned int rx_message_in_msg_fragments;
  848. unsigned int rx_message_in_bad_msg_fragments;
  849. };
  850. struct ieee80211_device;
  851. #include "ieee80211_crypt.h"
  852. #define SEC_KEY_1 (1<<0)
  853. #define SEC_KEY_2 (1<<1)
  854. #define SEC_KEY_3 (1<<2)
  855. #define SEC_KEY_4 (1<<3)
  856. #define SEC_ACTIVE_KEY (1<<4)
  857. #define SEC_AUTH_MODE (1<<5)
  858. #define SEC_UNICAST_GROUP (1<<6)
  859. #define SEC_LEVEL (1<<7)
  860. #define SEC_ENABLED (1<<8)
  861. #define SEC_ENCRYPT (1<<9)
  862. #define SEC_LEVEL_0 0 /* None */
  863. #define SEC_LEVEL_1 1 /* WEP 40 and 104 bit */
  864. #define SEC_LEVEL_2 2 /* Level 1 + TKIP */
  865. #define SEC_LEVEL_2_CKIP 3 /* Level 1 + CKIP */
  866. #define SEC_LEVEL_3 4 /* Level 2 + CCMP */
  867. #define SEC_ALG_NONE 0
  868. #define SEC_ALG_WEP 1
  869. #define SEC_ALG_TKIP 2
  870. #define SEC_ALG_CCMP 3
  871. #define WEP_KEYS 4
  872. #define WEP_KEY_LEN 13
  873. #define SCM_KEY_LEN 32
  874. #define SCM_TEMPORAL_KEY_LENGTH 16
  875. struct ieee80211_security {
  876. u16 active_key:2,
  877. enabled:1,
  878. auth_mode:2,
  879. auth_algo:4,
  880. unicast_uses_group:1,
  881. encrypt:1;
  882. u8 key_sizes[WEP_KEYS];
  883. u8 keys[WEP_KEYS][SCM_KEY_LEN];
  884. u8 level;
  885. u16 flags;
  886. } __attribute__ ((packed));
  887. /*
  888. 802.11 data frame from AP
  889. ,-------------------------------------------------------------------.
  890. Bytes | 2 | 2 | 6 | 6 | 6 | 2 | 0..2312 | 4 |
  891. |------|------|---------|---------|---------|------|---------|------|
  892. Desc. | ctrl | dura | DA/RA | TA | SA | Sequ | frame | fcs |
  893. | | tion | (BSSID) | | | ence | data | |
  894. `-------------------------------------------------------------------'
  895. Total: 28-2340 bytes
  896. */
  897. /* Management Frame Information Element Types */
  898. enum ieee80211_mfie {
  899. MFIE_TYPE_SSID = 0,
  900. MFIE_TYPE_RATES = 1,
  901. MFIE_TYPE_FH_SET = 2,
  902. MFIE_TYPE_DS_SET = 3,
  903. MFIE_TYPE_CF_SET = 4,
  904. MFIE_TYPE_TIM = 5,
  905. MFIE_TYPE_IBSS_SET = 6,
  906. MFIE_TYPE_COUNTRY = 7,
  907. MFIE_TYPE_HOP_PARAMS = 8,
  908. MFIE_TYPE_HOP_TABLE = 9,
  909. MFIE_TYPE_REQUEST = 10,
  910. MFIE_TYPE_CHALLENGE = 16,
  911. MFIE_TYPE_POWER_CONSTRAINT = 32,
  912. MFIE_TYPE_POWER_CAPABILITY = 33,
  913. MFIE_TYPE_TPC_REQUEST = 34,
  914. MFIE_TYPE_TPC_REPORT = 35,
  915. MFIE_TYPE_SUPP_CHANNELS = 36,
  916. MFIE_TYPE_CSA = 37,
  917. MFIE_TYPE_MEASURE_REQUEST = 38,
  918. MFIE_TYPE_MEASURE_REPORT = 39,
  919. MFIE_TYPE_QUIET = 40,
  920. MFIE_TYPE_IBSS_DFS = 41,
  921. MFIE_TYPE_ERP = 42,
  922. MFIE_TYPE_RSN = 48,
  923. MFIE_TYPE_RATES_EX = 50,
  924. MFIE_TYPE_HT_CAP= 45,
  925. MFIE_TYPE_HT_INFO= 61,
  926. MFIE_TYPE_AIRONET=133,
  927. MFIE_TYPE_GENERIC = 221,
  928. MFIE_TYPE_QOS_PARAMETER = 222,
  929. };
  930. /* Minimal header; can be used for passing 802.11 frames with sufficient
  931. * information to determine what type of underlying data type is actually
  932. * stored in the data. */
  933. struct ieee80211_hdr {
  934. __le16 frame_ctl;
  935. __le16 duration_id;
  936. u8 payload[0];
  937. } __attribute__ ((packed));
  938. struct ieee80211_hdr_1addr {
  939. __le16 frame_ctl;
  940. __le16 duration_id;
  941. u8 addr1[ETH_ALEN];
  942. u8 payload[0];
  943. } __attribute__ ((packed));
  944. struct ieee80211_hdr_2addr {
  945. __le16 frame_ctl;
  946. __le16 duration_id;
  947. u8 addr1[ETH_ALEN];
  948. u8 addr2[ETH_ALEN];
  949. u8 payload[0];
  950. } __attribute__ ((packed));
  951. struct ieee80211_hdr_3addr {
  952. __le16 frame_ctl;
  953. __le16 duration_id;
  954. u8 addr1[ETH_ALEN];
  955. u8 addr2[ETH_ALEN];
  956. u8 addr3[ETH_ALEN];
  957. __le16 seq_ctl;
  958. u8 payload[0];
  959. } __attribute__ ((packed));
  960. struct ieee80211_hdr_4addr {
  961. __le16 frame_ctl;
  962. __le16 duration_id;
  963. u8 addr1[ETH_ALEN];
  964. u8 addr2[ETH_ALEN];
  965. u8 addr3[ETH_ALEN];
  966. __le16 seq_ctl;
  967. u8 addr4[ETH_ALEN];
  968. u8 payload[0];
  969. } __attribute__ ((packed));
  970. struct ieee80211_hdr_3addrqos {
  971. __le16 frame_ctl;
  972. __le16 duration_id;
  973. u8 addr1[ETH_ALEN];
  974. u8 addr2[ETH_ALEN];
  975. u8 addr3[ETH_ALEN];
  976. __le16 seq_ctl;
  977. u8 payload[0];
  978. __le16 qos_ctl;
  979. } __attribute__ ((packed));
  980. struct ieee80211_hdr_4addrqos {
  981. __le16 frame_ctl;
  982. __le16 duration_id;
  983. u8 addr1[ETH_ALEN];
  984. u8 addr2[ETH_ALEN];
  985. u8 addr3[ETH_ALEN];
  986. __le16 seq_ctl;
  987. u8 addr4[ETH_ALEN];
  988. u8 payload[0];
  989. __le16 qos_ctl;
  990. } __attribute__ ((packed));
  991. struct ieee80211_info_element {
  992. u8 id;
  993. u8 len;
  994. u8 data[0];
  995. } __attribute__ ((packed));
  996. struct ieee80211_authentication {
  997. struct ieee80211_hdr_3addr header;
  998. __le16 algorithm;
  999. __le16 transaction;
  1000. __le16 status;
  1001. /*challenge*/
  1002. struct ieee80211_info_element info_element[0];
  1003. } __attribute__ ((packed));
  1004. struct ieee80211_disassoc {
  1005. struct ieee80211_hdr_3addr header;
  1006. __le16 reason;
  1007. } __attribute__ ((packed));
  1008. struct ieee80211_probe_request {
  1009. struct ieee80211_hdr_3addr header;
  1010. /* SSID, supported rates */
  1011. struct ieee80211_info_element info_element[0];
  1012. } __attribute__ ((packed));
  1013. struct ieee80211_probe_response {
  1014. struct ieee80211_hdr_3addr header;
  1015. u32 time_stamp[2];
  1016. __le16 beacon_interval;
  1017. __le16 capability;
  1018. /* SSID, supported rates, FH params, DS params,
  1019. * CF params, IBSS params, TIM (if beacon), RSN */
  1020. struct ieee80211_info_element info_element[0];
  1021. } __attribute__ ((packed));
  1022. /* Alias beacon for probe_response */
  1023. #define ieee80211_beacon ieee80211_probe_response
  1024. struct ieee80211_assoc_request_frame {
  1025. struct ieee80211_hdr_3addr header;
  1026. __le16 capability;
  1027. __le16 listen_interval;
  1028. /* SSID, supported rates, RSN */
  1029. struct ieee80211_info_element info_element[0];
  1030. } __attribute__ ((packed));
  1031. struct ieee80211_reassoc_request_frame {
  1032. struct ieee80211_hdr_3addr header;
  1033. __le16 capability;
  1034. __le16 listen_interval;
  1035. u8 current_ap[ETH_ALEN];
  1036. /* SSID, supported rates, RSN */
  1037. struct ieee80211_info_element info_element[0];
  1038. } __attribute__ ((packed));
  1039. struct ieee80211_assoc_response_frame {
  1040. struct ieee80211_hdr_3addr header;
  1041. __le16 capability;
  1042. __le16 status;
  1043. __le16 aid;
  1044. struct ieee80211_info_element info_element[0]; /* supported rates */
  1045. } __attribute__ ((packed));
  1046. struct ieee80211_txb {
  1047. u8 nr_frags;
  1048. u8 encrypted;
  1049. u8 queue_index;
  1050. u8 rts_included;
  1051. u16 reserved;
  1052. __le16 frag_size;
  1053. __le16 payload_size;
  1054. struct sk_buff *fragments[0];
  1055. };
  1056. #define MAX_TX_AGG_COUNT 16
  1057. struct ieee80211_drv_agg_txb {
  1058. u8 nr_drv_agg_frames;
  1059. struct sk_buff *tx_agg_frames[MAX_TX_AGG_COUNT];
  1060. }__attribute__((packed));
  1061. #define MAX_SUBFRAME_COUNT 64
  1062. struct ieee80211_rxb {
  1063. u8 nr_subframes;
  1064. struct sk_buff *subframes[MAX_SUBFRAME_COUNT];
  1065. u8 dst[ETH_ALEN];
  1066. u8 src[ETH_ALEN];
  1067. }__attribute__((packed));
  1068. typedef union _frameqos {
  1069. u16 shortdata;
  1070. u8 chardata[2];
  1071. struct {
  1072. u16 tid:4;
  1073. u16 eosp:1;
  1074. u16 ack_policy:2;
  1075. u16 reserved:1;
  1076. u16 txop:8;
  1077. }field;
  1078. }frameqos,*pframeqos;
  1079. /* SWEEP TABLE ENTRIES NUMBER*/
  1080. #define MAX_SWEEP_TAB_ENTRIES 42
  1081. #define MAX_SWEEP_TAB_ENTRIES_PER_PACKET 7
  1082. /* MAX_RATES_LENGTH needs to be 12. The spec says 8, and many APs
  1083. * only use 8, and then use extended rates for the remaining supported
  1084. * rates. Other APs, however, stick all of their supported rates on the
  1085. * main rates information element... */
  1086. #define MAX_RATES_LENGTH ((u8)12)
  1087. #define MAX_RATES_EX_LENGTH ((u8)16)
  1088. #define MAX_NETWORK_COUNT 128
  1089. #define MAX_CHANNEL_NUMBER 161
  1090. #define IEEE80211_SOFTMAC_SCAN_TIME 100
  1091. //(HZ / 2)
  1092. #define IEEE80211_SOFTMAC_ASSOC_RETRY_TIME (HZ * 2)
  1093. #define CRC_LENGTH 4U
  1094. #define MAX_WPA_IE_LEN 64
  1095. #define NETWORK_EMPTY_ESSID (1<<0)
  1096. #define NETWORK_HAS_OFDM (1<<1)
  1097. #define NETWORK_HAS_CCK (1<<2)
  1098. /* QoS structure */
  1099. #define NETWORK_HAS_QOS_PARAMETERS (1<<3)
  1100. #define NETWORK_HAS_QOS_INFORMATION (1<<4)
  1101. #define NETWORK_HAS_QOS_MASK (NETWORK_HAS_QOS_PARAMETERS | \
  1102. NETWORK_HAS_QOS_INFORMATION)
  1103. /* 802.11h */
  1104. #define NETWORK_HAS_POWER_CONSTRAINT (1<<5)
  1105. #define NETWORK_HAS_CSA (1<<6)
  1106. #define NETWORK_HAS_QUIET (1<<7)
  1107. #define NETWORK_HAS_IBSS_DFS (1<<8)
  1108. #define NETWORK_HAS_TPC_REPORT (1<<9)
  1109. #define NETWORK_HAS_ERP_VALUE (1<<10)
  1110. #define QOS_QUEUE_NUM 4
  1111. #define QOS_OUI_LEN 3
  1112. #define QOS_OUI_TYPE 2
  1113. #define QOS_ELEMENT_ID 221
  1114. #define QOS_OUI_INFO_SUB_TYPE 0
  1115. #define QOS_OUI_PARAM_SUB_TYPE 1
  1116. #define QOS_VERSION_1 1
  1117. #define QOS_AIFSN_MIN_VALUE 2
  1118. struct ieee80211_qos_information_element {
  1119. u8 elementID;
  1120. u8 length;
  1121. u8 qui[QOS_OUI_LEN];
  1122. u8 qui_type;
  1123. u8 qui_subtype;
  1124. u8 version;
  1125. u8 ac_info;
  1126. } __attribute__ ((packed));
  1127. struct ieee80211_qos_ac_parameter {
  1128. u8 aci_aifsn;
  1129. u8 ecw_min_max;
  1130. __le16 tx_op_limit;
  1131. } __attribute__ ((packed));
  1132. struct ieee80211_qos_parameter_info {
  1133. struct ieee80211_qos_information_element info_element;
  1134. u8 reserved;
  1135. struct ieee80211_qos_ac_parameter ac_params_record[QOS_QUEUE_NUM];
  1136. } __attribute__ ((packed));
  1137. struct ieee80211_qos_parameters {
  1138. __le16 cw_min[QOS_QUEUE_NUM];
  1139. __le16 cw_max[QOS_QUEUE_NUM];
  1140. u8 aifs[QOS_QUEUE_NUM];
  1141. u8 flag[QOS_QUEUE_NUM];
  1142. __le16 tx_op_limit[QOS_QUEUE_NUM];
  1143. } __attribute__ ((packed));
  1144. struct ieee80211_qos_data {
  1145. struct ieee80211_qos_parameters parameters;
  1146. int active;
  1147. int supported;
  1148. u8 param_count;
  1149. u8 old_param_count;
  1150. };
  1151. struct ieee80211_tim_parameters {
  1152. u8 tim_count;
  1153. u8 tim_period;
  1154. } __attribute__ ((packed));
  1155. //#else
  1156. struct ieee80211_wmm_ac_param {
  1157. u8 ac_aci_acm_aifsn;
  1158. u8 ac_ecwmin_ecwmax;
  1159. u16 ac_txop_limit;
  1160. };
  1161. struct ieee80211_wmm_ts_info {
  1162. u8 ac_dir_tid;
  1163. u8 ac_up_psb;
  1164. u8 reserved;
  1165. } __attribute__ ((packed));
  1166. struct ieee80211_wmm_tspec_elem {
  1167. struct ieee80211_wmm_ts_info ts_info;
  1168. u16 norm_msdu_size;
  1169. u16 max_msdu_size;
  1170. u32 min_serv_inter;
  1171. u32 max_serv_inter;
  1172. u32 inact_inter;
  1173. u32 suspen_inter;
  1174. u32 serv_start_time;
  1175. u32 min_data_rate;
  1176. u32 mean_data_rate;
  1177. u32 peak_data_rate;
  1178. u32 max_burst_size;
  1179. u32 delay_bound;
  1180. u32 min_phy_rate;
  1181. u16 surp_band_allow;
  1182. u16 medium_time;
  1183. }__attribute__((packed));
  1184. enum eap_type {
  1185. EAP_PACKET = 0,
  1186. EAPOL_START,
  1187. EAPOL_LOGOFF,
  1188. EAPOL_KEY,
  1189. EAPOL_ENCAP_ASF_ALERT
  1190. };
  1191. static const char *eap_types[] = {
  1192. [EAP_PACKET] = "EAP-Packet",
  1193. [EAPOL_START] = "EAPOL-Start",
  1194. [EAPOL_LOGOFF] = "EAPOL-Logoff",
  1195. [EAPOL_KEY] = "EAPOL-Key",
  1196. [EAPOL_ENCAP_ASF_ALERT] = "EAPOL-Encap-ASF-Alert"
  1197. };
  1198. static inline const char *eap_get_type(int type)
  1199. {
  1200. return ((u32)type >= ARRAY_SIZE(eap_types)) ? "Unknown" : eap_types[type];
  1201. }
  1202. //added by amy for reorder
  1203. static inline u8 Frame_QoSTID(u8* buf)
  1204. {
  1205. struct ieee80211_hdr_3addr *hdr;
  1206. u16 fc;
  1207. hdr = (struct ieee80211_hdr_3addr *)buf;
  1208. fc = le16_to_cpu(hdr->frame_ctl);
  1209. return (u8)((frameqos*)(buf + (((fc & IEEE80211_FCTL_TODS)&&(fc & IEEE80211_FCTL_FROMDS))? 30 : 24)))->field.tid;
  1210. }
  1211. //added by amy for reorder
  1212. struct eapol {
  1213. u8 snap[6];
  1214. u16 ethertype;
  1215. u8 version;
  1216. u8 type;
  1217. u16 length;
  1218. } __attribute__ ((packed));
  1219. struct ieee80211_softmac_stats{
  1220. unsigned int rx_ass_ok;
  1221. unsigned int rx_ass_err;
  1222. unsigned int rx_probe_rq;
  1223. unsigned int tx_probe_rs;
  1224. unsigned int tx_beacons;
  1225. unsigned int rx_auth_rq;
  1226. unsigned int rx_auth_rs_ok;
  1227. unsigned int rx_auth_rs_err;
  1228. unsigned int tx_auth_rq;
  1229. unsigned int no_auth_rs;
  1230. unsigned int no_ass_rs;
  1231. unsigned int tx_ass_rq;
  1232. unsigned int rx_ass_rq;
  1233. unsigned int tx_probe_rq;
  1234. unsigned int reassoc;
  1235. unsigned int swtxstop;
  1236. unsigned int swtxawake;
  1237. unsigned char CurrentShowTxate;
  1238. unsigned char last_packet_rate;
  1239. unsigned int txretrycount;
  1240. };
  1241. #define BEACON_PROBE_SSID_ID_POSITION 12
  1242. struct ieee80211_info_element_hdr {
  1243. u8 id;
  1244. u8 len;
  1245. } __attribute__ ((packed));
  1246. /*
  1247. * These are the data types that can make up management packets
  1248. *
  1249. u16 auth_algorithm;
  1250. u16 auth_sequence;
  1251. u16 beacon_interval;
  1252. u16 capability;
  1253. u8 current_ap[ETH_ALEN];
  1254. u16 listen_interval;
  1255. struct {
  1256. u16 association_id:14, reserved:2;
  1257. } __attribute__ ((packed));
  1258. u32 time_stamp[2];
  1259. u16 reason;
  1260. u16 status;
  1261. */
  1262. #define IEEE80211_DEFAULT_TX_ESSID "Penguin"
  1263. #define IEEE80211_DEFAULT_BASIC_RATE 2 //1Mbps
  1264. enum {WMM_all_frame, WMM_two_frame, WMM_four_frame, WMM_six_frame};
  1265. #define MAX_SP_Len (WMM_all_frame << 4)
  1266. #define IEEE80211_QOS_TID 0x0f
  1267. #define QOS_CTL_NOTCONTAIN_ACK (0x01 << 5)
  1268. #define IEEE80211_DTIM_MBCAST 4
  1269. #define IEEE80211_DTIM_UCAST 2
  1270. #define IEEE80211_DTIM_VALID 1
  1271. #define IEEE80211_DTIM_INVALID 0
  1272. #define IEEE80211_PS_DISABLED 0
  1273. #define IEEE80211_PS_UNICAST IEEE80211_DTIM_UCAST
  1274. #define IEEE80211_PS_MBCAST IEEE80211_DTIM_MBCAST
  1275. //added by David for QoS 2006/6/30
  1276. //#define WMM_Hang_8187
  1277. #ifdef WMM_Hang_8187
  1278. #undef WMM_Hang_8187
  1279. #endif
  1280. #define WME_AC_BK 0x00
  1281. #define WME_AC_BE 0x01
  1282. #define WME_AC_VI 0x02
  1283. #define WME_AC_VO 0x03
  1284. #define WME_ACI_MASK 0x03
  1285. #define WME_AIFSN_MASK 0x03
  1286. #define WME_AC_PRAM_LEN 16
  1287. #define MAX_RECEIVE_BUFFER_SIZE 9100
  1288. //UP Mapping to AC, using in MgntQuery_SequenceNumber() and maybe for DSCP
  1289. //#define UP2AC(up) ((up<3) ? ((up==0)?1:0) : (up>>1))
  1290. #define UP2AC(up) ( \
  1291. ((up) < 1) ? WME_AC_BE : \
  1292. ((up) < 3) ? WME_AC_BK : \
  1293. ((up) < 4) ? WME_AC_BE : \
  1294. ((up) < 6) ? WME_AC_VI : \
  1295. WME_AC_VO)
  1296. //AC Mapping to UP, using in Tx part for selecting the corresponding TX queue
  1297. #define AC2UP(_ac) ( \
  1298. ((_ac) == WME_AC_VO) ? 6 : \
  1299. ((_ac) == WME_AC_VI) ? 5 : \
  1300. ((_ac) == WME_AC_BK) ? 1 : \
  1301. 0)
  1302. #define ETHER_ADDR_LEN 6 /* length of an Ethernet address */
  1303. #define ETHERNET_HEADER_SIZE 14 /* length of two Ethernet address plus ether type*/
  1304. struct ether_header {
  1305. u8 ether_dhost[ETHER_ADDR_LEN];
  1306. u8 ether_shost[ETHER_ADDR_LEN];
  1307. u16 ether_type;
  1308. } __attribute__((packed));
  1309. #ifndef ETHERTYPE_PAE
  1310. #define ETHERTYPE_PAE 0x888e /* EAPOL PAE/802.1x */
  1311. #endif
  1312. #ifndef ETHERTYPE_IP
  1313. #define ETHERTYPE_IP 0x0800 /* IP protocol */
  1314. #endif
  1315. typedef struct _bss_ht{
  1316. bool support_ht;
  1317. // HT related elements
  1318. u8 ht_cap_buf[32];
  1319. u16 ht_cap_len;
  1320. u8 ht_info_buf[32];
  1321. u16 ht_info_len;
  1322. HT_SPEC_VER ht_spec_ver;
  1323. //HT_CAPABILITY_ELE bdHTCapEle;
  1324. //HT_INFORMATION_ELE bdHTInfoEle;
  1325. bool aggregation;
  1326. bool long_slot_time;
  1327. }bss_ht, *pbss_ht;
  1328. typedef enum _erp_t{
  1329. ERP_NonERPpresent = 0x01,
  1330. ERP_UseProtection = 0x02,
  1331. ERP_BarkerPreambleMode = 0x04,
  1332. } erp_t;
  1333. struct ieee80211_network {
  1334. /* These entries are used to identify a unique network */
  1335. u8 bssid[ETH_ALEN];
  1336. u8 channel;
  1337. /* Ensure null-terminated for any debug msgs */
  1338. u8 ssid[IW_ESSID_MAX_SIZE + 1];
  1339. u8 ssid_len;
  1340. struct ieee80211_qos_data qos_data;
  1341. //added by amy for LEAP
  1342. bool bWithAironetIE;
  1343. bool bCkipSupported;
  1344. bool bCcxRmEnable;
  1345. u16 CcxRmState[2];
  1346. // CCXv4 S59, MBSSID.
  1347. bool bMBssidValid;
  1348. u8 MBssidMask;
  1349. u8 MBssid[6];
  1350. // CCX 2 S38, WLAN Device Version Number element. Annie, 2006-08-20.
  1351. bool bWithCcxVerNum;
  1352. u8 BssCcxVerNumber;
  1353. /* These are network statistics */
  1354. struct ieee80211_rx_stats stats;
  1355. u16 capability;
  1356. u8 rates[MAX_RATES_LENGTH];
  1357. u8 rates_len;
  1358. u8 rates_ex[MAX_RATES_EX_LENGTH];
  1359. u8 rates_ex_len;
  1360. unsigned long last_scanned;
  1361. u8 mode;
  1362. u32 flags;
  1363. u32 last_associate;
  1364. u32 time_stamp[2];
  1365. u16 beacon_interval;
  1366. u16 listen_interval;
  1367. u16 atim_window;
  1368. u8 erp_value;
  1369. u8 wpa_ie[MAX_WPA_IE_LEN];
  1370. size_t wpa_ie_len;
  1371. u8 rsn_ie[MAX_WPA_IE_LEN];
  1372. size_t rsn_ie_len;
  1373. struct ieee80211_tim_parameters tim;
  1374. u8 dtim_period;
  1375. u8 dtim_data;
  1376. u32 last_dtim_sta_time[2];
  1377. //appeded for QoS
  1378. u8 wmm_info;
  1379. struct ieee80211_wmm_ac_param wmm_param[4];
  1380. u8 QoS_Enable;
  1381. #ifdef THOMAS_TURBO
  1382. u8 Turbo_Enable;//enable turbo mode, added by thomas
  1383. #endif
  1384. u16 CountryIeLen;
  1385. u8 CountryIeBuf[MAX_IE_LEN];
  1386. // HT Related, by amy, 2008.04.29
  1387. BSS_HT bssht;
  1388. // Add to handle broadcom AP management frame CCK rate.
  1389. bool broadcom_cap_exist;
  1390. bool ralink_cap_exist;
  1391. bool atheros_cap_exist;
  1392. bool cisco_cap_exist;
  1393. bool unknown_cap_exist;
  1394. // u8 berp_info;
  1395. bool berp_info_valid;
  1396. bool buseprotection;
  1397. //put at the end of the structure.
  1398. struct list_head list;
  1399. };
  1400. enum ieee80211_state {
  1401. /* the card is not linked at all */
  1402. IEEE80211_NOLINK = 0,
  1403. /* IEEE80211_ASSOCIATING* are for BSS client mode
  1404. * the driver shall not perform RX filtering unless
  1405. * the state is LINKED.
  1406. * The driver shall just check for the state LINKED and
  1407. * defaults to NOLINK for ALL the other states (including
  1408. * LINKED_SCANNING)
  1409. */
  1410. /* the association procedure will start (wq scheduling)*/
  1411. IEEE80211_ASSOCIATING,
  1412. IEEE80211_ASSOCIATING_RETRY,
  1413. /* the association procedure is sending AUTH request*/
  1414. IEEE80211_ASSOCIATING_AUTHENTICATING,
  1415. /* the association procedure has successfully authentcated
  1416. * and is sending association request
  1417. */
  1418. IEEE80211_ASSOCIATING_AUTHENTICATED,
  1419. /* the link is ok. the card associated to a BSS or linked
  1420. * to a ibss cell or acting as an AP and creating the bss
  1421. */
  1422. IEEE80211_LINKED,
  1423. /* same as LINKED, but the driver shall apply RX filter
  1424. * rules as we are in NO_LINK mode. As the card is still
  1425. * logically linked, but it is doing a syncro site survey
  1426. * then it will be back to LINKED state.
  1427. */
  1428. IEEE80211_LINKED_SCANNING,
  1429. };
  1430. #define DEFAULT_MAX_SCAN_AGE (15 * HZ)
  1431. #define DEFAULT_FTS 2346
  1432. #define CFG_IEEE80211_RESERVE_FCS (1<<0)
  1433. #define CFG_IEEE80211_COMPUTE_FCS (1<<1)
  1434. #define CFG_IEEE80211_RTS (1<<2)
  1435. #define IEEE80211_24GHZ_MIN_CHANNEL 1
  1436. #define IEEE80211_24GHZ_MAX_CHANNEL 14
  1437. #define IEEE80211_24GHZ_CHANNELS (IEEE80211_24GHZ_MAX_CHANNEL - \
  1438. IEEE80211_24GHZ_MIN_CHANNEL + 1)
  1439. #define IEEE80211_52GHZ_MIN_CHANNEL 34
  1440. #define IEEE80211_52GHZ_MAX_CHANNEL 165
  1441. #define IEEE80211_52GHZ_CHANNELS (IEEE80211_52GHZ_MAX_CHANNEL - \
  1442. IEEE80211_52GHZ_MIN_CHANNEL + 1)
  1443. typedef struct tx_pending_t{
  1444. int frag;
  1445. struct ieee80211_txb *txb;
  1446. }tx_pending_t;
  1447. typedef struct _bandwidth_autoswitch
  1448. {
  1449. long threshold_20Mhzto40Mhz;
  1450. long threshold_40Mhzto20Mhz;
  1451. bool bforced_tx20Mhz;
  1452. bool bautoswitch_enable;
  1453. }bandwidth_autoswitch,*pbandwidth_autoswitch;
  1454. //added by amy for order
  1455. #define REORDER_WIN_SIZE 128
  1456. #define REORDER_ENTRY_NUM 128
  1457. typedef struct _RX_REORDER_ENTRY
  1458. {
  1459. struct list_head List;
  1460. u16 SeqNum;
  1461. struct ieee80211_rxb* prxb;
  1462. } RX_REORDER_ENTRY, *PRX_REORDER_ENTRY;
  1463. //added by amy for order
  1464. typedef enum _Fsync_State{
  1465. Default_Fsync,
  1466. HW_Fsync,
  1467. SW_Fsync
  1468. }Fsync_State;
  1469. // Power save mode configured.
  1470. typedef enum _RT_PS_MODE
  1471. {
  1472. eActive, // Active/Continuous access.
  1473. eMaxPs, // Max power save mode.
  1474. eFastPs // Fast power save mode.
  1475. }RT_PS_MODE;
  1476. typedef enum _IPS_CALLBACK_FUNCION
  1477. {
  1478. IPS_CALLBACK_NONE = 0,
  1479. IPS_CALLBACK_MGNT_LINK_REQUEST = 1,
  1480. IPS_CALLBACK_JOIN_REQUEST = 2,
  1481. }IPS_CALLBACK_FUNCION;
  1482. typedef enum _RT_JOIN_ACTION{
  1483. RT_JOIN_INFRA = 1,
  1484. RT_JOIN_IBSS = 2,
  1485. RT_START_IBSS = 3,
  1486. RT_NO_ACTION = 4,
  1487. }RT_JOIN_ACTION;
  1488. typedef struct _IbssParms{
  1489. u16 atimWin;
  1490. }IbssParms, *PIbssParms;
  1491. #define MAX_NUM_RATES 264 // Max num of support rates element: 8, Max num of ext. support rate: 255. 061122, by rcnjko.
  1492. // RF state.
  1493. typedef enum _RT_RF_POWER_STATE
  1494. {
  1495. eRfOn,
  1496. eRfSleep,
  1497. eRfOff
  1498. }RT_RF_POWER_STATE;
  1499. typedef struct _RT_POWER_SAVE_CONTROL
  1500. {
  1501. //
  1502. // Inactive Power Save(IPS) : Disable RF when disconnected
  1503. //
  1504. bool bInactivePs;
  1505. bool bIPSModeBackup;
  1506. bool bSwRfProcessing;
  1507. RT_RF_POWER_STATE eInactivePowerState;
  1508. struct work_struct InactivePsWorkItem;
  1509. struct timer_list InactivePsTimer;
  1510. // Return point for join action
  1511. IPS_CALLBACK_FUNCION ReturnPoint;
  1512. // Recored Parameters for rescheduled JoinRequest
  1513. bool bTmpBssDesc;
  1514. RT_JOIN_ACTION tmpJoinAction;
  1515. struct ieee80211_network tmpBssDesc;
  1516. // Recored Parameters for rescheduled MgntLinkRequest
  1517. bool bTmpScanOnly;
  1518. bool bTmpActiveScan;
  1519. bool bTmpFilterHiddenAP;
  1520. bool bTmpUpdateParms;
  1521. u8 tmpSsidBuf[33];
  1522. OCTET_STRING tmpSsid2Scan;
  1523. bool bTmpSsid2Scan;
  1524. u8 tmpNetworkType;
  1525. u8 tmpChannelNumber;
  1526. u16 tmpBcnPeriod;
  1527. u8 tmpDtimPeriod;
  1528. u16 tmpmCap;
  1529. OCTET_STRING tmpSuppRateSet;
  1530. u8 tmpSuppRateBuf[MAX_NUM_RATES];
  1531. bool bTmpSuppRate;
  1532. IbssParms tmpIbpm;
  1533. bool bTmpIbpm;
  1534. //
  1535. // Leisre Poswer Save : Disable RF if connected but traffic is not busy
  1536. //
  1537. bool bLeisurePs;
  1538. }RT_POWER_SAVE_CONTROL,*PRT_POWER_SAVE_CONTROL;
  1539. typedef u32 RT_RF_CHANGE_SOURCE;
  1540. #define RF_CHANGE_BY_SW BIT31
  1541. #define RF_CHANGE_BY_HW BIT30
  1542. #define RF_CHANGE_BY_PS BIT29
  1543. #define RF_CHANGE_BY_IPS BIT28
  1544. #define RF_CHANGE_BY_INIT 0 // Do not change the RFOff reason. Defined by Bruce, 2008-01-17.
  1545. typedef enum
  1546. {
  1547. COUNTRY_CODE_FCC = 0,
  1548. COUNTRY_CODE_IC = 1,
  1549. COUNTRY_CODE_ETSI = 2,
  1550. COUNTRY_CODE_SPAIN = 3,
  1551. COUNTRY_CODE_FRANCE = 4,
  1552. COUNTRY_CODE_MKK = 5,
  1553. COUNTRY_CODE_MKK1 = 6,
  1554. COUNTRY_CODE_ISRAEL = 7,
  1555. COUNTRY_CODE_TELEC,
  1556. COUNTRY_CODE_MIC,
  1557. COUNTRY_CODE_GLOBAL_DOMAIN
  1558. }country_code_type_t;
  1559. #define RT_MAX_LD_SLOT_NUM 10
  1560. typedef struct _RT_LINK_DETECT_T{
  1561. u32 NumRecvBcnInPeriod;
  1562. u32 NumRecvDataInPeriod;
  1563. u32 RxBcnNum[RT_MAX_LD_SLOT_NUM]; // number of Rx beacon / CheckForHang_period to determine link status
  1564. u32 RxDataNum[RT_MAX_LD_SLOT_NUM]; // number of Rx data / CheckForHang_period to determine link status
  1565. u16 SlotNum; // number of CheckForHang period to determine link status
  1566. u16 SlotIndex;
  1567. u32 NumTxOkInPeriod;
  1568. u32 NumRxOkInPeriod;
  1569. bool bBusyTraffic;
  1570. }RT_LINK_DETECT_T, *PRT_LINK_DETECT_T;
  1571. struct ieee80211_device {
  1572. struct net_device *dev;
  1573. struct ieee80211_security sec;
  1574. //hw security related
  1575. // u8 hwsec_support; //support?
  1576. u8 hwsec_active; //hw security active.
  1577. bool is_silent_reset;
  1578. bool ieee_up;
  1579. //added by amy
  1580. bool bSupportRemoteWakeUp;
  1581. RT_PS_MODE dot11PowerSaveMode; // Power save mode configured.
  1582. bool actscanning;
  1583. bool beinretry;
  1584. RT_RF_POWER_STATE eRFPowerState;
  1585. RT_RF_CHANGE_SOURCE RfOffReason;
  1586. bool is_set_key;
  1587. //11n spec related I wonder if These info structure need to be moved out of ieee80211_device
  1588. //11n HT below
  1589. PRT_HIGH_THROUGHPUT pHTInfo;
  1590. //struct timer_list SwBwTimer;
  1591. // spinlock_t chnlop_spinlock;
  1592. spinlock_t bw_spinlock;
  1593. spinlock_t reorder_spinlock;
  1594. // for HT operation rate set. we use this one for HT data rate to separate different descriptors
  1595. //the way fill this is the same as in the IE
  1596. u8 Regdot11HTOperationalRateSet[16]; //use RATR format
  1597. u8 dot11HTOperationalRateSet[16]; //use RATR format
  1598. u8 RegHTSuppRateSet[16];
  1599. u8 HTCurrentOperaRate;
  1600. u8 HTHighestOperaRate;
  1601. //wb added for rate operation mode to firmware
  1602. u8 bTxDisableRateFallBack;
  1603. u8 bTxUseDriverAssingedRate;
  1604. atomic_t atm_chnlop;
  1605. atomic_t atm_swbw;
  1606. // u8 HTHighestOperaRate;
  1607. // u8 HTCurrentOperaRate;
  1608. // 802.11e and WMM Traffic Stream Info (TX)
  1609. struct list_head Tx_TS_Admit_List;
  1610. struct list_head Tx_TS_Pending_List;
  1611. struct list_head Tx_TS_Unused_List;
  1612. TX_TS_RECORD TxTsRecord[TOTAL_TS_NUM];
  1613. // 802.11e and WMM Traffic Stream Info (RX)
  1614. struct list_head Rx_TS_Admit_List;
  1615. struct list_head Rx_TS_Pending_List;
  1616. struct list_head Rx_TS_Unused_List;
  1617. RX_TS_RECORD RxTsRecord[TOTAL_TS_NUM];
  1618. //#ifdef TO_DO_LIST
  1619. RX_REORDER_ENTRY RxReorderEntry[128];
  1620. struct list_head RxReorder_Unused_List;
  1621. //#endif
  1622. // Qos related. Added by Annie, 2005-11-01.
  1623. // PSTA_QOS pStaQos;
  1624. u8 ForcedPriority; // Force per-packet priority 1~7. (default: 0, not to force it.)
  1625. /* Bookkeeping structures */
  1626. struct net_device_stats stats;
  1627. struct ieee80211_stats ieee_stats;
  1628. struct ieee80211_softmac_stats softmac_stats;
  1629. /* Probe / Beacon management */
  1630. struct list_head network_free_list;
  1631. struct list_head network_list;
  1632. struct ieee80211_network *networks;
  1633. int scans;
  1634. int scan_age;
  1635. int iw_mode; /* operating mode (IW_MODE_*) */
  1636. struct iw_spy_data spy_data;
  1637. spinlock_t lock;
  1638. spinlock_t wpax_suitlist_lock;
  1639. int tx_headroom; /* Set to size of any additional room needed at front
  1640. * of allocated Tx SKBs */
  1641. u32 config;
  1642. /* WEP and other encryption related settings at the device level */
  1643. int open_wep; /* Set to 1 to allow unencrypted frames */
  1644. int auth_mode;
  1645. int reset_on_keychange; /* Set to 1 if the HW needs to be reset on
  1646. * WEP key changes */
  1647. /* If the host performs {en,de}cryption, then set to 1 */
  1648. int host_encrypt;
  1649. int host_encrypt_msdu;
  1650. int host_decrypt;
  1651. /* host performs multicast decryption */
  1652. int host_mc_decrypt;
  1653. /* host should strip IV and ICV from protected frames */
  1654. /* meaningful only when hardware decryption is being used */
  1655. int host_strip_iv_icv;
  1656. int host_open_frag;
  1657. int host_build_iv;
  1658. int ieee802_1x; /* is IEEE 802.1X used */
  1659. /* WPA data */
  1660. bool bHalfWirelessN24GMode;
  1661. int wpa_enabled;
  1662. int drop_unencrypted;
  1663. int tkip_countermeasures;
  1664. int privacy_invoked;
  1665. size_t wpa_ie_len;
  1666. u8 *wpa_ie;
  1667. u8 ap_mac_addr[6];
  1668. u16 pairwise_key_type;
  1669. u16 group_key_type;
  1670. struct list_head crypt_deinit_list;
  1671. struct ieee80211_crypt_data *crypt[WEP_KEYS];
  1672. int tx_keyidx; /* default TX key index (crypt[tx_keyidx]) */
  1673. struct timer_list crypt_deinit_timer;
  1674. int crypt_quiesced;
  1675. int bcrx_sta_key; /* use individual keys to override default keys even
  1676. * with RX of broad/multicast frames */
  1677. /* Fragmentation structures */
  1678. // each streaming contain a entry
  1679. struct ieee80211_frag_entry frag_cache[17][IEEE80211_FRAG_CACHE_LEN];
  1680. unsigned int frag_next_idx[17];
  1681. u16 fts; /* Fragmentation Threshold */
  1682. #define DEFAULT_RTS_THRESHOLD 2346U
  1683. #define MIN_RTS_THRESHOLD 1
  1684. #define MAX_RTS_THRESHOLD 2346U
  1685. u16 rts; /* RTS threshold */
  1686. /* Association info */
  1687. u8 bssid[ETH_ALEN];
  1688. /* This stores infos for the current network.
  1689. * Either the network we are associated in INFRASTRUCTURE
  1690. * or the network that we are creating in MASTER mode.
  1691. * ad-hoc is a mixture ;-).
  1692. * Note that in infrastructure mode, even when not associated,
  1693. * fields bssid and essid may be valid (if wpa_set and essid_set
  1694. * are true) as thy carry the value set by the user via iwconfig
  1695. */
  1696. struct ieee80211_network current_network;
  1697. enum ieee80211_state state;
  1698. int short_slot;
  1699. int reg_mode;
  1700. int mode; /* A, B, G */
  1701. int modulation; /* CCK, OFDM */
  1702. int freq_band; /* 2.4Ghz, 5.2Ghz, Mixed */
  1703. int abg_true; /* ABG flag */
  1704. /* used for forcing the ibss workqueue to terminate
  1705. * without wait for the syncro scan to terminate
  1706. */
  1707. short sync_scan_hurryup;
  1708. int perfect_rssi;
  1709. int worst_rssi;
  1710. u16 prev_seq_ctl; /* used to drop duplicate frames */
  1711. /* map of allowed channels. 0 is dummy */
  1712. // FIXME: remember to default to a basic channel plan depending of the PHY type
  1713. void* pDot11dInfo;
  1714. bool bGlobalDomain;
  1715. int rate; /* current rate */
  1716. int basic_rate;
  1717. //FIXME: pleace callback, see if redundant with softmac_features
  1718. short active_scan;
  1719. /* this contains flags for selectively enable softmac support */
  1720. u16 softmac_features;
  1721. /* if the sequence control field is not filled by HW */
  1722. u16 seq_ctrl[5];
  1723. /* association procedure transaction sequence number */
  1724. u16 associate_seq;
  1725. /* AID for RTXed association responses */
  1726. u16 assoc_id;
  1727. /* power save mode related*/
  1728. short ps;
  1729. short sta_sleep;
  1730. int ps_timeout;
  1731. int ps_period;
  1732. struct tasklet_struct ps_task;
  1733. u32 ps_th;
  1734. u32 ps_tl;
  1735. short raw_tx;
  1736. /* used if IEEE_SOFTMAC_TX_QUEUE is set */
  1737. short queue_stop;
  1738. short scanning;
  1739. short proto_started;
  1740. struct semaphore wx_sem;
  1741. struct semaphore scan_sem;
  1742. spinlock_t mgmt_tx_lock;
  1743. spinlock_t beacon_lock;
  1744. short beacon_txing;
  1745. short wap_set;
  1746. short ssid_set;
  1747. u8 wpax_type_set; //{added by David, 2006.9.28}
  1748. u32 wpax_type_notify; //{added by David, 2006.9.26}
  1749. /* QoS related flag */
  1750. char init_wmmparam_flag;
  1751. /* set on initialization */
  1752. u8 qos_support;
  1753. /* for discarding duplicated packets in IBSS */
  1754. struct list_head ibss_mac_hash[IEEE_IBSS_MAC_HASH_SIZE];
  1755. /* for discarding duplicated packets in BSS */
  1756. u16 last_rxseq_num[17]; /* rx seq previous per-tid */
  1757. u16 last_rxfrag_num[17];/* tx frag previous per-tid */
  1758. unsigned long last_packet_time[17];
  1759. /* for PS mode */
  1760. unsigned long last_rx_ps_time;
  1761. /* used if IEEE_SOFTMAC_SINGLE_QUEUE is set */
  1762. struct sk_buff *mgmt_queue_ring[MGMT_QUEUE_NUM];
  1763. int mgmt_queue_head;
  1764. int mgmt_queue_tail;
  1765. //{ added for rtl819x
  1766. #define IEEE80211_QUEUE_LIMIT 128
  1767. u8 AsocRetryCount;
  1768. unsigned int hw_header;
  1769. struct sk_buff_head skb_waitQ[MAX_QUEUE_SIZE];
  1770. struct sk_buff_head skb_aggQ[MAX_QUEUE_SIZE];
  1771. struct sk_buff_head skb_drv_aggQ[MAX_QUEUE_SIZE];
  1772. u32 sta_edca_param[4];
  1773. bool aggregation;
  1774. // Enable/Disable Rx immediate BA capability.
  1775. bool enable_rx_imm_BA;
  1776. bool bibsscoordinator;
  1777. //+by amy for DM ,080515
  1778. //Dynamic Tx power for near/far range enable/Disable , by amy , 2008-05-15
  1779. bool bdynamic_txpower_enable;
  1780. bool bCTSToSelfEnable;
  1781. u8 CTSToSelfTH;
  1782. u32 fsync_time_interval;
  1783. u32 fsync_rate_bitmap;
  1784. u8 fsync_rssi_threshold;
  1785. bool bfsync_enable;
  1786. u8 fsync_multiple_timeinterval; // FsyncMultipleTimeInterval * FsyncTimeInterval
  1787. u32 fsync_firstdiff_ratethreshold; // low threshold
  1788. u32 fsync_seconddiff_ratethreshold; // decrease threshold
  1789. Fsync_State fsync_state;
  1790. bool bis_any_nonbepkts;
  1791. //20Mhz 40Mhz AutoSwitch Threshold
  1792. bandwidth_autoswitch bandwidth_auto_switch;
  1793. //for txpower tracking
  1794. bool FwRWRF;
  1795. //added by amy for AP roaming
  1796. RT_LINK_DETECT_T LinkDetectInfo;
  1797. //added by amy for ps
  1798. RT_POWER_SAVE_CONTROL PowerSaveControl;
  1799. //}
  1800. /* used if IEEE_SOFTMAC_TX_QUEUE is set */
  1801. struct tx_pending_t tx_pending;
  1802. /* used if IEEE_SOFTMAC_ASSOCIATE is set */
  1803. struct timer_list associate_timer;
  1804. /* used if IEEE_SOFTMAC_BEACONS is set */
  1805. struct timer_list beacon_timer;
  1806. struct work_struct associate_complete_wq;
  1807. struct work_struct associate_procedure_wq;
  1808. struct delayed_work softmac_scan_wq;
  1809. struct delayed_work associate_retry_wq;
  1810. struct delayed_work start_ibss_wq;
  1811. struct work_struct wx_sync_scan_wq;
  1812. struct workqueue_struct *wq;
  1813. // Qos related. Added by Annie, 2005-11-01.
  1814. //STA_QOS StaQos;
  1815. //u32 STA_EDCA_PARAM[4];
  1816. //CHANNEL_ACCESS_SETTING ChannelAccessSetting;
  1817. /* Callback functions */
  1818. void (*set_security)(struct net_device *dev,
  1819. struct ieee80211_security *sec);
  1820. /* Used to TX data frame by using txb structs.
  1821. * this is not used if in the softmac_features
  1822. * is set the flag IEEE_SOFTMAC_TX_QUEUE
  1823. */
  1824. int (*hard_start_xmit)(struct ieee80211_txb *txb,
  1825. struct net_device *dev);
  1826. int (*reset_port)(struct net_device *dev);
  1827. int (*is_queue_full) (struct net_device * dev, int pri);
  1828. int (*handle_management) (struct net_device * dev,
  1829. struct ieee80211_network * network, u16 type);
  1830. int (*is_qos_active) (struct net_device *dev, struct sk_buff *skb);
  1831. /* Softmac-generated frames (mamagement) are TXed via this
  1832. * callback if the flag IEEE_SOFTMAC_SINGLE_QUEUE is
  1833. * not set. As some cards may have different HW queues that
  1834. * one might want to use for data and management frames
  1835. * the option to have two callbacks might be useful.
  1836. * This function can't sleep.
  1837. */
  1838. int (*softmac_hard_start_xmit)(struct sk_buff *skb,
  1839. struct net_device *dev);
  1840. /* used instead of hard_start_xmit (not softmac_hard_start_xmit)
  1841. * if the IEEE_SOFTMAC_TX_QUEUE feature is used to TX data
  1842. * frames. I the option IEEE_SOFTMAC_SINGLE_QUEUE is also set
  1843. * then also management frames are sent via this callback.
  1844. * This function can't sleep.
  1845. */
  1846. void (*softmac_data_hard_start_xmit)(struct sk_buff *skb,
  1847. struct net_device *dev,int rate);
  1848. /* stops the HW queue for DATA frames. Useful to avoid
  1849. * waste time to TX data frame when we are reassociating
  1850. * This function can sleep.
  1851. */
  1852. void (*data_hard_stop)(struct net_device *dev);
  1853. /* OK this is complementar to data_poll_hard_stop */
  1854. void (*data_hard_resume)(struct net_device *dev);
  1855. /* ask to the driver to retune the radio .
  1856. * This function can sleep. the driver should ensure
  1857. * the radio has been swithced before return.
  1858. */
  1859. void (*set_chan)(struct net_device *dev,short ch);
  1860. /* These are not used if the ieee stack takes care of
  1861. * scanning (IEEE_SOFTMAC_SCAN feature set).
  1862. * In this case only the set_chan is used.
  1863. *
  1864. * The syncro version is similar to the start_scan but
  1865. * does not return until all channels has been scanned.
  1866. * this is called in user context and should sleep,
  1867. * it is called in a work_queue when swithcing to ad-hoc mode
  1868. * or in behalf of iwlist scan when the card is associated
  1869. * and root user ask for a scan.
  1870. * the function stop_scan should stop both the syncro and
  1871. * background scanning and can sleep.
  1872. * The function start_scan should initiate the background
  1873. * scanning and can't sleep.
  1874. */
  1875. void (*scan_syncro)(struct net_device *dev);
  1876. void (*start_scan)(struct net_device *dev);
  1877. void (*stop_scan)(struct net_device *dev);
  1878. /* indicate the driver that the link state is changed
  1879. * for example it may indicate the card is associated now.
  1880. * Driver might be interested in this to apply RX filter
  1881. * rules or simply light the LINK led
  1882. */
  1883. void (*link_change)(struct net_device *dev);
  1884. /* these two function indicates to the HW when to start
  1885. * and stop to send beacons. This is used when the
  1886. * IEEE_SOFTMAC_BEACONS is not set. For now the
  1887. * stop_send_bacons is NOT guaranteed to be called only
  1888. * after start_send_beacons.
  1889. */
  1890. void (*start_send_beacons) (struct net_device *dev,u16 tx_rate);
  1891. void (*stop_send_beacons) (struct net_device *dev);
  1892. /* power save mode related */
  1893. void (*sta_wake_up) (struct net_device *dev);
  1894. void (*ps_request_tx_ack) (struct net_device *dev);
  1895. void (*enter_sleep_state) (struct net_device *dev, u32 th, u32 tl);
  1896. short (*ps_is_queue_empty) (struct net_device *dev);
  1897. int (*handle_beacon) (struct net_device * dev, struct ieee80211_beacon * beacon, struct ieee80211_network * network);
  1898. int (*handle_assoc_response) (struct net_device * dev, struct ieee80211_assoc_response_frame * resp, struct ieee80211_network * network);
  1899. /* check whether Tx hw resouce available */
  1900. short (*check_nic_enough_desc)(struct net_device *dev, int queue_index);
  1901. //added by wb for HT related
  1902. // void (*SwChnlByTimerHandler)(struct net_device *dev, int channel);
  1903. void (*SetBWModeHandler)(struct net_device *dev, HT_CHANNEL_WIDTH Bandwidth, HT_EXTCHNL_OFFSET Offset);
  1904. // void (*UpdateHalRATRTableHandler)(struct net_device* dev, u8* pMcsRate);
  1905. bool (*GetNmodeSupportBySecCfg)(struct net_device* dev);
  1906. void (*SetWirelessMode)(struct net_device* dev, u8 wireless_mode);
  1907. bool (*GetHalfNmodeSupportByAPsHandler)(struct net_device* dev);
  1908. void (*InitialGainHandler)(struct net_device *dev, u8 Operation);
  1909. /* This must be the last item so that it points to the data
  1910. * allocated beyond this structure by alloc_ieee80211 */
  1911. u8 priv[0];
  1912. };
  1913. #define IEEE_A (1<<0)
  1914. #define IEEE_B (1<<1)
  1915. #define IEEE_G (1<<2)
  1916. #define IEEE_N_24G (1<<4)
  1917. #define IEEE_N_5G (1<<5)
  1918. #define IEEE_MODE_MASK (IEEE_A|IEEE_B|IEEE_G)
  1919. /* Generate a 802.11 header */
  1920. /* Uses the channel change callback directly
  1921. * instead of [start/stop] scan callbacks
  1922. */
  1923. #define IEEE_SOFTMAC_SCAN (1<<2)
  1924. /* Perform authentication and association handshake */
  1925. #define IEEE_SOFTMAC_ASSOCIATE (1<<3)
  1926. /* Generate probe requests */
  1927. #define IEEE_SOFTMAC_PROBERQ (1<<4)
  1928. /* Generate respones to probe requests */
  1929. #define IEEE_SOFTMAC_PROBERS (1<<5)
  1930. /* The ieee802.11 stack will manages the netif queue
  1931. * wake/stop for the driver, taking care of 802.11
  1932. * fragmentation. See softmac.c for details. */
  1933. #define IEEE_SOFTMAC_TX_QUEUE (1<<7)
  1934. /* Uses only the softmac_data_hard_start_xmit
  1935. * even for TX management frames.
  1936. */
  1937. #define IEEE_SOFTMAC_SINGLE_QUEUE (1<<8)
  1938. /* Generate beacons. The stack will enqueue beacons
  1939. * to the card
  1940. */
  1941. #define IEEE_SOFTMAC_BEACONS (1<<6)
  1942. static inline void *ieee80211_priv(struct net_device *dev)
  1943. {
  1944. return ((struct ieee80211_device *)netdev_priv(dev))->priv;
  1945. }
  1946. extern inline int ieee80211_is_empty_essid(const char *essid, int essid_len)
  1947. {
  1948. /* Single white space is for Linksys APs */
  1949. if (essid_len == 1 && essid[0] == ' ')
  1950. return 1;
  1951. /* Otherwise, if the entire essid is 0, we assume it is hidden */
  1952. while (essid_len) {
  1953. essid_len--;
  1954. if (essid[essid_len] != '\0')
  1955. return 0;
  1956. }
  1957. return 1;
  1958. }
  1959. extern inline int ieee80211_is_valid_mode(struct ieee80211_device *ieee, int mode)
  1960. {
  1961. /*
  1962. * It is possible for both access points and our device to support
  1963. * combinations of modes, so as long as there is one valid combination
  1964. * of ap/device supported modes, then return success
  1965. *
  1966. */
  1967. if ((mode & IEEE_A) &&
  1968. (ieee->modulation & IEEE80211_OFDM_MODULATION) &&
  1969. (ieee->freq_band & IEEE80211_52GHZ_BAND))
  1970. return 1;
  1971. if ((mode & IEEE_G) &&
  1972. (ieee->modulation & IEEE80211_OFDM_MODULATION) &&
  1973. (ieee->freq_band & IEEE80211_24GHZ_BAND))
  1974. return 1;
  1975. if ((mode & IEEE_B) &&
  1976. (ieee->modulation & IEEE80211_CCK_MODULATION) &&
  1977. (ieee->freq_band & IEEE80211_24GHZ_BAND))
  1978. return 1;
  1979. return 0;
  1980. }
  1981. extern inline int ieee80211_get_hdrlen(u16 fc)
  1982. {
  1983. int hdrlen = IEEE80211_3ADDR_LEN;
  1984. switch (WLAN_FC_GET_TYPE(fc)) {
  1985. case IEEE80211_FTYPE_DATA:
  1986. if ((fc & IEEE80211_FCTL_FROMDS) && (fc & IEEE80211_FCTL_TODS))
  1987. hdrlen = IEEE80211_4ADDR_LEN; /* Addr4 */
  1988. if(IEEE80211_QOS_HAS_SEQ(fc))
  1989. hdrlen += 2; /* QOS ctrl*/
  1990. break;
  1991. case IEEE80211_FTYPE_CTL:
  1992. switch (WLAN_FC_GET_STYPE(fc)) {
  1993. case IEEE80211_STYPE_CTS:
  1994. case IEEE80211_STYPE_ACK:
  1995. hdrlen = IEEE80211_1ADDR_LEN;
  1996. break;
  1997. default:
  1998. hdrlen = IEEE80211_2ADDR_LEN;
  1999. break;
  2000. }
  2001. break;
  2002. }
  2003. return hdrlen;
  2004. }
  2005. static inline u8 *ieee80211_get_payload(struct ieee80211_hdr *hdr)
  2006. {
  2007. switch (ieee80211_get_hdrlen(le16_to_cpu(hdr->frame_ctl))) {
  2008. case IEEE80211_1ADDR_LEN:
  2009. return ((struct ieee80211_hdr_1addr *)hdr)->payload;
  2010. case IEEE80211_2ADDR_LEN:
  2011. return ((struct ieee80211_hdr_2addr *)hdr)->payload;
  2012. case IEEE80211_3ADDR_LEN:
  2013. return ((struct ieee80211_hdr_3addr *)hdr)->payload;
  2014. case IEEE80211_4ADDR_LEN:
  2015. return ((struct ieee80211_hdr_4addr *)hdr)->payload;
  2016. }
  2017. return NULL;
  2018. }
  2019. static inline int ieee80211_is_ofdm_rate(u8 rate)
  2020. {
  2021. switch (rate & ~IEEE80211_BASIC_RATE_MASK) {
  2022. case IEEE80211_OFDM_RATE_6MB:
  2023. case IEEE80211_OFDM_RATE_9MB:
  2024. case IEEE80211_OFDM_RATE_12MB:
  2025. case IEEE80211_OFDM_RATE_18MB:
  2026. case IEEE80211_OFDM_RATE_24MB:
  2027. case IEEE80211_OFDM_RATE_36MB:
  2028. case IEEE80211_OFDM_RATE_48MB:
  2029. case IEEE80211_OFDM_RATE_54MB:
  2030. return 1;
  2031. }
  2032. return 0;
  2033. }
  2034. static inline int ieee80211_is_cck_rate(u8 rate)
  2035. {
  2036. switch (rate & ~IEEE80211_BASIC_RATE_MASK) {
  2037. case IEEE80211_CCK_RATE_1MB:
  2038. case IEEE80211_CCK_RATE_2MB:
  2039. case IEEE80211_CCK_RATE_5MB:
  2040. case IEEE80211_CCK_RATE_11MB:
  2041. return 1;
  2042. }
  2043. return 0;
  2044. }
  2045. /* ieee80211.c */
  2046. extern void free_ieee80211(struct net_device *dev);
  2047. extern struct net_device *alloc_ieee80211(int sizeof_priv);
  2048. extern int ieee80211_set_encryption(struct ieee80211_device *ieee);
  2049. /* ieee80211_tx.c */
  2050. extern int ieee80211_encrypt_fragment(
  2051. struct ieee80211_device *ieee,
  2052. struct sk_buff *frag,
  2053. int hdr_len);
  2054. extern int ieee80211_xmit(struct sk_buff *skb,
  2055. struct net_device *dev);
  2056. extern void ieee80211_txb_free(struct ieee80211_txb *);
  2057. /* ieee80211_rx.c */
  2058. extern int ieee80211_rx(struct ieee80211_device *ieee, struct sk_buff *skb,
  2059. struct ieee80211_rx_stats *rx_stats);
  2060. extern void ieee80211_rx_mgt(struct ieee80211_device *ieee,
  2061. struct ieee80211_hdr_4addr *header,
  2062. struct ieee80211_rx_stats *stats);
  2063. /* ieee80211_wx.c */
  2064. extern int ieee80211_wx_get_scan(struct ieee80211_device *ieee,
  2065. struct iw_request_info *info,
  2066. union iwreq_data *wrqu, char *key);
  2067. extern int ieee80211_wx_set_encode(struct ieee80211_device *ieee,
  2068. struct iw_request_info *info,
  2069. union iwreq_data *wrqu, char *key);
  2070. extern int ieee80211_wx_get_encode(struct ieee80211_device *ieee,
  2071. struct iw_request_info *info,
  2072. union iwreq_data *wrqu, char *key);
  2073. #if WIRELESS_EXT >= 18
  2074. extern int ieee80211_wx_get_encode_ext(struct ieee80211_device *ieee,
  2075. struct iw_request_info *info,
  2076. union iwreq_data* wrqu, char *extra);
  2077. extern int ieee80211_wx_set_encode_ext(struct ieee80211_device *ieee,
  2078. struct iw_request_info *info,
  2079. union iwreq_data* wrqu, char *extra);
  2080. extern int ieee80211_wx_set_auth(struct ieee80211_device *ieee,
  2081. struct iw_request_info *info,
  2082. struct iw_param *data, char *extra);
  2083. extern int ieee80211_wx_set_mlme(struct ieee80211_device *ieee,
  2084. struct iw_request_info *info,
  2085. union iwreq_data *wrqu, char *extra);
  2086. #endif
  2087. extern int ieee80211_wx_set_gen_ie(struct ieee80211_device *ieee, u8 *ie, size_t len);
  2088. /* ieee80211_softmac.c */
  2089. extern short ieee80211_is_54g(struct ieee80211_network net);
  2090. extern short ieee80211_is_shortslot(struct ieee80211_network net);
  2091. extern int ieee80211_rx_frame_softmac(struct ieee80211_device *ieee, struct sk_buff *skb,
  2092. struct ieee80211_rx_stats *rx_stats, u16 type,
  2093. u16 stype);
  2094. extern void ieee80211_softmac_new_net(struct ieee80211_device *ieee, struct ieee80211_network *net);
  2095. void SendDisassociation(struct ieee80211_device *ieee, u8* asSta, u8 asRsn);
  2096. extern void ieee80211_softmac_xmit(struct ieee80211_txb *txb, struct ieee80211_device *ieee);
  2097. extern void ieee80211_stop_send_beacons(struct ieee80211_device *ieee);
  2098. extern void notify_wx_assoc_event(struct ieee80211_device *ieee);
  2099. extern void ieee80211_softmac_check_all_nets(struct ieee80211_device *ieee);
  2100. extern void ieee80211_start_bss(struct ieee80211_device *ieee);
  2101. extern void ieee80211_start_master_bss(struct ieee80211_device *ieee);
  2102. extern void ieee80211_start_ibss(struct ieee80211_device *ieee);
  2103. extern void ieee80211_softmac_init(struct ieee80211_device *ieee);
  2104. extern void ieee80211_softmac_free(struct ieee80211_device *ieee);
  2105. extern void ieee80211_associate_abort(struct ieee80211_device *ieee);
  2106. extern void ieee80211_disassociate(struct ieee80211_device *ieee);
  2107. extern void ieee80211_stop_scan(struct ieee80211_device *ieee);
  2108. extern void ieee80211_start_scan_syncro(struct ieee80211_device *ieee);
  2109. extern void ieee80211_check_all_nets(struct ieee80211_device *ieee);
  2110. extern void ieee80211_start_protocol(struct ieee80211_device *ieee);
  2111. extern void ieee80211_stop_protocol(struct ieee80211_device *ieee);
  2112. extern void ieee80211_softmac_start_protocol(struct ieee80211_device *ieee);
  2113. extern void ieee80211_softmac_stop_protocol(struct ieee80211_device *ieee);
  2114. extern void ieee80211_reset_queue(struct ieee80211_device *ieee);
  2115. extern void ieee80211_wake_queue(struct ieee80211_device *ieee);
  2116. extern void ieee80211_stop_queue(struct ieee80211_device *ieee);
  2117. extern struct sk_buff *ieee80211_get_beacon(struct ieee80211_device *ieee);
  2118. extern void ieee80211_start_send_beacons(struct ieee80211_device *ieee);
  2119. extern void ieee80211_stop_send_beacons(struct ieee80211_device *ieee);
  2120. extern int ieee80211_wpa_supplicant_ioctl(struct ieee80211_device *ieee, struct iw_point *p);
  2121. extern void notify_wx_assoc_event(struct ieee80211_device *ieee);
  2122. extern void ieee80211_ps_tx_ack(struct ieee80211_device *ieee, short success);
  2123. extern void softmac_mgmt_xmit(struct sk_buff *skb, struct ieee80211_device *ieee);
  2124. /* ieee80211_crypt_ccmp&tkip&wep.c */
  2125. extern void ieee80211_tkip_null(void);
  2126. extern void ieee80211_wep_null(void);
  2127. extern void ieee80211_ccmp_null(void);
  2128. /* ieee80211_softmac_wx.c */
  2129. extern int ieee80211_wx_get_wap(struct ieee80211_device *ieee,
  2130. struct iw_request_info *info,
  2131. union iwreq_data *wrqu, char *ext);
  2132. extern int ieee80211_wx_set_wap(struct ieee80211_device *ieee,
  2133. struct iw_request_info *info,
  2134. union iwreq_data *awrq,
  2135. char *extra);
  2136. extern int ieee80211_wx_get_essid(struct ieee80211_device *ieee, struct iw_request_info *a,union iwreq_data *wrqu,char *b);
  2137. extern int ieee80211_wx_set_rate(struct ieee80211_device *ieee,
  2138. struct iw_request_info *info,
  2139. union iwreq_data *wrqu, char *extra);
  2140. extern int ieee80211_wx_get_rate(struct ieee80211_device *ieee,
  2141. struct iw_request_info *info,
  2142. union iwreq_data *wrqu, char *extra);
  2143. extern int ieee80211_wx_set_mode(struct ieee80211_device *ieee, struct iw_request_info *a,
  2144. union iwreq_data *wrqu, char *b);
  2145. extern int ieee80211_wx_set_scan(struct ieee80211_device *ieee, struct iw_request_info *a,
  2146. union iwreq_data *wrqu, char *b);
  2147. extern int ieee80211_wx_set_essid(struct ieee80211_device *ieee,
  2148. struct iw_request_info *a,
  2149. union iwreq_data *wrqu, char *extra);
  2150. extern int ieee80211_wx_get_mode(struct ieee80211_device *ieee, struct iw_request_info *a,
  2151. union iwreq_data *wrqu, char *b);
  2152. extern int ieee80211_wx_set_freq(struct ieee80211_device *ieee, struct iw_request_info *a,
  2153. union iwreq_data *wrqu, char *b);
  2154. extern int ieee80211_wx_get_freq(struct ieee80211_device *ieee, struct iw_request_info *a,
  2155. union iwreq_data *wrqu, char *b);
  2156. //extern void ieee80211_wx_sync_scan_wq(struct ieee80211_device *ieee);
  2157. extern void ieee80211_wx_sync_scan_wq(struct work_struct *work);
  2158. extern int ieee80211_wx_set_rawtx(struct ieee80211_device *ieee,
  2159. struct iw_request_info *info,
  2160. union iwreq_data *wrqu, char *extra);
  2161. extern int ieee80211_wx_get_name(struct ieee80211_device *ieee,
  2162. struct iw_request_info *info,
  2163. union iwreq_data *wrqu, char *extra);
  2164. extern int ieee80211_wx_set_power(struct ieee80211_device *ieee,
  2165. struct iw_request_info *info,
  2166. union iwreq_data *wrqu, char *extra);
  2167. extern int ieee80211_wx_get_power(struct ieee80211_device *ieee,
  2168. struct iw_request_info *info,
  2169. union iwreq_data *wrqu, char *extra);
  2170. extern int ieee80211_wx_set_rts(struct ieee80211_device *ieee,
  2171. struct iw_request_info *info,
  2172. union iwreq_data *wrqu, char *extra);
  2173. extern int ieee80211_wx_get_rts(struct ieee80211_device *ieee,
  2174. struct iw_request_info *info,
  2175. union iwreq_data *wrqu, char *extra);
  2176. //HT
  2177. #define MAX_RECEIVE_BUFFER_SIZE 9100 //
  2178. extern void HTDebugHTCapability(u8* CapIE, u8* TitleString );
  2179. extern void HTDebugHTInfo(u8* InfoIE, u8* TitleString);
  2180. void HTSetConnectBwMode(struct ieee80211_device* ieee, HT_CHANNEL_WIDTH Bandwidth, HT_EXTCHNL_OFFSET Offset);
  2181. extern void HTUpdateDefaultSetting(struct ieee80211_device* ieee);
  2182. extern void HTConstructCapabilityElement(struct ieee80211_device* ieee, u8* posHTCap, u8* len, u8 isEncrypt);
  2183. extern void HTConstructInfoElement(struct ieee80211_device* ieee, u8* posHTInfo, u8* len, u8 isEncrypt);
  2184. extern void HTConstructRT2RTAggElement(struct ieee80211_device* ieee, u8* posRT2RTAgg, u8* len);
  2185. extern void HTOnAssocRsp(struct ieee80211_device *ieee);
  2186. extern void HTInitializeHTInfo(struct ieee80211_device* ieee);
  2187. extern void HTInitializeBssDesc(PBSS_HT pBssHT);
  2188. extern void HTResetSelfAndSavePeerSetting(struct ieee80211_device* ieee, struct ieee80211_network * pNetwork);
  2189. extern void HTUpdateSelfAndPeerSetting(struct ieee80211_device* ieee, struct ieee80211_network * pNetwork);
  2190. extern u8 HTGetHighestMCSRate(struct ieee80211_device* ieee, u8* pMCSRateSet, u8* pMCSFilter);
  2191. extern u8 MCS_FILTER_ALL[];
  2192. extern u16 MCS_DATA_RATE[2][2][77] ;
  2193. extern u8 HTCCheck(struct ieee80211_device* ieee, u8* pFrame);
  2194. //extern void HTSetConnectBwModeCallback(unsigned long data);
  2195. extern void HTResetIOTSetting(PRT_HIGH_THROUGHPUT pHTInfo);
  2196. extern bool IsHTHalfNmodeAPs(struct ieee80211_device* ieee);
  2197. extern u16 HTHalfMcsToDataRate(struct ieee80211_device* ieee, u8 nMcsRate);
  2198. extern u16 HTMcsToDataRate( struct ieee80211_device* ieee, u8 nMcsRate);
  2199. extern u16 TxCountToDataRate( struct ieee80211_device* ieee, u8 nDataRate);
  2200. //function in BAPROC.c
  2201. extern int ieee80211_rx_ADDBAReq( struct ieee80211_device* ieee, struct sk_buff *skb);
  2202. extern int ieee80211_rx_ADDBARsp( struct ieee80211_device* ieee, struct sk_buff *skb);
  2203. extern int ieee80211_rx_DELBA(struct ieee80211_device* ieee,struct sk_buff *skb);
  2204. extern void TsInitAddBA( struct ieee80211_device* ieee, PTX_TS_RECORD pTS, u8 Policy, u8 bOverwritePending);
  2205. extern void TsInitDelBA( struct ieee80211_device* ieee, PTS_COMMON_INFO pTsCommonInfo, TR_SELECT TxRxSelect);
  2206. extern void BaSetupTimeOut(unsigned long data);
  2207. extern void TxBaInactTimeout(unsigned long data);
  2208. extern void RxBaInactTimeout(unsigned long data);
  2209. extern void ResetBaEntry( PBA_RECORD pBA);
  2210. //function in TS.c
  2211. extern bool GetTs(
  2212. struct ieee80211_device* ieee,
  2213. PTS_COMMON_INFO *ppTS,
  2214. u8* Addr,
  2215. u8 TID,
  2216. TR_SELECT TxRxSelect, //Rx:1, Tx:0
  2217. bool bAddNewTs
  2218. );
  2219. extern void TSInitialize(struct ieee80211_device *ieee);
  2220. extern void TsStartAddBaProcess(struct ieee80211_device* ieee, PTX_TS_RECORD pTxTS);
  2221. extern void RemovePeerTS(struct ieee80211_device* ieee, u8* Addr);
  2222. extern void RemoveAllTS(struct ieee80211_device* ieee);
  2223. void ieee80211_softmac_scan_syncro(struct ieee80211_device *ieee);
  2224. extern const long ieee80211_wlan_frequencies[];
  2225. extern inline void ieee80211_increment_scans(struct ieee80211_device *ieee)
  2226. {
  2227. ieee->scans++;
  2228. }
  2229. extern inline int ieee80211_get_scans(struct ieee80211_device *ieee)
  2230. {
  2231. return ieee->scans;
  2232. }
  2233. static inline const char *escape_essid(const char *essid, u8 essid_len) {
  2234. static char escaped[IW_ESSID_MAX_SIZE * 2 + 1];
  2235. const char *s = essid;
  2236. char *d = escaped;
  2237. if (ieee80211_is_empty_essid(essid, essid_len)) {
  2238. memcpy(escaped, "<hidden>", sizeof("<hidden>"));
  2239. return escaped;
  2240. }
  2241. essid_len = min(essid_len, (u8)IW_ESSID_MAX_SIZE);
  2242. while (essid_len--) {
  2243. if (*s == '\0') {
  2244. *d++ = '\\';
  2245. *d++ = '0';
  2246. s++;
  2247. } else {
  2248. *d++ = *s++;
  2249. }
  2250. }
  2251. *d = '\0';
  2252. return escaped;
  2253. }
  2254. /* For the function is more related to hardware setting, it's better to use the
  2255. * ieee handler to refer to it.
  2256. */
  2257. extern short check_nic_enough_desc(struct net_device *dev, int queue_index);
  2258. extern int ieee80211_data_xmit(struct sk_buff *skb, struct net_device *dev);
  2259. extern int ieee80211_parse_info_param(struct ieee80211_device *ieee,
  2260. struct ieee80211_info_element *info_element,
  2261. u16 length,
  2262. struct ieee80211_network *network,
  2263. struct ieee80211_rx_stats *stats);
  2264. void ieee80211_indicate_packets(struct ieee80211_device *ieee, struct ieee80211_rxb** prxbIndicateArray,u8 index);
  2265. #define RT_ASOC_RETRY_LIMIT 5
  2266. #endif /* IEEE80211_H */