dp_mon.h 82 KB

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