dp_mon.h 81 KB

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