wma.h 82 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715
  1. /*
  2. * Copyright (c) 2013-2018 The Linux Foundation. All rights reserved.
  3. *
  4. * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  5. *
  6. *
  7. * Permission to use, copy, modify, and/or distribute this software for
  8. * any purpose with or without fee is hereby granted, provided that the
  9. * above copyright notice and this permission notice appear in all
  10. * copies.
  11. *
  12. * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
  13. * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
  14. * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
  15. * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
  16. * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
  17. * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
  18. * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  19. * PERFORMANCE OF THIS SOFTWARE.
  20. */
  21. /*
  22. * This file was originally distributed by Qualcomm Atheros, Inc.
  23. * under proprietary terms before Copyright ownership was assigned
  24. * to the Linux Foundation.
  25. */
  26. #ifndef WMA_H
  27. #define WMA_H
  28. #include "a_types.h"
  29. #include "qdf_types.h"
  30. #include "osapi_linux.h"
  31. #include "htc_packet.h"
  32. #include "i_qdf_event.h"
  33. #include "wmi_services.h"
  34. #include "wmi_unified.h"
  35. #include "wmi_version.h"
  36. #include "qdf_types.h"
  37. #include "cfg_api.h"
  38. #include "qdf_status.h"
  39. #include "cds_sched.h"
  40. #include "cds_config.h"
  41. #include "sir_mac_prot_def.h"
  42. #include "wma_types.h"
  43. #include <linux/workqueue.h>
  44. #include "utils_api.h"
  45. #include "lim_types.h"
  46. #include "wmi_unified_api.h"
  47. #include "cdp_txrx_cmn.h"
  48. #include "dbglog.h"
  49. #include "cds_ieee80211_common.h"
  50. #include "wlan_objmgr_psoc_obj.h"
  51. #include <cdp_txrx_handle.h>
  52. #include <wlan_policy_mgr_api.h>
  53. /* Platform specific configuration for max. no. of fragments */
  54. #define QCA_OL_11AC_TX_MAX_FRAGS 2
  55. /* Private */
  56. #define WMA_READY_EVENTID_TIMEOUT 6000
  57. #define WMA_SERVICE_READY_EXT_TIMEOUT 6000
  58. #define WMA_TGT_SUSPEND_COMPLETE_TIMEOUT 6000
  59. #define WMA_WAKE_LOCK_TIMEOUT WAKELOCK_DURATION_RECOMMENDED
  60. #define WMA_RESUME_TIMEOUT 25000
  61. #define MAX_MEM_CHUNKS 32
  62. #define NAN_CLUSTER_ID_BYTES 4
  63. #define WMA_CRASH_INJECT_TIMEOUT 5000
  64. /* MAC ID to PDEV ID mapping is as given below
  65. * MAC_ID PDEV_ID
  66. * 0 1
  67. * 1 2
  68. * SOC Level WMI_PDEV_ID_SOC
  69. */
  70. #define WMA_MAC_TO_PDEV_MAP(x) ((x) + (1))
  71. #define WMA_PDEV_TO_MAC_MAP(x) ((x) - (1))
  72. #define WMA_MAX_SUPPORTED_BSS SIR_MAX_SUPPORTED_BSS
  73. #define WMA_MAX_MGMT_MPDU_LEN 2000
  74. #define FRAGMENT_SIZE 3072
  75. #define MAX_PRINT_FAILURE_CNT 50
  76. #define WMA_INVALID_VDEV_ID 0xFF
  77. #define MAX_MEM_CHUNKS 32
  78. #define WMA_MAX_VDEV_SIZE 20
  79. #define WMA_VDEV_TBL_ENTRY_ADD 1
  80. #define WMA_VDEV_TBL_ENTRY_DEL 0
  81. /* 11A/G channel boundary */
  82. #define WMA_11A_CHANNEL_BEGIN 34
  83. #define WMA_11A_CHANNEL_END 165
  84. #define WMA_11G_CHANNEL_BEGIN 1
  85. #define WMA_11G_CHANNEL_END 14
  86. #define WMA_11P_CHANNEL_BEGIN (170)
  87. #define WMA_11P_CHANNEL_END (184)
  88. #define WMA_LOGD(args ...) \
  89. QDF_TRACE(QDF_MODULE_ID_WMA, QDF_TRACE_LEVEL_DEBUG, ## args)
  90. #define WMA_LOGI(args ...) \
  91. QDF_TRACE(QDF_MODULE_ID_WMA, QDF_TRACE_LEVEL_INFO, ## args)
  92. #define WMA_LOGW(args ...) \
  93. QDF_TRACE(QDF_MODULE_ID_WMA, QDF_TRACE_LEVEL_WARN, ## args)
  94. #define WMA_LOGE(args ...) \
  95. QDF_TRACE(QDF_MODULE_ID_WMA, QDF_TRACE_LEVEL_ERROR, ## args)
  96. #define WMA_LOGP(args ...) \
  97. QDF_TRACE(QDF_MODULE_ID_WMA, QDF_TRACE_LEVEL_FATAL, ## args)
  98. #define WMA_DEBUG_ALWAYS
  99. #ifdef WMA_DEBUG_ALWAYS
  100. #define WMA_LOGA(args ...) \
  101. QDF_TRACE(QDF_MODULE_ID_WMA, QDF_TRACE_LEVEL_FATAL, ## args)
  102. #else
  103. #define WMA_LOGA(args ...)
  104. #endif
  105. #define ALIGNED_WORD_SIZE 4
  106. #define WLAN_HAL_MSG_TYPE_MAX_ENUM_SIZE 0x7FFF
  107. #define WMA_WILDCARD_PDEV_ID 0x0
  108. /* Prefix used by scan req ids generated on the host */
  109. #define WMA_HOST_SCAN_REQID_PREFIX 0xA000
  110. /* Prefix used by roam scan req ids generated on the host */
  111. #define WMA_HOST_ROAM_SCAN_REQID_PREFIX 0xA800
  112. /* Prefix used by scan requestor id on host */
  113. #define WMA_HOST_SCAN_REQUESTOR_ID_PREFIX 0xA000
  114. #define WMA_HW_DEF_SCAN_MAX_DURATION 30000 /* 30 secs */
  115. /* Max offchannel duration */
  116. #define WMA_BURST_SCAN_MAX_NUM_OFFCHANNELS (3)
  117. #define WMA_SCAN_NPROBES_DEFAULT (2)
  118. #define WMA_SCAN_IDLE_TIME_DEFAULT (25)
  119. #define WMA_P2P_SCAN_MAX_BURST_DURATION (180)
  120. #define WMA_CTS_DURATION_MS_MAX (32)
  121. #define WMA_GO_MIN_ACTIVE_SCAN_BURST_DURATION (40)
  122. #define WMA_GO_MAX_ACTIVE_SCAN_BURST_DURATION (120)
  123. #define WMA_DWELL_TIME_PASSIVE_DEFAULT (110)
  124. #define WMA_DWELL_TIME_PROBE_TIME_MAP_SIZE (11)
  125. #define WMA_3PORT_CONC_SCAN_MAX_BURST_DURATION (25)
  126. #define WMA_SEC_TO_USEC (1000000)
  127. #define BEACON_TX_BUFFER_SIZE (512)
  128. /* WMA_ETHER_TYPE_OFFSET = sa(6) + da(6) */
  129. #define WMA_ETHER_TYPE_OFFSET (6 + 6)
  130. /* WMA_ICMP_V6_HEADER_OFFSET = sa(6) + da(6) + eth_type(2) + icmp_v6_hdr(6)*/
  131. #define WMA_ICMP_V6_HEADER_OFFSET (6 + 6 + 2 + 6)
  132. /* WMA_ICMP_V6_TYPE_OFFSET = sa(6) + da(6) + eth_type(2) + 40 */
  133. #define WMA_ICMP_V6_TYPE_OFFSET (6 + 6 + 2 + 40)
  134. /* WMA_IPV4_PROTOCOL = sa(6) + da(6) + eth_type(2) + 9 */
  135. #define WMA_IPV4_PROTOCOL (6 + 6 + 2 + 9)
  136. #define WMA_ICMP_V6_HEADER_TYPE (0x3A)
  137. #define WMA_ICMP_V6_RA_TYPE (0x86)
  138. #define WMA_ICMP_V6_NS_TYPE (0x87)
  139. #define WMA_ICMP_V6_NA_TYPE (0x88)
  140. #define WMA_BCAST_MAC_ADDR (0xFF)
  141. #define WMA_MCAST_IPV4_MAC_ADDR (0x01)
  142. #define WMA_MCAST_IPV6_MAC_ADDR (0x33)
  143. #define WMA_ICMP_PROTOCOL (0x01)
  144. #define WMA_IS_EAPOL_GET_MIN_LEN 14
  145. #define WMA_EAPOL_SUBTYPE_GET_MIN_LEN 21
  146. #define WMA_EAPOL_INFO_GET_MIN_LEN 23
  147. #define WMA_IS_DHCP_GET_MIN_LEN 38
  148. #define WMA_DHCP_SUBTYPE_GET_MIN_LEN 0x11D
  149. #define WMA_DHCP_INFO_GET_MIN_LEN 50
  150. #define WMA_IS_ARP_GET_MIN_LEN 14
  151. #define WMA_ARP_SUBTYPE_GET_MIN_LEN 22
  152. #define WMA_IPV4_PROTO_GET_MIN_LEN 24
  153. #define WMA_IPV4_PKT_INFO_GET_MIN_LEN 42
  154. #define WMA_ICMP_SUBTYPE_GET_MIN_LEN 35
  155. #define WMA_IPV6_PROTO_GET_MIN_LEN 21
  156. #define WMA_IPV6_PKT_INFO_GET_MIN_LEN 62
  157. #define WMA_ICMPV6_SUBTYPE_GET_MIN_LEN 55
  158. /* Beacon tx rate */
  159. #define WMA_BEACON_TX_RATE_1_M 10
  160. #define WMA_BEACON_TX_RATE_2_M 20
  161. #define WMA_BEACON_TX_RATE_5_5_M 55
  162. #define WMA_BEACON_TX_RATE_11_M 110
  163. #define WMA_BEACON_TX_RATE_6_M 60
  164. #define WMA_BEACON_TX_RATE_9_M 90
  165. #define WMA_BEACON_TX_RATE_12_M 120
  166. #define WMA_BEACON_TX_RATE_18_M 180
  167. #define WMA_BEACON_TX_RATE_24_M 240
  168. #define WMA_BEACON_TX_RATE_36_M 360
  169. #define WMA_BEACON_TX_RATE_48_M 480
  170. #define WMA_BEACON_TX_RATE_54_M 540
  171. /**
  172. * ds_mode: distribution system mode
  173. * @IEEE80211_NO_DS: NO DS at either side
  174. * @IEEE80211_TO_DS: DS at receiver side
  175. * @IEEE80211_FROM_DS: DS at sender side
  176. * @IEEE80211_DS_TO_DS: DS at both sender and revceiver side
  177. */
  178. enum ds_mode {
  179. IEEE80211_NO_DS,
  180. IEEE80211_TO_DS,
  181. IEEE80211_FROM_DS,
  182. IEEE80211_DS_TO_DS
  183. };
  184. /* Roaming default values
  185. * All time and period values are in milliseconds.
  186. * All rssi values are in dB except for WMA_NOISE_FLOOR_DBM_DEFAULT.
  187. */
  188. #define WMA_ROAM_SCAN_CHANNEL_SWITCH_TIME (4)
  189. #define WMA_NOISE_FLOOR_DBM_DEFAULT (-96)
  190. #define WMA_ROAM_RSSI_DIFF_DEFAULT (5)
  191. #define WMA_ROAM_DWELL_TIME_ACTIVE_DEFAULT (100)
  192. #define WMA_ROAM_DWELL_TIME_PASSIVE_DEFAULT (110)
  193. #define WMA_ROAM_MIN_REST_TIME_DEFAULT (50)
  194. #define WMA_ROAM_MAX_REST_TIME_DEFAULT (500)
  195. #define WMA_ROAM_LOW_RSSI_TRIGGER_DEFAULT (20)
  196. #define WMA_ROAM_LOW_RSSI_TRIGGER_VERYLOW (10)
  197. #define WMA_ROAM_BEACON_WEIGHT_DEFAULT (14)
  198. #define WMA_ROAM_OPP_SCAN_PERIOD_DEFAULT (120000)
  199. #define WMA_ROAM_OPP_SCAN_AGING_PERIOD_DEFAULT \
  200. (WMA_ROAM_OPP_SCAN_PERIOD_DEFAULT * 5)
  201. #define WMA_ROAM_BMISS_FIRST_BCNT_DEFAULT (10)
  202. #define WMA_ROAM_BMISS_FINAL_BCNT_DEFAULT (10)
  203. #define WMA_ROAM_BMISS_FIRST_BCNT_DEFAULT_P2P (15)
  204. #define WMA_ROAM_BMISS_FINAL_BCNT_DEFAULT_P2P (45)
  205. #define WMA_INVALID_KEY_IDX 0xff
  206. #define WMA_MAX_RF_CHAINS(x) ((1 << x) - 1)
  207. #define WMA_MIN_RF_CHAINS (1)
  208. #define WMA_MAX_NSS (2)
  209. #ifdef FEATURE_WLAN_EXTSCAN
  210. #define WMA_MAX_EXTSCAN_MSG_SIZE 1536
  211. #define WMA_EXTSCAN_REST_TIME 100
  212. #define WMA_EXTSCAN_MAX_SCAN_TIME 50000
  213. #define WMA_EXTSCAN_BURST_DURATION 150
  214. #endif
  215. #define WMA_CHAN_START_RESP 0
  216. #define WMA_CHAN_END_RESP 1
  217. #define WMA_BCN_BUF_MAX_SIZE 2500
  218. #define WMA_NOA_IE_SIZE(num_desc) (2 + (13 * (num_desc)))
  219. #define WMA_MAX_NOA_DESCRIPTORS 4
  220. #define WMA_TIM_SUPPORTED_PVB_LENGTH ((HAL_NUM_STA / 8) + 1)
  221. #define WMA_WOW_PTRN_MASK_VALID 0xFF
  222. #define WMA_NUM_BITS_IN_BYTE 8
  223. #define WMA_AP_WOW_DEFAULT_PTRN_MAX 4
  224. #define WMA_BSS_STATUS_STARTED 0x1
  225. #define WMA_BSS_STATUS_STOPPED 0x2
  226. #define WMA_TARGET_REQ_TYPE_VDEV_START 0x1
  227. #define WMA_TARGET_REQ_TYPE_VDEV_STOP 0x2
  228. #define WMA_TARGET_REQ_TYPE_VDEV_DEL 0x3
  229. #define WMA_PEER_ASSOC_CNF_START 0x01
  230. #define WMA_PEER_ASSOC_TIMEOUT (6000) /* 6 seconds */
  231. #define WMA_DELETE_STA_RSP_START 0x02
  232. #define WMA_DELETE_STA_TIMEOUT (6000) /* 6 seconds */
  233. #define WMA_DEL_P2P_SELF_STA_RSP_START 0x03
  234. #define WMA_SET_LINK_PEER_RSP 0x04
  235. #define WMA_DELETE_PEER_RSP 0x05
  236. #define WMA_PDEV_SET_HW_MODE_RESP 0x06
  237. #define WMA_VDEV_START_REQUEST_TIMEOUT 6000 /* 6s */
  238. #define WMA_VDEV_STOP_REQUEST_TIMEOUT 6000 /* 6s */
  239. #define WMA_VDEV_HW_MODE_REQUEST_TIMEOUT 5000 /* 5s */
  240. #define WMA_VDEV_PLCY_MGR_CMD_TIMEOUT 3000 /* 3s */
  241. #define WMA_VDEV_SET_KEY_WAKELOCK_TIMEOUT WAKELOCK_DURATION_RECOMMENDED
  242. #define WMA_TGT_INVALID_SNR (0)
  243. #define WMA_TGT_IS_VALID_SNR(x) ((x) >= 0 && (x) < WMA_TGT_MAX_SNR)
  244. #define WMA_TGT_IS_INVALID_SNR(x) (!WMA_TGT_IS_VALID_SNR(x))
  245. #define WMA_TX_Q_RECHECK_TIMER_WAIT 2 /* 2 ms */
  246. #define WMA_TX_Q_RECHECK_TIMER_MAX_WAIT 20 /* 20 ms */
  247. #define WMA_MAX_NUM_ARGS 8
  248. #define WMA_SMPS_MASK_LOWER_16BITS 0xFF
  249. #define WMA_SMPS_MASK_UPPER_3BITS 0x7
  250. #define WMA_SMPS_PARAM_VALUE_S 29
  251. #define WMA_MAX_SCAN_ID 0x00FF
  252. /*
  253. * Setting the Tx Comp Timeout to 1 secs.
  254. * TODO: Need to Revist the Timing
  255. */
  256. #define WMA_TX_FRAME_COMPLETE_TIMEOUT 1000
  257. #define WMA_TX_FRAME_BUFFER_NO_FREE 0
  258. #define WMA_TX_FRAME_BUFFER_FREE 1
  259. /* Default InActivity Time is 200 ms */
  260. #define POWERSAVE_DEFAULT_INACTIVITY_TIME 200
  261. /* Default WOW InActivity Time is 50 ms */
  262. #define WOW_POWERSAVE_DEFAULT_INACTIVITY_TIME 50
  263. /* Default Listen Interval */
  264. #define POWERSAVE_DEFAULT_LISTEN_INTERVAL 1
  265. /*
  266. * TODO: Add WMI_CMD_ID_MAX as part of WMI_CMD_ID
  267. * instead of assigning it to the last valid wmi
  268. * cmd+1 to avoid updating this when a command is
  269. * added/deleted.
  270. */
  271. #define WMI_CMDID_MAX (WMI_TXBF_CMDID + 1)
  272. #define WMA_NLO_FREQ_THRESH 1000 /* in MHz */
  273. #define WMA_SEC_TO_MSEC(sec) (sec * 1000) /* sec to msec */
  274. #define WMA_MSEC_TO_USEC(msec) (msec * 1000) /* msec to usec */
  275. /* Default rssi threshold defined in CFG80211 */
  276. #define WMA_RSSI_THOLD_DEFAULT -300
  277. #define WMA_AUTH_REQ_RECV_WAKE_LOCK_TIMEOUT WAKELOCK_DURATION_RECOMMENDED
  278. #define WMA_ASSOC_REQ_RECV_WAKE_LOCK_DURATION WAKELOCK_DURATION_RECOMMENDED
  279. #define WMA_DEAUTH_RECV_WAKE_LOCK_DURATION WAKELOCK_DURATION_RECOMMENDED
  280. #define WMA_DISASSOC_RECV_WAKE_LOCK_DURATION WAKELOCK_DURATION_RECOMMENDED
  281. #define WMA_ROAM_HO_WAKE_LOCK_DURATION (500) /* in msec */
  282. #ifdef FEATURE_WLAN_AUTO_SHUTDOWN
  283. #define WMA_AUTO_SHUTDOWN_WAKE_LOCK_DURATION WAKELOCK_DURATION_RECOMMENDED
  284. #endif
  285. #define WMA_BMISS_EVENT_WAKE_LOCK_DURATION WAKELOCK_DURATION_RECOMMENDED
  286. #define WMA_FW_RSP_EVENT_WAKE_LOCK_DURATION WAKELOCK_DURATION_MAX
  287. #define WMA_TXMIC_LEN 8
  288. #define WMA_RXMIC_LEN 8
  289. /*
  290. * Length = (2 octets for Index and CTWin/Opp PS) and
  291. * (13 octets for each NOA Descriptors)
  292. */
  293. #define WMA_P2P_NOA_IE_OPP_PS_SET (0x80)
  294. #define WMA_P2P_NOA_IE_CTWIN_MASK (0x7F)
  295. #define WMA_P2P_IE_ID 0xdd
  296. #define WMA_P2P_WFA_OUI { 0x50, 0x6f, 0x9a }
  297. #define WMA_P2P_WFA_VER 0x09 /* ver 1.0 */
  298. #define WMA_WSC_OUI { 0x00, 0x50, 0xF2 } /* Microsoft WSC OUI byte */
  299. /* P2P Sub element defintions (according to table 5 of Wifi's P2P spec) */
  300. #define WMA_P2P_SUB_ELEMENT_STATUS 0
  301. #define WMA_P2P_SUB_ELEMENT_MINOR_REASON 1
  302. #define WMA_P2P_SUB_ELEMENT_CAPABILITY 2
  303. #define WMA_P2P_SUB_ELEMENT_DEVICE_ID 3
  304. #define WMA_P2P_SUB_ELEMENT_GO_INTENT 4
  305. #define WMA_P2P_SUB_ELEMENT_CONFIGURATION_TIMEOUT 5
  306. #define WMA_P2P_SUB_ELEMENT_LISTEN_CHANNEL 6
  307. #define WMA_P2P_SUB_ELEMENT_GROUP_BSSID 7
  308. #define WMA_P2P_SUB_ELEMENT_EXTENDED_LISTEN_TIMING 8
  309. #define WMA_P2P_SUB_ELEMENT_INTENDED_INTERFACE_ADDR 9
  310. #define WMA_P2P_SUB_ELEMENT_MANAGEABILITY 10
  311. #define WMA_P2P_SUB_ELEMENT_CHANNEL_LIST 11
  312. #define WMA_P2P_SUB_ELEMENT_NOA 12
  313. #define WMA_P2P_SUB_ELEMENT_DEVICE_INFO 13
  314. #define WMA_P2P_SUB_ELEMENT_GROUP_INFO 14
  315. #define WMA_P2P_SUB_ELEMENT_GROUP_ID 15
  316. #define WMA_P2P_SUB_ELEMENT_INTERFACE 16
  317. #define WMA_P2P_SUB_ELEMENT_OP_CHANNEL 17
  318. #define WMA_P2P_SUB_ELEMENT_INVITATION_FLAGS 18
  319. #define WMA_P2P_SUB_ELEMENT_VENDOR 221
  320. /* Macros for handling unaligned memory accesses */
  321. #define P2PIE_PUT_LE16(a, val) \
  322. do { \
  323. (a)[1] = ((u16) (val)) >> 8; \
  324. (a)[0] = ((u16) (val)) & 0xff; \
  325. } while (0)
  326. #define P2PIE_PUT_LE32(a, val) \
  327. do { \
  328. (a)[3] = (u8) ((((u32) (val)) >> 24) & 0xff); \
  329. (a)[2] = (u8) ((((u32) (val)) >> 16) & 0xff); \
  330. (a)[1] = (u8) ((((u32) (val)) >> 8) & 0xff); \
  331. (a)[0] = (u8) (((u32) (val)) & 0xff); \
  332. } while (0)
  333. #define WMA_DEFAULT_MAX_PSPOLL_BEFORE_WAKE 1
  334. #define WMA_DEFAULT_QPOWER_MAX_PSPOLL_BEFORE_WAKE 1
  335. #define WMA_DEFAULT_QPOWER_TX_WAKE_THRESHOLD 2
  336. #define WMA_DEFAULT_SIFS_BURST_DURATION 8160
  337. #define WMA_VHT_PPS_PAID_MATCH 1
  338. #define WMA_VHT_PPS_GID_MATCH 2
  339. #define WMA_VHT_PPS_DELIM_CRC_FAIL 3
  340. #define WMA_DEFAULT_HW_MODE_INDEX 0xFFFF
  341. #define TWO_THIRD (2/3)
  342. /**
  343. * WMA hardware mode list bit-mask definitions.
  344. * Bits 4:0, 31:29 are unused.
  345. *
  346. * The below definitions are added corresponding to WMI DBS HW mode
  347. * list to make it independent of firmware changes for WMI definitions.
  348. * Currently these definitions have dependency with BIT positions of
  349. * the existing WMI macros. Thus, if the BIT positions are changed for
  350. * WMI macros, then these macros' BIT definitions are also need to be
  351. * changed.
  352. */
  353. #define WMA_HW_MODE_MAC0_TX_STREAMS_BITPOS (28)
  354. #define WMA_HW_MODE_MAC0_RX_STREAMS_BITPOS (24)
  355. #define WMA_HW_MODE_MAC1_TX_STREAMS_BITPOS (20)
  356. #define WMA_HW_MODE_MAC1_RX_STREAMS_BITPOS (16)
  357. #define WMA_HW_MODE_MAC0_BANDWIDTH_BITPOS (12)
  358. #define WMA_HW_MODE_MAC1_BANDWIDTH_BITPOS (8)
  359. #define WMA_HW_MODE_DBS_MODE_BITPOS (7)
  360. #define WMA_HW_MODE_AGILE_DFS_MODE_BITPOS (6)
  361. #define WMA_HW_MODE_SBS_MODE_BITPOS (5)
  362. #define WMA_HW_MODE_MAC0_TX_STREAMS_MASK \
  363. (0xf << WMA_HW_MODE_MAC0_TX_STREAMS_BITPOS)
  364. #define WMA_HW_MODE_MAC0_RX_STREAMS_MASK \
  365. (0xf << WMA_HW_MODE_MAC0_RX_STREAMS_BITPOS)
  366. #define WMA_HW_MODE_MAC1_TX_STREAMS_MASK \
  367. (0xf << WMA_HW_MODE_MAC1_TX_STREAMS_BITPOS)
  368. #define WMA_HW_MODE_MAC1_RX_STREAMS_MASK \
  369. (0xf << WMA_HW_MODE_MAC1_RX_STREAMS_BITPOS)
  370. #define WMA_HW_MODE_MAC0_BANDWIDTH_MASK \
  371. (0xf << WMA_HW_MODE_MAC0_BANDWIDTH_BITPOS)
  372. #define WMA_HW_MODE_MAC1_BANDWIDTH_MASK \
  373. (0xf << WMA_HW_MODE_MAC1_BANDWIDTH_BITPOS)
  374. #define WMA_HW_MODE_DBS_MODE_MASK \
  375. (0x1 << WMA_HW_MODE_DBS_MODE_BITPOS)
  376. #define WMA_HW_MODE_AGILE_DFS_MODE_MASK \
  377. (0x1 << WMA_HW_MODE_AGILE_DFS_MODE_BITPOS)
  378. #define WMA_HW_MODE_SBS_MODE_MASK \
  379. (0x1 << WMA_HW_MODE_SBS_MODE_BITPOS)
  380. #define WMA_HW_MODE_MAC0_TX_STREAMS_SET(hw_mode, value) \
  381. WMI_SET_BITS(hw_mode, WMA_HW_MODE_MAC0_TX_STREAMS_BITPOS, 4, value)
  382. #define WMA_HW_MODE_MAC0_RX_STREAMS_SET(hw_mode, value) \
  383. WMI_SET_BITS(hw_mode, WMA_HW_MODE_MAC0_RX_STREAMS_BITPOS, 4, value)
  384. #define WMA_HW_MODE_MAC1_TX_STREAMS_SET(hw_mode, value) \
  385. WMI_SET_BITS(hw_mode, WMA_HW_MODE_MAC1_TX_STREAMS_BITPOS, 4, value)
  386. #define WMA_HW_MODE_MAC1_RX_STREAMS_SET(hw_mode, value) \
  387. WMI_SET_BITS(hw_mode, WMA_HW_MODE_MAC1_RX_STREAMS_BITPOS, 4, value)
  388. #define WMA_HW_MODE_MAC0_BANDWIDTH_SET(hw_mode, value) \
  389. WMI_SET_BITS(hw_mode, WMA_HW_MODE_MAC0_BANDWIDTH_BITPOS, 4, value)
  390. #define WMA_HW_MODE_MAC1_BANDWIDTH_SET(hw_mode, value) \
  391. WMI_SET_BITS(hw_mode, WMA_HW_MODE_MAC1_BANDWIDTH_BITPOS, 4, value)
  392. #define WMA_HW_MODE_DBS_MODE_SET(hw_mode, value) \
  393. WMI_SET_BITS(hw_mode, WMA_HW_MODE_DBS_MODE_BITPOS, 1, value)
  394. #define WMA_HW_MODE_AGILE_DFS_SET(hw_mode, value) \
  395. WMI_SET_BITS(hw_mode, WMA_HW_MODE_AGILE_DFS_MODE_BITPOS, 1, value)
  396. #define WMA_HW_MODE_SBS_MODE_SET(hw_mode, value) \
  397. WMI_SET_BITS(hw_mode, WMA_HW_MODE_SBS_MODE_BITPOS, 1, value)
  398. #define WMA_HW_MODE_MAC0_TX_STREAMS_GET(hw_mode) \
  399. ((hw_mode & WMA_HW_MODE_MAC0_TX_STREAMS_MASK) >> \
  400. WMA_HW_MODE_MAC0_TX_STREAMS_BITPOS)
  401. #define WMA_HW_MODE_MAC0_RX_STREAMS_GET(hw_mode) \
  402. ((hw_mode & WMA_HW_MODE_MAC0_RX_STREAMS_MASK) >> \
  403. WMA_HW_MODE_MAC0_RX_STREAMS_BITPOS)
  404. #define WMA_HW_MODE_MAC1_TX_STREAMS_GET(hw_mode) \
  405. ((hw_mode & WMA_HW_MODE_MAC1_TX_STREAMS_MASK) >> \
  406. WMA_HW_MODE_MAC1_TX_STREAMS_BITPOS)
  407. #define WMA_HW_MODE_MAC1_RX_STREAMS_GET(hw_mode) \
  408. ((hw_mode & WMA_HW_MODE_MAC1_RX_STREAMS_MASK) >> \
  409. WMA_HW_MODE_MAC1_RX_STREAMS_BITPOS)
  410. #define WMA_HW_MODE_MAC0_BANDWIDTH_GET(hw_mode) \
  411. ((hw_mode & WMA_HW_MODE_MAC0_BANDWIDTH_MASK) >> \
  412. WMA_HW_MODE_MAC0_BANDWIDTH_BITPOS)
  413. #define WMA_HW_MODE_MAC1_BANDWIDTH_GET(hw_mode) \
  414. ((hw_mode & WMA_HW_MODE_MAC1_BANDWIDTH_MASK) >> \
  415. WMA_HW_MODE_MAC1_BANDWIDTH_BITPOS)
  416. #define WMA_HW_MODE_DBS_MODE_GET(hw_mode) \
  417. ((hw_mode & WMA_HW_MODE_DBS_MODE_MASK) >> \
  418. WMA_HW_MODE_DBS_MODE_BITPOS)
  419. #define WMA_HW_MODE_AGILE_DFS_GET(hw_mode) \
  420. ((hw_mode & WMA_HW_MODE_AGILE_DFS_MODE_MASK) >> \
  421. WMA_HW_MODE_AGILE_DFS_MODE_BITPOS)
  422. #define WMA_HW_MODE_SBS_MODE_GET(hw_mode) \
  423. ((hw_mode & WMA_HW_MODE_SBS_MODE_MASK) >> \
  424. WMA_HW_MODE_SBS_MODE_BITPOS)
  425. #define WMA_SCAN_END_EVENT (WMI_SCAN_EVENT_COMPLETED | \
  426. WMI_SCAN_EVENT_DEQUEUED | \
  427. WMI_SCAN_EVENT_START_FAILED)
  428. /*
  429. * PROBE_REQ_TX_DELAY
  430. * param to specify probe request Tx delay for scans triggered on this VDEV
  431. */
  432. #define PROBE_REQ_TX_DELAY 10
  433. /* PROBE_REQ_TX_TIME_GAP
  434. * param to specify the time gap between each set of probe request transmission.
  435. * The number of probe requests in each set depends on the ssid_list and,
  436. * bssid_list in the scan request. This parameter will get applied only,
  437. * for the scans triggered on this VDEV.
  438. */
  439. #define PROBE_REQ_TX_TIME_GAP 20
  440. /**
  441. * struct probeTime_dwellTime - probe time, dwell time map
  442. * @dwell_time: dwell time
  443. * @probe_time: repeat probe time
  444. */
  445. typedef struct probeTime_dwellTime {
  446. uint8_t dwell_time;
  447. uint8_t probe_time;
  448. } t_probeTime_dwellTime;
  449. static const t_probeTime_dwellTime
  450. probe_time_dwell_time_map[WMA_DWELL_TIME_PROBE_TIME_MAP_SIZE] = {
  451. {28, 11}, /* 0 SSID */
  452. {28, 20}, /* 1 SSID */
  453. {28, 20}, /* 2 SSID */
  454. {28, 20}, /* 3 SSID */
  455. {28, 20}, /* 4 SSID */
  456. {28, 20}, /* 5 SSID */
  457. {28, 20}, /* 6 SSID */
  458. {28, 11}, /* 7 SSID */
  459. {28, 11}, /* 8 SSID */
  460. {28, 11}, /* 9 SSID */
  461. {28, 8} /* 10 SSID */
  462. };
  463. typedef void (*txFailIndCallback)(uint8_t *peer_mac, uint8_t seqNo);
  464. typedef void (*tp_wma_packetdump_cb)(qdf_nbuf_t netbuf,
  465. uint8_t status, uint8_t vdev_id, uint8_t type);
  466. #ifdef FEATURE_WLAN_TDLS
  467. /**
  468. * enum t_wma_tdls_mode - TDLS mode
  469. * @WMA_TDLS_SUPPORT_NOT_ENABLED: tdls is disable
  470. * @WMA_TDLS_SUPPORT_DISABLED: suppress implicit trigger and not respond to peer
  471. * @WMA_TDLS_SUPPORT_EXPLICIT_TRIGGER_ONLY: suppress implicit trigger,
  472. * but respond to the peer
  473. * @WMA_TDLS_SUPPORT_ENABLED: implicit trigger
  474. * @WMA_TDLS_SUPPORT_ACTIVE_EXTERNAL_CONTROL: External control means
  475. * implicit trigger but only to a peer mac configured by user space.
  476. */
  477. typedef enum {
  478. WMA_TDLS_SUPPORT_NOT_ENABLED = 0,
  479. WMA_TDLS_SUPPORT_DISABLED,
  480. WMA_TDLS_SUPPORT_EXPLICIT_TRIGGER_ONLY,
  481. WMA_TDLS_SUPPORT_ENABLED,
  482. WMA_TDLS_SUPPORT_ACTIVE_EXTERNAL_CONTROL,
  483. } t_wma_tdls_mode;
  484. /**
  485. * enum wma_tdls_peer_notification - TDLS events
  486. * @WMA_TDLS_SHOULD_DISCOVER: tdls discovery recommended for peer (always based
  487. * on tx bytes per second > tx_discover threshold
  488. * NB: notification will be re-sent after
  489. * discovery_request_interval_ms
  490. * @WMA_TDLS_SHOULD_TEARDOWN: tdls link tear down recommended for peer
  491. * due to tx bytes per second below
  492. * tx_teardown_threshold
  493. * NB: this notification sent once
  494. * @WMA_TDLS_PEER_DISCONNECTED: tx peer TDLS link tear down complete
  495. */
  496. enum wma_tdls_peer_notification {
  497. WMA_TDLS_SHOULD_DISCOVER,
  498. WMA_TDLS_SHOULD_TEARDOWN,
  499. WMA_TDLS_PEER_DISCONNECTED,
  500. };
  501. /**
  502. * enum wma_tdls_peer_reason - TDLS peer reason
  503. * @WMA_TDLS_TEARDOWN_REASON_TX: tdls teardown recommended due to low transmits
  504. * @WMA_TDLS_TEARDOWN_REASON_RATE: tdls tear down recommended due to
  505. * packet rates < AP rates
  506. * @WMA_TDLS_TEARDOWN_REASON_RSSI: tdls link tear down recommended
  507. * due to poor RSSI
  508. * @WMA_TDLS_TEARDOWN_REASON_SCAN: tdls link tear down recommended
  509. * due to offchannel scan
  510. * @WMA_TDLS_DISCONNECTED_REASON_PEER_DELETE: tdls peer disconnected
  511. * due to peer deletion
  512. */
  513. enum wma_tdls_peer_reason {
  514. WMA_TDLS_TEARDOWN_REASON_TX,
  515. WMA_TDLS_TEARDOWN_REASON_RATE,
  516. WMA_TDLS_TEARDOWN_REASON_RSSI,
  517. WMA_TDLS_TEARDOWN_REASON_SCAN,
  518. WMA_TDLS_DISCONNECTED_REASON_PEER_DELETE,
  519. };
  520. #endif /* FEATURE_WLAN_TDLS */
  521. /**
  522. * enum wma_rx_exec_ctx - wma rx execution context
  523. * @WMA_RX_WORK_CTX: work queue context execution
  524. * @WMA_RX_TASKLET_CTX: tasklet context execution
  525. * @WMA_RX_SERIALIZER_CTX: MC thread context execution
  526. *
  527. */
  528. enum wma_rx_exec_ctx {
  529. WMA_RX_WORK_CTX,
  530. WMA_RX_TASKLET_CTX,
  531. WMA_RX_SERIALIZER_CTX
  532. };
  533. /**
  534. * enum wma_phy_idx
  535. * @PHY1: to notify caller that PHY1 specific param needed
  536. * @PHY2: to notify caller that PHY2 specific param needed
  537. * @PHY1_PHY2: to notify caller that both PHY's param needed
  538. * Note: Firmware sends phy map in terms of bitmask, so enum
  539. * also needs to be defined that way.
  540. *
  541. * For example, 0x3 = 0011 = BIT0 corresponds to one phy and
  542. * BIT1 coresponds to another phy. There is no direct relation between
  543. * each bit to particular PHY (ex. PHYA or PHYB).
  544. *
  545. * In simple terms, 3 means referring both PHYs & 1 or 2 means
  546. * referring to either PHYA or PHYB.
  547. */
  548. enum wma_phy_idx {
  549. PHY1 = 0x1, /* 0x1 */
  550. PHY2, /* 0x2 */
  551. PHY1_PHY2, /* 0x3 */
  552. };
  553. /**
  554. * struct wma_mem_chunk - memory chunks
  555. * @vaddr: virtual address
  556. * @paddr: physical address
  557. * @memctx: dma mapped memory
  558. * @len: length of data
  559. * @req_id: request id
  560. *
  561. * memory chunck allocated by Host to be managed by FW
  562. * used only for low latency interfaces like pcie
  563. */
  564. struct wma_mem_chunk {
  565. uint32_t *vaddr;
  566. uint32_t paddr;
  567. qdf_dma_mem_context(memctx);
  568. uint32_t len;
  569. uint32_t req_id;
  570. };
  571. /**
  572. * struct p2p_scan_param - p2p scan listen parameters
  573. * @scan_id: scan id
  574. * @p2p_scan_type: p2p scan type
  575. */
  576. struct p2p_scan_param {
  577. uint32_t scan_id;
  578. tSirP2pScanType p2p_scan_type;
  579. };
  580. /**
  581. * struct scan_param - scan parameters
  582. * @scan_id: scan id
  583. * @scan_requestor_id: scan requestor id
  584. * @p2p_scan_type: p2p scan type
  585. */
  586. struct scan_param {
  587. uint32_t scan_id;
  588. uint32_t scan_requestor_id;
  589. tSirP2pScanType p2p_scan_type;
  590. uint32_t chan_freq;
  591. };
  592. /**
  593. * struct beacon_info - structure to store beacon template
  594. * @buf: skb ptr
  595. * @len: length
  596. * @dma_mapped: is it dma mapped or not
  597. * @tim_ie_offset: TIM IE offset
  598. * @dtim_count: DTIM count
  599. * @seq_no: sequence no
  600. * @noa_sub_ie: NOA sub IE
  601. * @noa_sub_ie_len: NOA sub IE length
  602. * @noa_ie: NOA IE
  603. * @p2p_ie_offset: p2p IE offset
  604. * @lock: lock
  605. */
  606. struct beacon_info {
  607. qdf_nbuf_t buf;
  608. uint32_t len;
  609. uint8_t dma_mapped;
  610. uint32_t tim_ie_offset;
  611. uint8_t dtim_count;
  612. uint16_t seq_no;
  613. uint8_t noa_sub_ie[2 + WMA_NOA_IE_SIZE(WMA_MAX_NOA_DESCRIPTORS)];
  614. uint16_t noa_sub_ie_len;
  615. uint8_t *noa_ie;
  616. uint16_t p2p_ie_offset;
  617. qdf_spinlock_t lock;
  618. };
  619. /**
  620. * struct beacon_tim_ie - structure to store TIM IE of beacon
  621. * @tim_ie: tim ie
  622. * @tim_len: tim ie length
  623. * @dtim_count: dtim count
  624. * @dtim_period: dtim period
  625. * @tim_bitctl: tim bit control
  626. * @tim_bitmap: tim bitmap
  627. */
  628. struct beacon_tim_ie {
  629. uint8_t tim_ie;
  630. uint8_t tim_len;
  631. uint8_t dtim_count;
  632. uint8_t dtim_period;
  633. uint8_t tim_bitctl;
  634. uint8_t tim_bitmap[1];
  635. } __ATTRIB_PACK;
  636. /**
  637. * struct pps - packet power save parameter
  638. * @paid_match_enable: paid match enable
  639. * @gid_match_enable: gid match enable
  640. * @tim_clear: time clear
  641. * @dtim_clear: dtim clear
  642. * @eof_delim: eof delim
  643. * @mac_match: mac match
  644. * @delim_fail: delim fail
  645. * @nsts_zero: nsts zero
  646. * @rssi_chk: RSSI check
  647. * @ebt_5g: ebt 5GHz
  648. */
  649. struct pps {
  650. bool paid_match_enable;
  651. bool gid_match_enable;
  652. bool tim_clear;
  653. bool dtim_clear;
  654. bool eof_delim;
  655. bool mac_match;
  656. bool delim_fail;
  657. bool nsts_zero;
  658. bool rssi_chk;
  659. bool ebt_5g;
  660. };
  661. /**
  662. * struct qpower_params - qpower related parameters
  663. * @max_ps_poll_cnt: max ps poll count
  664. * @max_tx_before_wake: max tx before wake
  665. * @spec_ps_poll_wake_interval: ps poll wake interval
  666. * @max_spec_nodata_ps_poll: no data ps poll
  667. */
  668. struct qpower_params {
  669. uint32_t max_ps_poll_cnt;
  670. uint32_t max_tx_before_wake;
  671. uint32_t spec_ps_poll_wake_interval;
  672. uint32_t max_spec_nodata_ps_poll;
  673. };
  674. /**
  675. * struct gtx_config_t - GTX config
  676. * @gtxRTMask: for HT and VHT rate masks
  677. * @gtxUsrcfg: host request for GTX mask
  678. * @gtxPERThreshold: PER Threshold (default: 10%)
  679. * @gtxPERMargin: PER margin (default: 2%)
  680. * @gtxTPCstep: TCP step (default: 1)
  681. * @gtxTPCMin: TCP min (default: 5)
  682. * @gtxBWMask: BW mask (20/40/80/160 Mhz)
  683. */
  684. typedef struct {
  685. uint32_t gtxRTMask[2];
  686. uint32_t gtxUsrcfg;
  687. uint32_t gtxPERThreshold;
  688. uint32_t gtxPERMargin;
  689. uint32_t gtxTPCstep;
  690. uint32_t gtxTPCMin;
  691. uint32_t gtxBWMask;
  692. } gtx_config_t;
  693. /**
  694. * struct pdev_cli_config_t - store pdev parameters
  695. * @ani_enable: ANI is enabled/disable on target
  696. * @ani_poll_len: store ANI polling period
  697. * @ani_listen_len: store ANI listening period
  698. * @ani_ofdm_level: store ANI OFDM immunity level
  699. * @ani_cck_level: store ANI CCK immunity level
  700. * @cwmenable: Dynamic bw is enable/disable in fw
  701. * @txchainmask: tx chain mask
  702. * @rxchainmask: rx chain mask
  703. * @txpow2g: tx power limit for 2GHz
  704. * @txpow5g: tx power limit for 5GHz
  705. * @burst_enable: is burst enable/disable
  706. * @burst_dur: burst duration
  707. *
  708. * This structure stores pdev parameters.
  709. * Some of these parameters are set in fw and some
  710. * parameters are only maintained in host.
  711. */
  712. typedef struct {
  713. uint32_t ani_enable;
  714. uint32_t ani_poll_len;
  715. uint32_t ani_listen_len;
  716. uint32_t ani_ofdm_level;
  717. uint32_t ani_cck_level;
  718. uint32_t cwmenable;
  719. uint32_t cts_cbw;
  720. uint32_t txchainmask;
  721. uint32_t rxchainmask;
  722. uint32_t txpow2g;
  723. uint32_t txpow5g;
  724. uint32_t burst_enable;
  725. uint32_t burst_dur;
  726. } pdev_cli_config_t;
  727. /**
  728. * struct vdev_cli_config_t - store vdev parameters
  729. * @nss: nss width
  730. * @ldpc: is ldpc is enable/disable
  731. * @tx_stbc: TX STBC is enable/disable
  732. * @rx_stbc: RX STBC is enable/disable
  733. * @shortgi: short gi is enable/disable
  734. * @rtscts_en: RTS/CTS is enable/disable
  735. * @chwidth: channel width
  736. * @tx_rate: tx rate
  737. * @ampdu: ampdu size
  738. * @amsdu: amsdu size
  739. * @erx_adjust: enable/disable early rx enable
  740. * @erx_bmiss_num: target bmiss number per sample
  741. * @erx_bmiss_cycle: sample cycle
  742. * @erx_slop_step: slop_step value
  743. * @erx_init_slop: init slop
  744. * @erx_adj_pause: pause adjust enable/disable
  745. * @erx_dri_sample: enable/disable drift sample
  746. * @pps_params: packet power save parameters
  747. * @qpower_params: qpower parameters
  748. * @gtx_info: GTX offload info
  749. * @dcm: DCM enable/disable
  750. * @range_ext: HE range extension enable/disable
  751. *
  752. * This structure stores vdev parameters.
  753. * Some of these parameters are set in fw and some
  754. * parameters are only maintained in host.
  755. */
  756. typedef struct {
  757. uint32_t nss;
  758. uint32_t ldpc;
  759. uint32_t tx_stbc;
  760. uint32_t rx_stbc;
  761. uint32_t shortgi;
  762. uint32_t rtscts_en;
  763. uint32_t chwidth;
  764. uint32_t tx_rate;
  765. uint32_t ampdu;
  766. uint32_t amsdu;
  767. uint32_t erx_adjust;
  768. uint32_t erx_bmiss_num;
  769. uint32_t erx_bmiss_cycle;
  770. uint32_t erx_slop_step;
  771. uint32_t erx_init_slop;
  772. uint32_t erx_adj_pause;
  773. uint32_t erx_dri_sample;
  774. struct pps pps_params;
  775. struct qpower_params qpower_params;
  776. gtx_config_t gtx_info;
  777. #ifdef WLAN_FEATURE_11AX
  778. uint8_t dcm;
  779. uint8_t range_ext;
  780. #endif
  781. } vdev_cli_config_t;
  782. /**
  783. * struct wma_version_info - Store wmi version info
  784. * @major: wmi major version
  785. * @minor: wmi minor version
  786. * @revision: wmi revision number
  787. */
  788. struct wma_version_info {
  789. u_int32_t major;
  790. u_int32_t minor;
  791. u_int32_t revision;
  792. };
  793. /**
  794. * struct wma_wow - store wow patterns
  795. * @magic_ptrn_enable: magic pattern enable/disable
  796. * @wow_enable: wow enable/disable
  797. * @wow_enable_cmd_sent: is wow enable command sent to fw
  798. * @deauth_enable: is deauth wakeup enable/disable
  799. * @disassoc_enable: is disassoc wakeup enable/disable
  800. * @bmiss_enable: is bmiss wakeup enable/disable
  801. * @gtk_pdev_enable: is GTK based wakeup enable/disable
  802. * @gtk_err_enable: is GTK error wakeup enable/disable
  803. * @lphb_cache: lphb cache
  804. *
  805. * This structure stores wow patterns and
  806. * wow related parameters in host.
  807. */
  808. struct wma_wow {
  809. bool magic_ptrn_enable;
  810. bool wow_enable;
  811. bool wow_enable_cmd_sent;
  812. bool deauth_enable;
  813. bool disassoc_enable;
  814. bool bmiss_enable;
  815. bool gtk_err_enable[WMA_MAX_SUPPORTED_BSS];
  816. };
  817. #ifdef WLAN_FEATURE_11W
  818. #define CMAC_IPN_LEN (6)
  819. #define WMA_IGTK_KEY_INDEX_4 (4)
  820. #define WMA_IGTK_KEY_INDEX_5 (5)
  821. /**
  822. * struct wma_igtk_ipn_t - GTK IPN info
  823. * @ipn: IPN info
  824. */
  825. typedef struct {
  826. uint8_t ipn[CMAC_IPN_LEN];
  827. } wma_igtk_ipn_t;
  828. /**
  829. * struct wma_igtk_key_t - GTK key
  830. * @key_length: key length
  831. * @key: key
  832. * @key_id: key id
  833. */
  834. typedef struct {
  835. uint16_t key_length;
  836. uint8_t key[CSR_AES_GMAC_256_KEY_LEN];
  837. /* IPN is maintained per iGTK keyID
  838. * 0th index for iGTK keyID = 4;
  839. * 1st index for iGTK KeyID = 5
  840. */
  841. wma_igtk_ipn_t key_id[2];
  842. uint32_t key_cipher;
  843. } wma_igtk_key_t;
  844. #endif
  845. /**
  846. * struct vdev_restart_params_t - vdev restart parameters
  847. * @vdev_id: vdev id
  848. * @ssid: ssid
  849. * @flags: flags
  850. * @requestor_id: requestor id
  851. * @chan: channel
  852. * @hidden_ssid_restart_in_progress: hidden ssid restart flag
  853. * @ssidHidden: is ssid hidden or not
  854. */
  855. typedef struct {
  856. A_UINT32 vdev_id;
  857. wmi_ssid ssid;
  858. A_UINT32 flags;
  859. A_UINT32 requestor_id;
  860. A_UINT32 disable_hw_ack;
  861. wmi_channel chan;
  862. qdf_atomic_t hidden_ssid_restart_in_progress;
  863. uint8_t ssidHidden;
  864. } vdev_restart_params_t;
  865. struct roam_synch_frame_ind {
  866. uint32_t bcn_probe_rsp_len;
  867. uint8_t *bcn_probe_rsp;
  868. uint8_t is_beacon;
  869. uint32_t reassoc_req_len;
  870. uint8_t *reassoc_req;
  871. uint32_t reassoc_rsp_len;
  872. uint8_t *reassoc_rsp;
  873. };
  874. /**
  875. * struct wma_txrx_node - txrx node
  876. * @addr: mac address
  877. * @bssid: bssid
  878. * @handle: wma handle
  879. * @beacon: beacon info
  880. * @vdev_restart_params: vdev restart parameters
  881. * @config: per vdev config parameters
  882. * @scan_info: scan info
  883. * @type: type
  884. * @sub_type: sub type
  885. * @nlo_match_evt_received: is nlo match event received or not
  886. * @pno_in_progress: is pno in progress or not
  887. * @plm_in_progress: is plm in progress or not
  888. * @ptrn_match_enable: is pattern match is enable or not
  889. * @num_wow_default_patterns: number of default wow patterns configured for vdev
  890. * @num_wow_user_patterns: number of user wow patterns configured for vdev
  891. * @conn_state: connection state
  892. * @beaconInterval: beacon interval
  893. * @llbCoexist: 11b coexist
  894. * @shortSlotTimeSupported: is short slot time supported or not
  895. * @dtimPeriod: DTIM period
  896. * @chanmode: channel mode
  897. * @vht_capable: VHT capablity flag
  898. * @ht_capable: HT capablity flag
  899. * @mhz: channel frequency in KHz
  900. * @chan_width: channel bandwidth
  901. * @vdev_up: is vdev up or not
  902. * @tsfadjust: TSF adjust
  903. * @addBssStaContext: add bss context
  904. * @aid: association id
  905. * @rmfEnabled: Robust Management Frame (RMF) enabled/disabled
  906. * @key: GTK key
  907. * @uapsd_cached_val: uapsd cached value
  908. * @stats_rsp: stats response
  909. * @fw_stats_set: fw stats value
  910. * @del_staself_req: delete sta self request
  911. * @bss_status: bss status
  912. * @rate_flags: rate flags
  913. * @nss: nss value
  914. * @is_channel_switch: is channel switch
  915. * @pause_bitmap: pause bitmap
  916. * @tx_power: tx power in dbm
  917. * @max_tx_power: max tx power in dbm
  918. * @nwType: network type (802.11a/b/g/n/ac)
  919. * @staKeyParams: sta key parameters
  920. * @ps_enabled: is powersave enable/disable
  921. * @restore_dtim_setting: DTIM settings restore flag
  922. * @peer_count: peer count
  923. * @roam_synch_in_progress: flag is in progress or not
  924. * @plink_status_req: link status request
  925. * @psnr_req: snr request
  926. * @delay_before_vdev_stop: delay
  927. * @override_li: dynamically user configured listen interval
  928. * @tx_streams: number of tx streams can be used by the vdev
  929. * @rx_streams: number of rx streams can be used by the vdev
  930. * @chain_mask: chain mask can be used by the vdev
  931. * @mac_id: the mac on which vdev is on
  932. * @wep_default_key_idx: wep default index for group key
  933. * @arp_offload_req: cached arp offload request
  934. * @ns_offload_req: cached ns offload request
  935. * @wow_stats: stat counters for WoW related events
  936. * @rcpi_req: rcpi request
  937. * It stores parameters per vdev in wma.
  938. * @in_bmps : Whether bmps for this interface has been enabled
  939. * @vdev_start_wakelock: wakelock to protect vdev start op with firmware
  940. * @vdev_stop_wakelock: wakelock to protect vdev stop op with firmware
  941. * @vdev_set_key_wakelock: wakelock to protect vdev set key op with firmware
  942. * @channel: channel
  943. */
  944. struct wma_txrx_node {
  945. uint8_t addr[IEEE80211_ADDR_LEN];
  946. uint8_t bssid[IEEE80211_ADDR_LEN];
  947. struct cdp_vdev *handle;
  948. struct beacon_info *beacon;
  949. vdev_restart_params_t vdev_restart_params;
  950. vdev_cli_config_t config;
  951. struct scan_param scan_info;
  952. uint32_t type;
  953. uint32_t sub_type;
  954. #ifdef FEATURE_WLAN_ESE
  955. bool plm_in_progress;
  956. #endif
  957. bool ptrn_match_enable;
  958. uint8_t num_wow_default_patterns;
  959. uint8_t num_wow_user_patterns;
  960. bool conn_state;
  961. tSirMacBeaconInterval beaconInterval;
  962. uint8_t llbCoexist;
  963. uint8_t shortSlotTimeSupported;
  964. uint8_t dtimPeriod;
  965. WLAN_PHY_MODE chanmode;
  966. uint8_t vht_capable;
  967. uint8_t ht_capable;
  968. A_UINT32 mhz;
  969. enum phy_ch_width chan_width;
  970. bool vdev_active;
  971. uint64_t tsfadjust;
  972. void *addBssStaContext;
  973. uint8_t aid;
  974. uint8_t rmfEnabled;
  975. #ifdef WLAN_FEATURE_11W
  976. wma_igtk_key_t key;
  977. #endif /* WLAN_FEATURE_11W */
  978. uint32_t uapsd_cached_val;
  979. tAniGetPEStatsRsp *stats_rsp;
  980. uint8_t fw_stats_set;
  981. void *del_staself_req;
  982. bool is_del_sta_defered;
  983. qdf_atomic_t bss_status;
  984. uint8_t rate_flags;
  985. uint8_t nss;
  986. bool is_channel_switch;
  987. uint16_t pause_bitmap;
  988. int8_t tx_power;
  989. int8_t max_tx_power;
  990. uint32_t nwType;
  991. void *staKeyParams;
  992. bool restore_dtim_setting;
  993. uint32_t peer_count;
  994. qdf_atomic_t fw_peer_count;
  995. qdf_event_t fw_peer_delete_completion;
  996. bool roam_synch_in_progress;
  997. void *plink_status_req;
  998. void *psnr_req;
  999. uint8_t delay_before_vdev_stop;
  1000. #ifdef FEATURE_WLAN_EXTSCAN
  1001. bool extscan_in_progress;
  1002. #endif
  1003. uint32_t alt_modulated_dtim;
  1004. bool alt_modulated_dtim_enabled;
  1005. uint32_t override_li;
  1006. uint32_t tx_streams;
  1007. uint32_t rx_streams;
  1008. uint32_t chain_mask;
  1009. uint32_t mac_id;
  1010. bool roaming_in_progress;
  1011. int32_t roam_synch_delay;
  1012. uint8_t nss_2g;
  1013. uint8_t nss_5g;
  1014. bool p2p_lo_in_progress;
  1015. uint8_t wep_default_key_idx;
  1016. tSirHostOffloadReq arp_offload_req;
  1017. tSirHostOffloadReq ns_offload_req;
  1018. bool is_vdev_valid;
  1019. struct sir_vdev_wow_stats wow_stats;
  1020. struct sme_rcpi_req *rcpi_req;
  1021. #ifdef WLAN_FEATURE_11AX
  1022. bool he_capable;
  1023. uint32_t he_ops;
  1024. #endif
  1025. bool in_bmps;
  1026. struct beacon_filter_param beacon_filter;
  1027. bool beacon_filter_enabled;
  1028. qdf_wake_lock_t vdev_start_wakelock;
  1029. qdf_wake_lock_t vdev_stop_wakelock;
  1030. qdf_wake_lock_t vdev_set_key_wakelock;
  1031. struct roam_synch_frame_ind roam_synch_frame_ind;
  1032. bool is_waiting_for_key;
  1033. uint8_t channel;
  1034. };
  1035. /**
  1036. * struct scan_timer_info - scan timer info
  1037. * @vdev_id: vdev id
  1038. * @scan_id: scan id
  1039. */
  1040. typedef struct {
  1041. uint8_t vdev_id;
  1042. uint32_t scan_id;
  1043. } scan_timer_info;
  1044. /**
  1045. * struct ibss_power_save_params - IBSS power save parameters
  1046. * @atimWindowLength: ATIM window length
  1047. * @isPowerSaveAllowed: is power save allowed
  1048. * @isPowerCollapseAllowed: is power collapsed allowed
  1049. * @isAwakeonTxRxEnabled: is awake on tx/rx enabled
  1050. * @inactivityCount: inactivity count
  1051. * @txSPEndInactivityTime: tx SP end inactivity time
  1052. * @ibssPsWarmupTime: IBSS power save warm up time
  1053. * @ibssPs1RxChainInAtimEnable: IBSS power save rx chain in ATIM enable
  1054. */
  1055. typedef struct {
  1056. uint32_t atimWindowLength;
  1057. uint32_t isPowerSaveAllowed;
  1058. uint32_t isPowerCollapseAllowed;
  1059. uint32_t isAwakeonTxRxEnabled;
  1060. uint32_t inactivityCount;
  1061. uint32_t txSPEndInactivityTime;
  1062. uint32_t ibssPsWarmupTime;
  1063. uint32_t ibssPs1RxChainInAtimEnable;
  1064. } ibss_power_save_params;
  1065. /**
  1066. * struct mac_ss_bw_info - hw_mode_list PHY/MAC params for each MAC
  1067. * @mac_tx_stream: Max TX stream
  1068. * @mac_rx_stream: Max RX stream
  1069. * @mac_bw: Max bandwidth
  1070. */
  1071. struct mac_ss_bw_info {
  1072. uint32_t mac_tx_stream;
  1073. uint32_t mac_rx_stream;
  1074. uint32_t mac_bw;
  1075. };
  1076. /**
  1077. * struct wma_ini_config - Structure to hold wma ini configuration
  1078. * @max_no_of_peers: Max Number of supported
  1079. *
  1080. * Placeholder for WMA ini parameters.
  1081. */
  1082. struct wma_ini_config {
  1083. uint8_t max_no_of_peers;
  1084. };
  1085. /**
  1086. * struct wmi_valid_channels - Channel details part of WMI_SCAN_CHAN_LIST_CMDID
  1087. * @num_channels: Number of channels
  1088. * @channel_list: Channel list
  1089. */
  1090. struct wma_valid_channels {
  1091. uint8_t num_channels;
  1092. uint8_t channel_list[MAX_NUM_CHAN];
  1093. };
  1094. /**
  1095. * struct hw_mode_idx_to_mac_cap_idx - map between hw_mode to capabilities
  1096. * @num_of_macs: number of macs/PHYs for given hw_mode through hw_mode_id
  1097. * @mac_cap_idx: index of the mac/PHY for given hw_mode through hw_mode_id
  1098. * @hw_mode_id: given hw_mode id
  1099. */
  1100. struct hw_mode_idx_to_mac_cap_idx {
  1101. uint8_t num_of_macs;
  1102. uint8_t mac_cap_idx;
  1103. uint8_t hw_mode_id;
  1104. };
  1105. /**
  1106. * struct t_wma_handle - wma context
  1107. * @wmi_handle: wmi handle
  1108. * @cds_context: cds handle
  1109. * @mac_context: mac context
  1110. * @psoc: psoc context
  1111. * @wma_resume_event: wma resume event
  1112. * @target_suspend: target suspend event
  1113. * @recovery_event: wma FW recovery event
  1114. * @max_station: max stations
  1115. * @max_bssid: max bssid
  1116. * @driver_type: driver type
  1117. * @myaddr: current mac address
  1118. * @hwaddr: mac address from EEPROM
  1119. * @lpss_support: LPSS feature is supported in target or not
  1120. * @egap_support: Enhanced Green AP support flag
  1121. * @wmi_ready: wmi status flag
  1122. * @wlan_init_status: wlan init status
  1123. * @qdf_dev: qdf device
  1124. * @wmi_service_bitmap: wmi services bitmap received from Target
  1125. * @frameTransRequired: frame transmission required
  1126. * @wmaGlobalSystemRole: global system role
  1127. * @tx_frm_download_comp_cb: Tx Frame Compl Cb registered by umac
  1128. * @tx_frm_download_comp_event: Event to wait for tx download completion
  1129. * @tx_queue_empty_event: wait for tx queue to get flushed
  1130. * @umac_ota_ack_cb: Ack Complete Callback registered by umac
  1131. * @umac_data_ota_ack_cb: ack complete callback
  1132. * @last_umac_data_ota_timestamp: timestamp when OTA of last umac data was done
  1133. * @last_umac_data_nbuf: cache nbuf ptr for the last umac data buf
  1134. * @needShutdown: is shutdown needed or not
  1135. * @num_mem_chunks: number of memory chunk
  1136. * @mem_chunks: memory chunks
  1137. * @tgt_cfg_update_cb: configuration update callback
  1138. * @reg_cap: regulatory capablities
  1139. * @scan_id: scan id
  1140. * @interfaces: txrx nodes(per vdev)
  1141. * @pdevconfig: pdev related configrations
  1142. * @vdev_resp_queue: vdev response queue
  1143. * @vdev_respq_lock: vdev response queue lock
  1144. * @vht_supp_mcs: VHT supported MCS
  1145. * @is_fw_assert: is fw asserted
  1146. * @wow: wow related patterns & parameters
  1147. * @no_of_suspend_ind: number of suspend indications
  1148. * @no_of_resume_ind: number of resume indications
  1149. * @mArpInfo: arp info
  1150. * @powersave_mode: power save mode
  1151. * @ptrn_match_enable_all_vdev: is pattern match is enable/disable
  1152. * @pGetRssiReq: get RSSI request
  1153. * @thermal_mgmt_info: Thermal mitigation related info
  1154. * @roam_offload_enabled: is roam offload enable/disable
  1155. * @ssdp: ssdp flag
  1156. * @enable_mc_list : To Check if Multicast list filtering is enabled in FW
  1157. * @ibss_started: is IBSS started or not
  1158. * @ibsskey_info: IBSS key info
  1159. * @hddTxFailCb: tx fail indication callback
  1160. * @pno_wake_lock: PNO wake lock
  1161. * @extscan_wake_lock: extscan wake lock
  1162. * @wow_wake_lock: wow wake lock
  1163. * @wow_auth_req_wl: wow wake lock for auth req
  1164. * @wow_assoc_req_wl: wow wake lock for assoc req
  1165. * @wow_deauth_rec_wl: wow wake lock for deauth req
  1166. * @wow_disassoc_rec_wl: wow wake lock for disassoc req
  1167. * @wow_ap_assoc_lost_wl: wow wake lock for assoc lost req
  1168. * @wow_auto_shutdown_wl: wow wake lock for shutdown req
  1169. * @roam_ho_wl: wake lock for roam handoff req
  1170. * @wow_nack: wow negative ack flag
  1171. * @ap_client_cnt: ap client count
  1172. * @is_wow_bus_suspended: is wow bus suspended flag
  1173. * @wma_scan_comp_timer: scan completion timer
  1174. * @suitable_ap_hb_failure: better ap found
  1175. * @suitable_ap_hb_failure_rssi: record the RSSI when suitable_ap_hb_failure
  1176. * for later usage to report RSSI at beacon miss scenario
  1177. * @wma_ibss_power_save_params: IBSS Power Save config Parameters
  1178. * @IsRArateLimitEnabled: RA rate limiti s enabled or not
  1179. * @RArateLimitInterval: RA rate limit interval
  1180. * @is_lpass_enabled: Flag to indicate if LPASS feature is enabled or not
  1181. * @is_nan_enabled: Flag to indicate if NaN feature is enabled or not
  1182. * @staMaxLIModDtim: station max listen interval
  1183. * @staModDtim: station mode DTIM
  1184. * @staDynamicDtim: station dynamic DTIM
  1185. * @enable_mhf_offload: is MHF offload enable/disable
  1186. * @last_mhf_entries_timestamp: timestamp when last entries where set
  1187. * @hw_bd_id: hardware board id
  1188. * @hw_bd_info: hardware board info
  1189. * @in_d0wow: D0WOW is enable/disable
  1190. * @miracast_value: miracast value
  1191. * @log_completion_timer: log completion timer
  1192. * @num_dbs_hw_modes: Number of HW modes supported by the FW
  1193. * @dbs_mode: DBS HW mode list
  1194. * @old_hw_mode_index: Previous configured HW mode index
  1195. * @new_hw_mode_index: Current configured HW mode index
  1196. * @extended_caps phy_caps: extended caps per hw mode
  1197. * @peer_authorized_cb: peer authorized hdd callback
  1198. * @ocb_callback: callback to OCB commands
  1199. * @ocb_resp: response to OCB commands
  1200. * @wow_pno_match_wake_up_count: PNO match wake up count
  1201. * @wow_pno_complete_wake_up_count: PNO complete wake up count
  1202. * @wow_gscan_wake_up_count: Gscan wake up count
  1203. * @wow_low_rssi_wake_up_count: Low rssi wake up count
  1204. * @wow_rssi_breach_wake_up_count: RSSI breach wake up count
  1205. * @wow_ucast_wake_up_count: WoW unicast packet wake up count
  1206. * @wow_bcast_wake_up_count: WoW brodcast packet wake up count
  1207. * @wow_ipv4_mcast_wake_up_count: WoW IPV4 mcast packet wake up count
  1208. * @wow_ipv6_mcast_wake_up_count: WoW IPV6 mcast packet wake up count
  1209. * @wow_ipv6_mcast_ra_stats: WoW IPV6 mcast RA packet wake up count
  1210. * @wow_ipv6_mcast_ns_stats: WoW IPV6 mcast NS packet wake up count
  1211. * @wow_ipv6_mcast_na_stats: WoW IPV6 mcast NA packet wake up count
  1212. * @wow_icmpv4_count: WoW ipv4 icmp packet wake up count
  1213. * @wow_icmpv6_count: WoW ipv6 icmp packet wake up count
  1214. * @dual_mac_cfg: Dual mac configuration params for scan and fw mode
  1215. *
  1216. * @max_scan: maximum scan requests than can be queued
  1217. * This structure is global wma context
  1218. * It contains global wma module parameters and
  1219. * handle of other modules.
  1220. * @bpf_packet_filter_enable: BPF filter enabled or not
  1221. * @active_uc_bpf_mode: Setting that determines how BPF is applied in active
  1222. * mode for uc packets
  1223. * @active_mc_bc_bpf_mode: Setting that determines how BPF is applied in
  1224. * active mode for MC/BC packets
  1225. * @service_ready_ext_evt: Wait event for service ready ext
  1226. * @wmi_cmd_rsp_wake_lock: wmi command response wake lock
  1227. * @wmi_cmd_rsp_runtime_lock: wmi command response bus lock
  1228. * @saved_chan: saved channel list sent as part of WMI_SCAN_CHAN_LIST_CMDID
  1229. * @is_dfs_offloaded: dfs and cac timer offload
  1230. * @bandcapability: band capability configured through ini
  1231. * @ito_repeat_count: Indicates ito repeated count
  1232. * @critical_events_in_flight: number of suspend preventing events in flight
  1233. */
  1234. typedef struct {
  1235. void *wmi_handle;
  1236. void *cds_context;
  1237. void *mac_context;
  1238. struct wlan_objmgr_psoc *psoc;
  1239. struct wlan_objmgr_pdev *pdev;
  1240. qdf_event_t wma_resume_event;
  1241. qdf_event_t target_suspend;
  1242. qdf_event_t runtime_suspend;
  1243. qdf_event_t recovery_event;
  1244. uint16_t max_station;
  1245. uint16_t max_bssid;
  1246. enum qdf_driver_type driver_type;
  1247. uint8_t myaddr[IEEE80211_ADDR_LEN];
  1248. uint8_t hwaddr[IEEE80211_ADDR_LEN];
  1249. #ifdef WLAN_FEATURE_LPSS
  1250. uint8_t lpss_support;
  1251. #endif
  1252. uint8_t ap_arpns_support;
  1253. bool wmi_ready;
  1254. uint32_t wlan_init_status;
  1255. qdf_device_t qdf_dev;
  1256. uint32_t wmi_service_bitmap[WMI_SERVICE_BM_SIZE];
  1257. uint32_t wmi_service_ext_offset;
  1258. uint32_t wmi_service_ext_bitmap[WMI_SERVICE_SEGMENT_BM_SIZE32];
  1259. uint32_t frameTransRequired;
  1260. tBssSystemRole wmaGlobalSystemRole;
  1261. wma_tx_dwnld_comp_callback tx_frm_download_comp_cb;
  1262. qdf_event_t tx_frm_download_comp_event;
  1263. /*
  1264. * Dummy event to wait for draining MSDUs left in hardware tx
  1265. * queue and before requesting VDEV_STOP. Nobody will set this
  1266. * and wait will timeout, and code will poll the pending tx
  1267. * descriptors number to be zero.
  1268. */
  1269. qdf_event_t tx_queue_empty_event;
  1270. wma_tx_ota_comp_callback umac_ota_ack_cb[SIR_MAC_MGMT_RESERVED15];
  1271. wma_tx_ota_comp_callback umac_data_ota_ack_cb;
  1272. unsigned long last_umac_data_ota_timestamp;
  1273. qdf_nbuf_t last_umac_data_nbuf;
  1274. bool needShutdown;
  1275. uint32_t num_mem_chunks;
  1276. struct wmi_host_mem_chunk mem_chunks[MAX_MEM_CHUNKS];
  1277. wma_tgt_cfg_cb tgt_cfg_update_cb;
  1278. HAL_REG_CAPABILITIES reg_cap;
  1279. uint32_t scan_id;
  1280. struct wma_txrx_node *interfaces;
  1281. pdev_cli_config_t pdevconfig;
  1282. qdf_list_t vdev_resp_queue;
  1283. qdf_spinlock_t vdev_respq_lock;
  1284. qdf_list_t wma_hold_req_queue;
  1285. qdf_spinlock_t wma_hold_req_q_lock;
  1286. uint32_t vht_supp_mcs;
  1287. uint8_t is_fw_assert;
  1288. struct wma_wow wow;
  1289. uint8_t no_of_suspend_ind;
  1290. uint8_t no_of_resume_ind;
  1291. /* Have a back up of arp info to send along
  1292. * with ns info suppose if ns also enabled
  1293. */
  1294. tSirHostOffloadReq mArpInfo;
  1295. struct wma_tx_ack_work_ctx *ack_work_ctx;
  1296. uint8_t powersave_mode;
  1297. bool ptrn_match_enable_all_vdev;
  1298. void *pGetRssiReq;
  1299. bool get_one_peer_info;
  1300. bool get_sta_peer_info;
  1301. struct qdf_mac_addr peer_macaddr;
  1302. t_thermal_mgmt thermal_mgmt_info;
  1303. bool roam_offload_enabled;
  1304. bool ssdp;
  1305. bool enable_mc_list;
  1306. uint8_t ibss_started;
  1307. tSetBssKeyParams ibsskey_info;
  1308. txFailIndCallback hddTxFailCb;
  1309. #ifdef FEATURE_WLAN_EXTSCAN
  1310. qdf_wake_lock_t extscan_wake_lock;
  1311. #endif
  1312. qdf_wake_lock_t wow_wake_lock;
  1313. qdf_wake_lock_t wow_auth_req_wl;
  1314. qdf_wake_lock_t wow_assoc_req_wl;
  1315. qdf_wake_lock_t wow_deauth_rec_wl;
  1316. qdf_wake_lock_t wow_disassoc_rec_wl;
  1317. qdf_wake_lock_t wow_ap_assoc_lost_wl;
  1318. qdf_wake_lock_t wow_auto_shutdown_wl;
  1319. qdf_wake_lock_t roam_ho_wl;
  1320. int wow_nack;
  1321. qdf_atomic_t is_wow_bus_suspended;
  1322. qdf_mc_timer_t wma_scan_comp_timer;
  1323. bool suitable_ap_hb_failure;
  1324. uint32_t suitable_ap_hb_failure_rssi;
  1325. ibss_power_save_params wma_ibss_power_save_params;
  1326. #ifdef FEATURE_WLAN_RA_FILTERING
  1327. bool IsRArateLimitEnabled;
  1328. uint16_t RArateLimitInterval;
  1329. #endif
  1330. #ifdef WLAN_FEATURE_LPSS
  1331. bool is_lpass_enabled;
  1332. #endif
  1333. #ifdef WLAN_FEATURE_NAN
  1334. bool is_nan_enabled;
  1335. #endif
  1336. uint8_t staMaxLIModDtim;
  1337. uint8_t staModDtim;
  1338. uint8_t staDynamicDtim;
  1339. uint8_t enable_mhf_offload;
  1340. unsigned long last_mhf_entries_timestamp;
  1341. uint32_t hw_bd_id;
  1342. uint32_t hw_bd_info[HW_BD_INFO_SIZE];
  1343. uint32_t miracast_value;
  1344. qdf_mc_timer_t log_completion_timer;
  1345. uint32_t num_dbs_hw_modes;
  1346. struct dbs_hw_mode_info hw_mode;
  1347. uint32_t old_hw_mode_index;
  1348. uint32_t new_hw_mode_index;
  1349. qdf_atomic_t scan_id_counter;
  1350. wma_peer_authorized_fp peer_authorized_cb;
  1351. uint32_t wow_unspecified_wake_count;
  1352. /* OCB request contexts */
  1353. struct sir_ocb_config *ocb_config_req;
  1354. uint8_t max_scan;
  1355. uint16_t self_gen_frm_pwr;
  1356. bool tx_chain_mask_cck;
  1357. /* Going with a timer instead of wait event because on receiving the
  1358. * service ready event, we will be waiting on the MC thread for the
  1359. * service extended ready event which is also processed in MC thread.
  1360. * This leads to MC thread being stuck. Alternative was to process
  1361. * these events in tasklet/workqueue context. But, this leads to
  1362. * race conditions when the events are processed in two different
  1363. * context. So, processing ready event and extended ready event in
  1364. * the serialized MC thread context with a timer.
  1365. */
  1366. qdf_mc_timer_t service_ready_ext_timer;
  1367. QDF_STATUS (*csr_roam_synch_cb)(tpAniSirGlobal mac,
  1368. roam_offload_synch_ind *roam_synch_data,
  1369. tpSirBssDescription bss_desc_ptr,
  1370. enum sir_roam_op_code reason);
  1371. QDF_STATUS (*pe_roam_synch_cb)(tpAniSirGlobal mac,
  1372. roam_offload_synch_ind *roam_synch_data,
  1373. tpSirBssDescription bss_desc_ptr,
  1374. enum sir_roam_op_code reason);
  1375. qdf_wake_lock_t wmi_cmd_rsp_wake_lock;
  1376. qdf_runtime_lock_t wmi_cmd_rsp_runtime_lock;
  1377. bool bpf_enabled;
  1378. bool bpf_packet_filter_enable;
  1379. enum active_bpf_mode active_uc_bpf_mode;
  1380. enum active_bpf_mode active_mc_bc_bpf_mode;
  1381. struct wma_ini_config ini_config;
  1382. struct wma_valid_channels saved_chan;
  1383. /* NAN datapath support enabled in firmware */
  1384. bool nan_datapath_enabled;
  1385. QDF_STATUS (*pe_ndp_event_handler)(tpAniSirGlobal mac_ctx,
  1386. struct scheduler_msg *msg);
  1387. bool fw_timeout_crash;
  1388. bool sub_20_support;
  1389. bool is_dfs_offloaded;
  1390. tp_wma_packetdump_cb wma_mgmt_tx_packetdump_cb;
  1391. tp_wma_packetdump_cb wma_mgmt_rx_packetdump_cb;
  1392. bool rcpi_enabled;
  1393. tSirLLStatsResults *link_stats_results;
  1394. uint64_t tx_fail_cnt;
  1395. #ifdef WLAN_FEATURE_11AX
  1396. struct he_capability he_cap;
  1397. #endif
  1398. uint8_t bandcapability;
  1399. bool tx_bfee_8ss_enabled;
  1400. bool in_imps;
  1401. uint8_t ito_repeat_count;
  1402. qdf_mc_timer_t wma_fw_time_sync_timer;
  1403. qdf_atomic_t critical_events_in_flight;
  1404. } t_wma_handle, *tp_wma_handle;
  1405. /**
  1406. * struct wma_target_cap - target capabality
  1407. * @wmi_service_bitmap: wmi services bitmap
  1408. * @wlan_resource_config: resource config
  1409. */
  1410. struct wma_target_cap {
  1411. /* wmi services bitmap received from Target */
  1412. uint32_t wmi_service_bitmap[WMI_SERVICE_BM_SIZE];
  1413. /* default resource config,the os shim can overwrite it */
  1414. target_resource_config wlan_resource_config;
  1415. };
  1416. /**
  1417. * struct t_wma_start_req - wma start request parameters
  1418. * @pConfigBuffer: config buffer
  1419. * @usConfigBufferLen: Length of the config buffer above
  1420. * @driver_type: Production or FTM driver
  1421. * @pUserData: user data
  1422. * @pIndUserData: indication function pointer to send to UMAC
  1423. *
  1424. * The shared memory between WDI and HAL is 4K so maximum data can be
  1425. * transferred from WDI to HAL is 4K
  1426. */
  1427. typedef struct {
  1428. void *pConfigBuffer;
  1429. uint16_t usConfigBufferLen;
  1430. enum qdf_driver_type driver_type;
  1431. void *pUserData;
  1432. void *pIndUserData;
  1433. } t_wma_start_req;
  1434. /* Enumeration for Version */
  1435. typedef enum {
  1436. WLAN_HAL_MSG_VERSION0 = 0,
  1437. WLAN_HAL_MSG_VERSION1 = 1,
  1438. WLAN_HAL_MSG_WCNSS_CTRL_VERSION = 0x7FFF, /*define as 2 bytes data */
  1439. WLAN_HAL_MSG_VERSION_MAX_FIELD = WLAN_HAL_MSG_WCNSS_CTRL_VERSION
  1440. } tHalHostMsgVersion;
  1441. /**
  1442. * struct sHalMacStartParameter - mac start request parameters
  1443. * @driverType: driver type (production/FTM)
  1444. * @uConfigBufferLen: length of config buffer
  1445. */
  1446. typedef struct qdf_packed sHalMacStartParameter {
  1447. enum qdf_driver_type driverType;
  1448. uint32_t uConfigBufferLen;
  1449. /* Following this there is a TLV formatted buffer of length
  1450. * "uConfigBufferLen" bytes containing all config values.
  1451. * The TLV is expected to be formatted like this:
  1452. * 0 15 31 31+CFG_LEN-1 length-1
  1453. * | CFG_ID | CFG_LEN | CFG_BODY | CFG_ID |......|
  1454. */
  1455. } tHalMacStartParameter, *tpHalMacStartParameter;
  1456. extern void cds_wma_complete_cback(void);
  1457. extern void wma_send_regdomain_info_to_fw(uint32_t reg_dmn, uint16_t regdmn2G,
  1458. uint16_t regdmn5G, uint8_t ctl2G,
  1459. uint8_t ctl5G);
  1460. /**
  1461. * enum frame_index - Frame index
  1462. * @GENERIC_NODOWNLD_NOACK_COMP_INDEX: Frame index for no download comp no ack
  1463. * @GENERIC_DOWNLD_COMP_NOACK_COMP_INDEX: Frame index for download comp no ack
  1464. * @GENERIC_DOWNLD_COMP_ACK_COMP_INDEX: Frame index for download comp and ack
  1465. * @GENERIC_NODOWLOAD_ACK_COMP_INDEX: Frame index for no download comp and ack
  1466. * @FRAME_INDEX_MAX: maximum frame index
  1467. */
  1468. enum frame_index {
  1469. GENERIC_NODOWNLD_NOACK_COMP_INDEX,
  1470. GENERIC_DOWNLD_COMP_NOACK_COMP_INDEX,
  1471. GENERIC_DOWNLD_COMP_ACK_COMP_INDEX,
  1472. GENERIC_NODOWLOAD_ACK_COMP_INDEX,
  1473. FRAME_INDEX_MAX
  1474. };
  1475. /**
  1476. * struct wma_tx_ack_work_ctx - tx ack work context
  1477. * @wma_handle: wma handle
  1478. * @sub_type: sub type
  1479. * @status: status
  1480. * @ack_cmp_work: work structure
  1481. */
  1482. struct wma_tx_ack_work_ctx {
  1483. tp_wma_handle wma_handle;
  1484. uint16_t sub_type;
  1485. int32_t status;
  1486. qdf_work_t ack_cmp_work;
  1487. };
  1488. /**
  1489. * struct wma_target_req - target request parameters
  1490. * @event_timeout: event timeout
  1491. * @node: list
  1492. * @user_data: user data
  1493. * @msg_type: message type
  1494. * @vdev_id: vdev id
  1495. * @type: type
  1496. */
  1497. struct wma_target_req {
  1498. qdf_mc_timer_t event_timeout;
  1499. qdf_list_node_t node;
  1500. void *user_data;
  1501. uint32_t msg_type;
  1502. uint8_t vdev_id;
  1503. uint8_t type;
  1504. };
  1505. /**
  1506. * struct wma_vdev_start_req - vdev start request parameters
  1507. * @beacon_intval: beacon interval
  1508. * @dtim_period: dtim period
  1509. * @max_txpow: max tx power
  1510. * @chan_offset: channel offset
  1511. * @is_dfs: is dfs supported or not
  1512. * @vdev_id: vdev id
  1513. * @chan: channel
  1514. * @oper_mode: operating mode
  1515. * @ssid: ssid
  1516. * @hidden_ssid: hidden ssid
  1517. * @pmf_enabled: is pmf enabled or not
  1518. * @vht_capable: VHT capabality
  1519. * @ht_capable: HT capabality
  1520. * @dot11_mode: 802.11 mode
  1521. * @is_half_rate: is the channel operating at 10MHz
  1522. * @is_quarter_rate: is the channel operating at 5MHz
  1523. * @preferred_tx_streams: policy manager indicates the preferred
  1524. * number of transmit streams
  1525. * @preferred_rx_streams: policy manager indicates the preferred
  1526. * number of receive streams
  1527. * @beacon_tx_rate: beacon tx rate
  1528. * @he_capable: HE capability
  1529. * @he_ops: HE operation
  1530. * @cac_duration_ms: cac duration in milliseconds
  1531. * @dfs_regdomain: dfs region
  1532. */
  1533. struct wma_vdev_start_req {
  1534. uint32_t beacon_intval;
  1535. uint32_t dtim_period;
  1536. int32_t max_txpow;
  1537. enum phy_ch_width chan_width;
  1538. bool is_dfs;
  1539. uint8_t vdev_id;
  1540. uint8_t chan;
  1541. uint8_t oper_mode;
  1542. tSirMacSSid ssid;
  1543. uint8_t hidden_ssid;
  1544. uint8_t pmf_enabled;
  1545. uint8_t vht_capable;
  1546. uint8_t ch_center_freq_seg0;
  1547. uint8_t ch_center_freq_seg1;
  1548. uint8_t ht_capable;
  1549. uint8_t dot11_mode;
  1550. bool is_half_rate;
  1551. bool is_quarter_rate;
  1552. uint32_t preferred_tx_streams;
  1553. uint32_t preferred_rx_streams;
  1554. uint16_t beacon_tx_rate;
  1555. #ifdef WLAN_FEATURE_11AX
  1556. bool he_capable;
  1557. uint32_t he_ops;
  1558. #endif
  1559. uint32_t cac_duration_ms;
  1560. uint32_t dfs_regdomain;
  1561. };
  1562. /**
  1563. * struct wma_set_key_params - set key parameters
  1564. * @vdev_id: vdev id
  1565. * @def_key_idx: used to see if we have to read the key from cfg
  1566. * @key_len: key length
  1567. * @peer_mac: peer mac address
  1568. * @singl_tid_rc: 1=Single TID based Replay Count, 0=Per TID based RC
  1569. * @key_type: key type
  1570. * @key_idx: key index
  1571. * @unicast: unicast flag
  1572. * @key_data: key data
  1573. */
  1574. struct wma_set_key_params {
  1575. uint8_t vdev_id;
  1576. /* def_key_idx can be used to see if we have to read the key from cfg */
  1577. uint32_t def_key_idx;
  1578. uint16_t key_len;
  1579. uint8_t peer_mac[IEEE80211_ADDR_LEN];
  1580. uint8_t singl_tid_rc;
  1581. enum eAniEdType key_type;
  1582. uint32_t key_idx;
  1583. bool unicast;
  1584. uint8_t key_data[SIR_MAC_MAX_KEY_LENGTH];
  1585. uint8_t key_rsc[SIR_MAC_MAX_KEY_RSC_LEN];
  1586. };
  1587. /**
  1588. * struct t_thermal_cmd_params - thermal command parameters
  1589. * @minTemp: minimum temprature
  1590. * @maxTemp: maximum temprature
  1591. * @thermalEnable: thermal enable
  1592. */
  1593. typedef struct {
  1594. uint16_t minTemp;
  1595. uint16_t maxTemp;
  1596. uint8_t thermalEnable;
  1597. } t_thermal_cmd_params, *tp_thermal_cmd_params;
  1598. /**
  1599. * enum wma_cfg_cmd_id - wma cmd ids
  1600. * @WMA_VDEV_TXRX_FWSTATS_ENABLE_CMDID: txrx firmware stats enable command
  1601. * @WMA_VDEV_TXRX_FWSTATS_RESET_CMDID: txrx firmware stats reset command
  1602. * @WMA_VDEV_MCC_SET_TIME_LATENCY: set MCC latency time
  1603. * @WMA_VDEV_MCC_SET_TIME_QUOTA: set MCC time quota
  1604. * @WMA_VDEV_IBSS_SET_ATIM_WINDOW_SIZE: set IBSS ATIM window size
  1605. * @WMA_VDEV_IBSS_SET_POWER_SAVE_ALLOWED: set IBSS enable power save
  1606. * @WMA_VDEV_IBSS_SET_POWER_COLLAPSE_ALLOWED: set IBSS power collapse enable
  1607. * @WMA_VDEV_IBSS_SET_AWAKE_ON_TX_RX: awake IBSS on TX/RX
  1608. * @WMA_VDEV_IBSS_SET_INACTIVITY_TIME: set IBSS inactivity time
  1609. * @WMA_VDEV_IBSS_SET_TXSP_END_INACTIVITY_TIME: set IBSS TXSP
  1610. * @WMA_VDEV_IBSS_PS_SET_WARMUP_TIME_SECS: set IBSS power save warmup time
  1611. * @WMA_VDEV_IBSS_PS_SET_1RX_CHAIN_IN_ATIM_WINDOW: set IBSS power save ATIM
  1612. * @WMA_VDEV_TXRX_GET_IPA_UC_FW_STATS_CMDID: get IPA microcontroller fw stats
  1613. * @WMA_VDEV_TXRX_GET_IPA_UC_SHARING_STATS_CMDID: get IPA uC wifi-sharing stats
  1614. * @WMA_VDEV_TXRX_SET_IPA_UC_QUOTA_CMDID: set IPA uC quota limit
  1615. *
  1616. * wma command ids for configuration request which
  1617. * does not involve sending a wmi command.
  1618. */
  1619. enum wma_cfg_cmd_id {
  1620. WMA_VDEV_TXRX_FWSTATS_ENABLE_CMDID = WMI_CMDID_MAX,
  1621. WMA_VDEV_TXRX_FWSTATS_RESET_CMDID,
  1622. WMA_VDEV_MCC_SET_TIME_LATENCY,
  1623. WMA_VDEV_MCC_SET_TIME_QUOTA,
  1624. WMA_VDEV_IBSS_SET_ATIM_WINDOW_SIZE,
  1625. WMA_VDEV_IBSS_SET_POWER_SAVE_ALLOWED,
  1626. WMA_VDEV_IBSS_SET_POWER_COLLAPSE_ALLOWED,
  1627. WMA_VDEV_IBSS_SET_AWAKE_ON_TX_RX,
  1628. WMA_VDEV_IBSS_SET_INACTIVITY_TIME,
  1629. WMA_VDEV_IBSS_SET_TXSP_END_INACTIVITY_TIME,
  1630. WMA_VDEV_IBSS_PS_SET_WARMUP_TIME_SECS,
  1631. WMA_VDEV_IBSS_PS_SET_1RX_CHAIN_IN_ATIM_WINDOW,
  1632. WMA_VDEV_TXRX_GET_IPA_UC_FW_STATS_CMDID,
  1633. WMA_VDEV_TXRX_GET_IPA_UC_SHARING_STATS_CMDID,
  1634. WMA_VDEV_TXRX_SET_IPA_UC_QUOTA_CMDID,
  1635. WMA_CMD_ID_MAX
  1636. };
  1637. /**
  1638. * struct wma_trigger_uapsd_params - trigger uapsd parameters
  1639. * @wmm_ac: wmm access catagory
  1640. * @user_priority: user priority
  1641. * @service_interval: service interval
  1642. * @suspend_interval: suspend interval
  1643. * @delay_interval: delay interval
  1644. */
  1645. typedef struct wma_trigger_uapsd_params {
  1646. uint32_t wmm_ac;
  1647. uint32_t user_priority;
  1648. uint32_t service_interval;
  1649. uint32_t suspend_interval;
  1650. uint32_t delay_interval;
  1651. } t_wma_trigger_uapsd_params, *tp_wma_trigger_uapsd_params;
  1652. /**
  1653. * enum uapsd_peer_param_max_sp - U-APSD maximum service period of peer station
  1654. * @UAPSD_MAX_SP_LEN_UNLIMITED: unlimited max service period
  1655. * @UAPSD_MAX_SP_LEN_2: max service period = 2
  1656. * @UAPSD_MAX_SP_LEN_4: max service period = 4
  1657. * @UAPSD_MAX_SP_LEN_6: max service period = 6
  1658. */
  1659. enum uapsd_peer_param_max_sp {
  1660. UAPSD_MAX_SP_LEN_UNLIMITED = 0,
  1661. UAPSD_MAX_SP_LEN_2 = 2,
  1662. UAPSD_MAX_SP_LEN_4 = 4,
  1663. UAPSD_MAX_SP_LEN_6 = 6
  1664. };
  1665. /**
  1666. * enum uapsd_peer_param_enabled_ac - U-APSD Enabled AC's of peer station
  1667. * @UAPSD_VO_ENABLED: enable uapsd for voice
  1668. * @UAPSD_VI_ENABLED: enable uapsd for video
  1669. * @UAPSD_BK_ENABLED: enable uapsd for background
  1670. * @UAPSD_BE_ENABLED: enable uapsd for best effort
  1671. */
  1672. enum uapsd_peer_param_enabled_ac {
  1673. UAPSD_VO_ENABLED = 0x01,
  1674. UAPSD_VI_ENABLED = 0x02,
  1675. UAPSD_BK_ENABLED = 0x04,
  1676. UAPSD_BE_ENABLED = 0x08
  1677. };
  1678. /**
  1679. * enum profile_id_t - Firmware profiling index
  1680. * @PROF_CPU_IDLE: cpu idle profile
  1681. * @PROF_PPDU_PROC: ppdu processing profile
  1682. * @PROF_PPDU_POST: ppdu post profile
  1683. * @PROF_HTT_TX_INPUT: htt tx input profile
  1684. * @PROF_MSDU_ENQ: msdu enqueue profile
  1685. * @PROF_PPDU_POST_HAL: ppdu post profile
  1686. * @PROF_COMPUTE_TX_TIME: tx time profile
  1687. * @PROF_MAX_ID: max profile index
  1688. */
  1689. enum profile_id_t {
  1690. PROF_CPU_IDLE,
  1691. PROF_PPDU_PROC,
  1692. PROF_PPDU_POST,
  1693. PROF_HTT_TX_INPUT,
  1694. PROF_MSDU_ENQ,
  1695. PROF_PPDU_POST_HAL,
  1696. PROF_COMPUTE_TX_TIME,
  1697. PROF_MAX_ID,
  1698. };
  1699. /**
  1700. * struct p2p_ie - P2P IE structural definition.
  1701. * @p2p_id: p2p id
  1702. * @p2p_len: p2p length
  1703. * @p2p_oui: p2p OUI
  1704. * @p2p_oui_type: p2p OUI type
  1705. */
  1706. struct p2p_ie {
  1707. uint8_t p2p_id;
  1708. uint8_t p2p_len;
  1709. uint8_t p2p_oui[3];
  1710. uint8_t p2p_oui_type;
  1711. } __packed;
  1712. /**
  1713. * struct p2p_noa_descriptor - noa descriptor
  1714. * @type_count: 255: continuous schedule, 0: reserved
  1715. * @duration: Absent period duration in micro seconds
  1716. * @interval: Absent period interval in micro seconds
  1717. * @start_time: 32 bit tsf time when in starts
  1718. */
  1719. struct p2p_noa_descriptor {
  1720. uint8_t type_count;
  1721. uint32_t duration;
  1722. uint32_t interval;
  1723. uint32_t start_time;
  1724. } __packed;
  1725. /**
  1726. * struct p2p_sub_element_noa - p2p noa element
  1727. * @p2p_sub_id: p2p sub id
  1728. * @p2p_sub_len: p2p sub length
  1729. * @index: identifies instance of NOA su element
  1730. * @oppPS: oppPS state of the AP
  1731. * @ctwindow: ctwindow in TUs
  1732. * @num_descriptors: number of NOA descriptors
  1733. * @noa_descriptors: noa descriptors
  1734. */
  1735. struct p2p_sub_element_noa {
  1736. uint8_t p2p_sub_id;
  1737. uint8_t p2p_sub_len;
  1738. uint8_t index; /* identifies instance of NOA su element */
  1739. uint8_t oppPS:1, /* oppPS state of the AP */
  1740. ctwindow:7; /* ctwindow in TUs */
  1741. uint8_t num_descriptors; /* number of NOA descriptors */
  1742. struct p2p_noa_descriptor noa_descriptors[WMA_MAX_NOA_DESCRIPTORS];
  1743. };
  1744. /**
  1745. * struct wma_decap_info_t - decapsulation info
  1746. * @hdr: header
  1747. * @hdr_len: header length
  1748. */
  1749. struct wma_decap_info_t {
  1750. uint8_t hdr[sizeof(struct ieee80211_qosframe_addr4)];
  1751. int32_t hdr_len;
  1752. };
  1753. /**
  1754. * enum packet_power_save - packet power save params
  1755. * @WMI_VDEV_PPS_PAID_MATCH: paid match param
  1756. * @WMI_VDEV_PPS_GID_MATCH: gid match param
  1757. * @WMI_VDEV_PPS_EARLY_TIM_CLEAR: early tim clear param
  1758. * @WMI_VDEV_PPS_EARLY_DTIM_CLEAR: early dtim clear param
  1759. * @WMI_VDEV_PPS_EOF_PAD_DELIM: eof pad delim param
  1760. * @WMI_VDEV_PPS_MACADDR_MISMATCH: macaddr mismatch param
  1761. * @WMI_VDEV_PPS_DELIM_CRC_FAIL: delim CRC fail param
  1762. * @WMI_VDEV_PPS_GID_NSTS_ZERO: gid nsts zero param
  1763. * @WMI_VDEV_PPS_RSSI_CHECK: RSSI check param
  1764. * @WMI_VDEV_PPS_5G_EBT: 5G ebt param
  1765. */
  1766. typedef enum {
  1767. WMI_VDEV_PPS_PAID_MATCH = 0,
  1768. WMI_VDEV_PPS_GID_MATCH = 1,
  1769. WMI_VDEV_PPS_EARLY_TIM_CLEAR = 2,
  1770. WMI_VDEV_PPS_EARLY_DTIM_CLEAR = 3,
  1771. WMI_VDEV_PPS_EOF_PAD_DELIM = 4,
  1772. WMI_VDEV_PPS_MACADDR_MISMATCH = 5,
  1773. WMI_VDEV_PPS_DELIM_CRC_FAIL = 6,
  1774. WMI_VDEV_PPS_GID_NSTS_ZERO = 7,
  1775. WMI_VDEV_PPS_RSSI_CHECK = 8,
  1776. WMI_VDEV_VHT_SET_GID_MGMT = 9,
  1777. WMI_VDEV_PPS_5G_EBT = 10
  1778. } packet_power_save;
  1779. /**
  1780. * enum green_tx_param - green tx parameters
  1781. * @WMI_VDEV_PARAM_GTX_HT_MCS: ht mcs param
  1782. * @WMI_VDEV_PARAM_GTX_VHT_MCS: vht mcs param
  1783. * @WMI_VDEV_PARAM_GTX_USR_CFG: user cfg param
  1784. * @WMI_VDEV_PARAM_GTX_THRE: thre param
  1785. * @WMI_VDEV_PARAM_GTX_MARGIN: green tx margin param
  1786. * @WMI_VDEV_PARAM_GTX_STEP: green tx step param
  1787. * @WMI_VDEV_PARAM_GTX_MINTPC: mintpc param
  1788. * @WMI_VDEV_PARAM_GTX_BW_MASK: bandwidth mask
  1789. */
  1790. typedef enum {
  1791. WMI_VDEV_PARAM_GTX_HT_MCS,
  1792. WMI_VDEV_PARAM_GTX_VHT_MCS,
  1793. WMI_VDEV_PARAM_GTX_USR_CFG,
  1794. WMI_VDEV_PARAM_GTX_THRE,
  1795. WMI_VDEV_PARAM_GTX_MARGIN,
  1796. WMI_VDEV_PARAM_GTX_STEP,
  1797. WMI_VDEV_PARAM_GTX_MINTPC,
  1798. WMI_VDEV_PARAM_GTX_BW_MASK,
  1799. } green_tx_param;
  1800. #ifdef FEATURE_WLAN_TDLS
  1801. /**
  1802. * struct wma_tdls_params - TDLS parameters
  1803. * @vdev_id: vdev id
  1804. * @tdls_state: TDLS state
  1805. * @notification_interval_ms: notification inerval
  1806. * @tx_discovery_threshold: tx discovery threshold
  1807. * @tx_teardown_threshold: tx teardown threashold
  1808. * @rssi_teardown_threshold: RSSI teardown threshold
  1809. * @rssi_delta: RSSI delta
  1810. * @tdls_options: TDLS options
  1811. * @peer_traffic_ind_window: raffic indication window
  1812. * @peer_traffic_response_timeout: traffic response timeout
  1813. * @puapsd_mask: uapsd mask
  1814. * @puapsd_inactivity_time: uapsd inactivity time
  1815. * @puapsd_rx_frame_threshold: uapsd rx frame threshold
  1816. * @teardown_notification_ms: tdls teardown notification interval
  1817. * @tdls_peer_kickout_threshold: tdls packet threshold for
  1818. * peer kickout operation
  1819. */
  1820. typedef struct wma_tdls_params {
  1821. uint32_t vdev_id;
  1822. uint32_t tdls_state;
  1823. uint32_t notification_interval_ms;
  1824. uint32_t tx_discovery_threshold;
  1825. uint32_t tx_teardown_threshold;
  1826. int32_t rssi_teardown_threshold;
  1827. int32_t rssi_delta;
  1828. uint32_t tdls_options;
  1829. uint32_t peer_traffic_ind_window;
  1830. uint32_t peer_traffic_response_timeout;
  1831. uint32_t puapsd_mask;
  1832. uint32_t puapsd_inactivity_time;
  1833. uint32_t puapsd_rx_frame_threshold;
  1834. uint32_t teardown_notification_ms;
  1835. uint32_t tdls_peer_kickout_threshold;
  1836. } t_wma_tdls_params;
  1837. /**
  1838. * struct wma_tdls_peer_event - TDLS peer event
  1839. * @vdev_id: vdev id
  1840. * @peer_macaddr: peer MAC address
  1841. * @peer_status: TDLS peer status
  1842. * @peer_reason: TDLS peer reason
  1843. */
  1844. typedef struct {
  1845. A_UINT32 vdev_id;
  1846. wmi_mac_addr peer_macaddr;
  1847. A_UINT32 peer_status;
  1848. A_UINT32 peer_reason;
  1849. } wma_tdls_peer_event;
  1850. #endif /* FEATURE_WLAN_TDLS */
  1851. /**
  1852. * enum uapsd_ac - U-APSD Access Categories
  1853. * @UAPSD_BE: best effort
  1854. * @UAPSD_BK: back ground
  1855. * @UAPSD_VI: video
  1856. * @UAPSD_VO: voice
  1857. */
  1858. enum uapsd_ac {
  1859. UAPSD_BE,
  1860. UAPSD_BK,
  1861. UAPSD_VI,
  1862. UAPSD_VO
  1863. };
  1864. QDF_STATUS wma_disable_uapsd_per_ac(tp_wma_handle wma_handle,
  1865. uint32_t vdev_id, enum uapsd_ac ac);
  1866. /**
  1867. * enum uapsd_up - U-APSD User Priorities
  1868. * @UAPSD_UP_BE: best effort
  1869. * @UAPSD_UP_BK: back ground
  1870. * @UAPSD_UP_RESV: reserve
  1871. * @UAPSD_UP_EE: Excellent Effort
  1872. * @UAPSD_UP_CL: Critical Applications
  1873. * @UAPSD_UP_VI: video
  1874. * @UAPSD_UP_VO: voice
  1875. * @UAPSD_UP_NC: Network Control
  1876. */
  1877. enum uapsd_up {
  1878. UAPSD_UP_BE,
  1879. UAPSD_UP_BK,
  1880. UAPSD_UP_RESV,
  1881. UAPSD_UP_EE,
  1882. UAPSD_UP_CL,
  1883. UAPSD_UP_VI,
  1884. UAPSD_UP_VO,
  1885. UAPSD_UP_NC,
  1886. UAPSD_UP_MAX
  1887. };
  1888. /**
  1889. * struct wma_roam_invoke_cmd - roam invoke command
  1890. * @vdev_id: vdev id
  1891. * @bssid: mac address
  1892. * @channel: channel
  1893. * @frame_len: frame length, includs mac header, fixed params and ies
  1894. * @frame_buf: buffer contaning probe response or beacon
  1895. * @is_same_bssid: flag to indicate if roaming is requested for same bssid
  1896. */
  1897. struct wma_roam_invoke_cmd {
  1898. uint32_t vdev_id;
  1899. uint8_t bssid[IEEE80211_ADDR_LEN];
  1900. uint32_t channel;
  1901. uint32_t frame_len;
  1902. uint8_t *frame_buf;
  1903. uint8_t is_same_bssid;
  1904. };
  1905. /**
  1906. * struct wma_process_fw_event_params - fw event parameters
  1907. * @wmi_handle: wmi handle
  1908. * @evt_buf: event buffer
  1909. */
  1910. typedef struct {
  1911. void *wmi_handle;
  1912. void *evt_buf;
  1913. } wma_process_fw_event_params;
  1914. int wma_process_fw_event_handler(void *ctx, void *ev, uint8_t rx_ctx);
  1915. A_UINT32 e_csr_auth_type_to_rsn_authmode(eCsrAuthType authtype,
  1916. eCsrEncryptionType encr);
  1917. A_UINT32 e_csr_encryption_type_to_rsn_cipherset(eCsrEncryptionType encr);
  1918. QDF_STATUS wma_trigger_uapsd_params(tp_wma_handle wma_handle, uint32_t vdev_id,
  1919. tp_wma_trigger_uapsd_params
  1920. trigger_uapsd_params);
  1921. /* added to get average snr for both data and beacon */
  1922. QDF_STATUS wma_send_snr_request(tp_wma_handle wma_handle, void *pGetRssiReq);
  1923. QDF_STATUS wma_update_vdev_tbl(tp_wma_handle wma_handle, uint8_t vdev_id,
  1924. void *tx_rx_vdev_handle,
  1925. uint8_t *mac, uint32_t vdev_type, bool add_del);
  1926. void wma_send_flush_logs_to_fw(tp_wma_handle wma_handle);
  1927. void wma_log_completion_timeout(void *data);
  1928. QDF_STATUS wma_set_rssi_monitoring(tp_wma_handle wma,
  1929. struct rssi_monitor_req *req);
  1930. QDF_STATUS wma_send_pdev_set_pcl_cmd(tp_wma_handle wma_handle,
  1931. struct wmi_pcl_chan_weights *msg);
  1932. QDF_STATUS wma_send_pdev_set_hw_mode_cmd(tp_wma_handle wma_handle,
  1933. struct policy_mgr_hw_mode *msg);
  1934. QDF_STATUS wma_send_pdev_set_dual_mac_config(tp_wma_handle wma_handle,
  1935. struct sir_dual_mac_config *msg);
  1936. QDF_STATUS wma_send_pdev_set_antenna_mode(tp_wma_handle wma_handle,
  1937. struct sir_antenna_mode_param *msg);
  1938. struct wma_target_req *wma_fill_vdev_req(tp_wma_handle wma,
  1939. uint8_t vdev_id,
  1940. uint32_t msg_type, uint8_t type,
  1941. void *params, uint32_t timeout);
  1942. struct wma_target_req *wma_fill_hold_req(tp_wma_handle wma,
  1943. uint8_t vdev_id, uint32_t msg_type,
  1944. uint8_t type, void *params,
  1945. uint32_t timeout);
  1946. QDF_STATUS wma_vdev_start(tp_wma_handle wma,
  1947. struct wma_vdev_start_req *req, bool isRestart);
  1948. void wma_remove_vdev_req(tp_wma_handle wma, uint8_t vdev_id,
  1949. uint8_t type);
  1950. int wma_mgmt_tx_completion_handler(void *handle, uint8_t *cmpl_event_params,
  1951. uint32_t len);
  1952. int wma_mgmt_tx_bundle_completion_handler(void *handle,
  1953. uint8_t *cmpl_event_params, uint32_t len);
  1954. uint32_t wma_get_vht_ch_width(void);
  1955. QDF_STATUS
  1956. wma_config_debug_module_cmd(wmi_unified_t wmi_handle, A_UINT32 param,
  1957. A_UINT32 val, A_UINT32 *module_id_bitmap,
  1958. A_UINT32 bitmap_len);
  1959. #ifdef FEATURE_LFR_SUBNET_DETECTION
  1960. QDF_STATUS wma_set_gateway_params(tp_wma_handle wma,
  1961. struct gateway_param_update_req *req);
  1962. #else
  1963. static inline QDF_STATUS wma_set_gateway_params(tp_wma_handle wma,
  1964. struct gateway_param_update_req *req)
  1965. {
  1966. return QDF_STATUS_SUCCESS;
  1967. }
  1968. #endif /* FEATURE_LFR_SUBNET_DETECTION */
  1969. QDF_STATUS wma_lro_config_cmd(void *handle,
  1970. struct cdp_lro_hash_config *wma_lro_cmd);
  1971. void
  1972. wma_indicate_err(enum ol_rx_err_type err_type,
  1973. struct ol_error_info *err_info);
  1974. /**
  1975. * wma_rx_mic_error_ind() - indicate mic error to the protocol stack
  1976. * @scn_handle: pdev handle from osif layer
  1977. * @vdev_id: vdev id
  1978. * @wh: pointer to ieee80211_frame structure
  1979. *
  1980. * This function indicates TKIP MIC errors encountered in the RX data path
  1981. * to the protocol stack
  1982. *
  1983. * Return: none
  1984. */
  1985. void wma_rx_mic_error_ind(void *scn_handle, uint16_t vdev_id, void *wh);
  1986. QDF_STATUS wma_ht40_stop_obss_scan(tp_wma_handle wma_handle,
  1987. int32_t vdev_id);
  1988. void wma_process_fw_test_cmd(WMA_HANDLE handle,
  1989. struct set_fwtest_params *wma_fwtest);
  1990. QDF_STATUS wma_send_ht40_obss_scanind(tp_wma_handle wma,
  1991. struct obss_ht40_scanind *req);
  1992. int wma_get_bpf_caps_event_handler(void *handle,
  1993. u_int8_t *cmd_param_info,
  1994. u_int32_t len);
  1995. uint32_t wma_get_num_of_setbits_from_bitmask(uint32_t mask);
  1996. QDF_STATUS wma_get_bpf_capabilities(tp_wma_handle wma);
  1997. QDF_STATUS wma_set_bpf_instructions(tp_wma_handle wma,
  1998. struct sir_bpf_set_offload *bpf_set_offload);
  1999. void wma_process_set_pdev_ie_req(tp_wma_handle wma,
  2000. struct set_ie_param *ie_params);
  2001. void wma_process_set_pdev_ht_ie_req(tp_wma_handle wma,
  2002. struct set_ie_param *ie_params);
  2003. void wma_process_set_pdev_vht_ie_req(tp_wma_handle wma,
  2004. struct set_ie_param *ie_params);
  2005. void wma_remove_peer(tp_wma_handle wma, u_int8_t *bssid,
  2006. u_int8_t vdev_id, void *peer,
  2007. bool roam_synch_in_progress);
  2008. QDF_STATUS wma_create_peer(tp_wma_handle wma, struct cdp_pdev *pdev,
  2009. struct cdp_vdev *vdev, u8 peer_addr[6],
  2010. u_int32_t peer_type, u_int8_t vdev_id,
  2011. bool roam_synch_in_progress);
  2012. /**
  2013. * wma_get_cca_stats() - send request to fw to get CCA
  2014. * @wmi_hdl: wma handle
  2015. * @vdev_id: vdev id
  2016. *
  2017. * Return: QDF status
  2018. */
  2019. QDF_STATUS wma_get_cca_stats(tp_wma_handle wma_handle,
  2020. uint8_t vdev_id);
  2021. struct wma_ini_config *wma_get_ini_handle(tp_wma_handle wma_handle);
  2022. WLAN_PHY_MODE wma_chan_phy_mode(u8 chan, enum phy_ch_width chan_width,
  2023. u8 dot11_mode);
  2024. #ifdef FEATURE_OEM_DATA_SUPPORT
  2025. QDF_STATUS wma_start_oem_data_req(tp_wma_handle wma_handle,
  2026. struct oem_data_req *oem_req);
  2027. #endif
  2028. QDF_STATUS wma_enable_disable_caevent_ind(tp_wma_handle wma_handle,
  2029. uint8_t val);
  2030. void wma_register_packetdump_callback(
  2031. tp_wma_packetdump_cb wma_mgmt_tx_packetdump_cb,
  2032. tp_wma_packetdump_cb wma_mgmt_rx_packetdump_cb);
  2033. void wma_deregister_packetdump_callback(void);
  2034. void wma_update_sta_inactivity_timeout(tp_wma_handle wma,
  2035. struct sme_sta_inactivity_timeout *sta_inactivity_timer);
  2036. void wma_peer_set_default_routing(void *scn_handle, uint8_t *peer_macaddr,
  2037. uint8_t vdev_id, bool hash_based, uint8_t ring_num);
  2038. int wma_peer_rx_reorder_queue_setup(void *scn_handle,
  2039. uint8_t vdev_id, uint8_t *peer_macaddr, qdf_dma_addr_t hw_qdesc,
  2040. int tid, uint16_t queue_no);
  2041. int wma_peer_rx_reorder_queue_remove(void *scn_handle,
  2042. uint8_t vdev_id, uint8_t *peer_macaddr, uint32_t peer_tid_bitmap);
  2043. /**
  2044. * wma_form_rx_packet() - form rx cds packet
  2045. * @buf: buffer
  2046. * @mgmt_rx_params: mgmt rx params
  2047. * @rx_pkt: cds packet
  2048. *
  2049. * This functions forms a cds packet from the rx mgmt frame received.
  2050. *
  2051. * Return: 0 for success or error code
  2052. */
  2053. int wma_form_rx_packet(qdf_nbuf_t buf,
  2054. struct mgmt_rx_event_params *mgmt_rx_params,
  2055. cds_pkt_t *rx_pkt);
  2056. /**
  2057. * wma_mgmt_unified_cmd_send() - send the mgmt tx packet
  2058. * @vdev: objmgr vdev
  2059. * @buf: buffer
  2060. * @desc_id: desc id
  2061. * @mgmt_tx_params: mgmt rx params
  2062. *
  2063. * This functions sends mgmt tx packet to WMI layer.
  2064. *
  2065. * Return: 0 for success or error code
  2066. */
  2067. QDF_STATUS wma_mgmt_unified_cmd_send(struct wlan_objmgr_vdev *vdev,
  2068. qdf_nbuf_t buf, uint32_t desc_id,
  2069. void *mgmt_tx_params);
  2070. /**
  2071. * wma_chan_info_event_handler() - chan info event handler
  2072. * @handle: wma handle
  2073. * @event_buf: event handler data
  2074. * @len: length of @event_buf
  2075. *
  2076. * this function will handle the WMI_CHAN_INFO_EVENTID
  2077. *
  2078. * Return: int
  2079. */
  2080. int wma_chan_info_event_handler(void *handle, uint8_t *event_buf,
  2081. uint32_t len);
  2082. /**
  2083. * wma_vdev_set_mlme_state() - Set vdev mlme state
  2084. * @wma: wma handle
  2085. * @vdev_id: the Id of the vdev to configure
  2086. * @state: vdev state
  2087. *
  2088. * Return: None
  2089. */
  2090. static inline
  2091. void wma_vdev_set_mlme_state(tp_wma_handle wma, uint8_t vdev_id,
  2092. enum wlan_vdev_state state)
  2093. {
  2094. struct wlan_objmgr_vdev *vdev;
  2095. if (!wma) {
  2096. WMA_LOGE("%s: WMA context is invald!", __func__);
  2097. return;
  2098. }
  2099. vdev = wlan_objmgr_get_vdev_by_id_from_psoc(wma->psoc, vdev_id,
  2100. WLAN_LEGACY_WMA_ID);
  2101. if (vdev) {
  2102. wlan_vdev_obj_lock(vdev);
  2103. wlan_vdev_mlme_set_state(vdev, state);
  2104. wlan_vdev_obj_unlock(vdev);
  2105. wlan_objmgr_vdev_release_ref(vdev, WLAN_LEGACY_WMA_ID);
  2106. }
  2107. }
  2108. /**
  2109. * wma_update_vdev_pause_bitmap() - update vdev pause bitmap
  2110. * @vdev_id: the Id of the vdev to configure
  2111. * @value: value pause bitmap value
  2112. *
  2113. * Return: None
  2114. */
  2115. static inline
  2116. void wma_vdev_update_pause_bitmap(uint8_t vdev_id, uint16_t value)
  2117. {
  2118. tp_wma_handle wma = (tp_wma_handle)cds_get_context(QDF_MODULE_ID_WMA);
  2119. struct wma_txrx_node *iface;
  2120. if (!wma) {
  2121. WMA_LOGE("%s: WMA context is invald!", __func__);
  2122. return;
  2123. }
  2124. if (vdev_id >= wma->max_bssid) {
  2125. WMA_LOGE("%s: Invalid vdev_id: %d", __func__, vdev_id);
  2126. return;
  2127. }
  2128. iface = &wma->interfaces[vdev_id];
  2129. if (!iface) {
  2130. WMA_LOGE("%s: Failed to get iface: NULL",
  2131. __func__);
  2132. return;
  2133. }
  2134. if (!iface->handle) {
  2135. WMA_LOGE("%s: Failed to get iface handle: NULL",
  2136. __func__);
  2137. return;
  2138. }
  2139. iface->pause_bitmap = value;
  2140. }
  2141. /**
  2142. * wma_vdev_get_pause_bitmap() - Get vdev pause bitmap
  2143. * @vdev_id: the Id of the vdev to configure
  2144. *
  2145. * Return: Vdev pause bitmap value else 0 on error
  2146. */
  2147. static inline
  2148. uint16_t wma_vdev_get_pause_bitmap(uint8_t vdev_id)
  2149. {
  2150. tp_wma_handle wma = (tp_wma_handle)cds_get_context(QDF_MODULE_ID_WMA);
  2151. struct wma_txrx_node *iface;
  2152. if (!wma) {
  2153. WMA_LOGE("%s: WMA context is invald!", __func__);
  2154. return 0;
  2155. }
  2156. iface = &wma->interfaces[vdev_id];
  2157. if (!iface) {
  2158. WMA_LOGE("%s: Failed to get iface: NULL",
  2159. __func__);
  2160. return 0;
  2161. }
  2162. if (!iface->handle) {
  2163. WMA_LOGE("%s: Failed to get iface handle: NULL",
  2164. __func__);
  2165. return 0;
  2166. }
  2167. return iface->pause_bitmap;
  2168. }
  2169. /**
  2170. * wma_vdev_is_device_in_low_pwr_mode - is device in power save mode
  2171. * @vdev_id: the Id of the vdev to configure
  2172. *
  2173. * Return: true if device is in low power mode else false
  2174. */
  2175. static inline bool wma_vdev_is_device_in_low_pwr_mode(uint8_t vdev_id)
  2176. {
  2177. tp_wma_handle wma = (tp_wma_handle)cds_get_context(QDF_MODULE_ID_WMA);
  2178. struct wma_txrx_node *iface;
  2179. if (!wma) {
  2180. WMA_LOGE("%s: WMA context is invald!", __func__);
  2181. return 0;
  2182. }
  2183. iface = &wma->interfaces[vdev_id];
  2184. if (!iface) {
  2185. WMA_LOGE("%s: Failed to get iface: NULL",
  2186. __func__);
  2187. return 0;
  2188. }
  2189. if (!iface->handle) {
  2190. WMA_LOGE("%s: Failed to get iface handle:NULL",
  2191. __func__);
  2192. return 0;
  2193. }
  2194. return iface->in_bmps || wma->in_imps;
  2195. }
  2196. /**
  2197. * wma_vdev_set_pause_bit() - Set a bit in vdev pause bitmap
  2198. * @vdev_id: the Id of the vdev to configure
  2199. * @bit_pos: set bit position in pause bitmap
  2200. *
  2201. * Return: None
  2202. */
  2203. static inline
  2204. void wma_vdev_set_pause_bit(uint8_t vdev_id, wmi_tx_pause_type bit_pos)
  2205. {
  2206. tp_wma_handle wma = (tp_wma_handle)cds_get_context(QDF_MODULE_ID_WMA);
  2207. struct wma_txrx_node *iface;
  2208. if (!wma) {
  2209. WMA_LOGE("%s: WMA context is invald!", __func__);
  2210. return;
  2211. }
  2212. iface = &wma->interfaces[vdev_id];
  2213. if (!iface) {
  2214. WMA_LOGE("%s: Failed to get iface: NULL",
  2215. __func__);
  2216. return;
  2217. }
  2218. if (!iface->handle) {
  2219. WMA_LOGE("%s: Failed to get iface handle: NULL",
  2220. __func__);
  2221. return;
  2222. }
  2223. iface->pause_bitmap |= (1 << bit_pos);
  2224. }
  2225. /**
  2226. * wma_vdev_clear_pause_bit() - Clear a bit from vdev pause bitmap
  2227. * @vdev_id: the Id of the vdev to configure
  2228. * @bit_pos: set bit position in pause bitmap
  2229. *
  2230. * Return: None
  2231. */
  2232. static inline
  2233. void wma_vdev_clear_pause_bit(uint8_t vdev_id, wmi_tx_pause_type bit_pos)
  2234. {
  2235. tp_wma_handle wma = (tp_wma_handle)cds_get_context(QDF_MODULE_ID_WMA);
  2236. struct wma_txrx_node *iface;
  2237. if (!wma) {
  2238. WMA_LOGE("%s: WMA context is invald!", __func__);
  2239. return;
  2240. }
  2241. iface = &wma->interfaces[vdev_id];
  2242. if (!iface) {
  2243. WMA_LOGE("%s: Failed to get iface: NULL",
  2244. __func__);
  2245. return;
  2246. }
  2247. if (!iface->handle) {
  2248. WMA_LOGE("%s: Failed to get iface handle: NULL",
  2249. __func__);
  2250. return;
  2251. }
  2252. iface->pause_bitmap &= ~(1 << bit_pos);
  2253. }
  2254. /**
  2255. * chanmode_to_chanwidth() - get channel width through channel mode
  2256. * @chanmode: channel phy mode
  2257. *
  2258. * Return: channel width
  2259. */
  2260. wmi_channel_width chanmode_to_chanwidth(WLAN_PHY_MODE chanmode);
  2261. /**
  2262. * wma_process_roaming_config() - process roam request
  2263. * @wma_handle: wma handle
  2264. * @roam_req: roam request parameters
  2265. *
  2266. * Main routine to handle ROAM commands coming from CSR module.
  2267. *
  2268. * Return: QDF status
  2269. */
  2270. QDF_STATUS wma_process_roaming_config(tp_wma_handle wma_handle,
  2271. tSirRoamOffloadScanReq *roam_req);
  2272. #ifdef WMI_INTERFACE_EVENT_LOGGING
  2273. static inline void wma_print_wmi_cmd_log(uint32_t count,
  2274. qdf_abstract_print *print,
  2275. void *print_priv)
  2276. {
  2277. t_wma_handle *wma = cds_get_context(QDF_MODULE_ID_WMA);
  2278. if (wma) {
  2279. print(print_priv, "Command Log (count %u)", count);
  2280. wmi_print_cmd_log(wma->wmi_handle, count, print, print_priv);
  2281. }
  2282. }
  2283. static inline void wma_print_wmi_cmd_tx_cmp_log(uint32_t count,
  2284. qdf_abstract_print *print,
  2285. void *print_priv)
  2286. {
  2287. t_wma_handle *wma = cds_get_context(QDF_MODULE_ID_WMA);
  2288. if (wma) {
  2289. print(print_priv, "Command Tx Complete Log (count %u)", count);
  2290. wmi_print_cmd_tx_cmp_log(wma->wmi_handle, count, print,
  2291. print_priv);
  2292. }
  2293. }
  2294. static inline void wma_print_wmi_mgmt_cmd_log(uint32_t count,
  2295. qdf_abstract_print *print,
  2296. void *print_priv)
  2297. {
  2298. t_wma_handle *wma = cds_get_context(QDF_MODULE_ID_WMA);
  2299. if (wma) {
  2300. print(print_priv, "Management Command Log (count %u)", count);
  2301. wmi_print_mgmt_cmd_log(wma->wmi_handle, count, print,
  2302. print_priv);
  2303. }
  2304. }
  2305. static inline void wma_print_wmi_mgmt_cmd_tx_cmp_log(uint32_t count,
  2306. qdf_abstract_print *print,
  2307. void *print_priv)
  2308. {
  2309. t_wma_handle *wma = cds_get_context(QDF_MODULE_ID_WMA);
  2310. if (wma) {
  2311. print(print_priv,
  2312. "Management Command Tx Complete Log (count %u)", count);
  2313. wmi_print_mgmt_cmd_tx_cmp_log(wma->wmi_handle, count, print,
  2314. print_priv);
  2315. }
  2316. }
  2317. static inline void wma_print_wmi_event_log(uint32_t count,
  2318. qdf_abstract_print *print,
  2319. void *print_priv)
  2320. {
  2321. t_wma_handle *wma = cds_get_context(QDF_MODULE_ID_WMA);
  2322. if (wma) {
  2323. print(print_priv, "Event Log (count %u)", count);
  2324. wmi_print_event_log(wma->wmi_handle, count, print, print_priv);
  2325. }
  2326. }
  2327. static inline void wma_print_wmi_rx_event_log(uint32_t count,
  2328. qdf_abstract_print *print,
  2329. void *print_priv)
  2330. {
  2331. t_wma_handle *wma = cds_get_context(QDF_MODULE_ID_WMA);
  2332. if (wma) {
  2333. print(print_priv, "Rx Event Log (count %u)", count);
  2334. wmi_print_rx_event_log(wma->wmi_handle, count, print,
  2335. print_priv);
  2336. }
  2337. }
  2338. static inline void wma_print_wmi_mgmt_event_log(uint32_t count,
  2339. qdf_abstract_print *print,
  2340. void *print_priv)
  2341. {
  2342. t_wma_handle *wma = cds_get_context(QDF_MODULE_ID_WMA);
  2343. if (wma) {
  2344. print(print_priv, "Management Event Log (count %u)", count);
  2345. wmi_print_mgmt_event_log(wma->wmi_handle, count, print,
  2346. print_priv);
  2347. }
  2348. }
  2349. #else
  2350. static inline void wma_print_wmi_cmd_log(uint32_t count,
  2351. qdf_abstract_print *print,
  2352. void *print_priv)
  2353. {
  2354. }
  2355. static inline void wma_print_wmi_cmd_tx_cmp_log(uint32_t count,
  2356. qdf_abstract_print *print,
  2357. void *print_priv)
  2358. {
  2359. }
  2360. static inline void wma_print_wmi_mgmt_cmd_log(uint32_t count,
  2361. qdf_abstract_print *print,
  2362. void *print_priv)
  2363. {
  2364. }
  2365. static inline void wma_print_wmi_mgmt_cmd_tx_cmp_log(uint32_t count,
  2366. qdf_abstract_print *print,
  2367. void *print_priv)
  2368. {
  2369. }
  2370. static inline void wma_print_wmi_event_log(uint32_t count,
  2371. qdf_abstract_print *print,
  2372. void *print_priv)
  2373. {
  2374. }
  2375. static inline void wma_print_wmi_rx_event_log(uint32_t count,
  2376. qdf_abstract_print *print,
  2377. void *print_priv)
  2378. {
  2379. }
  2380. static inline void wma_print_wmi_mgmt_event_log(uint32_t count,
  2381. qdf_abstract_print *print,
  2382. void *print_priv)
  2383. {
  2384. }
  2385. #endif /* WMI_INTERFACE_EVENT_LOGGING */
  2386. /**
  2387. * wma_ipa_uc_stat_request() - set ipa config parameters
  2388. * @privcmd: private command
  2389. *
  2390. * Return: None
  2391. */
  2392. void wma_ipa_uc_stat_request(wma_cli_set_cmd_t *privcmd);
  2393. /**
  2394. * wma_set_rx_reorder_timeout_val() - set rx recorder timeout value
  2395. * @wma_handle: pointer to wma handle
  2396. * @reorder_timeout: rx reorder timeout value
  2397. *
  2398. * Return: VOS_STATUS_SUCCESS for success or error code.
  2399. */
  2400. QDF_STATUS wma_set_rx_reorder_timeout_val(tp_wma_handle wma_handle,
  2401. struct sir_set_rx_reorder_timeout_val *reorder_timeout);
  2402. /**
  2403. * wma_set_rx_blocksize() - set rx blocksize
  2404. * @wma_handle: pointer to wma handle
  2405. * @peer_rx_blocksize: rx blocksize for peer mac
  2406. *
  2407. * Return: QDF_STATUS_SUCCESS for success or error code.
  2408. */
  2409. QDF_STATUS wma_set_rx_blocksize(tp_wma_handle wma_handle,
  2410. struct sir_peer_set_rx_blocksize *peer_rx_blocksize);
  2411. /**
  2412. * wma_configure_smps_params() - Configures the smps parameters to set
  2413. * @vdev_id: Virtual device for the command
  2414. * @param_id: SMPS parameter ID
  2415. * @param_val: Value to be set for the parameter
  2416. * Return: QDF_STATUS_SUCCESS or non-zero on failure
  2417. */
  2418. QDF_STATUS wma_configure_smps_params(uint32_t vdev_id, uint32_t param_id,
  2419. uint32_t param_val);
  2420. /*
  2421. * wma_chip_power_save_failure_detected_handler() - chip pwr save fail detected
  2422. * event handler
  2423. * @handle: wma handle
  2424. * @cmd_param_info: event handler data
  2425. * @len: length of @cmd_param_info
  2426. *
  2427. * Return: QDF_STATUS_SUCCESS on success; error code otherwise
  2428. */
  2429. int wma_chip_power_save_failure_detected_handler(void *handle,
  2430. uint8_t *cmd_param_info,
  2431. uint32_t len);
  2432. /**
  2433. * wma_get_chain_rssi() - send wmi cmd to get chain rssi
  2434. * @wma_handle: wma handler
  2435. * @req_params: requset params
  2436. *
  2437. * Return: Return QDF_STATUS
  2438. */
  2439. QDF_STATUS wma_get_chain_rssi(tp_wma_handle wma_handle,
  2440. struct get_chain_rssi_req_params *req_params);
  2441. /**
  2442. * wma_config_bmiss_bcnt_params() - set bmiss config parameters
  2443. * @vdev_id: virtual device for the command
  2444. * @first_cnt: bmiss first value
  2445. * @final_cnt: bmiss final value
  2446. *
  2447. * Return: QDF_STATUS_SUCCESS or non-zero on failure
  2448. */
  2449. QDF_STATUS wma_config_bmiss_bcnt_params(uint32_t vdev_id, uint32_t first_cnt,
  2450. uint32_t final_cnt);
  2451. /**
  2452. * wma_check_and_set_wake_timer(): checks all interfaces and if any interface
  2453. * has install_key pending, sets timer pattern in fw to wake up host after
  2454. * specified time has elapsed.
  2455. * @time: time after which host wants to be awaken.
  2456. *
  2457. * Return: None
  2458. */
  2459. void wma_check_and_set_wake_timer(uint32_t time);
  2460. /**
  2461. * wma_vdev_wait_for_peer_delete_completion() - wait for all peers of the vdev
  2462. * to be deleted.
  2463. * @wma_handle: wma handle
  2464. * @vdev_id: vdev id
  2465. *
  2466. * Return: None
  2467. */
  2468. void wma_vdev_wait_for_peer_delete_completion(tp_wma_handle wma_handle,
  2469. uint8_t vdev_id);
  2470. #endif