wsm.h 47 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874
  1. /*
  2. * WSM host interface (HI) interface for ST-Ericsson CW1200 mac80211 drivers
  3. *
  4. * Copyright (c) 2010, ST-Ericsson
  5. * Author: Dmitry Tarnyagin <dmitry.tarnyagin@lockless.no>
  6. *
  7. * Based on CW1200 UMAC WSM API, which is
  8. * Copyright (C) ST-Ericsson SA 2010
  9. * Author: Stewart Mathers <stewart.mathers@stericsson.com>
  10. *
  11. * This program is free software; you can redistribute it and/or modify
  12. * it under the terms of the GNU General Public License version 2 as
  13. * published by the Free Software Foundation.
  14. */
  15. #ifndef CW1200_WSM_H_INCLUDED
  16. #define CW1200_WSM_H_INCLUDED
  17. #include <linux/spinlock.h>
  18. struct cw1200_common;
  19. /* Bands */
  20. /* Radio band 2.412 -2.484 GHz. */
  21. #define WSM_PHY_BAND_2_4G (0)
  22. /* Radio band 4.9375-5.8250 GHz. */
  23. #define WSM_PHY_BAND_5G (1)
  24. /* Transmit rates */
  25. /* 1 Mbps ERP-DSSS */
  26. #define WSM_TRANSMIT_RATE_1 (0)
  27. /* 2 Mbps ERP-DSSS */
  28. #define WSM_TRANSMIT_RATE_2 (1)
  29. /* 5.5 Mbps ERP-CCK */
  30. #define WSM_TRANSMIT_RATE_5 (2)
  31. /* 11 Mbps ERP-CCK */
  32. #define WSM_TRANSMIT_RATE_11 (3)
  33. /* 22 Mbps ERP-PBCC (Not supported) */
  34. /* #define WSM_TRANSMIT_RATE_22 (4) */
  35. /* 33 Mbps ERP-PBCC (Not supported) */
  36. /* #define WSM_TRANSMIT_RATE_33 (5) */
  37. /* 6 Mbps (3 Mbps) ERP-OFDM, BPSK coding rate 1/2 */
  38. #define WSM_TRANSMIT_RATE_6 (6)
  39. /* 9 Mbps (4.5 Mbps) ERP-OFDM, BPSK coding rate 3/4 */
  40. #define WSM_TRANSMIT_RATE_9 (7)
  41. /* 12 Mbps (6 Mbps) ERP-OFDM, QPSK coding rate 1/2 */
  42. #define WSM_TRANSMIT_RATE_12 (8)
  43. /* 18 Mbps (9 Mbps) ERP-OFDM, QPSK coding rate 3/4 */
  44. #define WSM_TRANSMIT_RATE_18 (9)
  45. /* 24 Mbps (12 Mbps) ERP-OFDM, 16QAM coding rate 1/2 */
  46. #define WSM_TRANSMIT_RATE_24 (10)
  47. /* 36 Mbps (18 Mbps) ERP-OFDM, 16QAM coding rate 3/4 */
  48. #define WSM_TRANSMIT_RATE_36 (11)
  49. /* 48 Mbps (24 Mbps) ERP-OFDM, 64QAM coding rate 1/2 */
  50. #define WSM_TRANSMIT_RATE_48 (12)
  51. /* 54 Mbps (27 Mbps) ERP-OFDM, 64QAM coding rate 3/4 */
  52. #define WSM_TRANSMIT_RATE_54 (13)
  53. /* 6.5 Mbps HT-OFDM, BPSK coding rate 1/2 */
  54. #define WSM_TRANSMIT_RATE_HT_6 (14)
  55. /* 13 Mbps HT-OFDM, QPSK coding rate 1/2 */
  56. #define WSM_TRANSMIT_RATE_HT_13 (15)
  57. /* 19.5 Mbps HT-OFDM, QPSK coding rate 3/4 */
  58. #define WSM_TRANSMIT_RATE_HT_19 (16)
  59. /* 26 Mbps HT-OFDM, 16QAM coding rate 1/2 */
  60. #define WSM_TRANSMIT_RATE_HT_26 (17)
  61. /* 39 Mbps HT-OFDM, 16QAM coding rate 3/4 */
  62. #define WSM_TRANSMIT_RATE_HT_39 (18)
  63. /* 52 Mbps HT-OFDM, 64QAM coding rate 2/3 */
  64. #define WSM_TRANSMIT_RATE_HT_52 (19)
  65. /* 58.5 Mbps HT-OFDM, 64QAM coding rate 3/4 */
  66. #define WSM_TRANSMIT_RATE_HT_58 (20)
  67. /* 65 Mbps HT-OFDM, 64QAM coding rate 5/6 */
  68. #define WSM_TRANSMIT_RATE_HT_65 (21)
  69. /* Scan types */
  70. /* Foreground scan */
  71. #define WSM_SCAN_TYPE_FOREGROUND (0)
  72. /* Background scan */
  73. #define WSM_SCAN_TYPE_BACKGROUND (1)
  74. /* Auto scan */
  75. #define WSM_SCAN_TYPE_AUTO (2)
  76. /* Scan flags */
  77. /* Forced background scan means if the station cannot */
  78. /* enter the power-save mode, it shall force to perform a */
  79. /* background scan. Only valid when ScanType is */
  80. /* background scan. */
  81. #define WSM_SCAN_FLAG_FORCE_BACKGROUND (BIT(0))
  82. /* The WLAN device scans one channel at a time so */
  83. /* that disturbance to the data traffic is minimized. */
  84. #define WSM_SCAN_FLAG_SPLIT_METHOD (BIT(1))
  85. /* Preamble Type. Long if not set. */
  86. #define WSM_SCAN_FLAG_SHORT_PREAMBLE (BIT(2))
  87. /* 11n Tx Mode. Mixed if not set. */
  88. #define WSM_SCAN_FLAG_11N_GREENFIELD (BIT(3))
  89. /* Scan constraints */
  90. /* Maximum number of channels to be scanned. */
  91. #define WSM_SCAN_MAX_NUM_OF_CHANNELS (48)
  92. /* The maximum number of SSIDs that the device can scan for. */
  93. #define WSM_SCAN_MAX_NUM_OF_SSIDS (2)
  94. /* Power management modes */
  95. /* 802.11 Active mode */
  96. #define WSM_PSM_ACTIVE (0)
  97. /* 802.11 PS mode */
  98. #define WSM_PSM_PS BIT(0)
  99. /* Fast Power Save bit */
  100. #define WSM_PSM_FAST_PS_FLAG BIT(7)
  101. /* Dynamic aka Fast power save */
  102. #define WSM_PSM_FAST_PS (BIT(0) | BIT(7))
  103. /* Undetermined */
  104. /* Note : Undetermined status is reported when the */
  105. /* NULL data frame used to advertise the PM mode to */
  106. /* the AP at Pre or Post Background Scan is not Acknowledged */
  107. #define WSM_PSM_UNKNOWN BIT(1)
  108. /* Queue IDs */
  109. /* best effort/legacy */
  110. #define WSM_QUEUE_BEST_EFFORT (0)
  111. /* background */
  112. #define WSM_QUEUE_BACKGROUND (1)
  113. /* video */
  114. #define WSM_QUEUE_VIDEO (2)
  115. /* voice */
  116. #define WSM_QUEUE_VOICE (3)
  117. /* HT TX parameters */
  118. /* Non-HT */
  119. #define WSM_HT_TX_NON_HT (0)
  120. /* Mixed format */
  121. #define WSM_HT_TX_MIXED (1)
  122. /* Greenfield format */
  123. #define WSM_HT_TX_GREENFIELD (2)
  124. /* STBC allowed */
  125. #define WSM_HT_TX_STBC (BIT(7))
  126. /* EPTA prioirty flags for BT Coex */
  127. /* default epta priority */
  128. #define WSM_EPTA_PRIORITY_DEFAULT 4
  129. /* use for normal data */
  130. #define WSM_EPTA_PRIORITY_DATA 4
  131. /* use for connect/disconnect/roaming*/
  132. #define WSM_EPTA_PRIORITY_MGT 5
  133. /* use for action frames */
  134. #define WSM_EPTA_PRIORITY_ACTION 5
  135. /* use for AC_VI data */
  136. #define WSM_EPTA_PRIORITY_VIDEO 5
  137. /* use for AC_VO data */
  138. #define WSM_EPTA_PRIORITY_VOICE 6
  139. /* use for EAPOL exchange */
  140. #define WSM_EPTA_PRIORITY_EAPOL 7
  141. /* TX status */
  142. /* Frame was sent aggregated */
  143. /* Only valid for WSM_SUCCESS status. */
  144. #define WSM_TX_STATUS_AGGREGATION (BIT(0))
  145. /* Host should requeue this frame later. */
  146. /* Valid only when status is WSM_REQUEUE. */
  147. #define WSM_TX_STATUS_REQUEUE (BIT(1))
  148. /* Normal Ack */
  149. #define WSM_TX_STATUS_NORMAL_ACK (0<<2)
  150. /* No Ack */
  151. #define WSM_TX_STATUS_NO_ACK (1<<2)
  152. /* No explicit acknowledgement */
  153. #define WSM_TX_STATUS_NO_EXPLICIT_ACK (2<<2)
  154. /* Block Ack */
  155. /* Only valid for WSM_SUCCESS status. */
  156. #define WSM_TX_STATUS_BLOCK_ACK (3<<2)
  157. /* RX status */
  158. /* Unencrypted */
  159. #define WSM_RX_STATUS_UNENCRYPTED (0<<0)
  160. /* WEP */
  161. #define WSM_RX_STATUS_WEP (1<<0)
  162. /* TKIP */
  163. #define WSM_RX_STATUS_TKIP (2<<0)
  164. /* AES */
  165. #define WSM_RX_STATUS_AES (3<<0)
  166. /* WAPI */
  167. #define WSM_RX_STATUS_WAPI (4<<0)
  168. /* Macro to fetch encryption subfield. */
  169. #define WSM_RX_STATUS_ENCRYPTION(status) ((status) & 0x07)
  170. /* Frame was part of an aggregation */
  171. #define WSM_RX_STATUS_AGGREGATE (BIT(3))
  172. /* Frame was first in the aggregation */
  173. #define WSM_RX_STATUS_AGGREGATE_FIRST (BIT(4))
  174. /* Frame was last in the aggregation */
  175. #define WSM_RX_STATUS_AGGREGATE_LAST (BIT(5))
  176. /* Indicates a defragmented frame */
  177. #define WSM_RX_STATUS_DEFRAGMENTED (BIT(6))
  178. /* Indicates a Beacon frame */
  179. #define WSM_RX_STATUS_BEACON (BIT(7))
  180. /* Indicates STA bit beacon TIM field */
  181. #define WSM_RX_STATUS_TIM (BIT(8))
  182. /* Indicates Beacon frame's virtual bitmap contains multicast bit */
  183. #define WSM_RX_STATUS_MULTICAST (BIT(9))
  184. /* Indicates frame contains a matching SSID */
  185. #define WSM_RX_STATUS_MATCHING_SSID (BIT(10))
  186. /* Indicates frame contains a matching BSSI */
  187. #define WSM_RX_STATUS_MATCHING_BSSI (BIT(11))
  188. /* Indicates More bit set in Framectl field */
  189. #define WSM_RX_STATUS_MORE_DATA (BIT(12))
  190. /* Indicates frame received during a measurement process */
  191. #define WSM_RX_STATUS_MEASUREMENT (BIT(13))
  192. /* Indicates frame received as an HT packet */
  193. #define WSM_RX_STATUS_HT (BIT(14))
  194. /* Indicates frame received with STBC */
  195. #define WSM_RX_STATUS_STBC (BIT(15))
  196. /* Indicates Address 1 field matches dot11StationId */
  197. #define WSM_RX_STATUS_ADDRESS1 (BIT(16))
  198. /* Indicates Group address present in the Address 1 field */
  199. #define WSM_RX_STATUS_GROUP (BIT(17))
  200. /* Indicates Broadcast address present in the Address 1 field */
  201. #define WSM_RX_STATUS_BROADCAST (BIT(18))
  202. /* Indicates group key used with encrypted frames */
  203. #define WSM_RX_STATUS_GROUP_KEY (BIT(19))
  204. /* Macro to fetch encryption key index. */
  205. #define WSM_RX_STATUS_KEY_IDX(status) (((status >> 20)) & 0x0F)
  206. /* Indicates TSF inclusion after 802.11 frame body */
  207. #define WSM_RX_STATUS_TSF_INCLUDED (BIT(24))
  208. /* Frame Control field starts at Frame offset + 2 */
  209. #define WSM_TX_2BYTES_SHIFT (BIT(7))
  210. /* Join mode */
  211. /* IBSS */
  212. #define WSM_JOIN_MODE_IBSS (0)
  213. /* BSS */
  214. #define WSM_JOIN_MODE_BSS (1)
  215. /* PLCP preamble type */
  216. /* For long preamble */
  217. #define WSM_JOIN_PREAMBLE_LONG (0)
  218. /* For short preamble (Long for 1Mbps) */
  219. #define WSM_JOIN_PREAMBLE_SHORT (1)
  220. /* For short preamble (Long for 1 and 2Mbps) */
  221. #define WSM_JOIN_PREAMBLE_SHORT_2 (2)
  222. /* Join flags */
  223. /* Unsynchronized */
  224. #define WSM_JOIN_FLAGS_UNSYNCRONIZED BIT(0)
  225. /* The BSS owner is a P2P GO */
  226. #define WSM_JOIN_FLAGS_P2P_GO BIT(1)
  227. /* Force to join BSS with the BSSID and the
  228. * SSID specified without waiting for beacons. The
  229. * ProbeForJoin parameter is ignored. */
  230. #define WSM_JOIN_FLAGS_FORCE BIT(2)
  231. /* Give probe request/response higher
  232. * priority over the BT traffic */
  233. #define WSM_JOIN_FLAGS_PRIO BIT(3)
  234. /* Issue immediate join confirmation and use
  235. * join complete to notify about completion */
  236. #define WSM_JOIN_FLAGS_FORCE_WITH_COMPLETE_IND BIT(5)
  237. /* Key types */
  238. #define WSM_KEY_TYPE_WEP_DEFAULT (0)
  239. #define WSM_KEY_TYPE_WEP_PAIRWISE (1)
  240. #define WSM_KEY_TYPE_TKIP_GROUP (2)
  241. #define WSM_KEY_TYPE_TKIP_PAIRWISE (3)
  242. #define WSM_KEY_TYPE_AES_GROUP (4)
  243. #define WSM_KEY_TYPE_AES_PAIRWISE (5)
  244. #define WSM_KEY_TYPE_WAPI_GROUP (6)
  245. #define WSM_KEY_TYPE_WAPI_PAIRWISE (7)
  246. /* Key indexes */
  247. #define WSM_KEY_MAX_INDEX (10)
  248. /* ACK policy */
  249. #define WSM_ACK_POLICY_NORMAL (0)
  250. #define WSM_ACK_POLICY_NO_ACK (1)
  251. /* Start modes */
  252. #define WSM_START_MODE_AP (0) /* Mini AP */
  253. #define WSM_START_MODE_P2P_GO (1) /* P2P GO */
  254. #define WSM_START_MODE_P2P_DEV (2) /* P2P device */
  255. /* SetAssociationMode MIB flags */
  256. #define WSM_ASSOCIATION_MODE_USE_PREAMBLE_TYPE (BIT(0))
  257. #define WSM_ASSOCIATION_MODE_USE_HT_MODE (BIT(1))
  258. #define WSM_ASSOCIATION_MODE_USE_BASIC_RATE_SET (BIT(2))
  259. #define WSM_ASSOCIATION_MODE_USE_MPDU_START_SPACING (BIT(3))
  260. #define WSM_ASSOCIATION_MODE_SNOOP_ASSOC_FRAMES (BIT(4))
  261. /* RcpiRssiThreshold MIB flags */
  262. #define WSM_RCPI_RSSI_THRESHOLD_ENABLE (BIT(0))
  263. #define WSM_RCPI_RSSI_USE_RSSI (BIT(1))
  264. #define WSM_RCPI_RSSI_DONT_USE_UPPER (BIT(2))
  265. #define WSM_RCPI_RSSI_DONT_USE_LOWER (BIT(3))
  266. /* Update-ie constants */
  267. #define WSM_UPDATE_IE_BEACON (BIT(0))
  268. #define WSM_UPDATE_IE_PROBE_RESP (BIT(1))
  269. #define WSM_UPDATE_IE_PROBE_REQ (BIT(2))
  270. /* WSM events */
  271. /* Error */
  272. #define WSM_EVENT_ERROR (0)
  273. /* BSS lost */
  274. #define WSM_EVENT_BSS_LOST (1)
  275. /* BSS regained */
  276. #define WSM_EVENT_BSS_REGAINED (2)
  277. /* Radar detected */
  278. #define WSM_EVENT_RADAR_DETECTED (3)
  279. /* RCPI or RSSI threshold triggered */
  280. #define WSM_EVENT_RCPI_RSSI (4)
  281. /* BT inactive */
  282. #define WSM_EVENT_BT_INACTIVE (5)
  283. /* BT active */
  284. #define WSM_EVENT_BT_ACTIVE (6)
  285. /* MIB IDs */
  286. /* 4.1 dot11StationId */
  287. #define WSM_MIB_ID_DOT11_STATION_ID 0x0000
  288. /* 4.2 dot11MaxtransmitMsduLifeTime */
  289. #define WSM_MIB_ID_DOT11_MAX_TRANSMIT_LIFTIME 0x0001
  290. /* 4.3 dot11MaxReceiveLifeTime */
  291. #define WSM_MIB_ID_DOT11_MAX_RECEIVE_LIFETIME 0x0002
  292. /* 4.4 dot11SlotTime */
  293. #define WSM_MIB_ID_DOT11_SLOT_TIME 0x0003
  294. /* 4.5 dot11GroupAddressesTable */
  295. #define WSM_MIB_ID_DOT11_GROUP_ADDRESSES_TABLE 0x0004
  296. #define WSM_MAX_GRP_ADDRTABLE_ENTRIES 8
  297. /* 4.6 dot11WepDefaultKeyId */
  298. #define WSM_MIB_ID_DOT11_WEP_DEFAULT_KEY_ID 0x0005
  299. /* 4.7 dot11CurrentTxPowerLevel */
  300. #define WSM_MIB_ID_DOT11_CURRENT_TX_POWER_LEVEL 0x0006
  301. /* 4.8 dot11RTSThreshold */
  302. #define WSM_MIB_ID_DOT11_RTS_THRESHOLD 0x0007
  303. /* 4.9 NonErpProtection */
  304. #define WSM_MIB_ID_NON_ERP_PROTECTION 0x1000
  305. /* 4.10 ArpIpAddressesTable */
  306. #define WSM_MIB_ID_ARP_IP_ADDRESSES_TABLE 0x1001
  307. #define WSM_MAX_ARP_IP_ADDRTABLE_ENTRIES 1
  308. /* 4.11 TemplateFrame */
  309. #define WSM_MIB_ID_TEMPLATE_FRAME 0x1002
  310. /* 4.12 RxFilter */
  311. #define WSM_MIB_ID_RX_FILTER 0x1003
  312. /* 4.13 BeaconFilterTable */
  313. #define WSM_MIB_ID_BEACON_FILTER_TABLE 0x1004
  314. /* 4.14 BeaconFilterEnable */
  315. #define WSM_MIB_ID_BEACON_FILTER_ENABLE 0x1005
  316. /* 4.15 OperationalPowerMode */
  317. #define WSM_MIB_ID_OPERATIONAL_POWER_MODE 0x1006
  318. /* 4.16 BeaconWakeUpPeriod */
  319. #define WSM_MIB_ID_BEACON_WAKEUP_PERIOD 0x1007
  320. /* 4.17 RcpiRssiThreshold */
  321. #define WSM_MIB_ID_RCPI_RSSI_THRESHOLD 0x1009
  322. /* 4.18 StatisticsTable */
  323. #define WSM_MIB_ID_STATISTICS_TABLE 0x100A
  324. /* 4.19 IbssPsConfig */
  325. #define WSM_MIB_ID_IBSS_PS_CONFIG 0x100B
  326. /* 4.20 CountersTable */
  327. #define WSM_MIB_ID_COUNTERS_TABLE 0x100C
  328. /* 4.21 BlockAckPolicy */
  329. #define WSM_MIB_ID_BLOCK_ACK_POLICY 0x100E
  330. /* 4.22 OverrideInternalTxRate */
  331. #define WSM_MIB_ID_OVERRIDE_INTERNAL_TX_RATE 0x100F
  332. /* 4.23 SetAssociationMode */
  333. #define WSM_MIB_ID_SET_ASSOCIATION_MODE 0x1010
  334. /* 4.24 UpdateEptaConfigData */
  335. #define WSM_MIB_ID_UPDATE_EPTA_CONFIG_DATA 0x1011
  336. /* 4.25 SelectCcaMethod */
  337. #define WSM_MIB_ID_SELECT_CCA_METHOD 0x1012
  338. /* 4.26 SetUpasdInformation */
  339. #define WSM_MIB_ID_SET_UAPSD_INFORMATION 0x1013
  340. /* 4.27 SetAutoCalibrationMode WBF00004073 */
  341. #define WSM_MIB_ID_SET_AUTO_CALIBRATION_MODE 0x1015
  342. /* 4.28 SetTxRateRetryPolicy */
  343. #define WSM_MIB_ID_SET_TX_RATE_RETRY_POLICY 0x1016
  344. /* 4.29 SetHostMessageTypeFilter */
  345. #define WSM_MIB_ID_SET_HOST_MSG_TYPE_FILTER 0x1017
  346. /* 4.30 P2PFindInfo */
  347. #define WSM_MIB_ID_P2P_FIND_INFO 0x1018
  348. /* 4.31 P2PPsModeInfo */
  349. #define WSM_MIB_ID_P2P_PS_MODE_INFO 0x1019
  350. /* 4.32 SetEtherTypeDataFrameFilter */
  351. #define WSM_MIB_ID_SET_ETHERTYPE_DATAFRAME_FILTER 0x101A
  352. /* 4.33 SetUDPPortDataFrameFilter */
  353. #define WSM_MIB_ID_SET_UDPPORT_DATAFRAME_FILTER 0x101B
  354. /* 4.34 SetMagicDataFrameFilter */
  355. #define WSM_MIB_ID_SET_MAGIC_DATAFRAME_FILTER 0x101C
  356. /* 4.35 P2PDeviceInfo */
  357. #define WSM_MIB_ID_P2P_DEVICE_INFO 0x101D
  358. /* 4.36 SetWCDMABand */
  359. #define WSM_MIB_ID_SET_WCDMA_BAND 0x101E
  360. /* 4.37 GroupTxSequenceCounter */
  361. #define WSM_MIB_ID_GRP_SEQ_COUNTER 0x101F
  362. /* 4.38 ProtectedMgmtPolicy */
  363. #define WSM_MIB_ID_PROTECTED_MGMT_POLICY 0x1020
  364. /* 4.39 SetHtProtection */
  365. #define WSM_MIB_ID_SET_HT_PROTECTION 0x1021
  366. /* 4.40 GPIO Command */
  367. #define WSM_MIB_ID_GPIO_COMMAND 0x1022
  368. /* 4.41 TSF Counter Value */
  369. #define WSM_MIB_ID_TSF_COUNTER 0x1023
  370. /* Test Purposes Only */
  371. #define WSM_MIB_ID_BLOCK_ACK_INFO 0x100D
  372. /* 4.42 UseMultiTxConfMessage */
  373. #define WSM_MIB_USE_MULTI_TX_CONF 0x1024
  374. /* 4.43 Keep-alive period */
  375. #define WSM_MIB_ID_KEEP_ALIVE_PERIOD 0x1025
  376. /* 4.44 Disable BSSID filter */
  377. #define WSM_MIB_ID_DISABLE_BSSID_FILTER 0x1026
  378. /* Frame template types */
  379. #define WSM_FRAME_TYPE_PROBE_REQUEST (0)
  380. #define WSM_FRAME_TYPE_BEACON (1)
  381. #define WSM_FRAME_TYPE_NULL (2)
  382. #define WSM_FRAME_TYPE_QOS_NULL (3)
  383. #define WSM_FRAME_TYPE_PS_POLL (4)
  384. #define WSM_FRAME_TYPE_PROBE_RESPONSE (5)
  385. #define WSM_FRAME_GREENFIELD (0x80) /* See 4.11 */
  386. /* Status */
  387. /* The WSM firmware has completed a request */
  388. /* successfully. */
  389. #define WSM_STATUS_SUCCESS (0)
  390. /* This is a generic failure code if other error codes do */
  391. /* not apply. */
  392. #define WSM_STATUS_FAILURE (1)
  393. /* A request contains one or more invalid parameters. */
  394. #define WSM_INVALID_PARAMETER (2)
  395. /* The request cannot perform because the device is in */
  396. /* an inappropriate mode. */
  397. #define WSM_ACCESS_DENIED (3)
  398. /* The frame received includes a decryption error. */
  399. #define WSM_STATUS_DECRYPTFAILURE (4)
  400. /* A MIC failure is detected in the received packets. */
  401. #define WSM_STATUS_MICFAILURE (5)
  402. /* The transmit request failed due to retry limit being */
  403. /* exceeded. */
  404. #define WSM_STATUS_RETRY_EXCEEDED (6)
  405. /* The transmit request failed due to MSDU life time */
  406. /* being exceeded. */
  407. #define WSM_STATUS_TX_LIFETIME_EXCEEDED (7)
  408. /* The link to the AP is lost. */
  409. #define WSM_STATUS_LINK_LOST (8)
  410. /* No key was found for the encrypted frame */
  411. #define WSM_STATUS_NO_KEY_FOUND (9)
  412. /* Jammer was detected when transmitting this frame */
  413. #define WSM_STATUS_JAMMER_DETECTED (10)
  414. /* The message should be requeued later. */
  415. /* This is applicable only to Transmit */
  416. #define WSM_REQUEUE (11)
  417. /* Advanced filtering options */
  418. #define WSM_MAX_FILTER_ELEMENTS (4)
  419. #define WSM_FILTER_ACTION_IGNORE (0)
  420. #define WSM_FILTER_ACTION_FILTER_IN (1)
  421. #define WSM_FILTER_ACTION_FILTER_OUT (2)
  422. #define WSM_FILTER_PORT_TYPE_DST (0)
  423. #define WSM_FILTER_PORT_TYPE_SRC (1)
  424. /* Actual header of WSM messages */
  425. struct wsm_hdr {
  426. __le16 len;
  427. __le16 id;
  428. };
  429. #define WSM_TX_SEQ_MAX (7)
  430. #define WSM_TX_SEQ(seq) \
  431. ((seq & WSM_TX_SEQ_MAX) << 13)
  432. #define WSM_TX_LINK_ID_MAX (0x0F)
  433. #define WSM_TX_LINK_ID(link_id) \
  434. ((link_id & WSM_TX_LINK_ID_MAX) << 6)
  435. #define MAX_BEACON_SKIP_TIME_MS 1000
  436. #define WSM_CMD_LAST_CHANCE_TIMEOUT (HZ * 3 / 2)
  437. /* ******************************************************************** */
  438. /* WSM capability */
  439. #define WSM_STARTUP_IND_ID 0x0801
  440. struct wsm_startup_ind {
  441. u16 input_buffers;
  442. u16 input_buffer_size;
  443. u16 status;
  444. u16 hw_id;
  445. u16 hw_subid;
  446. u16 fw_cap;
  447. u16 fw_type;
  448. u16 fw_api;
  449. u16 fw_build;
  450. u16 fw_ver;
  451. char fw_label[128];
  452. u32 config[4];
  453. };
  454. /* ******************************************************************** */
  455. /* WSM commands */
  456. /* 3.1 */
  457. #define WSM_CONFIGURATION_REQ_ID 0x0009
  458. #define WSM_CONFIGURATION_RESP_ID 0x0409
  459. struct wsm_tx_power_range {
  460. int min_power_level;
  461. int max_power_level;
  462. u32 stepping;
  463. };
  464. struct wsm_configuration {
  465. /* [in] */ u32 dot11MaxTransmitMsduLifeTime;
  466. /* [in] */ u32 dot11MaxReceiveLifeTime;
  467. /* [in] */ u32 dot11RtsThreshold;
  468. /* [in, out] */ u8 *dot11StationId;
  469. /* [in] */ const void *dpdData;
  470. /* [in] */ size_t dpdData_size;
  471. /* [out] */ u8 dot11FrequencyBandsSupported;
  472. /* [out] */ u32 supportedRateMask;
  473. /* [out] */ struct wsm_tx_power_range txPowerRange[2];
  474. };
  475. int wsm_configuration(struct cw1200_common *priv,
  476. struct wsm_configuration *arg);
  477. /* 3.3 */
  478. #define WSM_RESET_REQ_ID 0x000A
  479. #define WSM_RESET_RESP_ID 0x040A
  480. struct wsm_reset {
  481. /* [in] */ int link_id;
  482. /* [in] */ bool reset_statistics;
  483. };
  484. int wsm_reset(struct cw1200_common *priv, const struct wsm_reset *arg);
  485. /* 3.5 */
  486. #define WSM_READ_MIB_REQ_ID 0x0005
  487. #define WSM_READ_MIB_RESP_ID 0x0405
  488. int wsm_read_mib(struct cw1200_common *priv, u16 mib_id, void *buf,
  489. size_t buf_size);
  490. /* 3.7 */
  491. #define WSM_WRITE_MIB_REQ_ID 0x0006
  492. #define WSM_WRITE_MIB_RESP_ID 0x0406
  493. int wsm_write_mib(struct cw1200_common *priv, u16 mib_id, void *buf,
  494. size_t buf_size);
  495. /* 3.9 */
  496. #define WSM_START_SCAN_REQ_ID 0x0007
  497. #define WSM_START_SCAN_RESP_ID 0x0407
  498. struct wsm_ssid {
  499. u8 ssid[32];
  500. u32 length;
  501. };
  502. struct wsm_scan_ch {
  503. u16 number;
  504. u32 min_chan_time;
  505. u32 max_chan_time;
  506. u32 tx_power_level;
  507. };
  508. struct wsm_scan {
  509. /* WSM_PHY_BAND_... */
  510. u8 band;
  511. /* WSM_SCAN_TYPE_... */
  512. u8 type;
  513. /* WSM_SCAN_FLAG_... */
  514. u8 flags;
  515. /* WSM_TRANSMIT_RATE_... */
  516. u8 max_tx_rate;
  517. /* Interval period in TUs that the device shall the re- */
  518. /* execute the requested scan. Max value supported by the device */
  519. /* is 256s. */
  520. u32 auto_scan_interval;
  521. /* Number of probe requests (per SSID) sent to one (1) */
  522. /* channel. Zero (0) means that none is send, which */
  523. /* means that a passive scan is to be done. Value */
  524. /* greater than zero (0) means that an active scan is to */
  525. /* be done. */
  526. u32 num_probes;
  527. /* Number of channels to be scanned. */
  528. /* Maximum value is WSM_SCAN_MAX_NUM_OF_CHANNELS. */
  529. u8 num_channels;
  530. /* Number of SSID provided in the scan command (this */
  531. /* is zero (0) in broadcast scan) */
  532. /* The maximum number of SSIDs is WSM_SCAN_MAX_NUM_OF_SSIDS. */
  533. u8 num_ssids;
  534. /* The delay time (in microseconds) period */
  535. /* before sending a probe-request. */
  536. u8 probe_delay;
  537. /* SSIDs to be scanned [numOfSSIDs]; */
  538. struct wsm_ssid *ssids;
  539. /* Channels to be scanned [numOfChannels]; */
  540. struct wsm_scan_ch *ch;
  541. };
  542. int wsm_scan(struct cw1200_common *priv, const struct wsm_scan *arg);
  543. /* 3.11 */
  544. #define WSM_STOP_SCAN_REQ_ID 0x0008
  545. #define WSM_STOP_SCAN_RESP_ID 0x0408
  546. int wsm_stop_scan(struct cw1200_common *priv);
  547. /* 3.13 */
  548. #define WSM_SCAN_COMPLETE_IND_ID 0x0806
  549. struct wsm_scan_complete {
  550. /* WSM_STATUS_... */
  551. u32 status;
  552. /* WSM_PSM_... */
  553. u8 psm;
  554. /* Number of channels that the scan operation completed. */
  555. u8 num_channels;
  556. };
  557. /* 3.14 */
  558. #define WSM_TX_CONFIRM_IND_ID 0x0404
  559. #define WSM_MULTI_TX_CONFIRM_ID 0x041E
  560. struct wsm_tx_confirm {
  561. /* Packet identifier used in wsm_tx. */
  562. u32 packet_id;
  563. /* WSM_STATUS_... */
  564. u32 status;
  565. /* WSM_TRANSMIT_RATE_... */
  566. u8 tx_rate;
  567. /* The number of times the frame was transmitted */
  568. /* without receiving an acknowledgement. */
  569. u8 ack_failures;
  570. /* WSM_TX_STATUS_... */
  571. u16 flags;
  572. /* The total time in microseconds that the frame spent in */
  573. /* the WLAN device before transmission as completed. */
  574. u32 media_delay;
  575. /* The total time in microseconds that the frame spent in */
  576. /* the WLAN device before transmission was started. */
  577. u32 tx_queue_delay;
  578. };
  579. /* 3.15 */
  580. typedef void (*wsm_tx_confirm_cb) (struct cw1200_common *priv,
  581. struct wsm_tx_confirm *arg);
  582. /* Note that ideology of wsm_tx struct is different against the rest of
  583. * WSM API. wsm_hdr is /not/ a caller-adapted struct to be used as an input
  584. * argument for WSM call, but a prepared bytestream to be sent to firmware.
  585. * It is filled partly in cw1200_tx, partly in low-level WSM code.
  586. * Please pay attention once again: ideology is different.
  587. *
  588. * Legend:
  589. * - [in]: cw1200_tx must fill this field.
  590. * - [wsm]: the field is filled by low-level WSM.
  591. */
  592. struct wsm_tx {
  593. /* common WSM header */
  594. struct wsm_hdr hdr;
  595. /* Packet identifier that meant to be used in completion. */
  596. __le32 packet_id;
  597. /* WSM_TRANSMIT_RATE_... */
  598. u8 max_tx_rate;
  599. /* WSM_QUEUE_... */
  600. u8 queue_id;
  601. /* True: another packet is pending on the host for transmission. */
  602. u8 more;
  603. /* Bit 0 = 0 - Start expiry time from first Tx attempt (default) */
  604. /* Bit 0 = 1 - Start expiry time from receipt of Tx Request */
  605. /* Bits 3:1 - PTA Priority */
  606. /* Bits 6:4 - Tx Rate Retry Policy */
  607. /* Bit 7 - Reserved */
  608. u8 flags;
  609. /* Should be 0. */
  610. __le32 reserved;
  611. /* The elapsed time in TUs, after the initial transmission */
  612. /* of an MSDU, after which further attempts to transmit */
  613. /* the MSDU shall be terminated. Overrides the global */
  614. /* dot11MaxTransmitMsduLifeTime setting [optional] */
  615. /* Device will set the default value if this is 0. */
  616. __le32 expire_time;
  617. /* WSM_HT_TX_... */
  618. __le32 ht_tx_parameters;
  619. };
  620. /* = sizeof(generic hi hdr) + sizeof(wsm hdr) + sizeof(alignment) */
  621. #define WSM_TX_EXTRA_HEADROOM (28)
  622. /* 3.16 */
  623. #define WSM_RECEIVE_IND_ID 0x0804
  624. struct wsm_rx {
  625. /* WSM_STATUS_... */
  626. __le32 status;
  627. /* Specifies the channel of the received packet. */
  628. __le16 channel_number;
  629. /* WSM_TRANSMIT_RATE_... */
  630. u8 rx_rate;
  631. /* This value is expressed in signed Q8.0 format for */
  632. /* RSSI and unsigned Q7.1 format for RCPI. */
  633. u8 rcpi_rssi;
  634. /* WSM_RX_STATUS_... */
  635. __le32 flags;
  636. /* Payload */
  637. u8 data[0];
  638. } __packed;
  639. /* = sizeof(generic hi hdr) + sizeof(wsm hdr) */
  640. #define WSM_RX_EXTRA_HEADROOM (16)
  641. typedef void (*wsm_rx_cb) (struct cw1200_common *priv, struct wsm_rx *arg,
  642. struct sk_buff **skb_p);
  643. /* 3.17 */
  644. struct wsm_event {
  645. /* WSM_STATUS_... */
  646. /* [out] */ u32 id;
  647. /* Indication parameters. */
  648. /* For error indication, this shall be a 32-bit WSM status. */
  649. /* For RCPI or RSSI indication, this should be an 8-bit */
  650. /* RCPI or RSSI value. */
  651. /* [out] */ u32 data;
  652. };
  653. struct cw1200_wsm_event {
  654. struct list_head link;
  655. struct wsm_event evt;
  656. };
  657. /* 3.18 - 3.22 */
  658. /* Measurement. Skipped for now. Irrelevent. */
  659. typedef void (*wsm_event_cb) (struct cw1200_common *priv,
  660. struct wsm_event *arg);
  661. /* 3.23 */
  662. #define WSM_JOIN_REQ_ID 0x000B
  663. #define WSM_JOIN_RESP_ID 0x040B
  664. struct wsm_join {
  665. /* WSM_JOIN_MODE_... */
  666. u8 mode;
  667. /* WSM_PHY_BAND_... */
  668. u8 band;
  669. /* Specifies the channel number to join. The channel */
  670. /* number will be mapped to an actual frequency */
  671. /* according to the band */
  672. u16 channel_number;
  673. /* Specifies the BSSID of the BSS or IBSS to be joined */
  674. /* or the IBSS to be started. */
  675. u8 bssid[6];
  676. /* ATIM window of IBSS */
  677. /* When ATIM window is zero the initiated IBSS does */
  678. /* not support power saving. */
  679. u16 atim_window;
  680. /* WSM_JOIN_PREAMBLE_... */
  681. u8 preamble_type;
  682. /* Specifies if a probe request should be send with the */
  683. /* specified SSID when joining to the network. */
  684. u8 probe_for_join;
  685. /* DTIM Period (In multiples of beacon interval) */
  686. u8 dtim_period;
  687. /* WSM_JOIN_FLAGS_... */
  688. u8 flags;
  689. /* Length of the SSID */
  690. u32 ssid_len;
  691. /* Specifies the SSID of the IBSS to join or start */
  692. u8 ssid[32];
  693. /* Specifies the time between TBTTs in TUs */
  694. u32 beacon_interval;
  695. /* A bit mask that defines the BSS basic rate set. */
  696. u32 basic_rate_set;
  697. };
  698. struct wsm_join_cnf {
  699. u32 status;
  700. /* Minimum transmission power level in units of 0.1dBm */
  701. u32 min_power_level;
  702. /* Maximum transmission power level in units of 0.1dBm */
  703. u32 max_power_level;
  704. };
  705. int wsm_join(struct cw1200_common *priv, struct wsm_join *arg);
  706. /* 3.24 */
  707. struct wsm_join_complete {
  708. /* WSM_STATUS_... */
  709. u32 status;
  710. };
  711. /* 3.25 */
  712. #define WSM_SET_PM_REQ_ID 0x0010
  713. #define WSM_SET_PM_RESP_ID 0x0410
  714. struct wsm_set_pm {
  715. /* WSM_PSM_... */
  716. u8 mode;
  717. /* in unit of 500us; 0 to use default */
  718. u8 fast_psm_idle_period;
  719. /* in unit of 500us; 0 to use default */
  720. u8 ap_psm_change_period;
  721. /* in unit of 500us; 0 to disable auto-pspoll */
  722. u8 min_auto_pspoll_period;
  723. };
  724. int wsm_set_pm(struct cw1200_common *priv, const struct wsm_set_pm *arg);
  725. /* 3.27 */
  726. struct wsm_set_pm_complete {
  727. u8 psm; /* WSM_PSM_... */
  728. };
  729. /* 3.28 */
  730. #define WSM_SET_BSS_PARAMS_REQ_ID 0x0011
  731. #define WSM_SET_BSS_PARAMS_RESP_ID 0x0411
  732. struct wsm_set_bss_params {
  733. /* This resets the beacon loss counters only */
  734. u8 reset_beacon_loss;
  735. /* The number of lost consecutive beacons after which */
  736. /* the WLAN device should indicate the BSS-Lost event */
  737. /* to the WLAN host driver. */
  738. u8 beacon_lost_count;
  739. /* The AID received during the association process. */
  740. u16 aid;
  741. /* The operational rate set mask */
  742. u32 operational_rate_set;
  743. };
  744. int wsm_set_bss_params(struct cw1200_common *priv,
  745. const struct wsm_set_bss_params *arg);
  746. /* 3.30 */
  747. #define WSM_ADD_KEY_REQ_ID 0x000C
  748. #define WSM_ADD_KEY_RESP_ID 0x040C
  749. struct wsm_add_key {
  750. u8 type; /* WSM_KEY_TYPE_... */
  751. u8 index; /* Key entry index: 0 -- WSM_KEY_MAX_INDEX */
  752. u16 reserved;
  753. union {
  754. struct {
  755. u8 peer[6]; /* MAC address of the
  756. * peer station */
  757. u8 reserved;
  758. u8 keylen; /* Key length in bytes */
  759. u8 keydata[16]; /* Key data */
  760. } __packed wep_pairwise;
  761. struct {
  762. u8 keyid; /* Unique per key identifier
  763. * (0..3) */
  764. u8 keylen; /* Key length in bytes */
  765. u16 reserved;
  766. u8 keydata[16]; /* Key data */
  767. } __packed wep_group;
  768. struct {
  769. u8 peer[6]; /* MAC address of the
  770. * peer station */
  771. u16 reserved;
  772. u8 keydata[16]; /* TKIP key data */
  773. u8 rx_mic_key[8]; /* Rx MIC key */
  774. u8 tx_mic_key[8]; /* Tx MIC key */
  775. } __packed tkip_pairwise;
  776. struct {
  777. u8 keydata[16]; /* TKIP key data */
  778. u8 rx_mic_key[8]; /* Rx MIC key */
  779. u8 keyid; /* Key ID */
  780. u8 reserved[3];
  781. u8 rx_seqnum[8]; /* Receive Sequence Counter */
  782. } __packed tkip_group;
  783. struct {
  784. u8 peer[6]; /* MAC address of the
  785. * peer station */
  786. u16 reserved;
  787. u8 keydata[16]; /* AES key data */
  788. } __packed aes_pairwise;
  789. struct {
  790. u8 keydata[16]; /* AES key data */
  791. u8 keyid; /* Key ID */
  792. u8 reserved[3];
  793. u8 rx_seqnum[8]; /* Receive Sequence Counter */
  794. } __packed aes_group;
  795. struct {
  796. u8 peer[6]; /* MAC address of the
  797. * peer station */
  798. u8 keyid; /* Key ID */
  799. u8 reserved;
  800. u8 keydata[16]; /* WAPI key data */
  801. u8 mic_key[16]; /* MIC key data */
  802. } __packed wapi_pairwise;
  803. struct {
  804. u8 keydata[16]; /* WAPI key data */
  805. u8 mic_key[16]; /* MIC key data */
  806. u8 keyid; /* Key ID */
  807. u8 reserved[3];
  808. } __packed wapi_group;
  809. } __packed;
  810. } __packed;
  811. int wsm_add_key(struct cw1200_common *priv, const struct wsm_add_key *arg);
  812. /* 3.32 */
  813. #define WSM_REMOVE_KEY_REQ_ID 0x000D
  814. #define WSM_REMOVE_KEY_RESP_ID 0x040D
  815. struct wsm_remove_key {
  816. u8 index; /* Key entry index : 0-10 */
  817. };
  818. int wsm_remove_key(struct cw1200_common *priv,
  819. const struct wsm_remove_key *arg);
  820. /* 3.34 */
  821. struct wsm_set_tx_queue_params {
  822. /* WSM_ACK_POLICY_... */
  823. u8 ackPolicy;
  824. /* Medium Time of TSPEC (in 32us units) allowed per */
  825. /* One Second Averaging Period for this queue. */
  826. u16 allowedMediumTime;
  827. /* dot11MaxTransmitMsduLifetime to be used for the */
  828. /* specified queue. */
  829. u32 maxTransmitLifetime;
  830. };
  831. struct wsm_tx_queue_params {
  832. /* NOTE: index is a linux queue id. */
  833. struct wsm_set_tx_queue_params params[4];
  834. };
  835. #define WSM_TX_QUEUE_SET(queue_params, queue, ack_policy, allowed_time,\
  836. max_life_time) \
  837. do { \
  838. struct wsm_set_tx_queue_params *p = &(queue_params)->params[queue]; \
  839. p->ackPolicy = (ack_policy); \
  840. p->allowedMediumTime = (allowed_time); \
  841. p->maxTransmitLifetime = (max_life_time); \
  842. } while (0)
  843. int wsm_set_tx_queue_params(struct cw1200_common *priv,
  844. const struct wsm_set_tx_queue_params *arg, u8 id);
  845. /* 3.36 */
  846. #define WSM_EDCA_PARAMS_REQ_ID 0x0013
  847. #define WSM_EDCA_PARAMS_RESP_ID 0x0413
  848. struct wsm_edca_queue_params {
  849. /* CWmin (in slots) for the access class. */
  850. __le16 cwmin;
  851. /* CWmax (in slots) for the access class. */
  852. __le16 cwmax;
  853. /* AIFS (in slots) for the access class. */
  854. __le16 aifns;
  855. /* TX OP Limit (in microseconds) for the access class. */
  856. __le16 txop_limit;
  857. /* dot11MaxReceiveLifetime to be used for the specified */
  858. /* the access class. Overrides the global */
  859. /* dot11MaxReceiveLifetime value */
  860. __le32 max_rx_lifetime;
  861. } __packed;
  862. struct wsm_edca_params {
  863. /* NOTE: index is a linux queue id. */
  864. struct wsm_edca_queue_params params[4];
  865. bool uapsd_enable[4];
  866. };
  867. #define TXOP_UNIT 32
  868. #define WSM_EDCA_SET(__edca, __queue, __aifs, __cw_min, __cw_max, __txop, __lifetime,\
  869. __uapsd) \
  870. do { \
  871. struct wsm_edca_queue_params *p = &(__edca)->params[__queue]; \
  872. p->cwmin = (__cw_min); \
  873. p->cwmax = (__cw_max); \
  874. p->aifns = (__aifs); \
  875. p->txop_limit = ((__txop) * TXOP_UNIT); \
  876. p->max_rx_lifetime = (__lifetime); \
  877. (__edca)->uapsd_enable[__queue] = (__uapsd); \
  878. } while (0)
  879. int wsm_set_edca_params(struct cw1200_common *priv,
  880. const struct wsm_edca_params *arg);
  881. int wsm_set_uapsd_param(struct cw1200_common *priv,
  882. const struct wsm_edca_params *arg);
  883. /* 3.38 */
  884. /* Set-System info. Skipped for now. Irrelevent. */
  885. /* 3.40 */
  886. #define WSM_SWITCH_CHANNEL_REQ_ID 0x0016
  887. #define WSM_SWITCH_CHANNEL_RESP_ID 0x0416
  888. struct wsm_switch_channel {
  889. /* 1 - means the STA shall not transmit any further */
  890. /* frames until the channel switch has completed */
  891. u8 mode;
  892. /* Number of TBTTs until channel switch occurs. */
  893. /* 0 - indicates switch shall occur at any time */
  894. /* 1 - occurs immediately before the next TBTT */
  895. u8 switch_count;
  896. /* The new channel number to switch to. */
  897. /* Note this is defined as per section 2.7. */
  898. u16 channel_number;
  899. };
  900. int wsm_switch_channel(struct cw1200_common *priv,
  901. const struct wsm_switch_channel *arg);
  902. typedef void (*wsm_channel_switch_cb) (struct cw1200_common *priv);
  903. #define WSM_START_REQ_ID 0x0017
  904. #define WSM_START_RESP_ID 0x0417
  905. struct wsm_start {
  906. /* WSM_START_MODE_... */
  907. /* [in] */ u8 mode;
  908. /* WSM_PHY_BAND_... */
  909. /* [in] */ u8 band;
  910. /* Channel number */
  911. /* [in] */ u16 channel_number;
  912. /* Client Traffic window in units of TU */
  913. /* Valid only when mode == ..._P2P */
  914. /* [in] */ u32 ct_window;
  915. /* Interval between two consecutive */
  916. /* beacon transmissions in TU. */
  917. /* [in] */ u32 beacon_interval;
  918. /* DTIM period in terms of beacon intervals */
  919. /* [in] */ u8 dtim_period;
  920. /* WSM_JOIN_PREAMBLE_... */
  921. /* [in] */ u8 preamble;
  922. /* The delay time (in microseconds) period */
  923. /* before sending a probe-request. */
  924. /* [in] */ u8 probe_delay;
  925. /* Length of the SSID */
  926. /* [in] */ u8 ssid_len;
  927. /* SSID of the BSS or P2P_GO to be started now. */
  928. /* [in] */ u8 ssid[32];
  929. /* The basic supported rates for the MiniAP. */
  930. /* [in] */ u32 basic_rate_set;
  931. };
  932. int wsm_start(struct cw1200_common *priv, const struct wsm_start *arg);
  933. #define WSM_BEACON_TRANSMIT_REQ_ID 0x0018
  934. #define WSM_BEACON_TRANSMIT_RESP_ID 0x0418
  935. struct wsm_beacon_transmit {
  936. /* 1: enable; 0: disable */
  937. /* [in] */ u8 enable_beaconing;
  938. };
  939. int wsm_beacon_transmit(struct cw1200_common *priv,
  940. const struct wsm_beacon_transmit *arg);
  941. int wsm_start_find(struct cw1200_common *priv);
  942. int wsm_stop_find(struct cw1200_common *priv);
  943. typedef void (*wsm_find_complete_cb) (struct cw1200_common *priv, u32 status);
  944. struct wsm_suspend_resume {
  945. /* See 3.52 */
  946. /* Link ID */
  947. /* [out] */ int link_id;
  948. /* Stop sending further Tx requests down to device for this link */
  949. /* [out] */ bool stop;
  950. /* Transmit multicast Frames */
  951. /* [out] */ bool multicast;
  952. /* The AC on which Tx to be suspended /resumed. */
  953. /* This is applicable only for U-APSD */
  954. /* WSM_QUEUE_... */
  955. /* [out] */ int queue;
  956. };
  957. typedef void (*wsm_suspend_resume_cb) (struct cw1200_common *priv,
  958. struct wsm_suspend_resume *arg);
  959. /* 3.54 Update-IE request. */
  960. struct wsm_update_ie {
  961. /* WSM_UPDATE_IE_... */
  962. /* [in] */ u16 what;
  963. /* [in] */ u16 count;
  964. /* [in] */ u8 *ies;
  965. /* [in] */ size_t length;
  966. };
  967. int wsm_update_ie(struct cw1200_common *priv,
  968. const struct wsm_update_ie *arg);
  969. /* 3.56 */
  970. struct wsm_map_link {
  971. /* MAC address of the remote device */
  972. /* [in] */ u8 mac_addr[6];
  973. /* [in] */ u8 link_id;
  974. };
  975. int wsm_map_link(struct cw1200_common *priv, const struct wsm_map_link *arg);
  976. /* ******************************************************************** */
  977. /* MIB shortcats */
  978. static inline int wsm_set_output_power(struct cw1200_common *priv,
  979. int power_level)
  980. {
  981. __le32 val = __cpu_to_le32(power_level);
  982. return wsm_write_mib(priv, WSM_MIB_ID_DOT11_CURRENT_TX_POWER_LEVEL,
  983. &val, sizeof(val));
  984. }
  985. static inline int wsm_set_beacon_wakeup_period(struct cw1200_common *priv,
  986. unsigned dtim_interval,
  987. unsigned listen_interval)
  988. {
  989. struct {
  990. u8 numBeaconPeriods;
  991. u8 reserved;
  992. __le16 listenInterval;
  993. } val = {
  994. dtim_interval, 0, __cpu_to_le16(listen_interval)
  995. };
  996. if (dtim_interval > 0xFF || listen_interval > 0xFFFF)
  997. return -EINVAL;
  998. else
  999. return wsm_write_mib(priv, WSM_MIB_ID_BEACON_WAKEUP_PERIOD,
  1000. &val, sizeof(val));
  1001. }
  1002. struct wsm_rcpi_rssi_threshold {
  1003. u8 rssiRcpiMode; /* WSM_RCPI_RSSI_... */
  1004. u8 lowerThreshold;
  1005. u8 upperThreshold;
  1006. u8 rollingAverageCount;
  1007. };
  1008. static inline int wsm_set_rcpi_rssi_threshold(struct cw1200_common *priv,
  1009. struct wsm_rcpi_rssi_threshold *arg)
  1010. {
  1011. return wsm_write_mib(priv, WSM_MIB_ID_RCPI_RSSI_THRESHOLD, arg,
  1012. sizeof(*arg));
  1013. }
  1014. struct wsm_mib_counters_table {
  1015. __le32 plcp_errors;
  1016. __le32 fcs_errors;
  1017. __le32 tx_packets;
  1018. __le32 rx_packets;
  1019. __le32 rx_packet_errors;
  1020. __le32 rx_decryption_failures;
  1021. __le32 rx_mic_failures;
  1022. __le32 rx_no_key_failures;
  1023. __le32 tx_multicast_frames;
  1024. __le32 tx_frames_success;
  1025. __le32 tx_frame_failures;
  1026. __le32 tx_frames_retried;
  1027. __le32 tx_frames_multi_retried;
  1028. __le32 rx_frame_duplicates;
  1029. __le32 rts_success;
  1030. __le32 rts_failures;
  1031. __le32 ack_failures;
  1032. __le32 rx_multicast_frames;
  1033. __le32 rx_frames_success;
  1034. __le32 rx_cmac_icv_errors;
  1035. __le32 rx_cmac_replays;
  1036. __le32 rx_mgmt_ccmp_replays;
  1037. } __packed;
  1038. static inline int wsm_get_counters_table(struct cw1200_common *priv,
  1039. struct wsm_mib_counters_table *arg)
  1040. {
  1041. return wsm_read_mib(priv, WSM_MIB_ID_COUNTERS_TABLE,
  1042. arg, sizeof(*arg));
  1043. }
  1044. static inline int wsm_get_station_id(struct cw1200_common *priv, u8 *mac)
  1045. {
  1046. return wsm_read_mib(priv, WSM_MIB_ID_DOT11_STATION_ID, mac, ETH_ALEN);
  1047. }
  1048. struct wsm_rx_filter {
  1049. bool promiscuous;
  1050. bool bssid;
  1051. bool fcs;
  1052. bool probeResponder;
  1053. };
  1054. static inline int wsm_set_rx_filter(struct cw1200_common *priv,
  1055. const struct wsm_rx_filter *arg)
  1056. {
  1057. __le32 val = 0;
  1058. if (arg->promiscuous)
  1059. val |= __cpu_to_le32(BIT(0));
  1060. if (arg->bssid)
  1061. val |= __cpu_to_le32(BIT(1));
  1062. if (arg->fcs)
  1063. val |= __cpu_to_le32(BIT(2));
  1064. if (arg->probeResponder)
  1065. val |= __cpu_to_le32(BIT(3));
  1066. return wsm_write_mib(priv, WSM_MIB_ID_RX_FILTER, &val, sizeof(val));
  1067. }
  1068. int wsm_set_probe_responder(struct cw1200_common *priv, bool enable);
  1069. #define WSM_BEACON_FILTER_IE_HAS_CHANGED BIT(0)
  1070. #define WSM_BEACON_FILTER_IE_NO_LONGER_PRESENT BIT(1)
  1071. #define WSM_BEACON_FILTER_IE_HAS_APPEARED BIT(2)
  1072. struct wsm_beacon_filter_table_entry {
  1073. u8 ie_id;
  1074. u8 flags;
  1075. u8 oui[3];
  1076. u8 match_data[3];
  1077. } __packed;
  1078. struct wsm_mib_beacon_filter_table {
  1079. __le32 num;
  1080. struct wsm_beacon_filter_table_entry entry[10];
  1081. } __packed;
  1082. static inline int wsm_set_beacon_filter_table(struct cw1200_common *priv,
  1083. struct wsm_mib_beacon_filter_table *ft)
  1084. {
  1085. size_t size = __le32_to_cpu(ft->num) *
  1086. sizeof(struct wsm_beacon_filter_table_entry) +
  1087. sizeof(__le32);
  1088. return wsm_write_mib(priv, WSM_MIB_ID_BEACON_FILTER_TABLE, ft, size);
  1089. }
  1090. #define WSM_BEACON_FILTER_ENABLE BIT(0) /* Enable/disable beacon filtering */
  1091. #define WSM_BEACON_FILTER_AUTO_ERP BIT(1) /* If 1 FW will handle ERP IE changes internally */
  1092. struct wsm_beacon_filter_control {
  1093. int enabled;
  1094. int bcn_count;
  1095. };
  1096. static inline int wsm_beacon_filter_control(struct cw1200_common *priv,
  1097. struct wsm_beacon_filter_control *arg)
  1098. {
  1099. struct {
  1100. __le32 enabled;
  1101. __le32 bcn_count;
  1102. } val;
  1103. val.enabled = __cpu_to_le32(arg->enabled);
  1104. val.bcn_count = __cpu_to_le32(arg->bcn_count);
  1105. return wsm_write_mib(priv, WSM_MIB_ID_BEACON_FILTER_ENABLE, &val,
  1106. sizeof(val));
  1107. }
  1108. enum wsm_power_mode {
  1109. wsm_power_mode_active = 0,
  1110. wsm_power_mode_doze = 1,
  1111. wsm_power_mode_quiescent = 2,
  1112. };
  1113. struct wsm_operational_mode {
  1114. enum wsm_power_mode power_mode;
  1115. int disable_more_flag_usage;
  1116. int perform_ant_diversity;
  1117. };
  1118. static inline int wsm_set_operational_mode(struct cw1200_common *priv,
  1119. const struct wsm_operational_mode *arg)
  1120. {
  1121. u8 val = arg->power_mode;
  1122. if (arg->disable_more_flag_usage)
  1123. val |= BIT(4);
  1124. if (arg->perform_ant_diversity)
  1125. val |= BIT(5);
  1126. return wsm_write_mib(priv, WSM_MIB_ID_OPERATIONAL_POWER_MODE, &val,
  1127. sizeof(val));
  1128. }
  1129. struct wsm_template_frame {
  1130. u8 frame_type;
  1131. u8 rate;
  1132. struct sk_buff *skb;
  1133. };
  1134. static inline int wsm_set_template_frame(struct cw1200_common *priv,
  1135. struct wsm_template_frame *arg)
  1136. {
  1137. int ret;
  1138. u8 *p = skb_push(arg->skb, 4);
  1139. p[0] = arg->frame_type;
  1140. p[1] = arg->rate;
  1141. ((u16 *)p)[1] = __cpu_to_le16(arg->skb->len - 4);
  1142. ret = wsm_write_mib(priv, WSM_MIB_ID_TEMPLATE_FRAME, p, arg->skb->len);
  1143. skb_pull(arg->skb, 4);
  1144. return ret;
  1145. }
  1146. struct wsm_protected_mgmt_policy {
  1147. bool protectedMgmtEnable;
  1148. bool unprotectedMgmtFramesAllowed;
  1149. bool encryptionForAuthFrame;
  1150. };
  1151. static inline int wsm_set_protected_mgmt_policy(struct cw1200_common *priv,
  1152. struct wsm_protected_mgmt_policy *arg)
  1153. {
  1154. __le32 val = 0;
  1155. int ret;
  1156. if (arg->protectedMgmtEnable)
  1157. val |= __cpu_to_le32(BIT(0));
  1158. if (arg->unprotectedMgmtFramesAllowed)
  1159. val |= __cpu_to_le32(BIT(1));
  1160. if (arg->encryptionForAuthFrame)
  1161. val |= __cpu_to_le32(BIT(2));
  1162. ret = wsm_write_mib(priv, WSM_MIB_ID_PROTECTED_MGMT_POLICY,
  1163. &val, sizeof(val));
  1164. return ret;
  1165. }
  1166. struct wsm_mib_block_ack_policy {
  1167. u8 tx_tid;
  1168. u8 reserved1;
  1169. u8 rx_tid;
  1170. u8 reserved2;
  1171. } __packed;
  1172. static inline int wsm_set_block_ack_policy(struct cw1200_common *priv,
  1173. u8 tx_tid_policy,
  1174. u8 rx_tid_policy)
  1175. {
  1176. struct wsm_mib_block_ack_policy val = {
  1177. .tx_tid = tx_tid_policy,
  1178. .rx_tid = rx_tid_policy,
  1179. };
  1180. return wsm_write_mib(priv, WSM_MIB_ID_BLOCK_ACK_POLICY, &val,
  1181. sizeof(val));
  1182. }
  1183. struct wsm_mib_association_mode {
  1184. u8 flags; /* WSM_ASSOCIATION_MODE_... */
  1185. u8 preamble; /* WSM_JOIN_PREAMBLE_... */
  1186. u8 greenfield; /* 1 for greenfield */
  1187. u8 mpdu_start_spacing;
  1188. __le32 basic_rate_set;
  1189. } __packed;
  1190. static inline int wsm_set_association_mode(struct cw1200_common *priv,
  1191. struct wsm_mib_association_mode *arg)
  1192. {
  1193. return wsm_write_mib(priv, WSM_MIB_ID_SET_ASSOCIATION_MODE, arg,
  1194. sizeof(*arg));
  1195. }
  1196. #define WSM_TX_RATE_POLICY_FLAG_TERMINATE_WHEN_FINISHED BIT(2)
  1197. #define WSM_TX_RATE_POLICY_FLAG_COUNT_INITIAL_TRANSMIT BIT(3)
  1198. struct wsm_tx_rate_retry_policy {
  1199. u8 index;
  1200. u8 short_retries;
  1201. u8 long_retries;
  1202. /* BIT(2) - Terminate retries when Tx rate retry policy
  1203. * finishes.
  1204. * BIT(3) - Count initial frame transmission as part of
  1205. * rate retry counting but not as a retry
  1206. * attempt */
  1207. u8 flags;
  1208. u8 rate_recoveries;
  1209. u8 reserved[3];
  1210. __le32 rate_count_indices[3];
  1211. } __packed;
  1212. struct wsm_set_tx_rate_retry_policy {
  1213. u8 num;
  1214. u8 reserved[3];
  1215. struct wsm_tx_rate_retry_policy tbl[8];
  1216. } __packed;
  1217. static inline int wsm_set_tx_rate_retry_policy(struct cw1200_common *priv,
  1218. struct wsm_set_tx_rate_retry_policy *arg)
  1219. {
  1220. size_t size = 4 + arg->num * sizeof(struct wsm_tx_rate_retry_policy);
  1221. return wsm_write_mib(priv, WSM_MIB_ID_SET_TX_RATE_RETRY_POLICY, arg,
  1222. size);
  1223. }
  1224. /* 4.32 SetEtherTypeDataFrameFilter */
  1225. struct wsm_ether_type_filter_hdr {
  1226. u8 num; /* Up to WSM_MAX_FILTER_ELEMENTS */
  1227. u8 reserved[3];
  1228. } __packed;
  1229. struct wsm_ether_type_filter {
  1230. u8 action; /* WSM_FILTER_ACTION_XXX */
  1231. u8 reserved;
  1232. __le16 type; /* Type of ethernet frame */
  1233. } __packed;
  1234. static inline int wsm_set_ether_type_filter(struct cw1200_common *priv,
  1235. struct wsm_ether_type_filter_hdr *arg)
  1236. {
  1237. size_t size = sizeof(struct wsm_ether_type_filter_hdr) +
  1238. arg->num * sizeof(struct wsm_ether_type_filter);
  1239. return wsm_write_mib(priv, WSM_MIB_ID_SET_ETHERTYPE_DATAFRAME_FILTER,
  1240. arg, size);
  1241. }
  1242. /* 4.33 SetUDPPortDataFrameFilter */
  1243. struct wsm_udp_port_filter_hdr {
  1244. u8 num; /* Up to WSM_MAX_FILTER_ELEMENTS */
  1245. u8 reserved[3];
  1246. } __packed;
  1247. struct wsm_udp_port_filter {
  1248. u8 action; /* WSM_FILTER_ACTION_XXX */
  1249. u8 type; /* WSM_FILTER_PORT_TYPE_XXX */
  1250. __le16 port; /* Port number */
  1251. } __packed;
  1252. static inline int wsm_set_udp_port_filter(struct cw1200_common *priv,
  1253. struct wsm_udp_port_filter_hdr *arg)
  1254. {
  1255. size_t size = sizeof(struct wsm_udp_port_filter_hdr) +
  1256. arg->num * sizeof(struct wsm_udp_port_filter);
  1257. return wsm_write_mib(priv, WSM_MIB_ID_SET_UDPPORT_DATAFRAME_FILTER,
  1258. arg, size);
  1259. }
  1260. /* Undocumented MIBs: */
  1261. /* 4.35 P2PDeviceInfo */
  1262. #define D11_MAX_SSID_LEN (32)
  1263. struct wsm_p2p_device_type {
  1264. __le16 categoryId;
  1265. u8 oui[4];
  1266. __le16 subCategoryId;
  1267. } __packed;
  1268. struct wsm_p2p_device_info {
  1269. struct wsm_p2p_device_type primaryDevice;
  1270. u8 reserved1[3];
  1271. u8 devNameSize;
  1272. u8 localDevName[D11_MAX_SSID_LEN];
  1273. u8 reserved2[3];
  1274. u8 numSecDevSupported;
  1275. struct wsm_p2p_device_type secondaryDevices[0];
  1276. } __packed;
  1277. /* 4.36 SetWCDMABand - WO */
  1278. struct wsm_cdma_band {
  1279. u8 WCDMA_Band;
  1280. u8 reserved[3];
  1281. } __packed;
  1282. /* 4.37 GroupTxSequenceCounter - RO */
  1283. struct wsm_group_tx_seq {
  1284. __le32 bits_47_16;
  1285. __le16 bits_15_00;
  1286. __le16 reserved;
  1287. } __packed;
  1288. /* 4.39 SetHtProtection - WO */
  1289. #define WSM_DUAL_CTS_PROT_ENB (1 << 0)
  1290. #define WSM_NON_GREENFIELD_STA_PRESENT (1 << 1)
  1291. #define WSM_HT_PROT_MODE__NO_PROT (0 << 2)
  1292. #define WSM_HT_PROT_MODE__NON_MEMBER (1 << 2)
  1293. #define WSM_HT_PROT_MODE__20_MHZ (2 << 2)
  1294. #define WSM_HT_PROT_MODE__NON_HT_MIXED (3 << 2)
  1295. #define WSM_LSIG_TXOP_PROT_FULL (1 << 4)
  1296. #define WSM_LARGE_L_LENGTH_PROT (1 << 5)
  1297. struct wsm_ht_protection {
  1298. __le32 flags;
  1299. } __packed;
  1300. /* 4.40 GPIO Command - R/W */
  1301. #define WSM_GPIO_COMMAND_SETUP 0
  1302. #define WSM_GPIO_COMMAND_READ 1
  1303. #define WSM_GPIO_COMMAND_WRITE 2
  1304. #define WSM_GPIO_COMMAND_RESET 3
  1305. #define WSM_GPIO_ALL_PINS 0xFF
  1306. struct wsm_gpio_command {
  1307. u8 GPIO_Command;
  1308. u8 pin;
  1309. __le16 config;
  1310. } __packed;
  1311. /* 4.41 TSFCounter - RO */
  1312. struct wsm_tsf_counter {
  1313. __le64 TSF_Counter;
  1314. } __packed;
  1315. /* 4.43 Keep alive period */
  1316. struct wsm_keep_alive_period {
  1317. __le16 keepAlivePeriod;
  1318. u8 reserved[2];
  1319. } __packed;
  1320. static inline int wsm_keep_alive_period(struct cw1200_common *priv,
  1321. int period)
  1322. {
  1323. struct wsm_keep_alive_period arg = {
  1324. .keepAlivePeriod = __cpu_to_le16(period),
  1325. };
  1326. return wsm_write_mib(priv, WSM_MIB_ID_KEEP_ALIVE_PERIOD,
  1327. &arg, sizeof(arg));
  1328. };
  1329. /* BSSID filtering */
  1330. struct wsm_set_bssid_filtering {
  1331. u8 filter;
  1332. u8 reserved[3];
  1333. } __packed;
  1334. static inline int wsm_set_bssid_filtering(struct cw1200_common *priv,
  1335. bool enabled)
  1336. {
  1337. struct wsm_set_bssid_filtering arg = {
  1338. .filter = !enabled,
  1339. };
  1340. return wsm_write_mib(priv, WSM_MIB_ID_DISABLE_BSSID_FILTER,
  1341. &arg, sizeof(arg));
  1342. }
  1343. /* Multicast filtering - 4.5 */
  1344. struct wsm_mib_multicast_filter {
  1345. __le32 enable;
  1346. __le32 num_addrs;
  1347. u8 macaddrs[WSM_MAX_GRP_ADDRTABLE_ENTRIES][ETH_ALEN];
  1348. } __packed;
  1349. static inline int wsm_set_multicast_filter(struct cw1200_common *priv,
  1350. struct wsm_mib_multicast_filter *fp)
  1351. {
  1352. return wsm_write_mib(priv, WSM_MIB_ID_DOT11_GROUP_ADDRESSES_TABLE,
  1353. fp, sizeof(*fp));
  1354. }
  1355. /* ARP IPv4 filtering - 4.10 */
  1356. struct wsm_mib_arp_ipv4_filter {
  1357. __le32 enable;
  1358. __be32 ipv4addrs[WSM_MAX_ARP_IP_ADDRTABLE_ENTRIES];
  1359. } __packed;
  1360. static inline int wsm_set_arp_ipv4_filter(struct cw1200_common *priv,
  1361. struct wsm_mib_arp_ipv4_filter *fp)
  1362. {
  1363. return wsm_write_mib(priv, WSM_MIB_ID_ARP_IP_ADDRESSES_TABLE,
  1364. fp, sizeof(*fp));
  1365. }
  1366. /* P2P Power Save Mode Info - 4.31 */
  1367. struct wsm_p2p_ps_modeinfo {
  1368. u8 oppPsCTWindow;
  1369. u8 count;
  1370. u8 reserved;
  1371. u8 dtimCount;
  1372. __le32 duration;
  1373. __le32 interval;
  1374. __le32 startTime;
  1375. } __packed;
  1376. static inline int wsm_set_p2p_ps_modeinfo(struct cw1200_common *priv,
  1377. struct wsm_p2p_ps_modeinfo *mi)
  1378. {
  1379. return wsm_write_mib(priv, WSM_MIB_ID_P2P_PS_MODE_INFO,
  1380. mi, sizeof(*mi));
  1381. }
  1382. static inline int wsm_get_p2p_ps_modeinfo(struct cw1200_common *priv,
  1383. struct wsm_p2p_ps_modeinfo *mi)
  1384. {
  1385. return wsm_read_mib(priv, WSM_MIB_ID_P2P_PS_MODE_INFO,
  1386. mi, sizeof(*mi));
  1387. }
  1388. /* UseMultiTxConfMessage */
  1389. static inline int wsm_use_multi_tx_conf(struct cw1200_common *priv,
  1390. bool enabled)
  1391. {
  1392. __le32 arg = enabled ? __cpu_to_le32(1) : 0;
  1393. return wsm_write_mib(priv, WSM_MIB_USE_MULTI_TX_CONF,
  1394. &arg, sizeof(arg));
  1395. }
  1396. /* 4.26 SetUpasdInformation */
  1397. struct wsm_uapsd_info {
  1398. __le16 uapsd_flags;
  1399. __le16 min_auto_trigger_interval;
  1400. __le16 max_auto_trigger_interval;
  1401. __le16 auto_trigger_step;
  1402. };
  1403. static inline int wsm_set_uapsd_info(struct cw1200_common *priv,
  1404. struct wsm_uapsd_info *arg)
  1405. {
  1406. return wsm_write_mib(priv, WSM_MIB_ID_SET_UAPSD_INFORMATION,
  1407. arg, sizeof(*arg));
  1408. }
  1409. /* 4.22 OverrideInternalTxRate */
  1410. struct wsm_override_internal_txrate {
  1411. u8 internalTxRate;
  1412. u8 nonErpInternalTxRate;
  1413. u8 reserved[2];
  1414. } __packed;
  1415. static inline int wsm_set_override_internal_txrate(struct cw1200_common *priv,
  1416. struct wsm_override_internal_txrate *arg)
  1417. {
  1418. return wsm_write_mib(priv, WSM_MIB_ID_OVERRIDE_INTERNAL_TX_RATE,
  1419. arg, sizeof(*arg));
  1420. }
  1421. /* ******************************************************************** */
  1422. /* WSM TX port control */
  1423. void wsm_lock_tx(struct cw1200_common *priv);
  1424. void wsm_lock_tx_async(struct cw1200_common *priv);
  1425. bool wsm_flush_tx(struct cw1200_common *priv);
  1426. void wsm_unlock_tx(struct cw1200_common *priv);
  1427. /* ******************************************************************** */
  1428. /* WSM / BH API */
  1429. int wsm_handle_exception(struct cw1200_common *priv, u8 *data, size_t len);
  1430. int wsm_handle_rx(struct cw1200_common *priv, u16 id, struct wsm_hdr *wsm,
  1431. struct sk_buff **skb_p);
  1432. /* ******************************************************************** */
  1433. /* wsm_buf API */
  1434. struct wsm_buf {
  1435. u8 *begin;
  1436. u8 *data;
  1437. u8 *end;
  1438. };
  1439. void wsm_buf_init(struct wsm_buf *buf);
  1440. void wsm_buf_deinit(struct wsm_buf *buf);
  1441. /* ******************************************************************** */
  1442. /* wsm_cmd API */
  1443. struct wsm_cmd {
  1444. spinlock_t lock; /* Protect structure from multiple access */
  1445. int done;
  1446. u8 *ptr;
  1447. size_t len;
  1448. void *arg;
  1449. int ret;
  1450. u16 cmd;
  1451. };
  1452. /* ******************************************************************** */
  1453. /* WSM TX buffer access */
  1454. int wsm_get_tx(struct cw1200_common *priv, u8 **data,
  1455. size_t *tx_len, int *burst);
  1456. void wsm_txed(struct cw1200_common *priv, u8 *data);
  1457. /* ******************************************************************** */
  1458. /* Queue mapping: WSM <---> linux */
  1459. /* Linux: VO VI BE BK */
  1460. /* WSM: BE BK VI VO */
  1461. static inline u8 wsm_queue_id_to_linux(u8 queue_id)
  1462. {
  1463. static const u8 queue_mapping[] = {
  1464. 2, 3, 1, 0
  1465. };
  1466. return queue_mapping[queue_id];
  1467. }
  1468. static inline u8 wsm_queue_id_to_wsm(u8 queue_id)
  1469. {
  1470. static const u8 queue_mapping[] = {
  1471. 3, 2, 0, 1
  1472. };
  1473. return queue_mapping[queue_id];
  1474. }
  1475. #endif /* CW1200_HWIO_H_INCLUDED */