dp_mon.h 83 KB

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