wma.h 86 KB

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