dp_mon.h 83 KB

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