rtllib.h 57 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219
  1. /*
  2. * Merged with mainline rtllib.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. * <andrea.merello@gmail.com>
  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 RTLLIB_H
  25. #define RTLLIB_H
  26. #include <linux/if_ether.h> /* ETH_ALEN */
  27. #include <linux/kernel.h> /* ARRAY_SIZE */
  28. #include <linux/module.h>
  29. #include <linux/interrupt.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 "rtllib_debug.h"
  37. #include "rtl819x_HT.h"
  38. #include "rtl819x_BA.h"
  39. #include "rtl819x_TS.h"
  40. #include <linux/netdevice.h>
  41. #include <linux/if_arp.h> /* ARPHRD_ETHER */
  42. #include <net/lib80211.h>
  43. #define MAX_PRECMD_CNT 16
  44. #define MAX_RFDEPENDCMD_CNT 16
  45. #define MAX_POSTCMD_CNT 16
  46. #ifndef WIRELESS_SPY
  47. #define WIRELESS_SPY
  48. #endif
  49. #include <net/iw_handler.h>
  50. #ifndef IW_MODE_MONITOR
  51. #define IW_MODE_MONITOR 6
  52. #endif
  53. #ifndef IWEVCUSTOM
  54. #define IWEVCUSTOM 0x8c02
  55. #endif
  56. #ifndef IW_CUSTOM_MAX
  57. /* Max number of char in custom event - use multiple of them if needed */
  58. #define IW_CUSTOM_MAX 256 /* In bytes */
  59. #endif
  60. #define skb_tail_pointer_rsl(skb) skb_tail_pointer(skb)
  61. #define queue_delayed_work_rsl(x, y, z) queue_delayed_work(x, y, z)
  62. #define INIT_DELAYED_WORK_RSL(x, y, z) INIT_DELAYED_WORK(x, y)
  63. #define queue_work_rsl(x, y) queue_work(x, y)
  64. #define INIT_WORK_RSL(x, y, z) INIT_WORK(x, y)
  65. #define container_of_work_rsl(x, y, z) container_of(x, y, z)
  66. #define container_of_dwork_rsl(x, y, z) \
  67. container_of(container_of(x, struct delayed_work, work), y, z)
  68. #define iwe_stream_add_event_rsl(info, start, stop, iwe, len) \
  69. iwe_stream_add_event(info, start, stop, iwe, len)
  70. #define iwe_stream_add_point_rsl(info, start, stop, iwe, p) \
  71. iwe_stream_add_point(info, start, stop, iwe, p)
  72. static inline void *netdev_priv_rsl(struct net_device *dev)
  73. {
  74. return netdev_priv(dev);
  75. }
  76. #define KEY_TYPE_NA 0x0
  77. #define KEY_TYPE_WEP40 0x1
  78. #define KEY_TYPE_TKIP 0x2
  79. #define KEY_TYPE_CCMP 0x4
  80. #define KEY_TYPE_WEP104 0x5
  81. /* added for rtl819x tx procedure */
  82. #define MAX_QUEUE_SIZE 0x10
  83. #define BK_QUEUE 0
  84. #define BE_QUEUE 1
  85. #define VI_QUEUE 2
  86. #define VO_QUEUE 3
  87. #define HCCA_QUEUE 4
  88. #define TXCMD_QUEUE 5
  89. #define MGNT_QUEUE 6
  90. #define HIGH_QUEUE 7
  91. #define BEACON_QUEUE 8
  92. #ifndef IW_MODE_MESH
  93. #define IW_MODE_MESH 7
  94. #endif
  95. #define IE_CISCO_FLAG_POSITION 0x08
  96. #define SUPPORT_CKIP_MIC 0x08
  97. #define SUPPORT_CKIP_PK 0x10
  98. #define RT_RF_OFF_LEVL_HALT_NIC BIT3
  99. #define RT_IN_PS_LEVEL(pPSC, _PS_FLAG) \
  100. ((pPSC->CurPsLevel & _PS_FLAG) ? true : false)
  101. #define RT_CLEAR_PS_LEVEL(pPSC, _PS_FLAG) \
  102. (pPSC->CurPsLevel &= (~(_PS_FLAG)))
  103. #define RT_SET_PS_LEVEL(pPSC, _PS_FLAG) (pPSC->CurPsLevel |= _PS_FLAG)
  104. /* defined for skb cb field */
  105. /* At most 28 byte */
  106. struct cb_desc {
  107. /* Tx Desc Related flags (8-9) */
  108. u8 bLastIniPkt:1;
  109. u8 bCmdOrInit:1;
  110. u8 bFirstSeg:1;
  111. u8 bLastSeg:1;
  112. u8 bEncrypt:1;
  113. u8 bTxDisableRateFallBack:1;
  114. u8 bTxUseDriverAssingedRate:1;
  115. u8 bHwSec:1;
  116. u8 nStuckCount;
  117. /* Tx Firmware Related flags (10-11)*/
  118. u8 bCTSEnable:1;
  119. u8 bRTSEnable:1;
  120. u8 bUseShortGI:1;
  121. u8 bUseShortPreamble:1;
  122. u8 bTxEnableFwCalcDur:1;
  123. u8 bAMPDUEnable:1;
  124. u8 bRTSSTBC:1;
  125. u8 RTSSC:1;
  126. u8 bRTSBW:1;
  127. u8 bPacketBW:1;
  128. u8 bRTSUseShortPreamble:1;
  129. u8 bRTSUseShortGI:1;
  130. u8 bMulticast:1;
  131. u8 bBroadcast:1;
  132. u8 drv_agg_enable:1;
  133. u8 reserved2:1;
  134. /* Tx Desc related element(12-19) */
  135. u8 rata_index;
  136. u8 queue_index;
  137. u16 txbuf_size;
  138. u8 RATRIndex;
  139. u8 bAMSDU:1;
  140. u8 bFromAggrQ:1;
  141. u8 reserved6:6;
  142. u8 macId;
  143. u8 priority;
  144. /* Tx firmware related element(20-27) */
  145. u8 data_rate;
  146. u8 rts_rate;
  147. u8 ampdu_factor;
  148. u8 ampdu_density;
  149. u8 DrvAggrNum;
  150. u8 bdhcp;
  151. u16 pkt_size;
  152. u8 bIsSpecialDataFrame;
  153. u8 bBTTxPacket;
  154. u8 bIsBTProbRsp;
  155. };
  156. enum sw_chnl_cmd_id {
  157. CmdID_End,
  158. CmdID_SetTxPowerLevel,
  159. CmdID_BBRegWrite10,
  160. CmdID_WritePortUlong,
  161. CmdID_WritePortUshort,
  162. CmdID_WritePortUchar,
  163. CmdID_RF_WriteReg,
  164. };
  165. struct sw_chnl_cmd {
  166. enum sw_chnl_cmd_id CmdID;
  167. u32 Para1;
  168. u32 Para2;
  169. u32 msDelay;
  170. } __packed;
  171. /*--------------------------Define -------------------------------------------*/
  172. #define MGN_1M 0x02
  173. #define MGN_2M 0x04
  174. #define MGN_5_5M 0x0b
  175. #define MGN_11M 0x16
  176. #define MGN_6M 0x0c
  177. #define MGN_9M 0x12
  178. #define MGN_12M 0x18
  179. #define MGN_18M 0x24
  180. #define MGN_24M 0x30
  181. #define MGN_36M 0x48
  182. #define MGN_48M 0x60
  183. #define MGN_54M 0x6c
  184. #define MGN_MCS0 0x80
  185. #define MGN_MCS1 0x81
  186. #define MGN_MCS2 0x82
  187. #define MGN_MCS3 0x83
  188. #define MGN_MCS4 0x84
  189. #define MGN_MCS5 0x85
  190. #define MGN_MCS6 0x86
  191. #define MGN_MCS7 0x87
  192. #define MGN_MCS8 0x88
  193. #define MGN_MCS9 0x89
  194. #define MGN_MCS10 0x8a
  195. #define MGN_MCS11 0x8b
  196. #define MGN_MCS12 0x8c
  197. #define MGN_MCS13 0x8d
  198. #define MGN_MCS14 0x8e
  199. #define MGN_MCS15 0x8f
  200. enum hw_variables {
  201. HW_VAR_ETHER_ADDR,
  202. HW_VAR_MULTICAST_REG,
  203. HW_VAR_BASIC_RATE,
  204. HW_VAR_BSSID,
  205. HW_VAR_MEDIA_STATUS,
  206. HW_VAR_SECURITY_CONF,
  207. HW_VAR_BEACON_INTERVAL,
  208. HW_VAR_ATIM_WINDOW,
  209. HW_VAR_LISTEN_INTERVAL,
  210. HW_VAR_CS_COUNTER,
  211. HW_VAR_DEFAULTKEY0,
  212. HW_VAR_DEFAULTKEY1,
  213. HW_VAR_DEFAULTKEY2,
  214. HW_VAR_DEFAULTKEY3,
  215. HW_VAR_SIFS,
  216. HW_VAR_DIFS,
  217. HW_VAR_EIFS,
  218. HW_VAR_SLOT_TIME,
  219. HW_VAR_ACK_PREAMBLE,
  220. HW_VAR_CW_CONFIG,
  221. HW_VAR_CW_VALUES,
  222. HW_VAR_RATE_FALLBACK_CONTROL,
  223. HW_VAR_CONTENTION_WINDOW,
  224. HW_VAR_RETRY_COUNT,
  225. HW_VAR_TR_SWITCH,
  226. HW_VAR_COMMAND,
  227. HW_VAR_WPA_CONFIG,
  228. HW_VAR_AMPDU_MIN_SPACE,
  229. HW_VAR_SHORTGI_DENSITY,
  230. HW_VAR_AMPDU_FACTOR,
  231. HW_VAR_MCS_RATE_AVAILABLE,
  232. HW_VAR_AC_PARAM,
  233. HW_VAR_ACM_CTRL,
  234. HW_VAR_DIS_Req_Qsize,
  235. HW_VAR_CCX_CHNL_LOAD,
  236. HW_VAR_CCX_NOISE_HISTOGRAM,
  237. HW_VAR_CCX_CLM_NHM,
  238. HW_VAR_TxOPLimit,
  239. HW_VAR_TURBO_MODE,
  240. HW_VAR_RF_STATE,
  241. HW_VAR_RF_OFF_BY_HW,
  242. HW_VAR_BUS_SPEED,
  243. HW_VAR_SET_DEV_POWER,
  244. HW_VAR_RCR,
  245. HW_VAR_RATR_0,
  246. HW_VAR_RRSR,
  247. HW_VAR_CPU_RST,
  248. HW_VAR_CECHK_BSSID,
  249. HW_VAR_LBK_MODE,
  250. HW_VAR_AES_11N_FIX,
  251. HW_VAR_USB_RX_AGGR,
  252. HW_VAR_USER_CONTROL_TURBO_MODE,
  253. HW_VAR_RETRY_LIMIT,
  254. HW_VAR_INIT_TX_RATE,
  255. HW_VAR_TX_RATE_REG,
  256. HW_VAR_EFUSE_USAGE,
  257. HW_VAR_EFUSE_BYTES,
  258. HW_VAR_AUTOLOAD_STATUS,
  259. HW_VAR_RF_2R_DISABLE,
  260. HW_VAR_SET_RPWM,
  261. HW_VAR_H2C_FW_PWRMODE,
  262. HW_VAR_H2C_FW_JOINBSSRPT,
  263. HW_VAR_1X1_RECV_COMBINE,
  264. HW_VAR_STOP_SEND_BEACON,
  265. HW_VAR_TSF_TIMER,
  266. HW_VAR_IO_CMD,
  267. HW_VAR_RF_RECOVERY,
  268. HW_VAR_H2C_FW_UPDATE_GTK,
  269. HW_VAR_WF_MASK,
  270. HW_VAR_WF_CRC,
  271. HW_VAR_WF_IS_MAC_ADDR,
  272. HW_VAR_H2C_FW_OFFLOAD,
  273. HW_VAR_RESET_WFCRC,
  274. HW_VAR_HANDLE_FW_C2H,
  275. HW_VAR_DL_FW_RSVD_PAGE,
  276. HW_VAR_AID,
  277. HW_VAR_HW_SEQ_ENABLE,
  278. HW_VAR_CORRECT_TSF,
  279. HW_VAR_BCN_VALID,
  280. HW_VAR_FWLPS_RF_ON,
  281. HW_VAR_DUAL_TSF_RST,
  282. HW_VAR_SWITCH_EPHY_WoWLAN,
  283. HW_VAR_INT_MIGRATION,
  284. HW_VAR_INT_AC,
  285. HW_VAR_RF_TIMING,
  286. };
  287. enum rt_op_mode {
  288. RT_OP_MODE_AP,
  289. RT_OP_MODE_INFRASTRUCTURE,
  290. RT_OP_MODE_IBSS,
  291. RT_OP_MODE_NO_LINK,
  292. };
  293. #define aSifsTime \
  294. (((priv->rtllib->current_network.mode == IEEE_A) \
  295. || (priv->rtllib->current_network.mode == IEEE_N_24G) \
  296. || (priv->rtllib->current_network.mode == IEEE_N_5G)) ? 16 : 10)
  297. #define MGMT_QUEUE_NUM 5
  298. #define IEEE_CMD_SET_WPA_PARAM 1
  299. #define IEEE_CMD_SET_WPA_IE 2
  300. #define IEEE_CMD_SET_ENCRYPTION 3
  301. #define IEEE_CMD_MLME 4
  302. #define IEEE_PARAM_WPA_ENABLED 1
  303. #define IEEE_PARAM_TKIP_COUNTERMEASURES 2
  304. #define IEEE_PARAM_DROP_UNENCRYPTED 3
  305. #define IEEE_PARAM_PRIVACY_INVOKED 4
  306. #define IEEE_PARAM_AUTH_ALGS 5
  307. #define IEEE_PARAM_IEEE_802_1X 6
  308. #define IEEE_PARAM_WPAX_SELECT 7
  309. #define IEEE_MLME_STA_DEAUTH 1
  310. #define IEEE_MLME_STA_DISASSOC 2
  311. #define IEEE_CRYPT_ERR_UNKNOWN_ALG 2
  312. #define IEEE_CRYPT_ERR_CRYPT_INIT_FAILED 4
  313. #define IEEE_CRYPT_ERR_KEY_SET_FAILED 5
  314. #define IEEE_CRYPT_ERR_CARD_CONF_FAILED 7
  315. #define IEEE_CRYPT_ALG_NAME_LEN 16
  316. #define MAX_IE_LEN 0xff
  317. struct ieee_param {
  318. u32 cmd;
  319. u8 sta_addr[ETH_ALEN];
  320. union {
  321. struct {
  322. u8 name;
  323. u32 value;
  324. } wpa_param;
  325. struct {
  326. u32 len;
  327. u8 reserved[32];
  328. u8 data[0];
  329. } wpa_ie;
  330. struct {
  331. int command;
  332. int reason_code;
  333. } mlme;
  334. struct {
  335. u8 alg[IEEE_CRYPT_ALG_NAME_LEN];
  336. u8 set_tx;
  337. u32 err;
  338. u8 idx;
  339. u8 seq[8]; /* sequence counter (set: RX, get: TX) */
  340. u16 key_len;
  341. u8 key[0];
  342. } crypt;
  343. } u;
  344. };
  345. #define msleep_interruptible_rsl msleep_interruptible
  346. /* Maximum size for the MA-UNITDATA primitive, 802.11 standard section
  347. * 6.2.1.1.2.
  348. *
  349. * The figure in section 7.1.2 suggests a body size of up to 2312
  350. * bytes is allowed, which is a bit confusing, I suspect this
  351. * represents the 2304 bytes of real data, plus a possible 8 bytes of
  352. * WEP IV and ICV. (this interpretation suggested by Ramiro Barreiro)
  353. */
  354. #define RTLLIB_1ADDR_LEN 10
  355. #define RTLLIB_2ADDR_LEN 16
  356. #define RTLLIB_3ADDR_LEN 24
  357. #define RTLLIB_4ADDR_LEN 30
  358. #define RTLLIB_FCS_LEN 4
  359. #define RTLLIB_SKBBUFFER_SIZE 2500
  360. #define MIN_FRAG_THRESHOLD 256U
  361. #define MAX_FRAG_THRESHOLD 2346U
  362. /* Frame control field constants */
  363. #define RTLLIB_FCTL_FTYPE 0x000c
  364. #define RTLLIB_FCTL_STYPE 0x00f0
  365. #define RTLLIB_FCTL_FRAMETYPE 0x00fc
  366. #define RTLLIB_FCTL_TODS 0x0100
  367. #define RTLLIB_FCTL_FROMDS 0x0200
  368. #define RTLLIB_FCTL_DSTODS 0x0300
  369. #define RTLLIB_FCTL_MOREFRAGS 0x0400
  370. #define RTLLIB_FCTL_RETRY 0x0800
  371. #define RTLLIB_FCTL_PM 0x1000
  372. #define RTLLIB_FCTL_MOREDATA 0x2000
  373. #define RTLLIB_FCTL_WEP 0x4000
  374. #define RTLLIB_FCTL_ORDER 0x8000
  375. #define RTLLIB_FTYPE_MGMT 0x0000
  376. #define RTLLIB_FTYPE_CTL 0x0004
  377. #define RTLLIB_FTYPE_DATA 0x0008
  378. /* management */
  379. #define RTLLIB_STYPE_ASSOC_REQ 0x0000
  380. #define RTLLIB_STYPE_ASSOC_RESP 0x0010
  381. #define RTLLIB_STYPE_REASSOC_REQ 0x0020
  382. #define RTLLIB_STYPE_REASSOC_RESP 0x0030
  383. #define RTLLIB_STYPE_PROBE_REQ 0x0040
  384. #define RTLLIB_STYPE_PROBE_RESP 0x0050
  385. #define RTLLIB_STYPE_BEACON 0x0080
  386. #define RTLLIB_STYPE_ATIM 0x0090
  387. #define RTLLIB_STYPE_DISASSOC 0x00A0
  388. #define RTLLIB_STYPE_AUTH 0x00B0
  389. #define RTLLIB_STYPE_DEAUTH 0x00C0
  390. #define RTLLIB_STYPE_MANAGE_ACT 0x00D0
  391. /* control */
  392. #define RTLLIB_STYPE_PSPOLL 0x00A0
  393. #define RTLLIB_STYPE_RTS 0x00B0
  394. #define RTLLIB_STYPE_CTS 0x00C0
  395. #define RTLLIB_STYPE_ACK 0x00D0
  396. /* data */
  397. #define RTLLIB_STYPE_DATA 0x0000
  398. #define RTLLIB_STYPE_DATA_CFACK 0x0010
  399. #define RTLLIB_STYPE_DATA_CFPOLL 0x0020
  400. #define RTLLIB_STYPE_DATA_CFACKPOLL 0x0030
  401. #define RTLLIB_STYPE_NULLFUNC 0x0040
  402. #define RTLLIB_STYPE_QOS_DATA 0x0080
  403. #define RTLLIB_STYPE_QOS_NULL 0x00C0
  404. #define RTLLIB_SCTL_FRAG 0x000F
  405. #define RTLLIB_SCTL_SEQ 0xFFF0
  406. /* QOS control */
  407. #define RTLLIB_QCTL_TID 0x000F
  408. #define FC_QOS_BIT BIT7
  409. #define IsDataFrame(pdu) (((pdu[0] & 0x0C) == 0x08) ? true : false)
  410. #define IsLegacyDataFrame(pdu) (IsDataFrame(pdu) && (!(pdu[0]&FC_QOS_BIT)))
  411. #define IsQoSDataFrame(pframe) \
  412. ((*(u16 *)pframe&(RTLLIB_STYPE_QOS_DATA|RTLLIB_FTYPE_DATA)) == \
  413. (RTLLIB_STYPE_QOS_DATA|RTLLIB_FTYPE_DATA))
  414. #define Frame_Order(pframe) (*(u16 *)pframe&RTLLIB_FCTL_ORDER)
  415. #define SN_LESS(a, b) (((a-b)&0x800) != 0)
  416. #define SN_EQUAL(a, b) (a == b)
  417. #define MAX_DEV_ADDR_SIZE 8
  418. enum act_category {
  419. ACT_CAT_QOS = 1,
  420. ACT_CAT_DLS = 2,
  421. ACT_CAT_BA = 3,
  422. ACT_CAT_HT = 7,
  423. ACT_CAT_WMM = 17,
  424. };
  425. enum ba_action {
  426. ACT_ADDBAREQ = 0,
  427. ACT_ADDBARSP = 1,
  428. ACT_DELBA = 2,
  429. };
  430. enum init_gain_op_type {
  431. IG_Backup = 0,
  432. IG_Restore,
  433. IG_Max
  434. };
  435. enum led_ctl_mode {
  436. LED_CTL_POWER_ON = 1,
  437. LED_CTL_LINK = 2,
  438. LED_CTL_NO_LINK = 3,
  439. LED_CTL_TX = 4,
  440. LED_CTL_RX = 5,
  441. LED_CTL_SITE_SURVEY = 6,
  442. LED_CTL_POWER_OFF = 7,
  443. LED_CTL_START_TO_LINK = 8,
  444. };
  445. enum rt_rf_type_def {
  446. RF_1T2R = 0,
  447. RF_2T4R,
  448. };
  449. enum wireless_mode {
  450. WIRELESS_MODE_UNKNOWN = 0x00,
  451. WIRELESS_MODE_A = 0x01,
  452. WIRELESS_MODE_B = 0x02,
  453. WIRELESS_MODE_G = 0x04,
  454. WIRELESS_MODE_AUTO = 0x08,
  455. WIRELESS_MODE_N_24G = 0x10,
  456. WIRELESS_MODE_N_5G = 0x20
  457. };
  458. #ifndef ETH_P_PAE
  459. #define ETH_P_PAE 0x888E /* Port Access Entity (IEEE 802.1X) */
  460. #define ETH_P_IP 0x0800 /* Internet Protocol packet */
  461. #define ETH_P_ARP 0x0806 /* Address Resolution packet */
  462. #endif /* ETH_P_PAE */
  463. #ifndef ETH_P_80211_RAW
  464. #define ETH_P_80211_RAW (ETH_P_ECONET + 1)
  465. #endif
  466. /* IEEE 802.11 defines */
  467. #define P80211_OUI_LEN 3
  468. struct rtllib_snap_hdr {
  469. u8 dsap; /* always 0xAA */
  470. u8 ssap; /* always 0xAA */
  471. u8 ctrl; /* always 0x03 */
  472. u8 oui[P80211_OUI_LEN]; /* organizational universal id */
  473. } __packed;
  474. enum _REG_PREAMBLE_MODE {
  475. PREAMBLE_LONG = 1,
  476. PREAMBLE_AUTO = 2,
  477. PREAMBLE_SHORT = 3,
  478. };
  479. #define SNAP_SIZE sizeof(struct rtllib_snap_hdr)
  480. #define WLAN_FC_GET_TYPE(fc) ((fc) & RTLLIB_FCTL_FTYPE)
  481. #define WLAN_FC_GET_STYPE(fc) ((fc) & RTLLIB_FCTL_STYPE)
  482. #define WLAN_FC_MORE_DATA(fc) ((fc) & RTLLIB_FCTL_MOREDATA)
  483. #define WLAN_FC_GET_FRAMETYPE(fc) ((fc) & RTLLIB_FCTL_FRAMETYPE)
  484. #define WLAN_GET_SEQ_FRAG(seq) ((seq) & RTLLIB_SCTL_FRAG)
  485. #define WLAN_GET_SEQ_SEQ(seq) (((seq) & RTLLIB_SCTL_SEQ) >> 4)
  486. /* Authentication algorithms */
  487. #define WLAN_AUTH_OPEN 0
  488. #define WLAN_AUTH_SHARED_KEY 1
  489. #define WLAN_AUTH_LEAP 128
  490. #define WLAN_CAPABILITY_ESS (1<<0)
  491. #define WLAN_CAPABILITY_IBSS (1<<1)
  492. #define WLAN_CAPABILITY_PRIVACY (1<<4)
  493. #define WLAN_CAPABILITY_SHORT_PREAMBLE (1<<5)
  494. #define WLAN_CAPABILITY_SHORT_SLOT_TIME (1<<10)
  495. #define RTLLIB_STATMASK_SIGNAL (1<<0)
  496. #define RTLLIB_STATMASK_RSSI (1<<1)
  497. #define RTLLIB_STATMASK_NOISE (1<<2)
  498. #define RTLLIB_STATMASK_WEMASK 0x7
  499. #define RTLLIB_CCK_MODULATION (1<<0)
  500. #define RTLLIB_OFDM_MODULATION (1<<1)
  501. #define RTLLIB_24GHZ_BAND (1<<0)
  502. #define RTLLIB_52GHZ_BAND (1<<1)
  503. #define RTLLIB_CCK_RATE_LEN 4
  504. #define RTLLIB_CCK_RATE_1MB 0x02
  505. #define RTLLIB_CCK_RATE_2MB 0x04
  506. #define RTLLIB_CCK_RATE_5MB 0x0B
  507. #define RTLLIB_CCK_RATE_11MB 0x16
  508. #define RTLLIB_OFDM_RATE_LEN 8
  509. #define RTLLIB_OFDM_RATE_6MB 0x0C
  510. #define RTLLIB_OFDM_RATE_9MB 0x12
  511. #define RTLLIB_OFDM_RATE_12MB 0x18
  512. #define RTLLIB_OFDM_RATE_18MB 0x24
  513. #define RTLLIB_OFDM_RATE_24MB 0x30
  514. #define RTLLIB_OFDM_RATE_36MB 0x48
  515. #define RTLLIB_OFDM_RATE_48MB 0x60
  516. #define RTLLIB_OFDM_RATE_54MB 0x6C
  517. #define RTLLIB_BASIC_RATE_MASK 0x80
  518. /* this is stolen and modified from the madwifi driver*/
  519. #define RTLLIB_FC0_TYPE_MASK 0x0c
  520. #define RTLLIB_FC0_TYPE_DATA 0x08
  521. #define RTLLIB_FC0_SUBTYPE_MASK 0xB0
  522. #define RTLLIB_FC0_SUBTYPE_QOS 0x80
  523. #define RTLLIB_QOS_HAS_SEQ(fc) \
  524. (((fc) & (RTLLIB_FC0_TYPE_MASK | RTLLIB_FC0_SUBTYPE_MASK)) == \
  525. (RTLLIB_FC0_TYPE_DATA | RTLLIB_FC0_SUBTYPE_QOS))
  526. /* this is stolen from ipw2200 driver */
  527. #define IEEE_IBSS_MAC_HASH_SIZE 31
  528. struct ieee_ibss_seq {
  529. u8 mac[ETH_ALEN];
  530. u16 seq_num[17];
  531. u16 frag_num[17];
  532. unsigned long packet_time[17];
  533. struct list_head list;
  534. };
  535. /* NOTE: This data is for statistical purposes; not all hardware provides this
  536. * information for frames received. Not setting these will not cause
  537. * any adverse affects. */
  538. struct rtllib_rx_stats {
  539. u64 mac_time;
  540. s8 rssi;
  541. u8 signal;
  542. u8 noise;
  543. u16 rate; /* in 100 kbps */
  544. u8 received_channel;
  545. u8 control;
  546. u8 mask;
  547. u8 freq;
  548. u16 len;
  549. u64 tsf;
  550. u32 beacon_time;
  551. u8 nic_type;
  552. u16 Length;
  553. u8 SignalQuality;
  554. s32 RecvSignalPower;
  555. s8 RxPower;
  556. u8 SignalStrength;
  557. u16 bHwError:1;
  558. u16 bCRC:1;
  559. u16 bICV:1;
  560. u16 bShortPreamble:1;
  561. u16 Antenna:1;
  562. u16 Decrypted:1;
  563. u16 Wakeup:1;
  564. u16 Reserved0:1;
  565. u8 AGC;
  566. u32 TimeStampLow;
  567. u32 TimeStampHigh;
  568. bool bShift;
  569. bool bIsQosData;
  570. u8 RxDrvInfoSize;
  571. u8 RxBufShift;
  572. bool bIsAMPDU;
  573. bool bFirstMPDU;
  574. bool bContainHTC;
  575. bool RxIs40MHzPacket;
  576. u32 RxPWDBAll;
  577. u8 RxMIMOSignalStrength[4];
  578. s8 RxMIMOSignalQuality[2];
  579. bool bPacketMatchBSSID;
  580. bool bIsCCK;
  581. bool bPacketToSelf;
  582. u16 packetlength;
  583. u16 fraglength;
  584. u16 fragoffset;
  585. u16 ntotalfrag;
  586. bool bPacketBeacon;
  587. bool bToSelfBA;
  588. u16 Seq_Num;
  589. };
  590. /* IEEE 802.11 requires that STA supports concurrent reception of at least
  591. * three fragmented frames. This define can be increased to support more
  592. * concurrent frames, but it should be noted that each entry can consume about
  593. * 2 kB of RAM and increasing cache size will slow down frame reassembly.
  594. */
  595. #define RTLLIB_FRAG_CACHE_LEN 4
  596. struct rtllib_frag_entry {
  597. unsigned long first_frag_time;
  598. unsigned int seq;
  599. unsigned int last_frag;
  600. struct sk_buff *skb;
  601. u8 src_addr[ETH_ALEN];
  602. u8 dst_addr[ETH_ALEN];
  603. };
  604. struct rtllib_device;
  605. #define SEC_ACTIVE_KEY (1<<4)
  606. #define SEC_AUTH_MODE (1<<5)
  607. #define SEC_UNICAST_GROUP (1<<6)
  608. #define SEC_LEVEL (1<<7)
  609. #define SEC_ENABLED (1<<8)
  610. #define SEC_LEVEL_0 0 /* None */
  611. #define SEC_LEVEL_1 1 /* WEP 40 and 104 bit */
  612. #define SEC_LEVEL_2 2 /* Level 1 + TKIP */
  613. #define SEC_LEVEL_2_CKIP 3 /* Level 1 + CKIP */
  614. #define SEC_LEVEL_3 4 /* Level 2 + CCMP */
  615. #define SEC_ALG_NONE 0
  616. #define SEC_ALG_WEP 1
  617. #define SEC_ALG_TKIP 2
  618. #define SEC_ALG_CCMP 4
  619. #define WEP_KEY_LEN 13
  620. #define SCM_KEY_LEN 32
  621. struct rtllib_security {
  622. u16 active_key:2,
  623. enabled:1,
  624. auth_mode:2,
  625. auth_algo:4,
  626. unicast_uses_group:1,
  627. encrypt:1;
  628. u8 key_sizes[NUM_WEP_KEYS];
  629. u8 keys[NUM_WEP_KEYS][SCM_KEY_LEN];
  630. u8 level;
  631. u16 flags;
  632. } __packed;
  633. /* 802.11 data frame from AP
  634. * ,-------------------------------------------------------------------.
  635. * Bytes | 2 | 2 | 6 | 6 | 6 | 2 | 0..2312 | 4 |
  636. * |------|------|---------|---------|---------|------|---------|------|
  637. * Desc. | ctrl | dura | DA/RA | TA | SA | Sequ | frame | fcs |
  638. * | | tion | (BSSID) | | | ence | data | |
  639. * `-------------------------------------------------------------------'
  640. * Total: 28-2340 bytes
  641. */
  642. /* Management Frame Information Element Types */
  643. enum rtllib_mfie {
  644. MFIE_TYPE_SSID = 0,
  645. MFIE_TYPE_RATES = 1,
  646. MFIE_TYPE_FH_SET = 2,
  647. MFIE_TYPE_DS_SET = 3,
  648. MFIE_TYPE_CF_SET = 4,
  649. MFIE_TYPE_TIM = 5,
  650. MFIE_TYPE_IBSS_SET = 6,
  651. MFIE_TYPE_COUNTRY = 7,
  652. MFIE_TYPE_HOP_PARAMS = 8,
  653. MFIE_TYPE_HOP_TABLE = 9,
  654. MFIE_TYPE_REQUEST = 10,
  655. MFIE_TYPE_CHALLENGE = 16,
  656. MFIE_TYPE_POWER_CONSTRAINT = 32,
  657. MFIE_TYPE_POWER_CAPABILITY = 33,
  658. MFIE_TYPE_TPC_REQUEST = 34,
  659. MFIE_TYPE_TPC_REPORT = 35,
  660. MFIE_TYPE_SUPP_CHANNELS = 36,
  661. MFIE_TYPE_CSA = 37,
  662. MFIE_TYPE_MEASURE_REQUEST = 38,
  663. MFIE_TYPE_MEASURE_REPORT = 39,
  664. MFIE_TYPE_QUIET = 40,
  665. MFIE_TYPE_IBSS_DFS = 41,
  666. MFIE_TYPE_ERP = 42,
  667. MFIE_TYPE_HT_CAP = 45,
  668. MFIE_TYPE_RSN = 48,
  669. MFIE_TYPE_RATES_EX = 50,
  670. MFIE_TYPE_HT_INFO = 61,
  671. MFIE_TYPE_AIRONET = 133,
  672. MFIE_TYPE_GENERIC = 221,
  673. MFIE_TYPE_QOS_PARAMETER = 222,
  674. };
  675. /* Minimal header; can be used for passing 802.11 frames with sufficient
  676. * information to determine what type of underlying data type is actually
  677. * stored in the data.
  678. */
  679. struct rtllib_pspoll_hdr {
  680. __le16 frame_ctl;
  681. __le16 aid;
  682. u8 bssid[ETH_ALEN];
  683. u8 ta[ETH_ALEN];
  684. } __packed;
  685. struct rtllib_hdr {
  686. __le16 frame_ctl;
  687. __le16 duration_id;
  688. u8 payload[0];
  689. } __packed;
  690. struct rtllib_hdr_1addr {
  691. __le16 frame_ctl;
  692. __le16 duration_id;
  693. u8 addr1[ETH_ALEN];
  694. u8 payload[0];
  695. } __packed;
  696. struct rtllib_hdr_2addr {
  697. __le16 frame_ctl;
  698. __le16 duration_id;
  699. u8 addr1[ETH_ALEN];
  700. u8 addr2[ETH_ALEN];
  701. u8 payload[0];
  702. } __packed;
  703. struct rtllib_hdr_3addr {
  704. __le16 frame_ctl;
  705. __le16 duration_id;
  706. u8 addr1[ETH_ALEN];
  707. u8 addr2[ETH_ALEN];
  708. u8 addr3[ETH_ALEN];
  709. __le16 seq_ctl;
  710. u8 payload[0];
  711. } __packed;
  712. struct rtllib_hdr_4addr {
  713. __le16 frame_ctl;
  714. __le16 duration_id;
  715. u8 addr1[ETH_ALEN];
  716. u8 addr2[ETH_ALEN];
  717. u8 addr3[ETH_ALEN];
  718. __le16 seq_ctl;
  719. u8 addr4[ETH_ALEN];
  720. u8 payload[0];
  721. } __packed;
  722. struct rtllib_hdr_3addrqos {
  723. __le16 frame_ctl;
  724. __le16 duration_id;
  725. u8 addr1[ETH_ALEN];
  726. u8 addr2[ETH_ALEN];
  727. u8 addr3[ETH_ALEN];
  728. __le16 seq_ctl;
  729. __le16 qos_ctl;
  730. u8 payload[0];
  731. } __packed;
  732. struct rtllib_hdr_4addrqos {
  733. __le16 frame_ctl;
  734. __le16 duration_id;
  735. u8 addr1[ETH_ALEN];
  736. u8 addr2[ETH_ALEN];
  737. u8 addr3[ETH_ALEN];
  738. __le16 seq_ctl;
  739. u8 addr4[ETH_ALEN];
  740. __le16 qos_ctl;
  741. u8 payload[0];
  742. } __packed;
  743. struct rtllib_info_element {
  744. u8 id;
  745. u8 len;
  746. u8 data[0];
  747. } __packed;
  748. struct rtllib_authentication {
  749. struct rtllib_hdr_3addr header;
  750. __le16 algorithm;
  751. __le16 transaction;
  752. __le16 status;
  753. /*challenge*/
  754. struct rtllib_info_element info_element[0];
  755. } __packed;
  756. struct rtllib_disauth {
  757. struct rtllib_hdr_3addr header;
  758. __le16 reason;
  759. } __packed;
  760. struct rtllib_disassoc {
  761. struct rtllib_hdr_3addr header;
  762. __le16 reason;
  763. } __packed;
  764. struct rtllib_probe_request {
  765. struct rtllib_hdr_3addr header;
  766. /* SSID, supported rates */
  767. struct rtllib_info_element info_element[0];
  768. } __packed;
  769. struct rtllib_probe_response {
  770. struct rtllib_hdr_3addr header;
  771. u32 time_stamp[2];
  772. __le16 beacon_interval;
  773. __le16 capability;
  774. /* SSID, supported rates, FH params, DS params,
  775. * CF params, IBSS params, TIM (if beacon), RSN
  776. */
  777. struct rtllib_info_element info_element[0];
  778. } __packed;
  779. /* Alias beacon for probe_response */
  780. #define rtllib_beacon rtllib_probe_response
  781. struct rtllib_assoc_request_frame {
  782. struct rtllib_hdr_3addr header;
  783. __le16 capability;
  784. __le16 listen_interval;
  785. /* SSID, supported rates, RSN */
  786. struct rtllib_info_element info_element[0];
  787. } __packed;
  788. struct rtllib_assoc_response_frame {
  789. struct rtllib_hdr_3addr header;
  790. __le16 capability;
  791. __le16 status;
  792. __le16 aid;
  793. struct rtllib_info_element info_element[0]; /* supported rates */
  794. } __packed;
  795. struct rtllib_txb {
  796. u8 nr_frags;
  797. u8 encrypted;
  798. u8 queue_index;
  799. u8 rts_included;
  800. u16 reserved;
  801. __le16 frag_size;
  802. __le16 payload_size;
  803. struct sk_buff *fragments[0];
  804. };
  805. #define MAX_SUBFRAME_COUNT 64
  806. struct rtllib_rxb {
  807. u8 nr_subframes;
  808. struct sk_buff *subframes[MAX_SUBFRAME_COUNT];
  809. u8 dst[ETH_ALEN];
  810. u8 src[ETH_ALEN];
  811. } __packed;
  812. union frameqos {
  813. u16 shortdata;
  814. u8 chardata[2];
  815. struct {
  816. u16 tid:4;
  817. u16 eosp:1;
  818. u16 ack_policy:2;
  819. u16 reserved:1;
  820. u16 txop:8;
  821. } field;
  822. };
  823. /* MAX_RATES_LENGTH needs to be 12. The spec says 8, and many APs
  824. * only use 8, and then use extended rates for the remaining supported
  825. * rates. Other APs, however, stick all of their supported rates on the
  826. * main rates information element...
  827. */
  828. #define MAX_RATES_LENGTH ((u8)12)
  829. #define MAX_RATES_EX_LENGTH ((u8)16)
  830. #define MAX_NETWORK_COUNT 96
  831. #define MAX_CHANNEL_NUMBER 161
  832. #define RTLLIB_SOFTMAC_SCAN_TIME 100
  833. #define RTLLIB_SOFTMAC_ASSOC_RETRY_TIME (HZ * 2)
  834. #define MAX_WPA_IE_LEN 64
  835. #define MAX_WZC_IE_LEN 256
  836. #define NETWORK_EMPTY_ESSID (1<<0)
  837. #define NETWORK_HAS_OFDM (1<<1)
  838. #define NETWORK_HAS_CCK (1<<2)
  839. /* QoS structure */
  840. #define NETWORK_HAS_QOS_PARAMETERS (1<<3)
  841. #define NETWORK_HAS_QOS_INFORMATION (1<<4)
  842. #define NETWORK_HAS_QOS_MASK (NETWORK_HAS_QOS_PARAMETERS | \
  843. NETWORK_HAS_QOS_INFORMATION)
  844. /* 802.11h */
  845. #define NETWORK_HAS_ERP_VALUE (1<<10)
  846. #define QOS_QUEUE_NUM 4
  847. #define QOS_OUI_LEN 3
  848. #define QOS_OUI_TYPE 2
  849. #define QOS_ELEMENT_ID 221
  850. #define QOS_OUI_INFO_SUB_TYPE 0
  851. #define QOS_OUI_PARAM_SUB_TYPE 1
  852. #define QOS_VERSION_1 1
  853. struct rtllib_qos_information_element {
  854. u8 elementID;
  855. u8 length;
  856. u8 qui[QOS_OUI_LEN];
  857. u8 qui_type;
  858. u8 qui_subtype;
  859. u8 version;
  860. u8 ac_info;
  861. } __packed;
  862. struct rtllib_qos_ac_parameter {
  863. u8 aci_aifsn;
  864. u8 ecw_min_max;
  865. __le16 tx_op_limit;
  866. } __packed;
  867. struct rtllib_qos_parameter_info {
  868. struct rtllib_qos_information_element info_element;
  869. u8 reserved;
  870. struct rtllib_qos_ac_parameter ac_params_record[QOS_QUEUE_NUM];
  871. } __packed;
  872. struct rtllib_qos_parameters {
  873. __le16 cw_min[QOS_QUEUE_NUM];
  874. __le16 cw_max[QOS_QUEUE_NUM];
  875. u8 aifs[QOS_QUEUE_NUM];
  876. u8 flag[QOS_QUEUE_NUM];
  877. __le16 tx_op_limit[QOS_QUEUE_NUM];
  878. } __packed;
  879. struct rtllib_qos_data {
  880. struct rtllib_qos_parameters parameters;
  881. unsigned int wmm_acm;
  882. int active;
  883. int supported;
  884. u8 param_count;
  885. u8 old_param_count;
  886. };
  887. struct rtllib_tim_parameters {
  888. u8 tim_count;
  889. u8 tim_period;
  890. } __packed;
  891. struct rtllib_wmm_ac_param {
  892. u8 ac_aci_acm_aifsn;
  893. u8 ac_ecwmin_ecwmax;
  894. u16 ac_txop_limit;
  895. };
  896. enum eap_type {
  897. EAP_PACKET = 0,
  898. EAPOL_START,
  899. EAPOL_LOGOFF,
  900. EAPOL_KEY,
  901. EAPOL_ENCAP_ASF_ALERT
  902. };
  903. static const char * const eap_types[] = {
  904. [EAP_PACKET] = "EAP-Packet",
  905. [EAPOL_START] = "EAPOL-Start",
  906. [EAPOL_LOGOFF] = "EAPOL-Logoff",
  907. [EAPOL_KEY] = "EAPOL-Key",
  908. [EAPOL_ENCAP_ASF_ALERT] = "EAPOL-Encap-ASF-Alert"
  909. };
  910. static inline const char *eap_get_type(int type)
  911. {
  912. return ((u32)type >= ARRAY_SIZE(eap_types)) ? "Unknown" :
  913. eap_types[type];
  914. }
  915. static inline u8 Frame_QoSTID(u8 *buf)
  916. {
  917. struct rtllib_hdr_3addr *hdr;
  918. u16 fc;
  919. hdr = (struct rtllib_hdr_3addr *)buf;
  920. fc = le16_to_cpu(hdr->frame_ctl);
  921. return (u8)((union frameqos *)(buf + (((fc & RTLLIB_FCTL_TODS) &&
  922. (fc & RTLLIB_FCTL_FROMDS)) ? 30 : 24)))->field.tid;
  923. }
  924. struct eapol {
  925. u8 snap[6];
  926. u16 ethertype;
  927. u8 version;
  928. u8 type;
  929. u16 length;
  930. } __packed;
  931. struct rtllib_softmac_stats {
  932. unsigned int rx_ass_ok;
  933. unsigned int rx_ass_err;
  934. unsigned int rx_probe_rq;
  935. unsigned int tx_probe_rs;
  936. unsigned int tx_beacons;
  937. unsigned int rx_auth_rq;
  938. unsigned int rx_auth_rs_ok;
  939. unsigned int rx_auth_rs_err;
  940. unsigned int tx_auth_rq;
  941. unsigned int no_auth_rs;
  942. unsigned int no_ass_rs;
  943. unsigned int tx_ass_rq;
  944. unsigned int rx_ass_rq;
  945. unsigned int tx_probe_rq;
  946. unsigned int reassoc;
  947. unsigned int swtxstop;
  948. unsigned int swtxawake;
  949. unsigned char CurrentShowTxate;
  950. unsigned char last_packet_rate;
  951. unsigned int txretrycount;
  952. };
  953. /* These are the data types that can make up management packets
  954. *
  955. * u16 auth_algorithm;
  956. * u16 auth_sequence;
  957. * u16 beacon_interval;
  958. * u16 capability;
  959. * u8 current_ap[ETH_ALEN];
  960. * u16 listen_interval;
  961. * struct {
  962. * u16 association_id:14, reserved:2;
  963. * } __packed;
  964. * u32 time_stamp[2];
  965. * u16 reason;
  966. * u16 status;
  967. */
  968. #define RTLLIB_DEFAULT_TX_ESSID "Penguin"
  969. #define RTLLIB_DEFAULT_BASIC_RATE 2
  970. enum {WMM_all_frame, WMM_two_frame, WMM_four_frame, WMM_six_frame};
  971. #define MAX_SP_Len (WMM_all_frame << 4)
  972. #define RTLLIB_QOS_TID 0x0f
  973. #define QOS_CTL_NOTCONTAIN_ACK (0x01 << 5)
  974. #define RTLLIB_DTIM_MBCAST 4
  975. #define RTLLIB_DTIM_UCAST 2
  976. #define RTLLIB_DTIM_VALID 1
  977. #define RTLLIB_DTIM_INVALID 0
  978. #define RTLLIB_PS_DISABLED 0
  979. #define RTLLIB_PS_UNICAST RTLLIB_DTIM_UCAST
  980. #define RTLLIB_PS_MBCAST RTLLIB_DTIM_MBCAST
  981. #define WME_AC_BK 0x00
  982. #define WME_AC_BE 0x01
  983. #define WME_AC_VI 0x02
  984. #define WME_AC_VO 0x03
  985. #define WME_AC_PRAM_LEN 16
  986. #define MAX_RECEIVE_BUFFER_SIZE 9100
  987. #define UP2AC(up) ( \
  988. ((up) < 1) ? WME_AC_BE : \
  989. ((up) < 3) ? WME_AC_BK : \
  990. ((up) < 4) ? WME_AC_BE : \
  991. ((up) < 6) ? WME_AC_VI : \
  992. WME_AC_VO)
  993. #define ETHER_ADDR_LEN 6 /* length of an Ethernet address */
  994. #define ETHERNET_HEADER_SIZE 14 /* length of two Ethernet address
  995. * plus ether type*/
  996. enum erp_t {
  997. ERP_NonERPpresent = 0x01,
  998. ERP_UseProtection = 0x02,
  999. ERP_BarkerPreambleMode = 0x04,
  1000. };
  1001. struct rtllib_network {
  1002. /* These entries are used to identify a unique network */
  1003. u8 bssid[ETH_ALEN];
  1004. u8 channel;
  1005. /* Ensure null-terminated for any debug msgs */
  1006. u8 ssid[IW_ESSID_MAX_SIZE + 1];
  1007. u8 ssid_len;
  1008. u8 hidden_ssid[IW_ESSID_MAX_SIZE + 1];
  1009. u8 hidden_ssid_len;
  1010. struct rtllib_qos_data qos_data;
  1011. bool bWithAironetIE;
  1012. bool bCkipSupported;
  1013. bool bCcxRmEnable;
  1014. u16 CcxRmState[2];
  1015. bool bMBssidValid;
  1016. u8 MBssidMask;
  1017. u8 MBssid[ETH_ALEN];
  1018. bool bWithCcxVerNum;
  1019. u8 BssCcxVerNumber;
  1020. /* These are network statistics */
  1021. struct rtllib_rx_stats stats;
  1022. u16 capability;
  1023. u8 rates[MAX_RATES_LENGTH];
  1024. u8 rates_len;
  1025. u8 rates_ex[MAX_RATES_EX_LENGTH];
  1026. u8 rates_ex_len;
  1027. unsigned long last_scanned;
  1028. u8 mode;
  1029. u32 flags;
  1030. u32 time_stamp[2];
  1031. u16 beacon_interval;
  1032. u16 listen_interval;
  1033. u16 atim_window;
  1034. u8 erp_value;
  1035. u8 wpa_ie[MAX_WPA_IE_LEN];
  1036. size_t wpa_ie_len;
  1037. u8 rsn_ie[MAX_WPA_IE_LEN];
  1038. size_t rsn_ie_len;
  1039. u8 wzc_ie[MAX_WZC_IE_LEN];
  1040. size_t wzc_ie_len;
  1041. struct rtllib_tim_parameters tim;
  1042. u8 dtim_period;
  1043. u8 dtim_data;
  1044. u64 last_dtim_sta_time;
  1045. u8 wmm_info;
  1046. struct rtllib_wmm_ac_param wmm_param[4];
  1047. u8 Turbo_Enable;
  1048. u16 CountryIeLen;
  1049. u8 CountryIeBuf[MAX_IE_LEN];
  1050. struct bss_ht bssht;
  1051. bool broadcom_cap_exist;
  1052. bool realtek_cap_exit;
  1053. bool marvell_cap_exist;
  1054. bool ralink_cap_exist;
  1055. bool atheros_cap_exist;
  1056. bool cisco_cap_exist;
  1057. bool airgo_cap_exist;
  1058. bool unknown_cap_exist;
  1059. bool berp_info_valid;
  1060. bool buseprotection;
  1061. u8 SignalStrength;
  1062. u8 RSSI;
  1063. struct list_head list;
  1064. };
  1065. enum rtllib_state {
  1066. /* the card is not linked at all */
  1067. RTLLIB_NOLINK = 0,
  1068. /* RTLLIB_ASSOCIATING* are for BSS client mode
  1069. * the driver shall not perform RX filtering unless
  1070. * the state is LINKED.
  1071. * The driver shall just check for the state LINKED and
  1072. * defaults to NOLINK for ALL the other states (including
  1073. * LINKED_SCANNING)
  1074. */
  1075. /* the association procedure will start (wq scheduling)*/
  1076. RTLLIB_ASSOCIATING,
  1077. RTLLIB_ASSOCIATING_RETRY,
  1078. /* the association procedure is sending AUTH request*/
  1079. RTLLIB_ASSOCIATING_AUTHENTICATING,
  1080. /* the association procedure has successfully authenticated
  1081. * and is sending association request
  1082. */
  1083. RTLLIB_ASSOCIATING_AUTHENTICATED,
  1084. /* the link is ok. the card associated to a BSS or linked
  1085. * to a ibss cell or acting as an AP and creating the bss
  1086. */
  1087. RTLLIB_LINKED,
  1088. /* same as LINKED, but the driver shall apply RX filter
  1089. * rules as we are in NO_LINK mode. As the card is still
  1090. * logically linked, but it is doing a syncro site survey
  1091. * then it will be back to LINKED state.
  1092. */
  1093. RTLLIB_LINKED_SCANNING,
  1094. };
  1095. #define DEFAULT_MAX_SCAN_AGE (15 * HZ)
  1096. #define DEFAULT_FTS 2346
  1097. #define CFG_RTLLIB_RESERVE_FCS (1<<0)
  1098. #define CFG_RTLLIB_COMPUTE_FCS (1<<1)
  1099. struct tx_pending {
  1100. int frag;
  1101. struct rtllib_txb *txb;
  1102. };
  1103. struct bandwidth_autoswitch {
  1104. long threshold_20Mhzto40Mhz;
  1105. long threshold_40Mhzto20Mhz;
  1106. bool bforced_tx20Mhz;
  1107. bool bautoswitch_enable;
  1108. };
  1109. #define REORDER_WIN_SIZE 128
  1110. #define REORDER_ENTRY_NUM 128
  1111. struct rx_reorder_entry {
  1112. struct list_head List;
  1113. u16 SeqNum;
  1114. struct rtllib_rxb *prxb;
  1115. };
  1116. enum fsync_state {
  1117. Default_Fsync,
  1118. HW_Fsync,
  1119. SW_Fsync
  1120. };
  1121. enum rt_ps_mode {
  1122. eActive,
  1123. eMaxPs,
  1124. eFastPs,
  1125. eAutoPs,
  1126. };
  1127. enum ips_callback_function {
  1128. IPS_CALLBACK_NONE = 0,
  1129. IPS_CALLBACK_MGNT_LINK_REQUEST = 1,
  1130. IPS_CALLBACK_JOIN_REQUEST = 2,
  1131. };
  1132. enum rt_rf_power_state {
  1133. eRfOn,
  1134. eRfSleep,
  1135. eRfOff
  1136. };
  1137. struct rt_pwr_save_ctrl {
  1138. bool bInactivePs;
  1139. bool bIPSModeBackup;
  1140. bool bSwRfProcessing;
  1141. enum rt_rf_power_state eInactivePowerState;
  1142. enum ips_callback_function ReturnPoint;
  1143. bool bLeisurePs;
  1144. u8 LpsIdleCount;
  1145. u8 RegMaxLPSAwakeIntvl;
  1146. u8 LPSAwakeIntvl;
  1147. u32 CurPsLevel;
  1148. u32 RegRfPsLevel;
  1149. bool bFwCtrlLPS;
  1150. };
  1151. #define RT_RF_CHANGE_SOURCE u32
  1152. #define RF_CHANGE_BY_SW BIT31
  1153. #define RF_CHANGE_BY_HW BIT30
  1154. #define RF_CHANGE_BY_PS BIT29
  1155. #define RF_CHANGE_BY_IPS BIT28
  1156. #define RF_CHANGE_BY_INIT 0
  1157. enum country_code_type {
  1158. COUNTRY_CODE_FCC = 0,
  1159. COUNTRY_CODE_IC = 1,
  1160. COUNTRY_CODE_ETSI = 2,
  1161. COUNTRY_CODE_SPAIN = 3,
  1162. COUNTRY_CODE_FRANCE = 4,
  1163. COUNTRY_CODE_MKK = 5,
  1164. COUNTRY_CODE_MKK1 = 6,
  1165. COUNTRY_CODE_ISRAEL = 7,
  1166. COUNTRY_CODE_TELEC = 8,
  1167. COUNTRY_CODE_MIC = 9,
  1168. COUNTRY_CODE_GLOBAL_DOMAIN = 10,
  1169. COUNTRY_CODE_WORLD_WIDE_13 = 11,
  1170. COUNTRY_CODE_TELEC_NETGEAR = 12,
  1171. COUNTRY_CODE_MAX
  1172. };
  1173. enum scan_op_backup_opt {
  1174. SCAN_OPT_BACKUP = 0,
  1175. SCAN_OPT_RESTORE,
  1176. SCAN_OPT_MAX
  1177. };
  1178. enum fw_cmd_io_type {
  1179. FW_CMD_DIG_ENABLE = 0,
  1180. FW_CMD_DIG_DISABLE = 1,
  1181. FW_CMD_DIG_HALT = 2,
  1182. FW_CMD_DIG_RESUME = 3,
  1183. FW_CMD_HIGH_PWR_ENABLE = 4,
  1184. FW_CMD_HIGH_PWR_DISABLE = 5,
  1185. FW_CMD_RA_RESET = 6,
  1186. FW_CMD_RA_ACTIVE = 7,
  1187. FW_CMD_RA_REFRESH_N = 8,
  1188. FW_CMD_RA_REFRESH_BG = 9,
  1189. FW_CMD_RA_INIT = 10,
  1190. FW_CMD_IQK_ENABLE = 11,
  1191. FW_CMD_TXPWR_TRACK_ENABLE = 12,
  1192. FW_CMD_TXPWR_TRACK_DISABLE = 13,
  1193. FW_CMD_TXPWR_TRACK_THERMAL = 14,
  1194. FW_CMD_PAUSE_DM_BY_SCAN = 15,
  1195. FW_CMD_RESUME_DM_BY_SCAN = 16,
  1196. FW_CMD_RA_REFRESH_N_COMB = 17,
  1197. FW_CMD_RA_REFRESH_BG_COMB = 18,
  1198. FW_CMD_ANTENNA_SW_ENABLE = 19,
  1199. FW_CMD_ANTENNA_SW_DISABLE = 20,
  1200. FW_CMD_TX_FEEDBACK_CCX_ENABLE = 21,
  1201. FW_CMD_LPS_ENTER = 22,
  1202. FW_CMD_LPS_LEAVE = 23,
  1203. };
  1204. #define RT_MAX_LD_SLOT_NUM 10
  1205. struct rt_link_detect {
  1206. u32 NumRecvBcnInPeriod;
  1207. u32 NumRecvDataInPeriod;
  1208. u32 RxBcnNum[RT_MAX_LD_SLOT_NUM];
  1209. u32 RxDataNum[RT_MAX_LD_SLOT_NUM];
  1210. u16 SlotNum;
  1211. u16 SlotIndex;
  1212. u32 NumTxOkInPeriod;
  1213. u32 NumRxOkInPeriod;
  1214. u32 NumRxUnicastOkInPeriod;
  1215. bool bBusyTraffic;
  1216. bool bHigherBusyTraffic;
  1217. bool bHigherBusyRxTraffic;
  1218. };
  1219. struct sw_cam_table {
  1220. u8 macaddr[ETH_ALEN];
  1221. bool bused;
  1222. u8 key_buf[16];
  1223. u16 key_type;
  1224. u8 useDK;
  1225. u8 key_index;
  1226. };
  1227. #define TOTAL_CAM_ENTRY 32
  1228. struct rate_adaptive {
  1229. u8 rate_adaptive_disabled;
  1230. u8 ratr_state;
  1231. u16 reserve;
  1232. u32 high_rssi_thresh_for_ra;
  1233. u32 high2low_rssi_thresh_for_ra;
  1234. u8 low2high_rssi_thresh_for_ra40M;
  1235. u32 low_rssi_thresh_for_ra40M;
  1236. u8 low2high_rssi_thresh_for_ra20M;
  1237. u32 low_rssi_thresh_for_ra20M;
  1238. u32 upper_rssi_threshold_ratr;
  1239. u32 middle_rssi_threshold_ratr;
  1240. u32 low_rssi_threshold_ratr;
  1241. u32 low_rssi_threshold_ratr_40M;
  1242. u32 low_rssi_threshold_ratr_20M;
  1243. u8 ping_rssi_enable;
  1244. u32 ping_rssi_ratr;
  1245. u32 ping_rssi_thresh_for_ra;
  1246. u32 last_ratr;
  1247. u8 PreRATRState;
  1248. };
  1249. #define NUM_PMKID_CACHE 16
  1250. struct rt_pmkid_list {
  1251. u8 Bssid[ETH_ALEN];
  1252. u8 PMKID[16];
  1253. u8 SsidBuf[33];
  1254. u8 bUsed;
  1255. };
  1256. struct rt_intel_promisc_mode {
  1257. bool bPromiscuousOn;
  1258. bool bFilterSourceStationFrame;
  1259. };
  1260. /*************** DRIVER STATUS *****/
  1261. #define STATUS_SCANNING 0
  1262. /*************** DRIVER STATUS *****/
  1263. enum {
  1264. LPS_IS_WAKE = 0,
  1265. LPS_IS_SLEEP = 1,
  1266. LPS_WAIT_NULL_DATA_SEND = 2,
  1267. };
  1268. struct rtllib_device {
  1269. struct pci_dev *pdev;
  1270. struct net_device *dev;
  1271. struct rtllib_security sec;
  1272. bool disable_mgnt_queue;
  1273. unsigned long status;
  1274. u8 CntAfterLink;
  1275. enum rt_op_mode OpMode;
  1276. /* The last AssocReq/Resp IEs */
  1277. u8 *assocreq_ies, *assocresp_ies;
  1278. size_t assocreq_ies_len, assocresp_ies_len;
  1279. bool bForcedBgMode;
  1280. u8 RF_Type;
  1281. u8 hwsec_active;
  1282. bool is_silent_reset;
  1283. bool is_roaming;
  1284. bool ieee_up;
  1285. bool cannot_notify;
  1286. bool bSupportRemoteWakeUp;
  1287. bool actscanning;
  1288. bool FirstIe_InScan;
  1289. bool be_scan_inprogress;
  1290. bool beinretry;
  1291. enum rt_rf_power_state eRFPowerState;
  1292. RT_RF_CHANGE_SOURCE RfOffReason;
  1293. bool is_set_key;
  1294. bool wx_set_enc;
  1295. struct rt_hi_throughput *pHTInfo;
  1296. spinlock_t reorder_spinlock;
  1297. u8 Regdot11HTOperationalRateSet[16];
  1298. u8 Regdot11TxHTOperationalRateSet[16];
  1299. u8 dot11HTOperationalRateSet[16];
  1300. u8 RegHTSuppRateSet[16];
  1301. u8 HTCurrentOperaRate;
  1302. u8 HTHighestOperaRate;
  1303. u8 bTxDisableRateFallBack;
  1304. u8 bTxUseDriverAssingedRate;
  1305. u8 bTxEnableFwCalcDur;
  1306. atomic_t atm_swbw;
  1307. struct list_head Tx_TS_Admit_List;
  1308. struct list_head Tx_TS_Pending_List;
  1309. struct list_head Tx_TS_Unused_List;
  1310. struct tx_ts_record TxTsRecord[TOTAL_TS_NUM];
  1311. struct list_head Rx_TS_Admit_List;
  1312. struct list_head Rx_TS_Pending_List;
  1313. struct list_head Rx_TS_Unused_List;
  1314. struct rx_ts_record RxTsRecord[TOTAL_TS_NUM];
  1315. struct rx_reorder_entry RxReorderEntry[128];
  1316. struct list_head RxReorder_Unused_List;
  1317. /* Bookkeeping structures */
  1318. struct net_device_stats stats;
  1319. struct rtllib_softmac_stats softmac_stats;
  1320. /* Probe / Beacon management */
  1321. struct list_head network_free_list;
  1322. struct list_head network_list;
  1323. struct rtllib_network *networks;
  1324. int scans;
  1325. int scan_age;
  1326. int iw_mode; /* operating mode (IW_MODE_*) */
  1327. bool bNetPromiscuousMode;
  1328. struct rt_intel_promisc_mode IntelPromiscuousModeInfo;
  1329. spinlock_t lock;
  1330. spinlock_t wpax_suitlist_lock;
  1331. int tx_headroom; /* Set to size of any additional room needed at front
  1332. * of allocated Tx SKBs
  1333. */
  1334. u32 config;
  1335. /* WEP and other encryption related settings at the device level */
  1336. int open_wep; /* Set to 1 to allow unencrypted frames */
  1337. int auth_mode;
  1338. int reset_on_keychange; /* Set to 1 if the HW needs to be reset on
  1339. * WEP key changes
  1340. */
  1341. /* If the host performs {en,de}cryption, then set to 1 */
  1342. int host_encrypt;
  1343. int host_decrypt;
  1344. int ieee802_1x; /* is IEEE 802.1X used */
  1345. /* WPA data */
  1346. bool bHalfWirelessN24GMode;
  1347. int wpa_enabled;
  1348. int drop_unencrypted;
  1349. int tkip_countermeasures;
  1350. int privacy_invoked;
  1351. size_t wpa_ie_len;
  1352. u8 *wpa_ie;
  1353. size_t wps_ie_len;
  1354. u8 *wps_ie;
  1355. u8 ap_mac_addr[ETH_ALEN];
  1356. u16 pairwise_key_type;
  1357. u16 group_key_type;
  1358. struct lib80211_crypt_info crypt_info;
  1359. struct sw_cam_table swcamtable[TOTAL_CAM_ENTRY];
  1360. struct rt_pmkid_list PMKIDList[NUM_PMKID_CACHE];
  1361. /* Fragmentation structures */
  1362. struct rtllib_frag_entry frag_cache[17][RTLLIB_FRAG_CACHE_LEN];
  1363. unsigned int frag_next_idx[17];
  1364. u16 fts; /* Fragmentation Threshold */
  1365. #define DEFAULT_RTS_THRESHOLD 2346U
  1366. #define MIN_RTS_THRESHOLD 1
  1367. #define MAX_RTS_THRESHOLD 2346U
  1368. u16 rts; /* RTS threshold */
  1369. /* Association info */
  1370. u8 bssid[ETH_ALEN];
  1371. /* This stores infos for the current network.
  1372. * Either the network we are associated in INFRASTRUCTURE
  1373. * or the network that we are creating in MASTER mode.
  1374. * ad-hoc is a mixture ;-).
  1375. * Note that in infrastructure mode, even when not associated,
  1376. * fields bssid and essid may be valid (if wpa_set and essid_set
  1377. * are true) as thy carry the value set by the user via iwconfig
  1378. */
  1379. struct rtllib_network current_network;
  1380. enum rtllib_state state;
  1381. int short_slot;
  1382. int mode; /* A, B, G */
  1383. int modulation; /* CCK, OFDM */
  1384. /* used for forcing the ibss workqueue to terminate
  1385. * without wait for the syncro scan to terminate
  1386. */
  1387. short sync_scan_hurryup;
  1388. u16 scan_watch_dog;
  1389. /* map of allowed channels. 0 is dummy */
  1390. void *pDot11dInfo;
  1391. bool bGlobalDomain;
  1392. u8 active_channel_map[MAX_CHANNEL_NUMBER+1];
  1393. u8 IbssStartChnl;
  1394. u8 ibss_maxjoin_chal;
  1395. int rate; /* current rate */
  1396. int basic_rate;
  1397. short active_scan;
  1398. /* this contains flags for selectively enable softmac support */
  1399. u16 softmac_features;
  1400. /* if the sequence control field is not filled by HW */
  1401. u16 seq_ctrl[5];
  1402. /* association procedure transaction sequence number */
  1403. u16 associate_seq;
  1404. /* AID for RTXed association responses */
  1405. u16 assoc_id;
  1406. /* power save mode related*/
  1407. u8 ack_tx_to_ieee;
  1408. short ps;
  1409. short sta_sleep;
  1410. int ps_timeout;
  1411. int ps_period;
  1412. struct tasklet_struct ps_task;
  1413. u64 ps_time;
  1414. bool polling;
  1415. short raw_tx;
  1416. /* used if IEEE_SOFTMAC_TX_QUEUE is set */
  1417. short queue_stop;
  1418. short scanning_continue;
  1419. short proto_started;
  1420. short proto_stoppping;
  1421. struct semaphore wx_sem;
  1422. struct semaphore scan_sem;
  1423. struct semaphore ips_sem;
  1424. spinlock_t mgmt_tx_lock;
  1425. spinlock_t beacon_lock;
  1426. short beacon_txing;
  1427. short wap_set;
  1428. short ssid_set;
  1429. /* set on initialization */
  1430. unsigned int wmm_acm;
  1431. /* for discarding duplicated packets in IBSS */
  1432. struct list_head ibss_mac_hash[IEEE_IBSS_MAC_HASH_SIZE];
  1433. /* for discarding duplicated packets in BSS */
  1434. u16 last_rxseq_num[17]; /* rx seq previous per-tid */
  1435. u16 last_rxfrag_num[17];/* tx frag previous per-tid */
  1436. unsigned long last_packet_time[17];
  1437. /* for PS mode */
  1438. unsigned long last_rx_ps_time;
  1439. bool bAwakePktSent;
  1440. u8 LPSDelayCnt;
  1441. /* used if IEEE_SOFTMAC_SINGLE_QUEUE is set */
  1442. struct sk_buff *mgmt_queue_ring[MGMT_QUEUE_NUM];
  1443. int mgmt_queue_head;
  1444. int mgmt_queue_tail;
  1445. u8 AsocRetryCount;
  1446. struct sk_buff_head skb_waitQ[MAX_QUEUE_SIZE];
  1447. struct sk_buff_head skb_aggQ[MAX_QUEUE_SIZE];
  1448. bool bdynamic_txpower_enable;
  1449. bool bCTSToSelfEnable;
  1450. u32 fsync_time_interval;
  1451. u32 fsync_rate_bitmap;
  1452. u8 fsync_rssi_threshold;
  1453. bool bfsync_enable;
  1454. u8 fsync_multiple_timeinterval;
  1455. u32 fsync_firstdiff_ratethreshold;
  1456. u32 fsync_seconddiff_ratethreshold;
  1457. enum fsync_state fsync_state;
  1458. bool bis_any_nonbepkts;
  1459. struct bandwidth_autoswitch bandwidth_auto_switch;
  1460. bool FwRWRF;
  1461. struct rt_link_detect LinkDetectInfo;
  1462. bool bIsAggregateFrame;
  1463. struct rt_pwr_save_ctrl PowerSaveControl;
  1464. /* used if IEEE_SOFTMAC_TX_QUEUE is set */
  1465. struct tx_pending tx_pending;
  1466. /* used if IEEE_SOFTMAC_ASSOCIATE is set */
  1467. struct timer_list associate_timer;
  1468. /* used if IEEE_SOFTMAC_BEACONS is set */
  1469. struct timer_list beacon_timer;
  1470. u8 need_sw_enc;
  1471. struct work_struct associate_complete_wq;
  1472. struct work_struct ips_leave_wq;
  1473. struct delayed_work associate_procedure_wq;
  1474. struct delayed_work softmac_scan_wq;
  1475. struct delayed_work associate_retry_wq;
  1476. struct delayed_work start_ibss_wq;
  1477. struct delayed_work hw_wakeup_wq;
  1478. struct delayed_work hw_sleep_wq;
  1479. struct delayed_work link_change_wq;
  1480. struct work_struct wx_sync_scan_wq;
  1481. struct workqueue_struct *wq;
  1482. union {
  1483. struct rtllib_rxb *RfdArray[REORDER_WIN_SIZE];
  1484. struct rtllib_rxb *stats_IndicateArray[REORDER_WIN_SIZE];
  1485. struct rtllib_rxb *prxbIndicateArray[REORDER_WIN_SIZE];
  1486. struct {
  1487. struct sw_chnl_cmd PreCommonCmd[MAX_PRECMD_CNT];
  1488. struct sw_chnl_cmd PostCommonCmd[MAX_POSTCMD_CNT];
  1489. struct sw_chnl_cmd RfDependCmd[MAX_RFDEPENDCMD_CNT];
  1490. };
  1491. };
  1492. /* Callback functions */
  1493. void (*set_security)(struct net_device *dev,
  1494. struct rtllib_security *sec);
  1495. /* Used to TX data frame by using txb structs.
  1496. * this is not used if in the softmac_features
  1497. * is set the flag IEEE_SOFTMAC_TX_QUEUE
  1498. */
  1499. int (*hard_start_xmit)(struct rtllib_txb *txb,
  1500. struct net_device *dev);
  1501. int (*reset_port)(struct net_device *dev);
  1502. /* Softmac-generated frames (management) are TXed via this
  1503. * callback if the flag IEEE_SOFTMAC_SINGLE_QUEUE is
  1504. * not set. As some cards may have different HW queues that
  1505. * one might want to use for data and management frames
  1506. * the option to have two callbacks might be useful.
  1507. * This function can't sleep.
  1508. */
  1509. int (*softmac_hard_start_xmit)(struct sk_buff *skb,
  1510. struct net_device *dev);
  1511. /* used instead of hard_start_xmit (not softmac_hard_start_xmit)
  1512. * if the IEEE_SOFTMAC_TX_QUEUE feature is used to TX data
  1513. * frames. If the option IEEE_SOFTMAC_SINGLE_QUEUE is also set
  1514. * then also management frames are sent via this callback.
  1515. * This function can't sleep.
  1516. */
  1517. void (*softmac_data_hard_start_xmit)(struct sk_buff *skb,
  1518. struct net_device *dev, int rate);
  1519. /* stops the HW queue for DATA frames. Useful to avoid
  1520. * waste time to TX data frame when we are reassociating
  1521. * This function can sleep.
  1522. */
  1523. void (*data_hard_stop)(struct net_device *dev);
  1524. /* OK this is complementing to data_poll_hard_stop */
  1525. void (*data_hard_resume)(struct net_device *dev);
  1526. /* ask to the driver to retune the radio.
  1527. * This function can sleep. the driver should ensure
  1528. * the radio has been switched before return.
  1529. */
  1530. void (*set_chan)(struct net_device *dev, short ch);
  1531. void (*rtllib_start_hw_scan)(struct net_device *dev);
  1532. void (*rtllib_stop_hw_scan)(struct net_device *dev);
  1533. /* indicate the driver that the link state is changed
  1534. * for example it may indicate the card is associated now.
  1535. * Driver might be interested in this to apply RX filter
  1536. * rules or simply light the LINK led
  1537. */
  1538. void (*link_change)(struct net_device *dev);
  1539. /* these two function indicates to the HW when to start
  1540. * and stop to send beacons. This is used when the
  1541. * IEEE_SOFTMAC_BEACONS is not set. For now the
  1542. * stop_send_bacons is NOT guaranteed to be called only
  1543. * after start_send_beacons.
  1544. */
  1545. void (*start_send_beacons)(struct net_device *dev);
  1546. void (*stop_send_beacons)(struct net_device *dev);
  1547. /* power save mode related */
  1548. void (*sta_wake_up)(struct net_device *dev);
  1549. void (*enter_sleep_state)(struct net_device *dev, u64 time);
  1550. short (*ps_is_queue_empty)(struct net_device *dev);
  1551. int (*handle_beacon)(struct net_device *dev,
  1552. struct rtllib_beacon *beacon,
  1553. struct rtllib_network *network);
  1554. int (*handle_assoc_response)(struct net_device *dev,
  1555. struct rtllib_assoc_response_frame *resp,
  1556. struct rtllib_network *network);
  1557. /* check whether Tx hw resource available */
  1558. short (*check_nic_enough_desc)(struct net_device *dev, int queue_index);
  1559. void (*SetBWModeHandler)(struct net_device *dev,
  1560. enum ht_channel_width Bandwidth,
  1561. enum ht_extchnl_offset Offset);
  1562. bool (*GetNmodeSupportBySecCfg)(struct net_device *dev);
  1563. void (*SetWirelessMode)(struct net_device *dev, u8 wireless_mode);
  1564. bool (*GetHalfNmodeSupportByAPsHandler)(struct net_device *dev);
  1565. u8 (*rtllib_ap_sec_type)(struct rtllib_device *ieee);
  1566. void (*InitialGainHandler)(struct net_device *dev, u8 Operation);
  1567. bool (*SetFwCmdHandler)(struct net_device *dev,
  1568. enum fw_cmd_io_type FwCmdIO);
  1569. void (*UpdateBeaconInterruptHandler)(struct net_device *dev,
  1570. bool start);
  1571. void (*ScanOperationBackupHandler)(struct net_device *dev,
  1572. u8 Operation);
  1573. void (*LedControlHandler)(struct net_device *dev,
  1574. enum led_ctl_mode LedAction);
  1575. void (*SetHwRegHandler)(struct net_device *dev, u8 variable, u8 *val);
  1576. void (*AllowAllDestAddrHandler)(struct net_device *dev,
  1577. bool bAllowAllDA, bool WriteIntoReg);
  1578. void (*rtllib_ips_leave_wq)(struct net_device *dev);
  1579. void (*rtllib_ips_leave)(struct net_device *dev);
  1580. void (*LeisurePSLeave)(struct net_device *dev);
  1581. /* This must be the last item so that it points to the data
  1582. * allocated beyond this structure by alloc_rtllib
  1583. */
  1584. u8 priv[0];
  1585. };
  1586. #define IEEE_A (1<<0)
  1587. #define IEEE_B (1<<1)
  1588. #define IEEE_G (1<<2)
  1589. #define IEEE_N_24G (1<<4)
  1590. #define IEEE_N_5G (1<<5)
  1591. #define IEEE_MODE_MASK (IEEE_A|IEEE_B|IEEE_G)
  1592. /* Generate a 802.11 header */
  1593. /* Uses the channel change callback directly
  1594. * instead of [start/stop] scan callbacks
  1595. */
  1596. #define IEEE_SOFTMAC_SCAN (1<<2)
  1597. /* Perform authentication and association handshake */
  1598. #define IEEE_SOFTMAC_ASSOCIATE (1<<3)
  1599. /* Generate probe requests */
  1600. #define IEEE_SOFTMAC_PROBERQ (1<<4)
  1601. /* Generate response to probe requests */
  1602. #define IEEE_SOFTMAC_PROBERS (1<<5)
  1603. /* The ieee802.11 stack will manage the netif queue
  1604. * wake/stop for the driver, taking care of 802.11
  1605. * fragmentation. See softmac.c for details.
  1606. */
  1607. #define IEEE_SOFTMAC_TX_QUEUE (1<<7)
  1608. /* Uses only the softmac_data_hard_start_xmit
  1609. * even for TX management frames.
  1610. */
  1611. #define IEEE_SOFTMAC_SINGLE_QUEUE (1<<8)
  1612. /* Generate beacons. The stack will enqueue beacons
  1613. * to the card
  1614. */
  1615. #define IEEE_SOFTMAC_BEACONS (1<<6)
  1616. static inline void *rtllib_priv(struct net_device *dev)
  1617. {
  1618. return ((struct rtllib_device *)netdev_priv(dev))->priv;
  1619. }
  1620. static inline int rtllib_is_empty_essid(const char *essid, int essid_len)
  1621. {
  1622. /* Single white space is for Linksys APs */
  1623. if (essid_len == 1 && essid[0] == ' ')
  1624. return 1;
  1625. /* Otherwise, if the entire essid is 0, we assume it is hidden */
  1626. while (essid_len) {
  1627. essid_len--;
  1628. if (essid[essid_len] != '\0')
  1629. return 0;
  1630. }
  1631. return 1;
  1632. }
  1633. static inline int rtllib_get_hdrlen(u16 fc)
  1634. {
  1635. int hdrlen = RTLLIB_3ADDR_LEN;
  1636. switch (WLAN_FC_GET_TYPE(fc)) {
  1637. case RTLLIB_FTYPE_DATA:
  1638. if ((fc & RTLLIB_FCTL_FROMDS) && (fc & RTLLIB_FCTL_TODS))
  1639. hdrlen = RTLLIB_4ADDR_LEN; /* Addr4 */
  1640. if (RTLLIB_QOS_HAS_SEQ(fc))
  1641. hdrlen += 2; /* QOS ctrl*/
  1642. break;
  1643. case RTLLIB_FTYPE_CTL:
  1644. switch (WLAN_FC_GET_STYPE(fc)) {
  1645. case RTLLIB_STYPE_CTS:
  1646. case RTLLIB_STYPE_ACK:
  1647. hdrlen = RTLLIB_1ADDR_LEN;
  1648. break;
  1649. default:
  1650. hdrlen = RTLLIB_2ADDR_LEN;
  1651. break;
  1652. }
  1653. break;
  1654. }
  1655. return hdrlen;
  1656. }
  1657. static inline u8 *rtllib_get_payload(struct rtllib_hdr *hdr)
  1658. {
  1659. switch (rtllib_get_hdrlen(le16_to_cpu(hdr->frame_ctl))) {
  1660. case RTLLIB_1ADDR_LEN:
  1661. return ((struct rtllib_hdr_1addr *)hdr)->payload;
  1662. case RTLLIB_2ADDR_LEN:
  1663. return ((struct rtllib_hdr_2addr *)hdr)->payload;
  1664. case RTLLIB_3ADDR_LEN:
  1665. return ((struct rtllib_hdr_3addr *)hdr)->payload;
  1666. case RTLLIB_4ADDR_LEN:
  1667. return ((struct rtllib_hdr_4addr *)hdr)->payload;
  1668. }
  1669. return NULL;
  1670. }
  1671. static inline int rtllib_is_ofdm_rate(u8 rate)
  1672. {
  1673. switch (rate & ~RTLLIB_BASIC_RATE_MASK) {
  1674. case RTLLIB_OFDM_RATE_6MB:
  1675. case RTLLIB_OFDM_RATE_9MB:
  1676. case RTLLIB_OFDM_RATE_12MB:
  1677. case RTLLIB_OFDM_RATE_18MB:
  1678. case RTLLIB_OFDM_RATE_24MB:
  1679. case RTLLIB_OFDM_RATE_36MB:
  1680. case RTLLIB_OFDM_RATE_48MB:
  1681. case RTLLIB_OFDM_RATE_54MB:
  1682. return 1;
  1683. }
  1684. return 0;
  1685. }
  1686. static inline int rtllib_is_cck_rate(u8 rate)
  1687. {
  1688. switch (rate & ~RTLLIB_BASIC_RATE_MASK) {
  1689. case RTLLIB_CCK_RATE_1MB:
  1690. case RTLLIB_CCK_RATE_2MB:
  1691. case RTLLIB_CCK_RATE_5MB:
  1692. case RTLLIB_CCK_RATE_11MB:
  1693. return 1;
  1694. }
  1695. return 0;
  1696. }
  1697. /* rtllib.c */
  1698. void free_rtllib(struct net_device *dev);
  1699. struct net_device *alloc_rtllib(int sizeof_priv);
  1700. /* rtllib_tx.c */
  1701. int rtllib_encrypt_fragment(
  1702. struct rtllib_device *ieee,
  1703. struct sk_buff *frag,
  1704. int hdr_len);
  1705. int rtllib_xmit(struct sk_buff *skb, struct net_device *dev);
  1706. void rtllib_txb_free(struct rtllib_txb *);
  1707. /* rtllib_rx.c */
  1708. int rtllib_rx(struct rtllib_device *ieee, struct sk_buff *skb,
  1709. struct rtllib_rx_stats *rx_stats);
  1710. void rtllib_rx_probe_rq(struct rtllib_device *ieee,
  1711. struct sk_buff *skb);
  1712. int rtllib_legal_channel(struct rtllib_device *rtllib, u8 channel);
  1713. /* rtllib_wx.c */
  1714. int rtllib_wx_get_scan(struct rtllib_device *ieee,
  1715. struct iw_request_info *info,
  1716. union iwreq_data *wrqu, char *key);
  1717. int rtllib_wx_set_encode(struct rtllib_device *ieee,
  1718. struct iw_request_info *info,
  1719. union iwreq_data *wrqu, char *key);
  1720. int rtllib_wx_get_encode(struct rtllib_device *ieee,
  1721. struct iw_request_info *info,
  1722. union iwreq_data *wrqu, char *key);
  1723. int rtllib_wx_set_encode_ext(struct rtllib_device *ieee,
  1724. struct iw_request_info *info,
  1725. union iwreq_data *wrqu, char *extra);
  1726. int rtllib_wx_set_auth(struct rtllib_device *ieee,
  1727. struct iw_request_info *info,
  1728. struct iw_param *data, char *extra);
  1729. int rtllib_wx_set_mlme(struct rtllib_device *ieee,
  1730. struct iw_request_info *info,
  1731. union iwreq_data *wrqu, char *extra);
  1732. int rtllib_wx_set_gen_ie(struct rtllib_device *ieee, u8 *ie, size_t len);
  1733. /* rtllib_softmac.c */
  1734. int rtllib_rx_frame_softmac(struct rtllib_device *ieee, struct sk_buff *skb,
  1735. struct rtllib_rx_stats *rx_stats, u16 type,
  1736. u16 stype);
  1737. void rtllib_softmac_new_net(struct rtllib_device *ieee,
  1738. struct rtllib_network *net);
  1739. void SendDisassociation(struct rtllib_device *ieee, bool deauth, u16 asRsn);
  1740. void rtllib_softmac_xmit(struct rtllib_txb *txb, struct rtllib_device *ieee);
  1741. void rtllib_stop_send_beacons(struct rtllib_device *ieee);
  1742. void notify_wx_assoc_event(struct rtllib_device *ieee);
  1743. void rtllib_start_ibss(struct rtllib_device *ieee);
  1744. void rtllib_softmac_init(struct rtllib_device *ieee);
  1745. void rtllib_softmac_free(struct rtllib_device *ieee);
  1746. void rtllib_disassociate(struct rtllib_device *ieee);
  1747. void rtllib_stop_scan(struct rtllib_device *ieee);
  1748. bool rtllib_act_scanning(struct rtllib_device *ieee, bool sync_scan);
  1749. void rtllib_stop_scan_syncro(struct rtllib_device *ieee);
  1750. void rtllib_start_scan_syncro(struct rtllib_device *ieee, u8 is_mesh);
  1751. void rtllib_sta_ps_send_null_frame(struct rtllib_device *ieee, short pwr);
  1752. void rtllib_sta_ps_send_pspoll_frame(struct rtllib_device *ieee);
  1753. void rtllib_start_protocol(struct rtllib_device *ieee);
  1754. void rtllib_stop_protocol(struct rtllib_device *ieee, u8 shutdown);
  1755. void rtllib_EnableNetMonitorMode(struct net_device *dev, bool bInitState);
  1756. void rtllib_DisableNetMonitorMode(struct net_device *dev, bool bInitState);
  1757. void rtllib_EnableIntelPromiscuousMode(struct net_device *dev, bool bInitState);
  1758. void rtllib_DisableIntelPromiscuousMode(struct net_device *dev,
  1759. bool bInitState);
  1760. void rtllib_softmac_stop_protocol(struct rtllib_device *ieee,
  1761. u8 mesh_flag, u8 shutdown);
  1762. void rtllib_softmac_start_protocol(struct rtllib_device *ieee, u8 mesh_flag);
  1763. void rtllib_reset_queue(struct rtllib_device *ieee);
  1764. void rtllib_wake_all_queues(struct rtllib_device *ieee);
  1765. void rtllib_stop_all_queues(struct rtllib_device *ieee);
  1766. struct sk_buff *rtllib_get_beacon(struct rtllib_device *ieee);
  1767. void rtllib_start_send_beacons(struct rtllib_device *ieee);
  1768. void rtllib_stop_send_beacons(struct rtllib_device *ieee);
  1769. int rtllib_wpa_supplicant_ioctl(struct rtllib_device *ieee,
  1770. struct iw_point *p, u8 is_mesh);
  1771. void notify_wx_assoc_event(struct rtllib_device *ieee);
  1772. void rtllib_ps_tx_ack(struct rtllib_device *ieee, short success);
  1773. void softmac_mgmt_xmit(struct sk_buff *skb, struct rtllib_device *ieee);
  1774. u8 rtllib_ap_sec_type(struct rtllib_device *ieee);
  1775. /* rtllib_softmac_wx.c */
  1776. int rtllib_wx_get_wap(struct rtllib_device *ieee, struct iw_request_info *info,
  1777. union iwreq_data *wrqu, char *ext);
  1778. int rtllib_wx_set_wap(struct rtllib_device *ieee, struct iw_request_info *info,
  1779. union iwreq_data *awrq, char *extra);
  1780. int rtllib_wx_get_essid(struct rtllib_device *ieee, struct iw_request_info *a,
  1781. union iwreq_data *wrqu, char *b);
  1782. int rtllib_wx_set_rate(struct rtllib_device *ieee, struct iw_request_info *info,
  1783. union iwreq_data *wrqu, char *extra);
  1784. int rtllib_wx_get_rate(struct rtllib_device *ieee, struct iw_request_info *info,
  1785. union iwreq_data *wrqu, char *extra);
  1786. int rtllib_wx_set_mode(struct rtllib_device *ieee, struct iw_request_info *a,
  1787. union iwreq_data *wrqu, char *b);
  1788. int rtllib_wx_set_scan(struct rtllib_device *ieee, struct iw_request_info *a,
  1789. union iwreq_data *wrqu, char *b);
  1790. int rtllib_wx_set_essid(struct rtllib_device *ieee, struct iw_request_info *a,
  1791. union iwreq_data *wrqu, char *extra);
  1792. int rtllib_wx_get_mode(struct rtllib_device *ieee, struct iw_request_info *a,
  1793. union iwreq_data *wrqu, char *b);
  1794. int rtllib_wx_set_freq(struct rtllib_device *ieee, struct iw_request_info *a,
  1795. union iwreq_data *wrqu, char *b);
  1796. int rtllib_wx_get_freq(struct rtllib_device *ieee, struct iw_request_info *a,
  1797. union iwreq_data *wrqu, char *b);
  1798. void rtllib_wx_sync_scan_wq(void *data);
  1799. int rtllib_wx_set_rawtx(struct rtllib_device *ieee,
  1800. struct iw_request_info *info,
  1801. union iwreq_data *wrqu, char *extra);
  1802. int rtllib_wx_get_name(struct rtllib_device *ieee, struct iw_request_info *info,
  1803. union iwreq_data *wrqu, char *extra);
  1804. int rtllib_wx_set_power(struct rtllib_device *ieee,
  1805. struct iw_request_info *info,
  1806. union iwreq_data *wrqu, char *extra);
  1807. int rtllib_wx_get_power(struct rtllib_device *ieee,
  1808. struct iw_request_info *info,
  1809. union iwreq_data *wrqu, char *extra);
  1810. int rtllib_wx_set_rts(struct rtllib_device *ieee, struct iw_request_info *info,
  1811. union iwreq_data *wrqu, char *extra);
  1812. int rtllib_wx_get_rts(struct rtllib_device *ieee, struct iw_request_info *info,
  1813. union iwreq_data *wrqu, char *extra);
  1814. #define MAX_RECEIVE_BUFFER_SIZE 9100
  1815. void HTSetConnectBwMode(struct rtllib_device *ieee,
  1816. enum ht_channel_width Bandwidth,
  1817. enum ht_extchnl_offset Offset);
  1818. void HTUpdateDefaultSetting(struct rtllib_device *ieee);
  1819. void HTConstructCapabilityElement(struct rtllib_device *ieee,
  1820. u8 *posHTCap, u8 *len,
  1821. u8 isEncrypt, bool bAssoc);
  1822. void HTConstructInfoElement(struct rtllib_device *ieee,
  1823. u8 *posHTInfo, u8 *len, u8 isEncrypt);
  1824. void HTConstructRT2RTAggElement(struct rtllib_device *ieee,
  1825. u8 *posRT2RTAgg, u8 *len);
  1826. void HTOnAssocRsp(struct rtllib_device *ieee);
  1827. void HTInitializeHTInfo(struct rtllib_device *ieee);
  1828. void HTInitializeBssDesc(struct bss_ht *pBssHT);
  1829. void HTResetSelfAndSavePeerSetting(struct rtllib_device *ieee,
  1830. struct rtllib_network *pNetwork);
  1831. void HT_update_self_and_peer_setting(struct rtllib_device *ieee,
  1832. struct rtllib_network *pNetwork);
  1833. u8 HTGetHighestMCSRate(struct rtllib_device *ieee, u8 *pMCSRateSet,
  1834. u8 *pMCSFilter);
  1835. extern u8 MCS_FILTER_ALL[];
  1836. extern u16 MCS_DATA_RATE[2][2][77];
  1837. u8 HTCCheck(struct rtllib_device *ieee, u8 *pFrame);
  1838. void HTResetIOTSetting(struct rt_hi_throughput *pHTInfo);
  1839. bool IsHTHalfNmodeAPs(struct rtllib_device *ieee);
  1840. u16 TxCountToDataRate(struct rtllib_device *ieee, u8 nDataRate);
  1841. int rtllib_rx_ADDBAReq(struct rtllib_device *ieee, struct sk_buff *skb);
  1842. int rtllib_rx_ADDBARsp(struct rtllib_device *ieee, struct sk_buff *skb);
  1843. int rtllib_rx_DELBA(struct rtllib_device *ieee, struct sk_buff *skb);
  1844. void TsInitAddBA(struct rtllib_device *ieee, struct tx_ts_record *pTS,
  1845. u8 Policy, u8 bOverwritePending);
  1846. void TsInitDelBA(struct rtllib_device *ieee,
  1847. struct ts_common_info *pTsCommonInfo,
  1848. enum tr_select TxRxSelect);
  1849. void BaSetupTimeOut(unsigned long data);
  1850. void TxBaInactTimeout(unsigned long data);
  1851. void RxBaInactTimeout(unsigned long data);
  1852. void ResetBaEntry(struct ba_record *pBA);
  1853. bool GetTs(struct rtllib_device *ieee, struct ts_common_info **ppTS, u8 *Addr,
  1854. u8 TID, enum tr_select TxRxSelect, bool bAddNewTs);
  1855. void TSInitialize(struct rtllib_device *ieee);
  1856. void TsStartAddBaProcess(struct rtllib_device *ieee,
  1857. struct tx_ts_record *pTxTS);
  1858. void RemovePeerTS(struct rtllib_device *ieee, u8 *Addr);
  1859. void RemoveAllTS(struct rtllib_device *ieee);
  1860. extern const long rtllib_wlan_frequencies[];
  1861. static inline const char *escape_essid(const char *essid, u8 essid_len)
  1862. {
  1863. static char escaped[IW_ESSID_MAX_SIZE * 2 + 1];
  1864. if (rtllib_is_empty_essid(essid, essid_len)) {
  1865. memcpy(escaped, "<hidden>", sizeof("<hidden>"));
  1866. return escaped;
  1867. }
  1868. snprintf(escaped, sizeof(escaped), "%*pEn", essid_len, essid);
  1869. return escaped;
  1870. }
  1871. /* fun with the built-in rtllib stack... */
  1872. bool rtllib_MgntDisconnect(struct rtllib_device *rtllib, u8 asRsn);
  1873. /* For the function is more related to hardware setting, it's better to use the
  1874. * ieee handler to refer to it.
  1875. */
  1876. void rtllib_FlushRxTsPendingPkts(struct rtllib_device *ieee,
  1877. struct rx_ts_record *pTS);
  1878. int rtllib_parse_info_param(struct rtllib_device *ieee,
  1879. struct rtllib_info_element *info_element,
  1880. u16 length,
  1881. struct rtllib_network *network,
  1882. struct rtllib_rx_stats *stats);
  1883. void rtllib_indicate_packets(struct rtllib_device *ieee,
  1884. struct rtllib_rxb **prxbIndicateArray, u8 index);
  1885. void HTUseDefaultSetting(struct rtllib_device *ieee);
  1886. #define RT_ASOC_RETRY_LIMIT 5
  1887. u8 MgntQuery_TxRateExcludeCCKRates(struct rtllib_device *ieee);
  1888. #define SEM_DOWN_IEEE_WX(psem) down(psem)
  1889. #define SEM_UP_IEEE_WX(psem) up(psem)
  1890. #endif /* RTLLIB_H */