wma.h 79 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717
  1. /*
  2. * Copyright (c) 2013-2021 The Linux Foundation. All rights reserved.
  3. * Copyright (c) 2021-2024 Qualcomm Innovation Center, Inc. All rights reserved.
  4. *
  5. * Permission to use, copy, modify, and/or distribute this software for
  6. * any purpose with or without fee is hereby granted, provided that the
  7. * above copyright notice and this permission notice appear in all
  8. * copies.
  9. *
  10. * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
  11. * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
  12. * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
  13. * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
  14. * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
  15. * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
  16. * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  17. * PERFORMANCE OF THIS SOFTWARE.
  18. */
  19. #ifndef WMA_H
  20. #define WMA_H
  21. #include "a_types.h"
  22. #include "qdf_types.h"
  23. #include "osapi_linux.h"
  24. #include "htc_packet.h"
  25. #include "i_qdf_event.h"
  26. #include "wmi_services.h"
  27. #include "wmi_unified.h"
  28. #include "wmi_version.h"
  29. #include "qdf_types.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. #include "wma_api.h"
  46. #include "wmi_unified_param.h"
  47. #include "wmi.h"
  48. #include "wlan_cm_roam_public_struct.h"
  49. #include "target_if.h"
  50. #include <qdf_hang_event_notifier.h>
  51. /* Platform specific configuration for max. no. of fragments */
  52. #define QCA_OL_11AC_TX_MAX_FRAGS 2
  53. /* Private */
  54. #define WMA_READY_EVENTID_TIMEOUT 6000
  55. #define WMA_SERVICE_READY_EXT_TIMEOUT 6000
  56. #define NAN_CLUSTER_ID_BYTES 4
  57. #define WMA_CRASH_INJECT_TIMEOUT 5000
  58. /* MAC ID to PDEV ID mapping is as given below
  59. * MAC_ID PDEV_ID
  60. * 0 1
  61. * 1 2
  62. * SOC Level WMI_PDEV_ID_SOC
  63. */
  64. #define WMA_MAC_TO_PDEV_MAP(x) ((x) + (1))
  65. #define WMA_PDEV_TO_MAC_MAP(x) ((x) - (1))
  66. #define MAX_PRINT_FAILURE_CNT 50
  67. #define WMA_INVALID_VDEV_ID 0xFF
  68. #define wma_alert(params...) QDF_TRACE_FATAL(QDF_MODULE_ID_WMA, params)
  69. #define wma_err(params...) QDF_TRACE_ERROR(QDF_MODULE_ID_WMA, params)
  70. #define wma_warn(params...) QDF_TRACE_WARN(QDF_MODULE_ID_WMA, params)
  71. #define wma_info(params...) QDF_TRACE_INFO(QDF_MODULE_ID_WMA, params)
  72. #define wma_debug(params...) QDF_TRACE_DEBUG(QDF_MODULE_ID_WMA, params)
  73. #define wma_debug_rl(params...) QDF_TRACE_DEBUG_RL(QDF_MODULE_ID_WMA, params)
  74. #define wma_err_rl(params...) QDF_TRACE_ERROR_RL(QDF_MODULE_ID_WMA, params)
  75. #define wma_nofl_alert(params...) \
  76. QDF_TRACE_FATAL_NO_FL(QDF_MODULE_ID_WMA, params)
  77. #define wma_nofl_err(params...) \
  78. QDF_TRACE_ERROR_NO_FL(QDF_MODULE_ID_WMA, params)
  79. #define wma_nofl_warn(params...) \
  80. QDF_TRACE_WARN_NO_FL(QDF_MODULE_ID_WMA, params)
  81. #define wma_nofl_info(params...) \
  82. QDF_TRACE_INFO_NO_FL(QDF_MODULE_ID_WMA, params)
  83. #define wma_nofl_debug(params...) \
  84. QDF_TRACE_DEBUG_NO_FL(QDF_MODULE_ID_WMA, params)
  85. #define wma_conditional_log(is_console_log_enabled, params...) \
  86. do { \
  87. if (is_console_log_enabled) \
  88. wma_info(params); \
  89. else \
  90. wma_debug(params); \
  91. } while(0); \
  92. #define WMA_WILDCARD_PDEV_ID 0x0
  93. #define WMA_HW_DEF_SCAN_MAX_DURATION 30000 /* 30 secs */
  94. #define WMA_EAPOL_SUBTYPE_GET_MIN_LEN 21
  95. #define WMA_EAPOL_INFO_GET_MIN_LEN 23
  96. #define WMA_IS_DHCP_GET_MIN_LEN 38
  97. #define WMA_DHCP_SUBTYPE_GET_MIN_LEN 0x11D
  98. #define WMA_DHCP_INFO_GET_MIN_LEN 50
  99. #define WMA_ARP_SUBTYPE_GET_MIN_LEN 22
  100. #define WMA_IPV4_PROTO_GET_MIN_LEN 24
  101. #define WMA_IPV4_PKT_INFO_GET_MIN_LEN 42
  102. #define WMA_ICMP_SUBTYPE_GET_MIN_LEN 35
  103. #define WMA_IPV6_PROTO_GET_MIN_LEN 21
  104. #define WMA_IPV6_PKT_INFO_GET_MIN_LEN 62
  105. #define WMA_ICMPV6_SUBTYPE_GET_MIN_LEN 55
  106. /* Beacon tx rate */
  107. #define WMA_BEACON_TX_RATE_1_M 10
  108. #define WMA_BEACON_TX_RATE_2_M 20
  109. #define WMA_BEACON_TX_RATE_5_5_M 55
  110. #define WMA_BEACON_TX_RATE_11_M 110
  111. #define WMA_BEACON_TX_RATE_6_M 60
  112. #define WMA_BEACON_TX_RATE_9_M 90
  113. #define WMA_BEACON_TX_RATE_12_M 120
  114. #define WMA_BEACON_TX_RATE_18_M 180
  115. #define WMA_BEACON_TX_RATE_24_M 240
  116. #define WMA_BEACON_TX_RATE_36_M 360
  117. #define WMA_BEACON_TX_RATE_48_M 480
  118. #define WMA_BEACON_TX_RATE_54_M 540
  119. /* Roaming default values
  120. * All time and period values are in milliseconds.
  121. * All rssi values are in dB except for WMA_NOISE_FLOOR_DBM_DEFAULT.
  122. */
  123. #define WMA_ROAM_SCAN_CHANNEL_SWITCH_TIME (4)
  124. #define WMA_NOISE_FLOOR_DBM_DEFAULT (-96)
  125. #define WMA_RSSI_MIN_VALUE (-128)
  126. #define WMA_RSSI_MAX_VALUE (127)
  127. #define WMA_ROAM_RSSI_DIFF_DEFAULT (5)
  128. #define WMA_ROAM_DWELL_TIME_ACTIVE_DEFAULT (100)
  129. #define WMA_ROAM_DWELL_TIME_PASSIVE_DEFAULT (110)
  130. #define WMA_ROAM_MIN_REST_TIME_DEFAULT (50)
  131. #define WMA_ROAM_MAX_REST_TIME_DEFAULT (500)
  132. #define WMA_INVALID_KEY_IDX 0xff
  133. #define WMA_MAX_RF_CHAINS(x) ((1 << x) - 1)
  134. #define WMA_MIN_RF_CHAINS (1)
  135. #define WMA_MAX_NSS (2)
  136. #define WMA_NOA_IE_SIZE(num_desc) (2 + (13 * (num_desc)))
  137. #define WMA_MAX_NOA_DESCRIPTORS 4
  138. #define WMA_TIM_SUPPORTED_PVB_LENGTH ((HAL_NUM_STA / 8) + 1)
  139. #define WMA_BSS_STATUS_STARTED 0x1
  140. #define WMA_BSS_STATUS_STOPPED 0x2
  141. #define WMA_PEER_ASSOC_CNF_START 0x01
  142. #define WMA_PEER_ASSOC_TIMEOUT SIR_PEER_ASSOC_TIMEOUT
  143. #define WMA_DELETE_STA_RSP_START 0x02
  144. #define WMA_DELETE_STA_TIMEOUT SIR_DELETE_STA_TIMEOUT
  145. #define WMA_DEL_P2P_SELF_STA_RSP_START 0x03
  146. #define WMA_SET_LINK_PEER_RSP 0x04
  147. #define WMA_DELETE_PEER_RSP 0x05
  148. #define WMA_PDEV_SET_HW_MODE_RESP 0x06
  149. #define WMA_PDEV_MAC_CFG_RESP 0x07
  150. #define WMA_PEER_CREATE_RESPONSE 0x08
  151. #define WMA_PEER_CREATE_RESPONSE_TIMEOUT SIR_PEER_CREATE_RESPONSE_TIMEOUT
  152. /* send connect respone after bss peer is deleted */
  153. #define WMA_DELETE_STA_CONNECT_RSP 0x09
  154. /* Peer create response for 11az PASN peer */
  155. #define WMA_PASN_PEER_CREATE_RESPONSE 0x0a
  156. #define WMA_PASN_PEER_DELETE_RESPONSE 0x0b
  157. #define WMA_PEER_DELETE_RESPONSE_TIMEOUT SIR_DELETE_STA_TIMEOUT
  158. /* FW response timeout values in milli seconds */
  159. #define WMA_VDEV_PLCY_MGR_TIMEOUT SIR_VDEV_PLCY_MGR_TIMEOUT
  160. #define WMA_VDEV_HW_MODE_REQUEST_TIMEOUT WMA_VDEV_PLCY_MGR_TIMEOUT
  161. #define WMA_VDEV_DUAL_MAC_CFG_TIMEOUT WMA_VDEV_PLCY_MGR_TIMEOUT
  162. #define WMA_VDEV_PLCY_MGR_WAKE_LOCK_TIMEOUT \
  163. (WMA_VDEV_PLCY_MGR_TIMEOUT + 500)
  164. #define WMA_VDEV_SET_KEY_WAKELOCK_TIMEOUT WAKELOCK_DURATION_RECOMMENDED
  165. #define WMA_TX_Q_RECHECK_TIMER_WAIT 2 /* 2 ms */
  166. #define WMA_SMPS_PARAM_VALUE_S 29
  167. /*
  168. * Setting the Tx Comp Timeout to 1 secs.
  169. * TODO: Need to Revist the Timing
  170. */
  171. #define WMA_TX_FRAME_COMPLETE_TIMEOUT 1000
  172. #define WMA_TX_FRAME_BUFFER_NO_FREE 0
  173. #define WMA_TX_FRAME_BUFFER_FREE 1
  174. /*
  175. * TODO: Add WMI_CMD_ID_MAX as part of WMI_CMD_ID
  176. * instead of assigning it to the last valid wmi
  177. * cmd+1 to avoid updating this when a command is
  178. * added/deleted.
  179. */
  180. #define WMI_CMDID_MAX (WMI_TXBF_CMDID + 1)
  181. #define WMA_NLO_FREQ_THRESH 1000 /* in MHz */
  182. #define WMA_MSEC_TO_USEC(msec) (msec * 1000) /* msec to usec */
  183. #define WMA_AUTH_REQ_RECV_WAKE_LOCK_TIMEOUT WAKELOCK_DURATION_RECOMMENDED
  184. #define WMA_ASSOC_REQ_RECV_WAKE_LOCK_DURATION WAKELOCK_DURATION_RECOMMENDED
  185. #define WMA_DEAUTH_RECV_WAKE_LOCK_DURATION WAKELOCK_DURATION_RECOMMENDED
  186. #define WMA_DISASSOC_RECV_WAKE_LOCK_DURATION WAKELOCK_DURATION_RECOMMENDED
  187. #define WMA_ROAM_HO_WAKE_LOCK_DURATION (500) /* in msec */
  188. #define WMA_ROAM_PREAUTH_WAKE_LOCK_DURATION (2 * 1000)
  189. #define WMA_REASON_PROBE_REQ_WPS_IE_RECV_DURATION (3 * 1000)
  190. #ifdef FEATURE_WLAN_AUTO_SHUTDOWN
  191. #define WMA_AUTO_SHUTDOWN_WAKE_LOCK_DURATION WAKELOCK_DURATION_RECOMMENDED
  192. #endif
  193. #define WMA_BMISS_EVENT_WAKE_LOCK_DURATION WAKELOCK_DURATION_RECOMMENDED
  194. #define WMA_FW_RSP_EVENT_WAKE_LOCK_DURATION WAKELOCK_DURATION_MAX
  195. #define WMA_TXMIC_LEN 8
  196. #define WMA_RXMIC_LEN 8
  197. #define WMA_IV_KEY_LEN 16
  198. /*
  199. * Length = (2 octets for Index and CTWin/Opp PS) and
  200. * (13 octets for each NOA Descriptors)
  201. */
  202. #define WMA_P2P_NOA_IE_OPP_PS_SET (0x80)
  203. #define WMA_P2P_NOA_IE_CTWIN_MASK (0x7F)
  204. #define WMA_P2P_IE_ID 0xdd
  205. #define WMA_P2P_WFA_OUI { 0x50, 0x6f, 0x9a }
  206. #define WMA_P2P_WFA_VER 0x09 /* ver 1.0 */
  207. /* P2P Sub element definitions (according to table 5 of Wifi's P2P spec) */
  208. #define WMA_P2P_SUB_ELEMENT_STATUS 0
  209. #define WMA_P2P_SUB_ELEMENT_MINOR_REASON 1
  210. #define WMA_P2P_SUB_ELEMENT_CAPABILITY 2
  211. #define WMA_P2P_SUB_ELEMENT_DEVICE_ID 3
  212. #define WMA_P2P_SUB_ELEMENT_GO_INTENT 4
  213. #define WMA_P2P_SUB_ELEMENT_CONFIGURATION_TIMEOUT 5
  214. #define WMA_P2P_SUB_ELEMENT_LISTEN_CHANNEL 6
  215. #define WMA_P2P_SUB_ELEMENT_GROUP_BSSID 7
  216. #define WMA_P2P_SUB_ELEMENT_EXTENDED_LISTEN_TIMING 8
  217. #define WMA_P2P_SUB_ELEMENT_INTENDED_INTERFACE_ADDR 9
  218. #define WMA_P2P_SUB_ELEMENT_MANAGEABILITY 10
  219. #define WMA_P2P_SUB_ELEMENT_CHANNEL_LIST 11
  220. #define WMA_P2P_SUB_ELEMENT_NOA 12
  221. #define WMA_P2P_SUB_ELEMENT_DEVICE_INFO 13
  222. #define WMA_P2P_SUB_ELEMENT_GROUP_INFO 14
  223. #define WMA_P2P_SUB_ELEMENT_GROUP_ID 15
  224. #define WMA_P2P_SUB_ELEMENT_INTERFACE 16
  225. #define WMA_P2P_SUB_ELEMENT_OP_CHANNEL 17
  226. #define WMA_P2P_SUB_ELEMENT_INVITATION_FLAGS 18
  227. #define WMA_P2P_SUB_ELEMENT_VENDOR 221
  228. /* Macros for handling unaligned memory accesses */
  229. #define P2PIE_PUT_LE16(a, val) \
  230. do { \
  231. (a)[1] = ((uint16_t) (val)) >> 8; \
  232. (a)[0] = ((uint16_t) (val)) & 0xff; \
  233. } while (0)
  234. #define P2PIE_PUT_LE32(a, val) \
  235. do { \
  236. (a)[3] = (uint8_t) ((((uint32_t) (val)) >> 24) & 0xff); \
  237. (a)[2] = (uint8_t) ((((uint32_t) (val)) >> 16) & 0xff); \
  238. (a)[1] = (uint8_t) ((((uint32_t) (val)) >> 8) & 0xff); \
  239. (a)[0] = (uint8_t) (((uint32_t) (val)) & 0xff); \
  240. } while (0)
  241. #define WMA_DEFAULT_MAX_PSPOLL_BEFORE_WAKE 1
  242. #define WMA_VHT_PPS_PAID_MATCH 1
  243. #define WMA_VHT_PPS_GID_MATCH 2
  244. #define WMA_VHT_PPS_DELIM_CRC_FAIL 3
  245. #define WMA_DEFAULT_HW_MODE_INDEX 0xFFFF
  246. #define TWO_THIRD (2/3)
  247. #ifdef WLAN_FEATURE_SON
  248. #define WMA_SON_MAX_PEER_EXT_STATS 16
  249. #else
  250. #define WMA_SON_MAX_PEER_EXT_STATS 0
  251. #endif
  252. /**
  253. * WMA hardware mode list bit-mask definitions.
  254. * Bits 4:0, 31:29 are unused.
  255. *
  256. * The below definitions are added corresponding to WMI DBS HW mode
  257. * list to make it independent of firmware changes for WMI definitions.
  258. * Currently these definitions have dependency with BIT positions of
  259. * the existing WMI macros. Thus, if the BIT positions are changed for
  260. * WMI macros, then these macros' BIT definitions are also need to be
  261. * changed.
  262. */
  263. #define WMA_HW_MODE_MAC0_TX_STREAMS_BITPOS (28)
  264. #define WMA_HW_MODE_MAC0_RX_STREAMS_BITPOS (24)
  265. #define WMA_HW_MODE_MAC1_TX_STREAMS_BITPOS (20)
  266. #define WMA_HW_MODE_MAC1_RX_STREAMS_BITPOS (16)
  267. #define WMA_HW_MODE_MAC0_BANDWIDTH_BITPOS (12)
  268. #define WMA_HW_MODE_MAC1_BANDWIDTH_BITPOS (8)
  269. #define WMA_HW_MODE_DBS_MODE_BITPOS (7)
  270. #define WMA_HW_MODE_AGILE_DFS_MODE_BITPOS (6)
  271. #define WMA_HW_MODE_SBS_MODE_BITPOS (5)
  272. #define WMA_HW_MODE_MAC0_TX_STREAMS_MASK \
  273. (0xf << WMA_HW_MODE_MAC0_TX_STREAMS_BITPOS)
  274. #define WMA_HW_MODE_MAC0_RX_STREAMS_MASK \
  275. (0xf << WMA_HW_MODE_MAC0_RX_STREAMS_BITPOS)
  276. #define WMA_HW_MODE_MAC1_TX_STREAMS_MASK \
  277. (0xf << WMA_HW_MODE_MAC1_TX_STREAMS_BITPOS)
  278. #define WMA_HW_MODE_MAC1_RX_STREAMS_MASK \
  279. (0xf << WMA_HW_MODE_MAC1_RX_STREAMS_BITPOS)
  280. #define WMA_HW_MODE_MAC0_BANDWIDTH_MASK \
  281. (0xf << WMA_HW_MODE_MAC0_BANDWIDTH_BITPOS)
  282. #define WMA_HW_MODE_MAC1_BANDWIDTH_MASK \
  283. (0xf << WMA_HW_MODE_MAC1_BANDWIDTH_BITPOS)
  284. #define WMA_HW_MODE_DBS_MODE_MASK \
  285. (0x1 << WMA_HW_MODE_DBS_MODE_BITPOS)
  286. #define WMA_HW_MODE_AGILE_DFS_MODE_MASK \
  287. (0x1 << WMA_HW_MODE_AGILE_DFS_MODE_BITPOS)
  288. #define WMA_HW_MODE_SBS_MODE_MASK \
  289. (0x1 << WMA_HW_MODE_SBS_MODE_BITPOS)
  290. #define WMA_HW_MODE_MAC0_TX_STREAMS_SET(hw_mode, value) \
  291. WMI_SET_BITS(hw_mode, WMA_HW_MODE_MAC0_TX_STREAMS_BITPOS, 4, value)
  292. #define WMA_HW_MODE_MAC0_RX_STREAMS_SET(hw_mode, value) \
  293. WMI_SET_BITS(hw_mode, WMA_HW_MODE_MAC0_RX_STREAMS_BITPOS, 4, value)
  294. #define WMA_HW_MODE_MAC1_TX_STREAMS_SET(hw_mode, value) \
  295. WMI_SET_BITS(hw_mode, WMA_HW_MODE_MAC1_TX_STREAMS_BITPOS, 4, value)
  296. #define WMA_HW_MODE_MAC1_RX_STREAMS_SET(hw_mode, value) \
  297. WMI_SET_BITS(hw_mode, WMA_HW_MODE_MAC1_RX_STREAMS_BITPOS, 4, value)
  298. #define WMA_HW_MODE_MAC0_BANDWIDTH_SET(hw_mode, value) \
  299. WMI_SET_BITS(hw_mode, WMA_HW_MODE_MAC0_BANDWIDTH_BITPOS, 4, value)
  300. #define WMA_HW_MODE_MAC1_BANDWIDTH_SET(hw_mode, value) \
  301. WMI_SET_BITS(hw_mode, WMA_HW_MODE_MAC1_BANDWIDTH_BITPOS, 4, value)
  302. #define WMA_HW_MODE_DBS_MODE_SET(hw_mode, value) \
  303. WMI_SET_BITS(hw_mode, WMA_HW_MODE_DBS_MODE_BITPOS, 1, value)
  304. #define WMA_HW_MODE_AGILE_DFS_SET(hw_mode, value) \
  305. WMI_SET_BITS(hw_mode, WMA_HW_MODE_AGILE_DFS_MODE_BITPOS, 1, value)
  306. #define WMA_HW_MODE_SBS_MODE_SET(hw_mode, value) \
  307. WMI_SET_BITS(hw_mode, WMA_HW_MODE_SBS_MODE_BITPOS, 1, value)
  308. #define WMA_HW_MODE_MAC0_TX_STREAMS_GET(hw_mode) \
  309. ((hw_mode & WMA_HW_MODE_MAC0_TX_STREAMS_MASK) >> \
  310. WMA_HW_MODE_MAC0_TX_STREAMS_BITPOS)
  311. #define WMA_HW_MODE_MAC0_RX_STREAMS_GET(hw_mode) \
  312. ((hw_mode & WMA_HW_MODE_MAC0_RX_STREAMS_MASK) >> \
  313. WMA_HW_MODE_MAC0_RX_STREAMS_BITPOS)
  314. #define WMA_HW_MODE_MAC1_TX_STREAMS_GET(hw_mode) \
  315. ((hw_mode & WMA_HW_MODE_MAC1_TX_STREAMS_MASK) >> \
  316. WMA_HW_MODE_MAC1_TX_STREAMS_BITPOS)
  317. #define WMA_HW_MODE_MAC1_RX_STREAMS_GET(hw_mode) \
  318. ((hw_mode & WMA_HW_MODE_MAC1_RX_STREAMS_MASK) >> \
  319. WMA_HW_MODE_MAC1_RX_STREAMS_BITPOS)
  320. #define WMA_HW_MODE_MAC0_BANDWIDTH_GET(hw_mode) \
  321. ((hw_mode & WMA_HW_MODE_MAC0_BANDWIDTH_MASK) >> \
  322. WMA_HW_MODE_MAC0_BANDWIDTH_BITPOS)
  323. #define WMA_HW_MODE_MAC1_BANDWIDTH_GET(hw_mode) \
  324. ((hw_mode & WMA_HW_MODE_MAC1_BANDWIDTH_MASK) >> \
  325. WMA_HW_MODE_MAC1_BANDWIDTH_BITPOS)
  326. #define WMA_HW_MODE_DBS_MODE_GET(hw_mode) \
  327. ((hw_mode & WMA_HW_MODE_DBS_MODE_MASK) >> \
  328. WMA_HW_MODE_DBS_MODE_BITPOS)
  329. #define WMA_HW_MODE_AGILE_DFS_GET(hw_mode) \
  330. ((hw_mode & WMA_HW_MODE_AGILE_DFS_MODE_MASK) >> \
  331. WMA_HW_MODE_AGILE_DFS_MODE_BITPOS)
  332. #define WMA_HW_MODE_SBS_MODE_GET(hw_mode) \
  333. ((hw_mode & WMA_HW_MODE_SBS_MODE_MASK) >> \
  334. WMA_HW_MODE_SBS_MODE_BITPOS)
  335. /*
  336. * Extract 2G or 5G tx/rx chainmask
  337. * format of txrx_chainmask (from wmi_service_ready_event_fixed_param):
  338. * [7:0] - 2G band tx chain mask
  339. * [15:8] - 2G band rx chain mask
  340. * [23:16] - 5G band tx chain mask
  341. * [31:24] - 5G band rx chain mask
  342. */
  343. #define EXTRACT_TX_CHAIN_MASK_2G(chainmask) ((chainmask) & 0xFF)
  344. #define EXTRACT_RX_CHAIN_MASK_2G(chainmask) (((chainmask) >> 8) & 0xFF)
  345. #define EXTRACT_TX_CHAIN_MASK_5G(chainmask) (((chainmask) >> 16) & 0xFF)
  346. #define EXTRACT_RX_CHAIN_MASK_5G(chainmask) (((chainmask) >> 24) & 0xFF)
  347. /*
  348. * PROBE_REQ_TX_DELAY
  349. * param to specify probe request Tx delay for scans triggered on this VDEV
  350. */
  351. #define PROBE_REQ_TX_DELAY 10
  352. /* PROBE_REQ_TX_TIME_GAP
  353. * param to specify the time gap between each set of probe request transmission.
  354. * The number of probe requests in each set depends on the ssid_list and,
  355. * bssid_list in the scan request. This parameter will get applied only,
  356. * for the scans triggered on this VDEV.
  357. */
  358. #define PROBE_REQ_TX_TIME_GAP 20
  359. /**
  360. * enum wma_rx_exec_ctx - wma rx execution context
  361. * @WMA_RX_WORK_CTX: work queue context execution
  362. * @WMA_RX_TASKLET_CTX: tasklet context execution
  363. * @WMA_RX_SERIALIZER_CTX: MC thread context execution
  364. *
  365. */
  366. enum wma_rx_exec_ctx {
  367. WMA_RX_WORK_CTX = WMI_RX_WORK_CTX,
  368. WMA_RX_TASKLET_CTX = WMI_RX_TASKLET_CTX,
  369. WMA_RX_SERIALIZER_CTX = WMI_RX_SERIALIZER_CTX,
  370. };
  371. /**
  372. * struct beacon_info - structure to store beacon template
  373. * @buf: skb ptr
  374. * @len: length
  375. * @dma_mapped: is it dma mapped or not
  376. * @tim_ie_offset: TIM IE offset
  377. * @dtim_count: DTIM count
  378. * @seq_no: sequence no
  379. * @noa_sub_ie: NOA sub IE
  380. * @noa_sub_ie_len: NOA sub IE length
  381. * @noa_ie: NOA IE
  382. * @p2p_ie_offset: p2p IE offset
  383. * @csa_count_offset: Offset of Switch count field in CSA IE
  384. * @ecsa_count_offset: Offset of Switch count field in ECSA IE
  385. * @lock: lock
  386. */
  387. struct beacon_info {
  388. qdf_nbuf_t buf;
  389. uint32_t len;
  390. uint8_t dma_mapped;
  391. uint32_t tim_ie_offset;
  392. uint8_t dtim_count;
  393. uint16_t seq_no;
  394. uint8_t noa_sub_ie[2 + WMA_NOA_IE_SIZE(WMA_MAX_NOA_DESCRIPTORS)];
  395. uint16_t noa_sub_ie_len;
  396. uint8_t *noa_ie;
  397. uint16_t p2p_ie_offset;
  398. uint16_t csa_count_offset;
  399. uint16_t ecsa_count_offset;
  400. qdf_spinlock_t lock;
  401. };
  402. /**
  403. * struct beacon_tim_ie - structure to store TIM IE of beacon
  404. * @tim_ie: tim ie
  405. * @tim_len: tim ie length
  406. * @dtim_count: dtim count
  407. * @dtim_period: dtim period
  408. * @tim_bitctl: tim bit control
  409. * @tim_bitmap: tim bitmap
  410. */
  411. struct beacon_tim_ie {
  412. uint8_t tim_ie;
  413. uint8_t tim_len;
  414. uint8_t dtim_count;
  415. uint8_t dtim_period;
  416. uint8_t tim_bitctl;
  417. QDF_FLEX_ARRAY(uint8_t, tim_bitmap);
  418. } __ATTRIB_PACK;
  419. /**
  420. * struct pps - packet power save parameter
  421. * @paid_match_enable: paid match enable
  422. * @gid_match_enable: gid match enable
  423. * @tim_clear: time clear
  424. * @dtim_clear: dtim clear
  425. * @eof_delim: eof delim
  426. * @mac_match: mac match
  427. * @delim_fail: delim fail
  428. * @nsts_zero: nsts zero
  429. * @rssi_chk: RSSI check
  430. * @ebt_5g: ebt 5GHz
  431. */
  432. struct pps {
  433. bool paid_match_enable;
  434. bool gid_match_enable;
  435. bool tim_clear;
  436. bool dtim_clear;
  437. bool eof_delim;
  438. bool mac_match;
  439. bool delim_fail;
  440. bool nsts_zero;
  441. bool rssi_chk;
  442. bool ebt_5g;
  443. };
  444. /**
  445. * struct qpower_params - qpower related parameters
  446. * @max_ps_poll_cnt: max ps poll count
  447. * @max_tx_before_wake: max tx before wake
  448. * @spec_ps_poll_wake_interval: ps poll wake interval
  449. * @max_spec_nodata_ps_poll: no data ps poll
  450. */
  451. struct qpower_params {
  452. uint32_t max_ps_poll_cnt;
  453. uint32_t max_tx_before_wake;
  454. uint32_t spec_ps_poll_wake_interval;
  455. uint32_t max_spec_nodata_ps_poll;
  456. };
  457. /**
  458. * struct gtx_config_t - GTX config
  459. * @gtxRTMask: for HT and VHT rate masks
  460. * @gtxUsrcfg: host request for GTX mask
  461. * @gtxPERThreshold: PER Threshold (default: 10%)
  462. * @gtxPERMargin: PER margin (default: 2%)
  463. * @gtxTPCstep: TCP step (default: 1)
  464. * @gtxTPCMin: TCP min (default: 5)
  465. * @gtxBWMask: BW mask (20/40/80/160 Mhz)
  466. */
  467. typedef struct {
  468. uint32_t gtxRTMask[2];
  469. uint32_t gtxUsrcfg;
  470. uint32_t gtxPERThreshold;
  471. uint32_t gtxPERMargin;
  472. uint32_t gtxTPCstep;
  473. uint32_t gtxTPCMin;
  474. uint32_t gtxBWMask;
  475. } gtx_config_t;
  476. /**
  477. * struct pdev_cli_config_t - store pdev parameters
  478. * @ani_enable: ANI is enabled/disable on target
  479. * @ani_poll_len: store ANI polling period
  480. * @ani_listen_len: store ANI listening period
  481. * @ani_ofdm_level: store ANI OFDM immunity level
  482. * @ani_cck_level: store ANI CCK immunity level
  483. * @cwmenable: Dynamic bw is enable/disable in fw
  484. * @txchainmask: tx chain mask
  485. * @rxchainmask: rx chain mask
  486. * @txpow2g: tx power limit for 2GHz
  487. * @txpow5g: tx power limit for 5GHz
  488. *
  489. * This structure stores pdev parameters.
  490. * Some of these parameters are set in fw and some
  491. * parameters are only maintained in host.
  492. */
  493. typedef struct {
  494. uint32_t ani_enable;
  495. uint32_t ani_poll_len;
  496. uint32_t ani_listen_len;
  497. uint32_t ani_ofdm_level;
  498. uint32_t ani_cck_level;
  499. uint32_t cwmenable;
  500. uint32_t cts_cbw;
  501. uint32_t txchainmask;
  502. uint32_t rxchainmask;
  503. uint32_t txpow2g;
  504. uint32_t txpow5g;
  505. } pdev_cli_config_t;
  506. /**
  507. * struct vdev_cli_config_t - store vdev parameters
  508. * @nss: nss width
  509. * @ldpc: is ldpc is enable/disable
  510. * @tx_stbc: TX STBC is enable/disable
  511. * @rx_stbc: RX STBC is enable/disable
  512. * @shortgi: short gi is enable/disable
  513. * @rtscts_en: RTS/CTS is enable/disable
  514. * @chwidth: channel width
  515. * @tx_rate: tx rate
  516. * @ampdu: ampdu size
  517. * @amsdu: amsdu size
  518. * @erx_adjust: enable/disable early rx enable
  519. * @erx_bmiss_num: target bmiss number per sample
  520. * @erx_bmiss_cycle: sample cycle
  521. * @erx_slop_step: slop_step value
  522. * @erx_init_slop: init slop
  523. * @erx_adj_pause: pause adjust enable/disable
  524. * @erx_dri_sample: enable/disable drift sample
  525. * @pps_params: packet power save parameters
  526. * @qpower_params: qpower parameters
  527. * @gtx_info: GTX offload info
  528. * @dcm: DCM enable/disable
  529. * @range_ext: HE range extension enable/disable
  530. * @tx_ampdu: tx ampdu size
  531. * @rx_ampdu: rx ampdu size
  532. * @tx_amsdu: tx amsdu size
  533. * @rx_amsdu: rx amsdu size
  534. *
  535. * This structure stores vdev parameters.
  536. * Some of these parameters are set in fw and some
  537. * parameters are only maintained in host.
  538. */
  539. typedef struct {
  540. uint32_t nss;
  541. uint32_t ldpc;
  542. uint32_t tx_stbc;
  543. uint32_t rx_stbc;
  544. uint32_t shortgi;
  545. uint32_t rtscts_en;
  546. uint32_t chwidth;
  547. uint32_t tx_rate;
  548. uint32_t ampdu;
  549. uint32_t amsdu;
  550. uint32_t erx_adjust;
  551. uint32_t erx_bmiss_num;
  552. uint32_t erx_bmiss_cycle;
  553. uint32_t erx_slop_step;
  554. uint32_t erx_init_slop;
  555. uint32_t erx_adj_pause;
  556. uint32_t erx_dri_sample;
  557. struct pps pps_params;
  558. struct qpower_params qpower_params;
  559. gtx_config_t gtx_info;
  560. #ifdef WLAN_FEATURE_11AX
  561. uint8_t dcm;
  562. uint8_t range_ext;
  563. #endif
  564. uint32_t tx_ampdu;
  565. uint32_t rx_ampdu;
  566. uint32_t tx_amsdu;
  567. uint32_t rx_amsdu;
  568. } vdev_cli_config_t;
  569. /**
  570. * struct wma_version_info - Store wmi version info
  571. * @major: wmi major version
  572. * @minor: wmi minor version
  573. * @revision: wmi revision number
  574. */
  575. struct wma_version_info {
  576. u_int32_t major;
  577. u_int32_t minor;
  578. u_int32_t revision;
  579. };
  580. /* Max number of invalid peer entries */
  581. #define INVALID_PEER_MAX_NUM 5
  582. /**
  583. * struct wma_invalid_peer_params - stores invalid peer entries
  584. * @rx_macaddr: store mac addr of invalid peer
  585. */
  586. struct wma_invalid_peer_params {
  587. uint8_t rx_macaddr[QDF_MAC_ADDR_SIZE];
  588. };
  589. /**
  590. * struct wma_txrx_node - txrx node
  591. * @vdev: pointer to vdev object
  592. * @beacon: beacon info
  593. * @config: per vdev config parameters
  594. * @scan_info: scan info
  595. * @type: type
  596. * @sub_type: sub type
  597. * @nlo_match_evt_received: is nlo match event received or not
  598. * @pno_in_progress: is pno in progress or not
  599. * @plm_in_progress: is plm in progress or not
  600. * @beaconInterval: beacon interval
  601. * @llbCoexist: 11b coexist
  602. * @shortSlotTimeSupported: is short slot time supported or not
  603. * @dtimPeriod: DTIM period
  604. * @chan_width: channel bandwidth
  605. * @vdev_up: is vdev up or not
  606. * @tsfadjust: TSF adjust
  607. * @addBssStaContext: add bss context
  608. * @aid: association id
  609. * @rmfEnabled: Robust Management Frame (RMF) enabled/disabled
  610. * @uapsd_cached_val: uapsd cached value
  611. * @stats_rsp: stats response
  612. * @del_staself_req: delete sta self request
  613. * @bss_status: bss status
  614. * @nss: nss value
  615. * @is_channel_switch: is channel switch
  616. * @pause_bitmap: pause bitmap
  617. * @nwType: network type (802.11a/b/g/n/ac)
  618. * @ps_enabled: is powersave enable/disable
  619. * @peer_count: peer count
  620. * @plink_status_req: link status request
  621. * @psnr_req: snr request
  622. * @tx_streams: number of tx streams can be used by the vdev
  623. * @mac_id: the mac on which vdev is on
  624. * @arp_offload_req: cached arp offload request
  625. * @ns_offload_req: cached ns offload request
  626. * @rcpi_req: rcpi request
  627. * @in_bmps: Whether bmps for this interface has been enabled
  628. * @ch_freq: channel frequency
  629. * @roam_scan_stats_req: cached roam scan stats request
  630. * @wma_invalid_peer_params: structure storing invalid peer params
  631. * @invalid_peer_idx: invalid peer index
  632. * It stores parameters per vdev in wma.
  633. */
  634. struct wma_txrx_node {
  635. struct wlan_objmgr_vdev *vdev;
  636. struct beacon_info *beacon;
  637. vdev_cli_config_t config;
  638. uint32_t type;
  639. uint32_t sub_type;
  640. #ifdef FEATURE_WLAN_ESE
  641. bool plm_in_progress;
  642. #endif
  643. tSirMacBeaconInterval beaconInterval;
  644. uint8_t llbCoexist;
  645. uint8_t shortSlotTimeSupported;
  646. uint8_t dtimPeriod;
  647. enum phy_ch_width chan_width;
  648. bool vdev_active;
  649. uint64_t tsfadjust;
  650. tAddStaParams *addBssStaContext;
  651. uint16_t aid;
  652. uint8_t rmfEnabled;
  653. uint32_t uapsd_cached_val;
  654. void *del_staself_req;
  655. bool is_del_sta_deferred;
  656. qdf_atomic_t bss_status;
  657. enum tx_rate_info rate_flags;
  658. uint8_t nss;
  659. uint16_t pause_bitmap;
  660. uint32_t nwType;
  661. uint32_t peer_count;
  662. void *plink_status_req;
  663. void *psnr_req;
  664. #ifdef FEATURE_WLAN_EXTSCAN
  665. bool extscan_in_progress;
  666. #endif
  667. uint32_t tx_streams;
  668. uint32_t mac_id;
  669. int32_t roam_synch_delay;
  670. struct sme_rcpi_req *rcpi_req;
  671. bool in_bmps;
  672. struct beacon_filter_param beacon_filter;
  673. bool beacon_filter_enabled;
  674. struct roam_synch_frame_ind roam_synch_frame_ind;
  675. bool is_waiting_for_key;
  676. uint32_t ch_freq;
  677. uint16_t ch_flagext;
  678. struct sir_roam_scan_stats *roam_scan_stats_req;
  679. struct wma_invalid_peer_params invalid_peers[INVALID_PEER_MAX_NUM];
  680. uint8_t invalid_peer_idx;
  681. uint16_t bss_max_idle_period;
  682. };
  683. /**
  684. * struct mac_ss_bw_info - hw_mode_list PHY/MAC params for each MAC
  685. * @mac_tx_stream: Max TX stream
  686. * @mac_rx_stream: Max RX stream
  687. * @mac_bw: Max bandwidth
  688. */
  689. struct mac_ss_bw_info {
  690. uint32_t mac_tx_stream;
  691. uint32_t mac_rx_stream;
  692. uint32_t mac_bw;
  693. };
  694. /**
  695. * struct wma_ini_config - Structure to hold wma ini configuration
  696. * @max_no_of_peers: Max Number of supported
  697. * @exclude_selftx_from_cca_busy: Exclude self tx time from cca busy time flag.
  698. *
  699. * Placeholder for WMA ini parameters.
  700. */
  701. struct wma_ini_config {
  702. uint8_t max_no_of_peers;
  703. bool exclude_selftx_from_cca_busy;
  704. };
  705. /**
  706. * struct wma_valid_channels - Channel details part of WMI_SCAN_CHAN_LIST_CMDID
  707. * @num_channels: Number of channels
  708. * @ch_freq_list: Channel Frequency list
  709. */
  710. struct wma_valid_channels {
  711. uint8_t num_channels;
  712. uint32_t ch_freq_list[NUM_CHANNELS];
  713. };
  714. #ifdef FEATURE_WLM_STATS
  715. /**
  716. * struct wma_wlm_stats_data - Data required to be used to send WLM req
  717. * @wlm_stats_max_size: Buffer size provided by userspace
  718. * @wlm_stats_cookie: Cookie to retrieve WLM req data
  719. * @wlm_stats_callback: Callback to be used to send WLM response
  720. */
  721. struct wma_wlm_stats_data {
  722. uint32_t wlm_stats_max_size;
  723. void *wlm_stats_cookie;
  724. wma_wlm_stats_cb wlm_stats_callback;
  725. };
  726. #endif
  727. #define WLAN_WMA_MAX_PF_SYM 50
  728. #define WLAN_WMA_PF_APPS_NOTIFY_BUF_LEN QDF_HANG_EVENT_DATA_SIZE
  729. #define WLAN_WMA_PF_SYM_LEN 4
  730. #define WLAN_WMA_PF_SYM_CNT_LEN 1
  731. #define WLAN_WMA_PF_SYM_FLAGS_LEN 1
  732. #define WLAN_WMA_PER_PF_SYM_NOTIFY_BUF_LEN (WLAN_WMA_PF_SYM_LEN + \
  733. WLAN_WMA_PF_SYM_CNT_LEN + \
  734. WLAN_WMA_PF_SYM_FLAGS_LEN)
  735. /*
  736. * struct wow_pf_sym - WOW PF wakeup symbol info
  737. * @symbol: Address of PF symbol
  738. * @count: Count of PF symbol
  739. * @flags: Flags associated with @symbol
  740. */
  741. struct wow_pf_sym {
  742. uint32_t symbol;
  743. uint8_t count;
  744. uint8_t flags;
  745. };
  746. /*
  747. * struct wow_pf_wakeup_ev_data - WOW PF wakeup event data
  748. * @pf_sym: Array of each unique PF symbol in wakeup event payload
  749. * @num_pf_syms: Total unique symbols in event.
  750. * @pending_pf_syms: Pending PF symbols to process
  751. */
  752. struct wow_pf_wakeup_ev_data {
  753. struct wow_pf_sym *pf_sym;
  754. uint8_t num_pf_syms;
  755. uint8_t pending_pf_syms;
  756. };
  757. /**
  758. * struct wma_pf_sym - Per symbol PF data in PF symbol history
  759. * @pf_sym: PF symbol info
  760. * @pf_event_ts: Array of page fault event ts
  761. */
  762. struct wma_pf_sym {
  763. struct wow_pf_sym pf_sym;
  764. qdf_time_t *pf_ev_ts;
  765. };
  766. /*
  767. * struct wma_pf_sym_hist - System level FW PF symbol history
  768. * @wma_pf_sym: Array of symbols in history.
  769. * @pf_notify_buf_ptr: Pointer to APPS notify buffer
  770. * @pf_notify_buf_len: Current data length of @pf_notify_buf_ptr
  771. * @lock: Lock to access PF symbol history
  772. */
  773. struct wma_pf_sym_hist {
  774. struct wma_pf_sym wma_pf_sym[WLAN_WMA_MAX_PF_SYM];
  775. uint8_t *pf_notify_buf_ptr;
  776. uint32_t pf_notify_buf_len;
  777. qdf_spinlock_t lock;
  778. };
  779. /**
  780. * struct t_wma_handle - wma context
  781. * @wmi_handle: wmi handle
  782. * @cds_context: cds handle
  783. * @mac_context: mac context
  784. * @psoc: psoc context
  785. * @pdev: physical device global object
  786. * @target_suspend: target suspend event
  787. * @recovery_event: wma FW recovery event
  788. * @max_station: max stations
  789. * @max_bssid: max bssid
  790. * @myaddr: current mac address
  791. * @hwaddr: mac address from EEPROM
  792. * @lpss_support: LPSS feature is supported in target or not
  793. * @wmi_ready: wmi status flag
  794. * @wlan_init_status: wlan init status
  795. * @qdf_dev: qdf device
  796. * @wmi_service_bitmap: wmi services bitmap received from Target
  797. * @wmi_service_ext_bitmap: extended wmi services bitmap received from Target
  798. * @tx_frm_download_comp_cb: Tx Frame Compl Cb registered by umac
  799. * @tx_frm_download_comp_event: Event to wait for tx download completion
  800. * @tx_queue_empty_event: Dummy event to wait for draining MSDUs left
  801. * in hardware tx queue and before requesting VDEV_STOP. Nobody will
  802. * set this and wait will timeout, and code will poll the pending tx
  803. * descriptors number to be zero.
  804. * @umac_ota_ack_cb: Ack Complete Callback registered by umac
  805. * @umac_data_ota_ack_cb: ack complete callback
  806. * @last_umac_data_ota_timestamp: timestamp when OTA of last umac data
  807. * was done
  808. * @last_umac_data_nbuf: cache nbuf ptr for the last umac data buf
  809. * @tgt_cfg_update_cb: configuration update callback
  810. * @reg_cap: regulatory capabilities
  811. * @scan_id: scan id
  812. * @interfaces: txrx nodes(per vdev)
  813. * @pdevconfig: pdev related configurations
  814. * @wma_hold_req_queue: Queue use to serialize requests to firmware
  815. * @wma_hold_req_q_lock: Mutex for @wma_hold_req_queue
  816. * @vht_supp_mcs: VHT supported MCS
  817. * @is_fw_assert: is fw asserted
  818. * @ack_work_ctx: Context for deferred processing of TX ACK
  819. * @pGetRssiReq: get RSSI request
  820. * @get_one_peer_info: When a "get peer info" request is active, is
  821. * the request for a single peer?
  822. * @peer_macaddr: When @get_one_peer_info is true, the peer's mac address
  823. * @thermal_mgmt_info: Thermal mitigation related info
  824. * @enable_mc_list: To Check if Multicast list filtering is enabled in FW
  825. * @hddTxFailCb: tx fail indication callback
  826. * @extscan_wake_lock: extscan wake lock
  827. * @wow_wake_lock: wow wake lock
  828. * @wow_auth_req_wl: wow wake lock for auth req
  829. * @wow_assoc_req_wl: wow wake lock for assoc req
  830. * @wow_deauth_rec_wl: wow wake lock for deauth req
  831. * @wow_disassoc_rec_wl: wow wake lock for disassoc req
  832. * @wow_ap_assoc_lost_wl: wow wake lock for assoc lost req
  833. * @wow_auto_shutdown_wl: wow wake lock for shutdown req
  834. * @roam_ho_wl: wake lock for roam handoff req
  835. * @wow_nack: wow negative ack flag
  836. * @is_wow_bus_suspended: is wow bus suspended flag
  837. * @IsRArateLimitEnabled: RA rate limiti s enabled or not
  838. * @RArateLimitInterval: RA rate limit interval
  839. * @is_lpass_enabled: Flag to indicate if LPASS feature is enabled or not
  840. * @staMaxLIModDtim: station max listen interval
  841. * @sta_max_li_mod_dtim_ms: station max listen interval in ms
  842. * @staModDtim: station mode DTIM
  843. * @staDynamicDtim: station dynamic DTIM
  844. * @hw_bd_id: hardware board id
  845. * @hw_bd_info: hardware board info
  846. * @miracast_value: miracast value
  847. * @log_completion_timer: log completion timer
  848. * @old_hw_mode_index: Previous configured HW mode index
  849. * @new_hw_mode_index: Current configured HW mode index
  850. * @ocb_config_req: OCB request context
  851. * @self_gen_frm_pwr: Self-generated frame power
  852. * @tx_chain_mask_cck: Is the CCK tx chain mask enabled
  853. * @service_ready_ext_timer: Timer for service ready extended. Note
  854. * this is a a timer instead of wait event because on receiving the
  855. * service ready event, we will be waiting on the MC thread for the
  856. * service extended ready event which is also processed in MC
  857. * thread. This leads to MC thread being stuck. Alternative was to
  858. * process these events in tasklet/workqueue context. But, this
  859. * leads to race conditions when the events are processed in two
  860. * different context. So, processing ready event and extended ready
  861. * event in the serialized MC thread context with a timer.
  862. * @csr_roam_synch_cb: CSR callback for firmware Roam Sync events
  863. * @pe_roam_synch_cb: pe callback for firmware Roam Sync events
  864. * @csr_roam_auth_event_handle_cb: CSR callback for target authentication
  865. * offload event.
  866. * @pe_roam_set_ie_cb: PE callback to set IEs to firmware.
  867. * @wmi_cmd_rsp_wake_lock: wmi command response wake lock
  868. * @wmi_cmd_rsp_runtime_lock: wmi command response bus lock
  869. * @active_uc_apf_mode: Setting that determines how APF is applied in
  870. * active mode for uc packets
  871. * @active_mc_bc_apf_mode: Setting that determines how APF is applied in
  872. * active mode for MC/BC packets
  873. * @ini_config: Initial configuration from upper layer
  874. * @saved_chan: saved channel list sent as part of
  875. * WMI_SCAN_CHAN_LIST_CMDID
  876. * @nan_datapath_enabled: Is NAN datapath support enabled in firmware?
  877. * @fw_timeout_crash: Should firmware be reset upon response timeout?
  878. * @sub_20_support: Does target support sub-20MHz bandwidth (aka
  879. * half-rate and quarter-rate)?
  880. * @is_dfs_offloaded: Is dfs and cac timer offloaded?
  881. * @wma_mgmt_tx_packetdump_cb: Callback function for TX packet dump
  882. * @wma_mgmt_rx_packetdump_cb: Callback function for RX packet dump
  883. * @rcpi_enabled: Is RCPI enabled?
  884. * @link_stats_results: Structure for handing link stats from firmware
  885. * @tx_fail_cnt: Number of TX failures
  886. * @wlm_data: Data required for WLM req and resp handling
  887. * @he_cap: 802.11ax capabilities
  888. * @bandcapability: band capability configured through ini
  889. * @tx_bfee_8ss_enabled: Is Tx Beamformee support for 8x8 enabled?
  890. * @in_imps: Is device in Idle Mode Power Save?
  891. * @dynamic_nss_chains_update: per vdev nss, chains update
  892. * @ito_repeat_count: Indicates ito repeated count
  893. * @wma_fw_time_sync_timer: timer used for firmware time sync
  894. * * @fw_therm_throt_support: FW Supports thermal throttling?
  895. * @eht_cap: 802.11be capabilities
  896. * @set_hw_mode_resp_status: Set HW mode response status
  897. * @wma_pf_hist: PF symbol history
  898. *
  899. * This structure is the global wma context. It contains global wma
  900. * module parameters and handles of other modules.
  901. */
  902. typedef struct {
  903. void *wmi_handle;
  904. void *cds_context;
  905. struct mac_context *mac_context;
  906. struct wlan_objmgr_psoc *psoc;
  907. struct wlan_objmgr_pdev *pdev;
  908. qdf_event_t target_suspend;
  909. qdf_event_t runtime_suspend;
  910. qdf_event_t recovery_event;
  911. uint16_t max_station;
  912. uint16_t max_bssid;
  913. uint8_t myaddr[QDF_MAC_ADDR_SIZE];
  914. uint8_t hwaddr[QDF_MAC_ADDR_SIZE];
  915. #ifdef WLAN_FEATURE_LPSS
  916. uint8_t lpss_support;
  917. #endif
  918. uint8_t ap_arpns_support;
  919. bool wmi_ready;
  920. uint32_t wlan_init_status;
  921. qdf_device_t qdf_dev;
  922. uint32_t wmi_service_bitmap[WMI_SERVICE_BM_SIZE];
  923. uint32_t wmi_service_ext_bitmap[WMI_SERVICE_SEGMENT_BM_SIZE32];
  924. wma_tx_dwnld_comp_callback tx_frm_download_comp_cb;
  925. qdf_event_t tx_frm_download_comp_event;
  926. qdf_event_t tx_queue_empty_event;
  927. wma_tx_ota_comp_callback umac_data_ota_ack_cb;
  928. unsigned long last_umac_data_ota_timestamp;
  929. qdf_nbuf_t last_umac_data_nbuf;
  930. wma_tgt_cfg_cb tgt_cfg_update_cb;
  931. HAL_REG_CAPABILITIES reg_cap;
  932. uint32_t scan_id;
  933. struct wma_txrx_node *interfaces;
  934. pdev_cli_config_t pdevconfig;
  935. qdf_list_t wma_hold_req_queue;
  936. qdf_spinlock_t wma_hold_req_q_lock;
  937. uint32_t vht_supp_mcs;
  938. uint8_t is_fw_assert;
  939. struct wma_tx_ack_work_ctx *ack_work_ctx;
  940. void *pGetRssiReq;
  941. bool get_one_peer_info;
  942. struct qdf_mac_addr peer_macaddr;
  943. t_thermal_mgmt thermal_mgmt_info;
  944. bool enable_mc_list;
  945. #ifdef FEATURE_WLAN_EXTSCAN
  946. qdf_wake_lock_t extscan_wake_lock;
  947. #endif
  948. qdf_wake_lock_t wow_wake_lock;
  949. qdf_wake_lock_t wow_auth_req_wl;
  950. qdf_wake_lock_t wow_assoc_req_wl;
  951. qdf_wake_lock_t wow_deauth_rec_wl;
  952. qdf_wake_lock_t wow_disassoc_rec_wl;
  953. qdf_wake_lock_t wow_ap_assoc_lost_wl;
  954. qdf_wake_lock_t wow_auto_shutdown_wl;
  955. qdf_wake_lock_t roam_ho_wl;
  956. qdf_wake_lock_t roam_preauth_wl;
  957. qdf_wake_lock_t probe_req_wps_wl;
  958. int wow_nack;
  959. qdf_atomic_t is_wow_bus_suspended;
  960. #ifdef WLAN_FEATURE_LPSS
  961. bool is_lpass_enabled;
  962. #endif
  963. uint8_t staMaxLIModDtim;
  964. uint16_t sta_max_li_mod_dtim_ms;
  965. uint8_t staModDtim;
  966. uint8_t staDynamicDtim;
  967. uint32_t hw_bd_id;
  968. uint32_t hw_bd_info[HW_BD_INFO_SIZE];
  969. uint32_t miracast_value;
  970. qdf_mc_timer_t log_completion_timer;
  971. uint32_t old_hw_mode_index;
  972. uint32_t new_hw_mode_index;
  973. uint16_t self_gen_frm_pwr;
  974. bool tx_chain_mask_cck;
  975. qdf_mc_timer_t service_ready_ext_timer;
  976. QDF_STATUS (*csr_roam_auth_event_handle_cb)(struct mac_context *mac,
  977. uint8_t vdev_id,
  978. struct qdf_mac_addr bssid,
  979. uint32_t akm);
  980. QDF_STATUS (*pe_roam_synch_cb)(struct mac_context *mac,
  981. uint8_t vdev_id,
  982. struct roam_offload_synch_ind *roam_synch_data,
  983. uint16_t ie_len,
  984. enum sir_roam_op_code reason);
  985. QDF_STATUS (*pe_disconnect_cb) (struct mac_context *mac,
  986. uint8_t vdev_id,
  987. uint8_t *deauth_disassoc_frame,
  988. uint16_t deauth_disassoc_frame_len,
  989. uint16_t reason_code);
  990. QDF_STATUS (*pe_roam_set_ie_cb)(struct mac_context *mac_ctx,
  991. uint8_t vdev_id, uint16_t dot11_mode,
  992. enum QDF_OPMODE device_mode);
  993. qdf_wake_lock_t wmi_cmd_rsp_wake_lock;
  994. qdf_runtime_lock_t wmi_cmd_rsp_runtime_lock;
  995. qdf_runtime_lock_t sap_prevent_runtime_pm_lock;
  996. qdf_runtime_lock_t ndp_prevent_runtime_pm_lock;
  997. enum active_apf_mode active_uc_apf_mode;
  998. enum active_apf_mode active_mc_bc_apf_mode;
  999. struct wma_ini_config ini_config;
  1000. struct wma_valid_channels saved_chan;
  1001. bool nan_datapath_enabled;
  1002. bool fw_timeout_crash;
  1003. bool sub_20_support;
  1004. bool is_dfs_offloaded;
  1005. ol_txrx_pktdump_cb wma_mgmt_tx_packetdump_cb;
  1006. ol_txrx_pktdump_cb wma_mgmt_rx_packetdump_cb;
  1007. bool rcpi_enabled;
  1008. tSirLLStatsResults *link_stats_results;
  1009. qdf_mutex_t radio_stats_lock;
  1010. uint64_t tx_fail_cnt;
  1011. #ifdef FEATURE_WLM_STATS
  1012. struct wma_wlm_stats_data wlm_data;
  1013. #endif
  1014. #ifdef WLAN_FEATURE_11AX
  1015. struct he_capability he_cap;
  1016. #endif
  1017. uint8_t bandcapability;
  1018. bool tx_bfee_8ss_enabled;
  1019. bool in_imps;
  1020. bool dynamic_nss_chains_support;
  1021. uint8_t ito_repeat_count;
  1022. bool fw_therm_throt_support;
  1023. bool enable_tx_compl_tsf64;
  1024. #ifdef WLAN_FEATURE_11BE
  1025. struct eht_capability eht_cap;
  1026. #endif
  1027. qdf_atomic_t sap_num_clients_connected;
  1028. qdf_atomic_t go_num_clients_connected;
  1029. qdf_wake_lock_t sap_d3_wow_wake_lock;
  1030. qdf_wake_lock_t go_d3_wow_wake_lock;
  1031. enum set_hw_mode_status set_hw_mode_resp_status;
  1032. struct wma_pf_sym_hist wma_pf_hist;
  1033. } t_wma_handle, *tp_wma_handle;
  1034. /**
  1035. * wma_validate_handle() - Validate WMA handle
  1036. * @wma_handle: wma handle
  1037. *
  1038. * This function will log on error and hence caller should not log on error
  1039. *
  1040. * Return: errno if WMA handle is NULL; 0 otherwise
  1041. */
  1042. #define wma_validate_handle(wma_handle) \
  1043. __wma_validate_handle(wma_handle, __func__)
  1044. int __wma_validate_handle(tp_wma_handle wma_handle, const char *func);
  1045. /**
  1046. * wma_vdev_nss_chain_params_send() - send vdev nss chain params to fw.
  1047. * @vdev_id: vdev_id
  1048. * @user_cfg: pointer to the params structure
  1049. *
  1050. * This function sends nss chain params to the fw
  1051. *
  1052. * Return: QDF_STATUS_SUCCESS on success, QDF_STATUS_E_FAILURE on error
  1053. */
  1054. QDF_STATUS
  1055. wma_vdev_nss_chain_params_send(uint8_t vdev_id,
  1056. struct wlan_mlme_nss_chains *user_cfg);
  1057. /**
  1058. * wma_send_regdomain_info_to_fw() - send regdomain info to fw
  1059. * @reg_dmn: reg domain
  1060. * @regdmn2G: 2G reg domain
  1061. * @regdmn5G: 5G reg domain
  1062. * @ctl2G: 2G test limit
  1063. * @ctl5G: 5G test limit
  1064. *
  1065. * Return: none
  1066. */
  1067. void wma_send_regdomain_info_to_fw(uint32_t reg_dmn, uint16_t regdmn2G,
  1068. uint16_t regdmn5G, uint8_t ctl2G,
  1069. uint8_t ctl5G);
  1070. /**
  1071. * enum frame_index - Frame index
  1072. * @GENERIC_NODOWNLD_NOACK_COMP_INDEX: Frame index for no download comp no ack
  1073. * @GENERIC_DOWNLD_COMP_NOACK_COMP_INDEX: Frame index for download comp no ack
  1074. * @GENERIC_DOWNLD_COMP_ACK_COMP_INDEX: Frame index for download comp and ack
  1075. * @GENERIC_NODOWLOAD_ACK_COMP_INDEX: Frame index for no download comp and ack
  1076. * @FRAME_INDEX_MAX: maximum frame index
  1077. */
  1078. enum frame_index {
  1079. GENERIC_NODOWNLD_NOACK_COMP_INDEX,
  1080. GENERIC_DOWNLD_COMP_NOACK_COMP_INDEX,
  1081. GENERIC_DOWNLD_COMP_ACK_COMP_INDEX,
  1082. GENERIC_NODOWLOAD_ACK_COMP_INDEX,
  1083. FRAME_INDEX_MAX
  1084. };
  1085. /**
  1086. * struct wma_tx_ack_work_ctx - tx ack work context
  1087. * @wma_handle: wma handle
  1088. * @sub_type: sub type
  1089. * @status: status
  1090. * @ack_cmp_work: work structure
  1091. * @frame: frame nbuf
  1092. */
  1093. struct wma_tx_ack_work_ctx {
  1094. tp_wma_handle wma_handle;
  1095. uint16_t sub_type;
  1096. int32_t status;
  1097. qdf_work_t ack_cmp_work;
  1098. qdf_nbuf_t frame;
  1099. };
  1100. /**
  1101. * struct wma_target_req - target request parameters
  1102. * @event_timeout: event timeout
  1103. * @node: list
  1104. * @user_data: user data
  1105. * @addr: Mac address
  1106. * @msg_type: message type
  1107. * @vdev_id: vdev id
  1108. * @type: type
  1109. */
  1110. struct wma_target_req {
  1111. qdf_mc_timer_t event_timeout;
  1112. qdf_list_node_t node;
  1113. void *user_data;
  1114. struct qdf_mac_addr addr;
  1115. uint32_t msg_type;
  1116. uint8_t vdev_id;
  1117. uint8_t type;
  1118. };
  1119. /**
  1120. * struct t_thermal_cmd_params - thermal command parameters
  1121. * @minTemp: minimum temperature
  1122. * @maxTemp: maximum temperature
  1123. * @thermalEnable: thermal enable
  1124. * @thermal_action: thermal action
  1125. */
  1126. typedef struct {
  1127. uint16_t minTemp;
  1128. uint16_t maxTemp;
  1129. uint8_t thermalEnable;
  1130. enum thermal_mgmt_action_code thermal_action;
  1131. } t_thermal_cmd_params, *tp_thermal_cmd_params;
  1132. /**
  1133. * enum wma_cfg_cmd_id - wma cmd ids
  1134. * @WMA_VDEV_TXRX_FWSTATS_ENABLE_CMDID: txrx firmware stats enable command
  1135. * @WMA_VDEV_TXRX_FWSTATS_RESET_CMDID: txrx firmware stats reset command
  1136. * @WMA_VDEV_MCC_SET_TIME_LATENCY: set MCC latency time
  1137. * @WMA_VDEV_MCC_SET_TIME_QUOTA: set MCC time quota
  1138. * @WMA_VDEV_TXRX_GET_IPA_UC_FW_STATS_CMDID: get IPA microcontroller fw stats
  1139. * @WMA_VDEV_TXRX_GET_IPA_UC_SHARING_STATS_CMDID: get IPA uC wifi-sharing stats
  1140. * @WMA_VDEV_TXRX_SET_IPA_UC_QUOTA_CMDID: set IPA uC quota limit
  1141. *
  1142. * wma command ids for configuration request which
  1143. * does not involve sending a wmi command.
  1144. */
  1145. enum wma_cfg_cmd_id {
  1146. WMA_VDEV_TXRX_FWSTATS_ENABLE_CMDID = WMI_CMDID_MAX,
  1147. WMA_VDEV_TXRX_FWSTATS_RESET_CMDID,
  1148. WMA_VDEV_MCC_SET_TIME_LATENCY,
  1149. WMA_VDEV_MCC_SET_TIME_QUOTA,
  1150. WMA_VDEV_TXRX_GET_IPA_UC_FW_STATS_CMDID,
  1151. WMA_VDEV_TXRX_GET_IPA_UC_SHARING_STATS_CMDID,
  1152. WMA_VDEV_TXRX_SET_IPA_UC_QUOTA_CMDID,
  1153. WMA_CMD_ID_MAX
  1154. };
  1155. /**
  1156. * struct wma_trigger_uapsd_params - trigger uapsd parameters
  1157. * @wmm_ac: wmm access category
  1158. * @user_priority: user priority
  1159. * @service_interval: service interval
  1160. * @suspend_interval: suspend interval
  1161. * @delay_interval: delay interval
  1162. */
  1163. typedef struct wma_trigger_uapsd_params {
  1164. uint32_t wmm_ac;
  1165. uint32_t user_priority;
  1166. uint32_t service_interval;
  1167. uint32_t suspend_interval;
  1168. uint32_t delay_interval;
  1169. } t_wma_trigger_uapsd_params, *tp_wma_trigger_uapsd_params;
  1170. /**
  1171. * enum uapsd_peer_param_max_sp - U-APSD maximum service period of peer station
  1172. * @UAPSD_MAX_SP_LEN_UNLIMITED: unlimited max service period
  1173. * @UAPSD_MAX_SP_LEN_2: max service period = 2
  1174. * @UAPSD_MAX_SP_LEN_4: max service period = 4
  1175. * @UAPSD_MAX_SP_LEN_6: max service period = 6
  1176. */
  1177. enum uapsd_peer_param_max_sp {
  1178. UAPSD_MAX_SP_LEN_UNLIMITED = 0,
  1179. UAPSD_MAX_SP_LEN_2 = 2,
  1180. UAPSD_MAX_SP_LEN_4 = 4,
  1181. UAPSD_MAX_SP_LEN_6 = 6
  1182. };
  1183. /**
  1184. * enum uapsd_peer_param_enabled_ac - U-APSD Enabled AC's of peer station
  1185. * @UAPSD_VO_ENABLED: enable uapsd for voice
  1186. * @UAPSD_VI_ENABLED: enable uapsd for video
  1187. * @UAPSD_BK_ENABLED: enable uapsd for background
  1188. * @UAPSD_BE_ENABLED: enable uapsd for best effort
  1189. */
  1190. enum uapsd_peer_param_enabled_ac {
  1191. UAPSD_VO_ENABLED = 0x01,
  1192. UAPSD_VI_ENABLED = 0x02,
  1193. UAPSD_BK_ENABLED = 0x04,
  1194. UAPSD_BE_ENABLED = 0x08
  1195. };
  1196. /**
  1197. * enum profile_id_t - Firmware profiling index
  1198. * @PROF_CPU_IDLE: cpu idle profile
  1199. * @PROF_PPDU_PROC: ppdu processing profile
  1200. * @PROF_PPDU_POST: ppdu post profile
  1201. * @PROF_HTT_TX_INPUT: htt tx input profile
  1202. * @PROF_MSDU_ENQ: msdu enqueue profile
  1203. * @PROF_PPDU_POST_HAL: ppdu post profile
  1204. * @PROF_COMPUTE_TX_TIME: tx time profile
  1205. * @PROF_MAX_ID: max profile index
  1206. */
  1207. enum profile_id_t {
  1208. PROF_CPU_IDLE,
  1209. PROF_PPDU_PROC,
  1210. PROF_PPDU_POST,
  1211. PROF_HTT_TX_INPUT,
  1212. PROF_MSDU_ENQ,
  1213. PROF_PPDU_POST_HAL,
  1214. PROF_COMPUTE_TX_TIME,
  1215. PROF_MAX_ID,
  1216. };
  1217. /**
  1218. * struct p2p_ie - P2P IE structural definition.
  1219. * @p2p_id: p2p id
  1220. * @p2p_len: p2p length
  1221. * @p2p_oui: p2p OUI
  1222. * @p2p_oui_type: p2p OUI type
  1223. */
  1224. struct p2p_ie {
  1225. uint8_t p2p_id;
  1226. uint8_t p2p_len;
  1227. uint8_t p2p_oui[3];
  1228. uint8_t p2p_oui_type;
  1229. } __packed;
  1230. /**
  1231. * struct p2p_noa_descriptor - noa descriptor
  1232. * @type_count: 255: continuous schedule, 0: reserved
  1233. * @duration: Absent period duration in micro seconds
  1234. * @interval: Absent period interval in micro seconds
  1235. * @start_time: 32 bit tsf time when in starts
  1236. */
  1237. struct p2p_noa_descriptor {
  1238. uint8_t type_count;
  1239. uint32_t duration;
  1240. uint32_t interval;
  1241. uint32_t start_time;
  1242. } __packed;
  1243. /**
  1244. * struct p2p_sub_element_noa - p2p noa element
  1245. * @p2p_sub_id: p2p sub id
  1246. * @p2p_sub_len: p2p sub length
  1247. * @index: identifies instance of NOA su element
  1248. * @oppPS: oppPS state of the AP
  1249. * @ctwindow: ctwindow in TUs
  1250. * @num_descriptors: number of NOA descriptors
  1251. * @noa_descriptors: noa descriptors
  1252. */
  1253. struct p2p_sub_element_noa {
  1254. uint8_t p2p_sub_id;
  1255. uint8_t p2p_sub_len;
  1256. uint8_t index; /* identifies instance of NOA su element */
  1257. uint8_t oppPS:1, /* oppPS state of the AP */
  1258. ctwindow:7; /* ctwindow in TUs */
  1259. uint8_t num_descriptors; /* number of NOA descriptors */
  1260. struct p2p_noa_descriptor noa_descriptors[WMA_MAX_NOA_DESCRIPTORS];
  1261. };
  1262. /**
  1263. * struct wma_decap_info_t - decapsulation info
  1264. * @hdr: header
  1265. * @hdr_len: header length
  1266. */
  1267. struct wma_decap_info_t {
  1268. uint8_t hdr[sizeof(struct ieee80211_qosframe_addr4)];
  1269. int32_t hdr_len;
  1270. };
  1271. /**
  1272. * enum packet_power_save - packet power save params
  1273. * @WMI_VDEV_PPS_PAID_MATCH: paid match param
  1274. * @WMI_VDEV_PPS_GID_MATCH: gid match param
  1275. * @WMI_VDEV_PPS_EARLY_TIM_CLEAR: early tim clear param
  1276. * @WMI_VDEV_PPS_EARLY_DTIM_CLEAR: early dtim clear param
  1277. * @WMI_VDEV_PPS_EOF_PAD_DELIM: eof pad delim param
  1278. * @WMI_VDEV_PPS_MACADDR_MISMATCH: macaddr mismatch param
  1279. * @WMI_VDEV_PPS_DELIM_CRC_FAIL: delim CRC fail param
  1280. * @WMI_VDEV_PPS_GID_NSTS_ZERO: gid nsts zero param
  1281. * @WMI_VDEV_PPS_RSSI_CHECK: RSSI check param
  1282. * @WMI_VDEV_PPS_5G_EBT: 5G ebt param
  1283. */
  1284. typedef enum {
  1285. WMI_VDEV_PPS_PAID_MATCH = 0,
  1286. WMI_VDEV_PPS_GID_MATCH = 1,
  1287. WMI_VDEV_PPS_EARLY_TIM_CLEAR = 2,
  1288. WMI_VDEV_PPS_EARLY_DTIM_CLEAR = 3,
  1289. WMI_VDEV_PPS_EOF_PAD_DELIM = 4,
  1290. WMI_VDEV_PPS_MACADDR_MISMATCH = 5,
  1291. WMI_VDEV_PPS_DELIM_CRC_FAIL = 6,
  1292. WMI_VDEV_PPS_GID_NSTS_ZERO = 7,
  1293. WMI_VDEV_PPS_RSSI_CHECK = 8,
  1294. WMI_VDEV_VHT_SET_GID_MGMT = 9,
  1295. WMI_VDEV_PPS_5G_EBT = 10
  1296. } packet_power_save;
  1297. /**
  1298. * enum green_tx_param - green tx parameters
  1299. * @wmi_vdev_param_gtx_ht_mcs: ht mcs param
  1300. * @wmi_vdev_param_gtx_vht_mcs: vht mcs param
  1301. * @wmi_vdev_param_gtx_usr_cfg: user cfg param
  1302. * @wmi_vdev_param_gtx_thre: thre param
  1303. * @wmi_vdev_param_gtx_margin: green tx margin param
  1304. * @wmi_vdev_param_gtx_step: green tx step param
  1305. * @wmi_vdev_param_gtx_mintpc: mintpc param
  1306. * @wmi_vdev_param_gtx_bw_mask: bandwidth mask
  1307. */
  1308. typedef enum {
  1309. wmi_vdev_param_gtx_ht_mcs,
  1310. wmi_vdev_param_gtx_vht_mcs,
  1311. wmi_vdev_param_gtx_usr_cfg,
  1312. wmi_vdev_param_gtx_thre,
  1313. wmi_vdev_param_gtx_margin,
  1314. wmi_vdev_param_gtx_step,
  1315. wmi_vdev_param_gtx_mintpc,
  1316. wmi_vdev_param_gtx_bw_mask,
  1317. } green_tx_param;
  1318. /**
  1319. * enum uapsd_ac - U-APSD Access Categories
  1320. * @UAPSD_BE: best effort
  1321. * @UAPSD_BK: back ground
  1322. * @UAPSD_VI: video
  1323. * @UAPSD_VO: voice
  1324. */
  1325. enum uapsd_ac {
  1326. UAPSD_BE,
  1327. UAPSD_BK,
  1328. UAPSD_VI,
  1329. UAPSD_VO
  1330. };
  1331. /**
  1332. * wma_disable_uapsd_per_ac() - disable uapsd per ac
  1333. * @wmi_handle: wma handle
  1334. * @vdev_id: vdev id
  1335. * @ac: access category
  1336. *
  1337. * Return: QDF_STATUS_SUCCESS for success or error code.
  1338. */
  1339. QDF_STATUS wma_disable_uapsd_per_ac(tp_wma_handle wma_handle,
  1340. uint32_t vdev_id, enum uapsd_ac ac);
  1341. /**
  1342. * enum uapsd_up - U-APSD User Priorities
  1343. * @UAPSD_UP_BE: best effort
  1344. * @UAPSD_UP_BK: back ground
  1345. * @UAPSD_UP_RESV: reserve
  1346. * @UAPSD_UP_EE: Excellent Effort
  1347. * @UAPSD_UP_CL: Critical Applications
  1348. * @UAPSD_UP_VI: video
  1349. * @UAPSD_UP_VO: voice
  1350. * @UAPSD_UP_NC: Network Control
  1351. */
  1352. enum uapsd_up {
  1353. UAPSD_UP_BE,
  1354. UAPSD_UP_BK,
  1355. UAPSD_UP_RESV,
  1356. UAPSD_UP_EE,
  1357. UAPSD_UP_CL,
  1358. UAPSD_UP_VI,
  1359. UAPSD_UP_VO,
  1360. UAPSD_UP_NC,
  1361. UAPSD_UP_MAX
  1362. };
  1363. /**
  1364. * wma_trigger_uapsd_params() - set trigger uapsd parameter
  1365. * @wmi_handle: wma handle
  1366. * @vdev_id: vdev id
  1367. * @trigger_uapsd_params: trigger uapsd parameters
  1368. *
  1369. * This function sets the trigger uapsd
  1370. * params such as service interval, delay
  1371. * interval and suspend interval which
  1372. * will be used by the firmware to send
  1373. * trigger frames periodically when there
  1374. * is no traffic on the transmit side.
  1375. *
  1376. * Return: QDF_STATUS_SUCCESS for success or error code.
  1377. */
  1378. QDF_STATUS wma_trigger_uapsd_params(tp_wma_handle wma_handle, uint32_t vdev_id,
  1379. tp_wma_trigger_uapsd_params
  1380. trigger_uapsd_params);
  1381. void wma_send_flush_logs_to_fw(tp_wma_handle wma_handle);
  1382. void wma_log_completion_timeout(void *data);
  1383. #ifdef FEATURE_RSSI_MONITOR
  1384. /**
  1385. * wma_set_rssi_monitoring() - set rssi monitoring
  1386. * @handle: WMA handle
  1387. * @req: rssi monitoring request structure
  1388. *
  1389. * This function takes the incoming @req and sends it down to the
  1390. * firmware
  1391. *
  1392. * Return: QDF_STATUS
  1393. */
  1394. QDF_STATUS wma_set_rssi_monitoring(tp_wma_handle wma,
  1395. struct rssi_monitor_param *req);
  1396. #else /* FEATURE_RSSI_MONITOR */
  1397. static inline
  1398. QDF_STATUS wma_set_rssi_monitoring(tp_wma_handle wma,
  1399. struct rssi_monitor_param *req)
  1400. {
  1401. return QDF_STATUS_SUCCESS;
  1402. }
  1403. #endif /* FEATURE_RSSI_MONITOR */
  1404. /**
  1405. * wma_map_pcl_weights - Map WMA pcl weights to wmi pcl weights
  1406. * @pcl_weight: Input PCL weight to be converted to wmi format
  1407. *
  1408. * Return: wmi_pcl_chan_weight
  1409. */
  1410. wmi_pcl_chan_weight wma_map_pcl_weights(uint32_t pcl_weight);
  1411. QDF_STATUS wma_send_set_pcl_cmd(tp_wma_handle wma_handle,
  1412. struct set_pcl_req *msg);
  1413. QDF_STATUS wma_send_pdev_set_hw_mode_cmd(tp_wma_handle wma_handle,
  1414. struct policy_mgr_hw_mode *msg);
  1415. QDF_STATUS wma_send_pdev_set_dual_mac_config(tp_wma_handle wma_handle,
  1416. struct policy_mgr_dual_mac_config *msg);
  1417. QDF_STATUS wma_send_pdev_set_antenna_mode(tp_wma_handle wma_handle,
  1418. struct sir_antenna_mode_param *msg);
  1419. struct wma_target_req *wma_fill_hold_req(tp_wma_handle wma,
  1420. uint8_t vdev_id, uint32_t msg_type,
  1421. uint8_t type, void *params,
  1422. uint32_t timeout);
  1423. int wma_mgmt_tx_completion_handler(void *handle, uint8_t *cmpl_event_params,
  1424. uint32_t len);
  1425. int wma_mgmt_tx_bundle_completion_handler(void *handle,
  1426. uint8_t *cmpl_event_params, uint32_t len);
  1427. uint32_t wma_get_vht_ch_width(void);
  1428. #ifdef WLAN_FEATURE_11BE
  1429. /**
  1430. * wma_get_orig_eht_ch_width() - Get original EHT channel width supported
  1431. *
  1432. * API to get original EHT channel width
  1433. *
  1434. * Return: void
  1435. */
  1436. uint32_t wma_get_orig_eht_ch_width(void);
  1437. /**
  1438. * wma_get_orig_eht_ch_width() - Get current EHT channel width supported
  1439. *
  1440. * API to get current EHT channel width
  1441. *
  1442. * Return: void
  1443. */
  1444. uint32_t wma_get_eht_ch_width(void);
  1445. #else
  1446. static inline uint32_t wma_get_orig_eht_ch_width(void)
  1447. {
  1448. return 0;
  1449. }
  1450. static inline uint32_t wma_get_eht_ch_width(void)
  1451. {
  1452. return 0;
  1453. }
  1454. #endif
  1455. QDF_STATUS
  1456. wma_config_debug_module_cmd(wmi_unified_t wmi_handle, A_UINT32 param,
  1457. A_UINT32 val, A_UINT32 *module_id_bitmap,
  1458. A_UINT32 bitmap_len);
  1459. #ifdef FEATURE_LFR_SUBNET_DETECTION
  1460. /**
  1461. * wma_set_gateway_params() - set gateway parameters
  1462. * @wma: WMA handle
  1463. * @req: gateway update request parameter structure
  1464. *
  1465. * This function takes the incoming @req and sends it down to the
  1466. * firmware
  1467. *
  1468. * Return: QDF_STATUS
  1469. */
  1470. QDF_STATUS wma_set_gateway_params(tp_wma_handle wma,
  1471. struct gateway_update_req_param *req);
  1472. #else
  1473. static inline
  1474. QDF_STATUS wma_set_gateway_params(tp_wma_handle wma,
  1475. struct gateway_update_req_param *req)
  1476. {
  1477. return QDF_STATUS_SUCCESS;
  1478. }
  1479. #endif /* FEATURE_LFR_SUBNET_DETECTION */
  1480. QDF_STATUS wma_ht40_stop_obss_scan(tp_wma_handle wma_handle,
  1481. int32_t vdev_id);
  1482. QDF_STATUS wma_process_fw_test_cmd(WMA_HANDLE handle,
  1483. struct set_fwtest_params *wma_fwtest);
  1484. QDF_STATUS wma_send_ht40_obss_scanind(tp_wma_handle wma,
  1485. struct obss_ht40_scanind *req);
  1486. uint32_t wma_get_num_of_setbits_from_bitmask(uint32_t mask);
  1487. #ifdef FEATURE_WLAN_APF
  1488. /**
  1489. * wma_get_apf_caps_event_handler() - Event handler for get apf capability
  1490. * @handle: WMA global handle
  1491. * @cmd_param_info: command event data
  1492. * @len: Length of @cmd_param_info
  1493. *
  1494. * Return: 0 on Success or Errno on failure
  1495. */
  1496. int wma_get_apf_caps_event_handler(void *handle,
  1497. u_int8_t *cmd_param_info,
  1498. u_int32_t len);
  1499. /**
  1500. * wma_get_apf_capabilities - Send get apf capability to firmware
  1501. * @wma_handle: wma handle
  1502. *
  1503. * Return: QDF_STATUS enumeration.
  1504. */
  1505. QDF_STATUS wma_get_apf_capabilities(tp_wma_handle wma);
  1506. /**
  1507. * wma_set_apf_instructions - Set apf instructions to firmware
  1508. * @wma: wma handle
  1509. * @apf_set_offload: APF offload information to set to firmware
  1510. *
  1511. * Return: QDF_STATUS enumeration
  1512. */
  1513. QDF_STATUS
  1514. wma_set_apf_instructions(tp_wma_handle wma,
  1515. struct sir_apf_set_offload *apf_set_offload);
  1516. /**
  1517. * wma_send_apf_enable_cmd - Send apf enable/disable cmd
  1518. * @wma_handle: wma handle
  1519. * @vdev_id: vdev id
  1520. * @apf_enable: true: Enable APF Int., false: Disable APF Int.
  1521. *
  1522. * Return: QDF_STATUS enumeration.
  1523. */
  1524. QDF_STATUS wma_send_apf_enable_cmd(WMA_HANDLE handle, uint8_t vdev_id,
  1525. bool apf_enable);
  1526. /**
  1527. * wma_send_apf_write_work_memory_cmd - Command to write into the apf work
  1528. * memory
  1529. * @wma_handle: wma handle
  1530. * @write_params: APF parameters for the write operation
  1531. *
  1532. * Return: QDF_STATUS enumeration.
  1533. */
  1534. QDF_STATUS
  1535. wma_send_apf_write_work_memory_cmd(WMA_HANDLE handle,
  1536. struct wmi_apf_write_memory_params
  1537. *write_params);
  1538. /**
  1539. * wma_send_apf_read_work_memory_cmd - Command to get part of apf work memory
  1540. * @wma_handle: wma handle
  1541. * @callback: HDD callback to receive apf get mem event
  1542. * @context: Context for the HDD callback
  1543. * @read_params: APF parameters for the get operation
  1544. *
  1545. * Return: QDF_STATUS enumeration.
  1546. */
  1547. QDF_STATUS
  1548. wma_send_apf_read_work_memory_cmd(WMA_HANDLE handle,
  1549. struct wmi_apf_read_memory_params
  1550. *read_params);
  1551. /**
  1552. * wma_apf_read_work_memory_event_handler - Event handler for get apf mem
  1553. * operation
  1554. * @handle: wma handle
  1555. * @evt_buf: Buffer pointer to the event
  1556. * @len: Length of the event buffer
  1557. *
  1558. * Return: status.
  1559. */
  1560. int wma_apf_read_work_memory_event_handler(void *handle, uint8_t *evt_buf,
  1561. uint32_t len);
  1562. #else /* FEATURE_WLAN_APF */
  1563. static inline QDF_STATUS wma_get_apf_capabilities(tp_wma_handle wma)
  1564. {
  1565. return QDF_STATUS_SUCCESS;
  1566. }
  1567. static inline QDF_STATUS
  1568. wma_set_apf_instructions(tp_wma_handle wma,
  1569. struct sir_apf_set_offload *apf_set_offload)
  1570. {
  1571. return QDF_STATUS_SUCCESS;
  1572. }
  1573. #endif /* FEATURE_WLAN_APF */
  1574. void wma_process_set_pdev_ie_req(tp_wma_handle wma,
  1575. struct set_ie_param *ie_params);
  1576. void wma_process_set_pdev_ht_ie_req(tp_wma_handle wma,
  1577. struct set_ie_param *ie_params);
  1578. void wma_process_set_pdev_vht_ie_req(tp_wma_handle wma,
  1579. struct set_ie_param *ie_params);
  1580. QDF_STATUS wma_remove_peer(tp_wma_handle wma, uint8_t *mac_addr,
  1581. uint8_t vdev_id, bool no_fw_peer_delete);
  1582. /**
  1583. * wma_create_peer() - Call wma_add_peer() to send peer create command to fw
  1584. * and setup cdp peer
  1585. * @wma: wma handle
  1586. * @peer_addr: peer mac address
  1587. * @peer_type: peer type
  1588. * @vdev_id: vdev id
  1589. * @peer_mld_addr: peer mld address
  1590. * @is_assoc_peer: is assoc peer or not
  1591. *
  1592. * Return: QDF_STATUS
  1593. */
  1594. QDF_STATUS wma_create_peer(tp_wma_handle wma,
  1595. uint8_t peer_addr[QDF_MAC_ADDR_SIZE],
  1596. u_int32_t peer_type, u_int8_t vdev_id,
  1597. uint8_t peer_mld_addr[QDF_MAC_ADDR_SIZE],
  1598. bool is_assoc_peer);
  1599. /**
  1600. * wma_create_objmgr_peer() - create objmgr peer information in host driver
  1601. * @wma: wma handle
  1602. * @vdev_id: vdev id
  1603. * @peer_addr: peer mac address
  1604. * @wma_peer_type: peer type of enum wmi_peer_type
  1605. * @peer_mld: peer mld address
  1606. *
  1607. * Return: Pointer to objmgr_peer
  1608. */
  1609. struct wlan_objmgr_peer *wma_create_objmgr_peer(tp_wma_handle wma,
  1610. uint8_t vdev_id,
  1611. uint8_t *peer_addr,
  1612. uint32_t wma_peer_type,
  1613. uint8_t *peer_mld);
  1614. /**
  1615. * wma_remove_objmgr_peer() - Remove Object manager peer
  1616. * @wma: WMA handle
  1617. * @obj_vdev: Vdev object pointer
  1618. * @peer_addr: Peer mac address
  1619. *
  1620. * Return: None
  1621. */
  1622. void wma_remove_objmgr_peer(tp_wma_handle wma,
  1623. struct wlan_objmgr_vdev *obj_vdev,
  1624. uint8_t *peer_addr);
  1625. QDF_STATUS wma_peer_unmap_conf_cb(uint8_t vdev_id,
  1626. uint32_t peer_id_cnt,
  1627. uint16_t *peer_id_list);
  1628. bool wma_objmgr_peer_exist(tp_wma_handle wma,
  1629. uint8_t *peer_addr, uint8_t *peer_vdev_id);
  1630. /**
  1631. * wma_get_cca_stats() - send request to fw to get CCA
  1632. * @wmi_hdl: wma handle
  1633. * @vdev_id: vdev id
  1634. *
  1635. * Return: QDF status
  1636. */
  1637. QDF_STATUS wma_get_cca_stats(tp_wma_handle wma_handle,
  1638. uint8_t vdev_id);
  1639. struct wma_ini_config *wma_get_ini_handle(tp_wma_handle wma_handle);
  1640. /**
  1641. * wma_chan_phy__mode() - get host phymode for channel
  1642. * @freq: channel freq
  1643. * @chan_width: maximum channel width possible
  1644. * @dot11_mode: maximum phy_mode possible
  1645. *
  1646. * Return: return host phymode
  1647. */
  1648. enum wlan_phymode wma_chan_phy_mode(uint32_t freq, enum phy_ch_width chan_width,
  1649. uint8_t dot11_mode);
  1650. /**
  1651. * wma_fw_to_host_phymode() - convert fw to host phymode
  1652. * @phymode: phymode to convert
  1653. *
  1654. * Return: one of the values defined in enum wlan_phymode;
  1655. * or WLAN_PHYMODE_AUTO if the conversion fails
  1656. */
  1657. enum wlan_phymode wma_fw_to_host_phymode(WMI_HOST_WLAN_PHY_MODE phymode);
  1658. #ifdef FEATURE_OEM_DATA_SUPPORT
  1659. /**
  1660. * wma_start_oem_req_cmd() - send oem request command to fw
  1661. * @wma_handle: wma handle
  1662. * @oem_data_req: the pointer of oem req buf
  1663. *
  1664. * Return: QDF status
  1665. */
  1666. QDF_STATUS wma_start_oem_req_cmd(tp_wma_handle wma_handle,
  1667. struct oem_data_req *oem_data_req);
  1668. #endif
  1669. #ifdef FEATURE_OEM_DATA
  1670. /**
  1671. * wma_start_oem_data_cmd() - send oem data command to fw
  1672. * @wma_handle: wma handle
  1673. * @oem_data: the pointer of oem data buf
  1674. *
  1675. * Return: QDF status
  1676. */
  1677. QDF_STATUS wma_start_oem_data_cmd(tp_wma_handle wma_handle,
  1678. struct oem_data *oem_data);
  1679. #endif
  1680. QDF_STATUS wma_enable_disable_caevent_ind(tp_wma_handle wma_handle,
  1681. uint8_t val);
  1682. void wma_register_packetdump_callback(
  1683. ol_txrx_pktdump_cb wma_mgmt_tx_packetdump_cb,
  1684. ol_txrx_pktdump_cb wma_mgmt_rx_packetdump_cb);
  1685. void wma_deregister_packetdump_callback(void);
  1686. void wma_update_sta_inactivity_timeout(tp_wma_handle wma,
  1687. struct sme_sta_inactivity_timeout *sta_inactivity_timer);
  1688. /**
  1689. * wma_form_rx_packet() - form rx cds packet
  1690. * @buf: buffer
  1691. * @mgmt_rx_params: mgmt rx params
  1692. * @rx_pkt: cds packet
  1693. *
  1694. * This functions forms a cds packet from the rx mgmt frame received.
  1695. *
  1696. * Return: 0 for success or error code
  1697. */
  1698. int wma_form_rx_packet(qdf_nbuf_t buf,
  1699. struct mgmt_rx_event_params *mgmt_rx_params,
  1700. cds_pkt_t *rx_pkt);
  1701. /**
  1702. * wma_mgmt_unified_cmd_send() - send the mgmt tx packet
  1703. * @vdev: objmgr vdev
  1704. * @buf: buffer
  1705. * @desc_id: desc id
  1706. * @mgmt_tx_params: mgmt rx params
  1707. *
  1708. * This functions sends mgmt tx packet to WMI layer.
  1709. *
  1710. * Return: 0 for success or error code
  1711. */
  1712. QDF_STATUS wma_mgmt_unified_cmd_send(struct wlan_objmgr_vdev *vdev,
  1713. qdf_nbuf_t buf, uint32_t desc_id,
  1714. void *mgmt_tx_params);
  1715. #ifndef CONFIG_HL_SUPPORT
  1716. /**
  1717. * wma_mgmt_nbuf_unmap_cb() - dma unmap for pending mgmt pkts
  1718. * @pdev: objmgr pdev
  1719. * @buf: buffer
  1720. *
  1721. * This function does the dma unmap of the pending mgmt packet cleanup
  1722. *
  1723. * Return: None
  1724. */
  1725. void wma_mgmt_nbuf_unmap_cb(struct wlan_objmgr_pdev *pdev,
  1726. qdf_nbuf_t buf);
  1727. /**
  1728. * wma_mgmt_nbuf_unmap_cb() - dma unmap for pending mgmt pkts
  1729. * @pdev: objmgr pdev
  1730. * @buf: buffer
  1731. *
  1732. * This is a cb function drains all mgmt packets of a vdev.
  1733. * This is called in event of target going down without sending completions.
  1734. *
  1735. * Return: QDF_STATUS
  1736. */
  1737. QDF_STATUS wma_mgmt_frame_fill_peer_cb(struct wlan_objmgr_peer *peer,
  1738. qdf_nbuf_t buf);
  1739. #else
  1740. static inline void wma_mgmt_nbuf_unmap_cb(struct wlan_objmgr_pdev *pdev,
  1741. qdf_nbuf_t buf)
  1742. {}
  1743. static inline QDF_STATUS wma_mgmt_frame_fill_peer_cb(struct wlan_objmgr_peer *peer,
  1744. qdf_nbuf_t buf)
  1745. {
  1746. return QDF_STATUS_SUCCESS;
  1747. }
  1748. #endif
  1749. /**
  1750. * wma_chan_info_event_handler() - chan info event handler
  1751. * @handle: wma handle
  1752. * @event_buf: event handler data
  1753. * @len: length of @event_buf
  1754. *
  1755. * this function will handle the WMI_CHAN_INFO_EVENTID
  1756. *
  1757. * Return: int
  1758. */
  1759. int wma_chan_info_event_handler(void *handle, uint8_t *event_buf,
  1760. uint32_t len);
  1761. /**
  1762. * wma_update_vdev_pause_bitmap() - update vdev pause bitmap
  1763. * @vdev_id: the Id of the vdev to configure
  1764. * @value: value pause bitmap value
  1765. *
  1766. * Return: None
  1767. */
  1768. static inline
  1769. void wma_vdev_update_pause_bitmap(uint8_t vdev_id, uint16_t value)
  1770. {
  1771. tp_wma_handle wma = (tp_wma_handle)cds_get_context(QDF_MODULE_ID_WMA);
  1772. struct wma_txrx_node *iface;
  1773. if (!wma)
  1774. return;
  1775. if (vdev_id >= wma->max_bssid) {
  1776. wma_err("Invalid vdev_id: %d", vdev_id);
  1777. return;
  1778. }
  1779. iface = &wma->interfaces[vdev_id];
  1780. if (!iface) {
  1781. wma_err("Interface is NULL");
  1782. return;
  1783. }
  1784. iface->pause_bitmap = value;
  1785. }
  1786. /**
  1787. * wma_vdev_get_pause_bitmap() - Get vdev pause bitmap
  1788. * @vdev_id: the Id of the vdev to configure
  1789. *
  1790. * Return: Vdev pause bitmap value else 0 on error
  1791. */
  1792. static inline
  1793. uint16_t wma_vdev_get_pause_bitmap(uint8_t vdev_id)
  1794. {
  1795. tp_wma_handle wma = (tp_wma_handle)cds_get_context(QDF_MODULE_ID_WMA);
  1796. struct wma_txrx_node *iface;
  1797. if (!wma)
  1798. return 0;
  1799. iface = &wma->interfaces[vdev_id];
  1800. if (!iface) {
  1801. wma_err("Interface is NULL");
  1802. return 0;
  1803. }
  1804. return iface->pause_bitmap;
  1805. }
  1806. /**
  1807. * wma_vdev_is_device_in_low_pwr_mode - is device in power save mode
  1808. * @vdev_id: the Id of the vdev to configure
  1809. *
  1810. * Return: true if device is in low power mode else false
  1811. */
  1812. static inline bool wma_vdev_is_device_in_low_pwr_mode(uint8_t vdev_id)
  1813. {
  1814. tp_wma_handle wma = (tp_wma_handle)cds_get_context(QDF_MODULE_ID_WMA);
  1815. struct wma_txrx_node *iface;
  1816. if (!wma)
  1817. return 0;
  1818. iface = &wma->interfaces[vdev_id];
  1819. if (!iface) {
  1820. wma_err("Interface is NULL");
  1821. return 0;
  1822. }
  1823. return iface->in_bmps || wma->in_imps;
  1824. }
  1825. /**
  1826. * wma_vdev_get_dtim_period - Get dtim period value from mlme
  1827. * @vdev_id: vdev index number
  1828. * @value: pointer to the value to fill out
  1829. *
  1830. * Note caller must verify return status before using value
  1831. *
  1832. * Return: QDF_STATUS_SUCCESS when fetched a valid value from cfg else
  1833. * QDF_STATUS_E_FAILURE
  1834. */
  1835. static inline
  1836. QDF_STATUS wma_vdev_get_dtim_period(uint8_t vdev_id, uint8_t *value)
  1837. {
  1838. tp_wma_handle wma = (tp_wma_handle)cds_get_context(QDF_MODULE_ID_WMA);
  1839. struct wma_txrx_node *iface;
  1840. /* set value to zero */
  1841. *value = 0;
  1842. if (!wma)
  1843. return QDF_STATUS_E_FAILURE;
  1844. iface = &wma->interfaces[vdev_id];
  1845. if (!iface)
  1846. return QDF_STATUS_E_FAILURE;
  1847. *value = iface->dtimPeriod;
  1848. return QDF_STATUS_SUCCESS;
  1849. }
  1850. /**
  1851. * wma_vdev_get_beacon_interval - Get beacon interval from mlme
  1852. * @vdev_id: vdev index number
  1853. * @value: pointer to the value to fill out
  1854. *
  1855. * Note caller must verify return status before using value
  1856. *
  1857. * Return: QDF_STATUS_SUCCESS when fetched a valid value from cfg else
  1858. * QDF_STATUS_E_FAILURE
  1859. */
  1860. static inline
  1861. QDF_STATUS wma_vdev_get_beacon_interval(uint8_t vdev_id, uint16_t *value)
  1862. {
  1863. tp_wma_handle wma = (tp_wma_handle)cds_get_context(QDF_MODULE_ID_WMA);
  1864. struct wma_txrx_node *iface;
  1865. /* set value to zero */
  1866. *value = 0;
  1867. if (!wma)
  1868. return QDF_STATUS_E_FAILURE;
  1869. iface = &wma->interfaces[vdev_id];
  1870. if (!iface)
  1871. return QDF_STATUS_E_FAILURE;
  1872. *value = iface->beaconInterval;
  1873. return QDF_STATUS_SUCCESS;
  1874. }
  1875. /**
  1876. * wma_get_vdev_rate_flag - Get beacon rate flag from mlme
  1877. * @vdev_id: vdev index number
  1878. * @rate_flag: pointer to the value to fill out
  1879. *
  1880. * Note caller must verify return status before using value
  1881. *
  1882. * Return: QDF_STATUS_SUCCESS when fetched a valid value from mlme else
  1883. * QDF_STATUS_E_FAILURE
  1884. */
  1885. static inline QDF_STATUS
  1886. wma_get_vdev_rate_flag(struct wlan_objmgr_vdev *vdev, uint32_t *rate_flag)
  1887. {
  1888. struct vdev_mlme_obj *mlme_obj;
  1889. if (!vdev) {
  1890. wma_err("vdev is NULL");
  1891. return QDF_STATUS_E_FAILURE;
  1892. }
  1893. mlme_obj = wlan_vdev_mlme_get_cmpt_obj(vdev);
  1894. if (!mlme_obj) {
  1895. wma_err("ailed to get mlme_obj");
  1896. return QDF_STATUS_E_FAILURE;
  1897. }
  1898. *rate_flag = mlme_obj->mgmt.rate_info.rate_flags;
  1899. return QDF_STATUS_SUCCESS;
  1900. }
  1901. /**
  1902. * wma_vdev_set_pause_bit() - Set a bit in vdev pause bitmap
  1903. * @vdev_id: the Id of the vdev to configure
  1904. * @bit_pos: set bit position in pause bitmap
  1905. *
  1906. * Return: None
  1907. */
  1908. static inline
  1909. void wma_vdev_set_pause_bit(uint8_t vdev_id, wmi_tx_pause_type bit_pos)
  1910. {
  1911. tp_wma_handle wma = (tp_wma_handle)cds_get_context(QDF_MODULE_ID_WMA);
  1912. struct wma_txrx_node *iface;
  1913. if (!wma)
  1914. return;
  1915. iface = &wma->interfaces[vdev_id];
  1916. if (!iface) {
  1917. wma_err("Interface is NULL");
  1918. return;
  1919. }
  1920. iface->pause_bitmap |= (1 << bit_pos);
  1921. }
  1922. /**
  1923. * wma_vdev_clear_pause_bit() - Clear a bit from vdev pause bitmap
  1924. * @vdev_id: the Id of the vdev to configure
  1925. * @bit_pos: set bit position in pause bitmap
  1926. *
  1927. * Return: None
  1928. */
  1929. static inline
  1930. void wma_vdev_clear_pause_bit(uint8_t vdev_id, wmi_tx_pause_type bit_pos)
  1931. {
  1932. tp_wma_handle wma = (tp_wma_handle)cds_get_context(QDF_MODULE_ID_WMA);
  1933. struct wma_txrx_node *iface;
  1934. if (!wma)
  1935. return;
  1936. iface = &wma->interfaces[vdev_id];
  1937. if (!iface) {
  1938. wma_err("Interface is NULL");
  1939. return;
  1940. }
  1941. iface->pause_bitmap &= ~(1 << bit_pos);
  1942. }
  1943. #ifdef WLAN_FEATURE_ROAM_OFFLOAD
  1944. /**
  1945. * wma_send_roam_preauth_status() - Send the preauth status to wmi
  1946. * @handle: WMA handle
  1947. * @roam_req: Pointer to wmi_roam_auth_status_params from sae
  1948. *
  1949. * Return: None
  1950. */
  1951. void
  1952. wma_send_roam_preauth_status(tp_wma_handle wma_handle,
  1953. struct wmi_roam_auth_status_params *params);
  1954. /**
  1955. * wma_handle_roam_sync_timeout() - Update roaming status at wma layer
  1956. * @wma_handle: wma handle
  1957. * @info: Info for roaming start timer
  1958. *
  1959. * This function gets called in case of roaming offload timer get expired
  1960. *
  1961. * Return: None
  1962. */
  1963. void wma_handle_roam_sync_timeout(tp_wma_handle wma_handle,
  1964. struct roam_sync_timeout_timer_info *info);
  1965. #else
  1966. static inline void
  1967. wma_send_roam_preauth_status(tp_wma_handle wma_handle,
  1968. struct wmi_roam_auth_status_params *params)
  1969. {}
  1970. static inline void
  1971. wma_handle_roam_sync_timeout(tp_wma_handle wma_handle,
  1972. struct roam_sync_timeout_timer_info *info)
  1973. {}
  1974. #endif
  1975. #ifdef WMI_INTERFACE_EVENT_LOGGING
  1976. static inline void wma_print_wmi_cmd_log(uint32_t count,
  1977. qdf_abstract_print *print,
  1978. void *print_priv)
  1979. {
  1980. t_wma_handle *wma = cds_get_context(QDF_MODULE_ID_WMA);
  1981. if (wma) {
  1982. print(print_priv, "Command Log (count %u)", count);
  1983. wmi_print_cmd_log(wma->wmi_handle, count, print, print_priv);
  1984. }
  1985. }
  1986. static inline void wma_print_wmi_cmd_tx_cmp_log(uint32_t count,
  1987. qdf_abstract_print *print,
  1988. void *print_priv)
  1989. {
  1990. t_wma_handle *wma = cds_get_context(QDF_MODULE_ID_WMA);
  1991. if (wma) {
  1992. print(print_priv, "Command Tx Complete Log (count %u)", count);
  1993. wmi_print_cmd_tx_cmp_log(wma->wmi_handle, count, print,
  1994. print_priv);
  1995. }
  1996. }
  1997. static inline void wma_print_wmi_mgmt_cmd_log(uint32_t count,
  1998. qdf_abstract_print *print,
  1999. void *print_priv)
  2000. {
  2001. t_wma_handle *wma = cds_get_context(QDF_MODULE_ID_WMA);
  2002. if (wma) {
  2003. print(print_priv, "Management Command Log (count %u)", count);
  2004. wmi_print_mgmt_cmd_log(wma->wmi_handle, count, print,
  2005. print_priv);
  2006. }
  2007. }
  2008. static inline void wma_print_wmi_mgmt_cmd_tx_cmp_log(uint32_t count,
  2009. qdf_abstract_print *print,
  2010. void *print_priv)
  2011. {
  2012. t_wma_handle *wma = cds_get_context(QDF_MODULE_ID_WMA);
  2013. if (wma) {
  2014. print(print_priv,
  2015. "Management Command Tx Complete Log (count %u)", count);
  2016. wmi_print_mgmt_cmd_tx_cmp_log(wma->wmi_handle, count, print,
  2017. print_priv);
  2018. }
  2019. }
  2020. static inline void wma_print_wmi_event_log(uint32_t count,
  2021. qdf_abstract_print *print,
  2022. void *print_priv)
  2023. {
  2024. t_wma_handle *wma = cds_get_context(QDF_MODULE_ID_WMA);
  2025. if (wma) {
  2026. print(print_priv, "Event Log (count %u)", count);
  2027. wmi_print_event_log(wma->wmi_handle, count, print, print_priv);
  2028. }
  2029. }
  2030. static inline void wma_print_wmi_rx_event_log(uint32_t count,
  2031. qdf_abstract_print *print,
  2032. void *print_priv)
  2033. {
  2034. t_wma_handle *wma = cds_get_context(QDF_MODULE_ID_WMA);
  2035. if (wma) {
  2036. print(print_priv, "Rx Event Log (count %u)", count);
  2037. wmi_print_rx_event_log(wma->wmi_handle, count, print,
  2038. print_priv);
  2039. }
  2040. }
  2041. static inline void wma_print_wmi_mgmt_event_log(uint32_t count,
  2042. qdf_abstract_print *print,
  2043. void *print_priv)
  2044. {
  2045. t_wma_handle *wma = cds_get_context(QDF_MODULE_ID_WMA);
  2046. if (wma) {
  2047. print(print_priv, "Management Event Log (count %u)", count);
  2048. wmi_print_mgmt_event_log(wma->wmi_handle, count, print,
  2049. print_priv);
  2050. }
  2051. }
  2052. #else
  2053. static inline void wma_print_wmi_cmd_log(uint32_t count,
  2054. qdf_abstract_print *print,
  2055. void *print_priv)
  2056. {
  2057. }
  2058. static inline void wma_print_wmi_cmd_tx_cmp_log(uint32_t count,
  2059. qdf_abstract_print *print,
  2060. void *print_priv)
  2061. {
  2062. }
  2063. static inline void wma_print_wmi_mgmt_cmd_log(uint32_t count,
  2064. qdf_abstract_print *print,
  2065. void *print_priv)
  2066. {
  2067. }
  2068. static inline void wma_print_wmi_mgmt_cmd_tx_cmp_log(uint32_t count,
  2069. qdf_abstract_print *print,
  2070. void *print_priv)
  2071. {
  2072. }
  2073. static inline void wma_print_wmi_event_log(uint32_t count,
  2074. qdf_abstract_print *print,
  2075. void *print_priv)
  2076. {
  2077. }
  2078. static inline void wma_print_wmi_rx_event_log(uint32_t count,
  2079. qdf_abstract_print *print,
  2080. void *print_priv)
  2081. {
  2082. }
  2083. static inline void wma_print_wmi_mgmt_event_log(uint32_t count,
  2084. qdf_abstract_print *print,
  2085. void *print_priv)
  2086. {
  2087. }
  2088. #endif /* WMI_INTERFACE_EVENT_LOGGING */
  2089. /**
  2090. * wma_set_rx_reorder_timeout_val() - set rx recorder timeout value
  2091. * @wma_handle: pointer to wma handle
  2092. * @reorder_timeout: rx reorder timeout value
  2093. *
  2094. * Return: QDF_STATUS
  2095. */
  2096. QDF_STATUS wma_set_rx_reorder_timeout_val(tp_wma_handle wma_handle,
  2097. struct sir_set_rx_reorder_timeout_val *reorder_timeout);
  2098. /**
  2099. * wma_set_rx_blocksize() - set rx blocksize
  2100. * @wma_handle: pointer to wma handle
  2101. * @peer_rx_blocksize: rx blocksize for peer mac
  2102. *
  2103. * Return: QDF_STATUS_SUCCESS for success or error code.
  2104. */
  2105. QDF_STATUS wma_set_rx_blocksize(tp_wma_handle wma_handle,
  2106. struct sir_peer_set_rx_blocksize *peer_rx_blocksize);
  2107. /**
  2108. * wma_configure_smps_params() - Configures the smps parameters to set
  2109. * @vdev_id: Virtual device for the command
  2110. * @param_id: SMPS parameter ID
  2111. * @param_val: Value to be set for the parameter
  2112. * Return: QDF_STATUS_SUCCESS or non-zero on failure
  2113. */
  2114. QDF_STATUS wma_configure_smps_params(uint32_t vdev_id, uint32_t param_id,
  2115. uint32_t param_val);
  2116. /*
  2117. * wma_chip_power_save_failure_detected_handler() - chip pwr save fail detected
  2118. * event handler
  2119. * @handle: wma handle
  2120. * @cmd_param_info: event handler data
  2121. * @len: length of @cmd_param_info
  2122. *
  2123. * Return: QDF_STATUS_SUCCESS on success; error code otherwise
  2124. */
  2125. int wma_chip_power_save_failure_detected_handler(void *handle,
  2126. uint8_t *cmd_param_info,
  2127. uint32_t len);
  2128. /**
  2129. * wma_get_chain_rssi() - send wmi cmd to get chain rssi
  2130. * @wma_handle: wma handler
  2131. * @req_params: requset params
  2132. *
  2133. * Return: Return QDF_STATUS
  2134. */
  2135. QDF_STATUS wma_get_chain_rssi(tp_wma_handle wma_handle,
  2136. struct get_chain_rssi_req_params *req_params);
  2137. /**
  2138. * wma_config_bmiss_bcnt_params() - set bmiss config parameters
  2139. * @vdev_id: virtual device for the command
  2140. * @first_cnt: bmiss first value
  2141. * @final_cnt: bmiss final value
  2142. *
  2143. * Return: QDF_STATUS_SUCCESS or non-zero on failure
  2144. */
  2145. QDF_STATUS wma_config_bmiss_bcnt_params(uint32_t vdev_id, uint32_t first_cnt,
  2146. uint32_t final_cnt);
  2147. #ifdef WLAN_POWER_MANAGEMENT_OFFLOAD
  2148. /**
  2149. * wma_check_and_set_wake_timer(): checks all interfaces and if any interface
  2150. * has install_key pending, sets timer pattern in fw to wake up host after
  2151. * specified time has elapsed.
  2152. * @time: time after which host wants to be awaken.
  2153. *
  2154. * Return: None
  2155. */
  2156. void wma_check_and_set_wake_timer(uint32_t time);
  2157. #endif
  2158. /**
  2159. * wma_delete_invalid_peer_entries() - Delete invalid peer entries stored
  2160. * @vdev_id: virtual interface id
  2161. * @peer_mac_addr: Peer MAC address
  2162. *
  2163. * Removes the invalid peer mac entry from wma node
  2164. */
  2165. void wma_delete_invalid_peer_entries(uint8_t vdev_id, uint8_t *peer_mac_addr);
  2166. /**
  2167. * wma_rx_invalid_peer_ind() - the callback for DP to notify WMA layer
  2168. * invalid peer data is received, this function will send message to
  2169. * lim module.
  2170. * @vdev_id: virtual device ID
  2171. * @wh: Pointer to 802.11 frame header
  2172. *
  2173. * Return: 0 for success or non-zero on failure
  2174. */
  2175. uint8_t wma_rx_invalid_peer_ind(uint8_t vdev_id, void *wh);
  2176. /**
  2177. * wma_dp_send_delba_ind() - the callback for DP to notify WMA layer
  2178. * to del ba of rx
  2179. * @vdev_id: vdev id
  2180. * @peer_macaddr: peer mac address
  2181. * @tid: tid of rx
  2182. * @reason_code: reason code
  2183. * @cdp_rcode: CDP reason code for sending DELBA
  2184. *
  2185. * Return: 0 for success or non-zero on failure
  2186. */
  2187. int wma_dp_send_delba_ind(uint8_t vdev_id,
  2188. uint8_t *peer_macaddr,
  2189. uint8_t tid,
  2190. uint8_t reason_code,
  2191. enum cdp_delba_rcode cdp_rcode);
  2192. /**
  2193. * is_roam_inprogress() - Is vdev in progress
  2194. * @vdev_id: vdev of interest
  2195. *
  2196. * Return: true if roaming started, false during roam sync and otherwise
  2197. */
  2198. bool wma_is_roam_in_progress(uint32_t vdev_id);
  2199. /**
  2200. * wma_get_psoc_from_scn_handle() - API to get psoc from scn handle
  2201. * @scn_handle: opaque wma handle
  2202. *
  2203. * API to get psoc from scn handle
  2204. *
  2205. * Return: psoc context or null in case of failure
  2206. */
  2207. struct wlan_objmgr_psoc *wma_get_psoc_from_scn_handle(void *scn_handle);
  2208. /**
  2209. * wma_set_peer_ucast_cipher() - Update unicast cipher of the peer
  2210. * @mac_addr: peer mac address
  2211. * @cipher: peer cipher bits
  2212. * @cipher_cap: cipher cap
  2213. *
  2214. * Return: None
  2215. */
  2216. void wma_set_peer_ucast_cipher(uint8_t *mac_addr, int32_t cipher,
  2217. int32_t cipher_cap);
  2218. /**
  2219. * wma_update_set_key() - Update WMA layer for set key
  2220. * @session_id: vdev session identifier
  2221. * @pairwise: denotes if it is pairwise or group key
  2222. * @key_index: Key Index
  2223. * @cipher_type: cipher type being used for the encryption/decryption
  2224. *
  2225. * Return: None
  2226. */
  2227. void wma_update_set_key(uint8_t session_id, bool pairwise,
  2228. uint8_t key_index,
  2229. enum wlan_crypto_cipher_type cipher_type);
  2230. #ifdef WLAN_FEATURE_MOTION_DETECTION
  2231. /**
  2232. * wma_motion_det_host_event_handler - motion detection event handler
  2233. * @handle: WMA global handle
  2234. * @event: motion detection event
  2235. * @len: Length of cmd
  2236. *
  2237. * Call motion detection event callback handler
  2238. *
  2239. * Return: 0 on success, else error on failure
  2240. */
  2241. int wma_motion_det_host_event_handler(void *handle, u_int8_t *event,
  2242. u_int32_t len);
  2243. /**
  2244. * wma_motion_det_base_line_host_event_handler - md baselining event handler
  2245. * @handle: WMA global handle
  2246. * @event: motion detection baselining event
  2247. * @len: Length of cmd
  2248. *
  2249. * Return: 0 on success, else error on failure
  2250. */
  2251. int wma_motion_det_base_line_host_event_handler(void *handle, u_int8_t *event,
  2252. u_int32_t len);
  2253. #endif /* WLAN_FEATURE_MOTION_DETECTION */
  2254. /**
  2255. * wma_add_bss_peer_sta() - create bss peer when sta connect
  2256. * @vdev_id: vdev id
  2257. * @bssid: AP bssid
  2258. * @roam_sync: if roam sync is in progress
  2259. * @is_resp_required: Peer create response is expected from firmware.
  2260. * This flag will be set to true for initial connection and false for
  2261. * LFR2 case.
  2262. * @mld_mac: peer mld mac address
  2263. * @is_assoc_peer: is assoc peer or not
  2264. *
  2265. * Return: 0 on success, else error on failure
  2266. */
  2267. QDF_STATUS wma_add_bss_peer_sta(uint8_t vdev_id, uint8_t *bssid,
  2268. bool is_resp_required, uint8_t *mld_mac,
  2269. bool is_assoc_peer);
  2270. /**
  2271. * wma_send_vdev_stop() - WMA api to send vdev stop to fw
  2272. * @vdev_id: vdev id
  2273. *
  2274. * Return: 0 on success, else error on failure
  2275. */
  2276. QDF_STATUS wma_send_vdev_stop(uint8_t vdev_id);
  2277. /**
  2278. * wma_pre_assoc_req() - wma pre assoc req when sta connect
  2279. * @add_bss: add bss param
  2280. *
  2281. * Return: QDF_STATUS
  2282. */
  2283. QDF_STATUS wma_pre_assoc_req(struct bss_params *add_bss);
  2284. /**
  2285. * wma_add_bss_lfr3() - add bss during LFR3 offload roaming
  2286. * @wma: wma handler
  2287. * @add_bss: add bss param
  2288. *
  2289. * Return: None
  2290. */
  2291. void wma_add_bss_lfr3(tp_wma_handle wma, struct bss_params *add_bss);
  2292. #ifdef WLAN_FEATURE_HOST_ROAM
  2293. /**
  2294. * wma_add_bss_lfr2_vdev_start() - add bss and start vdev during host roaming
  2295. * @vdev: vdev in object manager
  2296. * @add_bss: add bss param
  2297. *
  2298. * Return: None
  2299. */
  2300. QDF_STATUS wma_add_bss_lfr2_vdev_start(struct wlan_objmgr_vdev *vdev,
  2301. struct bss_params *add_bss);
  2302. #endif
  2303. /**
  2304. * wma_set_vdev_bw() - wma send vdev bw
  2305. * @vdev_id: vdev id
  2306. * @bw: band width
  2307. *
  2308. * Return: QDF_STATUS
  2309. */
  2310. QDF_STATUS wma_set_vdev_bw(uint8_t vdev_id, uint8_t bw);
  2311. /**
  2312. * wma_send_peer_assoc_req() - wma send peer assoc req when sta connect
  2313. * @add_bss: add bss param
  2314. *
  2315. * Return: None
  2316. */
  2317. QDF_STATUS wma_send_peer_assoc_req(struct bss_params *add_bss);
  2318. /**
  2319. * wma_get_rx_chainmask() - API to get rx chainmask from mac phy capability
  2320. * @pdev_id: pdev id
  2321. * @chainmask_2g: pointer to return 2g chainmask
  2322. * @chainmask_5g: pointer to return 5g chainmask
  2323. *
  2324. * API to get rx chainmask from mac phy capability directly.
  2325. *
  2326. * Return: QDF_STATUS_SUCCESS or non-zero on failure
  2327. */
  2328. QDF_STATUS wma_get_rx_chainmask(uint8_t pdev_id, uint32_t *chainmask_2g,
  2329. uint32_t *chainmask_5g);
  2330. /**
  2331. * wma_handle_channel_switch_resp() - handle channel switch resp
  2332. * @wma: wma handle
  2333. * @rsp: response for channel switch
  2334. *
  2335. * Return: QDF_STATUS
  2336. */
  2337. QDF_STATUS wma_handle_channel_switch_resp(tp_wma_handle wma,
  2338. struct vdev_start_response *rsp);
  2339. /**
  2340. * wma_pre_chan_switch_setup() - handler before channel switch vdev start
  2341. * @vdev_id: vdev id
  2342. *
  2343. * Return: QDF_STATUS
  2344. */
  2345. QDF_STATUS wma_pre_chan_switch_setup(uint8_t vdev_id);
  2346. /**
  2347. * wma_post_chan_switch_setup() - handler after channel switch vdev start
  2348. * @vdev_id: vdev id
  2349. *
  2350. * Return: QDF_STATUS
  2351. */
  2352. QDF_STATUS wma_post_chan_switch_setup(uint8_t vdev_id);
  2353. /**
  2354. * wma_vdev_pre_start() - prepare vdev start
  2355. * @vdev_id: vdev id
  2356. *
  2357. * Return: QDF_STATUS
  2358. */
  2359. QDF_STATUS wma_vdev_pre_start(uint8_t vdev_id, bool restart);
  2360. #ifdef WLAN_FEATURE_11BE_MLO
  2361. /**
  2362. * wma_delete_peer_mlo() - Remove the MLO peer and detach link peer
  2363. * @psoc: PSOC objmgr pointer
  2364. * @macaddr: MAC address of objmgr peer
  2365. *
  2366. * The API will remove the ML peer with objmgr peer fetched from
  2367. * psoc peer list using the @macaddr.
  2368. *
  2369. * Return: void
  2370. */
  2371. void wma_delete_peer_mlo(struct wlan_objmgr_psoc *psoc, uint8_t *macaddr);
  2372. #else
  2373. static inline
  2374. void wma_delete_peer_mlo(struct wlan_objmgr_psoc *psoc, uint8_t *macaddr)
  2375. {
  2376. }
  2377. #endif
  2378. /**
  2379. * wma_remove_bss_peer_on_failure() - remove the bss peers in case of
  2380. * failure
  2381. * @wma: wma handle.
  2382. * @vdev_id: vdev id
  2383. *
  2384. * This API deletes the BSS peer created during ADD BSS in case of ADD BSS
  2385. * request sent to the FW fails.
  2386. *
  2387. * Return: None;
  2388. */
  2389. void wma_remove_bss_peer_on_failure(tp_wma_handle wma, uint8_t vdev_id);
  2390. /**
  2391. * wma_remove_bss_peer_before_join() - remove the bss peers in case of
  2392. * failure before join (vdev start) for sta mode
  2393. * @wma: wma handle.
  2394. * @vdev_id: vdev id
  2395. * @cm_join_req: join cm context
  2396. *
  2397. * This API deletes the BSS peer if any failure before "join" (vdev start).
  2398. * And indicate connection failure to CM after bss peer delete event comes
  2399. * from FW.
  2400. *
  2401. * Return: QDF_STATUS_SUCCESS if success, QDF_STATUS_E_PENDING if peer delete
  2402. * event will be indicated later from target.
  2403. */
  2404. QDF_STATUS wma_remove_bss_peer_before_join(
  2405. tp_wma_handle wma, uint8_t vdev_id,
  2406. void *cm_join_req);
  2407. /**
  2408. * wma_send_add_bss_resp() - send add bss failure
  2409. * @wma: wma handle.
  2410. * @vdev_id: vdev id
  2411. * @status: status
  2412. *
  2413. * Return: None
  2414. */
  2415. void wma_send_add_bss_resp(tp_wma_handle wma, uint8_t vdev_id,
  2416. QDF_STATUS status);
  2417. /**
  2418. * wma_post_vdev_start_setup() - wma post vdev start handler
  2419. * @wma: wma handle.
  2420. * @vdev_id: vdev id
  2421. *
  2422. * Return: Success or Failure status
  2423. */
  2424. QDF_STATUS wma_post_vdev_start_setup(uint8_t vdev_id);
  2425. /**
  2426. * wma_pre_vdev_start_setup() - wma pre vdev start handler
  2427. * @wma: wma handle.
  2428. * @vdev_id: vdev id
  2429. * @addbss_param: bss param
  2430. *
  2431. * Return: Success or Failure status
  2432. */
  2433. QDF_STATUS wma_pre_vdev_start_setup(uint8_t vdev_id,
  2434. struct bss_params *add_bss);
  2435. #ifdef FEATURE_ANI_LEVEL_REQUEST
  2436. /**
  2437. * wma_send_ani_level_request() - Send get ani level cmd to WMI
  2438. * @wma_handle: wma handle.
  2439. * @freqs: pointer to channels for which ANI level has to be retrieved
  2440. * @num_freqs: number of channels in the above parameter
  2441. *
  2442. * Return: QDF_STATUS
  2443. */
  2444. QDF_STATUS wma_send_ani_level_request(tp_wma_handle wma_handle,
  2445. uint32_t *freqs, uint8_t num_freqs);
  2446. #endif /* FEATURE_ANI_LEVEL_REQUEST */
  2447. /**
  2448. * wma_vdev_detach() - send vdev delete command to fw
  2449. * @wma_handle: wma handle
  2450. * @pdel_vdev_req_param: del vdev params
  2451. *
  2452. * Return: QDF status
  2453. */
  2454. QDF_STATUS wma_vdev_detach(struct del_vdev_params *pdel_vdev_req_param);
  2455. #ifdef WLAN_FEATURE_DYNAMIC_MAC_ADDR_UPDATE
  2456. /**
  2457. * wma_p2p_self_peer_remove() - Send P2P self peer delete command to FW
  2458. * @vdev: Object manager vdev
  2459. *
  2460. * Return: success if peer delete command sent to firmware, else failure.
  2461. */
  2462. QDF_STATUS wma_p2p_self_peer_remove(struct wlan_objmgr_vdev *vdev);
  2463. #endif
  2464. #endif