wma.h 87 KB

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