wsm.h 47 KB

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