dp_mon.h 84 KB

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