wma.h 80 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740
  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. #ifdef WLAN_FEATURE_11BE_MLO_ADV_FEATURE
  1631. /**
  1632. * wma_peer_tbl_trans_add_entry() - Add peer transition to peer history
  1633. * @peer: Object manager peer pointer
  1634. * @is_create: Set to %true if @peer is getting created
  1635. * @peer_info: Info of peer setup on @peer create,
  1636. * %NULL if @is_create is %false.
  1637. *
  1638. * Adds new entry to peer history about the transition of peer in the system.
  1639. * The APIs has to be called to keep record of create and delete of peer.
  1640. *
  1641. * Returns: void
  1642. */
  1643. void wma_peer_tbl_trans_add_entry(struct wlan_objmgr_peer *peer, bool is_create,
  1644. struct cdp_peer_setup_info *peer_info);
  1645. #else
  1646. static inline void
  1647. wma_peer_tbl_trans_add_entry(struct wlan_objmgr_peer *peer, bool is_create,
  1648. struct cdp_peer_setup_info *peer_info)
  1649. {
  1650. }
  1651. #endif
  1652. /**
  1653. * wma_get_cca_stats() - send request to fw to get CCA
  1654. * @wmi_hdl: wma handle
  1655. * @vdev_id: vdev id
  1656. *
  1657. * Return: QDF status
  1658. */
  1659. QDF_STATUS wma_get_cca_stats(tp_wma_handle wma_handle,
  1660. uint8_t vdev_id);
  1661. struct wma_ini_config *wma_get_ini_handle(tp_wma_handle wma_handle);
  1662. /**
  1663. * wma_chan_phy__mode() - get host phymode for channel
  1664. * @freq: channel freq
  1665. * @chan_width: maximum channel width possible
  1666. * @dot11_mode: maximum phy_mode possible
  1667. *
  1668. * Return: return host phymode
  1669. */
  1670. enum wlan_phymode wma_chan_phy_mode(uint32_t freq, enum phy_ch_width chan_width,
  1671. uint8_t dot11_mode);
  1672. /**
  1673. * wma_fw_to_host_phymode() - convert fw to host phymode
  1674. * @phymode: phymode to convert
  1675. *
  1676. * Return: one of the values defined in enum wlan_phymode;
  1677. * or WLAN_PHYMODE_AUTO if the conversion fails
  1678. */
  1679. enum wlan_phymode wma_fw_to_host_phymode(WMI_HOST_WLAN_PHY_MODE phymode);
  1680. #ifdef FEATURE_OEM_DATA_SUPPORT
  1681. /**
  1682. * wma_start_oem_req_cmd() - send oem request command to fw
  1683. * @wma_handle: wma handle
  1684. * @oem_data_req: the pointer of oem req buf
  1685. *
  1686. * Return: QDF status
  1687. */
  1688. QDF_STATUS wma_start_oem_req_cmd(tp_wma_handle wma_handle,
  1689. struct oem_data_req *oem_data_req);
  1690. #endif
  1691. #ifdef FEATURE_OEM_DATA
  1692. /**
  1693. * wma_start_oem_data_cmd() - send oem data command to fw
  1694. * @wma_handle: wma handle
  1695. * @oem_data: the pointer of oem data buf
  1696. *
  1697. * Return: QDF status
  1698. */
  1699. QDF_STATUS wma_start_oem_data_cmd(tp_wma_handle wma_handle,
  1700. struct oem_data *oem_data);
  1701. #endif
  1702. QDF_STATUS wma_enable_disable_caevent_ind(tp_wma_handle wma_handle,
  1703. uint8_t val);
  1704. void wma_register_packetdump_callback(
  1705. ol_txrx_pktdump_cb wma_mgmt_tx_packetdump_cb,
  1706. ol_txrx_pktdump_cb wma_mgmt_rx_packetdump_cb);
  1707. void wma_deregister_packetdump_callback(void);
  1708. void wma_update_sta_inactivity_timeout(tp_wma_handle wma,
  1709. struct sme_sta_inactivity_timeout *sta_inactivity_timer);
  1710. /**
  1711. * wma_form_rx_packet() - form rx cds packet
  1712. * @buf: buffer
  1713. * @mgmt_rx_params: mgmt rx params
  1714. * @rx_pkt: cds packet
  1715. *
  1716. * This functions forms a cds packet from the rx mgmt frame received.
  1717. *
  1718. * Return: 0 for success or error code
  1719. */
  1720. int wma_form_rx_packet(qdf_nbuf_t buf,
  1721. struct mgmt_rx_event_params *mgmt_rx_params,
  1722. cds_pkt_t *rx_pkt);
  1723. /**
  1724. * wma_mgmt_unified_cmd_send() - send the mgmt tx packet
  1725. * @vdev: objmgr vdev
  1726. * @buf: buffer
  1727. * @desc_id: desc id
  1728. * @mgmt_tx_params: mgmt rx params
  1729. *
  1730. * This functions sends mgmt tx packet to WMI layer.
  1731. *
  1732. * Return: 0 for success or error code
  1733. */
  1734. QDF_STATUS wma_mgmt_unified_cmd_send(struct wlan_objmgr_vdev *vdev,
  1735. qdf_nbuf_t buf, uint32_t desc_id,
  1736. void *mgmt_tx_params);
  1737. #ifndef CONFIG_HL_SUPPORT
  1738. /**
  1739. * wma_mgmt_nbuf_unmap_cb() - dma unmap for pending mgmt pkts
  1740. * @pdev: objmgr pdev
  1741. * @buf: buffer
  1742. *
  1743. * This function does the dma unmap of the pending mgmt packet cleanup
  1744. *
  1745. * Return: None
  1746. */
  1747. void wma_mgmt_nbuf_unmap_cb(struct wlan_objmgr_pdev *pdev,
  1748. qdf_nbuf_t buf);
  1749. /**
  1750. * wma_mgmt_nbuf_unmap_cb() - dma unmap for pending mgmt pkts
  1751. * @pdev: objmgr pdev
  1752. * @buf: buffer
  1753. *
  1754. * This is a cb function drains all mgmt packets of a vdev.
  1755. * This is called in event of target going down without sending completions.
  1756. *
  1757. * Return: QDF_STATUS
  1758. */
  1759. QDF_STATUS wma_mgmt_frame_fill_peer_cb(struct wlan_objmgr_peer *peer,
  1760. qdf_nbuf_t buf);
  1761. #else
  1762. static inline void wma_mgmt_nbuf_unmap_cb(struct wlan_objmgr_pdev *pdev,
  1763. qdf_nbuf_t buf)
  1764. {}
  1765. static inline QDF_STATUS wma_mgmt_frame_fill_peer_cb(struct wlan_objmgr_peer *peer,
  1766. qdf_nbuf_t buf)
  1767. {
  1768. return QDF_STATUS_SUCCESS;
  1769. }
  1770. #endif
  1771. /**
  1772. * wma_chan_info_event_handler() - chan info event handler
  1773. * @handle: wma handle
  1774. * @event_buf: event handler data
  1775. * @len: length of @event_buf
  1776. *
  1777. * this function will handle the WMI_CHAN_INFO_EVENTID
  1778. *
  1779. * Return: int
  1780. */
  1781. int wma_chan_info_event_handler(void *handle, uint8_t *event_buf,
  1782. uint32_t len);
  1783. /**
  1784. * wma_update_vdev_pause_bitmap() - update vdev pause bitmap
  1785. * @vdev_id: the Id of the vdev to configure
  1786. * @value: value pause bitmap value
  1787. *
  1788. * Return: None
  1789. */
  1790. static inline
  1791. void wma_vdev_update_pause_bitmap(uint8_t vdev_id, uint16_t value)
  1792. {
  1793. tp_wma_handle wma = (tp_wma_handle)cds_get_context(QDF_MODULE_ID_WMA);
  1794. struct wma_txrx_node *iface;
  1795. if (!wma)
  1796. return;
  1797. if (vdev_id >= wma->max_bssid) {
  1798. wma_err("Invalid vdev_id: %d", vdev_id);
  1799. return;
  1800. }
  1801. iface = &wma->interfaces[vdev_id];
  1802. if (!iface) {
  1803. wma_err("Interface is NULL");
  1804. return;
  1805. }
  1806. iface->pause_bitmap = value;
  1807. }
  1808. /**
  1809. * wma_vdev_get_pause_bitmap() - Get vdev pause bitmap
  1810. * @vdev_id: the Id of the vdev to configure
  1811. *
  1812. * Return: Vdev pause bitmap value else 0 on error
  1813. */
  1814. static inline
  1815. uint16_t wma_vdev_get_pause_bitmap(uint8_t vdev_id)
  1816. {
  1817. tp_wma_handle wma = (tp_wma_handle)cds_get_context(QDF_MODULE_ID_WMA);
  1818. struct wma_txrx_node *iface;
  1819. if (!wma)
  1820. return 0;
  1821. iface = &wma->interfaces[vdev_id];
  1822. if (!iface) {
  1823. wma_err("Interface is NULL");
  1824. return 0;
  1825. }
  1826. return iface->pause_bitmap;
  1827. }
  1828. /**
  1829. * wma_vdev_is_device_in_low_pwr_mode - is device in power save mode
  1830. * @vdev_id: the Id of the vdev to configure
  1831. *
  1832. * Return: true if device is in low power mode else false
  1833. */
  1834. static inline bool wma_vdev_is_device_in_low_pwr_mode(uint8_t vdev_id)
  1835. {
  1836. tp_wma_handle wma = (tp_wma_handle)cds_get_context(QDF_MODULE_ID_WMA);
  1837. struct wma_txrx_node *iface;
  1838. if (!wma)
  1839. return 0;
  1840. iface = &wma->interfaces[vdev_id];
  1841. if (!iface) {
  1842. wma_err("Interface is NULL");
  1843. return 0;
  1844. }
  1845. return iface->in_bmps || wma->in_imps;
  1846. }
  1847. /**
  1848. * wma_vdev_get_dtim_period - Get dtim period value from mlme
  1849. * @vdev_id: vdev index number
  1850. * @value: pointer to the value to fill out
  1851. *
  1852. * Note caller must verify return status before using value
  1853. *
  1854. * Return: QDF_STATUS_SUCCESS when fetched a valid value from cfg else
  1855. * QDF_STATUS_E_FAILURE
  1856. */
  1857. static inline
  1858. QDF_STATUS wma_vdev_get_dtim_period(uint8_t vdev_id, uint8_t *value)
  1859. {
  1860. tp_wma_handle wma = (tp_wma_handle)cds_get_context(QDF_MODULE_ID_WMA);
  1861. struct wma_txrx_node *iface;
  1862. /* set value to zero */
  1863. *value = 0;
  1864. if (!wma)
  1865. return QDF_STATUS_E_FAILURE;
  1866. iface = &wma->interfaces[vdev_id];
  1867. if (!iface)
  1868. return QDF_STATUS_E_FAILURE;
  1869. *value = iface->dtimPeriod;
  1870. return QDF_STATUS_SUCCESS;
  1871. }
  1872. /**
  1873. * wma_vdev_get_beacon_interval - Get beacon interval from mlme
  1874. * @vdev_id: vdev index number
  1875. * @value: pointer to the value to fill out
  1876. *
  1877. * Note caller must verify return status before using value
  1878. *
  1879. * Return: QDF_STATUS_SUCCESS when fetched a valid value from cfg else
  1880. * QDF_STATUS_E_FAILURE
  1881. */
  1882. static inline
  1883. QDF_STATUS wma_vdev_get_beacon_interval(uint8_t vdev_id, uint16_t *value)
  1884. {
  1885. tp_wma_handle wma = (tp_wma_handle)cds_get_context(QDF_MODULE_ID_WMA);
  1886. struct wma_txrx_node *iface;
  1887. /* set value to zero */
  1888. *value = 0;
  1889. if (!wma)
  1890. return QDF_STATUS_E_FAILURE;
  1891. iface = &wma->interfaces[vdev_id];
  1892. if (!iface)
  1893. return QDF_STATUS_E_FAILURE;
  1894. *value = iface->beaconInterval;
  1895. return QDF_STATUS_SUCCESS;
  1896. }
  1897. /**
  1898. * wma_get_vdev_rate_flag - Get beacon rate flag from mlme
  1899. * @vdev_id: vdev index number
  1900. * @rate_flag: pointer to the value to fill out
  1901. *
  1902. * Note caller must verify return status before using value
  1903. *
  1904. * Return: QDF_STATUS_SUCCESS when fetched a valid value from mlme else
  1905. * QDF_STATUS_E_FAILURE
  1906. */
  1907. static inline QDF_STATUS
  1908. wma_get_vdev_rate_flag(struct wlan_objmgr_vdev *vdev, uint32_t *rate_flag)
  1909. {
  1910. struct vdev_mlme_obj *mlme_obj;
  1911. if (!vdev) {
  1912. wma_err("vdev is NULL");
  1913. return QDF_STATUS_E_FAILURE;
  1914. }
  1915. mlme_obj = wlan_vdev_mlme_get_cmpt_obj(vdev);
  1916. if (!mlme_obj) {
  1917. wma_err("ailed to get mlme_obj");
  1918. return QDF_STATUS_E_FAILURE;
  1919. }
  1920. *rate_flag = mlme_obj->mgmt.rate_info.rate_flags;
  1921. return QDF_STATUS_SUCCESS;
  1922. }
  1923. /**
  1924. * wma_vdev_set_pause_bit() - Set a bit in vdev pause bitmap
  1925. * @vdev_id: the Id of the vdev to configure
  1926. * @bit_pos: set bit position in pause bitmap
  1927. *
  1928. * Return: None
  1929. */
  1930. static inline
  1931. void wma_vdev_set_pause_bit(uint8_t vdev_id, wmi_tx_pause_type bit_pos)
  1932. {
  1933. tp_wma_handle wma = (tp_wma_handle)cds_get_context(QDF_MODULE_ID_WMA);
  1934. struct wma_txrx_node *iface;
  1935. if (!wma)
  1936. return;
  1937. iface = &wma->interfaces[vdev_id];
  1938. if (!iface) {
  1939. wma_err("Interface is NULL");
  1940. return;
  1941. }
  1942. iface->pause_bitmap |= (1 << bit_pos);
  1943. }
  1944. /**
  1945. * wma_vdev_clear_pause_bit() - Clear a bit from vdev pause bitmap
  1946. * @vdev_id: the Id of the vdev to configure
  1947. * @bit_pos: set bit position in pause bitmap
  1948. *
  1949. * Return: None
  1950. */
  1951. static inline
  1952. void wma_vdev_clear_pause_bit(uint8_t vdev_id, wmi_tx_pause_type bit_pos)
  1953. {
  1954. tp_wma_handle wma = (tp_wma_handle)cds_get_context(QDF_MODULE_ID_WMA);
  1955. struct wma_txrx_node *iface;
  1956. if (!wma)
  1957. return;
  1958. iface = &wma->interfaces[vdev_id];
  1959. if (!iface) {
  1960. wma_err("Interface is NULL");
  1961. return;
  1962. }
  1963. iface->pause_bitmap &= ~(1 << bit_pos);
  1964. }
  1965. #ifdef WLAN_FEATURE_ROAM_OFFLOAD
  1966. /**
  1967. * wma_send_roam_preauth_status() - Send the preauth status to wmi
  1968. * @handle: WMA handle
  1969. * @roam_req: Pointer to wmi_roam_auth_status_params from sae
  1970. *
  1971. * Return: None
  1972. */
  1973. void
  1974. wma_send_roam_preauth_status(tp_wma_handle wma_handle,
  1975. struct wmi_roam_auth_status_params *params);
  1976. /**
  1977. * wma_handle_roam_sync_timeout() - Update roaming status at wma layer
  1978. * @wma_handle: wma handle
  1979. * @info: Info for roaming start timer
  1980. *
  1981. * This function gets called in case of roaming offload timer get expired
  1982. *
  1983. * Return: None
  1984. */
  1985. void wma_handle_roam_sync_timeout(tp_wma_handle wma_handle,
  1986. struct roam_sync_timeout_timer_info *info);
  1987. #else
  1988. static inline void
  1989. wma_send_roam_preauth_status(tp_wma_handle wma_handle,
  1990. struct wmi_roam_auth_status_params *params)
  1991. {}
  1992. static inline void
  1993. wma_handle_roam_sync_timeout(tp_wma_handle wma_handle,
  1994. struct roam_sync_timeout_timer_info *info)
  1995. {}
  1996. #endif
  1997. #ifdef WMI_INTERFACE_EVENT_LOGGING
  1998. static inline void wma_print_wmi_cmd_log(uint32_t count,
  1999. qdf_abstract_print *print,
  2000. void *print_priv)
  2001. {
  2002. t_wma_handle *wma = cds_get_context(QDF_MODULE_ID_WMA);
  2003. if (wma) {
  2004. print(print_priv, "Command Log (count %u)", count);
  2005. wmi_print_cmd_log(wma->wmi_handle, count, print, print_priv);
  2006. }
  2007. }
  2008. static inline void wma_print_wmi_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, "Command Tx Complete Log (count %u)", count);
  2015. wmi_print_cmd_tx_cmp_log(wma->wmi_handle, count, print,
  2016. print_priv);
  2017. }
  2018. }
  2019. static inline void wma_print_wmi_mgmt_cmd_log(uint32_t count,
  2020. qdf_abstract_print *print,
  2021. void *print_priv)
  2022. {
  2023. t_wma_handle *wma = cds_get_context(QDF_MODULE_ID_WMA);
  2024. if (wma) {
  2025. print(print_priv, "Management Command Log (count %u)", count);
  2026. wmi_print_mgmt_cmd_log(wma->wmi_handle, count, print,
  2027. print_priv);
  2028. }
  2029. }
  2030. static inline void wma_print_wmi_mgmt_cmd_tx_cmp_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,
  2037. "Management Command Tx Complete Log (count %u)", count);
  2038. wmi_print_mgmt_cmd_tx_cmp_log(wma->wmi_handle, count, print,
  2039. print_priv);
  2040. }
  2041. }
  2042. static inline void wma_print_wmi_event_log(uint32_t count,
  2043. qdf_abstract_print *print,
  2044. void *print_priv)
  2045. {
  2046. t_wma_handle *wma = cds_get_context(QDF_MODULE_ID_WMA);
  2047. if (wma) {
  2048. print(print_priv, "Event Log (count %u)", count);
  2049. wmi_print_event_log(wma->wmi_handle, count, print, print_priv);
  2050. }
  2051. }
  2052. static inline void wma_print_wmi_rx_event_log(uint32_t count,
  2053. qdf_abstract_print *print,
  2054. void *print_priv)
  2055. {
  2056. t_wma_handle *wma = cds_get_context(QDF_MODULE_ID_WMA);
  2057. if (wma) {
  2058. print(print_priv, "Rx Event Log (count %u)", count);
  2059. wmi_print_rx_event_log(wma->wmi_handle, count, print,
  2060. print_priv);
  2061. }
  2062. }
  2063. static inline void wma_print_wmi_mgmt_event_log(uint32_t count,
  2064. qdf_abstract_print *print,
  2065. void *print_priv)
  2066. {
  2067. t_wma_handle *wma = cds_get_context(QDF_MODULE_ID_WMA);
  2068. if (wma) {
  2069. print(print_priv, "Management Event Log (count %u)", count);
  2070. wmi_print_mgmt_event_log(wma->wmi_handle, count, print,
  2071. print_priv);
  2072. }
  2073. }
  2074. #else
  2075. static inline void wma_print_wmi_cmd_log(uint32_t count,
  2076. qdf_abstract_print *print,
  2077. void *print_priv)
  2078. {
  2079. }
  2080. static inline void wma_print_wmi_cmd_tx_cmp_log(uint32_t count,
  2081. qdf_abstract_print *print,
  2082. void *print_priv)
  2083. {
  2084. }
  2085. static inline void wma_print_wmi_mgmt_cmd_log(uint32_t count,
  2086. qdf_abstract_print *print,
  2087. void *print_priv)
  2088. {
  2089. }
  2090. static inline void wma_print_wmi_mgmt_cmd_tx_cmp_log(uint32_t count,
  2091. qdf_abstract_print *print,
  2092. void *print_priv)
  2093. {
  2094. }
  2095. static inline void wma_print_wmi_event_log(uint32_t count,
  2096. qdf_abstract_print *print,
  2097. void *print_priv)
  2098. {
  2099. }
  2100. static inline void wma_print_wmi_rx_event_log(uint32_t count,
  2101. qdf_abstract_print *print,
  2102. void *print_priv)
  2103. {
  2104. }
  2105. static inline void wma_print_wmi_mgmt_event_log(uint32_t count,
  2106. qdf_abstract_print *print,
  2107. void *print_priv)
  2108. {
  2109. }
  2110. #endif /* WMI_INTERFACE_EVENT_LOGGING */
  2111. /**
  2112. * wma_set_rx_reorder_timeout_val() - set rx recorder timeout value
  2113. * @wma_handle: pointer to wma handle
  2114. * @reorder_timeout: rx reorder timeout value
  2115. *
  2116. * Return: QDF_STATUS
  2117. */
  2118. QDF_STATUS wma_set_rx_reorder_timeout_val(tp_wma_handle wma_handle,
  2119. struct sir_set_rx_reorder_timeout_val *reorder_timeout);
  2120. /**
  2121. * wma_set_rx_blocksize() - set rx blocksize
  2122. * @wma_handle: pointer to wma handle
  2123. * @peer_rx_blocksize: rx blocksize for peer mac
  2124. *
  2125. * Return: QDF_STATUS_SUCCESS for success or error code.
  2126. */
  2127. QDF_STATUS wma_set_rx_blocksize(tp_wma_handle wma_handle,
  2128. struct sir_peer_set_rx_blocksize *peer_rx_blocksize);
  2129. /**
  2130. * wma_configure_smps_params() - Configures the smps parameters to set
  2131. * @vdev_id: Virtual device for the command
  2132. * @param_id: SMPS parameter ID
  2133. * @param_val: Value to be set for the parameter
  2134. * Return: QDF_STATUS_SUCCESS or non-zero on failure
  2135. */
  2136. QDF_STATUS wma_configure_smps_params(uint32_t vdev_id, uint32_t param_id,
  2137. uint32_t param_val);
  2138. /*
  2139. * wma_chip_power_save_failure_detected_handler() - chip pwr save fail detected
  2140. * event handler
  2141. * @handle: wma handle
  2142. * @cmd_param_info: event handler data
  2143. * @len: length of @cmd_param_info
  2144. *
  2145. * Return: QDF_STATUS_SUCCESS on success; error code otherwise
  2146. */
  2147. int wma_chip_power_save_failure_detected_handler(void *handle,
  2148. uint8_t *cmd_param_info,
  2149. uint32_t len);
  2150. /**
  2151. * wma_get_chain_rssi() - send wmi cmd to get chain rssi
  2152. * @wma_handle: wma handler
  2153. * @req_params: requset params
  2154. *
  2155. * Return: Return QDF_STATUS
  2156. */
  2157. QDF_STATUS wma_get_chain_rssi(tp_wma_handle wma_handle,
  2158. struct get_chain_rssi_req_params *req_params);
  2159. /**
  2160. * wma_config_bmiss_bcnt_params() - set bmiss config parameters
  2161. * @vdev_id: virtual device for the command
  2162. * @first_cnt: bmiss first value
  2163. * @final_cnt: bmiss final value
  2164. *
  2165. * Return: QDF_STATUS_SUCCESS or non-zero on failure
  2166. */
  2167. QDF_STATUS wma_config_bmiss_bcnt_params(uint32_t vdev_id, uint32_t first_cnt,
  2168. uint32_t final_cnt);
  2169. #ifdef WLAN_POWER_MANAGEMENT_OFFLOAD
  2170. /**
  2171. * wma_check_and_set_wake_timer(): checks all interfaces and if any interface
  2172. * has install_key pending, sets timer pattern in fw to wake up host after
  2173. * specified time has elapsed.
  2174. * @time: time after which host wants to be awaken.
  2175. *
  2176. * Return: None
  2177. */
  2178. void wma_check_and_set_wake_timer(uint32_t time);
  2179. #endif
  2180. /**
  2181. * wma_delete_invalid_peer_entries() - Delete invalid peer entries stored
  2182. * @vdev_id: virtual interface id
  2183. * @peer_mac_addr: Peer MAC address
  2184. *
  2185. * Removes the invalid peer mac entry from wma node
  2186. */
  2187. void wma_delete_invalid_peer_entries(uint8_t vdev_id, uint8_t *peer_mac_addr);
  2188. /**
  2189. * wma_rx_invalid_peer_ind() - the callback for DP to notify WMA layer
  2190. * invalid peer data is received, this function will send message to
  2191. * lim module.
  2192. * @vdev_id: virtual device ID
  2193. * @wh: Pointer to 802.11 frame header
  2194. *
  2195. * Return: 0 for success or non-zero on failure
  2196. */
  2197. uint8_t wma_rx_invalid_peer_ind(uint8_t vdev_id, void *wh);
  2198. /**
  2199. * wma_dp_send_delba_ind() - the callback for DP to notify WMA layer
  2200. * to del ba of rx
  2201. * @vdev_id: vdev id
  2202. * @peer_macaddr: peer mac address
  2203. * @tid: tid of rx
  2204. * @reason_code: reason code
  2205. * @cdp_rcode: CDP reason code for sending DELBA
  2206. *
  2207. * Return: 0 for success or non-zero on failure
  2208. */
  2209. int wma_dp_send_delba_ind(uint8_t vdev_id,
  2210. uint8_t *peer_macaddr,
  2211. uint8_t tid,
  2212. uint8_t reason_code,
  2213. enum cdp_delba_rcode cdp_rcode);
  2214. /**
  2215. * is_roam_inprogress() - Is vdev in progress
  2216. * @vdev_id: vdev of interest
  2217. *
  2218. * Return: true if roaming started, false during roam sync and otherwise
  2219. */
  2220. bool wma_is_roam_in_progress(uint32_t vdev_id);
  2221. /**
  2222. * wma_get_psoc_from_scn_handle() - API to get psoc from scn handle
  2223. * @scn_handle: opaque wma handle
  2224. *
  2225. * API to get psoc from scn handle
  2226. *
  2227. * Return: psoc context or null in case of failure
  2228. */
  2229. struct wlan_objmgr_psoc *wma_get_psoc_from_scn_handle(void *scn_handle);
  2230. /**
  2231. * wma_set_peer_ucast_cipher() - Update unicast cipher of the peer
  2232. * @mac_addr: peer mac address
  2233. * @cipher: peer cipher bits
  2234. * @cipher_cap: cipher cap
  2235. *
  2236. * Return: None
  2237. */
  2238. void wma_set_peer_ucast_cipher(uint8_t *mac_addr, int32_t cipher,
  2239. int32_t cipher_cap);
  2240. /**
  2241. * wma_update_set_key() - Update WMA layer for set key
  2242. * @session_id: vdev session identifier
  2243. * @pairwise: denotes if it is pairwise or group key
  2244. * @key_index: Key Index
  2245. * @cipher_type: cipher type being used for the encryption/decryption
  2246. *
  2247. * Return: None
  2248. */
  2249. void wma_update_set_key(uint8_t session_id, bool pairwise,
  2250. uint8_t key_index,
  2251. enum wlan_crypto_cipher_type cipher_type);
  2252. #ifdef WLAN_FEATURE_MOTION_DETECTION
  2253. /**
  2254. * wma_motion_det_host_event_handler - motion detection event handler
  2255. * @handle: WMA global handle
  2256. * @event: motion detection event
  2257. * @len: Length of cmd
  2258. *
  2259. * Call motion detection event callback handler
  2260. *
  2261. * Return: 0 on success, else error on failure
  2262. */
  2263. int wma_motion_det_host_event_handler(void *handle, u_int8_t *event,
  2264. u_int32_t len);
  2265. /**
  2266. * wma_motion_det_base_line_host_event_handler - md baselining event handler
  2267. * @handle: WMA global handle
  2268. * @event: motion detection baselining event
  2269. * @len: Length of cmd
  2270. *
  2271. * Return: 0 on success, else error on failure
  2272. */
  2273. int wma_motion_det_base_line_host_event_handler(void *handle, u_int8_t *event,
  2274. u_int32_t len);
  2275. #endif /* WLAN_FEATURE_MOTION_DETECTION */
  2276. /**
  2277. * wma_add_bss_peer_sta() - create bss peer when sta connect
  2278. * @vdev_id: vdev id
  2279. * @bssid: AP bssid
  2280. * @roam_sync: if roam sync is in progress
  2281. * @is_resp_required: Peer create response is expected from firmware.
  2282. * This flag will be set to true for initial connection and false for
  2283. * LFR2 case.
  2284. * @mld_mac: peer mld mac address
  2285. * @is_assoc_peer: is assoc peer or not
  2286. *
  2287. * Return: 0 on success, else error on failure
  2288. */
  2289. QDF_STATUS wma_add_bss_peer_sta(uint8_t vdev_id, uint8_t *bssid,
  2290. bool is_resp_required, uint8_t *mld_mac,
  2291. bool is_assoc_peer);
  2292. /**
  2293. * wma_send_vdev_stop() - WMA api to send vdev stop to fw
  2294. * @vdev_id: vdev id
  2295. *
  2296. * Return: 0 on success, else error on failure
  2297. */
  2298. QDF_STATUS wma_send_vdev_stop(uint8_t vdev_id);
  2299. /**
  2300. * wma_pre_assoc_req() - wma pre assoc req when sta connect
  2301. * @add_bss: add bss param
  2302. *
  2303. * Return: QDF_STATUS
  2304. */
  2305. QDF_STATUS wma_pre_assoc_req(struct bss_params *add_bss);
  2306. /**
  2307. * wma_add_bss_lfr3() - add bss during LFR3 offload roaming
  2308. * @wma: wma handler
  2309. * @add_bss: add bss param
  2310. *
  2311. * Return: None
  2312. */
  2313. void wma_add_bss_lfr3(tp_wma_handle wma, struct bss_params *add_bss);
  2314. #ifdef WLAN_FEATURE_HOST_ROAM
  2315. /**
  2316. * wma_add_bss_lfr2_vdev_start() - add bss and start vdev during host roaming
  2317. * @vdev: vdev in object manager
  2318. * @add_bss: add bss param
  2319. *
  2320. * Return: None
  2321. */
  2322. QDF_STATUS wma_add_bss_lfr2_vdev_start(struct wlan_objmgr_vdev *vdev,
  2323. struct bss_params *add_bss);
  2324. #endif
  2325. /**
  2326. * wma_set_vdev_bw() - wma send vdev bw
  2327. * @vdev_id: vdev id
  2328. * @bw: band width
  2329. *
  2330. * Return: QDF_STATUS
  2331. */
  2332. QDF_STATUS wma_set_vdev_bw(uint8_t vdev_id, uint8_t bw);
  2333. /**
  2334. * wma_send_peer_assoc_req() - wma send peer assoc req when sta connect
  2335. * @add_bss: add bss param
  2336. *
  2337. * Return: None
  2338. */
  2339. QDF_STATUS wma_send_peer_assoc_req(struct bss_params *add_bss);
  2340. /**
  2341. * wma_get_rx_chainmask() - API to get rx chainmask from mac phy capability
  2342. * @pdev_id: pdev id
  2343. * @chainmask_2g: pointer to return 2g chainmask
  2344. * @chainmask_5g: pointer to return 5g chainmask
  2345. *
  2346. * API to get rx chainmask from mac phy capability directly.
  2347. *
  2348. * Return: QDF_STATUS_SUCCESS or non-zero on failure
  2349. */
  2350. QDF_STATUS wma_get_rx_chainmask(uint8_t pdev_id, uint32_t *chainmask_2g,
  2351. uint32_t *chainmask_5g);
  2352. /**
  2353. * wma_handle_channel_switch_resp() - handle channel switch resp
  2354. * @wma: wma handle
  2355. * @rsp: response for channel switch
  2356. *
  2357. * Return: QDF_STATUS
  2358. */
  2359. QDF_STATUS wma_handle_channel_switch_resp(tp_wma_handle wma,
  2360. struct vdev_start_response *rsp);
  2361. /**
  2362. * wma_pre_chan_switch_setup() - handler before channel switch vdev start
  2363. * @vdev_id: vdev id
  2364. *
  2365. * Return: QDF_STATUS
  2366. */
  2367. QDF_STATUS wma_pre_chan_switch_setup(uint8_t vdev_id);
  2368. /**
  2369. * wma_post_chan_switch_setup() - handler after channel switch vdev start
  2370. * @vdev_id: vdev id
  2371. *
  2372. * Return: QDF_STATUS
  2373. */
  2374. QDF_STATUS wma_post_chan_switch_setup(uint8_t vdev_id);
  2375. /**
  2376. * wma_vdev_pre_start() - prepare vdev start
  2377. * @vdev_id: vdev id
  2378. *
  2379. * Return: QDF_STATUS
  2380. */
  2381. QDF_STATUS wma_vdev_pre_start(uint8_t vdev_id, bool restart);
  2382. #ifdef WLAN_FEATURE_11BE_MLO
  2383. /**
  2384. * wma_delete_peer_mlo() - Remove the MLO peer and detach link peer
  2385. * @psoc: PSOC objmgr pointer
  2386. * @macaddr: MAC address of objmgr peer
  2387. *
  2388. * The API will remove the ML peer with objmgr peer fetched from
  2389. * psoc peer list using the @macaddr.
  2390. *
  2391. * Return: void
  2392. */
  2393. void wma_delete_peer_mlo(struct wlan_objmgr_psoc *psoc, uint8_t *macaddr);
  2394. #else
  2395. static inline
  2396. void wma_delete_peer_mlo(struct wlan_objmgr_psoc *psoc, uint8_t *macaddr)
  2397. {
  2398. }
  2399. #endif
  2400. /**
  2401. * wma_remove_bss_peer_on_failure() - remove the bss peers in case of
  2402. * failure
  2403. * @wma: wma handle.
  2404. * @vdev_id: vdev id
  2405. *
  2406. * This API deletes the BSS peer created during ADD BSS in case of ADD BSS
  2407. * request sent to the FW fails.
  2408. *
  2409. * Return: None;
  2410. */
  2411. void wma_remove_bss_peer_on_failure(tp_wma_handle wma, uint8_t vdev_id);
  2412. /**
  2413. * wma_remove_bss_peer_before_join() - remove the bss peers in case of
  2414. * failure before join (vdev start) for sta mode
  2415. * @wma: wma handle.
  2416. * @vdev_id: vdev id
  2417. * @cm_join_req: join cm context
  2418. *
  2419. * This API deletes the BSS peer if any failure before "join" (vdev start).
  2420. * And indicate connection failure to CM after bss peer delete event comes
  2421. * from FW.
  2422. *
  2423. * Return: QDF_STATUS_SUCCESS if success, QDF_STATUS_E_PENDING if peer delete
  2424. * event will be indicated later from target.
  2425. */
  2426. QDF_STATUS wma_remove_bss_peer_before_join(
  2427. tp_wma_handle wma, uint8_t vdev_id,
  2428. void *cm_join_req);
  2429. /**
  2430. * wma_send_add_bss_resp() - send add bss failure
  2431. * @wma: wma handle.
  2432. * @vdev_id: vdev id
  2433. * @status: status
  2434. *
  2435. * Return: None
  2436. */
  2437. void wma_send_add_bss_resp(tp_wma_handle wma, uint8_t vdev_id,
  2438. QDF_STATUS status);
  2439. /**
  2440. * wma_post_vdev_start_setup() - wma post vdev start handler
  2441. * @wma: wma handle.
  2442. * @vdev_id: vdev id
  2443. *
  2444. * Return: Success or Failure status
  2445. */
  2446. QDF_STATUS wma_post_vdev_start_setup(uint8_t vdev_id);
  2447. /**
  2448. * wma_pre_vdev_start_setup() - wma pre vdev start handler
  2449. * @wma: wma handle.
  2450. * @vdev_id: vdev id
  2451. * @addbss_param: bss param
  2452. *
  2453. * Return: Success or Failure status
  2454. */
  2455. QDF_STATUS wma_pre_vdev_start_setup(uint8_t vdev_id,
  2456. struct bss_params *add_bss);
  2457. #ifdef FEATURE_ANI_LEVEL_REQUEST
  2458. /**
  2459. * wma_send_ani_level_request() - Send get ani level cmd to WMI
  2460. * @wma_handle: wma handle.
  2461. * @freqs: pointer to channels for which ANI level has to be retrieved
  2462. * @num_freqs: number of channels in the above parameter
  2463. *
  2464. * Return: QDF_STATUS
  2465. */
  2466. QDF_STATUS wma_send_ani_level_request(tp_wma_handle wma_handle,
  2467. uint32_t *freqs, uint8_t num_freqs);
  2468. #endif /* FEATURE_ANI_LEVEL_REQUEST */
  2469. /**
  2470. * wma_vdev_detach() - send vdev delete command to fw
  2471. * @wma_handle: wma handle
  2472. * @pdel_vdev_req_param: del vdev params
  2473. *
  2474. * Return: QDF status
  2475. */
  2476. QDF_STATUS wma_vdev_detach(struct del_vdev_params *pdel_vdev_req_param);
  2477. #ifdef WLAN_FEATURE_DYNAMIC_MAC_ADDR_UPDATE
  2478. /**
  2479. * wma_p2p_self_peer_remove() - Send P2P self peer delete command to FW
  2480. * @vdev: Object manager vdev
  2481. *
  2482. * Return: success if peer delete command sent to firmware, else failure.
  2483. */
  2484. QDF_STATUS wma_p2p_self_peer_remove(struct wlan_objmgr_vdev *vdev);
  2485. #endif
  2486. #endif