wsm.h 47 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870
  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. u32 packet_id; /* Note this is actually a cookie */
  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. u32 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. } __packed;
  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. u32 status;
  630. /* Specifies the channel of the received packet. */
  631. u16 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. u32 flags;
  639. };
  640. /* = sizeof(generic hi hdr) + sizeof(wsm hdr) */
  641. #define WSM_RX_EXTRA_HEADROOM (16)
  642. typedef void (*wsm_rx_cb) (struct cw1200_common *priv, struct wsm_rx *arg,
  643. struct sk_buff **skb_p);
  644. /* 3.17 */
  645. struct wsm_event {
  646. /* WSM_STATUS_... */
  647. /* [out] */ u32 id;
  648. /* Indication parameters. */
  649. /* For error indication, this shall be a 32-bit WSM status. */
  650. /* For RCPI or RSSI indication, this should be an 8-bit */
  651. /* RCPI or RSSI value. */
  652. /* [out] */ u32 data;
  653. };
  654. struct cw1200_wsm_event {
  655. struct list_head link;
  656. struct wsm_event evt;
  657. };
  658. /* 3.18 - 3.22 */
  659. /* Measurement. Skipped for now. Irrelevent. */
  660. typedef void (*wsm_event_cb) (struct cw1200_common *priv,
  661. struct wsm_event *arg);
  662. /* 3.23 */
  663. #define WSM_JOIN_REQ_ID 0x000B
  664. #define WSM_JOIN_RESP_ID 0x040B
  665. struct wsm_join {
  666. /* WSM_JOIN_MODE_... */
  667. u8 mode;
  668. /* WSM_PHY_BAND_... */
  669. u8 band;
  670. /* Specifies the channel number to join. The channel */
  671. /* number will be mapped to an actual frequency */
  672. /* according to the band */
  673. u16 channel_number;
  674. /* Specifies the BSSID of the BSS or IBSS to be joined */
  675. /* or the IBSS to be started. */
  676. u8 bssid[6];
  677. /* ATIM window of IBSS */
  678. /* When ATIM window is zero the initiated IBSS does */
  679. /* not support power saving. */
  680. u16 atim_window;
  681. /* WSM_JOIN_PREAMBLE_... */
  682. u8 preamble_type;
  683. /* Specifies if a probe request should be send with the */
  684. /* specified SSID when joining to the network. */
  685. u8 probe_for_join;
  686. /* DTIM Period (In multiples of beacon interval) */
  687. u8 dtim_period;
  688. /* WSM_JOIN_FLAGS_... */
  689. u8 flags;
  690. /* Length of the SSID */
  691. u32 ssid_len;
  692. /* Specifies the SSID of the IBSS to join or start */
  693. u8 ssid[32];
  694. /* Specifies the time between TBTTs in TUs */
  695. u32 beacon_interval;
  696. /* A bit mask that defines the BSS basic rate set. */
  697. u32 basic_rate_set;
  698. };
  699. struct wsm_join_cnf {
  700. u32 status;
  701. /* Minimum transmission power level in units of 0.1dBm */
  702. u32 min_power_level;
  703. /* Maximum transmission power level in units of 0.1dBm */
  704. u32 max_power_level;
  705. };
  706. int wsm_join(struct cw1200_common *priv, struct wsm_join *arg);
  707. /* 3.24 */
  708. struct wsm_join_complete {
  709. /* WSM_STATUS_... */
  710. u32 status;
  711. };
  712. /* 3.25 */
  713. #define WSM_SET_PM_REQ_ID 0x0010
  714. #define WSM_SET_PM_RESP_ID 0x0410
  715. struct wsm_set_pm {
  716. /* WSM_PSM_... */
  717. u8 mode;
  718. /* in unit of 500us; 0 to use default */
  719. u8 fast_psm_idle_period;
  720. /* in unit of 500us; 0 to use default */
  721. u8 ap_psm_change_period;
  722. /* in unit of 500us; 0 to disable auto-pspoll */
  723. u8 min_auto_pspoll_period;
  724. };
  725. int wsm_set_pm(struct cw1200_common *priv, const struct wsm_set_pm *arg);
  726. /* 3.27 */
  727. struct wsm_set_pm_complete {
  728. u8 psm; /* WSM_PSM_... */
  729. };
  730. /* 3.28 */
  731. #define WSM_SET_BSS_PARAMS_REQ_ID 0x0011
  732. #define WSM_SET_BSS_PARAMS_RESP_ID 0x0411
  733. struct wsm_set_bss_params {
  734. /* This resets the beacon loss counters only */
  735. u8 reset_beacon_loss;
  736. /* The number of lost consecutive beacons after which */
  737. /* the WLAN device should indicate the BSS-Lost event */
  738. /* to the WLAN host driver. */
  739. u8 beacon_lost_count;
  740. /* The AID received during the association process. */
  741. u16 aid;
  742. /* The operational rate set mask */
  743. u32 operational_rate_set;
  744. };
  745. int wsm_set_bss_params(struct cw1200_common *priv,
  746. const struct wsm_set_bss_params *arg);
  747. /* 3.30 */
  748. #define WSM_ADD_KEY_REQ_ID 0x000C
  749. #define WSM_ADD_KEY_RESP_ID 0x040C
  750. struct wsm_add_key {
  751. u8 type; /* WSM_KEY_TYPE_... */
  752. u8 index; /* Key entry index: 0 -- WSM_KEY_MAX_INDEX */
  753. u16 reserved;
  754. union {
  755. struct {
  756. u8 peer[6]; /* MAC address of the 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 (0..3) */
  763. u8 keylen; /* Key length in bytes */
  764. u16 reserved;
  765. u8 keydata[16]; /* Key data */
  766. } __packed wep_group;
  767. struct {
  768. u8 peer[6]; /* MAC address of the peer station */
  769. u16 reserved;
  770. u8 keydata[16]; /* TKIP key data */
  771. u8 rx_mic_key[8]; /* Rx MIC key */
  772. u8 tx_mic_key[8]; /* Tx MIC key */
  773. } __packed tkip_pairwise;
  774. struct {
  775. u8 keydata[16]; /* TKIP key data */
  776. u8 rx_mic_key[8]; /* Rx MIC key */
  777. u8 keyid; /* Key ID */
  778. u8 reserved[3];
  779. u8 rx_seqnum[8]; /* Receive Sequence Counter */
  780. } __packed tkip_group;
  781. struct {
  782. u8 peer[6]; /* MAC address of the peer station */
  783. u16 reserved;
  784. u8 keydata[16]; /* AES key data */
  785. } __packed aes_pairwise;
  786. struct {
  787. u8 keydata[16]; /* AES key data */
  788. u8 keyid; /* Key ID */
  789. u8 reserved[3];
  790. u8 rx_seqnum[8]; /* Receive Sequence Counter */
  791. } __packed aes_group;
  792. struct {
  793. u8 peer[6]; /* MAC address of the peer station */
  794. u8 keyid; /* Key ID */
  795. u8 reserved;
  796. u8 keydata[16]; /* WAPI key data */
  797. u8 mic_key[16]; /* MIC key data */
  798. } __packed wapi_pairwise;
  799. struct {
  800. u8 keydata[16]; /* WAPI key data */
  801. u8 mic_key[16]; /* MIC key data */
  802. u8 keyid; /* Key ID */
  803. u8 reserved[3];
  804. } __packed wapi_group;
  805. } __packed;
  806. } __packed;
  807. int wsm_add_key(struct cw1200_common *priv, const struct wsm_add_key *arg);
  808. /* 3.32 */
  809. #define WSM_REMOVE_KEY_REQ_ID 0x000D
  810. #define WSM_REMOVE_KEY_RESP_ID 0x040D
  811. struct wsm_remove_key {
  812. u8 index; /* Key entry index : 0-10 */
  813. };
  814. int wsm_remove_key(struct cw1200_common *priv,
  815. const struct wsm_remove_key *arg);
  816. /* 3.34 */
  817. struct wsm_set_tx_queue_params {
  818. /* WSM_ACK_POLICY_... */
  819. u8 ackPolicy;
  820. /* Medium Time of TSPEC (in 32us units) allowed per */
  821. /* One Second Averaging Period for this queue. */
  822. u16 allowedMediumTime;
  823. /* dot11MaxTransmitMsduLifetime to be used for the */
  824. /* specified queue. */
  825. u32 maxTransmitLifetime;
  826. };
  827. struct wsm_tx_queue_params {
  828. /* NOTE: index is a linux queue id. */
  829. struct wsm_set_tx_queue_params params[4];
  830. };
  831. #define WSM_TX_QUEUE_SET(queue_params, queue, ack_policy, allowed_time,\
  832. max_life_time) \
  833. do { \
  834. struct wsm_set_tx_queue_params *p = &(queue_params)->params[queue]; \
  835. p->ackPolicy = (ack_policy); \
  836. p->allowedMediumTime = (allowed_time); \
  837. p->maxTransmitLifetime = (max_life_time); \
  838. } while (0)
  839. int wsm_set_tx_queue_params(struct cw1200_common *priv,
  840. const struct wsm_set_tx_queue_params *arg, u8 id);
  841. /* 3.36 */
  842. #define WSM_EDCA_PARAMS_REQ_ID 0x0013
  843. #define WSM_EDCA_PARAMS_RESP_ID 0x0413
  844. struct wsm_edca_queue_params {
  845. /* CWmin (in slots) for the access class. */
  846. u16 cwmin;
  847. /* CWmax (in slots) for the access class. */
  848. u16 cwmax;
  849. /* AIFS (in slots) for the access class. */
  850. u16 aifns;
  851. /* TX OP Limit (in microseconds) for the access class. */
  852. u16 txop_limit;
  853. /* dot11MaxReceiveLifetime to be used for the specified */
  854. /* the access class. Overrides the global */
  855. /* dot11MaxReceiveLifetime value */
  856. u32 max_rx_lifetime;
  857. };
  858. struct wsm_edca_params {
  859. /* NOTE: index is a linux queue id. */
  860. struct wsm_edca_queue_params params[4];
  861. bool uapsd_enable[4];
  862. };
  863. #define TXOP_UNIT 32
  864. #define WSM_EDCA_SET(__edca, __queue, __aifs, __cw_min, __cw_max, __txop, __lifetime,\
  865. __uapsd) \
  866. do { \
  867. struct wsm_edca_queue_params *p = &(__edca)->params[__queue]; \
  868. p->cwmin = __cw_min; \
  869. p->cwmax = __cw_max; \
  870. p->aifns = __aifs; \
  871. p->txop_limit = ((__txop) * TXOP_UNIT); \
  872. p->max_rx_lifetime = __lifetime; \
  873. (__edca)->uapsd_enable[__queue] = (__uapsd); \
  874. } while (0)
  875. int wsm_set_edca_params(struct cw1200_common *priv,
  876. const struct wsm_edca_params *arg);
  877. int wsm_set_uapsd_param(struct cw1200_common *priv,
  878. const struct wsm_edca_params *arg);
  879. /* 3.38 */
  880. /* Set-System info. Skipped for now. Irrelevent. */
  881. /* 3.40 */
  882. #define WSM_SWITCH_CHANNEL_REQ_ID 0x0016
  883. #define WSM_SWITCH_CHANNEL_RESP_ID 0x0416
  884. struct wsm_switch_channel {
  885. /* 1 - means the STA shall not transmit any further */
  886. /* frames until the channel switch has completed */
  887. u8 mode;
  888. /* Number of TBTTs until channel switch occurs. */
  889. /* 0 - indicates switch shall occur at any time */
  890. /* 1 - occurs immediately before the next TBTT */
  891. u8 switch_count;
  892. /* The new channel number to switch to. */
  893. /* Note this is defined as per section 2.7. */
  894. u16 channel_number;
  895. };
  896. int wsm_switch_channel(struct cw1200_common *priv,
  897. const struct wsm_switch_channel *arg);
  898. typedef void (*wsm_channel_switch_cb) (struct cw1200_common *priv);
  899. #define WSM_START_REQ_ID 0x0017
  900. #define WSM_START_RESP_ID 0x0417
  901. struct wsm_start {
  902. /* WSM_START_MODE_... */
  903. /* [in] */ u8 mode;
  904. /* WSM_PHY_BAND_... */
  905. /* [in] */ u8 band;
  906. /* Channel number */
  907. /* [in] */ u16 channel_number;
  908. /* Client Traffic window in units of TU */
  909. /* Valid only when mode == ..._P2P */
  910. /* [in] */ u32 ct_window;
  911. /* Interval between two consecutive */
  912. /* beacon transmissions in TU. */
  913. /* [in] */ u32 beacon_interval;
  914. /* DTIM period in terms of beacon intervals */
  915. /* [in] */ u8 dtim_period;
  916. /* WSM_JOIN_PREAMBLE_... */
  917. /* [in] */ u8 preamble;
  918. /* The delay time (in microseconds) period */
  919. /* before sending a probe-request. */
  920. /* [in] */ u8 probe_delay;
  921. /* Length of the SSID */
  922. /* [in] */ u8 ssid_len;
  923. /* SSID of the BSS or P2P_GO to be started now. */
  924. /* [in] */ u8 ssid[32];
  925. /* The basic supported rates for the MiniAP. */
  926. /* [in] */ u32 basic_rate_set;
  927. };
  928. int wsm_start(struct cw1200_common *priv, const struct wsm_start *arg);
  929. #define WSM_BEACON_TRANSMIT_REQ_ID 0x0018
  930. #define WSM_BEACON_TRANSMIT_RESP_ID 0x0418
  931. struct wsm_beacon_transmit {
  932. /* 1: enable; 0: disable */
  933. /* [in] */ u8 enable_beaconing;
  934. };
  935. int wsm_beacon_transmit(struct cw1200_common *priv,
  936. const struct wsm_beacon_transmit *arg);
  937. int wsm_start_find(struct cw1200_common *priv);
  938. int wsm_stop_find(struct cw1200_common *priv);
  939. typedef void (*wsm_find_complete_cb) (struct cw1200_common *priv, u32 status);
  940. struct wsm_suspend_resume {
  941. /* See 3.52 */
  942. /* Link ID */
  943. /* [out] */ int link_id;
  944. /* Stop sending further Tx requests down to device for this link */
  945. /* [out] */ bool stop;
  946. /* Transmit multicast Frames */
  947. /* [out] */ bool multicast;
  948. /* The AC on which Tx to be suspended /resumed. */
  949. /* This is applicable only for U-APSD */
  950. /* WSM_QUEUE_... */
  951. /* [out] */ int queue;
  952. };
  953. typedef void (*wsm_suspend_resume_cb) (struct cw1200_common *priv,
  954. struct wsm_suspend_resume *arg);
  955. /* 3.54 Update-IE request. */
  956. struct wsm_update_ie {
  957. /* WSM_UPDATE_IE_... */
  958. /* [in] */ u16 what;
  959. /* [in] */ u16 count;
  960. /* [in] */ u8 *ies;
  961. /* [in] */ size_t length;
  962. };
  963. int wsm_update_ie(struct cw1200_common *priv,
  964. const struct wsm_update_ie *arg);
  965. /* 3.56 */
  966. struct wsm_map_link {
  967. /* MAC address of the remote device */
  968. /* [in] */ u8 mac_addr[6];
  969. /* [in] */ u8 link_id;
  970. };
  971. int wsm_map_link(struct cw1200_common *priv, const struct wsm_map_link *arg);
  972. /* ******************************************************************** */
  973. /* MIB shortcats */
  974. static inline int wsm_set_output_power(struct cw1200_common *priv,
  975. int power_level)
  976. {
  977. __le32 val = __cpu_to_le32(power_level);
  978. return wsm_write_mib(priv, WSM_MIB_ID_DOT11_CURRENT_TX_POWER_LEVEL,
  979. &val, sizeof(val));
  980. }
  981. static inline int wsm_set_beacon_wakeup_period(struct cw1200_common *priv,
  982. unsigned dtim_interval,
  983. unsigned listen_interval)
  984. {
  985. struct {
  986. u8 numBeaconPeriods;
  987. u8 reserved;
  988. __le16 listenInterval;
  989. } val = {
  990. dtim_interval, 0, __cpu_to_le16(listen_interval)
  991. };
  992. if (dtim_interval > 0xFF || listen_interval > 0xFFFF)
  993. return -EINVAL;
  994. else
  995. return wsm_write_mib(priv, WSM_MIB_ID_BEACON_WAKEUP_PERIOD,
  996. &val, sizeof(val));
  997. }
  998. struct wsm_rcpi_rssi_threshold {
  999. u8 rssiRcpiMode; /* WSM_RCPI_RSSI_... */
  1000. u8 lowerThreshold;
  1001. u8 upperThreshold;
  1002. u8 rollingAverageCount;
  1003. };
  1004. static inline int wsm_set_rcpi_rssi_threshold(struct cw1200_common *priv,
  1005. struct wsm_rcpi_rssi_threshold *arg)
  1006. {
  1007. return wsm_write_mib(priv, WSM_MIB_ID_RCPI_RSSI_THRESHOLD, arg,
  1008. sizeof(*arg));
  1009. }
  1010. struct wsm_mib_counters_table {
  1011. __le32 plcp_errors;
  1012. __le32 fcs_errors;
  1013. __le32 tx_packets;
  1014. __le32 rx_packets;
  1015. __le32 rx_packet_errors;
  1016. __le32 rx_decryption_failures;
  1017. __le32 rx_mic_failures;
  1018. __le32 rx_no_key_failures;
  1019. __le32 tx_multicast_frames;
  1020. __le32 tx_frames_success;
  1021. __le32 tx_frame_failures;
  1022. __le32 tx_frames_retried;
  1023. __le32 tx_frames_multi_retried;
  1024. __le32 rx_frame_duplicates;
  1025. __le32 rts_success;
  1026. __le32 rts_failures;
  1027. __le32 ack_failures;
  1028. __le32 rx_multicast_frames;
  1029. __le32 rx_frames_success;
  1030. __le32 rx_cmac_icv_errors;
  1031. __le32 rx_cmac_replays;
  1032. __le32 rx_mgmt_ccmp_replays;
  1033. } __packed;
  1034. static inline int wsm_get_counters_table(struct cw1200_common *priv,
  1035. struct wsm_mib_counters_table *arg)
  1036. {
  1037. return wsm_read_mib(priv, WSM_MIB_ID_COUNTERS_TABLE,
  1038. arg, sizeof(*arg));
  1039. }
  1040. static inline int wsm_get_station_id(struct cw1200_common *priv, u8 *mac)
  1041. {
  1042. return wsm_read_mib(priv, WSM_MIB_ID_DOT11_STATION_ID, mac, ETH_ALEN);
  1043. }
  1044. struct wsm_rx_filter {
  1045. bool promiscuous;
  1046. bool bssid;
  1047. bool fcs;
  1048. bool probeResponder;
  1049. };
  1050. static inline int wsm_set_rx_filter(struct cw1200_common *priv,
  1051. const struct wsm_rx_filter *arg)
  1052. {
  1053. __le32 val = 0;
  1054. if (arg->promiscuous)
  1055. val |= __cpu_to_le32(BIT(0));
  1056. if (arg->bssid)
  1057. val |= __cpu_to_le32(BIT(1));
  1058. if (arg->fcs)
  1059. val |= __cpu_to_le32(BIT(2));
  1060. if (arg->probeResponder)
  1061. val |= __cpu_to_le32(BIT(3));
  1062. return wsm_write_mib(priv, WSM_MIB_ID_RX_FILTER, &val, sizeof(val));
  1063. }
  1064. int wsm_set_probe_responder(struct cw1200_common *priv, bool enable);
  1065. #define WSM_BEACON_FILTER_IE_HAS_CHANGED BIT(0)
  1066. #define WSM_BEACON_FILTER_IE_NO_LONGER_PRESENT BIT(1)
  1067. #define WSM_BEACON_FILTER_IE_HAS_APPEARED BIT(2)
  1068. struct wsm_beacon_filter_table_entry {
  1069. u8 ie_id;
  1070. u8 flags;
  1071. u8 oui[3];
  1072. u8 match_data[3];
  1073. } __packed;
  1074. struct wsm_mib_beacon_filter_table {
  1075. __le32 num;
  1076. struct wsm_beacon_filter_table_entry entry[10];
  1077. } __packed;
  1078. static inline int wsm_set_beacon_filter_table(struct cw1200_common *priv,
  1079. struct wsm_mib_beacon_filter_table *ft)
  1080. {
  1081. size_t size = __le32_to_cpu(ft->num) *
  1082. sizeof(struct wsm_beacon_filter_table_entry) +
  1083. sizeof(__le32);
  1084. return wsm_write_mib(priv, WSM_MIB_ID_BEACON_FILTER_TABLE, ft, size);
  1085. }
  1086. #define WSM_BEACON_FILTER_ENABLE BIT(0) /* Enable/disable beacon filtering */
  1087. #define WSM_BEACON_FILTER_AUTO_ERP BIT(1) /* If 1 FW will handle ERP IE changes internally */
  1088. struct wsm_beacon_filter_control {
  1089. int enabled;
  1090. int bcn_count;
  1091. };
  1092. static inline int wsm_beacon_filter_control(struct cw1200_common *priv,
  1093. struct wsm_beacon_filter_control *arg)
  1094. {
  1095. struct {
  1096. __le32 enabled;
  1097. __le32 bcn_count;
  1098. } val;
  1099. val.enabled = __cpu_to_le32(arg->enabled);
  1100. val.bcn_count = __cpu_to_le32(arg->bcn_count);
  1101. return wsm_write_mib(priv, WSM_MIB_ID_BEACON_FILTER_ENABLE, &val,
  1102. sizeof(val));
  1103. }
  1104. enum wsm_power_mode {
  1105. wsm_power_mode_active = 0,
  1106. wsm_power_mode_doze = 1,
  1107. wsm_power_mode_quiescent = 2,
  1108. };
  1109. struct wsm_operational_mode {
  1110. enum wsm_power_mode power_mode;
  1111. int disable_more_flag_usage;
  1112. int perform_ant_diversity;
  1113. };
  1114. static inline int wsm_set_operational_mode(struct cw1200_common *priv,
  1115. const struct wsm_operational_mode *arg)
  1116. {
  1117. u8 val = arg->power_mode;
  1118. if (arg->disable_more_flag_usage)
  1119. val |= BIT(4);
  1120. if (arg->perform_ant_diversity)
  1121. val |= BIT(5);
  1122. return wsm_write_mib(priv, WSM_MIB_ID_OPERATIONAL_POWER_MODE, &val,
  1123. sizeof(val));
  1124. }
  1125. struct wsm_template_frame {
  1126. u8 frame_type;
  1127. u8 rate;
  1128. struct sk_buff *skb;
  1129. };
  1130. static inline int wsm_set_template_frame(struct cw1200_common *priv,
  1131. struct wsm_template_frame *arg)
  1132. {
  1133. int ret;
  1134. u8 *p = skb_push(arg->skb, 4);
  1135. p[0] = arg->frame_type;
  1136. p[1] = arg->rate;
  1137. ((__le16 *)p)[1] = __cpu_to_le16(arg->skb->len - 4);
  1138. ret = wsm_write_mib(priv, WSM_MIB_ID_TEMPLATE_FRAME, p, arg->skb->len);
  1139. skb_pull(arg->skb, 4);
  1140. return ret;
  1141. }
  1142. struct wsm_protected_mgmt_policy {
  1143. bool protectedMgmtEnable;
  1144. bool unprotectedMgmtFramesAllowed;
  1145. bool encryptionForAuthFrame;
  1146. };
  1147. static inline int wsm_set_protected_mgmt_policy(struct cw1200_common *priv,
  1148. struct wsm_protected_mgmt_policy *arg)
  1149. {
  1150. __le32 val = 0;
  1151. int ret;
  1152. if (arg->protectedMgmtEnable)
  1153. val |= __cpu_to_le32(BIT(0));
  1154. if (arg->unprotectedMgmtFramesAllowed)
  1155. val |= __cpu_to_le32(BIT(1));
  1156. if (arg->encryptionForAuthFrame)
  1157. val |= __cpu_to_le32(BIT(2));
  1158. ret = wsm_write_mib(priv, WSM_MIB_ID_PROTECTED_MGMT_POLICY,
  1159. &val, sizeof(val));
  1160. return ret;
  1161. }
  1162. struct wsm_mib_block_ack_policy {
  1163. u8 tx_tid;
  1164. u8 reserved1;
  1165. u8 rx_tid;
  1166. u8 reserved2;
  1167. } __packed;
  1168. static inline int wsm_set_block_ack_policy(struct cw1200_common *priv,
  1169. u8 tx_tid_policy,
  1170. u8 rx_tid_policy)
  1171. {
  1172. struct wsm_mib_block_ack_policy val = {
  1173. .tx_tid = tx_tid_policy,
  1174. .rx_tid = rx_tid_policy,
  1175. };
  1176. return wsm_write_mib(priv, WSM_MIB_ID_BLOCK_ACK_POLICY, &val,
  1177. sizeof(val));
  1178. }
  1179. struct wsm_mib_association_mode {
  1180. u8 flags; /* WSM_ASSOCIATION_MODE_... */
  1181. u8 preamble; /* WSM_JOIN_PREAMBLE_... */
  1182. u8 greenfield; /* 1 for greenfield */
  1183. u8 mpdu_start_spacing;
  1184. __le32 basic_rate_set;
  1185. } __packed;
  1186. static inline int wsm_set_association_mode(struct cw1200_common *priv,
  1187. struct wsm_mib_association_mode *arg)
  1188. {
  1189. return wsm_write_mib(priv, WSM_MIB_ID_SET_ASSOCIATION_MODE, arg,
  1190. sizeof(*arg));
  1191. }
  1192. #define WSM_TX_RATE_POLICY_FLAG_TERMINATE_WHEN_FINISHED BIT(2)
  1193. #define WSM_TX_RATE_POLICY_FLAG_COUNT_INITIAL_TRANSMIT BIT(3)
  1194. struct wsm_tx_rate_retry_policy {
  1195. u8 index;
  1196. u8 short_retries;
  1197. u8 long_retries;
  1198. /* BIT(2) - Terminate retries when Tx rate retry policy
  1199. * finishes.
  1200. * BIT(3) - Count initial frame transmission as part of
  1201. * rate retry counting but not as a retry
  1202. * attempt
  1203. */
  1204. u8 flags;
  1205. u8 rate_recoveries;
  1206. u8 reserved[3];
  1207. __le32 rate_count_indices[3];
  1208. } __packed;
  1209. struct wsm_set_tx_rate_retry_policy {
  1210. u8 num;
  1211. u8 reserved[3];
  1212. struct wsm_tx_rate_retry_policy tbl[8];
  1213. } __packed;
  1214. static inline int wsm_set_tx_rate_retry_policy(struct cw1200_common *priv,
  1215. struct wsm_set_tx_rate_retry_policy *arg)
  1216. {
  1217. size_t size = 4 + arg->num * sizeof(struct wsm_tx_rate_retry_policy);
  1218. return wsm_write_mib(priv, WSM_MIB_ID_SET_TX_RATE_RETRY_POLICY, arg,
  1219. size);
  1220. }
  1221. /* 4.32 SetEtherTypeDataFrameFilter */
  1222. struct wsm_ether_type_filter_hdr {
  1223. u8 num; /* Up to WSM_MAX_FILTER_ELEMENTS */
  1224. u8 reserved[3];
  1225. } __packed;
  1226. struct wsm_ether_type_filter {
  1227. u8 action; /* WSM_FILTER_ACTION_XXX */
  1228. u8 reserved;
  1229. __le16 type; /* Type of ethernet frame */
  1230. } __packed;
  1231. static inline int wsm_set_ether_type_filter(struct cw1200_common *priv,
  1232. struct wsm_ether_type_filter_hdr *arg)
  1233. {
  1234. size_t size = sizeof(struct wsm_ether_type_filter_hdr) +
  1235. arg->num * sizeof(struct wsm_ether_type_filter);
  1236. return wsm_write_mib(priv, WSM_MIB_ID_SET_ETHERTYPE_DATAFRAME_FILTER,
  1237. arg, size);
  1238. }
  1239. /* 4.33 SetUDPPortDataFrameFilter */
  1240. struct wsm_udp_port_filter_hdr {
  1241. u8 num; /* Up to WSM_MAX_FILTER_ELEMENTS */
  1242. u8 reserved[3];
  1243. } __packed;
  1244. struct wsm_udp_port_filter {
  1245. u8 action; /* WSM_FILTER_ACTION_XXX */
  1246. u8 type; /* WSM_FILTER_PORT_TYPE_XXX */
  1247. __le16 port; /* Port number */
  1248. } __packed;
  1249. static inline int wsm_set_udp_port_filter(struct cw1200_common *priv,
  1250. struct wsm_udp_port_filter_hdr *arg)
  1251. {
  1252. size_t size = sizeof(struct wsm_udp_port_filter_hdr) +
  1253. arg->num * sizeof(struct wsm_udp_port_filter);
  1254. return wsm_write_mib(priv, WSM_MIB_ID_SET_UDPPORT_DATAFRAME_FILTER,
  1255. arg, size);
  1256. }
  1257. /* Undocumented MIBs: */
  1258. /* 4.35 P2PDeviceInfo */
  1259. #define D11_MAX_SSID_LEN (32)
  1260. struct wsm_p2p_device_type {
  1261. __le16 category_id;
  1262. u8 oui[4];
  1263. __le16 subcategory_id;
  1264. } __packed;
  1265. struct wsm_p2p_device_info {
  1266. struct wsm_p2p_device_type primaryDevice;
  1267. u8 reserved1[3];
  1268. u8 devname_size;
  1269. u8 local_devname[D11_MAX_SSID_LEN];
  1270. u8 reserved2[3];
  1271. u8 num_secdev_supported;
  1272. struct wsm_p2p_device_type secdevs[0];
  1273. } __packed;
  1274. /* 4.36 SetWCDMABand - WO */
  1275. struct wsm_cdma_band {
  1276. u8 wcdma_band;
  1277. u8 reserved[3];
  1278. } __packed;
  1279. /* 4.37 GroupTxSequenceCounter - RO */
  1280. struct wsm_group_tx_seq {
  1281. __le32 bits_47_16;
  1282. __le16 bits_15_00;
  1283. __le16 reserved;
  1284. } __packed;
  1285. /* 4.39 SetHtProtection - WO */
  1286. #define WSM_DUAL_CTS_PROT_ENB (1 << 0)
  1287. #define WSM_NON_GREENFIELD_STA_PRESENT (1 << 1)
  1288. #define WSM_HT_PROT_MODE__NO_PROT (0 << 2)
  1289. #define WSM_HT_PROT_MODE__NON_MEMBER (1 << 2)
  1290. #define WSM_HT_PROT_MODE__20_MHZ (2 << 2)
  1291. #define WSM_HT_PROT_MODE__NON_HT_MIXED (3 << 2)
  1292. #define WSM_LSIG_TXOP_PROT_FULL (1 << 4)
  1293. #define WSM_LARGE_L_LENGTH_PROT (1 << 5)
  1294. struct wsm_ht_protection {
  1295. __le32 flags;
  1296. } __packed;
  1297. /* 4.40 GPIO Command - R/W */
  1298. #define WSM_GPIO_COMMAND_SETUP 0
  1299. #define WSM_GPIO_COMMAND_READ 1
  1300. #define WSM_GPIO_COMMAND_WRITE 2
  1301. #define WSM_GPIO_COMMAND_RESET 3
  1302. #define WSM_GPIO_ALL_PINS 0xFF
  1303. struct wsm_gpio_command {
  1304. u8 command;
  1305. u8 pin;
  1306. __le16 config;
  1307. } __packed;
  1308. /* 4.41 TSFCounter - RO */
  1309. struct wsm_tsf_counter {
  1310. __le64 tsf_counter;
  1311. } __packed;
  1312. /* 4.43 Keep alive period */
  1313. struct wsm_keep_alive_period {
  1314. __le16 period;
  1315. u8 reserved[2];
  1316. } __packed;
  1317. static inline int wsm_keep_alive_period(struct cw1200_common *priv,
  1318. int period)
  1319. {
  1320. struct wsm_keep_alive_period arg = {
  1321. .period = __cpu_to_le16(period),
  1322. };
  1323. return wsm_write_mib(priv, WSM_MIB_ID_KEEP_ALIVE_PERIOD,
  1324. &arg, sizeof(arg));
  1325. };
  1326. /* BSSID filtering */
  1327. struct wsm_set_bssid_filtering {
  1328. u8 filter;
  1329. u8 reserved[3];
  1330. } __packed;
  1331. static inline int wsm_set_bssid_filtering(struct cw1200_common *priv,
  1332. bool enabled)
  1333. {
  1334. struct wsm_set_bssid_filtering arg = {
  1335. .filter = !enabled,
  1336. };
  1337. return wsm_write_mib(priv, WSM_MIB_ID_DISABLE_BSSID_FILTER,
  1338. &arg, sizeof(arg));
  1339. }
  1340. /* Multicast filtering - 4.5 */
  1341. struct wsm_mib_multicast_filter {
  1342. __le32 enable;
  1343. __le32 num_addrs;
  1344. u8 macaddrs[WSM_MAX_GRP_ADDRTABLE_ENTRIES][ETH_ALEN];
  1345. } __packed;
  1346. static inline int wsm_set_multicast_filter(struct cw1200_common *priv,
  1347. struct wsm_mib_multicast_filter *fp)
  1348. {
  1349. return wsm_write_mib(priv, WSM_MIB_ID_DOT11_GROUP_ADDRESSES_TABLE,
  1350. fp, sizeof(*fp));
  1351. }
  1352. /* ARP IPv4 filtering - 4.10 */
  1353. struct wsm_mib_arp_ipv4_filter {
  1354. __le32 enable;
  1355. __be32 ipv4addrs[WSM_MAX_ARP_IP_ADDRTABLE_ENTRIES];
  1356. } __packed;
  1357. static inline int wsm_set_arp_ipv4_filter(struct cw1200_common *priv,
  1358. struct wsm_mib_arp_ipv4_filter *fp)
  1359. {
  1360. return wsm_write_mib(priv, WSM_MIB_ID_ARP_IP_ADDRESSES_TABLE,
  1361. fp, sizeof(*fp));
  1362. }
  1363. /* P2P Power Save Mode Info - 4.31 */
  1364. struct wsm_p2p_ps_modeinfo {
  1365. u8 opp_ps_ct_window;
  1366. u8 count;
  1367. u8 reserved;
  1368. u8 dtim_count;
  1369. __le32 duration;
  1370. __le32 interval;
  1371. __le32 start_time;
  1372. } __packed;
  1373. static inline int wsm_set_p2p_ps_modeinfo(struct cw1200_common *priv,
  1374. struct wsm_p2p_ps_modeinfo *mi)
  1375. {
  1376. return wsm_write_mib(priv, WSM_MIB_ID_P2P_PS_MODE_INFO,
  1377. mi, sizeof(*mi));
  1378. }
  1379. static inline int wsm_get_p2p_ps_modeinfo(struct cw1200_common *priv,
  1380. struct wsm_p2p_ps_modeinfo *mi)
  1381. {
  1382. return wsm_read_mib(priv, WSM_MIB_ID_P2P_PS_MODE_INFO,
  1383. mi, sizeof(*mi));
  1384. }
  1385. /* UseMultiTxConfMessage */
  1386. static inline int wsm_use_multi_tx_conf(struct cw1200_common *priv,
  1387. bool enabled)
  1388. {
  1389. __le32 arg = enabled ? __cpu_to_le32(1) : 0;
  1390. return wsm_write_mib(priv, WSM_MIB_USE_MULTI_TX_CONF,
  1391. &arg, sizeof(arg));
  1392. }
  1393. /* 4.26 SetUpasdInformation */
  1394. struct wsm_uapsd_info {
  1395. __le16 uapsd_flags;
  1396. __le16 min_auto_trigger_interval;
  1397. __le16 max_auto_trigger_interval;
  1398. __le16 auto_trigger_step;
  1399. };
  1400. static inline int wsm_set_uapsd_info(struct cw1200_common *priv,
  1401. struct wsm_uapsd_info *arg)
  1402. {
  1403. return wsm_write_mib(priv, WSM_MIB_ID_SET_UAPSD_INFORMATION,
  1404. arg, sizeof(*arg));
  1405. }
  1406. /* 4.22 OverrideInternalTxRate */
  1407. struct wsm_override_internal_txrate {
  1408. u8 internalTxRate;
  1409. u8 nonErpInternalTxRate;
  1410. u8 reserved[2];
  1411. } __packed;
  1412. static inline int wsm_set_override_internal_txrate(struct cw1200_common *priv,
  1413. struct wsm_override_internal_txrate *arg)
  1414. {
  1415. return wsm_write_mib(priv, WSM_MIB_ID_OVERRIDE_INTERNAL_TX_RATE,
  1416. arg, sizeof(*arg));
  1417. }
  1418. /* ******************************************************************** */
  1419. /* WSM TX port control */
  1420. void wsm_lock_tx(struct cw1200_common *priv);
  1421. void wsm_lock_tx_async(struct cw1200_common *priv);
  1422. bool wsm_flush_tx(struct cw1200_common *priv);
  1423. void wsm_unlock_tx(struct cw1200_common *priv);
  1424. /* ******************************************************************** */
  1425. /* WSM / BH API */
  1426. int wsm_handle_exception(struct cw1200_common *priv, u8 *data, size_t len);
  1427. int wsm_handle_rx(struct cw1200_common *priv, u16 id, struct wsm_hdr *wsm,
  1428. struct sk_buff **skb_p);
  1429. /* ******************************************************************** */
  1430. /* wsm_buf API */
  1431. struct wsm_buf {
  1432. u8 *begin;
  1433. u8 *data;
  1434. u8 *end;
  1435. };
  1436. void wsm_buf_init(struct wsm_buf *buf);
  1437. void wsm_buf_deinit(struct wsm_buf *buf);
  1438. /* ******************************************************************** */
  1439. /* wsm_cmd API */
  1440. struct wsm_cmd {
  1441. spinlock_t lock; /* Protect structure from multiple access */
  1442. int done;
  1443. u8 *ptr;
  1444. size_t len;
  1445. void *arg;
  1446. int ret;
  1447. u16 cmd;
  1448. };
  1449. /* ******************************************************************** */
  1450. /* WSM TX buffer access */
  1451. int wsm_get_tx(struct cw1200_common *priv, u8 **data,
  1452. size_t *tx_len, int *burst);
  1453. void wsm_txed(struct cw1200_common *priv, u8 *data);
  1454. /* ******************************************************************** */
  1455. /* Queue mapping: WSM <---> linux */
  1456. /* Linux: VO VI BE BK */
  1457. /* WSM: BE BK VI VO */
  1458. static inline u8 wsm_queue_id_to_linux(u8 queue_id)
  1459. {
  1460. static const u8 queue_mapping[] = {
  1461. 2, 3, 1, 0
  1462. };
  1463. return queue_mapping[queue_id];
  1464. }
  1465. static inline u8 wsm_queue_id_to_wsm(u8 queue_id)
  1466. {
  1467. static const u8 queue_mapping[] = {
  1468. 3, 2, 0, 1
  1469. };
  1470. return queue_mapping[queue_id];
  1471. }
  1472. #endif /* CW1200_HWIO_H_INCLUDED */