dp_mon.h 87 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544
  1. /*
  2. * Copyright (c) 2016-2021, The Linux Foundation. All rights reserved.
  3. * Copyright (c) 2021-2022 Qualcomm Innovation Center, Inc. All rights reserved.
  4. *
  5. * Permission to use, copy, modify, and/or distribute this software for any
  6. * purpose with or without fee is hereby granted, provided that the above
  7. * copyright notice and this permission notice appear in all copies.
  8. *
  9. * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
  10. * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
  11. * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
  12. * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
  13. * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
  14. * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
  15. * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  16. */
  17. #ifndef _DP_MON_H_
  18. #define _DP_MON_H_
  19. #include "qdf_trace.h"
  20. #include "dp_internal.h"
  21. #include "dp_types.h"
  22. #include "dp_htt.h"
  23. #ifdef WLAN_TX_PKT_CAPTURE_ENH
  24. #include "dp_tx_capture.h"
  25. #endif
  26. #define DP_INTR_POLL_TIMER_MS 5
  27. #define MON_VDEV_TIMER_INIT 0x1
  28. #define MON_VDEV_TIMER_RUNNING 0x2
  29. /* Budget to reap monitor status ring */
  30. #define DP_MON_REAP_BUDGET 1024
  31. #define MON_BUF_MIN_ENTRIES 64
  32. #define RNG_ERR "SRNG setup failed for"
  33. #define dp_mon_info(params...) \
  34. __QDF_TRACE_FL(QDF_TRACE_LEVEL_INFO_HIGH, QDF_MODULE_ID_MON, ## params)
  35. #define dp_mon_err(params...) QDF_TRACE_ERROR(QDF_MODULE_ID_MON, params)
  36. #define dp_mon_debug(params...) QDF_TRACE_DEBUG(QDF_MODULE_ID_MON, params)
  37. #define dp_mon_warn(params...) QDF_TRACE_WARN(QDF_MODULE_ID_MON, params)
  38. #ifndef WLAN_TX_PKT_CAPTURE_ENH
  39. struct dp_pdev_tx_capture {
  40. };
  41. struct dp_peer_tx_capture {
  42. };
  43. #endif
  44. #ifndef WLAN_TX_PKT_CAPTURE_ENH
  45. static inline void
  46. dp_process_ppdu_stats_update_failed_bitmap(struct dp_pdev *pdev,
  47. void *data,
  48. uint32_t ppdu_id,
  49. uint32_t size)
  50. {
  51. }
  52. #endif
  53. #ifdef DP_CON_MON_MSI_ENABLED
  54. static inline bool dp_is_monitor_mode_using_poll(struct dp_soc *soc)
  55. {
  56. return false;
  57. }
  58. #else
  59. static inline bool dp_is_monitor_mode_using_poll(struct dp_soc *soc)
  60. {
  61. return true;
  62. }
  63. #endif
  64. /*
  65. * dp_mon_soc_attach() - DP monitor soc attach
  66. * @soc: Datapath SOC handle
  67. *
  68. * Return: QDF_STATUS_SUCCESS: Success
  69. * QDF_STATUS_E_NOMEM: Error
  70. */
  71. QDF_STATUS dp_mon_soc_attach(struct dp_soc *soc);
  72. /*
  73. * dp_mon_soc_detach() - DP monitor soc detach
  74. * @soc: Datapath SOC handle
  75. *
  76. * Return: QDF_STATUS_SUCCESS: Success
  77. * QDF_STATUS_E_FAILURE: Error
  78. */
  79. QDF_STATUS dp_mon_soc_detach(struct dp_soc *soc);
  80. /*
  81. * dp_mon_soc_cfg_init() - DP monitor soc config init
  82. * @soc: Datapath SOC handle
  83. *
  84. * Return: QDF_STATUS_SUCCESS: Success
  85. * QDF_STATUS_E_FAILURE: Error
  86. */
  87. QDF_STATUS dp_mon_soc_cfg_init(struct dp_soc *soc);
  88. /*
  89. * dp_mon_pdev_attach() - DP monitor pdev attach
  90. * @pdev: Datapath pdev handle
  91. *
  92. * Return: QDF_STATUS_SUCCESS: Success
  93. * QDF_STATUS_E_NOMEM: Error
  94. */
  95. QDF_STATUS dp_mon_pdev_attach(struct dp_pdev *pdev);
  96. /*
  97. * dp_mon_pdev_detach() - DP monitor pdev detach
  98. * @pdev: Datapath pdev handle
  99. *
  100. * Return: QDF_STATUS_SUCCESS: Success
  101. * QDF_STATUS_E_FAILURE: Error
  102. */
  103. QDF_STATUS dp_mon_pdev_detach(struct dp_pdev *pdev);
  104. /*
  105. * dp_mon_pdev_init() - DP monitor pdev init
  106. * @pdev: Datapath pdev handle
  107. *
  108. * Return: QDF_STATUS_SUCCESS: Success
  109. * QDF_STATUS_E_FAILURE: Error
  110. */
  111. QDF_STATUS dp_mon_pdev_init(struct dp_pdev *pdev);
  112. /*
  113. * dp_mon_pdev_deinit() - DP monitor pdev deinit
  114. * @pdev: Datapath pdev handle
  115. *
  116. * Return: QDF_STATUS_SUCCESS: Success
  117. * QDF_STATUS_E_FAILURE: Error
  118. */
  119. QDF_STATUS dp_mon_pdev_deinit(struct dp_pdev *pdev);
  120. /*
  121. * dp_mon_vdev_attach() - DP monitor vdev attach
  122. * @vdev: Datapath vdev handle
  123. *
  124. * Return: QDF_STATUS_SUCCESS: Success
  125. * QDF_STATUS_E_NOMEM: Error
  126. */
  127. QDF_STATUS dp_mon_vdev_attach(struct dp_vdev *vdev);
  128. /*
  129. * dp_mon_vdev_detach() - DP monitor vdev detach
  130. * @vdev: Datapath vdev handle
  131. *
  132. * Return: QDF_STATUS_SUCCESS: Success
  133. * QDF_STATUS_E_FAILURE: Error
  134. */
  135. QDF_STATUS dp_mon_vdev_detach(struct dp_vdev *vdev);
  136. /*
  137. * dp_mon_peer_attach() - DP monitor peer attach
  138. * @peer: Datapath peer handle
  139. *
  140. * Return: QDF_STATUS_SUCCESS: Success
  141. * QDF_STATUS_E_NOMEM: Error
  142. */
  143. #if defined(WLAN_TX_PKT_CAPTURE_ENH) || defined(FEATURE_PERPKT_INFO)
  144. QDF_STATUS dp_mon_peer_attach(struct dp_peer *peer);
  145. #else
  146. static inline
  147. QDF_STATUS dp_mon_peer_attach(struct dp_peer *peer)
  148. {
  149. return QDF_STATUS_SUCCESS;
  150. }
  151. #endif
  152. /*
  153. * dp_mon_peer_detach() - DP monitor peer detach
  154. * @peer: Datapath peer handle
  155. *
  156. * Return: QDF_STATUS_SUCCESS: Success
  157. * QDF_STATUS_E_FAILURE: Error
  158. */
  159. QDF_STATUS dp_mon_peer_detach(struct dp_peer *peer);
  160. /*
  161. * dp_mon_cdp_ops_register() - Register monitor cdp ops
  162. * @soc: Datapath soc handle
  163. *
  164. */
  165. void dp_mon_cdp_ops_register(struct dp_soc *soc);
  166. /*
  167. * dp_mon_cdp_ops_deregister() - deregister monitor cdp ops
  168. * @soc: Datapath soc handle
  169. *
  170. */
  171. void dp_mon_cdp_ops_deregister(struct dp_soc *soc);
  172. /*
  173. * dp_mon_intr_ops_deregister() - deregister monitor interrupt ops
  174. * @soc: Datapath soc handle
  175. *
  176. */
  177. void dp_mon_intr_ops_deregister(struct dp_soc *soc);
  178. /*
  179. * dp_mon_feature_ops_deregister() - deregister monitor feature ops
  180. * @soc: Datapath soc handle
  181. *
  182. */
  183. void dp_mon_feature_ops_deregister(struct dp_soc *soc);
  184. /*
  185. * dp_mon_ops_free() - free monitor ops
  186. * @soc: Datapath soc handle
  187. *
  188. */
  189. void dp_mon_ops_free(struct dp_soc *soc);
  190. /*
  191. * dp_mon_ops_register() - Register monitor ops
  192. * @soc: Datapath soc handle
  193. *
  194. */
  195. void dp_mon_ops_register(struct dp_soc *soc);
  196. #ifndef DISABLE_MON_CONFIG
  197. void dp_mon_register_intr_ops(struct dp_soc *soc);
  198. #else
  199. static inline void dp_mon_register_intr_ops(struct dp_soc *soc)
  200. {}
  201. #endif
  202. /*
  203. * dp_mon_htt_srng_setup() - DP mon htt srng setup
  204. * @soc: Datapath soc handle
  205. * @pdev: Datapath pdev handle
  206. * @mac_id: mac id
  207. * @mac_for_pdev: mac id mapped pdev
  208. *
  209. * Return: QDF_STATUS_SUCCESS: Success
  210. * QDF_STATUS_E_FAILURE: Error
  211. */
  212. QDF_STATUS dp_mon_htt_srng_setup(struct dp_soc *soc,
  213. struct dp_pdev *pdev,
  214. int mac_id,
  215. int mac_for_pdev);
  216. /*
  217. * dp_config_debug_sniffer()- API to enable/disable debug sniffer
  218. * @pdev: DP_PDEV handle
  219. * @val: user provided value
  220. *
  221. * Return: 0 for success. nonzero for failure.
  222. */
  223. #if defined(QCA_MCOPY_SUPPORT) || defined(QCA_TX_CAPTURE_SUPPORT)
  224. QDF_STATUS
  225. dp_config_debug_sniffer(struct dp_pdev *pdev, int val);
  226. #else
  227. static inline QDF_STATUS
  228. dp_config_debug_sniffer(struct dp_pdev *pdev, int val) {
  229. return QDF_STATUS_E_INVAL;
  230. }
  231. #endif /* QCA_MCOPY_SUPPORT || QCA_TX_CAPTURE_SUPPORT */
  232. /*
  233. * dp_htt_ppdu_stats_attach() - attach resources for HTT PPDU stats processing
  234. * @pdev: Datapath PDEV handle
  235. *
  236. * Return: QDF_STATUS_SUCCESS: Success
  237. * QDF_STATUS_E_NOMEM: Error
  238. */
  239. QDF_STATUS dp_htt_ppdu_stats_attach(struct dp_pdev *pdev);
  240. /*
  241. * dp_htt_ppdu_stats_detach() - detach stats resources
  242. * @pdev: Datapath PDEV handle
  243. *
  244. * Return: void
  245. */
  246. void dp_htt_ppdu_stats_detach(struct dp_pdev *pdev);
  247. /*
  248. *dp_set_bpr_enable() - API to enable/disable bpr feature
  249. *@pdev_handle: DP_PDEV handle.
  250. *@val: Provided value.
  251. *
  252. *Return: 0 for success. nonzero for failure.
  253. */
  254. #ifdef QCA_SUPPORT_BPR
  255. QDF_STATUS
  256. dp_set_bpr_enable(struct dp_pdev *pdev, int val);
  257. #endif
  258. #ifdef ATH_SUPPORT_NAC
  259. int dp_set_filter_neigh_peers(struct dp_pdev *pdev,
  260. bool val);
  261. #endif /* ATH_SUPPORT_NAC */
  262. #ifdef WLAN_ATF_ENABLE
  263. void dp_set_atf_stats_enable(struct dp_pdev *pdev, bool value);
  264. #endif
  265. /**
  266. * dp_set_bsscolor() - sets bsscolor for tx capture
  267. * @pdev: Datapath PDEV handle
  268. * @bsscolor: new bsscolor
  269. */
  270. void
  271. dp_mon_set_bsscolor(struct dp_pdev *pdev, uint8_t bsscolor);
  272. /**
  273. * dp_pdev_get_filter_ucast_data() - get DP PDEV monitor ucast filter
  274. * @soc : data path soc handle
  275. * @pdev_id : pdev_id
  276. * Return: true on ucast filter flag set
  277. */
  278. bool dp_pdev_get_filter_ucast_data(struct cdp_pdev *pdev_handle);
  279. /**
  280. * dp_pdev_get_filter_mcast_data() - get DP PDEV monitor mcast filter
  281. * @pdev_handle: Datapath PDEV handle
  282. * Return: true on mcast filter flag set
  283. */
  284. bool dp_pdev_get_filter_mcast_data(struct cdp_pdev *pdev_handle);
  285. /**
  286. * dp_pdev_get_filter_non_data() - get DP PDEV monitor non_data filter
  287. * @pdev_handle: Datapath PDEV handle
  288. * Return: true on non data filter flag set
  289. */
  290. bool dp_pdev_get_filter_non_data(struct cdp_pdev *pdev_handle);
  291. /*
  292. * dp_set_pktlog_wifi3() - attach txrx vdev
  293. * @pdev: Datapath PDEV handle
  294. * @event: which event's notifications are being subscribed to
  295. * @enable: WDI event subscribe or not. (True or False)
  296. *
  297. * Return: Success, NULL on failure
  298. */
  299. #ifdef WDI_EVENT_ENABLE
  300. int dp_set_pktlog_wifi3(struct dp_pdev *pdev, uint32_t event,
  301. bool enable);
  302. #endif
  303. /* MCL specific functions */
  304. #if defined(DP_CON_MON) && !defined(REMOVE_PKT_LOG)
  305. /**
  306. * dp_pktlogmod_exit() - API to cleanup pktlog info
  307. * @pdev: Pdev handle
  308. *
  309. * Return: none
  310. */
  311. void dp_pktlogmod_exit(struct dp_pdev *pdev);
  312. #else
  313. static inline
  314. void dp_pktlogmod_exit(struct dp_pdev *handle)
  315. {
  316. }
  317. #endif
  318. #ifdef QCA_MONITOR_PKT_SUPPORT
  319. /**
  320. * dp_vdev_set_monitor_mode_buf_rings () - set monitor mode buf rings
  321. *
  322. * Allocate SW descriptor pool, buffers, link descriptor memory
  323. * Initialize monitor related SRNGs
  324. *
  325. * @pdev: DP pdev object
  326. *
  327. * Return: void
  328. */
  329. void dp_vdev_set_monitor_mode_buf_rings(struct dp_pdev *pdev);
  330. /**
  331. * dp_vdev_set_monitor_mode_rings () - set monitor mode rings
  332. *
  333. * Allocate SW descriptor pool, buffers, link descriptor memory
  334. * Initialize monitor related SRNGs
  335. *
  336. * @pdev: DP pdev object
  337. *
  338. * Return: QDF_STATUS
  339. */
  340. QDF_STATUS dp_vdev_set_monitor_mode_rings(struct dp_pdev *pdev,
  341. uint8_t delayed_replenish);
  342. #else
  343. static inline void
  344. dp_vdev_set_monitor_mode_buf_rings(struct dp_pdev *pdev)
  345. {
  346. }
  347. static inline QDF_STATUS
  348. dp_vdev_set_monitor_mode_rings(struct dp_pdev *pdev,
  349. uint8_t delayed_replenish)
  350. {
  351. return QDF_STATUS_SUCCESS;
  352. }
  353. #endif
  354. #if defined(WDI_EVENT_ENABLE) &&\
  355. (defined(QCA_ENHANCED_STATS_SUPPORT) || !defined(REMOVE_PKT_LOG))
  356. /*
  357. * dp_ppdu_stats_ind_handler() - PPDU stats msg handler
  358. * @htt_soc: HTT SOC handle
  359. * @msg_word: Pointer to payload
  360. * @htt_t2h_msg: HTT msg nbuf
  361. *
  362. * Return: True if buffer should be freed by caller.
  363. */
  364. bool dp_ppdu_stats_ind_handler(struct htt_soc *soc,
  365. uint32_t *msg_word,
  366. qdf_nbuf_t htt_t2h_msg);
  367. #endif
  368. struct dp_mon_ops {
  369. QDF_STATUS (*mon_soc_cfg_init)(struct dp_soc *soc);
  370. QDF_STATUS (*mon_soc_attach)(struct dp_soc *soc);
  371. QDF_STATUS (*mon_soc_detach)(struct dp_soc *soc);
  372. QDF_STATUS (*mon_pdev_alloc)(struct dp_pdev *pdev);
  373. void (*mon_pdev_free)(struct dp_pdev *pdev);
  374. QDF_STATUS (*mon_pdev_attach)(struct dp_pdev *pdev);
  375. QDF_STATUS (*mon_pdev_detach)(struct dp_pdev *pdev);
  376. QDF_STATUS (*mon_pdev_init)(struct dp_pdev *pdev);
  377. QDF_STATUS (*mon_pdev_deinit)(struct dp_pdev *pdev);
  378. QDF_STATUS (*mon_vdev_attach)(struct dp_vdev *vdev);
  379. QDF_STATUS (*mon_vdev_detach)(struct dp_vdev *vdev);
  380. QDF_STATUS (*mon_peer_attach)(struct dp_peer *peer);
  381. QDF_STATUS (*mon_peer_detach)(struct dp_peer *peer);
  382. QDF_STATUS (*mon_config_debug_sniffer)(struct dp_pdev *pdev, int val);
  383. void (*mon_flush_rings)(struct dp_soc *soc);
  384. #if !defined(DISABLE_MON_CONFIG)
  385. QDF_STATUS (*mon_pdev_htt_srng_setup)(struct dp_soc *soc,
  386. struct dp_pdev *pdev,
  387. int mac_id,
  388. int mac_for_pdev);
  389. QDF_STATUS (*mon_soc_htt_srng_setup)(struct dp_soc *soc);
  390. #endif
  391. #if !defined(DISABLE_MON_CONFIG) && defined(MON_ENABLE_DROP_FOR_MAC)
  392. uint32_t (*mon_drop_packets_for_mac)(struct dp_pdev *pdev,
  393. uint32_t mac_id,
  394. uint32_t quota);
  395. #endif
  396. #if defined(DP_CON_MON)
  397. void (*mon_service_rings)(struct dp_soc *soc, uint32_t quota);
  398. #endif
  399. #ifndef DISABLE_MON_CONFIG
  400. uint32_t (*mon_rx_process)(struct dp_soc *soc,
  401. struct dp_intr *int_ctx,
  402. uint32_t mac_id,
  403. uint32_t quota);
  404. uint32_t (*mon_tx_process)(struct dp_soc *soc,
  405. struct dp_intr *int_ctx,
  406. uint32_t mac_id,
  407. uint32_t quota);
  408. #endif
  409. void (*mon_peer_tx_init)(struct dp_pdev *pdev, struct dp_peer *peer);
  410. void (*mon_peer_tx_cleanup)(struct dp_vdev *vdev,
  411. struct dp_peer *peer);
  412. #ifdef WLAN_TX_PKT_CAPTURE_ENH
  413. void (*mon_peer_tid_peer_id_update)(struct dp_peer *peer,
  414. uint16_t peer_id);
  415. void (*mon_tx_ppdu_stats_attach)(struct dp_pdev *pdev);
  416. void (*mon_tx_ppdu_stats_detach)(struct dp_pdev *pdev);
  417. QDF_STATUS (*mon_tx_capture_debugfs_init)(struct dp_pdev *pdev);
  418. void (*mon_peer_tx_capture_filter_check)(struct dp_pdev *pdev,
  419. struct dp_peer *peer);
  420. QDF_STATUS (*mon_tx_add_to_comp_queue)(struct dp_soc *soc,
  421. struct dp_tx_desc_s *desc,
  422. struct hal_tx_completion_status *ts,
  423. struct dp_peer *peer);
  424. QDF_STATUS (*mon_update_msdu_to_list)(struct dp_soc *soc,
  425. struct dp_pdev *pdev,
  426. struct dp_peer *peer,
  427. struct hal_tx_completion_status *ts,
  428. qdf_nbuf_t netbuf);
  429. QDF_STATUS
  430. (*mon_peer_tx_capture_get_stats)(struct dp_peer *peer,
  431. struct cdp_peer_tx_capture_stats *sts);
  432. QDF_STATUS
  433. (*mon_pdev_tx_capture_get_stats)(struct dp_pdev *pdev,
  434. struct cdp_pdev_tx_capture_stats *sts);
  435. #endif
  436. #if defined(WDI_EVENT_ENABLE) &&\
  437. (defined(QCA_ENHANCED_STATS_SUPPORT) || !defined(REMOVE_PKT_LOG))
  438. bool (*mon_ppdu_stats_ind_handler)(struct htt_soc *soc,
  439. uint32_t *msg_word,
  440. qdf_nbuf_t htt_t2h_msg);
  441. #endif
  442. QDF_STATUS (*mon_htt_ppdu_stats_attach)(struct dp_pdev *pdev);
  443. void (*mon_htt_ppdu_stats_detach)(struct dp_pdev *pdev);
  444. void (*mon_print_pdev_rx_mon_stats)(struct dp_pdev *pdev);
  445. #ifdef WLAN_TX_PKT_CAPTURE_ENH
  446. void (*mon_print_pdev_tx_capture_stats)(struct dp_pdev *pdev);
  447. QDF_STATUS (*mon_config_enh_tx_capture)(struct dp_pdev *pdev,
  448. uint8_t val);
  449. #endif
  450. #ifdef WLAN_RX_PKT_CAPTURE_ENH
  451. QDF_STATUS (*mon_config_enh_rx_capture)(struct dp_pdev *pdev,
  452. uint8_t val);
  453. #endif
  454. #ifdef QCA_SUPPORT_BPR
  455. QDF_STATUS (*mon_set_bpr_enable)(struct dp_pdev *pdev, int val);
  456. #endif
  457. #ifdef ATH_SUPPORT_NAC
  458. int (*mon_set_filter_neigh_peers)(struct dp_pdev *pdev, bool val);
  459. #endif
  460. #ifdef WLAN_ATF_ENABLE
  461. void (*mon_set_atf_stats_enable)(struct dp_pdev *pdev, bool value);
  462. #endif
  463. void (*mon_set_bsscolor)(struct dp_pdev *pdev, uint8_t bsscolor);
  464. bool (*mon_pdev_get_filter_ucast_data)(struct cdp_pdev *pdev_handle);
  465. bool (*mon_pdev_get_filter_non_data)(struct cdp_pdev *pdev_handle);
  466. bool (*mon_pdev_get_filter_mcast_data)(struct cdp_pdev *pdev_handle);
  467. #ifdef WDI_EVENT_ENABLE
  468. int (*mon_set_pktlog_wifi3)(struct dp_pdev *pdev, uint32_t event,
  469. bool enable);
  470. #endif
  471. #if defined(DP_CON_MON) && !defined(REMOVE_PKT_LOG)
  472. void (*mon_pktlogmod_exit)(struct dp_pdev *pdev);
  473. #endif
  474. void (*mon_vdev_set_monitor_mode_buf_rings)(struct dp_pdev *pdev);
  475. QDF_STATUS (*mon_vdev_set_monitor_mode_rings)(struct dp_pdev *pdev,
  476. uint8_t delayed_replenish);
  477. void (*mon_neighbour_peers_detach)(struct dp_pdev *pdev);
  478. #ifdef FEATURE_NAC_RSSI
  479. QDF_STATUS (*mon_filter_neighbour_peer)(struct dp_pdev *pdev,
  480. uint8_t *rx_pkt_hdr);
  481. #endif
  482. void (*mon_vdev_timer_init)(struct dp_soc *soc);
  483. void (*mon_vdev_timer_start)(struct dp_soc *soc);
  484. bool (*mon_vdev_timer_stop)(struct dp_soc *soc);
  485. void (*mon_vdev_timer_deinit)(struct dp_soc *soc);
  486. void (*mon_reap_timer_init)(struct dp_soc *soc);
  487. void (*mon_reap_timer_start)(struct dp_soc *soc);
  488. bool (*mon_reap_timer_stop)(struct dp_soc *soc);
  489. void (*mon_reap_timer_deinit)(struct dp_soc *soc);
  490. #ifdef QCA_MCOPY_SUPPORT
  491. QDF_STATUS (*mon_mcopy_check_deliver)(struct dp_pdev *pdev,
  492. uint16_t peer_id,
  493. uint32_t ppdu_id,
  494. uint8_t first_msdu);
  495. #endif
  496. void (*mon_neighbour_peer_add_ast)(struct dp_pdev *pdev,
  497. struct dp_peer *ta_peer,
  498. uint8_t *mac_addr,
  499. qdf_nbuf_t nbuf,
  500. uint32_t flags);
  501. #ifdef QCA_ENHANCED_STATS_SUPPORT
  502. void (*mon_filter_setup_enhanced_stats)(struct dp_pdev *pdev);
  503. void (*mon_filter_reset_enhanced_stats)(struct dp_pdev *pdev);
  504. void (*mon_tx_stats_update)(struct dp_peer *peer,
  505. struct cdp_tx_completion_ppdu_user *ppdu);
  506. #endif
  507. #ifdef QCA_MCOPY_SUPPORT
  508. void (*mon_filter_setup_mcopy_mode)(struct dp_pdev *pdev);
  509. void (*mon_filter_reset_mcopy_mode)(struct dp_pdev *pdev);
  510. #endif
  511. #if defined(ATH_SUPPORT_NAC_RSSI) || defined(ATH_SUPPORT_NAC)
  512. void (*mon_filter_setup_smart_monitor)(struct dp_pdev *pdev);
  513. void (*mon_filter_reset_smart_monitor)(struct dp_pdev *pdev);
  514. #endif
  515. #ifdef WLAN_RX_PKT_CAPTURE_ENH
  516. void (*mon_filter_setup_rx_enh_capture)(struct dp_pdev *pdev);
  517. void (*mon_filter_reset_rx_enh_capture)(struct dp_pdev *pdev);
  518. #endif
  519. void (*mon_filter_setup_rx_mon_mode)(struct dp_pdev *pdev);
  520. void (*mon_filter_reset_rx_mon_mode)(struct dp_pdev *pdev);
  521. void (*mon_filter_setup_tx_mon_mode)(struct dp_pdev *pdev);
  522. void (*mon_filter_reset_tx_mon_mode)(struct dp_pdev *pdev);
  523. #ifdef WDI_EVENT_ENABLE
  524. void (*mon_filter_setup_rx_pkt_log_full)(struct dp_pdev *pdev);
  525. void (*mon_filter_reset_rx_pkt_log_full)(struct dp_pdev *pdev);
  526. void (*mon_filter_setup_rx_pkt_log_lite)(struct dp_pdev *pdev);
  527. void (*mon_filter_reset_rx_pkt_log_lite)(struct dp_pdev *pdev);
  528. void (*mon_filter_setup_rx_pkt_log_cbf)(struct dp_pdev *pdev);
  529. void (*mon_filter_reset_rx_pkt_log_cbf)(struct dp_pdev *pdev);
  530. #ifdef QCA_WIFI_QCN9224
  531. void (*mon_filter_setup_pktlog_hybrid)(struct dp_pdev *pdev);
  532. void (*mon_filter_reset_pktlog_hybrid)(struct dp_pdev *pdev);
  533. #endif
  534. #endif
  535. QDF_STATUS (*rx_mon_filter_update)(struct dp_pdev *pdev);
  536. QDF_STATUS (*tx_mon_filter_update)(struct dp_pdev *pdev);
  537. QDF_STATUS (*tx_mon_filter_alloc)(struct dp_pdev *pdev);
  538. void (*tx_mon_filter_dealloc)(struct dp_pdev *pdev);
  539. QDF_STATUS (*mon_rings_alloc)(struct dp_pdev *pdev);
  540. void (*mon_rings_free)(struct dp_pdev *pdev);
  541. QDF_STATUS (*mon_rings_init)(struct dp_pdev *pdev);
  542. void (*mon_rings_deinit)(struct dp_pdev *pdev);
  543. QDF_STATUS (*rx_mon_buffers_alloc)(struct dp_pdev *pdev);
  544. void (*rx_mon_buffers_free)(struct dp_pdev *pdev);
  545. void (*rx_mon_desc_pool_init)(struct dp_pdev *pdev);
  546. void (*rx_mon_desc_pool_deinit)(struct dp_pdev *pdev);
  547. QDF_STATUS (*rx_mon_desc_pool_alloc)(struct dp_pdev *pdev);
  548. void (*rx_mon_desc_pool_free)(struct dp_pdev *pdev);
  549. void (*tx_mon_desc_pool_init)(struct dp_pdev *pdev);
  550. void (*tx_mon_desc_pool_deinit)(struct dp_pdev *pdev);
  551. QDF_STATUS (*tx_mon_desc_pool_alloc)(struct dp_pdev *pdev);
  552. void (*tx_mon_desc_pool_free)(struct dp_pdev *pdev);
  553. void (*rx_packet_length_set)(uint32_t *msg_word,
  554. struct htt_rx_ring_tlv_filter *tlv_filter);
  555. void (*rx_wmask_subscribe)(uint32_t *msg_word,
  556. struct htt_rx_ring_tlv_filter *tlv_filter);
  557. void (*rx_enable_mpdu_logging)(uint32_t *msg_word,
  558. struct htt_rx_ring_tlv_filter *tlv_filter);
  559. #ifndef DISABLE_MON_CONFIG
  560. void (*mon_register_intr_ops)(struct dp_soc *soc);
  561. #endif
  562. void (*mon_register_feature_ops)(struct dp_soc *soc);
  563. #ifdef QCA_ENHANCED_STATS_SUPPORT
  564. void (*mon_rx_stats_update)(struct dp_peer *peer,
  565. struct cdp_rx_indication_ppdu *ppdu,
  566. struct cdp_rx_stats_ppdu_user *ppdu_user);
  567. void (*mon_rx_populate_ppdu_usr_info)(struct mon_rx_user_status *rx_user_status,
  568. struct cdp_rx_stats_ppdu_user *ppdu_user);
  569. void (*mon_rx_populate_ppdu_info)(struct hal_rx_ppdu_info *hal_ppdu_info,
  570. struct cdp_rx_indication_ppdu *ppdu);
  571. #endif
  572. QDF_STATUS (*rx_mon_refill_buf_ring)(struct dp_intr *int_ctx);
  573. QDF_STATUS (*tx_mon_refill_buf_ring)(struct dp_intr *int_ctx);
  574. };
  575. struct dp_mon_soc {
  576. /* Holds all monitor related fields extracted from dp_soc */
  577. /* Holds pointer to monitor ops */
  578. /* monitor link descriptor pages */
  579. struct qdf_mem_multi_page_t mon_link_desc_pages[MAX_NUM_LMAC_HW];
  580. /* total link descriptors for monitor mode for each radio */
  581. uint32_t total_mon_link_descs[MAX_NUM_LMAC_HW];
  582. /* Monitor Link descriptor memory banks */
  583. struct link_desc_bank
  584. mon_link_desc_banks[MAX_NUM_LMAC_HW][MAX_MON_LINK_DESC_BANKS];
  585. uint32_t num_mon_link_desc_banks[MAX_NUM_LMAC_HW];
  586. /* Smart monitor capability for HKv2 */
  587. uint8_t hw_nac_monitor_support;
  588. /* Full monitor mode support */
  589. bool full_mon_mode;
  590. /*interrupt timer*/
  591. qdf_timer_t mon_reap_timer;
  592. uint8_t reap_timer_init;
  593. qdf_timer_t mon_vdev_timer;
  594. uint8_t mon_vdev_timer_state;
  595. struct dp_mon_ops *mon_ops;
  596. bool monitor_mode_v2;
  597. #ifndef DISABLE_MON_CONFIG
  598. uint32_t (*mon_rx_process)(struct dp_soc *soc,
  599. struct dp_intr *int_ctx,
  600. uint32_t mac_id,
  601. uint32_t quota);
  602. #endif
  603. #ifdef WLAN_TX_PKT_CAPTURE_ENH
  604. struct dp_soc_tx_capture dp_soc_tx_capt;
  605. #endif
  606. };
  607. struct dp_mon_pdev {
  608. /* monitor */
  609. bool monitor_configured;
  610. struct dp_mon_filter **filter; /* Monitor Filter pointer */
  611. /* advance filter mode and type*/
  612. uint8_t mon_filter_mode;
  613. uint16_t fp_mgmt_filter;
  614. uint16_t fp_ctrl_filter;
  615. uint16_t fp_data_filter;
  616. uint16_t mo_mgmt_filter;
  617. uint16_t mo_ctrl_filter;
  618. uint16_t mo_data_filter;
  619. uint16_t md_data_filter;
  620. #ifdef WLAN_TX_PKT_CAPTURE_ENH
  621. struct dp_pdev_tx_capture tx_capture;
  622. bool stop_tx_capture_work_q_timer;
  623. #endif
  624. /* tx packet capture enhancement */
  625. enum cdp_tx_enh_capture_mode tx_capture_enabled;
  626. /* Stuck count on monitor destination ring MPDU process */
  627. uint32_t mon_dest_ring_stuck_cnt;
  628. /* monitor mode lock */
  629. qdf_spinlock_t mon_lock;
  630. /* Monitor mode operation channel */
  631. int mon_chan_num;
  632. /* Monitor mode operation frequency */
  633. qdf_freq_t mon_chan_freq;
  634. /* Monitor mode band */
  635. enum reg_wifi_band mon_chan_band;
  636. uint32_t mon_ppdu_status;
  637. /* monitor mode status/destination ring PPDU and MPDU count */
  638. struct cdp_pdev_mon_stats rx_mon_stats;
  639. /* Monitor mode interface and status storage */
  640. struct dp_vdev *mvdev;
  641. struct cdp_mon_status rx_mon_recv_status;
  642. /* to track duplicate link descriptor indications by HW for a WAR */
  643. uint64_t mon_last_linkdesc_paddr;
  644. /* to track duplicate buffer indications by HW for a WAR */
  645. uint32_t mon_last_buf_cookie;
  646. #ifdef QCA_SUPPORT_FULL_MON
  647. /* List to maintain all MPDUs for a PPDU in monitor mode */
  648. TAILQ_HEAD(, dp_mon_mpdu) mon_mpdu_q;
  649. /* TODO: define per-user mpdu list
  650. * struct dp_mon_mpdu_list mpdu_list[MAX_MU_USERS];
  651. */
  652. struct hal_rx_mon_desc_info *mon_desc;
  653. #endif
  654. /* Flag to hold on to monitor destination ring */
  655. bool hold_mon_dest_ring;
  656. /* Flag to inidicate monitor rings are initialized */
  657. uint8_t pdev_mon_init;
  658. #ifndef REMOVE_PKT_LOG
  659. bool pkt_log_init;
  660. struct pktlog_dev_t *pl_dev; /* Pktlog pdev */
  661. #endif /* #ifndef REMOVE_PKT_LOG */
  662. /* Smart Mesh */
  663. bool filter_neighbour_peers;
  664. /*flag to indicate neighbour_peers_list not empty */
  665. bool neighbour_peers_added;
  666. /* smart mesh mutex */
  667. qdf_spinlock_t neighbour_peer_mutex;
  668. /* Neighnour peer list */
  669. TAILQ_HEAD(, dp_neighbour_peer) neighbour_peers_list;
  670. /* Enhanced Stats is enabled */
  671. bool enhanced_stats_en;
  672. qdf_nbuf_queue_t rx_status_q;
  673. /* 128 bytes mpdu header queue per user for ppdu */
  674. qdf_nbuf_queue_t mpdu_q[MAX_MU_USERS];
  675. /* is this a mpdu header TLV and not msdu header TLV */
  676. bool is_mpdu_hdr[MAX_MU_USERS];
  677. /* per user 128 bytes msdu header list for MPDU */
  678. struct msdu_list msdu_list[MAX_MU_USERS];
  679. /* RX enhanced capture mode */
  680. uint8_t rx_enh_capture_mode;
  681. /* Rx per peer enhanced capture mode */
  682. bool rx_enh_capture_peer;
  683. struct dp_vdev *rx_enh_monitor_vdev;
  684. /* RX enhanced capture trailer enable/disable flag */
  685. bool is_rx_enh_capture_trailer_enabled;
  686. #ifdef WLAN_RX_PKT_CAPTURE_ENH
  687. /* RX per MPDU/PPDU information */
  688. struct cdp_rx_indication_mpdu mpdu_ind;
  689. #endif
  690. /* Packet log mode */
  691. uint8_t rx_pktlog_mode;
  692. /* Enable pktlog logging cbf */
  693. bool rx_pktlog_cbf;
  694. /* Enable pktlog logging hybrid */
  695. #ifdef QCA_WIFI_QCN9224
  696. bool pktlog_hybrid_mode;
  697. #endif
  698. bool tx_sniffer_enable;
  699. /* mirror copy mode */
  700. enum m_copy_mode mcopy_mode;
  701. bool enable_reap_timer_non_pkt;
  702. bool bpr_enable;
  703. /* Pdev level flag to check peer based pktlog enabled or
  704. * disabled
  705. */
  706. uint8_t dp_peer_based_pktlog;
  707. #ifdef WLAN_ATF_ENABLE
  708. /* ATF stats enable */
  709. bool dp_atf_stats_enable;
  710. #endif
  711. /* Maintains first status buffer's paddr of a PPDU */
  712. uint64_t status_buf_addr;
  713. struct hal_rx_ppdu_info ppdu_info;
  714. /* ppdu_id of last received HTT TX stats */
  715. uint32_t last_ppdu_id;
  716. struct {
  717. uint8_t last_user;
  718. qdf_nbuf_t buf;
  719. } tx_ppdu_info;
  720. struct {
  721. uint32_t tx_ppdu_id;
  722. uint16_t tx_peer_id;
  723. uint32_t rx_ppdu_id;
  724. } m_copy_id;
  725. /* To check if PPDU Tx stats are enabled for Pktlog */
  726. bool pktlog_ppdu_stats;
  727. #ifdef ATH_SUPPORT_NAC_RSSI
  728. bool nac_rssi_filtering;
  729. #endif
  730. /* ppdu_stats lock for queue concurrency between cores*/
  731. qdf_spinlock_t ppdu_stats_lock;
  732. /* list of ppdu tlvs */
  733. TAILQ_HEAD(, ppdu_info) ppdu_info_list;
  734. TAILQ_HEAD(, ppdu_info) sched_comp_ppdu_list;
  735. uint32_t sched_comp_list_depth;
  736. uint16_t delivered_sched_cmdid;
  737. uint16_t last_sched_cmdid;
  738. uint32_t tlv_count;
  739. uint32_t list_depth;
  740. struct {
  741. qdf_nbuf_t last_nbuf; /*Ptr to mgmt last buf */
  742. uint8_t *mgmt_buf; /* Ptr to mgmt. payload in HTT ppdu stats */
  743. uint32_t mgmt_buf_len; /* Len of mgmt. payload in ppdu stats */
  744. uint32_t ppdu_id;
  745. } mgmtctrl_frm_info;
  746. /* Context of cal client timer */
  747. struct cdp_cal_client *cal_client_ctx;
  748. uint32_t *ppdu_tlv_buf; /* Buffer to hold HTT ppdu stats TLVs*/
  749. qdf_nbuf_t mcopy_status_nbuf;
  750. bool is_dp_mon_pdev_initialized;
  751. /* indicates if spcl vap is configured */
  752. bool scan_spcl_vap_configured;
  753. #ifdef QCA_SUPPORT_SCAN_SPCL_VAP_STATS
  754. /* enable spcl vap stats reset on ch change */
  755. bool reset_scan_spcl_vap_stats_enable;
  756. #endif
  757. bool is_tlv_hdr_64_bit;
  758. };
  759. struct dp_mon_vdev {
  760. /* callback to hand rx monitor 802.11 MPDU to the OS shim */
  761. ol_txrx_rx_mon_fp osif_rx_mon;
  762. #ifdef QCA_SUPPORT_SCAN_SPCL_VAP_STATS
  763. struct cdp_scan_spcl_vap_stats *scan_spcl_vap_stats;
  764. #endif
  765. };
  766. struct dp_mon_peer {
  767. #ifdef WLAN_TX_PKT_CAPTURE_ENH
  768. struct dp_peer_tx_capture tx_capture;
  769. #endif
  770. #ifdef FEATURE_PERPKT_INFO
  771. /* delayed ba ppdu stats handling */
  772. struct cdp_delayed_tx_completion_ppdu_user delayed_ba_ppdu_stats;
  773. /* delayed ba flag */
  774. bool last_delayed_ba;
  775. /* delayed ba ppdu id */
  776. uint32_t last_delayed_ba_ppduid;
  777. #endif
  778. };
  779. #if defined(QCA_TX_CAPTURE_SUPPORT) || defined(QCA_ENHANCED_STATS_SUPPORT)
  780. void dp_deliver_mgmt_frm(struct dp_pdev *pdev, qdf_nbuf_t nbuf);
  781. #else
  782. static inline
  783. void dp_deliver_mgmt_frm(struct dp_pdev *pdev, qdf_nbuf_t nbuf)
  784. {
  785. }
  786. #endif
  787. #if defined(WLAN_SUPPORT_RX_PROTOCOL_TYPE_TAG) ||\
  788. defined(WLAN_SUPPORT_RX_FLOW_TAG)
  789. /**
  790. * dp_rx_mon_update_protocol_flow_tag() - Performs necessary checks for monitor
  791. * mode and then tags appropriate packets
  792. * @soc: core txrx main context
  793. * @vdev: pdev on which packet is received
  794. * @msdu: QDF packet buffer on which the protocol tag should be set
  795. * @rx_desc: base address where the RX TLVs start
  796. * Return: void
  797. */
  798. void dp_rx_mon_update_protocol_flow_tag(struct dp_soc *soc,
  799. struct dp_pdev *dp_pdev,
  800. qdf_nbuf_t msdu, void *rx_desc);
  801. #endif /* WLAN_SUPPORT_RX_PROTOCOL_TYPE_TAG || WLAN_SUPPORT_RX_FLOW_TAG */
  802. #if !defined(WLAN_SUPPORT_RX_PROTOCOL_TYPE_TAG) &&\
  803. !defined(WLAN_SUPPORT_RX_FLOW_TAG)
  804. /**
  805. * dp_rx_mon_update_protocol_flow_tag() - Performs necessary checks for monitor
  806. * mode and then tags appropriate packets
  807. * @soc: core txrx main context
  808. * @vdev: pdev on which packet is received
  809. * @msdu: QDF packet buffer on which the protocol tag should be set
  810. * @rx_desc: base address where the RX TLVs start
  811. * Return: void
  812. */
  813. static inline
  814. void dp_rx_mon_update_protocol_flow_tag(struct dp_soc *soc,
  815. struct dp_pdev *dp_pdev,
  816. qdf_nbuf_t msdu, void *rx_desc)
  817. {
  818. }
  819. #endif /* WLAN_SUPPORT_RX_PROTOCOL_TYPE_TAG || WLAN_SUPPORT_RX_FLOW_TAG */
  820. #ifndef WLAN_TX_PKT_CAPTURE_ENH
  821. static inline
  822. QDF_STATUS dp_peer_set_tx_capture_enabled(struct dp_pdev *pdev,
  823. struct dp_peer *peer_handle,
  824. uint8_t value, uint8_t *peer_mac)
  825. {
  826. return QDF_STATUS_SUCCESS;
  827. }
  828. /**
  829. * dp_peer_tid_queue_init() – Initialize ppdu stats queue per TID
  830. * @peer: Datapath peer
  831. *
  832. */
  833. static inline void dp_peer_tid_queue_init(struct dp_peer *peer)
  834. {
  835. }
  836. /**
  837. * dp_peer_tid_queue_cleanup() – remove ppdu stats queue per TID
  838. * @peer: Datapath peer
  839. *
  840. */
  841. static inline void dp_peer_tid_queue_cleanup(struct dp_peer *peer)
  842. {
  843. }
  844. /**
  845. * dp_peer_update_80211_hdr() – dp peer update 80211 hdr
  846. * @vdev: Datapath vdev
  847. * @peer: Datapath peer
  848. *
  849. */
  850. static inline void
  851. dp_peer_update_80211_hdr(struct dp_vdev *vdev, struct dp_peer *peer)
  852. {
  853. }
  854. /**
  855. * dp_tx_ppdu_stats_attach - Initialize Tx PPDU stats and enhanced capture
  856. * @pdev: DP PDEV
  857. *
  858. * Return: none
  859. */
  860. static inline void dp_tx_ppdu_stats_attach(struct dp_pdev *pdev)
  861. {
  862. }
  863. /**
  864. * dp_tx_ppdu_stats_detach - Cleanup Tx PPDU stats and enhanced capture
  865. * @pdev: DP PDEV
  866. *
  867. * Return: none
  868. */
  869. static inline void dp_tx_ppdu_stats_detach(struct dp_pdev *pdev)
  870. {
  871. }
  872. /**
  873. * dp_tx_add_to_comp_queue() - add completion msdu to queue
  874. * @soc: DP Soc handle
  875. * @tx_desc: software Tx descriptor
  876. * @ts : Tx completion status from HAL/HTT descriptor
  877. * @peer: DP peer
  878. *
  879. * Return: none
  880. */
  881. static inline
  882. QDF_STATUS dp_tx_add_to_comp_queue(struct dp_soc *soc,
  883. struct dp_tx_desc_s *desc,
  884. struct hal_tx_completion_status *ts,
  885. struct dp_peer *peer)
  886. {
  887. return QDF_STATUS_E_FAILURE;
  888. }
  889. /**
  890. * dp_update_msdu_to_list(): Function to queue msdu from wbm
  891. * @pdev: dp_pdev
  892. * @peer: dp_peer
  893. * @ts: hal tx completion status
  894. * @netbuf: msdu
  895. *
  896. * return: status
  897. */
  898. static inline
  899. QDF_STATUS dp_update_msdu_to_list(struct dp_soc *soc,
  900. struct dp_pdev *pdev,
  901. struct dp_peer *peer,
  902. struct hal_tx_completion_status *ts,
  903. qdf_nbuf_t netbuf)
  904. {
  905. return QDF_STATUS_E_FAILURE;
  906. }
  907. /*
  908. * dp_peer_tx_capture_filter_check: check filter is enable for the filter
  909. * and update tx_cap_enabled flag
  910. * @pdev: DP PDEV handle
  911. * @peer: DP PEER handle
  912. *
  913. * return: void
  914. */
  915. static inline
  916. void dp_peer_tx_capture_filter_check(struct dp_pdev *pdev,
  917. struct dp_peer *peer)
  918. {
  919. }
  920. /*
  921. * dp_tx_capture_debugfs_init: tx capture debugfs init
  922. * @pdev: DP PDEV handle
  923. *
  924. * return: QDF_STATUS
  925. */
  926. static inline
  927. QDF_STATUS dp_tx_capture_debugfs_init(struct dp_pdev *pdev)
  928. {
  929. return QDF_STATUS_E_FAILURE;
  930. }
  931. /**
  932. * dp_get_peer_tx_capture_stats: to get peer tx capture stats
  933. * @peer: DP PEER handle
  934. * @stats: pointor to peer tx capture stats
  935. *
  936. * return: QDF_STATUS
  937. */
  938. static inline QDF_STATUS
  939. dp_get_peer_tx_capture_stats(struct dp_peer *peer,
  940. struct cdp_peer_tx_capture_stats *stats)
  941. {
  942. return QDF_STATUS_E_FAILURE;
  943. }
  944. /**
  945. * dp_get_pdev_tx_capture_stats: to get pdev tx capture stats
  946. * @pdev: DP PDEV handle
  947. * @stats: pointor to pdev tx capture stats
  948. *
  949. * return: QDF_STATUS
  950. */
  951. static inline QDF_STATUS
  952. dp_get_pdev_tx_capture_stats(struct dp_pdev *pdev,
  953. struct cdp_pdev_tx_capture_stats *stats)
  954. {
  955. return QDF_STATUS_E_FAILURE;
  956. }
  957. #endif
  958. #ifdef WLAN_TX_PKT_CAPTURE_ENH
  959. extern uint8_t
  960. dp_cpu_ring_map[DP_NSS_CPU_RING_MAP_MAX][WLAN_CFG_INT_NUM_CONTEXTS_MAX];
  961. #endif
  962. int
  963. dp_htt_get_ppdu_sniffer_ampdu_tlv_bitmap(uint32_t bitmap);
  964. #ifdef WDI_EVENT_ENABLE
  965. void dp_pkt_log_init(struct cdp_soc_t *soc_hdl, uint8_t pdev_id, void *scn);
  966. #else
  967. static inline void
  968. dp_pkt_log_init(struct cdp_soc_t *soc_hdl, uint8_t pdev_id, void *scn)
  969. {
  970. }
  971. #endif
  972. #ifdef WDI_EVENT_ENABLE
  973. QDF_STATUS dp_peer_stats_notify(struct dp_pdev *pdev, struct dp_peer *peer);
  974. #else
  975. static inline QDF_STATUS dp_peer_stats_notify(struct dp_pdev *pdev,
  976. struct dp_peer *peer)
  977. {
  978. return QDF_STATUS_SUCCESS;
  979. }
  980. #endif
  981. #ifndef WLAN_TX_PKT_CAPTURE_ENH
  982. /**
  983. * dp_tx_ppdu_stats_process - Deferred PPDU stats handler
  984. * @context: Opaque work context (PDEV)
  985. *
  986. * Return: none
  987. */
  988. static inline void dp_tx_ppdu_stats_process(void *context)
  989. {
  990. }
  991. /*
  992. * dp_tx_capture_htt_frame_counter: increment counter for htt_frame_type
  993. * pdev: DP pdev handle
  994. * htt_frame_type: htt frame type received from fw
  995. *
  996. * return: void
  997. */
  998. static inline
  999. void dp_tx_capture_htt_frame_counter(struct dp_pdev *pdev,
  1000. uint32_t htt_frame_type)
  1001. {
  1002. }
  1003. /*
  1004. * dp_tx_cature_stats: print tx capture stats
  1005. * @pdev: DP PDEV handle
  1006. *
  1007. * return: void
  1008. */
  1009. static inline
  1010. void dp_print_pdev_tx_capture_stats(struct dp_pdev *pdev)
  1011. {
  1012. }
  1013. #endif
  1014. /**
  1015. * dp_rx_cookie_2_mon_link_desc_va() - Converts cookie to a virtual address of
  1016. * the MSDU Link Descriptor
  1017. * @pdev: core txrx pdev context
  1018. * @buf_info: buf_info includes cookie that used to lookup virtual address of
  1019. * link descriptor. Normally this is just an index into a per pdev array.
  1020. *
  1021. * This is the VA of the link descriptor in monitor mode destination ring,
  1022. * that HAL layer later uses to retrieve the list of MSDU's for a given MPDU.
  1023. *
  1024. * Return: void *: Virtual Address of the Rx descriptor
  1025. */
  1026. static inline
  1027. void *dp_rx_cookie_2_mon_link_desc_va(struct dp_pdev *pdev,
  1028. struct hal_buf_info *buf_info,
  1029. int mac_id)
  1030. {
  1031. void *link_desc_va;
  1032. struct qdf_mem_multi_page_t *pages;
  1033. uint16_t page_id = LINK_DESC_COOKIE_PAGE_ID(buf_info->sw_cookie);
  1034. struct dp_mon_soc *mon_soc = pdev->soc->monitor_soc;
  1035. if (!mon_soc)
  1036. return NULL;
  1037. pages = &mon_soc->mon_link_desc_pages[mac_id];
  1038. if (!pages)
  1039. return NULL;
  1040. if (qdf_unlikely(page_id >= pages->num_pages))
  1041. return NULL;
  1042. link_desc_va = pages->dma_pages[page_id].page_v_addr_start +
  1043. (buf_info->paddr - pages->dma_pages[page_id].page_p_addr);
  1044. return link_desc_va;
  1045. }
  1046. /**
  1047. * dp_soc_is_full_mon_enable () - Return if full monitor mode is enabled
  1048. * @soc: DP soc handle
  1049. *
  1050. * Return: Full monitor mode status
  1051. */
  1052. static inline bool dp_soc_is_full_mon_enable(struct dp_pdev *pdev)
  1053. {
  1054. return (pdev->soc->monitor_soc->full_mon_mode &&
  1055. pdev->monitor_pdev->monitor_configured) ? true : false;
  1056. }
  1057. /*
  1058. * dp_mon_is_enable_reap_timer_non_pkt() - check if mon reap timer is
  1059. * enabled by non-pkt log or not
  1060. * @pdev: point to dp pdev
  1061. *
  1062. * Return: true if mon reap timer is enabled by non-pkt log
  1063. */
  1064. static inline bool dp_mon_is_enable_reap_timer_non_pkt(struct dp_pdev *pdev)
  1065. {
  1066. if (qdf_unlikely(!pdev || !pdev->monitor_pdev))
  1067. return false;
  1068. return pdev->monitor_pdev->enable_reap_timer_non_pkt;
  1069. }
  1070. /*
  1071. * dp_monitor_is_enable_mcopy_mode() - check if mcopy mode is enabled
  1072. * @pdev: point to dp pdev
  1073. *
  1074. * Return: true if mcopy mode is enabled
  1075. */
  1076. static inline bool dp_monitor_is_enable_mcopy_mode(struct dp_pdev *pdev)
  1077. {
  1078. if (qdf_unlikely(!pdev || !pdev->monitor_pdev))
  1079. return false;
  1080. return pdev->monitor_pdev->mcopy_mode;
  1081. }
  1082. /*
  1083. * dp_monitor_is_enable_tx_sniffer() - check if tx sniffer is enabled
  1084. * @pdev: point to dp pdev
  1085. *
  1086. * Return: true if tx sniffer is enabled
  1087. */
  1088. static inline bool dp_monitor_is_enable_tx_sniffer(struct dp_pdev *pdev)
  1089. {
  1090. if (qdf_unlikely(!pdev || !pdev->monitor_pdev))
  1091. return false;
  1092. return pdev->monitor_pdev->tx_sniffer_enable;
  1093. }
  1094. /*
  1095. * dp_monitor_is_set_monitor_configured() - check if monitor configured is set
  1096. * @pdev: point to dp pdev
  1097. *
  1098. * Return: true if monitor configured is set
  1099. */
  1100. static inline bool dp_monitor_is_configured(struct dp_pdev *pdev)
  1101. {
  1102. if (qdf_unlikely(!pdev || !pdev->monitor_pdev))
  1103. return false;
  1104. return pdev->monitor_pdev->monitor_configured;
  1105. }
  1106. /*
  1107. * dp_monitor_check_com_info_ppdu_id() - check if msdu ppdu_id matches with
  1108. * com info ppdu_id
  1109. * @pdev: point to dp pdev
  1110. * @rx_desc: point to rx_desc
  1111. *
  1112. * Return: success if ppdu_id matches
  1113. */
  1114. static inline QDF_STATUS dp_monitor_check_com_info_ppdu_id(struct dp_pdev *pdev,
  1115. void *rx_desc)
  1116. {
  1117. struct cdp_mon_status *rs;
  1118. struct dp_mon_pdev *mon_pdev;
  1119. uint32_t msdu_ppdu_id = 0;
  1120. if (qdf_unlikely(!pdev || !pdev->monitor_pdev))
  1121. return QDF_STATUS_E_FAILURE;
  1122. mon_pdev = pdev->monitor_pdev;
  1123. if (qdf_likely(1 != mon_pdev->ppdu_info.rx_status.rxpcu_filter_pass))
  1124. return QDF_STATUS_E_FAILURE;
  1125. rs = &pdev->monitor_pdev->rx_mon_recv_status;
  1126. if (!rs || rs->cdp_rs_rxdma_err)
  1127. return QDF_STATUS_E_FAILURE;
  1128. msdu_ppdu_id = hal_rx_get_ppdu_id(pdev->soc->hal_soc, rx_desc);
  1129. if (msdu_ppdu_id != mon_pdev->ppdu_info.com_info.ppdu_id) {
  1130. QDF_TRACE(QDF_MODULE_ID_DP,
  1131. QDF_TRACE_LEVEL_ERROR,
  1132. "msdu_ppdu_id=%x,com_info.ppdu_id=%x",
  1133. msdu_ppdu_id,
  1134. mon_pdev->ppdu_info.com_info.ppdu_id);
  1135. return QDF_STATUS_E_FAILURE;
  1136. }
  1137. return QDF_STATUS_SUCCESS;
  1138. }
  1139. /*
  1140. * dp_monitor_get_rx_status() - get rx status
  1141. * @pdev: point to dp pdev
  1142. *
  1143. * Return: return rx status pointer
  1144. */
  1145. static inline struct mon_rx_status*
  1146. dp_monitor_get_rx_status(struct dp_pdev *pdev)
  1147. {
  1148. if (qdf_unlikely(!pdev || !pdev->monitor_pdev))
  1149. return NULL;
  1150. return &pdev->monitor_pdev->ppdu_info.rx_status;
  1151. }
  1152. /*
  1153. * dp_monitor_is_chan_band_known() - check if monitor chan band known
  1154. * @pdev: point to dp pdev
  1155. *
  1156. * Return: true if chan band known
  1157. */
  1158. static inline bool dp_monitor_is_chan_band_known(struct dp_pdev *pdev)
  1159. {
  1160. if (qdf_unlikely(!pdev || !pdev->monitor_pdev))
  1161. return false;
  1162. if (pdev->monitor_pdev->mon_chan_band != REG_BAND_UNKNOWN)
  1163. return true;
  1164. return false;
  1165. }
  1166. /*
  1167. * dp_monitor_get_chan_band() - get chan band
  1168. * @pdev: point to dp pdev
  1169. *
  1170. * Return: wifi channel band
  1171. */
  1172. static inline enum reg_wifi_band
  1173. dp_monitor_get_chan_band(struct dp_pdev *pdev)
  1174. {
  1175. return pdev->monitor_pdev->mon_chan_band;
  1176. }
  1177. /*
  1178. * dp_monitor_print_tx_stats() - print tx stats from monitor pdev
  1179. * @pdev: point to dp pdev
  1180. *
  1181. */
  1182. static inline void dp_monitor_print_tx_stats(struct dp_pdev *pdev)
  1183. {
  1184. if (qdf_unlikely(!pdev || !pdev->monitor_pdev))
  1185. return;
  1186. DP_PRINT_STATS("ppdu info schedule completion list depth: %d",
  1187. pdev->monitor_pdev->sched_comp_list_depth);
  1188. DP_PRINT_STATS("delivered sched cmdid: %d",
  1189. pdev->monitor_pdev->delivered_sched_cmdid);
  1190. DP_PRINT_STATS("cur sched cmdid: %d",
  1191. pdev->monitor_pdev->last_sched_cmdid);
  1192. DP_PRINT_STATS("ppdu info list depth: %d",
  1193. pdev->monitor_pdev->list_depth);
  1194. }
  1195. /*
  1196. * dp_monitor_set_chan_num() - set channel number
  1197. * @pdev: point to dp pdev
  1198. * @chan_num: channel number
  1199. *
  1200. */
  1201. static inline void dp_monitor_set_chan_num(struct dp_pdev *pdev, int chan_num)
  1202. {
  1203. if (qdf_unlikely(!pdev || !pdev->monitor_pdev))
  1204. return;
  1205. pdev->monitor_pdev->mon_chan_num = chan_num;
  1206. }
  1207. /*
  1208. * dp_monitor_set_chan_freq() - set channel frequency
  1209. * @pdev: point to dp pdev
  1210. * @chan_freq: channel frequency
  1211. *
  1212. */
  1213. static inline void
  1214. dp_monitor_set_chan_freq(struct dp_pdev *pdev, qdf_freq_t chan_freq)
  1215. {
  1216. if (qdf_unlikely(!pdev || !pdev->monitor_pdev))
  1217. return;
  1218. pdev->monitor_pdev->mon_chan_freq = chan_freq;
  1219. }
  1220. /*
  1221. * dp_monitor_set_chan_band() - set channel band
  1222. * @pdev: point to dp pdev
  1223. * @chan_band: channel band
  1224. *
  1225. */
  1226. static inline void
  1227. dp_monitor_set_chan_band(struct dp_pdev *pdev, enum reg_wifi_band chan_band)
  1228. {
  1229. if (qdf_unlikely(!pdev || !pdev->monitor_pdev))
  1230. return;
  1231. pdev->monitor_pdev->mon_chan_band = chan_band;
  1232. }
  1233. /*
  1234. * dp_monitor_get_mpdu_status() - get mpdu status
  1235. * @pdev: point to dp pdev
  1236. * @soc: point to dp soc
  1237. * @rx_tlv_hdr: point to rx tlv header
  1238. *
  1239. */
  1240. static inline void dp_monitor_get_mpdu_status(struct dp_pdev *pdev,
  1241. struct dp_soc *soc,
  1242. uint8_t *rx_tlv_hdr)
  1243. {
  1244. struct dp_mon_pdev *mon_pdev;
  1245. if (qdf_unlikely(!pdev || !pdev->monitor_pdev))
  1246. return;
  1247. mon_pdev = pdev->monitor_pdev;
  1248. hal_rx_mon_hw_desc_get_mpdu_status(soc->hal_soc, rx_tlv_hdr,
  1249. &mon_pdev->ppdu_info.rx_status);
  1250. }
  1251. #ifdef FEATURE_NAC_RSSI
  1252. /*
  1253. * dp_monitor_drop_inv_peer_pkts() - drop invalid peer pkts
  1254. * @vdev: point to dp vdev
  1255. *
  1256. * Return: success if sta mode and filter for neighbour peers enabled
  1257. */
  1258. static inline QDF_STATUS dp_monitor_drop_inv_peer_pkts(struct dp_vdev *vdev)
  1259. {
  1260. struct dp_pdev *pdev = vdev->pdev;
  1261. struct dp_soc *soc = pdev->soc;
  1262. if (!soc->monitor_soc)
  1263. return QDF_STATUS_E_FAILURE;
  1264. if (!soc->monitor_soc->hw_nac_monitor_support &&
  1265. pdev->monitor_pdev->filter_neighbour_peers &&
  1266. vdev->opmode == wlan_op_mode_sta)
  1267. return QDF_STATUS_SUCCESS;
  1268. return QDF_STATUS_E_FAILURE;
  1269. }
  1270. #endif
  1271. /*
  1272. * dp_peer_ppdu_delayed_ba_init() - Initialize ppdu in peer
  1273. * @peer: Datapath peer
  1274. *
  1275. * return: void
  1276. */
  1277. #ifdef FEATURE_PERPKT_INFO
  1278. static inline void dp_peer_ppdu_delayed_ba_init(struct dp_peer *peer)
  1279. {
  1280. struct dp_mon_peer *mon_peer = peer->monitor_peer;
  1281. if (!mon_peer)
  1282. return;
  1283. qdf_mem_zero(&mon_peer->delayed_ba_ppdu_stats,
  1284. sizeof(struct cdp_delayed_tx_completion_ppdu_user));
  1285. mon_peer->last_delayed_ba = false;
  1286. mon_peer->last_delayed_ba_ppduid = 0;
  1287. }
  1288. #else
  1289. static inline void dp_peer_ppdu_delayed_ba_init(struct dp_peer *peer)
  1290. {
  1291. }
  1292. #endif
  1293. /*
  1294. * dp_monitor_vdev_register_osif() - Register osif rx mon
  1295. * @vdev: point to vdev
  1296. * @txrx_ops: point to ol txrx ops
  1297. *
  1298. * Return: void
  1299. */
  1300. static inline void dp_monitor_vdev_register_osif(struct dp_vdev *vdev,
  1301. struct ol_txrx_ops *txrx_ops)
  1302. {
  1303. if (!vdev->monitor_vdev)
  1304. return;
  1305. vdev->monitor_vdev->osif_rx_mon = txrx_ops->rx.mon;
  1306. }
  1307. /*
  1308. * dp_monitor_get_monitor_vdev_from_pdev() - Get monitor vdev
  1309. * @pdev: point to pdev
  1310. *
  1311. * Return: pointer to vdev
  1312. */
  1313. static inline struct dp_vdev*
  1314. dp_monitor_get_monitor_vdev_from_pdev(struct dp_pdev *pdev)
  1315. {
  1316. if (!pdev || !pdev->monitor_pdev || !pdev->monitor_pdev->mvdev)
  1317. return NULL;
  1318. return pdev->monitor_pdev->mvdev;
  1319. }
  1320. /*
  1321. * dp_monitor_is_vdev_timer_running() - Get vdev timer status
  1322. * @soc: point to soc
  1323. *
  1324. * Return: true if timer running
  1325. */
  1326. static inline bool dp_monitor_is_vdev_timer_running(struct dp_soc *soc)
  1327. {
  1328. if (qdf_unlikely(!soc || !soc->monitor_soc))
  1329. return false;
  1330. return !!(soc->monitor_soc->mon_vdev_timer_state &
  1331. MON_VDEV_TIMER_RUNNING);
  1332. }
  1333. /*
  1334. * dp_monitor_get_link_desc_pages() - Get link desc pages
  1335. * @soc: point to soc
  1336. * @mac_id: mac id
  1337. *
  1338. * Return: return point to link desc pages
  1339. */
  1340. static inline struct qdf_mem_multi_page_t*
  1341. dp_monitor_get_link_desc_pages(struct dp_soc *soc, uint32_t mac_id)
  1342. {
  1343. if (qdf_unlikely(!soc || !soc->monitor_soc))
  1344. return NULL;
  1345. return &soc->monitor_soc->mon_link_desc_pages[mac_id];
  1346. }
  1347. /*
  1348. * dp_monitor_get_total_link_descs() - Get total link descs
  1349. * @soc: point to soc
  1350. * @mac_id: mac id
  1351. *
  1352. * Return: return point total link descs
  1353. */
  1354. static inline uint32_t *
  1355. dp_monitor_get_total_link_descs(struct dp_soc *soc, uint32_t mac_id)
  1356. {
  1357. return &soc->monitor_soc->total_mon_link_descs[mac_id];
  1358. }
  1359. /*
  1360. * dp_monitor_pdev_attach() - Monitor pdev attach
  1361. * @pdev: point to pdev
  1362. *
  1363. * Return: return QDF_STATUS
  1364. */
  1365. static inline QDF_STATUS dp_monitor_pdev_attach(struct dp_pdev *pdev)
  1366. {
  1367. struct dp_mon_ops *monitor_ops;
  1368. struct dp_mon_soc *mon_soc = pdev->soc->monitor_soc;
  1369. /*
  1370. * mon_soc uninitialized modular support enabled
  1371. * monitor related attach/detach/init/deinit
  1372. * will be done while monitor insmod
  1373. */
  1374. if (!mon_soc)
  1375. return QDF_STATUS_SUCCESS;
  1376. monitor_ops = mon_soc->mon_ops;
  1377. if (!monitor_ops || !monitor_ops->mon_pdev_attach) {
  1378. dp_mon_debug("callback not registered");
  1379. return QDF_STATUS_E_FAILURE;
  1380. }
  1381. return monitor_ops->mon_pdev_attach(pdev);
  1382. }
  1383. /*
  1384. * dp_monitor_pdev_detach() - Monitor pdev detach
  1385. * @pdev: point to pdev
  1386. *
  1387. * Return: return QDF_STATUS
  1388. */
  1389. static inline QDF_STATUS dp_monitor_pdev_detach(struct dp_pdev *pdev)
  1390. {
  1391. struct dp_mon_ops *monitor_ops;
  1392. struct dp_mon_soc *mon_soc = pdev->soc->monitor_soc;
  1393. /*
  1394. * mon_soc uninitialized modular support enabled
  1395. * monitor related attach/detach/init/deinit
  1396. * will be done while monitor insmod
  1397. */
  1398. if (!mon_soc)
  1399. return QDF_STATUS_SUCCESS;
  1400. monitor_ops = mon_soc->mon_ops;
  1401. if (!monitor_ops || !monitor_ops->mon_pdev_detach) {
  1402. dp_mon_debug("callback not registered");
  1403. return QDF_STATUS_E_FAILURE;
  1404. }
  1405. return monitor_ops->mon_pdev_detach(pdev);
  1406. }
  1407. /*
  1408. * dp_monitor_vdev_attach() - Monitor vdev attach
  1409. * @vdev: point to vdev
  1410. *
  1411. * Return: return QDF_STATUS
  1412. */
  1413. static inline QDF_STATUS dp_monitor_vdev_attach(struct dp_vdev *vdev)
  1414. {
  1415. struct dp_mon_ops *monitor_ops;
  1416. struct dp_mon_soc *mon_soc = vdev->pdev->soc->monitor_soc;
  1417. if (!mon_soc)
  1418. return QDF_STATUS_E_FAILURE;
  1419. monitor_ops = mon_soc->mon_ops;
  1420. if (!monitor_ops || !monitor_ops->mon_vdev_attach) {
  1421. dp_mon_debug("callback not registered");
  1422. return QDF_STATUS_E_FAILURE;
  1423. }
  1424. return monitor_ops->mon_vdev_attach(vdev);
  1425. }
  1426. /*
  1427. * dp_monitor_vdev_detach() - Monitor vdev detach
  1428. * @vdev: point to vdev
  1429. *
  1430. * Return: return QDF_STATUS
  1431. */
  1432. static inline QDF_STATUS dp_monitor_vdev_detach(struct dp_vdev *vdev)
  1433. {
  1434. struct dp_mon_ops *monitor_ops;
  1435. struct dp_mon_soc *mon_soc = vdev->pdev->soc->monitor_soc;
  1436. if (!mon_soc)
  1437. return QDF_STATUS_E_FAILURE;
  1438. monitor_ops = mon_soc->mon_ops;
  1439. if (!monitor_ops || !monitor_ops->mon_vdev_detach) {
  1440. dp_mon_debug("callback not registered");
  1441. return QDF_STATUS_E_FAILURE;
  1442. }
  1443. return monitor_ops->mon_vdev_detach(vdev);
  1444. }
  1445. /*
  1446. * dp_monitor_peer_attach() - Monitor peer attach
  1447. * @soc: point to soc
  1448. * @peer: point to peer
  1449. *
  1450. * Return: return QDF_STATUS
  1451. */
  1452. static inline QDF_STATUS dp_monitor_peer_attach(struct dp_soc *soc,
  1453. struct dp_peer *peer)
  1454. {
  1455. struct dp_mon_ops *monitor_ops;
  1456. struct dp_mon_soc *mon_soc = soc->monitor_soc;
  1457. if (!mon_soc)
  1458. return QDF_STATUS_E_FAILURE;
  1459. monitor_ops = mon_soc->mon_ops;
  1460. if (!monitor_ops || !monitor_ops->mon_peer_attach) {
  1461. dp_mon_debug("callback not registered");
  1462. return QDF_STATUS_E_FAILURE;
  1463. }
  1464. return monitor_ops->mon_peer_attach(peer);
  1465. }
  1466. /*
  1467. * dp_monitor_peer_detach() - Monitor peer detach
  1468. * @soc: point to soc
  1469. * @peer: point to peer
  1470. *
  1471. * Return: return QDF_STATUS
  1472. */
  1473. static inline QDF_STATUS dp_monitor_peer_detach(struct dp_soc *soc,
  1474. struct dp_peer *peer)
  1475. {
  1476. struct dp_mon_ops *monitor_ops;
  1477. struct dp_mon_soc *mon_soc = soc->monitor_soc;
  1478. if (!mon_soc)
  1479. return QDF_STATUS_E_FAILURE;
  1480. monitor_ops = mon_soc->mon_ops;
  1481. if (!monitor_ops || !monitor_ops->mon_peer_detach) {
  1482. dp_mon_debug("callback not registered");
  1483. return QDF_STATUS_E_FAILURE;
  1484. }
  1485. return monitor_ops->mon_peer_detach(peer);
  1486. }
  1487. /*
  1488. * dp_monitor_pdev_init() - Monitor pdev init
  1489. * @pdev: point to pdev
  1490. *
  1491. * Return: return QDF_STATUS
  1492. */
  1493. static inline QDF_STATUS dp_monitor_pdev_init(struct dp_pdev *pdev)
  1494. {
  1495. struct dp_mon_ops *monitor_ops;
  1496. struct dp_mon_soc *mon_soc = pdev->soc->monitor_soc;
  1497. /*
  1498. * mon_soc uninitialized when modular support enabled
  1499. * monitor related attach/detach/init/deinit
  1500. * will be done while monitor insmod
  1501. */
  1502. if (!mon_soc)
  1503. return QDF_STATUS_SUCCESS;
  1504. monitor_ops = mon_soc->mon_ops;
  1505. if (!monitor_ops || !monitor_ops->mon_pdev_init) {
  1506. dp_mon_debug("callback not registered");
  1507. return QDF_STATUS_E_FAILURE;
  1508. }
  1509. return monitor_ops->mon_pdev_init(pdev);
  1510. }
  1511. /*
  1512. * dp_monitor_pdev_deinit() - Monitor pdev deinit
  1513. * @pdev: point to pdev
  1514. *
  1515. * Return: return QDF_STATUS
  1516. */
  1517. static inline QDF_STATUS dp_monitor_pdev_deinit(struct dp_pdev *pdev)
  1518. {
  1519. struct dp_mon_ops *monitor_ops;
  1520. struct dp_mon_soc *mon_soc = pdev->soc->monitor_soc;
  1521. /*
  1522. * mon_soc uninitialized modular when support enabled
  1523. * monitor related attach/detach/init/deinit
  1524. * will be done while monitor insmod
  1525. */
  1526. if (!mon_soc)
  1527. return QDF_STATUS_SUCCESS;
  1528. monitor_ops = mon_soc->mon_ops;
  1529. if (!monitor_ops || !monitor_ops->mon_pdev_deinit) {
  1530. dp_mon_debug("callback not registered");
  1531. return QDF_STATUS_E_FAILURE;
  1532. }
  1533. return monitor_ops->mon_pdev_deinit(pdev);
  1534. }
  1535. /*
  1536. * dp_monitor_soc_cfg_init() - Monitor sco cfg init
  1537. * @soc: point to soc
  1538. *
  1539. * Return: return QDF_STATUS
  1540. */
  1541. static inline QDF_STATUS dp_monitor_soc_cfg_init(struct dp_soc *soc)
  1542. {
  1543. struct dp_mon_ops *monitor_ops;
  1544. struct dp_mon_soc *mon_soc = soc->monitor_soc;
  1545. /*
  1546. * this API is getting call from dp_soc_init,
  1547. * mon_soc will be uninitialized when monitor support enabled
  1548. * So returning QDF_STATUS_SUCCESS.
  1549. * soc cfg init will be done while monitor insmod.
  1550. */
  1551. if (!mon_soc)
  1552. return QDF_STATUS_SUCCESS;
  1553. monitor_ops = mon_soc->mon_ops;
  1554. if (!monitor_ops || !monitor_ops->mon_soc_cfg_init) {
  1555. dp_mon_debug("callback not registered");
  1556. return QDF_STATUS_E_FAILURE;
  1557. }
  1558. return monitor_ops->mon_soc_cfg_init(soc);
  1559. }
  1560. /*
  1561. * dp_monitor_config_debug_sniffer() - Monitor config debug sniffer
  1562. * @pdev: point to pdev
  1563. * @val: val
  1564. *
  1565. * Return: return QDF_STATUS
  1566. */
  1567. static inline QDF_STATUS dp_monitor_config_debug_sniffer(struct dp_pdev *pdev,
  1568. int val)
  1569. {
  1570. struct dp_mon_ops *monitor_ops;
  1571. struct dp_mon_soc *mon_soc = pdev->soc->monitor_soc;
  1572. if (!mon_soc)
  1573. return QDF_STATUS_E_FAILURE;
  1574. monitor_ops = mon_soc->mon_ops;
  1575. if (!monitor_ops || !monitor_ops->mon_config_debug_sniffer) {
  1576. dp_mon_debug("callback not registered");
  1577. return QDF_STATUS_E_FAILURE;
  1578. }
  1579. return monitor_ops->mon_config_debug_sniffer(pdev, val);
  1580. }
  1581. /*
  1582. * dp_monitor_flush_rings() - Flush monitor rings
  1583. * @soc: point to soc
  1584. *
  1585. * Return: None
  1586. */
  1587. static inline void dp_monitor_flush_rings(struct dp_soc *soc)
  1588. {
  1589. struct dp_mon_ops *monitor_ops;
  1590. struct dp_mon_soc *mon_soc = soc->monitor_soc;
  1591. if (!mon_soc) {
  1592. dp_mon_debug("monitor soc is NULL");
  1593. return;
  1594. }
  1595. monitor_ops = mon_soc->mon_ops;
  1596. if (!monitor_ops || !monitor_ops->mon_flush_rings) {
  1597. dp_mon_debug("callback not registered");
  1598. return;
  1599. }
  1600. return monitor_ops->mon_flush_rings(soc);
  1601. }
  1602. /*
  1603. * dp_monitor_htt_srng_setup() - Setup htt srng
  1604. * @soc: point to soc
  1605. * @pdev: point to pdev
  1606. * @mac_id: lmac id
  1607. * @mac for pdev: pdev id
  1608. *
  1609. * Return: QDF_STATUS
  1610. */
  1611. #if !defined(DISABLE_MON_CONFIG)
  1612. static inline QDF_STATUS dp_monitor_htt_srng_setup(struct dp_soc *soc,
  1613. struct dp_pdev *pdev,
  1614. int mac_id,
  1615. int mac_for_pdev)
  1616. {
  1617. struct dp_mon_ops *monitor_ops;
  1618. struct dp_mon_soc *mon_soc = soc->monitor_soc;
  1619. if (!mon_soc) {
  1620. dp_mon_debug("monitor soc is NULL");
  1621. return QDF_STATUS_SUCCESS;
  1622. }
  1623. monitor_ops = mon_soc->mon_ops;
  1624. if (!monitor_ops || !monitor_ops->mon_pdev_htt_srng_setup) {
  1625. dp_mon_debug("callback not registered");
  1626. return QDF_STATUS_E_FAILURE;
  1627. }
  1628. return monitor_ops->mon_pdev_htt_srng_setup(soc, pdev, mac_id,
  1629. mac_for_pdev);
  1630. }
  1631. static inline QDF_STATUS dp_monitor_soc_htt_srng_setup(struct dp_soc *soc)
  1632. {
  1633. struct dp_mon_ops *monitor_ops;
  1634. struct dp_mon_soc *mon_soc = soc->monitor_soc;
  1635. if (!mon_soc) {
  1636. dp_mon_debug("monitor soc is NULL");
  1637. return QDF_STATUS_SUCCESS;
  1638. }
  1639. monitor_ops = mon_soc->mon_ops;
  1640. if (!monitor_ops || !monitor_ops->mon_soc_htt_srng_setup) {
  1641. dp_mon_debug("callback not registered");
  1642. return QDF_STATUS_E_FAILURE;
  1643. }
  1644. return monitor_ops->mon_soc_htt_srng_setup(soc);
  1645. }
  1646. #else
  1647. static inline QDF_STATUS dp_monitor_htt_srng_setup(struct dp_soc *soc,
  1648. struct dp_pdev *pdev,
  1649. int mac_id,
  1650. int mac_for_pdev)
  1651. {
  1652. return QDF_STATUS_SUCCESS;
  1653. }
  1654. #endif
  1655. /*
  1656. * dp_monitor_service_mon_rings() - service monitor rings
  1657. * @soc: point to soc
  1658. * @quota: reap budget
  1659. *
  1660. * Return: None
  1661. */
  1662. #if defined(DP_CON_MON)
  1663. static inline
  1664. void dp_monitor_service_mon_rings(struct dp_soc *soc, uint32_t quota)
  1665. {
  1666. struct dp_mon_ops *monitor_ops;
  1667. struct dp_mon_soc *mon_soc = soc->monitor_soc;
  1668. if (!mon_soc) {
  1669. dp_mon_debug("monitor soc is NULL");
  1670. return;
  1671. }
  1672. monitor_ops = mon_soc->mon_ops;
  1673. if (!monitor_ops || !monitor_ops->mon_service_rings) {
  1674. dp_mon_debug("callback not registered");
  1675. return;
  1676. }
  1677. return monitor_ops->mon_service_rings(soc, quota);
  1678. }
  1679. #endif
  1680. /*
  1681. * dp_rx_monitor_process() - Process monitor
  1682. * @soc: point to soc
  1683. * @int_ctx: interrupt ctx
  1684. * @mac_id: lma
  1685. * @quota:
  1686. *
  1687. * Return: None
  1688. */
  1689. #ifndef DISABLE_MON_CONFIG
  1690. static inline
  1691. uint32_t dp_monitor_process(struct dp_soc *soc, struct dp_intr *int_ctx,
  1692. uint32_t mac_id, uint32_t quota)
  1693. {
  1694. struct dp_mon_soc *mon_soc = soc->monitor_soc;
  1695. if (!mon_soc) {
  1696. dp_mon_debug("monitor soc is NULL");
  1697. return 0;
  1698. }
  1699. if (!mon_soc->mon_rx_process) {
  1700. dp_mon_debug("callback not registered");
  1701. return 0;
  1702. }
  1703. return mon_soc->mon_rx_process(soc, int_ctx, mac_id, quota);
  1704. }
  1705. static inline
  1706. uint32_t dp_tx_mon_process(struct dp_soc *soc, struct dp_intr *int_ctx,
  1707. uint32_t mac_id, uint32_t quota)
  1708. {
  1709. struct dp_mon_soc *mon_soc = soc->monitor_soc;
  1710. struct dp_mon_ops *monitor_ops;
  1711. if (!mon_soc) {
  1712. dp_mon_debug("monitor soc is NULL");
  1713. return 0;
  1714. }
  1715. monitor_ops = mon_soc->mon_ops;
  1716. if (!monitor_ops || !monitor_ops->mon_tx_process) {
  1717. dp_mon_debug("callback not registered");
  1718. return 0;
  1719. }
  1720. return monitor_ops->mon_tx_process(soc, int_ctx, mac_id, quota);
  1721. }
  1722. static inline
  1723. uint32_t dp_tx_mon_buf_refill(struct dp_intr *int_ctx)
  1724. {
  1725. struct dp_soc *soc = int_ctx->soc;
  1726. struct dp_mon_ops *monitor_ops;
  1727. struct dp_mon_soc *mon_soc = soc->monitor_soc;
  1728. if (!mon_soc) {
  1729. dp_mon_debug("monitor soc is NULL");
  1730. return 0;
  1731. }
  1732. monitor_ops = mon_soc->mon_ops;
  1733. if (!monitor_ops || !monitor_ops->tx_mon_refill_buf_ring) {
  1734. dp_mon_debug("callback not registered");
  1735. return 0;
  1736. }
  1737. return monitor_ops->tx_mon_refill_buf_ring(int_ctx);
  1738. }
  1739. static inline
  1740. uint32_t dp_rx_mon_buf_refill(struct dp_intr *int_ctx)
  1741. {
  1742. struct dp_soc *soc = int_ctx->soc;
  1743. struct dp_mon_ops *monitor_ops;
  1744. struct dp_mon_soc *mon_soc = soc->monitor_soc;
  1745. if (!mon_soc) {
  1746. dp_mon_debug("monitor soc is NULL");
  1747. return 0;
  1748. }
  1749. monitor_ops = mon_soc->mon_ops;
  1750. if (!monitor_ops || !monitor_ops->rx_mon_refill_buf_ring) {
  1751. dp_mon_debug("callback not registered");
  1752. return 0;
  1753. }
  1754. return monitor_ops->rx_mon_refill_buf_ring(int_ctx);
  1755. }
  1756. #else
  1757. static inline
  1758. uint32_t dp_monitor_process(struct dp_soc *soc, struct dp_intr *int_ctx,
  1759. uint32_t mac_id, uint32_t quota)
  1760. {
  1761. return 0;
  1762. }
  1763. static inline uint32_t
  1764. dp_tx_mon_process(struct dp_soc *soc, struct dp_intr *int_ctx,
  1765. uint32_t mac_id, uint32_t quota)
  1766. {
  1767. return 0;
  1768. }
  1769. static inline
  1770. uint32_t dp_tx_mon_buf_refill(struct dp_intr *int_ctx)
  1771. {
  1772. }
  1773. static inline
  1774. uint32_t dp_rx_mon_buf_refill(struct dp_intr *int_ctx)
  1775. {
  1776. }
  1777. #endif
  1778. /*
  1779. * dp_monitor_drop_packets_for_mac() - monitor_drop_packets_for_mac
  1780. * @pdev: point to pdev
  1781. * @mac_id:
  1782. * @quota:
  1783. *
  1784. * Return:
  1785. */
  1786. #if !defined(DISABLE_MON_CONFIG) && defined(MON_ENABLE_DROP_FOR_MAC)
  1787. static inline
  1788. uint32_t dp_monitor_drop_packets_for_mac(struct dp_pdev *pdev,
  1789. uint32_t mac_id, uint32_t quota)
  1790. {
  1791. struct dp_mon_ops *monitor_ops;
  1792. struct dp_mon_soc *mon_soc = pdev->soc->monitor_soc;
  1793. if (!mon_soc) {
  1794. dp_mon_debug("monitor soc is NULL");
  1795. return 0;
  1796. }
  1797. monitor_ops = mon_soc->mon_ops;
  1798. if (!monitor_ops || !monitor_ops->mon_drop_packets_for_mac) {
  1799. dp_mon_debug("callback not registered");
  1800. return 0;
  1801. }
  1802. return monitor_ops->mon_drop_packets_for_mac(pdev,
  1803. mac_id, quota);
  1804. }
  1805. #else
  1806. static inline
  1807. uint32_t dp_monitor_drop_packets_for_mac(struct dp_pdev *pdev,
  1808. uint32_t mac_id, uint32_t quota)
  1809. {
  1810. return 0;
  1811. }
  1812. #endif
  1813. /*
  1814. * dp_monitor_peer_tx_init() - peer tx init
  1815. * @pdev: point to pdev
  1816. * @peer: point to peer
  1817. *
  1818. * Return: None
  1819. */
  1820. static inline void dp_monitor_peer_tx_init(struct dp_pdev *pdev,
  1821. struct dp_peer *peer)
  1822. {
  1823. struct dp_mon_ops *monitor_ops;
  1824. struct dp_mon_soc *mon_soc = pdev->soc->monitor_soc;
  1825. if (!mon_soc) {
  1826. dp_mon_debug("monitor soc is NULL");
  1827. return;
  1828. }
  1829. monitor_ops = mon_soc->mon_ops;
  1830. if (!monitor_ops || !monitor_ops->mon_peer_tx_init) {
  1831. dp_mon_debug("callback not registered");
  1832. return;
  1833. }
  1834. return monitor_ops->mon_peer_tx_init(pdev, peer);
  1835. }
  1836. /*
  1837. * dp_monitor_peer_tx_cleanup() - peer tx cleanup
  1838. * @vdev: point to vdev
  1839. * @peer: point to peer
  1840. *
  1841. * Return: None
  1842. */
  1843. static inline void dp_monitor_peer_tx_cleanup(struct dp_vdev *vdev,
  1844. struct dp_peer *peer)
  1845. {
  1846. struct dp_mon_ops *monitor_ops;
  1847. struct dp_mon_soc *mon_soc = vdev->pdev->soc->monitor_soc;
  1848. if (!mon_soc) {
  1849. dp_mon_debug("monitor soc is NULL");
  1850. return;
  1851. }
  1852. monitor_ops = mon_soc->mon_ops;
  1853. if (!monitor_ops || !monitor_ops->mon_peer_tx_cleanup) {
  1854. dp_mon_debug("callback not registered");
  1855. return;
  1856. }
  1857. return monitor_ops->mon_peer_tx_cleanup(vdev, peer);
  1858. }
  1859. #ifdef WLAN_TX_PKT_CAPTURE_ENH
  1860. /*
  1861. * dp_monitor_peer_tid_peer_id_update() - peer tid update
  1862. * @soc: point to soc
  1863. * @peer: point to peer
  1864. * @peer_id: peer id
  1865. *
  1866. * Return: None
  1867. */
  1868. static inline
  1869. void dp_monitor_peer_tid_peer_id_update(struct dp_soc *soc,
  1870. struct dp_peer *peer,
  1871. uint16_t peer_id)
  1872. {
  1873. struct dp_mon_ops *monitor_ops;
  1874. struct dp_mon_soc *mon_soc = soc->monitor_soc;
  1875. if (!mon_soc) {
  1876. dp_mon_debug("monitor soc is NULL");
  1877. return;
  1878. }
  1879. monitor_ops = mon_soc->mon_ops;
  1880. if (!monitor_ops || !monitor_ops->mon_peer_tid_peer_id_update) {
  1881. dp_mon_debug("callback not registered");
  1882. return;
  1883. }
  1884. return monitor_ops->mon_peer_tid_peer_id_update(peer, peer_id);
  1885. }
  1886. /*
  1887. * dp_monitor_tx_ppdu_stats_attach() - Attach tx ppdu stats
  1888. * @pdev: point to pdev
  1889. *
  1890. * Return: None
  1891. */
  1892. static inline void dp_monitor_tx_ppdu_stats_attach(struct dp_pdev *pdev)
  1893. {
  1894. struct dp_mon_ops *monitor_ops;
  1895. struct dp_mon_soc *mon_soc = pdev->soc->monitor_soc;
  1896. if (!mon_soc) {
  1897. dp_mon_debug("monitor soc is NULL");
  1898. return;
  1899. }
  1900. monitor_ops = mon_soc->mon_ops;
  1901. if (!monitor_ops || !monitor_ops->mon_tx_ppdu_stats_attach) {
  1902. dp_mon_debug("callback not registered");
  1903. return;
  1904. }
  1905. return monitor_ops->mon_tx_ppdu_stats_attach(pdev);
  1906. }
  1907. /*
  1908. * dp_monitor_tx_ppdu_stats_detach() - Detach tx ppdu stats
  1909. * @pdev: point to pdev
  1910. *
  1911. * Return: None
  1912. */
  1913. static inline void dp_monitor_tx_ppdu_stats_detach(struct dp_pdev *pdev)
  1914. {
  1915. struct dp_mon_ops *monitor_ops;
  1916. struct dp_mon_soc *mon_soc = pdev->soc->monitor_soc;
  1917. if (!mon_soc) {
  1918. dp_mon_debug("monitor soc is NULL");
  1919. return;
  1920. }
  1921. monitor_ops = mon_soc->mon_ops;
  1922. if (!monitor_ops || !monitor_ops->mon_tx_ppdu_stats_detach) {
  1923. dp_mon_debug("callback not registered");
  1924. return;
  1925. }
  1926. return monitor_ops->mon_tx_ppdu_stats_detach(pdev);
  1927. }
  1928. /*
  1929. * dp_monitor_tx_capture_debugfs_init() - Init tx capture debugfs
  1930. * @pdev: point to pdev
  1931. *
  1932. * Return: QDF_STATUS_SUCCESS
  1933. */
  1934. static inline
  1935. QDF_STATUS dp_monitor_tx_capture_debugfs_init(struct dp_pdev *pdev)
  1936. {
  1937. struct dp_mon_ops *monitor_ops;
  1938. struct dp_mon_soc *mon_soc = pdev->soc->monitor_soc;
  1939. if (!mon_soc) {
  1940. dp_mon_debug("monitor soc is NULL");
  1941. return QDF_STATUS_E_FAILURE;
  1942. }
  1943. monitor_ops = mon_soc->mon_ops;
  1944. if (!monitor_ops || !monitor_ops->mon_tx_capture_debugfs_init) {
  1945. dp_mon_debug("callback not registered");
  1946. return QDF_STATUS_E_FAILURE;
  1947. }
  1948. return monitor_ops->mon_tx_capture_debugfs_init(pdev);
  1949. }
  1950. /*
  1951. * dp_monitor_peer_tx_capture_filter_check() - Check tx capture filter
  1952. * @pdev: point to pdev
  1953. * @peer: point to peer
  1954. *
  1955. * Return: None
  1956. */
  1957. static inline void dp_monitor_peer_tx_capture_filter_check(struct dp_pdev *pdev,
  1958. struct dp_peer *peer)
  1959. {
  1960. struct dp_mon_ops *monitor_ops;
  1961. struct dp_mon_soc *mon_soc = pdev->soc->monitor_soc;
  1962. if (!mon_soc) {
  1963. dp_mon_debug("monitor soc is NULL");
  1964. return;
  1965. }
  1966. monitor_ops = mon_soc->mon_ops;
  1967. if (!monitor_ops || !monitor_ops->mon_peer_tx_capture_filter_check) {
  1968. dp_mon_debug("callback not registered");
  1969. return;
  1970. }
  1971. return monitor_ops->mon_peer_tx_capture_filter_check(pdev, peer);
  1972. }
  1973. /*
  1974. * dp_monitor_tx_add_to_comp_queue() - add completion msdu to queue
  1975. *
  1976. * This API returns QDF_STATUS_SUCCESS in case where buffer is added
  1977. * to txmonitor queue successfuly caller will not free the buffer in
  1978. * this case. In other cases this API return QDF_STATUS_E_FAILURE and
  1979. * caller frees the buffer
  1980. *
  1981. * @soc: point to soc
  1982. * @desc: point to tx desc
  1983. * @ts: Tx completion status from HAL/HTT descriptor
  1984. * @peer: DP peer
  1985. *
  1986. * Return: QDF_STATUS
  1987. *
  1988. */
  1989. static inline
  1990. QDF_STATUS dp_monitor_tx_add_to_comp_queue(struct dp_soc *soc,
  1991. struct dp_tx_desc_s *desc,
  1992. struct hal_tx_completion_status *ts,
  1993. struct dp_peer *peer)
  1994. {
  1995. struct dp_mon_ops *monitor_ops;
  1996. struct dp_mon_soc *mon_soc = soc->monitor_soc;
  1997. if (!mon_soc) {
  1998. dp_mon_debug("monitor soc is NULL");
  1999. return QDF_STATUS_E_FAILURE;
  2000. }
  2001. monitor_ops = mon_soc->mon_ops;
  2002. if (!monitor_ops || !monitor_ops->mon_tx_add_to_comp_queue) {
  2003. dp_mon_debug("callback not registered");
  2004. return QDF_STATUS_E_FAILURE;
  2005. }
  2006. return monitor_ops->mon_tx_add_to_comp_queue(soc, desc, ts, peer);
  2007. }
  2008. static inline
  2009. QDF_STATUS monitor_update_msdu_to_list(struct dp_soc *soc,
  2010. struct dp_pdev *pdev,
  2011. struct dp_peer *peer,
  2012. struct hal_tx_completion_status *ts,
  2013. qdf_nbuf_t netbuf)
  2014. {
  2015. struct dp_mon_ops *monitor_ops;
  2016. struct dp_mon_soc *mon_soc = soc->monitor_soc;
  2017. if (!mon_soc) {
  2018. dp_mon_debug("monitor soc is NULL");
  2019. return QDF_STATUS_SUCCESS;
  2020. }
  2021. monitor_ops = mon_soc->mon_ops;
  2022. if (!monitor_ops || !monitor_ops->mon_update_msdu_to_list) {
  2023. dp_mon_debug("callback not registered");
  2024. return QDF_STATUS_E_FAILURE;
  2025. }
  2026. return monitor_ops->mon_update_msdu_to_list(soc, pdev,
  2027. peer, ts, netbuf);
  2028. }
  2029. /*
  2030. * dp_monitor_peer_tx_capture_get_stats - to get Peer Tx Capture stats
  2031. * @soc: DP SOC handle
  2032. * @peer: DP PEER handle
  2033. * @stats: Pointer Peer tx capture stats
  2034. *
  2035. * Return: QDF_STATUS_E_FAILURE or QDF_STATUS_SUCCESS
  2036. */
  2037. static inline QDF_STATUS
  2038. dp_monitor_peer_tx_capture_get_stats(struct dp_soc *soc, struct dp_peer *peer,
  2039. struct cdp_peer_tx_capture_stats *stats)
  2040. {
  2041. struct dp_mon_ops *monitor_ops;
  2042. struct dp_mon_soc *mon_soc = soc->monitor_soc;
  2043. if (!mon_soc) {
  2044. dp_mon_debug("monitor soc is NULL");
  2045. return QDF_STATUS_E_FAILURE;
  2046. }
  2047. monitor_ops = mon_soc->mon_ops;
  2048. if (!monitor_ops || !monitor_ops->mon_peer_tx_capture_get_stats) {
  2049. dp_mon_debug("callback not registered");
  2050. return QDF_STATUS_E_FAILURE;
  2051. }
  2052. return monitor_ops->mon_peer_tx_capture_get_stats(peer, stats);
  2053. }
  2054. /*
  2055. * dp_monitor_pdev_tx_capture_get_stats - to get pdev tx capture stats
  2056. * @soc: DP SOC handle
  2057. * @pdev: DP PDEV handle
  2058. * @stats: Pointer to pdev tx capture stats
  2059. *
  2060. * Return: QDF_STATUS_E_FAILURE or QDF_STATUS_SUCCESS
  2061. */
  2062. static inline QDF_STATUS
  2063. dp_monitor_pdev_tx_capture_get_stats(struct dp_soc *soc, struct dp_pdev *pdev,
  2064. struct cdp_pdev_tx_capture_stats *stats)
  2065. {
  2066. struct dp_mon_ops *monitor_ops;
  2067. struct dp_mon_soc *mon_soc = soc->monitor_soc;
  2068. if (!mon_soc) {
  2069. dp_mon_debug("monitor soc is NULL");
  2070. return QDF_STATUS_E_FAILURE;
  2071. }
  2072. monitor_ops = mon_soc->mon_ops;
  2073. if (!monitor_ops || !monitor_ops->mon_pdev_tx_capture_get_stats) {
  2074. dp_mon_debug("callback not registered");
  2075. return QDF_STATUS_E_FAILURE;
  2076. }
  2077. return monitor_ops->mon_pdev_tx_capture_get_stats(pdev, stats);
  2078. }
  2079. #else
  2080. static inline
  2081. void dp_monitor_peer_tid_peer_id_update(struct dp_soc *soc,
  2082. struct dp_peer *peer,
  2083. uint16_t peer_id)
  2084. {
  2085. }
  2086. static inline void dp_monitor_tx_ppdu_stats_attach(struct dp_pdev *pdev)
  2087. {
  2088. }
  2089. static inline void dp_monitor_tx_ppdu_stats_detach(struct dp_pdev *pdev)
  2090. {
  2091. }
  2092. static inline
  2093. QDF_STATUS dp_monitor_tx_capture_debugfs_init(struct dp_pdev *pdev)
  2094. {
  2095. return QDF_STATUS_E_FAILURE;
  2096. }
  2097. static inline void dp_monitor_peer_tx_capture_filter_check(struct dp_pdev *pdev,
  2098. struct dp_peer *peer)
  2099. {
  2100. }
  2101. static inline
  2102. QDF_STATUS dp_monitor_tx_add_to_comp_queue(struct dp_soc *soc,
  2103. struct dp_tx_desc_s *desc,
  2104. struct hal_tx_completion_status *ts,
  2105. struct dp_peer *peer)
  2106. {
  2107. return QDF_STATUS_E_FAILURE;
  2108. }
  2109. static inline
  2110. QDF_STATUS monitor_update_msdu_to_list(struct dp_soc *soc,
  2111. struct dp_pdev *pdev,
  2112. struct dp_peer *peer,
  2113. struct hal_tx_completion_status *ts,
  2114. qdf_nbuf_t netbuf)
  2115. {
  2116. return QDF_STATUS_E_FAILURE;
  2117. }
  2118. static inline QDF_STATUS
  2119. dp_monitor_peer_tx_capture_get_stats(struct dp_soc *soc, struct dp_peer *peer,
  2120. struct cdp_peer_tx_capture_stats *stats)
  2121. {
  2122. return QDF_STATUS_E_FAILURE;
  2123. }
  2124. static inline QDF_STATUS
  2125. dp_monitor_pdev_tx_capture_get_stats(struct dp_soc *soc, struct dp_pdev *pdev,
  2126. struct cdp_pdev_tx_capture_stats *stats)
  2127. {
  2128. return QDF_STATUS_E_FAILURE;
  2129. }
  2130. #endif
  2131. /*
  2132. * dp_monitor_ppdu_stats_ind_handler() - PPDU stats msg handler
  2133. * @htt_soc: HTT SOC handle
  2134. * @msg_word: Pointer to payload
  2135. * @htt_t2h_msg: HTT msg nbuf
  2136. *
  2137. * Return: True if buffer should be freed by caller.
  2138. */
  2139. #if defined(WDI_EVENT_ENABLE) &&\
  2140. (defined(QCA_ENHANCED_STATS_SUPPORT) || !defined(REMOVE_PKT_LOG))
  2141. static inline bool dp_monitor_ppdu_stats_ind_handler(struct htt_soc *soc,
  2142. uint32_t *msg_word,
  2143. qdf_nbuf_t htt_t2h_msg)
  2144. {
  2145. struct dp_mon_ops *monitor_ops;
  2146. struct dp_mon_soc *mon_soc = soc->dp_soc->monitor_soc;
  2147. if (!mon_soc) {
  2148. dp_mon_debug("monitor soc is NULL");
  2149. return true;
  2150. }
  2151. monitor_ops = mon_soc->mon_ops;
  2152. if (!monitor_ops || !monitor_ops->mon_ppdu_stats_ind_handler) {
  2153. dp_mon_debug("callback not registered");
  2154. return true;
  2155. }
  2156. return monitor_ops->mon_ppdu_stats_ind_handler(soc, msg_word,
  2157. htt_t2h_msg);
  2158. }
  2159. #else
  2160. static inline bool dp_monitor_ppdu_stats_ind_handler(struct htt_soc *soc,
  2161. uint32_t *msg_word,
  2162. qdf_nbuf_t htt_t2h_msg)
  2163. {
  2164. return true;
  2165. }
  2166. #endif
  2167. /*
  2168. * dp_monitor_htt_ppdu_stats_attach() - attach resources for HTT PPDU
  2169. * stats processing
  2170. * @pdev: Datapath PDEV handle
  2171. *
  2172. * Return: QDF_STATUS
  2173. */
  2174. static inline QDF_STATUS dp_monitor_htt_ppdu_stats_attach(struct dp_pdev *pdev)
  2175. {
  2176. struct dp_mon_ops *monitor_ops;
  2177. struct dp_mon_soc *mon_soc = pdev->soc->monitor_soc;
  2178. if (!mon_soc) {
  2179. dp_mon_debug("monitor soc is NULL");
  2180. return QDF_STATUS_SUCCESS;
  2181. }
  2182. monitor_ops = mon_soc->mon_ops;
  2183. if (!monitor_ops || !monitor_ops->mon_htt_ppdu_stats_attach) {
  2184. dp_mon_debug("callback not registered");
  2185. return QDF_STATUS_E_FAILURE;
  2186. }
  2187. return monitor_ops->mon_htt_ppdu_stats_attach(pdev);
  2188. }
  2189. /*
  2190. * dp_monitor_htt_ppdu_stats_detach() - detach stats resources
  2191. * @pdev: Datapath PDEV handle
  2192. *
  2193. * Return: void
  2194. */
  2195. static inline void dp_monitor_htt_ppdu_stats_detach(struct dp_pdev *pdev)
  2196. {
  2197. struct dp_mon_ops *monitor_ops;
  2198. struct dp_mon_soc *mon_soc = pdev->soc->monitor_soc;
  2199. if (!mon_soc) {
  2200. dp_mon_debug("monitor soc is NULL");
  2201. return;
  2202. }
  2203. monitor_ops = mon_soc->mon_ops;
  2204. if (!monitor_ops || !monitor_ops->mon_htt_ppdu_stats_detach) {
  2205. dp_mon_debug("callback not registered");
  2206. return;
  2207. }
  2208. return monitor_ops->mon_htt_ppdu_stats_detach(pdev);
  2209. }
  2210. /*
  2211. * dp_monitor_print_pdev_rx_mon_stats() - print rx mon stats
  2212. * @pdev: Datapath PDEV handle
  2213. *
  2214. * Return: void
  2215. */
  2216. static inline void dp_monitor_print_pdev_rx_mon_stats(struct dp_pdev *pdev)
  2217. {
  2218. struct dp_mon_ops *monitor_ops;
  2219. struct dp_mon_soc *mon_soc = pdev->soc->monitor_soc;
  2220. if (!mon_soc) {
  2221. dp_mon_debug("monitor soc is NULL");
  2222. return;
  2223. }
  2224. monitor_ops = mon_soc->mon_ops;
  2225. if (!monitor_ops || !monitor_ops->mon_print_pdev_rx_mon_stats) {
  2226. dp_mon_debug("callback not registered");
  2227. return;
  2228. }
  2229. return monitor_ops->mon_print_pdev_rx_mon_stats(pdev);
  2230. }
  2231. /*
  2232. * dp_monitor_print_pdev_tx_capture_stats() - print tx capture stats
  2233. * @pdev: Datapath PDEV handle
  2234. *
  2235. * Return: void
  2236. */
  2237. #ifdef WLAN_TX_PKT_CAPTURE_ENH
  2238. static inline void dp_monitor_print_pdev_tx_capture_stats(struct dp_pdev *pdev)
  2239. {
  2240. struct dp_mon_ops *monitor_ops;
  2241. struct dp_mon_soc *mon_soc = pdev->soc->monitor_soc;
  2242. if (!mon_soc) {
  2243. dp_mon_debug("monitor soc is NULL");
  2244. return;
  2245. }
  2246. monitor_ops = mon_soc->mon_ops;
  2247. if (!monitor_ops || !monitor_ops->mon_print_pdev_tx_capture_stats) {
  2248. dp_mon_debug("callback not registered");
  2249. return;
  2250. }
  2251. return monitor_ops->mon_print_pdev_tx_capture_stats(pdev);
  2252. }
  2253. static inline QDF_STATUS dp_monitor_config_enh_tx_capture(struct dp_pdev *pdev,
  2254. uint32_t val)
  2255. {
  2256. struct dp_mon_ops *monitor_ops;
  2257. struct dp_mon_soc *mon_soc = pdev->soc->monitor_soc;
  2258. if (!mon_soc) {
  2259. dp_mon_debug("monitor soc is NULL");
  2260. return QDF_STATUS_E_FAILURE;
  2261. }
  2262. monitor_ops = mon_soc->mon_ops;
  2263. if (!monitor_ops || !monitor_ops->mon_config_enh_tx_capture) {
  2264. dp_mon_debug("callback not registered");
  2265. return QDF_STATUS_E_FAILURE;
  2266. }
  2267. return monitor_ops->mon_config_enh_tx_capture(pdev, val);
  2268. }
  2269. #else
  2270. static inline void dp_monitor_print_pdev_tx_capture_stats(struct dp_pdev *pdev)
  2271. {
  2272. }
  2273. static inline QDF_STATUS dp_monitor_config_enh_tx_capture(struct dp_pdev *pdev,
  2274. uint32_t val)
  2275. {
  2276. return QDF_STATUS_E_INVAL;
  2277. }
  2278. #endif
  2279. #ifdef WLAN_RX_PKT_CAPTURE_ENH
  2280. static inline QDF_STATUS dp_monitor_config_enh_rx_capture(struct dp_pdev *pdev,
  2281. uint32_t val)
  2282. {
  2283. struct dp_mon_ops *monitor_ops;
  2284. struct dp_mon_soc *mon_soc = pdev->soc->monitor_soc;
  2285. if (!mon_soc) {
  2286. dp_mon_debug("monitor soc is NULL");
  2287. return QDF_STATUS_E_FAILURE;
  2288. }
  2289. monitor_ops = mon_soc->mon_ops;
  2290. if (!monitor_ops || !monitor_ops->mon_config_enh_rx_capture) {
  2291. dp_mon_debug("callback not registered");
  2292. return QDF_STATUS_E_FAILURE;
  2293. }
  2294. return monitor_ops->mon_config_enh_rx_capture(pdev, val);
  2295. }
  2296. #else
  2297. static inline QDF_STATUS dp_monitor_config_enh_rx_capture(struct dp_pdev *pdev,
  2298. uint32_t val)
  2299. {
  2300. return QDF_STATUS_E_INVAL;
  2301. }
  2302. #endif
  2303. #ifdef QCA_SUPPORT_BPR
  2304. static inline QDF_STATUS dp_monitor_set_bpr_enable(struct dp_pdev *pdev,
  2305. uint32_t val)
  2306. {
  2307. struct dp_mon_ops *monitor_ops;
  2308. struct dp_mon_soc *mon_soc = pdev->soc->monitor_soc;
  2309. if (!mon_soc) {
  2310. dp_mon_debug("monitor soc is NULL");
  2311. return QDF_STATUS_E_FAILURE;
  2312. }
  2313. monitor_ops = mon_soc->mon_ops;
  2314. if (!monitor_ops || !monitor_ops->mon_set_bpr_enable) {
  2315. dp_mon_debug("callback not registered");
  2316. return QDF_STATUS_E_FAILURE;
  2317. }
  2318. return monitor_ops->mon_set_bpr_enable(pdev, val);
  2319. }
  2320. #else
  2321. static inline QDF_STATUS dp_monitor_set_bpr_enable(struct dp_pdev *pdev,
  2322. uint32_t val)
  2323. {
  2324. return QDF_STATUS_E_FAILURE;
  2325. }
  2326. #endif
  2327. #ifdef ATH_SUPPORT_NAC
  2328. static inline
  2329. int dp_monitor_set_filter_neigh_peers(struct dp_pdev *pdev, bool val)
  2330. {
  2331. struct dp_mon_ops *monitor_ops;
  2332. struct dp_mon_soc *mon_soc = pdev->soc->monitor_soc;
  2333. if (!mon_soc) {
  2334. dp_mon_debug("monitor soc is NULL");
  2335. return 0;
  2336. }
  2337. monitor_ops = mon_soc->mon_ops;
  2338. if (!monitor_ops || !monitor_ops->mon_set_filter_neigh_peers) {
  2339. dp_mon_debug("callback not registered");
  2340. return 0;
  2341. }
  2342. return monitor_ops->mon_set_filter_neigh_peers(pdev, val);
  2343. }
  2344. #else
  2345. static inline
  2346. int dp_monitor_set_filter_neigh_peers(struct dp_pdev *pdev, bool val)
  2347. {
  2348. return 0;
  2349. }
  2350. #endif
  2351. #ifdef WLAN_ATF_ENABLE
  2352. static inline
  2353. void dp_monitor_set_atf_stats_enable(struct dp_pdev *pdev, bool value)
  2354. {
  2355. struct dp_mon_ops *monitor_ops;
  2356. struct dp_mon_soc *mon_soc = pdev->soc->monitor_soc;
  2357. if (!mon_soc) {
  2358. dp_mon_debug("monitor soc is NULL");
  2359. return;
  2360. }
  2361. monitor_ops = mon_soc->mon_ops;
  2362. if (!monitor_ops || !monitor_ops->mon_set_atf_stats_enable) {
  2363. dp_mon_debug("callback not registered");
  2364. return;
  2365. }
  2366. return monitor_ops->mon_set_atf_stats_enable(pdev, value);
  2367. }
  2368. #else
  2369. static inline
  2370. void dp_monitor_set_atf_stats_enable(struct dp_pdev *pdev, bool value)
  2371. {
  2372. }
  2373. #endif
  2374. static inline
  2375. void dp_monitor_set_bsscolor(struct dp_pdev *pdev, uint8_t bsscolor)
  2376. {
  2377. struct dp_mon_ops *monitor_ops;
  2378. struct dp_mon_soc *mon_soc = pdev->soc->monitor_soc;
  2379. if (!mon_soc) {
  2380. dp_mon_debug("monitor soc is NULL");
  2381. return;
  2382. }
  2383. monitor_ops = mon_soc->mon_ops;
  2384. if (!monitor_ops || !monitor_ops->mon_set_bsscolor) {
  2385. dp_mon_debug("callback not registered");
  2386. return;
  2387. }
  2388. return monitor_ops->mon_set_bsscolor(pdev, bsscolor);
  2389. }
  2390. static inline
  2391. bool dp_monitor_pdev_get_filter_mcast_data(struct cdp_pdev *pdev_handle)
  2392. {
  2393. struct dp_mon_ops *monitor_ops;
  2394. struct dp_pdev *pdev = (struct dp_pdev *)pdev_handle;
  2395. struct dp_mon_soc *mon_soc = pdev->soc->monitor_soc;
  2396. if (!mon_soc) {
  2397. dp_mon_debug("monitor soc is NULL");
  2398. return false;
  2399. }
  2400. monitor_ops = mon_soc->mon_ops;
  2401. if (!monitor_ops || !monitor_ops->mon_pdev_get_filter_mcast_data) {
  2402. dp_mon_debug("callback not registered");
  2403. return false;
  2404. }
  2405. return monitor_ops->mon_pdev_get_filter_mcast_data(pdev_handle);
  2406. }
  2407. static inline
  2408. bool dp_monitor_pdev_get_filter_non_data(struct cdp_pdev *pdev_handle)
  2409. {
  2410. struct dp_mon_ops *monitor_ops;
  2411. struct dp_pdev *pdev = (struct dp_pdev *)pdev_handle;
  2412. struct dp_mon_soc *mon_soc = pdev->soc->monitor_soc;
  2413. if (!mon_soc) {
  2414. dp_mon_debug("monitor soc is NULL");
  2415. return false;
  2416. }
  2417. monitor_ops = mon_soc->mon_ops;
  2418. if (!monitor_ops || !monitor_ops->mon_pdev_get_filter_non_data) {
  2419. dp_mon_debug("callback not registered");
  2420. return false;
  2421. }
  2422. return monitor_ops->mon_pdev_get_filter_non_data(pdev_handle);
  2423. }
  2424. static inline
  2425. bool dp_monitor_pdev_get_filter_ucast_data(struct cdp_pdev *pdev_handle)
  2426. {
  2427. struct dp_mon_ops *monitor_ops;
  2428. struct dp_pdev *pdev = (struct dp_pdev *)pdev_handle;
  2429. struct dp_mon_soc *mon_soc = pdev->soc->monitor_soc;
  2430. if (!mon_soc) {
  2431. dp_mon_debug("monitor soc is NULL");
  2432. return false;
  2433. }
  2434. monitor_ops = mon_soc->mon_ops;
  2435. if (!monitor_ops || !monitor_ops->mon_pdev_get_filter_ucast_data) {
  2436. dp_mon_debug("callback not registered");
  2437. return false;
  2438. }
  2439. return monitor_ops->mon_pdev_get_filter_ucast_data(pdev_handle);
  2440. }
  2441. #ifdef WDI_EVENT_ENABLE
  2442. static inline
  2443. int dp_monitor_set_pktlog_wifi3(struct dp_pdev *pdev, uint32_t event,
  2444. bool enable)
  2445. {
  2446. struct dp_mon_ops *monitor_ops;
  2447. struct dp_mon_soc *mon_soc = pdev->soc->monitor_soc;
  2448. if (!mon_soc) {
  2449. dp_mon_debug("monitor soc is NULL");
  2450. return 0;
  2451. }
  2452. monitor_ops = mon_soc->mon_ops;
  2453. if (!monitor_ops || !monitor_ops->mon_set_pktlog_wifi3) {
  2454. dp_mon_debug("callback not registered");
  2455. return 0;
  2456. }
  2457. return monitor_ops->mon_set_pktlog_wifi3(pdev, event, enable);
  2458. }
  2459. #else
  2460. static inline
  2461. int dp_monitor_set_pktlog_wifi3(struct dp_pdev *pdev, uint32_t event,
  2462. bool enable)
  2463. {
  2464. return 0;
  2465. }
  2466. #endif
  2467. #if defined(DP_CON_MON) && !defined(REMOVE_PKT_LOG)
  2468. static inline void dp_monitor_pktlogmod_exit(struct dp_pdev *pdev)
  2469. {
  2470. struct dp_mon_ops *monitor_ops;
  2471. struct dp_mon_soc *mon_soc = pdev->soc->monitor_soc;
  2472. if (!mon_soc) {
  2473. dp_mon_debug("monitor soc is NULL");
  2474. return;
  2475. }
  2476. monitor_ops = mon_soc->mon_ops;
  2477. if (!monitor_ops || !monitor_ops->mon_pktlogmod_exit) {
  2478. dp_mon_debug("callback not registered");
  2479. return;
  2480. }
  2481. return monitor_ops->mon_pktlogmod_exit(pdev);
  2482. }
  2483. #else
  2484. static inline void dp_monitor_pktlogmod_exit(struct dp_pdev *pdev) {}
  2485. #endif
  2486. static inline
  2487. void dp_monitor_vdev_set_monitor_mode_buf_rings(struct dp_pdev *pdev)
  2488. {
  2489. struct dp_mon_ops *monitor_ops;
  2490. struct dp_mon_soc *mon_soc = pdev->soc->monitor_soc;
  2491. if (!mon_soc) {
  2492. dp_mon_debug("monitor soc is NULL");
  2493. return;
  2494. }
  2495. monitor_ops = mon_soc->mon_ops;
  2496. if (!monitor_ops || !monitor_ops->mon_vdev_set_monitor_mode_buf_rings) {
  2497. dp_mon_debug("callback not registered");
  2498. return;
  2499. }
  2500. return monitor_ops->mon_vdev_set_monitor_mode_buf_rings(pdev);
  2501. }
  2502. static inline
  2503. void dp_monitor_neighbour_peers_detach(struct dp_pdev *pdev)
  2504. {
  2505. struct dp_mon_ops *monitor_ops;
  2506. struct dp_mon_soc *mon_soc = pdev->soc->monitor_soc;
  2507. if (!mon_soc) {
  2508. dp_mon_debug("monitor soc is NULL");
  2509. return;
  2510. }
  2511. monitor_ops = mon_soc->mon_ops;
  2512. if (!monitor_ops || !monitor_ops->mon_neighbour_peers_detach) {
  2513. dp_mon_debug("callback not registered");
  2514. return;
  2515. }
  2516. return monitor_ops->mon_neighbour_peers_detach(pdev);
  2517. }
  2518. #ifdef FEATURE_NAC_RSSI
  2519. static inline QDF_STATUS dp_monitor_filter_neighbour_peer(struct dp_pdev *pdev,
  2520. uint8_t *rx_pkt_hdr)
  2521. {
  2522. struct dp_mon_ops *monitor_ops;
  2523. struct dp_mon_soc *mon_soc = pdev->soc->monitor_soc;
  2524. if (!mon_soc) {
  2525. dp_mon_debug("monitor soc is NULL");
  2526. return QDF_STATUS_E_FAILURE;
  2527. }
  2528. monitor_ops = mon_soc->mon_ops;
  2529. if (!monitor_ops || !monitor_ops->mon_filter_neighbour_peer) {
  2530. dp_mon_debug("callback not registered");
  2531. return QDF_STATUS_E_FAILURE;
  2532. }
  2533. return monitor_ops->mon_filter_neighbour_peer(pdev, rx_pkt_hdr);
  2534. }
  2535. #endif
  2536. static inline
  2537. void dp_monitor_reap_timer_init(struct dp_soc *soc)
  2538. {
  2539. struct dp_mon_ops *monitor_ops;
  2540. struct dp_mon_soc *mon_soc = soc->monitor_soc;
  2541. if (!mon_soc) {
  2542. dp_mon_debug("monitor soc is NULL");
  2543. return;
  2544. }
  2545. monitor_ops = mon_soc->mon_ops;
  2546. if (!monitor_ops || !monitor_ops->mon_reap_timer_init) {
  2547. dp_mon_debug("callback not registered");
  2548. return;
  2549. }
  2550. monitor_ops->mon_reap_timer_init(soc);
  2551. }
  2552. static inline
  2553. void dp_monitor_reap_timer_deinit(struct dp_soc *soc)
  2554. {
  2555. struct dp_mon_ops *monitor_ops;
  2556. struct dp_mon_soc *mon_soc = soc->monitor_soc;
  2557. if (!mon_soc) {
  2558. dp_mon_debug("monitor soc is NULL");
  2559. return;
  2560. }
  2561. monitor_ops = mon_soc->mon_ops;
  2562. if (!monitor_ops || !monitor_ops->mon_reap_timer_deinit) {
  2563. dp_mon_debug("callback not registered");
  2564. return;
  2565. }
  2566. monitor_ops->mon_reap_timer_deinit(soc);
  2567. }
  2568. static inline
  2569. void dp_monitor_reap_timer_start(struct dp_soc *soc)
  2570. {
  2571. struct dp_mon_ops *monitor_ops;
  2572. struct dp_mon_soc *mon_soc = soc->monitor_soc;
  2573. if (!mon_soc) {
  2574. dp_mon_debug("monitor soc is NULL");
  2575. return;
  2576. }
  2577. monitor_ops = mon_soc->mon_ops;
  2578. if (!monitor_ops || !monitor_ops->mon_reap_timer_start) {
  2579. dp_mon_debug("callback not registered");
  2580. return;
  2581. }
  2582. monitor_ops->mon_reap_timer_start(soc);
  2583. }
  2584. static inline
  2585. bool dp_monitor_reap_timer_stop(struct dp_soc *soc)
  2586. {
  2587. struct dp_mon_ops *monitor_ops;
  2588. struct dp_mon_soc *mon_soc = soc->monitor_soc;
  2589. if (!mon_soc) {
  2590. dp_mon_debug("monitor soc is NULL");
  2591. return false;
  2592. }
  2593. monitor_ops = mon_soc->mon_ops;
  2594. if (!monitor_ops || !monitor_ops->mon_reap_timer_stop) {
  2595. dp_mon_debug("callback not registered");
  2596. return false;
  2597. }
  2598. return monitor_ops->mon_reap_timer_stop(soc);
  2599. }
  2600. static inline
  2601. void dp_monitor_vdev_timer_init(struct dp_soc *soc)
  2602. {
  2603. struct dp_mon_ops *monitor_ops;
  2604. struct dp_mon_soc *mon_soc = soc->monitor_soc;
  2605. if (!mon_soc) {
  2606. dp_mon_debug("monitor soc is NULL");
  2607. return;
  2608. }
  2609. monitor_ops = mon_soc->mon_ops;
  2610. if (!monitor_ops || !monitor_ops->mon_vdev_timer_init) {
  2611. dp_mon_debug("callback not registered");
  2612. return;
  2613. }
  2614. monitor_ops->mon_vdev_timer_init(soc);
  2615. }
  2616. static inline
  2617. void dp_monitor_vdev_timer_deinit(struct dp_soc *soc)
  2618. {
  2619. struct dp_mon_ops *monitor_ops;
  2620. struct dp_mon_soc *mon_soc = soc->monitor_soc;
  2621. if (!mon_soc) {
  2622. dp_mon_debug("monitor soc is NULL");
  2623. return;
  2624. }
  2625. monitor_ops = mon_soc->mon_ops;
  2626. if (!monitor_ops || !monitor_ops->mon_vdev_timer_deinit) {
  2627. dp_mon_debug("callback not registered");
  2628. return;
  2629. }
  2630. monitor_ops->mon_vdev_timer_deinit(soc);
  2631. }
  2632. static inline
  2633. void dp_monitor_vdev_timer_start(struct dp_soc *soc)
  2634. {
  2635. struct dp_mon_ops *monitor_ops;
  2636. struct dp_mon_soc *mon_soc = soc->monitor_soc;
  2637. if (!mon_soc) {
  2638. dp_mon_debug("monitor soc is NULL");
  2639. return;
  2640. }
  2641. monitor_ops = mon_soc->mon_ops;
  2642. if (!monitor_ops || !monitor_ops->mon_vdev_timer_start) {
  2643. dp_mon_debug("callback not registered");
  2644. return;
  2645. }
  2646. monitor_ops->mon_vdev_timer_start(soc);
  2647. }
  2648. static inline
  2649. bool dp_monitor_vdev_timer_stop(struct dp_soc *soc)
  2650. {
  2651. struct dp_mon_ops *monitor_ops;
  2652. struct dp_mon_soc *mon_soc = soc->monitor_soc;
  2653. if (!mon_soc) {
  2654. dp_mon_debug("monitor soc is NULL");
  2655. return false;
  2656. }
  2657. monitor_ops = mon_soc->mon_ops;
  2658. if (!monitor_ops || !monitor_ops->mon_vdev_timer_stop) {
  2659. dp_mon_debug("callback not registered");
  2660. return false;
  2661. }
  2662. return monitor_ops->mon_vdev_timer_stop(soc);
  2663. }
  2664. #ifdef QCA_MCOPY_SUPPORT
  2665. static inline
  2666. QDF_STATUS dp_monitor_mcopy_check_deliver(struct dp_pdev *pdev,
  2667. uint16_t peer_id, uint32_t ppdu_id,
  2668. uint8_t first_msdu)
  2669. {
  2670. struct dp_mon_ops *monitor_ops;
  2671. struct dp_mon_soc *mon_soc = pdev->soc->monitor_soc;
  2672. if (!mon_soc) {
  2673. dp_mon_debug("monitor soc is NULL");
  2674. return QDF_STATUS_E_FAILURE;
  2675. }
  2676. monitor_ops = mon_soc->mon_ops;
  2677. if (!monitor_ops || !monitor_ops->mon_mcopy_check_deliver) {
  2678. dp_mon_debug("callback not registered");
  2679. return QDF_STATUS_E_FAILURE;
  2680. }
  2681. return monitor_ops->mon_mcopy_check_deliver(pdev, peer_id,
  2682. ppdu_id, first_msdu);
  2683. }
  2684. #else
  2685. static inline
  2686. QDF_STATUS dp_monitor_mcopy_check_deliver(struct dp_pdev *pdev,
  2687. uint16_t peer_id, uint32_t ppdu_id,
  2688. uint8_t first_msdu)
  2689. {
  2690. return QDF_STATUS_SUCCESS;
  2691. }
  2692. #endif
  2693. /*
  2694. * dp_monitor_neighbour_peer_add_ast() - Add ast entry
  2695. * @pdev: point to dp pdev
  2696. * @ta_peer: point to peer
  2697. * @mac_addr: mac address
  2698. * @nbuf: point to nbuf
  2699. * @flags: flags
  2700. *
  2701. * Return: void
  2702. */
  2703. static inline void
  2704. dp_monitor_neighbour_peer_add_ast(struct dp_pdev *pdev,
  2705. struct dp_peer *ta_peer,
  2706. uint8_t *mac_addr,
  2707. qdf_nbuf_t nbuf,
  2708. uint32_t flags)
  2709. {
  2710. struct dp_mon_soc *mon_soc = pdev->soc->monitor_soc;
  2711. struct dp_mon_ops *monitor_ops;
  2712. if (!mon_soc) {
  2713. dp_mon_debug("monitor soc is NULL");
  2714. return;
  2715. }
  2716. monitor_ops = mon_soc->mon_ops;
  2717. if (!monitor_ops || !monitor_ops->mon_neighbour_peer_add_ast) {
  2718. dp_mon_debug("callback not registered");
  2719. return;
  2720. }
  2721. return monitor_ops->mon_neighbour_peer_add_ast(pdev, ta_peer, mac_addr,
  2722. nbuf, flags);
  2723. }
  2724. /*
  2725. * dp_monitor_vdev_delete() - delete monitor vdev
  2726. * @soc: point to dp soc
  2727. * @vdev: point to dp vdev
  2728. *
  2729. * Return: void
  2730. */
  2731. static inline void dp_monitor_vdev_delete(struct dp_soc *soc,
  2732. struct dp_vdev *vdev)
  2733. {
  2734. if (soc->intr_mode == DP_INTR_POLL) {
  2735. qdf_timer_sync_cancel(&soc->int_timer);
  2736. dp_monitor_flush_rings(soc);
  2737. } else if (soc->intr_mode == DP_INTR_MSI) {
  2738. if (dp_monitor_vdev_timer_stop(soc))
  2739. dp_monitor_flush_rings(soc);
  2740. }
  2741. dp_monitor_vdev_detach(vdev);
  2742. }
  2743. #ifdef DP_POWER_SAVE
  2744. /*
  2745. * dp_monitor_pktlog_reap_pending_frames() - reap pending frames
  2746. * @pdev: point to dp pdev
  2747. *
  2748. * Return: void
  2749. */
  2750. static inline void dp_monitor_pktlog_reap_pending_frames(struct dp_pdev *pdev)
  2751. {
  2752. struct dp_soc *soc;
  2753. if (qdf_unlikely(!pdev || !pdev->monitor_pdev))
  2754. return;
  2755. soc = pdev->soc;
  2756. if (((pdev->monitor_pdev->rx_pktlog_mode != DP_RX_PKTLOG_DISABLED) ||
  2757. dp_mon_is_enable_reap_timer_non_pkt(pdev))) {
  2758. if (dp_monitor_reap_timer_stop(soc))
  2759. dp_monitor_service_mon_rings(soc, DP_MON_REAP_BUDGET);
  2760. }
  2761. }
  2762. /*
  2763. * dp_monitor_pktlog_start_reap_timer() - start reap timer
  2764. * @pdev: point to dp pdev
  2765. *
  2766. * Return: void
  2767. */
  2768. static inline void dp_monitor_pktlog_start_reap_timer(struct dp_pdev *pdev)
  2769. {
  2770. struct dp_soc *soc;
  2771. if (qdf_unlikely(!pdev || !pdev->monitor_pdev))
  2772. return;
  2773. soc = pdev->soc;
  2774. if (((pdev->monitor_pdev->rx_pktlog_mode != DP_RX_PKTLOG_DISABLED) ||
  2775. dp_mon_is_enable_reap_timer_non_pkt(pdev)))
  2776. dp_monitor_reap_timer_start(soc);
  2777. }
  2778. #endif
  2779. /*
  2780. * dp_monitor_neighbour_peer_list_remove() - remove neighbour peer list
  2781. * @pdev: point to dp pdev
  2782. * @vdev: point to dp vdev
  2783. * @peer: point to dp_neighbour_peer
  2784. *
  2785. * Return: void
  2786. */
  2787. static inline
  2788. void dp_monitor_neighbour_peer_list_remove(struct dp_pdev *pdev,
  2789. struct dp_vdev *vdev,
  2790. struct dp_neighbour_peer *peer)
  2791. {
  2792. struct dp_mon_pdev *mon_pdev;
  2793. struct dp_neighbour_peer *temp_peer = NULL;
  2794. if (qdf_unlikely(!pdev || !pdev->monitor_pdev))
  2795. return;
  2796. mon_pdev = pdev->monitor_pdev;
  2797. qdf_spin_lock_bh(&mon_pdev->neighbour_peer_mutex);
  2798. if (!pdev->soc->monitor_soc->hw_nac_monitor_support) {
  2799. TAILQ_FOREACH(peer, &mon_pdev->neighbour_peers_list,
  2800. neighbour_peer_list_elem) {
  2801. QDF_ASSERT(peer->vdev != vdev);
  2802. }
  2803. } else {
  2804. TAILQ_FOREACH_SAFE(peer, &mon_pdev->neighbour_peers_list,
  2805. neighbour_peer_list_elem, temp_peer) {
  2806. if (peer->vdev == vdev) {
  2807. TAILQ_REMOVE(&mon_pdev->neighbour_peers_list,
  2808. peer,
  2809. neighbour_peer_list_elem);
  2810. qdf_mem_free(peer);
  2811. }
  2812. }
  2813. }
  2814. qdf_spin_unlock_bh(&mon_pdev->neighbour_peer_mutex);
  2815. }
  2816. static inline
  2817. void dp_monitor_pdev_set_mon_vdev(struct dp_vdev *vdev)
  2818. {
  2819. if (!vdev->pdev->monitor_pdev)
  2820. return;
  2821. vdev->pdev->monitor_pdev->mvdev = vdev;
  2822. }
  2823. static inline
  2824. void dp_monitor_pdev_config_scan_spcl_vap(struct dp_pdev *pdev, bool val)
  2825. {
  2826. if (!pdev || !pdev->monitor_pdev)
  2827. return;
  2828. pdev->monitor_pdev->scan_spcl_vap_configured = val;
  2829. }
  2830. #ifdef QCA_SUPPORT_SCAN_SPCL_VAP_STATS
  2831. static inline
  2832. void dp_monitor_pdev_reset_scan_spcl_vap_stats_enable(struct dp_pdev *pdev,
  2833. bool val)
  2834. {
  2835. if (!pdev || !pdev->monitor_pdev)
  2836. return;
  2837. pdev->monitor_pdev->reset_scan_spcl_vap_stats_enable = val;
  2838. }
  2839. #else
  2840. static inline
  2841. void dp_monitor_pdev_reset_scan_spcl_vap_stats_enable(struct dp_pdev *pdev,
  2842. bool val)
  2843. {
  2844. }
  2845. #endif
  2846. static inline void
  2847. dp_mon_rx_wmask_subscribe(struct dp_soc *soc, uint32_t *msg_word,
  2848. struct htt_rx_ring_tlv_filter *tlv_filter)
  2849. {
  2850. struct dp_mon_soc *mon_soc = soc->monitor_soc;
  2851. struct dp_mon_ops *monitor_ops;
  2852. if (!mon_soc) {
  2853. dp_mon_debug("mon soc is NULL");
  2854. return;
  2855. }
  2856. monitor_ops = mon_soc->mon_ops;
  2857. if (!monitor_ops || !monitor_ops->rx_wmask_subscribe) {
  2858. dp_mon_debug("callback not registered");
  2859. return;
  2860. }
  2861. monitor_ops->rx_wmask_subscribe(msg_word, tlv_filter);
  2862. }
  2863. static inline void
  2864. dp_mon_rx_enable_mpdu_logging(struct dp_soc *soc, uint32_t *msg_word,
  2865. struct htt_rx_ring_tlv_filter *tlv_filter)
  2866. {
  2867. struct dp_mon_soc *mon_soc = soc->monitor_soc;
  2868. struct dp_mon_ops *monitor_ops;
  2869. if (!mon_soc) {
  2870. dp_mon_debug("mon soc is NULL");
  2871. return;
  2872. }
  2873. monitor_ops = mon_soc->mon_ops;
  2874. if (!monitor_ops || !monitor_ops->rx_enable_mpdu_logging) {
  2875. dp_mon_debug("callback not registered");
  2876. return;
  2877. }
  2878. monitor_ops->rx_enable_mpdu_logging(msg_word, tlv_filter);
  2879. }
  2880. static inline void
  2881. dp_mon_rx_packet_length_set(struct dp_soc *soc, uint32_t *msg_word,
  2882. struct htt_rx_ring_tlv_filter *tlv_filter)
  2883. {
  2884. struct dp_mon_soc *mon_soc = soc->monitor_soc;
  2885. struct dp_mon_ops *monitor_ops;
  2886. if (!mon_soc) {
  2887. dp_mon_debug("mon soc is NULL");
  2888. return;
  2889. }
  2890. monitor_ops = mon_soc->mon_ops;
  2891. if (!monitor_ops || !monitor_ops->rx_packet_length_set) {
  2892. dp_mon_debug("callback not registered");
  2893. return;
  2894. }
  2895. monitor_ops->rx_packet_length_set(msg_word, tlv_filter);
  2896. }
  2897. #ifdef QCA_ENHANCED_STATS_SUPPORT
  2898. QDF_STATUS dp_peer_qos_stats_notify(struct dp_pdev *dp_pdev,
  2899. struct cdp_rx_stats_ppdu_user *ppdu_user);
  2900. #endif
  2901. /*
  2902. * dp_print_pdev_rx_mon_stats() - print rx mon stats
  2903. * @pdev: device object
  2904. *
  2905. * Return: void
  2906. */
  2907. void
  2908. dp_print_pdev_rx_mon_stats(struct dp_pdev *pdev);
  2909. /**
  2910. * dp_mcopy_check_deliver() - mcopy check deliver
  2911. * @pdev: DP pdev handle
  2912. * @peer_id: peer id
  2913. * @ppdu_id: ppdu
  2914. * @first_msdu: flag to indicate first msdu of ppdu
  2915. * Return: 0 on success, not 0 on failure
  2916. */
  2917. QDF_STATUS dp_mcopy_check_deliver(struct dp_pdev *pdev,
  2918. uint16_t peer_id,
  2919. uint32_t ppdu_id,
  2920. uint8_t first_msdu);
  2921. /**
  2922. * dp_pdev_set_advance_monitor_filter() - Set DP PDEV monitor filter
  2923. * @soc: soc handle
  2924. * @pdev_id: id of Datapath PDEV handle
  2925. * @filter_val: Flag to select Filter for monitor mode
  2926. * Return: 0 on success, not 0 on failure
  2927. */
  2928. #ifdef QCA_ADVANCE_MON_FILTER_SUPPORT
  2929. QDF_STATUS
  2930. dp_pdev_set_advance_monitor_filter(struct cdp_soc_t *soc_hdl, uint8_t pdev_id,
  2931. struct cdp_monitor_filter *filter_val);
  2932. #else
  2933. static inline QDF_STATUS
  2934. dp_pdev_set_advance_monitor_filter(struct cdp_soc_t *soc_hdl, uint8_t pdev_id,
  2935. struct cdp_monitor_filter *filter_val)
  2936. {
  2937. return QDF_STATUS_E_INVAL;
  2938. }
  2939. #endif /* QCA_ADVANCE_MON_FILTER_SUPPORT */
  2940. /**
  2941. * dp_deliver_tx_mgmt() - Deliver mgmt frame for tx capture
  2942. * @cdp_soc : data path soc handle
  2943. * @pdev_id : pdev_id
  2944. * @nbuf: Management frame buffer
  2945. */
  2946. QDF_STATUS
  2947. dp_deliver_tx_mgmt(struct cdp_soc_t *cdp_soc, uint8_t pdev_id, qdf_nbuf_t nbuf);
  2948. /**
  2949. * dp_filter_neighbour_peer() - API to filter neighbour peer
  2950. * @pdev : DP pdev handle
  2951. * @rx_pkt_hdr : packet header
  2952. *
  2953. * return: QDF_STATUS_SUCCESS on success
  2954. * QDF_STATUS_E_FAILURE on failure
  2955. */
  2956. #ifdef FEATURE_NAC_RSSI
  2957. QDF_STATUS dp_filter_neighbour_peer(struct dp_pdev *pdev,
  2958. uint8_t *rx_pkt_hdr);
  2959. #else
  2960. static inline
  2961. QDF_STATUS dp_filter_neighbour_peer(struct dp_pdev *pdev,
  2962. uint8_t *rx_pkt_hdr)
  2963. {
  2964. return QDF_STATUS_SUCCESS;
  2965. }
  2966. #endif /* FEATURE_NAC_RSSI */
  2967. /*
  2968. * dp_neighbour_peers_detach() - Detach neighbour peers(nac clients)
  2969. * @pdev: device object
  2970. *
  2971. * Return: void
  2972. */
  2973. void dp_neighbour_peers_detach(struct dp_pdev *pdev);
  2974. /**
  2975. * dp_reset_monitor_mode() - Disable monitor mode
  2976. * @soc_hdl: Datapath soc handle
  2977. * @pdev_id: id of datapath PDEV handle
  2978. * @smart_monitor: smart monitor flag
  2979. *
  2980. * Return: QDF_STATUS
  2981. */
  2982. QDF_STATUS dp_reset_monitor_mode(struct cdp_soc_t *soc_hdl,
  2983. uint8_t pdev_id,
  2984. uint8_t smart_monitor);
  2985. static inline
  2986. struct dp_mon_ops *dp_mon_ops_get(struct dp_soc *soc)
  2987. {
  2988. if (soc && soc->monitor_soc)
  2989. return soc->monitor_soc->mon_ops;
  2990. return NULL;
  2991. }
  2992. static inline
  2993. struct cdp_mon_ops *dp_mon_cdp_ops_get(struct dp_soc *soc)
  2994. {
  2995. struct cdp_ops *ops = soc->cdp_soc.ops;
  2996. return ops->mon_ops;
  2997. }
  2998. /**
  2999. * dp_ppdu_desc_user_stats_update(): Function to update TX user stats
  3000. * @pdev: DP pdev handle
  3001. * @ppdu_info: per PPDU TLV descriptor
  3002. *
  3003. * return: void
  3004. */
  3005. #ifdef QCA_ENHANCED_STATS_SUPPORT
  3006. void
  3007. dp_ppdu_desc_user_stats_update(struct dp_pdev *pdev,
  3008. struct ppdu_info *ppdu_info);
  3009. #else
  3010. static inline void
  3011. dp_ppdu_desc_user_stats_update(struct dp_pdev *pdev,
  3012. struct ppdu_info *ppdu_info)
  3013. {
  3014. }
  3015. #endif /* QCA_ENHANCED_STATS_SUPPORT */
  3016. /**
  3017. * dp_mon_ops_register_1_0(): register legacy monitor ops
  3018. * @mon_soc: monitor soc handle
  3019. *
  3020. * return: void
  3021. */
  3022. void dp_mon_ops_register_1_0(struct dp_mon_soc *mon_soc);
  3023. /**
  3024. * dp_mon_cdp_ops_register_1_0(): register legacy monitor cdp ops
  3025. * @ops: cdp ops handle
  3026. *
  3027. * return: void
  3028. */
  3029. void dp_mon_cdp_ops_register_1_0(struct cdp_ops *ops);
  3030. #ifdef QCA_MONITOR_2_0_SUPPORT
  3031. /**
  3032. * dp_mon_ops_register_2_0(): register monitor ops
  3033. * @mon_soc: monitor soc handle
  3034. *
  3035. * return: void
  3036. */
  3037. void dp_mon_ops_register_2_0(struct dp_mon_soc *mon_soc);
  3038. /**
  3039. * dp_mon_cdp_ops_register_2_0(): register monitor cdp ops
  3040. * @ops: cdp ops handle
  3041. *
  3042. * return: void
  3043. */
  3044. void dp_mon_cdp_ops_register_2_0(struct cdp_ops *ops);
  3045. #endif /* QCA_MONITOR_2_0_SUPPORT */
  3046. /**
  3047. * dp_mon_register_feature_ops(): Register mon feature ops
  3048. * @soc: Datapath soc context
  3049. *
  3050. * return: void
  3051. */
  3052. static inline
  3053. void dp_mon_register_feature_ops(struct dp_soc *soc)
  3054. {
  3055. struct dp_mon_ops *mon_ops = NULL;
  3056. mon_ops = dp_mon_ops_get(soc);
  3057. if (!mon_ops) {
  3058. dp_mon_err("Monitor ops is NULL");
  3059. return;
  3060. }
  3061. if (mon_ops->mon_register_feature_ops)
  3062. mon_ops->mon_register_feature_ops(soc);
  3063. }
  3064. /**
  3065. * dp_pdev_get_rx_mon_stats(): Get pdev Rx monitor stats
  3066. * @soc_hdl: soc handle
  3067. * @pdev_id: id of pdev handle
  3068. * @stats: User allocated stats buffer
  3069. *
  3070. * return: status success/failure
  3071. */
  3072. QDF_STATUS dp_pdev_get_rx_mon_stats(struct cdp_soc_t *soc_hdl, uint8_t pdev_id,
  3073. struct cdp_pdev_mon_stats *stats);
  3074. #endif /* _DP_MON_H_ */