wma.h 80 KB

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