wsm.h 47 KB

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