dp_mon.h 119 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797
  1. /*
  2. * Copyright (c) 2016-2021, The Linux Foundation. All rights reserved.
  3. * Copyright (c) 2021-2023 Qualcomm Innovation Center, Inc. All rights reserved.
  4. *
  5. * Permission to use, copy, modify, and/or distribute this software for any
  6. * purpose with or without fee is hereby granted, provided that the above
  7. * copyright notice and this permission notice appear in all copies.
  8. *
  9. * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
  10. * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
  11. * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
  12. * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
  13. * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
  14. * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
  15. * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  16. */
  17. #ifndef _DP_MON_H_
  18. #define _DP_MON_H_
  19. #include "qdf_trace.h"
  20. #include "dp_internal.h"
  21. #include "dp_types.h"
  22. #include "dp_htt.h"
  23. #include <dp_mon_filter.h>
  24. #ifdef WLAN_TX_PKT_CAPTURE_ENH
  25. #include "dp_tx_capture.h"
  26. #endif
  27. #ifdef QCA_SUPPORT_LITE_MONITOR
  28. #include "dp_lite_mon.h"
  29. #endif
  30. #define DP_INTR_POLL_TIMER_MS 5
  31. #define MON_VDEV_TIMER_INIT 0x1
  32. #define MON_VDEV_TIMER_RUNNING 0x2
  33. /* Budget to reap monitor status ring */
  34. #define DP_MON_REAP_BUDGET 1024
  35. #define MON_BUF_MIN_ENTRIES 64
  36. /* 40MHZ BW 2 20MHZ sub bands */
  37. #define SUB40BW 2
  38. /* 80MHZ BW 4 20MHZ sub bands */
  39. #define SUB80BW 4
  40. /* 160MHZ BW 8 20MHZ sub bands */
  41. #define SUB160BW 8
  42. /* 320MHZ BW 16 20MHZ sub bands */
  43. #define SUB320BW 16
  44. #define RNG_ERR "SRNG setup failed for"
  45. #define dp_mon_info(params...) \
  46. __QDF_TRACE_FL(QDF_TRACE_LEVEL_INFO_HIGH, QDF_MODULE_ID_MON, ## params)
  47. #define dp_mon_err(params...) QDF_TRACE_ERROR(QDF_MODULE_ID_MON, params)
  48. #define dp_mon_debug(params...) QDF_TRACE_DEBUG(QDF_MODULE_ID_MON, params)
  49. #define dp_mon_warn(params...) QDF_TRACE_WARN(QDF_MODULE_ID_MON, params)
  50. #define dp_mon_warn_rl(params...) QDF_TRACE_WARN_RL(QDF_MODULE_ID_MON, params)
  51. #define dp_mon_debug_rl(params...) QDF_TRACE_DEBUG_RL(QDF_MODULE_ID_MON, params)
  52. #define dp_mon_info_rl(params...) \
  53. __QDF_TRACE_RL(QDF_TRACE_LEVEL_INFO_HIGH, QDF_MODULE_ID_MON, ## params)
  54. #ifdef WLAN_FEATURE_LOCAL_PKT_CAPTURE
  55. #define IS_LOCAL_PKT_CAPTURE_RUNNING(var, field) ((var)->field)
  56. #else
  57. #define IS_LOCAL_PKT_CAPTURE_RUNNING(var, field) 0
  58. #endif
  59. #ifdef QCA_ENHANCED_STATS_SUPPORT
  60. typedef struct dp_peer_extd_tx_stats dp_mon_peer_tx_stats;
  61. typedef struct dp_peer_extd_rx_stats dp_mon_peer_rx_stats;
  62. #define DP_UPDATE_MON_STATS(_tgtobj, _srcobj) \
  63. DP_UPDATE_EXTD_STATS(_tgtobj, _srcobj)
  64. #endif
  65. #ifndef WLAN_TX_PKT_CAPTURE_ENH
  66. struct dp_pdev_tx_capture {
  67. };
  68. struct dp_peer_tx_capture {
  69. };
  70. #endif
  71. /**
  72. * struct ieee80211_ctlframe_addr2 - control frame addr
  73. * @i_fc: frame control
  74. * @i_aidordur: aid or duration
  75. * @i_addr1: address 1
  76. * @i_addr2: address 2
  77. */
  78. struct ieee80211_ctlframe_addr2 {
  79. uint8_t i_fc[2];
  80. uint8_t i_aidordur[2];
  81. uint8_t i_addr1[QDF_NET_MAC_ADDR_MAX_LEN];
  82. uint8_t i_addr2[QDF_NET_MAC_ADDR_MAX_LEN];
  83. } __packed;
  84. #ifndef WLAN_TX_PKT_CAPTURE_ENH
  85. static inline void
  86. dp_process_ppdu_stats_update_failed_bitmap(struct dp_pdev *pdev,
  87. void *data,
  88. uint32_t ppdu_id,
  89. uint32_t size)
  90. {
  91. }
  92. #endif
  93. #ifdef DP_CON_MON_MSI_ENABLED
  94. static inline bool dp_is_monitor_mode_using_poll(struct dp_soc *soc)
  95. {
  96. return false;
  97. }
  98. #else
  99. static inline bool dp_is_monitor_mode_using_poll(struct dp_soc *soc)
  100. {
  101. return true;
  102. }
  103. #endif
  104. /**
  105. * dp_mon_soc_attach() - DP monitor soc attach
  106. * @soc: Datapath SOC handle
  107. *
  108. * Return: QDF_STATUS_SUCCESS: Success
  109. * QDF_STATUS_E_NOMEM: Error
  110. */
  111. QDF_STATUS dp_mon_soc_attach(struct dp_soc *soc);
  112. /**
  113. * dp_mon_soc_detach() - DP monitor soc detach
  114. * @soc: Datapath SOC handle
  115. *
  116. * Return: QDF_STATUS_SUCCESS: Success
  117. * QDF_STATUS_E_FAILURE: Error
  118. */
  119. QDF_STATUS dp_mon_soc_detach(struct dp_soc *soc);
  120. /**
  121. * dp_mon_soc_cfg_init() - DP monitor soc config init
  122. * @soc: Datapath SOC handle
  123. *
  124. * Return: QDF_STATUS_SUCCESS: Success
  125. * QDF_STATUS_E_FAILURE: Error
  126. */
  127. QDF_STATUS dp_mon_soc_cfg_init(struct dp_soc *soc);
  128. /**
  129. * dp_mon_pdev_attach() - DP monitor pdev attach
  130. * @pdev: Datapath pdev handle
  131. *
  132. * Return: QDF_STATUS_SUCCESS: Success
  133. * QDF_STATUS_E_NOMEM: Error
  134. */
  135. QDF_STATUS dp_mon_pdev_attach(struct dp_pdev *pdev);
  136. /**
  137. * dp_mon_pdev_detach() - DP monitor pdev detach
  138. * @pdev: Datapath pdev handle
  139. *
  140. * Return: QDF_STATUS_SUCCESS: Success
  141. * QDF_STATUS_E_FAILURE: Error
  142. */
  143. QDF_STATUS dp_mon_pdev_detach(struct dp_pdev *pdev);
  144. /**
  145. * dp_mon_pdev_init() - DP monitor pdev init
  146. * @pdev: Datapath pdev handle
  147. *
  148. * Return: QDF_STATUS_SUCCESS: Success
  149. * QDF_STATUS_E_FAILURE: Error
  150. */
  151. QDF_STATUS dp_mon_pdev_init(struct dp_pdev *pdev);
  152. /**
  153. * dp_mon_pdev_deinit() - DP monitor pdev deinit
  154. * @pdev: Datapath pdev handle
  155. *
  156. * Return: QDF_STATUS_SUCCESS: Success
  157. * QDF_STATUS_E_FAILURE: Error
  158. */
  159. QDF_STATUS dp_mon_pdev_deinit(struct dp_pdev *pdev);
  160. /**
  161. * dp_mon_vdev_attach() - DP monitor vdev attach
  162. * @vdev: Datapath vdev handle
  163. *
  164. * Return: QDF_STATUS_SUCCESS: Success
  165. * QDF_STATUS_E_NOMEM: Error
  166. */
  167. QDF_STATUS dp_mon_vdev_attach(struct dp_vdev *vdev);
  168. /**
  169. * dp_mon_vdev_detach() - DP monitor vdev detach
  170. * @vdev: Datapath vdev handle
  171. *
  172. * Return: QDF_STATUS_SUCCESS: Success
  173. * QDF_STATUS_E_FAILURE: Error
  174. */
  175. QDF_STATUS dp_mon_vdev_detach(struct dp_vdev *vdev);
  176. /**
  177. * dp_mon_peer_attach() - DP monitor peer attach
  178. * @peer: Datapath peer handle
  179. *
  180. * Return: QDF_STATUS_SUCCESS: Success
  181. * QDF_STATUS_E_NOMEM: Error
  182. */
  183. #if defined(WLAN_TX_PKT_CAPTURE_ENH) || defined(FEATURE_PERPKT_INFO)
  184. QDF_STATUS dp_mon_peer_attach(struct dp_peer *peer);
  185. #else
  186. static inline
  187. QDF_STATUS dp_mon_peer_attach(struct dp_peer *peer)
  188. {
  189. return QDF_STATUS_SUCCESS;
  190. }
  191. #endif
  192. /**
  193. * dp_mon_peer_detach() - DP monitor peer detach
  194. * @peer: Datapath peer handle
  195. *
  196. * Return: QDF_STATUS_SUCCESS: Success
  197. * QDF_STATUS_E_FAILURE: Error
  198. */
  199. QDF_STATUS dp_mon_peer_detach(struct dp_peer *peer);
  200. /**
  201. * dp_mon_peer_get_peerstats_ctx() - Get peer stats context from monitor peer
  202. * @peer: Datapath peer handle
  203. *
  204. * Return: peerstats_ctx
  205. */
  206. struct cdp_peer_rate_stats_ctx *dp_mon_peer_get_peerstats_ctx(struct
  207. dp_peer *peer);
  208. #ifdef QCA_ENHANCED_STATS_SUPPORT
  209. /**
  210. * dp_mon_peer_reset_stats() - Reset monitor peer stats
  211. * @peer: Datapath peer handle
  212. *
  213. * Return: none
  214. */
  215. void dp_mon_peer_reset_stats(struct dp_peer *peer);
  216. /**
  217. * dp_mon_peer_get_stats() - Get monitor peer stats
  218. *
  219. * @peer: Datapath peer handle
  220. * @arg: Pointer to stats struct
  221. * @type: Update type
  222. *
  223. * Return: none
  224. */
  225. void dp_mon_peer_get_stats(struct dp_peer *peer, void *arg,
  226. enum cdp_stat_update_type type);
  227. /**
  228. * dp_mon_invalid_peer_update_pdev_stats() - Update pdev stats from
  229. * invalid monitor peer
  230. * @pdev: Datapath pdev handle
  231. *
  232. * Return: none
  233. */
  234. void dp_mon_invalid_peer_update_pdev_stats(struct dp_pdev *pdev);
  235. /**
  236. * dp_mon_peer_get_stats_param() - Get stats param value from monitor peer
  237. * @peer: Datapath peer handle
  238. * @type: Stats type requested
  239. * @buf: Pointer to buffer for stats param
  240. *
  241. * Return: QDF_STATUS
  242. */
  243. QDF_STATUS dp_mon_peer_get_stats_param(struct dp_peer *peer,
  244. enum cdp_peer_stats_type type,
  245. cdp_peer_stats_param_t *buf);
  246. #else
  247. static inline void dp_mon_peer_reset_stats(struct dp_peer *peer)
  248. {
  249. }
  250. static inline
  251. void dp_mon_peer_get_stats(struct dp_peer *peer, void *arg,
  252. enum cdp_stat_update_type type)
  253. {
  254. }
  255. static inline void dp_mon_invalid_peer_update_pdev_stats(struct dp_pdev *pdev)
  256. {
  257. }
  258. static inline
  259. QDF_STATUS dp_mon_peer_get_stats_param(struct dp_peer *peer,
  260. enum cdp_peer_stats_type type,
  261. cdp_peer_stats_param_t *buf)
  262. {
  263. return QDF_STATUS_E_FAILURE;
  264. }
  265. #endif
  266. /**
  267. * dp_mon_cdp_ops_register() - Register monitor cdp ops
  268. * @soc: Datapath soc handle
  269. *
  270. */
  271. void dp_mon_cdp_ops_register(struct dp_soc *soc);
  272. /**
  273. * dp_mon_cdp_ops_deregister() - deregister monitor cdp ops
  274. * @soc: Datapath soc handle
  275. *
  276. */
  277. void dp_mon_cdp_ops_deregister(struct dp_soc *soc);
  278. /**
  279. * dp_mon_intr_ops_deregister() - deregister monitor interrupt ops
  280. * @soc: Datapath soc handle
  281. *
  282. */
  283. void dp_mon_intr_ops_deregister(struct dp_soc *soc);
  284. /**
  285. * dp_mon_feature_ops_deregister() - deregister monitor feature ops
  286. * @soc: Datapath soc handle
  287. *
  288. */
  289. void dp_mon_feature_ops_deregister(struct dp_soc *soc);
  290. /**
  291. * dp_mon_ops_free() - free monitor ops
  292. * @soc: Datapath soc handle
  293. *
  294. */
  295. void dp_mon_ops_free(struct dp_soc *soc);
  296. /**
  297. * dp_mon_ops_register() - Register monitor ops
  298. * @soc: Datapath soc handle
  299. *
  300. */
  301. void dp_mon_ops_register(struct dp_soc *soc);
  302. #ifndef DISABLE_MON_CONFIG
  303. void dp_mon_register_intr_ops(struct dp_soc *soc);
  304. #else
  305. static inline void dp_mon_register_intr_ops(struct dp_soc *soc)
  306. {}
  307. #endif
  308. /**
  309. * dp_mon_htt_srng_setup() - DP mon htt srng setup
  310. * @soc: Datapath soc handle
  311. * @pdev: Datapath pdev handle
  312. * @mac_id: mac id
  313. * @mac_for_pdev: mac id mapped pdev
  314. *
  315. * Return: QDF_STATUS_SUCCESS: Success
  316. * QDF_STATUS_E_FAILURE: Error
  317. */
  318. QDF_STATUS dp_mon_htt_srng_setup(struct dp_soc *soc,
  319. struct dp_pdev *pdev,
  320. int mac_id,
  321. int mac_for_pdev);
  322. /**
  323. * dp_config_debug_sniffer()- API to enable/disable debug sniffer
  324. * @pdev: DP_PDEV handle
  325. * @val: user provided value
  326. *
  327. * Return: 0 for success. nonzero for failure.
  328. */
  329. #if defined(QCA_MCOPY_SUPPORT) || defined(QCA_TX_CAPTURE_SUPPORT)
  330. QDF_STATUS
  331. dp_config_debug_sniffer(struct dp_pdev *pdev, int val);
  332. #else
  333. static inline QDF_STATUS
  334. dp_config_debug_sniffer(struct dp_pdev *pdev, int val) {
  335. return QDF_STATUS_E_INVAL;
  336. }
  337. #endif /* QCA_MCOPY_SUPPORT || QCA_TX_CAPTURE_SUPPORT */
  338. /**
  339. * dp_mon_config_undecoded_metadata_capture()- API to enable/disable undecoded
  340. * metadata capture
  341. * @pdev: DP_PDEV handle
  342. * @val: user provided value
  343. *
  344. * Return: 0 for success. nonzero for failure.
  345. */
  346. #ifdef QCA_UNDECODED_METADATA_SUPPORT
  347. QDF_STATUS
  348. dp_mon_config_undecoded_metadata_capture(struct dp_pdev *pdev, int val);
  349. #else
  350. static inline QDF_STATUS
  351. dp_mon_config_undecoded_metadata_capture(struct dp_pdev *pdev, int val) {
  352. return QDF_STATUS_E_INVAL;
  353. }
  354. #endif /* QCA_UNDECODED_METADATA_SUPPORT */
  355. /**
  356. * dp_htt_ppdu_stats_attach() - attach resources for HTT PPDU stats processing
  357. * @pdev: Datapath PDEV handle
  358. *
  359. * Return: QDF_STATUS_SUCCESS: Success
  360. * QDF_STATUS_E_NOMEM: Error
  361. */
  362. QDF_STATUS dp_htt_ppdu_stats_attach(struct dp_pdev *pdev);
  363. /**
  364. * dp_htt_ppdu_stats_detach() - detach stats resources
  365. * @pdev: Datapath PDEV handle
  366. *
  367. * Return: void
  368. */
  369. void dp_htt_ppdu_stats_detach(struct dp_pdev *pdev);
  370. /**
  371. * dp_set_bpr_enable() - API to enable/disable bpr feature
  372. * @pdev: DP_PDEV handle.
  373. * @val: Provided value.
  374. *
  375. * Return: 0 for success. nonzero for failure.
  376. */
  377. #ifdef QCA_SUPPORT_BPR
  378. QDF_STATUS
  379. dp_set_bpr_enable(struct dp_pdev *pdev, int val);
  380. #endif
  381. #ifdef ATH_SUPPORT_NAC
  382. int dp_set_filter_neigh_peers(struct dp_pdev *pdev,
  383. bool val);
  384. #endif /* ATH_SUPPORT_NAC */
  385. #ifdef WLAN_ATF_ENABLE
  386. void dp_set_atf_stats_enable(struct dp_pdev *pdev, bool value);
  387. #endif
  388. /**
  389. * dp_mon_set_bsscolor() - sets bsscolor for tx capture
  390. * @pdev: Datapath PDEV handle
  391. * @bsscolor: new bsscolor
  392. */
  393. void
  394. dp_mon_set_bsscolor(struct dp_pdev *pdev, uint8_t bsscolor);
  395. /**
  396. * dp_pdev_get_filter_ucast_data() - get DP PDEV monitor ucast filter
  397. * @pdev_handle: Datapath PDEV handle
  398. *
  399. * Return: true on ucast filter flag set
  400. */
  401. bool dp_pdev_get_filter_ucast_data(struct cdp_pdev *pdev_handle);
  402. /**
  403. * dp_pdev_get_filter_mcast_data() - get DP PDEV monitor mcast filter
  404. * @pdev_handle: Datapath PDEV handle
  405. *
  406. * Return: true on mcast filter flag set
  407. */
  408. bool dp_pdev_get_filter_mcast_data(struct cdp_pdev *pdev_handle);
  409. /**
  410. * dp_pdev_get_filter_non_data() - get DP PDEV monitor non_data filter
  411. * @pdev_handle: Datapath PDEV handle
  412. *
  413. * Return: true on non data filter flag set
  414. */
  415. bool dp_pdev_get_filter_non_data(struct cdp_pdev *pdev_handle);
  416. /**
  417. * dp_set_pktlog_wifi3() - attach txrx vdev
  418. * @pdev: Datapath PDEV handle
  419. * @event: which event's notifications are being subscribed to
  420. * @enable: WDI event subscribe or not. (True or False)
  421. *
  422. * Return: Success, NULL on failure
  423. */
  424. #ifdef WDI_EVENT_ENABLE
  425. int dp_set_pktlog_wifi3(struct dp_pdev *pdev, uint32_t event,
  426. bool enable);
  427. #endif
  428. /* MCL specific functions */
  429. #if defined(DP_CON_MON) && !defined(REMOVE_PKT_LOG)
  430. /**
  431. * dp_pktlogmod_exit() - API to cleanup pktlog info
  432. * @pdev: Pdev handle
  433. *
  434. * Return: none
  435. */
  436. void dp_pktlogmod_exit(struct dp_pdev *pdev);
  437. #else
  438. static inline
  439. void dp_pktlogmod_exit(struct dp_pdev *handle)
  440. {
  441. }
  442. #endif
  443. #ifdef QCA_MONITOR_PKT_SUPPORT
  444. /**
  445. * dp_vdev_set_monitor_mode_buf_rings() - set monitor mode buf rings
  446. * @pdev: DP pdev object
  447. *
  448. * Allocate SW descriptor pool, buffers, link descriptor memory
  449. * Initialize monitor related SRNGs
  450. *
  451. * Return: QDF_STATUS
  452. */
  453. QDF_STATUS dp_vdev_set_monitor_mode_buf_rings(struct dp_pdev *pdev);
  454. /**
  455. * dp_vdev_set_monitor_mode_rings() - set monitor mode rings
  456. * @pdev: DP pdev object
  457. * @delayed_replenish:
  458. *
  459. * Allocate SW descriptor pool, buffers, link descriptor memory
  460. * Initialize monitor related SRNGs
  461. *
  462. * Return: QDF_STATUS
  463. */
  464. QDF_STATUS dp_vdev_set_monitor_mode_rings(struct dp_pdev *pdev,
  465. uint8_t delayed_replenish);
  466. #else
  467. static inline QDF_STATUS
  468. dp_vdev_set_monitor_mode_buf_rings(struct dp_pdev *pdev)
  469. {
  470. return QDF_STATUS_SUCCESS;
  471. }
  472. static inline QDF_STATUS
  473. dp_vdev_set_monitor_mode_rings(struct dp_pdev *pdev,
  474. uint8_t delayed_replenish)
  475. {
  476. return QDF_STATUS_SUCCESS;
  477. }
  478. #endif
  479. #if defined(WDI_EVENT_ENABLE) &&\
  480. (defined(QCA_ENHANCED_STATS_SUPPORT) || !defined(REMOVE_PKT_LOG))
  481. /**
  482. * dp_ppdu_stats_ind_handler() - PPDU stats msg handler
  483. * @soc: HTT SOC handle
  484. * @msg_word: Pointer to payload
  485. * @htt_t2h_msg: HTT msg nbuf
  486. *
  487. * Return: True if buffer should be freed by caller.
  488. */
  489. bool dp_ppdu_stats_ind_handler(struct htt_soc *soc,
  490. uint32_t *msg_word,
  491. qdf_nbuf_t htt_t2h_msg);
  492. #endif
  493. #if defined(QCA_ENHANCED_STATS_SUPPORT) && \
  494. (!defined(WLAN_TX_PKT_CAPTURE_ENH) || defined(WLAN_PKT_CAPTURE_TX_2_0))
  495. /**
  496. * dp_ppdu_desc_deliver(): Function to deliver Tx PPDU status descriptor
  497. * to upper layer
  498. * @pdev: DP pdev handle
  499. * @ppdu_info: per PPDU TLV descriptor
  500. *
  501. * return: void
  502. */
  503. void dp_ppdu_desc_deliver(struct dp_pdev *pdev, struct ppdu_info *ppdu_info);
  504. #endif
  505. #ifdef QCA_RSSI_DB2DBM
  506. /**
  507. * dp_mon_pdev_params_rssi_dbm_conv() --> to set rssi in dbm conversion
  508. * params into monitor pdev.
  509. * @cdp_soc: dp soc handle.
  510. * @params: cdp_rssi_db2dbm_param_dp structure value.
  511. *
  512. * Return: QDF_STATUS_SUCCESS if value set successfully
  513. * QDF_STATUS_E_INVAL false if error
  514. */
  515. QDF_STATUS
  516. dp_mon_pdev_params_rssi_dbm_conv(struct cdp_soc_t *cdp_soc,
  517. struct cdp_rssi_db2dbm_param_dp *params);
  518. #else
  519. static inline QDF_STATUS
  520. dp_mon_pdev_params_rssi_dbm_conv(struct cdp_soc_t *cdp_soc,
  521. struct cdp_rssi_db2dbm_param_dp *params)
  522. {
  523. return QDF_STATUS_E_INVAL;
  524. }
  525. #endif /* QCA_RSSI_DB2DBM */
  526. #if !defined(DISABLE_MON_CONFIG)
  527. typedef QDF_STATUS (*mon_pdev_htt_srng_setup_fp)(struct dp_soc *soc,
  528. struct dp_pdev *pdev,
  529. int mac_id,
  530. int mac_for_pdev);
  531. #endif
  532. typedef QDF_STATUS (*mon_rings_alloc_fp)(struct dp_pdev *pdev);
  533. typedef void (*mon_rings_free_fp)(struct dp_pdev *pdev);
  534. typedef QDF_STATUS (*mon_rings_init_fp)(struct dp_pdev *pdev);
  535. typedef void (*mon_rings_deinit_fp)(struct dp_pdev *pdev);
  536. typedef QDF_STATUS (*mon_soc_attach_fp)(struct dp_soc *soc);
  537. typedef QDF_STATUS (*mon_soc_detach_fp)(struct dp_soc *soc);
  538. typedef QDF_STATUS (*mon_soc_init_fp)(struct dp_soc *soc);
  539. typedef void (*mon_soc_deinit_fp)(struct dp_soc *soc);
  540. struct dp_mon_ops {
  541. QDF_STATUS (*mon_soc_cfg_init)(struct dp_soc *soc);
  542. mon_soc_attach_fp mon_soc_attach[2];
  543. mon_soc_detach_fp mon_soc_detach[2];
  544. mon_soc_init_fp mon_soc_init[2];
  545. mon_soc_deinit_fp mon_soc_deinit[2];
  546. QDF_STATUS (*mon_pdev_alloc)(struct dp_pdev *pdev);
  547. void (*mon_pdev_free)(struct dp_pdev *pdev);
  548. QDF_STATUS (*mon_pdev_attach)(struct dp_pdev *pdev);
  549. QDF_STATUS (*mon_pdev_detach)(struct dp_pdev *pdev);
  550. QDF_STATUS (*mon_pdev_init)(struct dp_pdev *pdev);
  551. QDF_STATUS (*mon_pdev_deinit)(struct dp_pdev *pdev);
  552. QDF_STATUS (*mon_vdev_attach)(struct dp_vdev *vdev);
  553. QDF_STATUS (*mon_vdev_detach)(struct dp_vdev *vdev);
  554. QDF_STATUS (*mon_peer_attach)(struct dp_peer *peer);
  555. QDF_STATUS (*mon_peer_detach)(struct dp_peer *peer);
  556. struct cdp_peer_rate_stats_ctx *(*mon_peer_get_peerstats_ctx)(struct
  557. dp_peer *peer);
  558. void (*mon_peer_reset_stats)(struct dp_peer *peer);
  559. void (*mon_peer_get_stats)(struct dp_peer *peer, void *arg,
  560. enum cdp_stat_update_type type);
  561. void (*mon_invalid_peer_update_pdev_stats)(struct dp_pdev *pdev);
  562. QDF_STATUS (*mon_peer_get_stats_param)(struct dp_peer *peer,
  563. enum cdp_peer_stats_type type,
  564. cdp_peer_stats_param_t *buf);
  565. QDF_STATUS (*mon_config_debug_sniffer)(struct dp_pdev *pdev, int val);
  566. void (*mon_flush_rings)(struct dp_soc *soc);
  567. #if !defined(DISABLE_MON_CONFIG)
  568. mon_pdev_htt_srng_setup_fp mon_pdev_htt_srng_setup[2];
  569. QDF_STATUS (*mon_soc_htt_srng_setup)(struct dp_soc *soc);
  570. #endif
  571. #if !defined(DISABLE_MON_CONFIG) && defined(MON_ENABLE_DROP_FOR_MAC)
  572. uint32_t (*mon_drop_packets_for_mac)(struct dp_pdev *pdev,
  573. uint32_t mac_id,
  574. uint32_t quota,
  575. bool force_flush);
  576. #endif
  577. #if defined(DP_CON_MON)
  578. void (*mon_service_rings)(struct dp_soc *soc, uint32_t quota);
  579. #endif
  580. #ifndef DISABLE_MON_CONFIG
  581. uint32_t (*mon_rx_process)(struct dp_soc *soc,
  582. struct dp_intr *int_ctx,
  583. uint32_t mac_id,
  584. uint32_t quota);
  585. uint32_t (*mon_tx_process)(struct dp_soc *soc,
  586. struct dp_intr *int_ctx,
  587. uint32_t mac_id,
  588. uint32_t quota);
  589. void (*print_txmon_ring_stat)(struct dp_pdev *pdev);
  590. #endif
  591. void (*mon_peer_tx_init)(struct dp_pdev *pdev, struct dp_peer *peer);
  592. void (*mon_peer_tx_cleanup)(struct dp_vdev *vdev,
  593. struct dp_peer *peer);
  594. #ifdef WIFI_MONITOR_SUPPORT
  595. void (*mon_peer_tid_peer_id_update)(struct dp_peer *peer,
  596. uint16_t peer_id);
  597. void (*mon_tx_ppdu_stats_attach)(struct dp_pdev *pdev);
  598. void (*mon_tx_ppdu_stats_detach)(struct dp_pdev *pdev);
  599. QDF_STATUS (*mon_tx_capture_debugfs_init)(struct dp_pdev *pdev);
  600. void (*mon_peer_tx_capture_filter_check)(struct dp_pdev *pdev,
  601. struct dp_peer *peer);
  602. QDF_STATUS (*mon_tx_add_to_comp_queue)(struct dp_soc *soc,
  603. struct dp_tx_desc_s *desc,
  604. struct hal_tx_completion_status *ts,
  605. uint16_t peer_id);
  606. QDF_STATUS (*mon_update_msdu_to_list)(struct dp_soc *soc,
  607. struct dp_pdev *pdev,
  608. struct dp_peer *peer,
  609. struct hal_tx_completion_status *ts,
  610. qdf_nbuf_t netbuf);
  611. QDF_STATUS
  612. (*mon_peer_tx_capture_get_stats)(struct dp_peer *peer,
  613. struct cdp_peer_tx_capture_stats *sts);
  614. QDF_STATUS
  615. (*mon_pdev_tx_capture_get_stats)(struct dp_pdev *pdev,
  616. struct cdp_pdev_tx_capture_stats *sts);
  617. #endif
  618. #if defined(WDI_EVENT_ENABLE) &&\
  619. (defined(QCA_ENHANCED_STATS_SUPPORT) || !defined(REMOVE_PKT_LOG))
  620. bool (*mon_ppdu_stats_ind_handler)(struct htt_soc *soc,
  621. uint32_t *msg_word,
  622. qdf_nbuf_t htt_t2h_msg);
  623. #endif
  624. QDF_STATUS (*mon_htt_ppdu_stats_attach)(struct dp_pdev *pdev);
  625. void (*mon_htt_ppdu_stats_detach)(struct dp_pdev *pdev);
  626. void (*mon_print_pdev_rx_mon_stats)(struct dp_pdev *pdev);
  627. #ifdef WIFI_MONITOR_SUPPORT
  628. void (*mon_print_pdev_tx_capture_stats)(struct dp_pdev *pdev);
  629. QDF_STATUS (*mon_config_enh_tx_capture)(struct dp_pdev *pdev,
  630. uint8_t val);
  631. QDF_STATUS (*mon_tx_peer_filter)(struct dp_pdev *pdev_handle,
  632. struct dp_peer *peer_handle,
  633. uint8_t is_tx_pkt_cap_enable,
  634. uint8_t *peer_mac);
  635. #endif
  636. #ifdef WLAN_RX_PKT_CAPTURE_ENH
  637. QDF_STATUS (*mon_config_enh_rx_capture)(struct dp_pdev *pdev,
  638. uint8_t val);
  639. #endif
  640. #ifdef QCA_SUPPORT_BPR
  641. QDF_STATUS (*mon_set_bpr_enable)(struct dp_pdev *pdev, int val);
  642. #endif
  643. #ifdef ATH_SUPPORT_NAC
  644. int (*mon_set_filter_neigh_peers)(struct dp_pdev *pdev, bool val);
  645. #endif
  646. #ifdef WLAN_ATF_ENABLE
  647. void (*mon_set_atf_stats_enable)(struct dp_pdev *pdev, bool value);
  648. #endif
  649. void (*mon_set_bsscolor)(struct dp_pdev *pdev, uint8_t bsscolor);
  650. bool (*mon_pdev_get_filter_ucast_data)(struct cdp_pdev *pdev_handle);
  651. bool (*mon_pdev_get_filter_non_data)(struct cdp_pdev *pdev_handle);
  652. bool (*mon_pdev_get_filter_mcast_data)(struct cdp_pdev *pdev_handle);
  653. #ifdef WDI_EVENT_ENABLE
  654. int (*mon_set_pktlog_wifi3)(struct dp_pdev *pdev, uint32_t event,
  655. bool enable);
  656. #endif
  657. #if defined(DP_CON_MON) && !defined(REMOVE_PKT_LOG)
  658. void (*mon_pktlogmod_exit)(struct dp_pdev *pdev);
  659. #endif
  660. QDF_STATUS (*mon_vdev_set_monitor_mode_buf_rings)(struct dp_pdev *pdev);
  661. QDF_STATUS (*mon_vdev_set_monitor_mode_rings)(struct dp_pdev *pdev,
  662. uint8_t delayed_replenish);
  663. void (*mon_neighbour_peers_detach)(struct dp_pdev *pdev);
  664. #ifdef FEATURE_NAC_RSSI
  665. QDF_STATUS (*mon_filter_neighbour_peer)(struct dp_pdev *pdev,
  666. uint8_t *rx_pkt_hdr);
  667. #endif
  668. void (*mon_vdev_timer_init)(struct dp_soc *soc);
  669. void (*mon_vdev_timer_start)(struct dp_soc *soc);
  670. bool (*mon_vdev_timer_stop)(struct dp_soc *soc);
  671. void (*mon_vdev_timer_deinit)(struct dp_soc *soc);
  672. void (*mon_reap_timer_init)(struct dp_soc *soc);
  673. bool (*mon_reap_timer_start)(struct dp_soc *soc,
  674. enum cdp_mon_reap_source source);
  675. bool (*mon_reap_timer_stop)(struct dp_soc *soc,
  676. enum cdp_mon_reap_source source);
  677. void (*mon_reap_timer_deinit)(struct dp_soc *soc);
  678. #ifdef QCA_MCOPY_SUPPORT
  679. QDF_STATUS (*mon_mcopy_check_deliver)(struct dp_pdev *pdev,
  680. uint16_t peer_id,
  681. uint32_t ppdu_id,
  682. uint8_t first_msdu);
  683. #endif
  684. void (*mon_neighbour_peer_add_ast)(struct dp_pdev *pdev,
  685. struct dp_peer *ta_peer,
  686. uint8_t *mac_addr,
  687. qdf_nbuf_t nbuf,
  688. uint32_t flags);
  689. #ifdef QCA_ENHANCED_STATS_SUPPORT
  690. void (*mon_filter_setup_enhanced_stats)(struct dp_pdev *pdev);
  691. void (*mon_filter_reset_enhanced_stats)(struct dp_pdev *pdev);
  692. void (*mon_tx_stats_update)(struct dp_mon_peer *mon_peer,
  693. struct cdp_tx_completion_ppdu_user *ppdu);
  694. void (*mon_tx_enable_enhanced_stats)(struct dp_pdev *pdev);
  695. void (*mon_tx_disable_enhanced_stats)(struct dp_pdev *pdev);
  696. void (*mon_ppdu_desc_deliver)(struct dp_pdev *pdev,
  697. struct ppdu_info *ppdu_info);
  698. bool (*mon_ppdu_stats_feat_enable_check)(struct dp_pdev *pdev);
  699. void (*mon_ppdu_desc_notify)(struct dp_pdev *pdev, qdf_nbuf_t nbuf);
  700. #endif
  701. #ifdef QCA_MCOPY_SUPPORT
  702. void (*mon_filter_setup_mcopy_mode)(struct dp_pdev *pdev);
  703. void (*mon_filter_reset_mcopy_mode)(struct dp_pdev *pdev);
  704. #endif
  705. #if defined(ATH_SUPPORT_NAC_RSSI) || defined(ATH_SUPPORT_NAC)
  706. void (*mon_filter_setup_smart_monitor)(struct dp_pdev *pdev);
  707. void (*mon_filter_reset_smart_monitor)(struct dp_pdev *pdev);
  708. #endif
  709. void (*mon_filter_set_reset_mon_mac_filter)(struct dp_pdev *pdev,
  710. bool val);
  711. #ifdef WLAN_RX_PKT_CAPTURE_ENH
  712. void (*mon_filter_setup_rx_enh_capture)(struct dp_pdev *pdev);
  713. void (*mon_filter_reset_rx_enh_capture)(struct dp_pdev *pdev);
  714. #endif
  715. void (*mon_filter_setup_rx_mon_mode)(struct dp_pdev *pdev);
  716. void (*mon_filter_reset_rx_mon_mode)(struct dp_pdev *pdev);
  717. void (*mon_filter_setup_tx_mon_mode)(struct dp_pdev *pdev);
  718. void (*mon_filter_reset_tx_mon_mode)(struct dp_pdev *pdev);
  719. #ifdef WDI_EVENT_ENABLE
  720. void (*mon_filter_setup_rx_pkt_log_full)(struct dp_pdev *pdev);
  721. void (*mon_filter_reset_rx_pkt_log_full)(struct dp_pdev *pdev);
  722. void (*mon_filter_setup_rx_pkt_log_lite)(struct dp_pdev *pdev);
  723. void (*mon_filter_reset_rx_pkt_log_lite)(struct dp_pdev *pdev);
  724. void (*mon_filter_setup_rx_pkt_log_cbf)(struct dp_pdev *pdev);
  725. void (*mon_filter_reset_rx_pkt_log_cbf)(struct dp_pdev *pdev);
  726. #ifdef BE_PKTLOG_SUPPORT
  727. void (*mon_filter_setup_pktlog_hybrid)(struct dp_pdev *pdev);
  728. void (*mon_filter_reset_pktlog_hybrid)(struct dp_pdev *pdev);
  729. #endif
  730. #endif
  731. QDF_STATUS (*rx_mon_filter_update)(struct dp_pdev *pdev);
  732. QDF_STATUS (*tx_mon_filter_update)(struct dp_pdev *pdev);
  733. QDF_STATUS (*set_mon_mode_buf_rings_tx)(struct dp_pdev *pdev,
  734. uint16_t num_buf);
  735. QDF_STATUS (*tx_mon_filter_alloc)(struct dp_pdev *pdev);
  736. void (*tx_mon_filter_dealloc)(struct dp_pdev *pdev);
  737. mon_rings_alloc_fp mon_rings_alloc[2];
  738. mon_rings_free_fp mon_rings_free[2];
  739. mon_rings_init_fp mon_rings_init[2];
  740. mon_rings_deinit_fp mon_rings_deinit[2];
  741. QDF_STATUS (*rx_mon_buffers_alloc)(struct dp_pdev *pdev);
  742. void (*rx_mon_buffers_free)(struct dp_pdev *pdev);
  743. void (*rx_mon_desc_pool_init)(struct dp_pdev *pdev);
  744. void (*rx_mon_desc_pool_deinit)(struct dp_pdev *pdev);
  745. QDF_STATUS (*rx_mon_desc_pool_alloc)(struct dp_pdev *pdev);
  746. void (*rx_mon_desc_pool_free)(struct dp_pdev *pdev);
  747. void (*tx_mon_desc_pool_init)(struct dp_pdev *pdev);
  748. void (*tx_mon_desc_pool_deinit)(struct dp_pdev *pdev);
  749. QDF_STATUS (*tx_mon_desc_pool_alloc)(struct dp_pdev *pdev);
  750. void (*tx_mon_desc_pool_free)(struct dp_pdev *pdev);
  751. void (*rx_mon_enable)(uint32_t *msg_word,
  752. struct htt_rx_ring_tlv_filter *tlv_filter);
  753. void (*rx_hdr_length_set)(uint32_t *msg_word,
  754. struct htt_rx_ring_tlv_filter *tlv_filter);
  755. void (*rx_packet_length_set)(uint32_t *msg_word,
  756. struct htt_rx_ring_tlv_filter *tlv_filter);
  757. void (*rx_wmask_subscribe)(uint32_t *msg_word,
  758. struct htt_rx_ring_tlv_filter *tlv_filter);
  759. void (*rx_pkt_tlv_offset)(uint32_t *msg_word,
  760. struct htt_rx_ring_tlv_filter *tlv_filter);
  761. void (*rx_enable_mpdu_logging)(uint32_t *msg_word,
  762. struct htt_rx_ring_tlv_filter *tlv_filter);
  763. void (*rx_enable_fpmo)(uint32_t *msg_word,
  764. struct htt_rx_ring_tlv_filter *tlv_filter);
  765. #ifndef DISABLE_MON_CONFIG
  766. void (*mon_register_intr_ops)(struct dp_soc *soc);
  767. #endif
  768. void (*mon_register_feature_ops)(struct dp_soc *soc);
  769. #ifdef QCA_ENHANCED_STATS_SUPPORT
  770. void (*mon_rx_stats_update)(struct dp_mon_peer *mon_peer,
  771. struct cdp_rx_indication_ppdu *ppdu,
  772. struct cdp_rx_stats_ppdu_user *ppdu_user);
  773. void (*mon_rx_populate_ppdu_usr_info)(struct mon_rx_user_status *rx_user_status,
  774. struct cdp_rx_stats_ppdu_user *ppdu_user);
  775. void (*mon_rx_populate_ppdu_info)(struct hal_rx_ppdu_info *hal_ppdu_info,
  776. struct cdp_rx_indication_ppdu *ppdu);
  777. #endif
  778. QDF_STATUS (*rx_mon_refill_buf_ring)(struct dp_intr *int_ctx);
  779. QDF_STATUS (*tx_mon_refill_buf_ring)(struct dp_intr *int_ctx);
  780. #ifdef QCA_UNDECODED_METADATA_SUPPORT
  781. QDF_STATUS (*mon_config_undecoded_metadata_capture)
  782. (struct dp_pdev *pdev, int val);
  783. void (*mon_filter_setup_undecoded_metadata_capture)
  784. (struct dp_pdev *pdev);
  785. void (*mon_filter_reset_undecoded_metadata_capture)
  786. (struct dp_pdev *pdev);
  787. #endif
  788. QDF_STATUS (*mon_pdev_ext_init)(struct dp_pdev *pdev);
  789. QDF_STATUS (*mon_pdev_ext_deinit)(struct dp_pdev *pdev);
  790. QDF_STATUS (*mon_rx_pdev_tlv_logger_init)(struct dp_pdev *pdev);
  791. QDF_STATUS (*mon_rx_pdev_tlv_logger_deinit)(struct dp_pdev *pdev);
  792. QDF_STATUS (*mon_lite_mon_alloc)(struct dp_pdev *pdev);
  793. void (*mon_lite_mon_dealloc)(struct dp_pdev *pdev);
  794. void (*mon_lite_mon_vdev_delete)(struct dp_pdev *pdev,
  795. struct dp_vdev *vdev);
  796. void (*mon_lite_mon_disable_rx)(struct dp_pdev *pdev);
  797. bool (*mon_lite_mon_is_rx_adv_filter_enable)(struct dp_pdev *pdev);
  798. /* Print advanced monitor stats */
  799. void (*mon_rx_print_advanced_stats)
  800. (struct dp_soc *soc, struct dp_pdev *pdev);
  801. QDF_STATUS (*mon_rx_ppdu_info_cache_create)(struct dp_pdev *pdev);
  802. void (*mon_rx_ppdu_info_cache_destroy)(struct dp_pdev *pdev);
  803. void (*mon_mac_filter_set)(uint32_t *msg_word,
  804. struct htt_rx_ring_tlv_filter *tlv_filter);
  805. #ifdef WLAN_FEATURE_LOCAL_PKT_CAPTURE
  806. QDF_STATUS (*start_local_pkt_capture)(struct dp_pdev *pdev);
  807. QDF_STATUS (*stop_local_pkt_capture)(struct dp_pdev *pdev);
  808. #endif /* WLAN_FEATURE_LOCAL_PKT_CAPTURE */
  809. };
  810. /**
  811. * struct dp_mon_soc_stats - monitor stats
  812. * @frag_alloc: Number of frags allocated
  813. * @frag_free: Number of frags freed
  814. * @empty_queue: Number of frags freed due to empty queue
  815. */
  816. struct dp_mon_soc_stats {
  817. uint32_t frag_alloc;
  818. uint32_t frag_free;
  819. uint32_t empty_queue;
  820. };
  821. struct dp_mon_soc {
  822. /* Holds all monitor related fields extracted from dp_soc */
  823. /* Holds pointer to monitor ops */
  824. /* monitor link descriptor pages */
  825. struct qdf_mem_multi_page_t mon_link_desc_pages[MAX_NUM_LMAC_HW];
  826. /* total link descriptors for monitor mode for each radio */
  827. uint32_t total_mon_link_descs[MAX_NUM_LMAC_HW];
  828. /* Monitor Link descriptor memory banks */
  829. struct link_desc_bank
  830. mon_link_desc_banks[MAX_NUM_LMAC_HW][MAX_MON_LINK_DESC_BANKS];
  831. uint32_t num_mon_link_desc_banks[MAX_NUM_LMAC_HW];
  832. /* Smart monitor capability for HKv2 */
  833. uint8_t hw_nac_monitor_support;
  834. /* Full monitor mode support */
  835. bool full_mon_mode;
  836. /*interrupt timer*/
  837. qdf_timer_t mon_reap_timer;
  838. uint8_t reap_timer_init;
  839. qdf_spinlock_t reap_timer_lock;
  840. /* Bitmap to record trigger sources of the reap timer */
  841. qdf_bitmap(mon_reap_src_bitmap, CDP_MON_REAP_SOURCE_NUM);
  842. qdf_timer_t mon_vdev_timer;
  843. uint8_t mon_vdev_timer_state;
  844. struct dp_mon_ops *mon_ops;
  845. bool monitor_mode_v2;
  846. #ifndef DISABLE_MON_CONFIG
  847. uint32_t (*mon_rx_process)(struct dp_soc *soc,
  848. struct dp_intr *int_ctx,
  849. uint32_t mac_id,
  850. uint32_t quota);
  851. #endif
  852. #ifdef WLAN_TX_PKT_CAPTURE_ENH
  853. struct dp_soc_tx_capture dp_soc_tx_capt;
  854. #endif
  855. /* monitor stats */
  856. struct dp_mon_soc_stats stats;
  857. };
  858. #ifdef WLAN_CONFIG_TELEMETRY_AGENT
  859. struct dp_mon_peer_airtime_consumption {
  860. uint32_t consumption;
  861. uint16_t avg_consumption_per_sec;
  862. };
  863. /**
  864. * struct dp_mon_peer_airtime_stats - Monitor peer airtime stats
  865. * @tx_airtime_consumption: tx artime consumption of peer
  866. * @rx_airtime_consumption: rx airtime consumption of peer
  867. * @last_update_time: Time when last avergae of airtime is done
  868. */
  869. struct dp_mon_peer_airtime_stats {
  870. struct dp_mon_peer_airtime_consumption tx_airtime_consumption[WME_AC_MAX];
  871. struct dp_mon_peer_airtime_consumption rx_airtime_consumption[WME_AC_MAX];
  872. uint64_t last_update_time;
  873. };
  874. /**
  875. * struct dp_mon_peer_deterministic - Monitor peer deterministic stats
  876. * @deter: Deterministic stats per data tid
  877. * @avg_tx_rate: Avg TX rate
  878. */
  879. struct dp_mon_peer_deterministic {
  880. struct cdp_peer_deter_stats deter[CDP_DATA_TID_MAX];
  881. uint64_t avg_tx_rate;
  882. };
  883. #endif
  884. /**
  885. * struct dp_mon_peer_stats - Monitor peer stats
  886. * @tx: tx stats
  887. * @rx: rx stats
  888. * @airtime_stats: mon peer airtime stats
  889. * @deter_stats: Deterministic stats
  890. */
  891. struct dp_mon_peer_stats {
  892. #ifdef QCA_ENHANCED_STATS_SUPPORT
  893. dp_mon_peer_tx_stats tx;
  894. dp_mon_peer_rx_stats rx;
  895. #ifdef WLAN_CONFIG_TELEMETRY_AGENT
  896. struct dp_mon_peer_airtime_stats airtime_stats;
  897. struct dp_mon_peer_deterministic deter_stats;
  898. #endif
  899. #endif
  900. };
  901. struct dp_mon_peer {
  902. #ifdef WLAN_TX_PKT_CAPTURE_ENH
  903. struct dp_peer_tx_capture tx_capture;
  904. #endif
  905. #ifdef FEATURE_PERPKT_INFO
  906. /* delayed ba ppdu stats handling */
  907. struct cdp_delayed_tx_completion_ppdu_user delayed_ba_ppdu_stats;
  908. /* delayed ba flag */
  909. bool last_delayed_ba;
  910. /* delayed ba ppdu id */
  911. uint32_t last_delayed_ba_ppduid;
  912. #endif
  913. uint8_t tx_cap_enabled:1, /* Peer's tx-capture is enabled */
  914. rx_cap_enabled:1; /* Peer's rx-capture is enabled */
  915. /* Peer level flag to check peer based pktlog enabled or
  916. * disabled
  917. */
  918. uint8_t peer_based_pktlog_filter;
  919. /* Monitor peer stats */
  920. struct dp_mon_peer_stats stats;
  921. /* peer extended statistics context */
  922. struct cdp_peer_rate_stats_ctx *peerstats_ctx;
  923. };
  924. struct dp_rx_mon_rssi_offset {
  925. /* Temperature based rssi offset */
  926. int32_t rssi_temp_offset;
  927. /* Low noise amplifier bypass offset */
  928. int32_t xlna_bypass_offset;
  929. /* Low noise amplifier bypass threshold */
  930. int32_t xlna_bypass_threshold;
  931. /* 3 Bytes of xbar_config are used for RF to BB mapping */
  932. uint32_t xbar_config;
  933. /* min noise floor in active chains per channel */
  934. int8_t min_nf_dbm;
  935. /* this value is sum of temp_oofset + min_nf*/
  936. int32_t rssi_offset;
  937. };
  938. struct dp_mon_pdev {
  939. /* monitor */
  940. bool monitor_configured;
  941. struct dp_mon_filter **filter; /* Monitor Filter pointer */
  942. /* advance filter mode and type*/
  943. uint8_t mon_filter_mode;
  944. uint16_t fp_mgmt_filter;
  945. uint16_t fp_ctrl_filter;
  946. uint16_t fp_data_filter;
  947. uint16_t mo_mgmt_filter;
  948. uint16_t mo_ctrl_filter;
  949. uint16_t mo_data_filter;
  950. uint16_t md_data_filter;
  951. #ifdef WLAN_TX_PKT_CAPTURE_ENH
  952. struct dp_pdev_tx_capture tx_capture;
  953. bool stop_tx_capture_work_q_timer;
  954. #endif
  955. /* tx packet capture enhancement */
  956. enum cdp_tx_enh_capture_mode tx_capture_enabled;
  957. /* Stuck count on monitor destination ring MPDU process */
  958. uint32_t mon_dest_ring_stuck_cnt;
  959. /* monitor mode lock */
  960. qdf_spinlock_t mon_lock;
  961. /* Monitor mode operation channel */
  962. int mon_chan_num;
  963. /* Monitor mode operation frequency */
  964. qdf_freq_t mon_chan_freq;
  965. /* Monitor mode band */
  966. enum reg_wifi_band mon_chan_band;
  967. uint32_t mon_ppdu_status;
  968. /* monitor mode status/destination ring PPDU and MPDU count */
  969. struct cdp_pdev_mon_stats rx_mon_stats;
  970. /* Monitor mode interface and status storage */
  971. struct dp_vdev *mvdev;
  972. struct cdp_mon_status rx_mon_recv_status;
  973. /* to track duplicate link descriptor indications by HW for a WAR */
  974. uint64_t mon_last_linkdesc_paddr;
  975. /* to track duplicate buffer indications by HW for a WAR */
  976. uint32_t mon_last_buf_cookie;
  977. #ifdef QCA_SUPPORT_FULL_MON
  978. /* List to maintain all MPDUs for a PPDU in monitor mode */
  979. TAILQ_HEAD(, dp_mon_mpdu) mon_mpdu_q;
  980. /* TODO: define per-user mpdu list
  981. * struct dp_mon_mpdu_list mpdu_list[MAX_MU_USERS];
  982. */
  983. struct hal_rx_mon_desc_info *mon_desc;
  984. #endif
  985. /* Flag to hold on to monitor destination ring */
  986. bool hold_mon_dest_ring;
  987. /* Flag to indicate monitor rings are initialized */
  988. uint8_t pdev_mon_init;
  989. #ifndef REMOVE_PKT_LOG
  990. bool pkt_log_init;
  991. struct pktlog_dev_t *pl_dev; /* Pktlog pdev */
  992. #endif /* #ifndef REMOVE_PKT_LOG */
  993. /* Smart Mesh */
  994. bool filter_neighbour_peers;
  995. /*flag to indicate neighbour_peers_list not empty */
  996. bool neighbour_peers_added;
  997. /* smart mesh mutex */
  998. qdf_spinlock_t neighbour_peer_mutex;
  999. /* Neighnour peer list */
  1000. TAILQ_HEAD(, dp_neighbour_peer) neighbour_peers_list;
  1001. /* Enhanced Stats is enabled */
  1002. uint8_t enhanced_stats_en;
  1003. qdf_nbuf_queue_t rx_status_q;
  1004. /* 128 bytes mpdu header queue per user for ppdu */
  1005. qdf_nbuf_queue_t mpdu_q[MAX_MU_USERS];
  1006. /* is this a mpdu header TLV and not msdu header TLV */
  1007. bool is_mpdu_hdr[MAX_MU_USERS];
  1008. /* per user 128 bytes msdu header list for MPDU */
  1009. struct msdu_list msdu_list[MAX_MU_USERS];
  1010. /* RX enhanced capture mode */
  1011. uint8_t rx_enh_capture_mode;
  1012. /* Rx per peer enhanced capture mode */
  1013. bool rx_enh_capture_peer;
  1014. struct dp_vdev *rx_enh_monitor_vdev;
  1015. /* RX enhanced capture trailer enable/disable flag */
  1016. bool is_rx_enh_capture_trailer_enabled;
  1017. #ifdef WLAN_RX_PKT_CAPTURE_ENH
  1018. /* RX per MPDU/PPDU information */
  1019. struct cdp_rx_indication_mpdu mpdu_ind;
  1020. #endif
  1021. /* Packet log mode */
  1022. uint8_t rx_pktlog_mode;
  1023. /* Enable pktlog logging cbf */
  1024. bool rx_pktlog_cbf;
  1025. #ifdef BE_PKTLOG_SUPPORT
  1026. /* Enable pktlog logging hybrid */
  1027. bool pktlog_hybrid_mode;
  1028. #endif
  1029. bool tx_sniffer_enable;
  1030. /* mirror copy mode */
  1031. enum m_copy_mode mcopy_mode;
  1032. bool bpr_enable;
  1033. /* Pdev level flag to check peer based pktlog enabled or
  1034. * disabled
  1035. */
  1036. uint8_t dp_peer_based_pktlog;
  1037. #ifdef WLAN_ATF_ENABLE
  1038. /* ATF stats enable */
  1039. bool dp_atf_stats_enable;
  1040. #endif
  1041. /* Maintains first status buffer's paddr of a PPDU */
  1042. uint64_t status_buf_addr;
  1043. struct hal_rx_ppdu_info ppdu_info;
  1044. /* ppdu_id of last received HTT TX stats */
  1045. uint32_t last_ppdu_id;
  1046. struct {
  1047. uint8_t last_user;
  1048. qdf_nbuf_t buf;
  1049. } tx_ppdu_info;
  1050. struct {
  1051. uint32_t tx_ppdu_id;
  1052. uint16_t tx_peer_id;
  1053. uint32_t rx_ppdu_id;
  1054. } m_copy_id;
  1055. /* To check if PPDU Tx stats are enabled for Pktlog */
  1056. bool pktlog_ppdu_stats;
  1057. #ifdef ATH_SUPPORT_NAC_RSSI
  1058. bool nac_rssi_filtering;
  1059. #endif
  1060. /* ppdu_stats lock for queue concurrency between cores*/
  1061. qdf_spinlock_t ppdu_stats_lock;
  1062. /* list of ppdu tlvs */
  1063. TAILQ_HEAD(, ppdu_info) ppdu_info_list;
  1064. TAILQ_HEAD(, ppdu_info) sched_comp_ppdu_list;
  1065. uint32_t sched_comp_list_depth;
  1066. uint16_t delivered_sched_cmdid;
  1067. uint16_t last_sched_cmdid;
  1068. uint32_t tlv_count;
  1069. uint32_t list_depth;
  1070. struct {
  1071. qdf_nbuf_t last_nbuf; /*Ptr to mgmt last buf */
  1072. uint8_t *mgmt_buf; /* Ptr to mgmt. payload in HTT ppdu stats */
  1073. uint32_t mgmt_buf_len; /* Len of mgmt. payload in ppdu stats */
  1074. uint32_t ppdu_id;
  1075. } mgmtctrl_frm_info;
  1076. /* Context of cal client timer */
  1077. struct cdp_cal_client *cal_client_ctx;
  1078. uint32_t *ppdu_tlv_buf; /* Buffer to hold HTT ppdu stats TLVs*/
  1079. qdf_nbuf_t mcopy_status_nbuf;
  1080. bool is_dp_mon_pdev_initialized;
  1081. /* indicates if spcl vap is configured */
  1082. bool scan_spcl_vap_configured;
  1083. bool undecoded_metadata_capture;
  1084. #ifdef QCA_UNDECODED_METADATA_SUPPORT
  1085. uint32_t phyrx_error_mask;
  1086. uint32_t phyrx_error_mask_cont;
  1087. #endif
  1088. #ifdef QCA_SUPPORT_SCAN_SPCL_VAP_STATS
  1089. /* enable spcl vap stats reset on ch change */
  1090. bool reset_scan_spcl_vap_stats_enable;
  1091. #endif
  1092. bool is_tlv_hdr_64_bit;
  1093. /* TLV header size*/
  1094. uint8_t tlv_hdr_size;
  1095. /* Invalid monitor peer to account for stats in mcopy mode */
  1096. struct dp_mon_peer *invalid_mon_peer;
  1097. bool rssi_dbm_conv_support;
  1098. struct dp_rx_mon_rssi_offset rssi_offsets;
  1099. uint8_t phy_ppdu_id_size;
  1100. };
  1101. struct dp_mon_vdev {
  1102. /* callback to hand rx monitor 802.11 MPDU to the OS shim */
  1103. ol_txrx_rx_mon_fp osif_rx_mon;
  1104. #ifdef QCA_SUPPORT_SCAN_SPCL_VAP_STATS
  1105. struct cdp_scan_spcl_vap_stats *scan_spcl_vap_stats;
  1106. #endif
  1107. };
  1108. #if defined(QCA_TX_CAPTURE_SUPPORT) || defined(QCA_ENHANCED_STATS_SUPPORT)
  1109. void dp_deliver_mgmt_frm(struct dp_pdev *pdev, qdf_nbuf_t nbuf);
  1110. #else
  1111. static inline
  1112. void dp_deliver_mgmt_frm(struct dp_pdev *pdev, qdf_nbuf_t nbuf)
  1113. {
  1114. }
  1115. #endif
  1116. #if defined(WLAN_SUPPORT_RX_PROTOCOL_TYPE_TAG) ||\
  1117. defined(WLAN_SUPPORT_RX_FLOW_TAG)
  1118. /**
  1119. * dp_rx_mon_update_protocol_flow_tag() - Performs necessary checks for monitor
  1120. * mode and then tags appropriate packets
  1121. * @soc: core txrx main context
  1122. * @dp_pdev: pdev on which packet is received
  1123. * @msdu: QDF packet buffer on which the protocol tag should be set
  1124. * @rx_desc: base address where the RX TLVs start
  1125. *
  1126. * Return: void
  1127. */
  1128. void dp_rx_mon_update_protocol_flow_tag(struct dp_soc *soc,
  1129. struct dp_pdev *dp_pdev,
  1130. qdf_nbuf_t msdu, void *rx_desc);
  1131. #endif /* WLAN_SUPPORT_RX_PROTOCOL_TYPE_TAG || WLAN_SUPPORT_RX_FLOW_TAG */
  1132. #if !defined(WLAN_SUPPORT_RX_PROTOCOL_TYPE_TAG) &&\
  1133. !defined(WLAN_SUPPORT_RX_FLOW_TAG)
  1134. /**
  1135. * dp_rx_mon_update_protocol_flow_tag() - Performs necessary checks for monitor
  1136. * mode and then tags appropriate packets
  1137. * @soc: core txrx main context
  1138. * @dp_pdev: pdev on which packet is received
  1139. * @msdu: QDF packet buffer on which the protocol tag should be set
  1140. * @rx_desc: base address where the RX TLVs start
  1141. *
  1142. * Return: void
  1143. */
  1144. static inline
  1145. void dp_rx_mon_update_protocol_flow_tag(struct dp_soc *soc,
  1146. struct dp_pdev *dp_pdev,
  1147. qdf_nbuf_t msdu, void *rx_desc)
  1148. {
  1149. }
  1150. #endif /* WLAN_SUPPORT_RX_PROTOCOL_TYPE_TAG || WLAN_SUPPORT_RX_FLOW_TAG */
  1151. #ifndef WLAN_TX_PKT_CAPTURE_ENH
  1152. /**
  1153. * dp_peer_tid_queue_init() - Initialize ppdu stats queue per TID
  1154. * @peer: Datapath peer
  1155. *
  1156. */
  1157. static inline void dp_peer_tid_queue_init(struct dp_peer *peer)
  1158. {
  1159. }
  1160. /**
  1161. * dp_peer_tid_queue_cleanup() - remove ppdu stats queue per TID
  1162. * @peer: Datapath peer
  1163. *
  1164. */
  1165. static inline void dp_peer_tid_queue_cleanup(struct dp_peer *peer)
  1166. {
  1167. }
  1168. /**
  1169. * dp_peer_update_80211_hdr() - dp peer update 80211 hdr
  1170. * @vdev: Datapath vdev
  1171. * @peer: Datapath peer
  1172. *
  1173. */
  1174. static inline void
  1175. dp_peer_update_80211_hdr(struct dp_vdev *vdev, struct dp_peer *peer)
  1176. {
  1177. }
  1178. /**
  1179. * dp_get_peer_tx_capture_stats() - to get peer tx capture stats
  1180. * @peer: DP PEER handle
  1181. * @stats: pointor to peer tx capture stats
  1182. *
  1183. * return: QDF_STATUS
  1184. */
  1185. static inline QDF_STATUS
  1186. dp_get_peer_tx_capture_stats(struct dp_peer *peer,
  1187. struct cdp_peer_tx_capture_stats *stats)
  1188. {
  1189. return QDF_STATUS_E_FAILURE;
  1190. }
  1191. /**
  1192. * dp_get_pdev_tx_capture_stats() - to get pdev tx capture stats
  1193. * @pdev: DP PDEV handle
  1194. * @stats: pointor to pdev tx capture stats
  1195. *
  1196. * return: QDF_STATUS
  1197. */
  1198. static inline QDF_STATUS
  1199. dp_get_pdev_tx_capture_stats(struct dp_pdev *pdev,
  1200. struct cdp_pdev_tx_capture_stats *stats)
  1201. {
  1202. return QDF_STATUS_E_FAILURE;
  1203. }
  1204. #endif
  1205. #ifdef WLAN_TX_PKT_CAPTURE_ENH
  1206. extern uint8_t
  1207. dp_cpu_ring_map[DP_NSS_CPU_RING_MAP_MAX][WLAN_CFG_INT_NUM_CONTEXTS_MAX];
  1208. #endif
  1209. /**
  1210. * dp_htt_get_ppdu_sniffer_ampdu_tlv_bitmap() - Get ppdu stats tlv
  1211. * bitmap for sniffer mode
  1212. * @bitmap: received bitmap
  1213. *
  1214. * Return: expected bitmap value, returns zero if doesn't match with
  1215. * either 64-bit Tx window or 256-bit window tlv bitmap
  1216. */
  1217. int
  1218. dp_htt_get_ppdu_sniffer_ampdu_tlv_bitmap(uint32_t bitmap);
  1219. #if (defined(DP_CON_MON) || defined(WDI_EVENT_ENABLE)) &&\
  1220. (!defined(REMOVE_PKT_LOG))
  1221. /**
  1222. * dp_pkt_log_init() - API to initialize packet log
  1223. * @soc_hdl: Datapath soc handle
  1224. * @pdev_id: id of data path pdev handle
  1225. * @scn: HIF context
  1226. *
  1227. * Return: none
  1228. */
  1229. void dp_pkt_log_init(struct cdp_soc_t *soc_hdl, uint8_t pdev_id, void *scn);
  1230. #else
  1231. static inline void
  1232. dp_pkt_log_init(struct cdp_soc_t *soc_hdl, uint8_t pdev_id, void *scn)
  1233. {
  1234. }
  1235. #endif
  1236. #if defined(WDI_EVENT_ENABLE) && defined(QCA_ENHANCED_STATS_SUPPORT)
  1237. QDF_STATUS dp_peer_stats_notify(struct dp_pdev *pdev, struct dp_peer *peer);
  1238. #else
  1239. static inline QDF_STATUS dp_peer_stats_notify(struct dp_pdev *pdev,
  1240. struct dp_peer *peer)
  1241. {
  1242. return QDF_STATUS_SUCCESS;
  1243. }
  1244. #endif
  1245. #if defined(FEATURE_PERPKT_INFO) && defined(WDI_EVENT_ENABLE)
  1246. void dp_send_stats_event(struct dp_pdev *pdev, struct dp_peer *peer,
  1247. uint16_t peer_id);
  1248. #else
  1249. static inline
  1250. void dp_send_stats_event(struct dp_pdev *pdev, struct dp_peer *peer,
  1251. uint16_t peer_id)
  1252. {
  1253. }
  1254. #endif
  1255. #ifndef WLAN_TX_PKT_CAPTURE_ENH
  1256. /**
  1257. * dp_tx_ppdu_stats_process - Deferred PPDU stats handler
  1258. * @context: Opaque work context (PDEV)
  1259. *
  1260. * Return: none
  1261. */
  1262. static inline void dp_tx_ppdu_stats_process(void *context)
  1263. {
  1264. }
  1265. /**
  1266. * dp_tx_capture_htt_frame_counter: increment counter for htt_frame_type
  1267. * @pdev: DP pdev handle
  1268. * @htt_frame_type: htt frame type received from fw
  1269. *
  1270. * return: void
  1271. */
  1272. static inline
  1273. void dp_tx_capture_htt_frame_counter(struct dp_pdev *pdev,
  1274. uint32_t htt_frame_type)
  1275. {
  1276. }
  1277. #endif
  1278. /**
  1279. * dp_rx_cookie_2_mon_link_desc_va() - Converts cookie to a virtual address of
  1280. * the MSDU Link Descriptor
  1281. * @pdev: core txrx pdev context
  1282. * @buf_info: buf_info includes cookie that used to lookup virtual address of
  1283. * link descriptor. Normally this is just an index into a per pdev array.
  1284. * @mac_id: mac id
  1285. *
  1286. * This is the VA of the link descriptor in monitor mode destination ring,
  1287. * that HAL layer later uses to retrieve the list of MSDU's for a given MPDU.
  1288. *
  1289. * Return: void *: Virtual Address of the Rx descriptor
  1290. */
  1291. static inline
  1292. void *dp_rx_cookie_2_mon_link_desc_va(struct dp_pdev *pdev,
  1293. struct hal_buf_info *buf_info,
  1294. int mac_id)
  1295. {
  1296. void *link_desc_va;
  1297. struct qdf_mem_multi_page_t *pages;
  1298. uint16_t page_id = LINK_DESC_COOKIE_PAGE_ID(buf_info->sw_cookie);
  1299. struct dp_mon_soc *mon_soc = pdev->soc->monitor_soc;
  1300. if (!mon_soc)
  1301. return NULL;
  1302. pages = &mon_soc->mon_link_desc_pages[mac_id];
  1303. if (!pages)
  1304. return NULL;
  1305. if (qdf_unlikely(page_id >= pages->num_pages))
  1306. return NULL;
  1307. link_desc_va = pages->dma_pages[page_id].page_v_addr_start +
  1308. (buf_info->paddr - pages->dma_pages[page_id].page_p_addr);
  1309. return link_desc_va;
  1310. }
  1311. /**
  1312. * dp_soc_is_full_mon_enable() - Return if full monitor mode is enabled
  1313. * @pdev: point to dp pdev
  1314. *
  1315. * Return: Full monitor mode status
  1316. */
  1317. static inline bool dp_soc_is_full_mon_enable(struct dp_pdev *pdev)
  1318. {
  1319. return (pdev->soc->monitor_soc->full_mon_mode &&
  1320. pdev->monitor_pdev->monitor_configured) ? true : false;
  1321. }
  1322. /**
  1323. * dp_monitor_is_enable_mcopy_mode() - check if mcopy mode is enabled
  1324. * @pdev: point to dp pdev
  1325. *
  1326. * Return: true if mcopy mode is enabled
  1327. */
  1328. static inline bool dp_monitor_is_enable_mcopy_mode(struct dp_pdev *pdev)
  1329. {
  1330. if (qdf_unlikely(!pdev || !pdev->monitor_pdev))
  1331. return false;
  1332. return pdev->monitor_pdev->mcopy_mode;
  1333. }
  1334. /**
  1335. * dp_monitor_is_enable_tx_sniffer() - check if tx sniffer is enabled
  1336. * @pdev: point to dp pdev
  1337. *
  1338. * Return: true if tx sniffer is enabled
  1339. */
  1340. static inline bool dp_monitor_is_enable_tx_sniffer(struct dp_pdev *pdev)
  1341. {
  1342. if (qdf_unlikely(!pdev || !pdev->monitor_pdev))
  1343. return false;
  1344. return pdev->monitor_pdev->tx_sniffer_enable;
  1345. }
  1346. /**
  1347. * dp_monitor_is_configured() - check if monitor configured is set
  1348. * @pdev: point to dp pdev
  1349. *
  1350. * Return: true if monitor configured is set
  1351. */
  1352. static inline bool dp_monitor_is_configured(struct dp_pdev *pdev)
  1353. {
  1354. if (qdf_unlikely(!pdev || !pdev->monitor_pdev))
  1355. return false;
  1356. return pdev->monitor_pdev->monitor_configured;
  1357. }
  1358. /**
  1359. * dp_monitor_check_com_info_ppdu_id() - check if msdu ppdu_id matches with
  1360. * com info ppdu_id
  1361. * @pdev: point to dp pdev
  1362. * @rx_desc: point to rx_desc
  1363. *
  1364. * Return: success if ppdu_id matches
  1365. */
  1366. static inline QDF_STATUS dp_monitor_check_com_info_ppdu_id(struct dp_pdev *pdev,
  1367. void *rx_desc)
  1368. {
  1369. struct cdp_mon_status *rs;
  1370. struct dp_mon_pdev *mon_pdev;
  1371. uint32_t msdu_ppdu_id = 0;
  1372. if (qdf_unlikely(!pdev || !pdev->monitor_pdev))
  1373. return QDF_STATUS_E_FAILURE;
  1374. mon_pdev = pdev->monitor_pdev;
  1375. if (qdf_likely(1 != mon_pdev->ppdu_info.rx_status.rxpcu_filter_pass))
  1376. return QDF_STATUS_E_FAILURE;
  1377. rs = &pdev->monitor_pdev->rx_mon_recv_status;
  1378. if (!rs || rs->cdp_rs_rxdma_err)
  1379. return QDF_STATUS_E_FAILURE;
  1380. msdu_ppdu_id = hal_rx_get_ppdu_id(pdev->soc->hal_soc, rx_desc);
  1381. if (msdu_ppdu_id != mon_pdev->ppdu_info.com_info.ppdu_id) {
  1382. QDF_TRACE(QDF_MODULE_ID_DP,
  1383. QDF_TRACE_LEVEL_ERROR,
  1384. "msdu_ppdu_id=%x,com_info.ppdu_id=%x",
  1385. msdu_ppdu_id,
  1386. mon_pdev->ppdu_info.com_info.ppdu_id);
  1387. return QDF_STATUS_E_FAILURE;
  1388. }
  1389. return QDF_STATUS_SUCCESS;
  1390. }
  1391. /**
  1392. * dp_monitor_get_rx_status() - get rx status
  1393. * @pdev: point to dp pdev
  1394. *
  1395. * Return: return rx status pointer
  1396. */
  1397. static inline struct mon_rx_status*
  1398. dp_monitor_get_rx_status(struct dp_pdev *pdev)
  1399. {
  1400. if (qdf_unlikely(!pdev || !pdev->monitor_pdev))
  1401. return NULL;
  1402. return &pdev->monitor_pdev->ppdu_info.rx_status;
  1403. }
  1404. /**
  1405. * dp_monitor_is_chan_band_known() - check if monitor chan band known
  1406. * @pdev: point to dp pdev
  1407. *
  1408. * Return: true if chan band known
  1409. */
  1410. static inline bool dp_monitor_is_chan_band_known(struct dp_pdev *pdev)
  1411. {
  1412. if (qdf_unlikely(!pdev || !pdev->monitor_pdev))
  1413. return false;
  1414. if (pdev->monitor_pdev->mon_chan_band != REG_BAND_UNKNOWN)
  1415. return true;
  1416. return false;
  1417. }
  1418. /**
  1419. * dp_monitor_get_chan_band() - get chan band
  1420. * @pdev: point to dp pdev
  1421. *
  1422. * Return: wifi channel band
  1423. */
  1424. static inline enum reg_wifi_band
  1425. dp_monitor_get_chan_band(struct dp_pdev *pdev)
  1426. {
  1427. return pdev->monitor_pdev->mon_chan_band;
  1428. }
  1429. /**
  1430. * dp_monitor_print_tx_stats() - print tx stats from monitor pdev
  1431. * @pdev: point to dp pdev
  1432. *
  1433. */
  1434. static inline void dp_monitor_print_tx_stats(struct dp_pdev *pdev)
  1435. {
  1436. if (qdf_unlikely(!pdev || !pdev->monitor_pdev))
  1437. return;
  1438. DP_PRINT_STATS("ppdu info schedule completion list depth: %d",
  1439. pdev->monitor_pdev->sched_comp_list_depth);
  1440. DP_PRINT_STATS("delivered sched cmdid: %d",
  1441. pdev->monitor_pdev->delivered_sched_cmdid);
  1442. DP_PRINT_STATS("cur sched cmdid: %d",
  1443. pdev->monitor_pdev->last_sched_cmdid);
  1444. DP_PRINT_STATS("ppdu info list depth: %d",
  1445. pdev->monitor_pdev->list_depth);
  1446. }
  1447. /**
  1448. * dp_monitor_set_chan_num() - set channel number
  1449. * @pdev: point to dp pdev
  1450. * @chan_num: channel number
  1451. *
  1452. */
  1453. static inline void dp_monitor_set_chan_num(struct dp_pdev *pdev, int chan_num)
  1454. {
  1455. if (qdf_unlikely(!pdev || !pdev->monitor_pdev))
  1456. return;
  1457. pdev->monitor_pdev->mon_chan_num = chan_num;
  1458. }
  1459. /**
  1460. * dp_monitor_get_chan_num() - get channel number
  1461. * @pdev: DP pdev handle
  1462. *
  1463. * Return: channel number
  1464. */
  1465. static inline int dp_monitor_get_chan_num(struct dp_pdev *pdev)
  1466. {
  1467. if (qdf_unlikely(!pdev || !pdev->monitor_pdev))
  1468. return 0;
  1469. return pdev->monitor_pdev->mon_chan_num;
  1470. }
  1471. /**
  1472. * dp_monitor_set_chan_freq() - set channel frequency
  1473. * @pdev: point to dp pdev
  1474. * @chan_freq: channel frequency
  1475. *
  1476. */
  1477. static inline void
  1478. dp_monitor_set_chan_freq(struct dp_pdev *pdev, qdf_freq_t chan_freq)
  1479. {
  1480. if (qdf_unlikely(!pdev || !pdev->monitor_pdev))
  1481. return;
  1482. pdev->monitor_pdev->mon_chan_freq = chan_freq;
  1483. }
  1484. /**
  1485. * dp_monitor_get_chan_freq() - get channel frequency
  1486. * @pdev: DP pdev handle
  1487. *
  1488. * Return: channel frequency
  1489. */
  1490. static inline qdf_freq_t
  1491. dp_monitor_get_chan_freq(struct dp_pdev *pdev)
  1492. {
  1493. if (qdf_unlikely(!pdev || !pdev->monitor_pdev))
  1494. return 0;
  1495. return pdev->monitor_pdev->mon_chan_freq;
  1496. }
  1497. /**
  1498. * dp_monitor_set_chan_band() - set channel band
  1499. * @pdev: point to dp pdev
  1500. * @chan_band: channel band
  1501. *
  1502. */
  1503. static inline void
  1504. dp_monitor_set_chan_band(struct dp_pdev *pdev, enum reg_wifi_band chan_band)
  1505. {
  1506. if (qdf_unlikely(!pdev || !pdev->monitor_pdev))
  1507. return;
  1508. pdev->monitor_pdev->mon_chan_band = chan_band;
  1509. }
  1510. /**
  1511. * dp_monitor_get_mpdu_status() - get mpdu status
  1512. * @pdev: point to dp pdev
  1513. * @soc: point to dp soc
  1514. * @rx_tlv_hdr: point to rx tlv header
  1515. *
  1516. */
  1517. static inline void dp_monitor_get_mpdu_status(struct dp_pdev *pdev,
  1518. struct dp_soc *soc,
  1519. uint8_t *rx_tlv_hdr)
  1520. {
  1521. struct dp_mon_pdev *mon_pdev;
  1522. if (qdf_unlikely(!pdev || !pdev->monitor_pdev))
  1523. return;
  1524. mon_pdev = pdev->monitor_pdev;
  1525. hal_rx_mon_hw_desc_get_mpdu_status(soc->hal_soc, rx_tlv_hdr,
  1526. &mon_pdev->ppdu_info.rx_status);
  1527. }
  1528. #ifdef FEATURE_NAC_RSSI
  1529. /**
  1530. * dp_monitor_drop_inv_peer_pkts() - drop invalid peer pkts
  1531. * @vdev: point to dp vdev
  1532. *
  1533. * Return: success if sta mode and filter for neighbour peers enabled
  1534. */
  1535. static inline QDF_STATUS dp_monitor_drop_inv_peer_pkts(struct dp_vdev *vdev)
  1536. {
  1537. struct dp_pdev *pdev = vdev->pdev;
  1538. struct dp_soc *soc = pdev->soc;
  1539. if (!soc->monitor_soc)
  1540. return QDF_STATUS_E_FAILURE;
  1541. if (!soc->monitor_soc->hw_nac_monitor_support &&
  1542. pdev->monitor_pdev->filter_neighbour_peers &&
  1543. vdev->opmode == wlan_op_mode_sta)
  1544. return QDF_STATUS_SUCCESS;
  1545. return QDF_STATUS_E_FAILURE;
  1546. }
  1547. #else
  1548. static inline QDF_STATUS dp_monitor_drop_inv_peer_pkts(struct dp_vdev *vdev)
  1549. {
  1550. return QDF_STATUS_E_FAILURE;
  1551. }
  1552. #endif
  1553. /**
  1554. * dp_peer_ppdu_delayed_ba_init() - Initialize ppdu in peer
  1555. * @peer: Datapath peer
  1556. *
  1557. * return: void
  1558. */
  1559. #ifdef FEATURE_PERPKT_INFO
  1560. static inline void dp_peer_ppdu_delayed_ba_init(struct dp_peer *peer)
  1561. {
  1562. struct dp_mon_peer *mon_peer = peer->monitor_peer;
  1563. if (!mon_peer)
  1564. return;
  1565. qdf_mem_zero(&mon_peer->delayed_ba_ppdu_stats,
  1566. sizeof(struct cdp_delayed_tx_completion_ppdu_user));
  1567. mon_peer->last_delayed_ba = false;
  1568. mon_peer->last_delayed_ba_ppduid = 0;
  1569. }
  1570. #else
  1571. static inline void dp_peer_ppdu_delayed_ba_init(struct dp_peer *peer)
  1572. {
  1573. }
  1574. #endif
  1575. /**
  1576. * dp_monitor_vdev_register_osif() - Register osif rx mon
  1577. * @vdev: point to vdev
  1578. * @txrx_ops: point to ol txrx ops
  1579. *
  1580. * Return: void
  1581. */
  1582. static inline void dp_monitor_vdev_register_osif(struct dp_vdev *vdev,
  1583. struct ol_txrx_ops *txrx_ops)
  1584. {
  1585. if (!vdev->monitor_vdev)
  1586. return;
  1587. vdev->monitor_vdev->osif_rx_mon = txrx_ops->rx.mon;
  1588. }
  1589. /**
  1590. * dp_monitor_get_monitor_vdev_from_pdev() - Get monitor vdev
  1591. * @pdev: point to pdev
  1592. *
  1593. * Return: pointer to vdev
  1594. */
  1595. static inline struct dp_vdev*
  1596. dp_monitor_get_monitor_vdev_from_pdev(struct dp_pdev *pdev)
  1597. {
  1598. if (!pdev || !pdev->monitor_pdev || !pdev->monitor_pdev->mvdev)
  1599. return NULL;
  1600. return pdev->monitor_pdev->mvdev;
  1601. }
  1602. /**
  1603. * dp_monitor_is_vdev_timer_running() - Get vdev timer status
  1604. * @soc: point to soc
  1605. *
  1606. * Return: true if timer running
  1607. */
  1608. static inline bool dp_monitor_is_vdev_timer_running(struct dp_soc *soc)
  1609. {
  1610. if (qdf_unlikely(!soc || !soc->monitor_soc))
  1611. return false;
  1612. return !!(soc->monitor_soc->mon_vdev_timer_state &
  1613. MON_VDEV_TIMER_RUNNING);
  1614. }
  1615. /**
  1616. * dp_monitor_get_link_desc_pages() - Get link desc pages
  1617. * @soc: point to soc
  1618. * @mac_id: mac id
  1619. *
  1620. * Return: return point to link desc pages
  1621. */
  1622. static inline struct qdf_mem_multi_page_t*
  1623. dp_monitor_get_link_desc_pages(struct dp_soc *soc, uint32_t mac_id)
  1624. {
  1625. if (qdf_unlikely(!soc || !soc->monitor_soc))
  1626. return NULL;
  1627. return &soc->monitor_soc->mon_link_desc_pages[mac_id];
  1628. }
  1629. /**
  1630. * dp_monitor_get_total_link_descs() - Get total link descs
  1631. * @soc: point to soc
  1632. * @mac_id: mac id
  1633. *
  1634. * Return: return point total link descs
  1635. */
  1636. static inline uint32_t *
  1637. dp_monitor_get_total_link_descs(struct dp_soc *soc, uint32_t mac_id)
  1638. {
  1639. return &soc->monitor_soc->total_mon_link_descs[mac_id];
  1640. }
  1641. /**
  1642. * dp_monitor_pdev_attach() - Monitor pdev attach
  1643. * @pdev: point to pdev
  1644. *
  1645. * Return: return QDF_STATUS
  1646. */
  1647. static inline QDF_STATUS dp_monitor_pdev_attach(struct dp_pdev *pdev)
  1648. {
  1649. struct dp_mon_ops *monitor_ops;
  1650. struct dp_mon_soc *mon_soc = pdev->soc->monitor_soc;
  1651. /*
  1652. * mon_soc uninitialized modular support enabled
  1653. * monitor related attach/detach/init/deinit
  1654. * will be done while monitor insmod
  1655. */
  1656. if (!mon_soc)
  1657. return QDF_STATUS_SUCCESS;
  1658. monitor_ops = mon_soc->mon_ops;
  1659. if (!monitor_ops || !monitor_ops->mon_pdev_attach) {
  1660. dp_mon_debug("callback not registered");
  1661. return QDF_STATUS_E_FAILURE;
  1662. }
  1663. return monitor_ops->mon_pdev_attach(pdev);
  1664. }
  1665. /**
  1666. * dp_monitor_pdev_detach() - Monitor pdev detach
  1667. * @pdev: point to pdev
  1668. *
  1669. * Return: return QDF_STATUS
  1670. */
  1671. static inline QDF_STATUS dp_monitor_pdev_detach(struct dp_pdev *pdev)
  1672. {
  1673. struct dp_mon_ops *monitor_ops;
  1674. struct dp_mon_soc *mon_soc = pdev->soc->monitor_soc;
  1675. /*
  1676. * mon_soc uninitialized modular support enabled
  1677. * monitor related attach/detach/init/deinit
  1678. * will be done while monitor insmod
  1679. */
  1680. if (!mon_soc)
  1681. return QDF_STATUS_SUCCESS;
  1682. monitor_ops = mon_soc->mon_ops;
  1683. if (!monitor_ops || !monitor_ops->mon_pdev_detach) {
  1684. dp_mon_debug("callback not registered");
  1685. return QDF_STATUS_E_FAILURE;
  1686. }
  1687. return monitor_ops->mon_pdev_detach(pdev);
  1688. }
  1689. /**
  1690. * dp_monitor_vdev_attach() - Monitor vdev attach
  1691. * @vdev: point to vdev
  1692. *
  1693. * Return: return QDF_STATUS
  1694. */
  1695. static inline QDF_STATUS dp_monitor_vdev_attach(struct dp_vdev *vdev)
  1696. {
  1697. struct dp_mon_ops *monitor_ops;
  1698. struct dp_mon_soc *mon_soc = vdev->pdev->soc->monitor_soc;
  1699. if (!mon_soc)
  1700. return QDF_STATUS_E_FAILURE;
  1701. monitor_ops = mon_soc->mon_ops;
  1702. if (!monitor_ops || !monitor_ops->mon_vdev_attach) {
  1703. dp_mon_debug("callback not registered");
  1704. return QDF_STATUS_E_FAILURE;
  1705. }
  1706. return monitor_ops->mon_vdev_attach(vdev);
  1707. }
  1708. /**
  1709. * dp_monitor_vdev_detach() - Monitor vdev detach
  1710. * @vdev: point to vdev
  1711. *
  1712. * Return: return QDF_STATUS
  1713. */
  1714. static inline QDF_STATUS dp_monitor_vdev_detach(struct dp_vdev *vdev)
  1715. {
  1716. struct dp_mon_ops *monitor_ops;
  1717. struct dp_mon_soc *mon_soc = vdev->pdev->soc->monitor_soc;
  1718. if (!mon_soc)
  1719. return QDF_STATUS_E_FAILURE;
  1720. monitor_ops = mon_soc->mon_ops;
  1721. if (!monitor_ops || !monitor_ops->mon_vdev_detach) {
  1722. dp_mon_debug("callback not registered");
  1723. return QDF_STATUS_E_FAILURE;
  1724. }
  1725. return monitor_ops->mon_vdev_detach(vdev);
  1726. }
  1727. /**
  1728. * dp_monitor_peer_attach() - Monitor peer attach
  1729. * @soc: point to soc
  1730. * @peer: point to peer
  1731. *
  1732. * Return: return QDF_STATUS
  1733. */
  1734. static inline QDF_STATUS dp_monitor_peer_attach(struct dp_soc *soc,
  1735. struct dp_peer *peer)
  1736. {
  1737. struct dp_mon_ops *monitor_ops;
  1738. struct dp_mon_soc *mon_soc = soc->monitor_soc;
  1739. if (!mon_soc)
  1740. return QDF_STATUS_E_FAILURE;
  1741. monitor_ops = mon_soc->mon_ops;
  1742. if (!monitor_ops || !monitor_ops->mon_peer_attach) {
  1743. dp_mon_debug("callback not registered");
  1744. return QDF_STATUS_E_FAILURE;
  1745. }
  1746. return monitor_ops->mon_peer_attach(peer);
  1747. }
  1748. /**
  1749. * dp_monitor_peer_detach() - Monitor peer detach
  1750. * @soc: point to soc
  1751. * @peer: point to peer
  1752. *
  1753. * Return: return QDF_STATUS
  1754. */
  1755. static inline QDF_STATUS dp_monitor_peer_detach(struct dp_soc *soc,
  1756. struct dp_peer *peer)
  1757. {
  1758. struct dp_mon_ops *monitor_ops;
  1759. struct dp_mon_soc *mon_soc = soc->monitor_soc;
  1760. if (!mon_soc)
  1761. return QDF_STATUS_E_FAILURE;
  1762. monitor_ops = mon_soc->mon_ops;
  1763. if (!monitor_ops || !monitor_ops->mon_peer_detach) {
  1764. dp_mon_debug("callback not registered");
  1765. return QDF_STATUS_E_FAILURE;
  1766. }
  1767. return monitor_ops->mon_peer_detach(peer);
  1768. }
  1769. /**
  1770. * dp_monitor_peer_get_peerstats_ctx() - Get peerstats context from monitor peer
  1771. * @soc: Datapath soc handle
  1772. * @peer: Datapath peer handle
  1773. *
  1774. * Return: peer stats context
  1775. */
  1776. static inline struct cdp_peer_rate_stats_ctx*
  1777. dp_monitor_peer_get_peerstats_ctx(struct dp_soc *soc, struct dp_peer *peer)
  1778. {
  1779. struct dp_mon_ops *monitor_ops;
  1780. struct dp_mon_soc *mon_soc = soc->monitor_soc;
  1781. if (!mon_soc)
  1782. return NULL;
  1783. monitor_ops = mon_soc->mon_ops;
  1784. if (!monitor_ops || !monitor_ops->mon_peer_get_peerstats_ctx) {
  1785. dp_mon_debug("callback not registered");
  1786. return NULL;
  1787. }
  1788. return monitor_ops->mon_peer_get_peerstats_ctx(peer);
  1789. }
  1790. /**
  1791. * dp_monitor_peer_reset_stats() - Reset monitor peer stats
  1792. * @soc: Datapath soc handle
  1793. * @peer: Datapath peer handle
  1794. *
  1795. * Return: none
  1796. */
  1797. static inline void dp_monitor_peer_reset_stats(struct dp_soc *soc,
  1798. struct dp_peer *peer)
  1799. {
  1800. struct dp_mon_ops *monitor_ops;
  1801. struct dp_mon_soc *mon_soc = soc->monitor_soc;
  1802. if (!mon_soc)
  1803. return;
  1804. monitor_ops = mon_soc->mon_ops;
  1805. if (!monitor_ops || !monitor_ops->mon_peer_reset_stats) {
  1806. dp_mon_debug("callback not registered");
  1807. return;
  1808. }
  1809. monitor_ops->mon_peer_reset_stats(peer);
  1810. }
  1811. /**
  1812. * dp_monitor_peer_get_stats() - Get monitor peer stats
  1813. * @soc: Datapath soc handle
  1814. * @peer: Datapath peer handle
  1815. * @arg: Pointer to stats struct
  1816. * @type: Update type
  1817. *
  1818. * Return: none
  1819. */
  1820. static inline
  1821. void dp_monitor_peer_get_stats(struct dp_soc *soc, struct dp_peer *peer,
  1822. void *arg, enum cdp_stat_update_type type)
  1823. {
  1824. struct dp_mon_ops *monitor_ops;
  1825. struct dp_mon_soc *mon_soc = soc->monitor_soc;
  1826. if (!mon_soc)
  1827. return;
  1828. monitor_ops = mon_soc->mon_ops;
  1829. if (!monitor_ops || !monitor_ops->mon_peer_get_stats) {
  1830. dp_mon_debug("callback not registered");
  1831. return;
  1832. }
  1833. monitor_ops->mon_peer_get_stats(peer, arg, type);
  1834. }
  1835. /**
  1836. * dp_monitor_invalid_peer_update_pdev_stats() - Update pdev stats from
  1837. * invalid monitor peer
  1838. * @soc: Datapath soc handle
  1839. * @pdev: Datapath pdev handle
  1840. *
  1841. * Return: none
  1842. */
  1843. static inline
  1844. void dp_monitor_invalid_peer_update_pdev_stats(struct dp_soc *soc,
  1845. struct dp_pdev *pdev)
  1846. {
  1847. struct dp_mon_ops *monitor_ops;
  1848. struct dp_mon_soc *mon_soc = soc->monitor_soc;
  1849. if (!mon_soc)
  1850. return;
  1851. monitor_ops = mon_soc->mon_ops;
  1852. if (!monitor_ops || !monitor_ops->mon_invalid_peer_update_pdev_stats) {
  1853. dp_mon_debug("callback not registered");
  1854. return;
  1855. }
  1856. monitor_ops->mon_invalid_peer_update_pdev_stats(pdev);
  1857. }
  1858. /**
  1859. * dp_monitor_peer_get_stats_param() - Get stats param value from monitor peer
  1860. * @soc: Datapath soc handle
  1861. * @peer: Datapath peer handle
  1862. * @type: Stats type requested
  1863. * @buf: Pointer to buffer for stats param
  1864. *
  1865. * Return: QDF_STATUS
  1866. */
  1867. static inline QDF_STATUS
  1868. dp_monitor_peer_get_stats_param(struct dp_soc *soc, struct dp_peer *peer,
  1869. enum cdp_peer_stats_type type,
  1870. cdp_peer_stats_param_t *buf)
  1871. {
  1872. struct dp_mon_ops *monitor_ops;
  1873. struct dp_mon_soc *mon_soc = soc->monitor_soc;
  1874. if (!mon_soc)
  1875. return QDF_STATUS_E_FAILURE;
  1876. monitor_ops = mon_soc->mon_ops;
  1877. if (!monitor_ops || !monitor_ops->mon_peer_get_stats_param) {
  1878. dp_mon_debug("callback not registered");
  1879. return QDF_STATUS_E_FAILURE;
  1880. }
  1881. return monitor_ops->mon_peer_get_stats_param(peer, type, buf);
  1882. }
  1883. /**
  1884. * dp_monitor_pdev_init() - Monitor pdev init
  1885. * @pdev: point to pdev
  1886. *
  1887. * Return: return QDF_STATUS
  1888. */
  1889. static inline QDF_STATUS dp_monitor_pdev_init(struct dp_pdev *pdev)
  1890. {
  1891. struct dp_mon_ops *monitor_ops;
  1892. struct dp_mon_soc *mon_soc = pdev->soc->monitor_soc;
  1893. /*
  1894. * mon_soc uninitialized when modular support enabled
  1895. * monitor related attach/detach/init/deinit
  1896. * will be done while monitor insmod
  1897. */
  1898. if (!mon_soc)
  1899. return QDF_STATUS_SUCCESS;
  1900. monitor_ops = mon_soc->mon_ops;
  1901. if (!monitor_ops || !monitor_ops->mon_pdev_init) {
  1902. dp_mon_debug("callback not registered");
  1903. return QDF_STATUS_E_FAILURE;
  1904. }
  1905. return monitor_ops->mon_pdev_init(pdev);
  1906. }
  1907. /**
  1908. * dp_monitor_pdev_deinit() - Monitor pdev deinit
  1909. * @pdev: point to pdev
  1910. *
  1911. * Return: return QDF_STATUS
  1912. */
  1913. static inline QDF_STATUS dp_monitor_pdev_deinit(struct dp_pdev *pdev)
  1914. {
  1915. struct dp_mon_ops *monitor_ops;
  1916. struct dp_mon_soc *mon_soc = pdev->soc->monitor_soc;
  1917. /*
  1918. * mon_soc uninitialized modular when support enabled
  1919. * monitor related attach/detach/init/deinit
  1920. * will be done while monitor insmod
  1921. */
  1922. if (!mon_soc)
  1923. return QDF_STATUS_SUCCESS;
  1924. monitor_ops = mon_soc->mon_ops;
  1925. if (!monitor_ops || !monitor_ops->mon_pdev_deinit) {
  1926. dp_mon_debug("callback not registered");
  1927. return QDF_STATUS_E_FAILURE;
  1928. }
  1929. return monitor_ops->mon_pdev_deinit(pdev);
  1930. }
  1931. /**
  1932. * dp_monitor_soc_cfg_init() - Monitor sco cfg init
  1933. * @soc: point to soc
  1934. *
  1935. * Return: return QDF_STATUS
  1936. */
  1937. static inline QDF_STATUS dp_monitor_soc_cfg_init(struct dp_soc *soc)
  1938. {
  1939. struct dp_mon_ops *monitor_ops;
  1940. struct dp_mon_soc *mon_soc = soc->monitor_soc;
  1941. /*
  1942. * this API is getting call from dp_soc_init,
  1943. * mon_soc will be uninitialized when monitor support enabled
  1944. * So returning QDF_STATUS_SUCCESS.
  1945. * soc cfg init will be done while monitor insmod.
  1946. */
  1947. if (!mon_soc)
  1948. return QDF_STATUS_SUCCESS;
  1949. monitor_ops = mon_soc->mon_ops;
  1950. if (!monitor_ops || !monitor_ops->mon_soc_cfg_init) {
  1951. dp_mon_debug("callback not registered");
  1952. return QDF_STATUS_E_FAILURE;
  1953. }
  1954. return monitor_ops->mon_soc_cfg_init(soc);
  1955. }
  1956. /**
  1957. * dp_monitor_config_debug_sniffer() - Monitor config debug sniffer
  1958. * @pdev: point to pdev
  1959. * @val: val
  1960. *
  1961. * Return: return QDF_STATUS
  1962. */
  1963. static inline QDF_STATUS dp_monitor_config_debug_sniffer(struct dp_pdev *pdev,
  1964. int val)
  1965. {
  1966. struct dp_mon_ops *monitor_ops;
  1967. struct dp_mon_soc *mon_soc = pdev->soc->monitor_soc;
  1968. if (!mon_soc)
  1969. return QDF_STATUS_E_FAILURE;
  1970. monitor_ops = mon_soc->mon_ops;
  1971. if (!monitor_ops || !monitor_ops->mon_config_debug_sniffer) {
  1972. dp_mon_debug("callback not registered");
  1973. return QDF_STATUS_E_FAILURE;
  1974. }
  1975. return monitor_ops->mon_config_debug_sniffer(pdev, val);
  1976. }
  1977. /**
  1978. * dp_monitor_flush_rings() - Flush monitor rings
  1979. * @soc: point to soc
  1980. *
  1981. * Return: None
  1982. */
  1983. static inline void dp_monitor_flush_rings(struct dp_soc *soc)
  1984. {
  1985. struct dp_mon_ops *monitor_ops;
  1986. struct dp_mon_soc *mon_soc = soc->monitor_soc;
  1987. if (!mon_soc) {
  1988. dp_mon_debug("monitor soc is NULL");
  1989. return;
  1990. }
  1991. monitor_ops = mon_soc->mon_ops;
  1992. if (!monitor_ops || !monitor_ops->mon_flush_rings) {
  1993. dp_mon_debug("callback not registered");
  1994. return;
  1995. }
  1996. return monitor_ops->mon_flush_rings(soc);
  1997. }
  1998. /**
  1999. * dp_monitor_config_undecoded_metadata_capture() - Monitor config
  2000. * undecoded metadata capture
  2001. * @pdev: point to pdev
  2002. * @val: val
  2003. *
  2004. * Return: return QDF_STATUS
  2005. */
  2006. #ifdef QCA_UNDECODED_METADATA_SUPPORT
  2007. static inline
  2008. QDF_STATUS dp_monitor_config_undecoded_metadata_capture(struct dp_pdev *pdev,
  2009. int val)
  2010. {
  2011. struct dp_mon_ops *monitor_ops;
  2012. struct dp_mon_soc *mon_soc = pdev->soc->monitor_soc;
  2013. if (!mon_soc)
  2014. return QDF_STATUS_E_FAILURE;
  2015. monitor_ops = mon_soc->mon_ops;
  2016. if (!monitor_ops ||
  2017. !monitor_ops->mon_config_undecoded_metadata_capture) {
  2018. dp_mon_debug("callback not registered");
  2019. return QDF_STATUS_E_FAILURE;
  2020. }
  2021. return monitor_ops->mon_config_undecoded_metadata_capture(pdev, val);
  2022. }
  2023. static inline QDF_STATUS
  2024. dp_monitor_config_undecoded_metadata_phyrx_error_mask(struct dp_pdev *pdev,
  2025. int mask, int mask_cont)
  2026. {
  2027. struct dp_mon_ops *monitor_ops;
  2028. struct dp_mon_pdev *mon_pdev = pdev->monitor_pdev;
  2029. struct dp_mon_soc *mon_soc = pdev->soc->monitor_soc;
  2030. if (!mon_soc)
  2031. return QDF_STATUS_E_FAILURE;
  2032. if (!mon_pdev)
  2033. return QDF_STATUS_E_FAILURE;
  2034. monitor_ops = mon_soc->mon_ops;
  2035. if (!monitor_ops ||
  2036. !monitor_ops->mon_config_undecoded_metadata_capture) {
  2037. dp_mon_debug("callback not registered");
  2038. return QDF_STATUS_E_FAILURE;
  2039. }
  2040. if (!mon_pdev->undecoded_metadata_capture) {
  2041. qdf_info("mask:0x%x mask_cont:0x%x", mask, mask_cont);
  2042. return QDF_STATUS_SUCCESS;
  2043. }
  2044. mon_pdev->phyrx_error_mask = mask;
  2045. mon_pdev->phyrx_error_mask_cont = mask_cont;
  2046. return monitor_ops->mon_config_undecoded_metadata_capture(pdev, 1);
  2047. }
  2048. static inline QDF_STATUS
  2049. dp_monitor_get_undecoded_metadata_phyrx_error_mask(struct dp_pdev *pdev,
  2050. int *mask, int *mask_cont)
  2051. {
  2052. struct dp_mon_pdev *mon_pdev = pdev->monitor_pdev;
  2053. if (!mon_pdev)
  2054. return QDF_STATUS_E_FAILURE;
  2055. *mask = mon_pdev->phyrx_error_mask;
  2056. *mask_cont = mon_pdev->phyrx_error_mask_cont;
  2057. return QDF_STATUS_SUCCESS;
  2058. }
  2059. #else
  2060. static inline
  2061. QDF_STATUS dp_monitor_config_undecoded_metadata_capture(struct dp_pdev *pdev,
  2062. int val)
  2063. {
  2064. return QDF_STATUS_SUCCESS;
  2065. }
  2066. static inline QDF_STATUS
  2067. dp_monitor_config_undecoded_metadata_phyrx_error_mask(struct dp_pdev *pdev,
  2068. int mask1, int mask2)
  2069. {
  2070. return QDF_STATUS_SUCCESS;
  2071. }
  2072. static inline QDF_STATUS
  2073. dp_monitor_get_undecoded_metadata_phyrx_error_mask(struct dp_pdev *pdev,
  2074. int *mask, int *mask_cont)
  2075. {
  2076. return QDF_STATUS_SUCCESS;
  2077. }
  2078. #endif /* QCA_UNDECODED_METADATA_SUPPORT */
  2079. /**
  2080. * dp_monitor_htt_srng_setup() - Setup htt srng
  2081. * @soc: point to soc
  2082. * @pdev: point to pdev
  2083. * @mac_id: lmac id
  2084. * @mac_for_pdev: pdev id
  2085. *
  2086. * Return: QDF_STATUS
  2087. */
  2088. #if !defined(DISABLE_MON_CONFIG)
  2089. static inline QDF_STATUS dp_monitor_htt_srng_setup(struct dp_soc *soc,
  2090. struct dp_pdev *pdev,
  2091. int mac_id,
  2092. int mac_for_pdev)
  2093. {
  2094. struct dp_mon_ops *monitor_ops;
  2095. struct dp_mon_soc *mon_soc = soc->monitor_soc;
  2096. QDF_STATUS status = QDF_STATUS_SUCCESS;
  2097. if (!mon_soc) {
  2098. dp_mon_debug("monitor soc is NULL");
  2099. return QDF_STATUS_SUCCESS;
  2100. }
  2101. monitor_ops = mon_soc->mon_ops;
  2102. if (!monitor_ops) {
  2103. dp_mon_err("monitor_ops is NULL");
  2104. return QDF_STATUS_E_FAILURE;
  2105. }
  2106. if (monitor_ops->mon_pdev_htt_srng_setup[0]) {
  2107. status = monitor_ops->mon_pdev_htt_srng_setup[0](soc, pdev,
  2108. mac_id, mac_for_pdev);
  2109. if (QDF_IS_STATUS_ERROR(status)) {
  2110. dp_mon_err("error: %d", status);
  2111. goto error;
  2112. }
  2113. }
  2114. if (monitor_ops->mon_pdev_htt_srng_setup[1]) {
  2115. status = monitor_ops->mon_pdev_htt_srng_setup[1](soc, pdev,
  2116. mac_id, mac_for_pdev);
  2117. if (QDF_IS_STATUS_ERROR(status)) {
  2118. dp_mon_err("error: %d", status);
  2119. goto error;
  2120. }
  2121. }
  2122. error:
  2123. return status;
  2124. }
  2125. static inline QDF_STATUS dp_monitor_soc_htt_srng_setup(struct dp_soc *soc)
  2126. {
  2127. struct dp_mon_ops *monitor_ops;
  2128. struct dp_mon_soc *mon_soc = soc->monitor_soc;
  2129. if (!mon_soc) {
  2130. dp_mon_debug("monitor soc is NULL");
  2131. return QDF_STATUS_SUCCESS;
  2132. }
  2133. monitor_ops = mon_soc->mon_ops;
  2134. if (!monitor_ops || !monitor_ops->mon_soc_htt_srng_setup) {
  2135. dp_mon_debug("callback not registered");
  2136. return QDF_STATUS_E_FAILURE;
  2137. }
  2138. return monitor_ops->mon_soc_htt_srng_setup(soc);
  2139. }
  2140. #else
  2141. static inline QDF_STATUS dp_monitor_htt_srng_setup(struct dp_soc *soc,
  2142. struct dp_pdev *pdev,
  2143. int mac_id,
  2144. int mac_for_pdev)
  2145. {
  2146. return QDF_STATUS_SUCCESS;
  2147. }
  2148. #endif
  2149. /**
  2150. * dp_monitor_service_mon_rings() - service monitor rings
  2151. * @soc: point to soc
  2152. * @quota: reap budget
  2153. *
  2154. * Return: None
  2155. */
  2156. #if defined(DP_CON_MON)
  2157. static inline
  2158. void dp_monitor_service_mon_rings(struct dp_soc *soc, uint32_t quota)
  2159. {
  2160. struct dp_mon_ops *monitor_ops;
  2161. struct dp_mon_soc *mon_soc = soc->monitor_soc;
  2162. if (!mon_soc) {
  2163. dp_mon_debug("monitor soc is NULL");
  2164. return;
  2165. }
  2166. monitor_ops = mon_soc->mon_ops;
  2167. if (!monitor_ops || !monitor_ops->mon_service_rings) {
  2168. dp_mon_debug("callback not registered");
  2169. return;
  2170. }
  2171. return monitor_ops->mon_service_rings(soc, quota);
  2172. }
  2173. #endif
  2174. /**
  2175. * dp_monitor_process() - Process monitor
  2176. * @soc: point to soc
  2177. * @int_ctx: interrupt ctx
  2178. * @mac_id: lma
  2179. * @quota:
  2180. *
  2181. * Return: None
  2182. */
  2183. #ifndef DISABLE_MON_CONFIG
  2184. static inline
  2185. uint32_t dp_monitor_process(struct dp_soc *soc, struct dp_intr *int_ctx,
  2186. uint32_t mac_id, uint32_t quota)
  2187. {
  2188. struct dp_mon_soc *mon_soc = soc->monitor_soc;
  2189. if (!mon_soc) {
  2190. dp_mon_debug("monitor soc is NULL");
  2191. return 0;
  2192. }
  2193. if (!mon_soc->mon_rx_process) {
  2194. dp_mon_debug("callback not registered");
  2195. return 0;
  2196. }
  2197. return mon_soc->mon_rx_process(soc, int_ctx, mac_id, quota);
  2198. }
  2199. static inline
  2200. uint32_t dp_tx_mon_process(struct dp_soc *soc, struct dp_intr *int_ctx,
  2201. uint32_t mac_id, uint32_t quota)
  2202. {
  2203. struct dp_mon_soc *mon_soc = soc->monitor_soc;
  2204. struct dp_mon_ops *monitor_ops;
  2205. if (!mon_soc) {
  2206. dp_mon_debug("monitor soc is NULL");
  2207. return 0;
  2208. }
  2209. monitor_ops = mon_soc->mon_ops;
  2210. if (!monitor_ops || !monitor_ops->mon_tx_process) {
  2211. dp_mon_debug("callback not registered");
  2212. return 0;
  2213. }
  2214. return monitor_ops->mon_tx_process(soc, int_ctx, mac_id, quota);
  2215. }
  2216. static inline
  2217. uint32_t dp_tx_mon_buf_refill(struct dp_intr *int_ctx)
  2218. {
  2219. struct dp_soc *soc = int_ctx->soc;
  2220. struct dp_mon_ops *monitor_ops;
  2221. struct dp_mon_soc *mon_soc = soc->monitor_soc;
  2222. if (!mon_soc) {
  2223. dp_mon_debug("monitor soc is NULL");
  2224. return 0;
  2225. }
  2226. monitor_ops = mon_soc->mon_ops;
  2227. if (!monitor_ops || !monitor_ops->tx_mon_refill_buf_ring) {
  2228. dp_mon_debug("callback not registered");
  2229. return 0;
  2230. }
  2231. return monitor_ops->tx_mon_refill_buf_ring(int_ctx);
  2232. }
  2233. static inline
  2234. uint32_t dp_rx_mon_buf_refill(struct dp_intr *int_ctx)
  2235. {
  2236. struct dp_soc *soc = int_ctx->soc;
  2237. struct dp_mon_ops *monitor_ops;
  2238. struct dp_mon_soc *mon_soc = soc->monitor_soc;
  2239. if (!mon_soc) {
  2240. dp_mon_debug("monitor soc is NULL");
  2241. return 0;
  2242. }
  2243. monitor_ops = mon_soc->mon_ops;
  2244. if (!monitor_ops || !monitor_ops->rx_mon_refill_buf_ring) {
  2245. dp_mon_debug("callback not registered");
  2246. return 0;
  2247. }
  2248. return monitor_ops->rx_mon_refill_buf_ring(int_ctx);
  2249. }
  2250. static inline
  2251. void dp_print_txmon_ring_stat_from_hal(struct dp_pdev *pdev)
  2252. {
  2253. struct dp_soc *soc = pdev->soc;
  2254. struct dp_mon_soc *mon_soc = soc->monitor_soc;
  2255. struct dp_mon_ops *monitor_ops;
  2256. if (!mon_soc) {
  2257. dp_mon_debug("monitor soc is NULL");
  2258. return;
  2259. }
  2260. monitor_ops = mon_soc->mon_ops;
  2261. if (!monitor_ops || !monitor_ops->print_txmon_ring_stat) {
  2262. dp_mon_debug("callback not registered");
  2263. return;
  2264. }
  2265. monitor_ops->print_txmon_ring_stat(pdev);
  2266. }
  2267. #else
  2268. static inline
  2269. uint32_t dp_monitor_process(struct dp_soc *soc, struct dp_intr *int_ctx,
  2270. uint32_t mac_id, uint32_t quota)
  2271. {
  2272. return 0;
  2273. }
  2274. static inline uint32_t
  2275. dp_tx_mon_process(struct dp_soc *soc, struct dp_intr *int_ctx,
  2276. uint32_t mac_id, uint32_t quota)
  2277. {
  2278. return 0;
  2279. }
  2280. static inline
  2281. uint32_t dp_tx_mon_buf_refill(struct dp_intr *int_ctx)
  2282. {
  2283. return 0;
  2284. }
  2285. static inline
  2286. uint32_t dp_rx_mon_buf_refill(struct dp_intr *int_ctx)
  2287. {
  2288. return 0;
  2289. }
  2290. static inline
  2291. void dp_print_txmon_ring_stat_from_hal(struct dp_pdev *pdev)
  2292. {
  2293. }
  2294. #endif
  2295. /**
  2296. * dp_monitor_drop_packets_for_mac() - monitor_drop_packets_for_mac
  2297. * @pdev: point to pdev
  2298. * @mac_id:
  2299. * @quota:
  2300. *
  2301. * Return:
  2302. */
  2303. #if !defined(DISABLE_MON_CONFIG) && defined(MON_ENABLE_DROP_FOR_MAC)
  2304. static inline
  2305. uint32_t dp_monitor_drop_packets_for_mac(struct dp_pdev *pdev,
  2306. uint32_t mac_id, uint32_t quota)
  2307. {
  2308. struct dp_mon_ops *monitor_ops;
  2309. struct dp_mon_soc *mon_soc = pdev->soc->monitor_soc;
  2310. if (!mon_soc) {
  2311. dp_mon_debug("monitor soc is NULL");
  2312. return 0;
  2313. }
  2314. monitor_ops = mon_soc->mon_ops;
  2315. if (!monitor_ops || !monitor_ops->mon_drop_packets_for_mac) {
  2316. dp_mon_debug("callback not registered");
  2317. return 0;
  2318. }
  2319. return monitor_ops->mon_drop_packets_for_mac(pdev,
  2320. mac_id, quota, false);
  2321. }
  2322. #else
  2323. static inline
  2324. uint32_t dp_monitor_drop_packets_for_mac(struct dp_pdev *pdev,
  2325. uint32_t mac_id, uint32_t quota)
  2326. {
  2327. return 0;
  2328. }
  2329. #endif
  2330. /**
  2331. * dp_monitor_peer_tx_init() - peer tx init
  2332. * @pdev: point to pdev
  2333. * @peer: point to peer
  2334. *
  2335. * Return: None
  2336. */
  2337. static inline void dp_monitor_peer_tx_init(struct dp_pdev *pdev,
  2338. struct dp_peer *peer)
  2339. {
  2340. struct dp_mon_ops *monitor_ops;
  2341. struct dp_mon_soc *mon_soc = pdev->soc->monitor_soc;
  2342. if (!mon_soc) {
  2343. dp_mon_debug("monitor soc is NULL");
  2344. return;
  2345. }
  2346. monitor_ops = mon_soc->mon_ops;
  2347. if (!monitor_ops || !monitor_ops->mon_peer_tx_init) {
  2348. dp_mon_debug("callback not registered");
  2349. return;
  2350. }
  2351. return monitor_ops->mon_peer_tx_init(pdev, peer);
  2352. }
  2353. /**
  2354. * dp_monitor_peer_tx_cleanup() - peer tx cleanup
  2355. * @vdev: point to vdev
  2356. * @peer: point to peer
  2357. *
  2358. * Return: None
  2359. */
  2360. static inline void dp_monitor_peer_tx_cleanup(struct dp_vdev *vdev,
  2361. struct dp_peer *peer)
  2362. {
  2363. struct dp_mon_ops *monitor_ops;
  2364. struct dp_mon_soc *mon_soc = vdev->pdev->soc->monitor_soc;
  2365. if (!mon_soc) {
  2366. dp_mon_debug("monitor soc is NULL");
  2367. return;
  2368. }
  2369. monitor_ops = mon_soc->mon_ops;
  2370. if (!monitor_ops || !monitor_ops->mon_peer_tx_cleanup) {
  2371. dp_mon_debug("callback not registered");
  2372. return;
  2373. }
  2374. return monitor_ops->mon_peer_tx_cleanup(vdev, peer);
  2375. }
  2376. #ifdef WIFI_MONITOR_SUPPORT
  2377. /**
  2378. * dp_monitor_peer_tid_peer_id_update() - peer tid update
  2379. * @soc: point to soc
  2380. * @peer: point to peer
  2381. * @peer_id: peer id
  2382. *
  2383. * Return: None
  2384. */
  2385. static inline
  2386. void dp_monitor_peer_tid_peer_id_update(struct dp_soc *soc,
  2387. struct dp_peer *peer,
  2388. uint16_t peer_id)
  2389. {
  2390. struct dp_mon_ops *monitor_ops;
  2391. struct dp_mon_soc *mon_soc = soc->monitor_soc;
  2392. if (!mon_soc) {
  2393. dp_mon_debug("monitor soc is NULL");
  2394. return;
  2395. }
  2396. monitor_ops = mon_soc->mon_ops;
  2397. if (!monitor_ops || !monitor_ops->mon_peer_tid_peer_id_update) {
  2398. dp_mon_debug("callback not registered");
  2399. return;
  2400. }
  2401. return monitor_ops->mon_peer_tid_peer_id_update(peer, peer_id);
  2402. }
  2403. /**
  2404. * dp_monitor_tx_ppdu_stats_attach() - Attach tx ppdu stats
  2405. * @pdev: point to pdev
  2406. *
  2407. * Return: None
  2408. */
  2409. static inline void dp_monitor_tx_ppdu_stats_attach(struct dp_pdev *pdev)
  2410. {
  2411. struct dp_mon_ops *monitor_ops;
  2412. struct dp_mon_soc *mon_soc = pdev->soc->monitor_soc;
  2413. if (!mon_soc) {
  2414. dp_mon_debug("monitor soc is NULL");
  2415. return;
  2416. }
  2417. monitor_ops = mon_soc->mon_ops;
  2418. if (!monitor_ops || !monitor_ops->mon_tx_ppdu_stats_attach) {
  2419. dp_mon_debug("callback not registered");
  2420. return;
  2421. }
  2422. return monitor_ops->mon_tx_ppdu_stats_attach(pdev);
  2423. }
  2424. /**
  2425. * dp_monitor_tx_ppdu_stats_detach() - Detach tx ppdu stats
  2426. * @pdev: point to pdev
  2427. *
  2428. * Return: None
  2429. */
  2430. static inline void dp_monitor_tx_ppdu_stats_detach(struct dp_pdev *pdev)
  2431. {
  2432. struct dp_mon_ops *monitor_ops;
  2433. struct dp_mon_soc *mon_soc = pdev->soc->monitor_soc;
  2434. if (!mon_soc) {
  2435. dp_mon_debug("monitor soc is NULL");
  2436. return;
  2437. }
  2438. monitor_ops = mon_soc->mon_ops;
  2439. if (!monitor_ops || !monitor_ops->mon_tx_ppdu_stats_detach) {
  2440. dp_mon_debug("callback not registered");
  2441. return;
  2442. }
  2443. return monitor_ops->mon_tx_ppdu_stats_detach(pdev);
  2444. }
  2445. /**
  2446. * dp_monitor_tx_capture_debugfs_init() - Init tx capture debugfs
  2447. * @pdev: point to pdev
  2448. *
  2449. * Return: QDF_STATUS_SUCCESS
  2450. */
  2451. static inline
  2452. QDF_STATUS dp_monitor_tx_capture_debugfs_init(struct dp_pdev *pdev)
  2453. {
  2454. struct dp_mon_ops *monitor_ops;
  2455. struct dp_mon_soc *mon_soc = pdev->soc->monitor_soc;
  2456. if (!mon_soc) {
  2457. dp_mon_debug("monitor soc is NULL");
  2458. return QDF_STATUS_E_FAILURE;
  2459. }
  2460. monitor_ops = mon_soc->mon_ops;
  2461. if (!monitor_ops || !monitor_ops->mon_tx_capture_debugfs_init) {
  2462. dp_mon_debug("callback not registered");
  2463. return QDF_STATUS_E_FAILURE;
  2464. }
  2465. return monitor_ops->mon_tx_capture_debugfs_init(pdev);
  2466. }
  2467. /**
  2468. * dp_monitor_peer_tx_capture_filter_check() - Check tx capture filter
  2469. * @pdev: point to pdev
  2470. * @peer: point to peer
  2471. *
  2472. * Return: None
  2473. */
  2474. static inline void dp_monitor_peer_tx_capture_filter_check(struct dp_pdev *pdev,
  2475. struct dp_peer *peer)
  2476. {
  2477. struct dp_mon_ops *monitor_ops;
  2478. struct dp_mon_soc *mon_soc = pdev->soc->monitor_soc;
  2479. if (!mon_soc) {
  2480. dp_mon_debug("monitor soc is NULL");
  2481. return;
  2482. }
  2483. monitor_ops = mon_soc->mon_ops;
  2484. if (!monitor_ops || !monitor_ops->mon_peer_tx_capture_filter_check) {
  2485. dp_mon_debug("callback not registered");
  2486. return;
  2487. }
  2488. return monitor_ops->mon_peer_tx_capture_filter_check(pdev, peer);
  2489. }
  2490. /**
  2491. * dp_monitor_tx_add_to_comp_queue() - add completion msdu to queue
  2492. *
  2493. * This API returns QDF_STATUS_SUCCESS in case where buffer is added
  2494. * to txmonitor queue successfully caller will not free the buffer in
  2495. * this case. In other cases this API return QDF_STATUS_E_FAILURE and
  2496. * caller frees the buffer
  2497. *
  2498. * @soc: point to soc
  2499. * @desc: point to tx desc
  2500. * @ts: Tx completion status from HAL/HTT descriptor
  2501. * @peer_id: DP peer id
  2502. *
  2503. * Return: QDF_STATUS
  2504. *
  2505. */
  2506. static inline
  2507. QDF_STATUS dp_monitor_tx_add_to_comp_queue(struct dp_soc *soc,
  2508. struct dp_tx_desc_s *desc,
  2509. struct hal_tx_completion_status *ts,
  2510. uint16_t peer_id)
  2511. {
  2512. struct dp_mon_ops *monitor_ops;
  2513. struct dp_mon_soc *mon_soc = soc->monitor_soc;
  2514. if (!mon_soc) {
  2515. dp_mon_debug("monitor soc is NULL");
  2516. return QDF_STATUS_E_FAILURE;
  2517. }
  2518. monitor_ops = mon_soc->mon_ops;
  2519. if (!monitor_ops || !monitor_ops->mon_tx_add_to_comp_queue) {
  2520. dp_mon_debug("callback not registered");
  2521. return QDF_STATUS_E_FAILURE;
  2522. }
  2523. return monitor_ops->mon_tx_add_to_comp_queue(soc, desc, ts, peer_id);
  2524. }
  2525. static inline
  2526. QDF_STATUS monitor_update_msdu_to_list(struct dp_soc *soc,
  2527. struct dp_pdev *pdev,
  2528. struct dp_peer *peer,
  2529. struct hal_tx_completion_status *ts,
  2530. qdf_nbuf_t netbuf)
  2531. {
  2532. struct dp_mon_ops *monitor_ops;
  2533. struct dp_mon_soc *mon_soc = soc->monitor_soc;
  2534. if (!mon_soc) {
  2535. dp_mon_debug("monitor soc is NULL");
  2536. return QDF_STATUS_SUCCESS;
  2537. }
  2538. monitor_ops = mon_soc->mon_ops;
  2539. if (!monitor_ops || !monitor_ops->mon_update_msdu_to_list) {
  2540. dp_mon_debug("callback not registered");
  2541. return QDF_STATUS_E_FAILURE;
  2542. }
  2543. return monitor_ops->mon_update_msdu_to_list(soc, pdev,
  2544. peer, ts, netbuf);
  2545. }
  2546. /**
  2547. * dp_monitor_peer_tx_capture_get_stats - to get Peer Tx Capture stats
  2548. * @soc: DP SOC handle
  2549. * @peer: DP PEER handle
  2550. * @stats: Pointer Peer tx capture stats
  2551. *
  2552. * Return: QDF_STATUS_E_FAILURE or QDF_STATUS_SUCCESS
  2553. */
  2554. static inline QDF_STATUS
  2555. dp_monitor_peer_tx_capture_get_stats(struct dp_soc *soc, struct dp_peer *peer,
  2556. struct cdp_peer_tx_capture_stats *stats)
  2557. {
  2558. struct dp_mon_ops *monitor_ops;
  2559. struct dp_mon_soc *mon_soc = soc->monitor_soc;
  2560. if (!mon_soc) {
  2561. dp_mon_debug("monitor soc is NULL");
  2562. return QDF_STATUS_E_FAILURE;
  2563. }
  2564. monitor_ops = mon_soc->mon_ops;
  2565. if (!monitor_ops || !monitor_ops->mon_peer_tx_capture_get_stats) {
  2566. dp_mon_debug("callback not registered");
  2567. return QDF_STATUS_E_FAILURE;
  2568. }
  2569. return monitor_ops->mon_peer_tx_capture_get_stats(peer, stats);
  2570. }
  2571. /**
  2572. * dp_monitor_pdev_tx_capture_get_stats - to get pdev tx capture stats
  2573. * @soc: DP SOC handle
  2574. * @pdev: DP PDEV handle
  2575. * @stats: Pointer to pdev tx capture stats
  2576. *
  2577. * Return: QDF_STATUS_E_FAILURE or QDF_STATUS_SUCCESS
  2578. */
  2579. static inline QDF_STATUS
  2580. dp_monitor_pdev_tx_capture_get_stats(struct dp_soc *soc, struct dp_pdev *pdev,
  2581. struct cdp_pdev_tx_capture_stats *stats)
  2582. {
  2583. struct dp_mon_ops *monitor_ops;
  2584. struct dp_mon_soc *mon_soc = soc->monitor_soc;
  2585. if (!mon_soc) {
  2586. dp_mon_debug("monitor soc is NULL");
  2587. return QDF_STATUS_E_FAILURE;
  2588. }
  2589. monitor_ops = mon_soc->mon_ops;
  2590. if (!monitor_ops || !monitor_ops->mon_pdev_tx_capture_get_stats) {
  2591. dp_mon_debug("callback not registered");
  2592. return QDF_STATUS_E_FAILURE;
  2593. }
  2594. return monitor_ops->mon_pdev_tx_capture_get_stats(pdev, stats);
  2595. }
  2596. #else
  2597. static inline
  2598. void dp_monitor_peer_tid_peer_id_update(struct dp_soc *soc,
  2599. struct dp_peer *peer,
  2600. uint16_t peer_id)
  2601. {
  2602. }
  2603. static inline void dp_monitor_tx_ppdu_stats_attach(struct dp_pdev *pdev)
  2604. {
  2605. }
  2606. static inline void dp_monitor_tx_ppdu_stats_detach(struct dp_pdev *pdev)
  2607. {
  2608. }
  2609. static inline
  2610. QDF_STATUS dp_monitor_tx_capture_debugfs_init(struct dp_pdev *pdev)
  2611. {
  2612. return QDF_STATUS_E_FAILURE;
  2613. }
  2614. static inline void dp_monitor_peer_tx_capture_filter_check(struct dp_pdev *pdev,
  2615. struct dp_peer *peer)
  2616. {
  2617. }
  2618. static inline
  2619. QDF_STATUS dp_monitor_tx_add_to_comp_queue(struct dp_soc *soc,
  2620. struct dp_tx_desc_s *desc,
  2621. struct hal_tx_completion_status *ts,
  2622. uint16_t peer_id)
  2623. {
  2624. return QDF_STATUS_E_FAILURE;
  2625. }
  2626. static inline
  2627. QDF_STATUS monitor_update_msdu_to_list(struct dp_soc *soc,
  2628. struct dp_pdev *pdev,
  2629. struct dp_peer *peer,
  2630. struct hal_tx_completion_status *ts,
  2631. qdf_nbuf_t netbuf)
  2632. {
  2633. return QDF_STATUS_E_FAILURE;
  2634. }
  2635. static inline QDF_STATUS
  2636. dp_monitor_peer_tx_capture_get_stats(struct dp_soc *soc, struct dp_peer *peer,
  2637. struct cdp_peer_tx_capture_stats *stats)
  2638. {
  2639. return QDF_STATUS_E_FAILURE;
  2640. }
  2641. static inline QDF_STATUS
  2642. dp_monitor_pdev_tx_capture_get_stats(struct dp_soc *soc, struct dp_pdev *pdev,
  2643. struct cdp_pdev_tx_capture_stats *stats)
  2644. {
  2645. return QDF_STATUS_E_FAILURE;
  2646. }
  2647. #endif
  2648. /**
  2649. * dp_monitor_ppdu_stats_ind_handler() - PPDU stats msg handler
  2650. * @soc: HTT SOC handle
  2651. * @msg_word: Pointer to payload
  2652. * @htt_t2h_msg: HTT msg nbuf
  2653. *
  2654. * Return: True if buffer should be freed by caller.
  2655. */
  2656. #if defined(WDI_EVENT_ENABLE) &&\
  2657. (defined(QCA_ENHANCED_STATS_SUPPORT) || !defined(REMOVE_PKT_LOG))
  2658. static inline bool dp_monitor_ppdu_stats_ind_handler(struct htt_soc *soc,
  2659. uint32_t *msg_word,
  2660. qdf_nbuf_t htt_t2h_msg)
  2661. {
  2662. struct dp_mon_ops *monitor_ops;
  2663. struct dp_mon_soc *mon_soc = soc->dp_soc->monitor_soc;
  2664. if (!mon_soc) {
  2665. dp_mon_debug("monitor soc is NULL");
  2666. return true;
  2667. }
  2668. monitor_ops = mon_soc->mon_ops;
  2669. if (!monitor_ops || !monitor_ops->mon_ppdu_stats_ind_handler) {
  2670. dp_mon_debug("callback not registered");
  2671. return true;
  2672. }
  2673. return monitor_ops->mon_ppdu_stats_ind_handler(soc, msg_word,
  2674. htt_t2h_msg);
  2675. }
  2676. #else
  2677. static inline bool dp_monitor_ppdu_stats_ind_handler(struct htt_soc *soc,
  2678. uint32_t *msg_word,
  2679. qdf_nbuf_t htt_t2h_msg)
  2680. {
  2681. return true;
  2682. }
  2683. #endif
  2684. /**
  2685. * dp_monitor_htt_ppdu_stats_attach() - attach resources for HTT PPDU
  2686. * stats processing
  2687. * @pdev: Datapath PDEV handle
  2688. *
  2689. * Return: QDF_STATUS
  2690. */
  2691. static inline QDF_STATUS dp_monitor_htt_ppdu_stats_attach(struct dp_pdev *pdev)
  2692. {
  2693. struct dp_mon_ops *monitor_ops;
  2694. struct dp_mon_soc *mon_soc = pdev->soc->monitor_soc;
  2695. if (!mon_soc) {
  2696. dp_mon_debug("monitor soc is NULL");
  2697. return QDF_STATUS_SUCCESS;
  2698. }
  2699. monitor_ops = mon_soc->mon_ops;
  2700. if (!monitor_ops || !monitor_ops->mon_htt_ppdu_stats_attach) {
  2701. dp_mon_debug("callback not registered");
  2702. return QDF_STATUS_E_FAILURE;
  2703. }
  2704. return monitor_ops->mon_htt_ppdu_stats_attach(pdev);
  2705. }
  2706. /**
  2707. * dp_monitor_htt_ppdu_stats_detach() - detach stats resources
  2708. * @pdev: Datapath PDEV handle
  2709. *
  2710. * Return: void
  2711. */
  2712. static inline void dp_monitor_htt_ppdu_stats_detach(struct dp_pdev *pdev)
  2713. {
  2714. struct dp_mon_ops *monitor_ops;
  2715. struct dp_mon_soc *mon_soc = pdev->soc->monitor_soc;
  2716. if (!mon_soc) {
  2717. dp_mon_debug("monitor soc is NULL");
  2718. return;
  2719. }
  2720. monitor_ops = mon_soc->mon_ops;
  2721. if (!monitor_ops || !monitor_ops->mon_htt_ppdu_stats_detach) {
  2722. dp_mon_debug("callback not registered");
  2723. return;
  2724. }
  2725. return monitor_ops->mon_htt_ppdu_stats_detach(pdev);
  2726. }
  2727. /**
  2728. * dp_monitor_print_pdev_rx_mon_stats() - print rx mon stats
  2729. * @pdev: Datapath PDEV handle
  2730. *
  2731. * Return: void
  2732. */
  2733. static inline void dp_monitor_print_pdev_rx_mon_stats(struct dp_pdev *pdev)
  2734. {
  2735. struct dp_mon_ops *monitor_ops;
  2736. struct dp_mon_soc *mon_soc = pdev->soc->monitor_soc;
  2737. if (!mon_soc) {
  2738. dp_mon_debug("monitor soc is NULL");
  2739. return;
  2740. }
  2741. monitor_ops = mon_soc->mon_ops;
  2742. if (!monitor_ops || !monitor_ops->mon_print_pdev_rx_mon_stats) {
  2743. dp_mon_debug("callback not registered");
  2744. return;
  2745. }
  2746. return monitor_ops->mon_print_pdev_rx_mon_stats(pdev);
  2747. }
  2748. #ifdef WIFI_MONITOR_SUPPORT
  2749. /**
  2750. * dp_monitor_print_pdev_tx_capture_stats() - print tx capture stats
  2751. * @pdev: Datapath PDEV handle
  2752. *
  2753. * Return: void
  2754. */
  2755. static inline void dp_monitor_print_pdev_tx_capture_stats(struct dp_pdev *pdev)
  2756. {
  2757. struct dp_mon_ops *monitor_ops;
  2758. struct dp_mon_soc *mon_soc = pdev->soc->monitor_soc;
  2759. if (!mon_soc) {
  2760. dp_mon_debug("monitor soc is NULL");
  2761. return;
  2762. }
  2763. monitor_ops = mon_soc->mon_ops;
  2764. if (!monitor_ops || !monitor_ops->mon_print_pdev_tx_capture_stats) {
  2765. dp_mon_debug("callback not registered");
  2766. return;
  2767. }
  2768. return monitor_ops->mon_print_pdev_tx_capture_stats(pdev);
  2769. }
  2770. /**
  2771. * dp_monitor_config_enh_tx_capture() - configure tx capture
  2772. * @pdev: Datapath PDEV handle
  2773. * @val: mode
  2774. *
  2775. * Return: status
  2776. */
  2777. static inline QDF_STATUS dp_monitor_config_enh_tx_capture(struct dp_pdev *pdev,
  2778. uint32_t val)
  2779. {
  2780. struct dp_mon_ops *monitor_ops;
  2781. struct dp_mon_soc *mon_soc = pdev->soc->monitor_soc;
  2782. if (!mon_soc) {
  2783. dp_mon_debug("monitor soc is NULL");
  2784. return QDF_STATUS_E_FAILURE;
  2785. }
  2786. monitor_ops = mon_soc->mon_ops;
  2787. if (!monitor_ops || !monitor_ops->mon_config_enh_tx_capture) {
  2788. dp_mon_debug("callback not registered");
  2789. return QDF_STATUS_E_FAILURE;
  2790. }
  2791. return monitor_ops->mon_config_enh_tx_capture(pdev, val);
  2792. }
  2793. /**
  2794. * dp_monitor_tx_peer_filter() - add tx monitor peer filter
  2795. * @pdev: Datapath PDEV handle
  2796. * @peer: Datapath PEER handle
  2797. * @is_tx_pkt_cap_enable: flag for tx capture enable/disable
  2798. * @peer_mac: peer mac address
  2799. *
  2800. * Return: status
  2801. */
  2802. static inline QDF_STATUS dp_monitor_tx_peer_filter(struct dp_pdev *pdev,
  2803. struct dp_peer *peer,
  2804. uint8_t is_tx_pkt_cap_enable,
  2805. uint8_t *peer_mac)
  2806. {
  2807. struct dp_mon_ops *monitor_ops;
  2808. struct dp_mon_soc *mon_soc = pdev->soc->monitor_soc;
  2809. if (!mon_soc) {
  2810. qdf_err("monitor soc is NULL");
  2811. return QDF_STATUS_E_FAILURE;
  2812. }
  2813. monitor_ops = mon_soc->mon_ops;
  2814. if (!monitor_ops || !monitor_ops->mon_tx_peer_filter) {
  2815. qdf_err("callback not registered");
  2816. return QDF_STATUS_E_FAILURE;
  2817. }
  2818. return monitor_ops->mon_tx_peer_filter(pdev, peer, is_tx_pkt_cap_enable,
  2819. peer_mac);
  2820. }
  2821. #endif
  2822. #ifdef WLAN_RX_PKT_CAPTURE_ENH
  2823. static inline QDF_STATUS dp_monitor_config_enh_rx_capture(struct dp_pdev *pdev,
  2824. uint32_t val)
  2825. {
  2826. struct dp_mon_ops *monitor_ops;
  2827. struct dp_mon_soc *mon_soc = pdev->soc->monitor_soc;
  2828. if (!mon_soc) {
  2829. dp_mon_debug("monitor soc is NULL");
  2830. return QDF_STATUS_E_FAILURE;
  2831. }
  2832. monitor_ops = mon_soc->mon_ops;
  2833. if (!monitor_ops || !monitor_ops->mon_config_enh_rx_capture) {
  2834. dp_mon_debug("callback not registered");
  2835. return QDF_STATUS_E_FAILURE;
  2836. }
  2837. return monitor_ops->mon_config_enh_rx_capture(pdev, val);
  2838. }
  2839. #else
  2840. static inline QDF_STATUS dp_monitor_config_enh_rx_capture(struct dp_pdev *pdev,
  2841. uint32_t val)
  2842. {
  2843. return QDF_STATUS_E_INVAL;
  2844. }
  2845. #endif
  2846. #ifdef QCA_SUPPORT_BPR
  2847. static inline QDF_STATUS dp_monitor_set_bpr_enable(struct dp_pdev *pdev,
  2848. uint32_t val)
  2849. {
  2850. struct dp_mon_ops *monitor_ops;
  2851. struct dp_mon_soc *mon_soc = pdev->soc->monitor_soc;
  2852. if (!mon_soc) {
  2853. dp_mon_debug("monitor soc is NULL");
  2854. return QDF_STATUS_E_FAILURE;
  2855. }
  2856. monitor_ops = mon_soc->mon_ops;
  2857. if (!monitor_ops || !monitor_ops->mon_set_bpr_enable) {
  2858. dp_mon_debug("callback not registered");
  2859. return QDF_STATUS_E_FAILURE;
  2860. }
  2861. return monitor_ops->mon_set_bpr_enable(pdev, val);
  2862. }
  2863. #else
  2864. static inline QDF_STATUS dp_monitor_set_bpr_enable(struct dp_pdev *pdev,
  2865. uint32_t val)
  2866. {
  2867. return QDF_STATUS_E_FAILURE;
  2868. }
  2869. #endif
  2870. #ifdef ATH_SUPPORT_NAC
  2871. static inline
  2872. int dp_monitor_set_filter_neigh_peers(struct dp_pdev *pdev, bool val)
  2873. {
  2874. struct dp_mon_ops *monitor_ops;
  2875. struct dp_mon_soc *mon_soc = pdev->soc->monitor_soc;
  2876. if (!mon_soc) {
  2877. dp_mon_debug("monitor soc is NULL");
  2878. return 0;
  2879. }
  2880. monitor_ops = mon_soc->mon_ops;
  2881. if (!monitor_ops || !monitor_ops->mon_set_filter_neigh_peers) {
  2882. dp_mon_debug("callback not registered");
  2883. return 0;
  2884. }
  2885. return monitor_ops->mon_set_filter_neigh_peers(pdev, val);
  2886. }
  2887. #else
  2888. static inline
  2889. int dp_monitor_set_filter_neigh_peers(struct dp_pdev *pdev, bool val)
  2890. {
  2891. return 0;
  2892. }
  2893. #endif
  2894. #ifdef WLAN_ATF_ENABLE
  2895. static inline
  2896. void dp_monitor_set_atf_stats_enable(struct dp_pdev *pdev, bool value)
  2897. {
  2898. struct dp_mon_ops *monitor_ops;
  2899. struct dp_mon_soc *mon_soc = pdev->soc->monitor_soc;
  2900. if (!mon_soc) {
  2901. dp_mon_debug("monitor soc is NULL");
  2902. return;
  2903. }
  2904. monitor_ops = mon_soc->mon_ops;
  2905. if (!monitor_ops || !monitor_ops->mon_set_atf_stats_enable) {
  2906. dp_mon_debug("callback not registered");
  2907. return;
  2908. }
  2909. return monitor_ops->mon_set_atf_stats_enable(pdev, value);
  2910. }
  2911. #else
  2912. static inline
  2913. void dp_monitor_set_atf_stats_enable(struct dp_pdev *pdev, bool value)
  2914. {
  2915. }
  2916. #endif
  2917. static inline
  2918. void dp_monitor_set_bsscolor(struct dp_pdev *pdev, uint8_t bsscolor)
  2919. {
  2920. struct dp_mon_ops *monitor_ops;
  2921. struct dp_mon_soc *mon_soc = pdev->soc->monitor_soc;
  2922. if (!mon_soc) {
  2923. dp_mon_debug("monitor soc is NULL");
  2924. return;
  2925. }
  2926. monitor_ops = mon_soc->mon_ops;
  2927. if (!monitor_ops || !monitor_ops->mon_set_bsscolor) {
  2928. dp_mon_debug("callback not registered");
  2929. return;
  2930. }
  2931. return monitor_ops->mon_set_bsscolor(pdev, bsscolor);
  2932. }
  2933. static inline
  2934. bool dp_monitor_pdev_get_filter_mcast_data(struct cdp_pdev *pdev_handle)
  2935. {
  2936. struct dp_mon_ops *monitor_ops;
  2937. struct dp_pdev *pdev = (struct dp_pdev *)pdev_handle;
  2938. struct dp_mon_soc *mon_soc = pdev->soc->monitor_soc;
  2939. if (!mon_soc) {
  2940. dp_mon_debug("monitor soc is NULL");
  2941. return false;
  2942. }
  2943. monitor_ops = mon_soc->mon_ops;
  2944. if (!monitor_ops || !monitor_ops->mon_pdev_get_filter_mcast_data) {
  2945. dp_mon_debug("callback not registered");
  2946. return false;
  2947. }
  2948. return monitor_ops->mon_pdev_get_filter_mcast_data(pdev_handle);
  2949. }
  2950. static inline
  2951. bool dp_monitor_pdev_get_filter_non_data(struct cdp_pdev *pdev_handle)
  2952. {
  2953. struct dp_mon_ops *monitor_ops;
  2954. struct dp_pdev *pdev = (struct dp_pdev *)pdev_handle;
  2955. struct dp_mon_soc *mon_soc = pdev->soc->monitor_soc;
  2956. if (!mon_soc) {
  2957. dp_mon_debug("monitor soc is NULL");
  2958. return false;
  2959. }
  2960. monitor_ops = mon_soc->mon_ops;
  2961. if (!monitor_ops || !monitor_ops->mon_pdev_get_filter_non_data) {
  2962. dp_mon_debug("callback not registered");
  2963. return false;
  2964. }
  2965. return monitor_ops->mon_pdev_get_filter_non_data(pdev_handle);
  2966. }
  2967. static inline
  2968. bool dp_monitor_pdev_get_filter_ucast_data(struct cdp_pdev *pdev_handle)
  2969. {
  2970. struct dp_mon_ops *monitor_ops;
  2971. struct dp_pdev *pdev = (struct dp_pdev *)pdev_handle;
  2972. struct dp_mon_soc *mon_soc = pdev->soc->monitor_soc;
  2973. if (!mon_soc) {
  2974. dp_mon_debug("monitor soc is NULL");
  2975. return false;
  2976. }
  2977. monitor_ops = mon_soc->mon_ops;
  2978. if (!monitor_ops || !monitor_ops->mon_pdev_get_filter_ucast_data) {
  2979. dp_mon_debug("callback not registered");
  2980. return false;
  2981. }
  2982. return monitor_ops->mon_pdev_get_filter_ucast_data(pdev_handle);
  2983. }
  2984. #ifdef WDI_EVENT_ENABLE
  2985. static inline
  2986. int dp_monitor_set_pktlog_wifi3(struct dp_pdev *pdev, uint32_t event,
  2987. bool enable)
  2988. {
  2989. struct dp_mon_ops *monitor_ops;
  2990. struct dp_mon_soc *mon_soc = pdev->soc->monitor_soc;
  2991. if (!mon_soc) {
  2992. dp_mon_debug("monitor soc is NULL");
  2993. return 0;
  2994. }
  2995. monitor_ops = mon_soc->mon_ops;
  2996. if (!monitor_ops || !monitor_ops->mon_set_pktlog_wifi3) {
  2997. dp_mon_debug("callback not registered");
  2998. return 0;
  2999. }
  3000. return monitor_ops->mon_set_pktlog_wifi3(pdev, event, enable);
  3001. }
  3002. #else
  3003. static inline
  3004. int dp_monitor_set_pktlog_wifi3(struct dp_pdev *pdev, uint32_t event,
  3005. bool enable)
  3006. {
  3007. return 0;
  3008. }
  3009. #endif
  3010. #if defined(DP_CON_MON) && !defined(REMOVE_PKT_LOG)
  3011. static inline void dp_monitor_pktlogmod_exit(struct dp_pdev *pdev)
  3012. {
  3013. struct dp_mon_ops *monitor_ops;
  3014. struct dp_mon_soc *mon_soc = pdev->soc->monitor_soc;
  3015. if (!mon_soc) {
  3016. dp_mon_debug("monitor soc is NULL");
  3017. return;
  3018. }
  3019. monitor_ops = mon_soc->mon_ops;
  3020. if (!monitor_ops || !monitor_ops->mon_pktlogmod_exit) {
  3021. dp_mon_debug("callback not registered");
  3022. return;
  3023. }
  3024. return monitor_ops->mon_pktlogmod_exit(pdev);
  3025. }
  3026. #else
  3027. static inline void dp_monitor_pktlogmod_exit(struct dp_pdev *pdev) {}
  3028. #endif
  3029. static inline
  3030. QDF_STATUS dp_monitor_vdev_set_monitor_mode_buf_rings(struct dp_pdev *pdev)
  3031. {
  3032. struct dp_mon_ops *monitor_ops;
  3033. struct dp_mon_soc *mon_soc = pdev->soc->monitor_soc;
  3034. if (!mon_soc) {
  3035. dp_mon_debug("monitor soc is NULL");
  3036. return QDF_STATUS_E_FAILURE;
  3037. }
  3038. monitor_ops = mon_soc->mon_ops;
  3039. if (!monitor_ops || !monitor_ops->mon_vdev_set_monitor_mode_buf_rings) {
  3040. dp_mon_debug("callback not registered");
  3041. return QDF_STATUS_E_FAILURE;
  3042. }
  3043. return monitor_ops->mon_vdev_set_monitor_mode_buf_rings(pdev);
  3044. }
  3045. static inline
  3046. void dp_monitor_neighbour_peers_detach(struct dp_pdev *pdev)
  3047. {
  3048. struct dp_mon_ops *monitor_ops;
  3049. struct dp_mon_soc *mon_soc = pdev->soc->monitor_soc;
  3050. if (!mon_soc) {
  3051. dp_mon_debug("monitor soc is NULL");
  3052. return;
  3053. }
  3054. monitor_ops = mon_soc->mon_ops;
  3055. if (!monitor_ops || !monitor_ops->mon_neighbour_peers_detach) {
  3056. dp_mon_debug("callback not registered");
  3057. return;
  3058. }
  3059. return monitor_ops->mon_neighbour_peers_detach(pdev);
  3060. }
  3061. #ifdef FEATURE_NAC_RSSI
  3062. static inline QDF_STATUS dp_monitor_filter_neighbour_peer(struct dp_pdev *pdev,
  3063. uint8_t *rx_pkt_hdr)
  3064. {
  3065. struct dp_mon_ops *monitor_ops;
  3066. struct dp_mon_soc *mon_soc = pdev->soc->monitor_soc;
  3067. if (!mon_soc) {
  3068. dp_mon_debug("monitor soc is NULL");
  3069. return QDF_STATUS_E_FAILURE;
  3070. }
  3071. monitor_ops = mon_soc->mon_ops;
  3072. if (!monitor_ops || !monitor_ops->mon_filter_neighbour_peer) {
  3073. dp_mon_debug("callback not registered");
  3074. return QDF_STATUS_E_FAILURE;
  3075. }
  3076. return monitor_ops->mon_filter_neighbour_peer(pdev, rx_pkt_hdr);
  3077. }
  3078. #else
  3079. static inline QDF_STATUS dp_monitor_filter_neighbour_peer(struct dp_pdev *pdev,
  3080. uint8_t *rx_pkt_hdr)
  3081. {
  3082. return QDF_STATUS_E_FAILURE;
  3083. }
  3084. #endif
  3085. static inline
  3086. void dp_monitor_reap_timer_init(struct dp_soc *soc)
  3087. {
  3088. struct dp_mon_ops *monitor_ops;
  3089. struct dp_mon_soc *mon_soc = soc->monitor_soc;
  3090. if (!mon_soc) {
  3091. dp_mon_debug("monitor soc is NULL");
  3092. return;
  3093. }
  3094. monitor_ops = mon_soc->mon_ops;
  3095. if (!monitor_ops || !monitor_ops->mon_reap_timer_init) {
  3096. dp_mon_debug("callback not registered");
  3097. return;
  3098. }
  3099. monitor_ops->mon_reap_timer_init(soc);
  3100. }
  3101. static inline
  3102. void dp_monitor_reap_timer_deinit(struct dp_soc *soc)
  3103. {
  3104. struct dp_mon_ops *monitor_ops;
  3105. struct dp_mon_soc *mon_soc = soc->monitor_soc;
  3106. if (!mon_soc) {
  3107. dp_mon_debug("monitor soc is NULL");
  3108. return;
  3109. }
  3110. monitor_ops = mon_soc->mon_ops;
  3111. if (!monitor_ops || !monitor_ops->mon_reap_timer_deinit) {
  3112. dp_mon_debug("callback not registered");
  3113. return;
  3114. }
  3115. monitor_ops->mon_reap_timer_deinit(soc);
  3116. }
  3117. /**
  3118. * dp_monitor_reap_timer_start() - start reap timer of monitor status ring
  3119. * @soc: point to soc
  3120. * @source: trigger source
  3121. *
  3122. * Return: true if timer-start is performed, false otherwise.
  3123. */
  3124. static inline bool
  3125. dp_monitor_reap_timer_start(struct dp_soc *soc,
  3126. enum cdp_mon_reap_source source)
  3127. {
  3128. struct dp_mon_ops *monitor_ops;
  3129. struct dp_mon_soc *mon_soc = soc->monitor_soc;
  3130. if (!mon_soc) {
  3131. dp_mon_debug("monitor soc is NULL");
  3132. return false;
  3133. }
  3134. monitor_ops = mon_soc->mon_ops;
  3135. if (!monitor_ops || !monitor_ops->mon_reap_timer_start) {
  3136. dp_mon_debug("callback not registered");
  3137. return false;
  3138. }
  3139. return monitor_ops->mon_reap_timer_start(soc, source);
  3140. }
  3141. /**
  3142. * dp_monitor_reap_timer_stop() - stop reap timer of monitor status ring
  3143. * @soc: point to soc
  3144. * @source: trigger source
  3145. *
  3146. * Return: true if timer-stop is performed, false otherwise.
  3147. */
  3148. static inline bool
  3149. dp_monitor_reap_timer_stop(struct dp_soc *soc,
  3150. enum cdp_mon_reap_source source)
  3151. {
  3152. struct dp_mon_ops *monitor_ops;
  3153. struct dp_mon_soc *mon_soc = soc->monitor_soc;
  3154. if (!mon_soc) {
  3155. dp_mon_debug("monitor soc is NULL");
  3156. return false;
  3157. }
  3158. monitor_ops = mon_soc->mon_ops;
  3159. if (!monitor_ops || !monitor_ops->mon_reap_timer_stop) {
  3160. dp_mon_debug("callback not registered");
  3161. return false;
  3162. }
  3163. return monitor_ops->mon_reap_timer_stop(soc, source);
  3164. }
  3165. static inline
  3166. void dp_monitor_vdev_timer_init(struct dp_soc *soc)
  3167. {
  3168. struct dp_mon_ops *monitor_ops;
  3169. struct dp_mon_soc *mon_soc = soc->monitor_soc;
  3170. if (!mon_soc) {
  3171. dp_mon_debug("monitor soc is NULL");
  3172. return;
  3173. }
  3174. monitor_ops = mon_soc->mon_ops;
  3175. if (!monitor_ops || !monitor_ops->mon_vdev_timer_init) {
  3176. dp_mon_debug("callback not registered");
  3177. return;
  3178. }
  3179. monitor_ops->mon_vdev_timer_init(soc);
  3180. }
  3181. static inline
  3182. void dp_monitor_vdev_timer_deinit(struct dp_soc *soc)
  3183. {
  3184. struct dp_mon_ops *monitor_ops;
  3185. struct dp_mon_soc *mon_soc = soc->monitor_soc;
  3186. if (!mon_soc) {
  3187. dp_mon_debug("monitor soc is NULL");
  3188. return;
  3189. }
  3190. monitor_ops = mon_soc->mon_ops;
  3191. if (!monitor_ops || !monitor_ops->mon_vdev_timer_deinit) {
  3192. dp_mon_debug("callback not registered");
  3193. return;
  3194. }
  3195. monitor_ops->mon_vdev_timer_deinit(soc);
  3196. }
  3197. static inline
  3198. void dp_monitor_vdev_timer_start(struct dp_soc *soc)
  3199. {
  3200. struct dp_mon_ops *monitor_ops;
  3201. struct dp_mon_soc *mon_soc = soc->monitor_soc;
  3202. if (!mon_soc) {
  3203. dp_mon_debug("monitor soc is NULL");
  3204. return;
  3205. }
  3206. monitor_ops = mon_soc->mon_ops;
  3207. if (!monitor_ops || !monitor_ops->mon_vdev_timer_start) {
  3208. dp_mon_debug("callback not registered");
  3209. return;
  3210. }
  3211. monitor_ops->mon_vdev_timer_start(soc);
  3212. }
  3213. static inline
  3214. bool dp_monitor_vdev_timer_stop(struct dp_soc *soc)
  3215. {
  3216. struct dp_mon_ops *monitor_ops;
  3217. struct dp_mon_soc *mon_soc = soc->monitor_soc;
  3218. if (!mon_soc) {
  3219. dp_mon_debug("monitor soc is NULL");
  3220. return false;
  3221. }
  3222. monitor_ops = mon_soc->mon_ops;
  3223. if (!monitor_ops || !monitor_ops->mon_vdev_timer_stop) {
  3224. dp_mon_debug("callback not registered");
  3225. return false;
  3226. }
  3227. return monitor_ops->mon_vdev_timer_stop(soc);
  3228. }
  3229. #ifdef QCA_MCOPY_SUPPORT
  3230. static inline
  3231. QDF_STATUS dp_monitor_mcopy_check_deliver(struct dp_pdev *pdev,
  3232. uint16_t peer_id, uint32_t ppdu_id,
  3233. uint8_t first_msdu)
  3234. {
  3235. struct dp_mon_ops *monitor_ops;
  3236. struct dp_mon_soc *mon_soc = pdev->soc->monitor_soc;
  3237. if (!mon_soc) {
  3238. dp_mon_debug("monitor soc is NULL");
  3239. return QDF_STATUS_E_FAILURE;
  3240. }
  3241. monitor_ops = mon_soc->mon_ops;
  3242. if (!monitor_ops || !monitor_ops->mon_mcopy_check_deliver) {
  3243. dp_mon_debug("callback not registered");
  3244. return QDF_STATUS_E_FAILURE;
  3245. }
  3246. return monitor_ops->mon_mcopy_check_deliver(pdev, peer_id,
  3247. ppdu_id, first_msdu);
  3248. }
  3249. #else
  3250. static inline
  3251. QDF_STATUS dp_monitor_mcopy_check_deliver(struct dp_pdev *pdev,
  3252. uint16_t peer_id, uint32_t ppdu_id,
  3253. uint8_t first_msdu)
  3254. {
  3255. return QDF_STATUS_SUCCESS;
  3256. }
  3257. #endif
  3258. /**
  3259. * dp_monitor_neighbour_peer_add_ast() - Add ast entry
  3260. * @pdev: point to dp pdev
  3261. * @ta_peer: point to peer
  3262. * @mac_addr: mac address
  3263. * @nbuf: point to nbuf
  3264. * @flags: flags
  3265. *
  3266. * Return: void
  3267. */
  3268. static inline void
  3269. dp_monitor_neighbour_peer_add_ast(struct dp_pdev *pdev,
  3270. struct dp_peer *ta_peer,
  3271. uint8_t *mac_addr,
  3272. qdf_nbuf_t nbuf,
  3273. uint32_t flags)
  3274. {
  3275. struct dp_mon_soc *mon_soc = pdev->soc->monitor_soc;
  3276. struct dp_mon_ops *monitor_ops;
  3277. if (!mon_soc) {
  3278. dp_mon_debug("monitor soc is NULL");
  3279. return;
  3280. }
  3281. monitor_ops = mon_soc->mon_ops;
  3282. if (!monitor_ops || !monitor_ops->mon_neighbour_peer_add_ast) {
  3283. dp_mon_debug("callback not registered");
  3284. return;
  3285. }
  3286. return monitor_ops->mon_neighbour_peer_add_ast(pdev, ta_peer, mac_addr,
  3287. nbuf, flags);
  3288. }
  3289. /**
  3290. * dp_monitor_vdev_delete() - delete monitor vdev
  3291. * @soc: point to dp soc
  3292. * @vdev: point to dp vdev
  3293. *
  3294. * Return: void
  3295. */
  3296. static inline void dp_monitor_vdev_delete(struct dp_soc *soc,
  3297. struct dp_vdev *vdev)
  3298. {
  3299. if (soc->intr_mode == DP_INTR_POLL) {
  3300. qdf_timer_sync_cancel(&soc->int_timer);
  3301. dp_monitor_flush_rings(soc);
  3302. } else if (soc->intr_mode == DP_INTR_MSI) {
  3303. dp_monitor_vdev_timer_stop(soc);
  3304. dp_monitor_flush_rings(soc);
  3305. }
  3306. dp_monitor_vdev_detach(vdev);
  3307. }
  3308. #ifdef DP_POWER_SAVE
  3309. /**
  3310. * dp_monitor_reap_timer_suspend() - Stop monitor reap timer
  3311. * and reap any pending frames in ring
  3312. * @soc: DP soc context
  3313. *
  3314. * Return: void
  3315. */
  3316. static inline void
  3317. dp_monitor_reap_timer_suspend(struct dp_soc *soc)
  3318. {
  3319. if (dp_monitor_reap_timer_stop(soc, CDP_MON_REAP_SOURCE_ANY))
  3320. dp_monitor_service_mon_rings(soc, DP_MON_REAP_BUDGET);
  3321. }
  3322. #endif
  3323. /**
  3324. * dp_monitor_neighbour_peer_list_remove() - remove neighbour peer list
  3325. * @pdev: point to dp pdev
  3326. * @vdev: point to dp vdev
  3327. * @peer: point to dp_neighbour_peer
  3328. *
  3329. * Return: void
  3330. */
  3331. static inline
  3332. void dp_monitor_neighbour_peer_list_remove(struct dp_pdev *pdev,
  3333. struct dp_vdev *vdev,
  3334. struct dp_neighbour_peer *peer)
  3335. {
  3336. struct dp_mon_pdev *mon_pdev;
  3337. struct dp_neighbour_peer *temp_peer = NULL;
  3338. if (qdf_unlikely(!pdev || !pdev->monitor_pdev))
  3339. return;
  3340. mon_pdev = pdev->monitor_pdev;
  3341. qdf_spin_lock_bh(&mon_pdev->neighbour_peer_mutex);
  3342. if (!pdev->soc->monitor_soc->hw_nac_monitor_support) {
  3343. TAILQ_FOREACH(peer, &mon_pdev->neighbour_peers_list,
  3344. neighbour_peer_list_elem) {
  3345. QDF_ASSERT(peer->vdev != vdev);
  3346. }
  3347. } else {
  3348. TAILQ_FOREACH_SAFE(peer, &mon_pdev->neighbour_peers_list,
  3349. neighbour_peer_list_elem, temp_peer) {
  3350. if (peer->vdev == vdev) {
  3351. TAILQ_REMOVE(&mon_pdev->neighbour_peers_list,
  3352. peer,
  3353. neighbour_peer_list_elem);
  3354. qdf_mem_free(peer);
  3355. }
  3356. }
  3357. }
  3358. qdf_spin_unlock_bh(&mon_pdev->neighbour_peer_mutex);
  3359. }
  3360. static inline
  3361. void dp_monitor_pdev_set_mon_vdev(struct dp_vdev *vdev)
  3362. {
  3363. if (!vdev->pdev->monitor_pdev)
  3364. return;
  3365. vdev->pdev->monitor_pdev->mvdev = vdev;
  3366. }
  3367. static inline
  3368. void dp_monitor_pdev_config_scan_spcl_vap(struct dp_pdev *pdev, bool val)
  3369. {
  3370. if (!pdev || !pdev->monitor_pdev)
  3371. return;
  3372. pdev->monitor_pdev->scan_spcl_vap_configured = val;
  3373. }
  3374. #ifdef QCA_SUPPORT_SCAN_SPCL_VAP_STATS
  3375. static inline
  3376. void dp_monitor_pdev_reset_scan_spcl_vap_stats_enable(struct dp_pdev *pdev,
  3377. bool val)
  3378. {
  3379. if (!pdev || !pdev->monitor_pdev)
  3380. return;
  3381. pdev->monitor_pdev->reset_scan_spcl_vap_stats_enable = val;
  3382. }
  3383. #else
  3384. static inline
  3385. void dp_monitor_pdev_reset_scan_spcl_vap_stats_enable(struct dp_pdev *pdev,
  3386. bool val)
  3387. {
  3388. }
  3389. #endif
  3390. #if defined(CONFIG_MON_WORD_BASED_TLV)
  3391. static inline void
  3392. dp_mon_rx_wmask_subscribe(struct dp_soc *soc, uint32_t *msg_word,
  3393. struct htt_rx_ring_tlv_filter *tlv_filter)
  3394. {
  3395. struct dp_mon_soc *mon_soc = soc->monitor_soc;
  3396. struct dp_mon_ops *monitor_ops;
  3397. if (!mon_soc) {
  3398. dp_mon_debug("mon soc is NULL");
  3399. return;
  3400. }
  3401. monitor_ops = mon_soc->mon_ops;
  3402. if (!monitor_ops || !monitor_ops->rx_wmask_subscribe) {
  3403. dp_mon_debug("callback not registered");
  3404. return;
  3405. }
  3406. monitor_ops->rx_wmask_subscribe(msg_word, tlv_filter);
  3407. }
  3408. #else
  3409. static inline void
  3410. dp_mon_rx_wmask_subscribe(struct dp_soc *soc, uint32_t *msg_word,
  3411. struct htt_rx_ring_tlv_filter *tlv_filter)
  3412. {
  3413. }
  3414. #endif
  3415. static inline void
  3416. dp_mon_rx_enable_pkt_tlv_offset(struct dp_soc *soc, uint32_t *msg_word,
  3417. struct htt_rx_ring_tlv_filter *tlv_filter)
  3418. {
  3419. struct dp_mon_soc *mon_soc = soc->monitor_soc;
  3420. struct dp_mon_ops *monitor_ops;
  3421. if (!mon_soc) {
  3422. dp_mon_debug("mon soc is NULL");
  3423. return;
  3424. }
  3425. monitor_ops = mon_soc->mon_ops;
  3426. if (!monitor_ops || !monitor_ops->rx_pkt_tlv_offset) {
  3427. dp_mon_debug("callback not registered");
  3428. return;
  3429. }
  3430. monitor_ops->rx_pkt_tlv_offset(msg_word, tlv_filter);
  3431. }
  3432. static inline void
  3433. dp_mon_rx_enable_mpdu_logging(struct dp_soc *soc, uint32_t *msg_word,
  3434. struct htt_rx_ring_tlv_filter *tlv_filter)
  3435. {
  3436. struct dp_mon_soc *mon_soc = soc->monitor_soc;
  3437. struct dp_mon_ops *monitor_ops;
  3438. if (!mon_soc) {
  3439. dp_mon_debug("mon soc is NULL");
  3440. return;
  3441. }
  3442. monitor_ops = mon_soc->mon_ops;
  3443. if (!monitor_ops || !monitor_ops->rx_enable_mpdu_logging) {
  3444. dp_mon_debug("callback not registered");
  3445. return;
  3446. }
  3447. monitor_ops->rx_enable_mpdu_logging(msg_word, tlv_filter);
  3448. }
  3449. /**
  3450. * dp_mon_rx_enable_fpmo() - set fpmo filters
  3451. * @soc: dp soc handle
  3452. * @msg_word: msg word
  3453. * @tlv_filter: rx fing filter config
  3454. *
  3455. * Return: void
  3456. */
  3457. static inline void
  3458. dp_mon_rx_enable_fpmo(struct dp_soc *soc, uint32_t *msg_word,
  3459. struct htt_rx_ring_tlv_filter *tlv_filter)
  3460. {
  3461. struct dp_mon_soc *mon_soc = soc->monitor_soc;
  3462. struct dp_mon_ops *monitor_ops;
  3463. if (!mon_soc) {
  3464. dp_mon_debug("mon soc is NULL");
  3465. return;
  3466. }
  3467. monitor_ops = mon_soc->mon_ops;
  3468. if (!monitor_ops || !monitor_ops->rx_enable_fpmo) {
  3469. dp_mon_debug("callback not registered");
  3470. return;
  3471. }
  3472. monitor_ops->rx_enable_fpmo(msg_word, tlv_filter);
  3473. }
  3474. /**
  3475. * dp_mon_rx_hdr_length_set() - set rx hdr tlv length
  3476. * @soc: dp soc handle
  3477. * @msg_word: msg word
  3478. * @tlv_filter: rx fing filter config
  3479. *
  3480. * Return: void
  3481. */
  3482. static inline void
  3483. dp_mon_rx_hdr_length_set(struct dp_soc *soc, uint32_t *msg_word,
  3484. struct htt_rx_ring_tlv_filter *tlv_filter)
  3485. {
  3486. struct dp_mon_soc *mon_soc = soc->monitor_soc;
  3487. struct dp_mon_ops *monitor_ops;
  3488. if (!mon_soc) {
  3489. dp_mon_debug("mon soc is NULL");
  3490. return;
  3491. }
  3492. monitor_ops = mon_soc->mon_ops;
  3493. if (!monitor_ops || !monitor_ops->rx_hdr_length_set) {
  3494. dp_mon_debug("callback not registered");
  3495. return;
  3496. }
  3497. monitor_ops->rx_hdr_length_set(msg_word, tlv_filter);
  3498. }
  3499. static inline void
  3500. dp_mon_rx_packet_length_set(struct dp_soc *soc, uint32_t *msg_word,
  3501. struct htt_rx_ring_tlv_filter *tlv_filter)
  3502. {
  3503. struct dp_mon_soc *mon_soc = soc->monitor_soc;
  3504. struct dp_mon_ops *monitor_ops;
  3505. if (!mon_soc) {
  3506. dp_mon_debug("mon soc is NULL");
  3507. return;
  3508. }
  3509. monitor_ops = mon_soc->mon_ops;
  3510. if (!monitor_ops || !monitor_ops->rx_packet_length_set) {
  3511. dp_mon_debug("callback not registered");
  3512. return;
  3513. }
  3514. monitor_ops->rx_packet_length_set(msg_word, tlv_filter);
  3515. }
  3516. static inline void
  3517. dp_rx_mon_enable(struct dp_soc *soc, uint32_t *msg_word,
  3518. struct htt_rx_ring_tlv_filter *tlv_filter)
  3519. {
  3520. struct dp_mon_soc *mon_soc = soc->monitor_soc;
  3521. struct dp_mon_ops *monitor_ops;
  3522. if (!mon_soc) {
  3523. dp_mon_debug("mon soc is NULL");
  3524. return;
  3525. }
  3526. monitor_ops = mon_soc->mon_ops;
  3527. if (!monitor_ops || !monitor_ops->rx_mon_enable) {
  3528. dp_mon_debug("callback not registered");
  3529. return;
  3530. }
  3531. monitor_ops->rx_mon_enable(msg_word, tlv_filter);
  3532. }
  3533. static inline void
  3534. dp_mon_rx_mac_filter_set(struct dp_soc *soc, uint32_t *msg_word,
  3535. struct htt_rx_ring_tlv_filter *tlv_filter)
  3536. {
  3537. struct dp_mon_soc *mon_soc = soc->monitor_soc;
  3538. struct dp_mon_ops *monitor_ops;
  3539. if (!mon_soc) {
  3540. dp_mon_debug("mon soc is NULL");
  3541. return;
  3542. }
  3543. monitor_ops = mon_soc->mon_ops;
  3544. if (!monitor_ops || !monitor_ops->mon_mac_filter_set) {
  3545. dp_mon_debug("callback not registered");
  3546. return;
  3547. }
  3548. monitor_ops->mon_mac_filter_set(msg_word, tlv_filter);
  3549. }
  3550. #ifdef QCA_ENHANCED_STATS_SUPPORT
  3551. QDF_STATUS dp_peer_qos_stats_notify(struct dp_pdev *dp_pdev,
  3552. struct cdp_rx_stats_ppdu_user *ppdu_user);
  3553. #endif
  3554. /**
  3555. * dp_print_pdev_rx_mon_stats() - print rx mon stats
  3556. * @pdev: device object
  3557. *
  3558. * Return: void
  3559. */
  3560. void
  3561. dp_print_pdev_rx_mon_stats(struct dp_pdev *pdev);
  3562. /**
  3563. * dp_mcopy_check_deliver() - mcopy check deliver
  3564. * @pdev: DP pdev handle
  3565. * @peer_id: peer id
  3566. * @ppdu_id: ppdu
  3567. * @first_msdu: flag to indicate first msdu of ppdu
  3568. * Return: 0 on success, not 0 on failure
  3569. */
  3570. QDF_STATUS dp_mcopy_check_deliver(struct dp_pdev *pdev,
  3571. uint16_t peer_id,
  3572. uint32_t ppdu_id,
  3573. uint8_t first_msdu);
  3574. /**
  3575. * dp_pdev_set_advance_monitor_filter() - Set DP PDEV monitor filter
  3576. * @soc_hdl: soc handle
  3577. * @pdev_id: id of Datapath PDEV handle
  3578. * @filter_val: Flag to select Filter for monitor mode
  3579. *
  3580. * Return: 0 on success, not 0 on failure
  3581. */
  3582. #ifdef QCA_ADVANCE_MON_FILTER_SUPPORT
  3583. QDF_STATUS
  3584. dp_pdev_set_advance_monitor_filter(struct cdp_soc_t *soc_hdl, uint8_t pdev_id,
  3585. struct cdp_monitor_filter *filter_val);
  3586. #else
  3587. static inline QDF_STATUS
  3588. dp_pdev_set_advance_monitor_filter(struct cdp_soc_t *soc_hdl, uint8_t pdev_id,
  3589. struct cdp_monitor_filter *filter_val)
  3590. {
  3591. return QDF_STATUS_E_INVAL;
  3592. }
  3593. #endif /* QCA_ADVANCE_MON_FILTER_SUPPORT */
  3594. /**
  3595. * dp_deliver_tx_mgmt() - Deliver mgmt frame for tx capture
  3596. * @cdp_soc : data path soc handle
  3597. * @pdev_id : pdev_id
  3598. * @nbuf: Management frame buffer
  3599. *
  3600. * Return: QDF_STATUS_SUCCESS on success
  3601. * QDF_STATUS_E_FAILURE on failure
  3602. */
  3603. QDF_STATUS
  3604. dp_deliver_tx_mgmt(struct cdp_soc_t *cdp_soc, uint8_t pdev_id, qdf_nbuf_t nbuf);
  3605. /**
  3606. * dp_filter_neighbour_peer() - API to filter neighbour peer
  3607. * @pdev : DP pdev handle
  3608. * @rx_pkt_hdr : packet header
  3609. *
  3610. * Return: QDF_STATUS_SUCCESS on success
  3611. * QDF_STATUS_E_FAILURE on failure
  3612. */
  3613. #ifdef FEATURE_NAC_RSSI
  3614. QDF_STATUS dp_filter_neighbour_peer(struct dp_pdev *pdev,
  3615. uint8_t *rx_pkt_hdr);
  3616. #else
  3617. static inline
  3618. QDF_STATUS dp_filter_neighbour_peer(struct dp_pdev *pdev,
  3619. uint8_t *rx_pkt_hdr)
  3620. {
  3621. return QDF_STATUS_SUCCESS;
  3622. }
  3623. #endif /* FEATURE_NAC_RSSI */
  3624. /**
  3625. * dp_neighbour_peers_detach() - Detach neighbour peers(nac clients)
  3626. * @pdev: device object
  3627. *
  3628. * Return: void
  3629. */
  3630. void dp_neighbour_peers_detach(struct dp_pdev *pdev);
  3631. /**
  3632. * dp_reset_monitor_mode() - Disable monitor mode
  3633. * @soc_hdl: Datapath soc handle
  3634. * @pdev_id: id of datapath PDEV handle
  3635. * @smart_monitor: smart monitor flag
  3636. *
  3637. * Return: QDF_STATUS
  3638. */
  3639. QDF_STATUS dp_reset_monitor_mode(struct cdp_soc_t *soc_hdl,
  3640. uint8_t pdev_id,
  3641. uint8_t smart_monitor);
  3642. static inline
  3643. struct dp_mon_ops *dp_mon_ops_get(struct dp_soc *soc)
  3644. {
  3645. if (soc && soc->monitor_soc)
  3646. return soc->monitor_soc->mon_ops;
  3647. return NULL;
  3648. }
  3649. static inline
  3650. struct cdp_mon_ops *dp_mon_cdp_ops_get(struct dp_soc *soc)
  3651. {
  3652. struct cdp_ops *ops = soc->cdp_soc.ops;
  3653. return ops->mon_ops;
  3654. }
  3655. /**
  3656. * dp_monitor_soc_attach() - Monitor SOC attach
  3657. * @soc: DP soc handle
  3658. *
  3659. * Return: void
  3660. */
  3661. static inline void dp_monitor_soc_attach(struct dp_soc *soc)
  3662. {
  3663. struct dp_mon_ops *mon_ops;
  3664. mon_ops = dp_mon_ops_get(soc);
  3665. if (mon_ops && mon_ops->mon_soc_attach[0])
  3666. mon_ops->mon_soc_attach[0](soc);
  3667. if (mon_ops && mon_ops->mon_soc_attach[1])
  3668. mon_ops->mon_soc_attach[1](soc);
  3669. }
  3670. /**
  3671. * dp_monitor_soc_detach() - Monitor SOC detach
  3672. * @soc: DP soc handle
  3673. *
  3674. * Return: void
  3675. */
  3676. static inline void dp_monitor_soc_detach(struct dp_soc *soc)
  3677. {
  3678. struct dp_mon_ops *mon_ops;
  3679. mon_ops = dp_mon_ops_get(soc);
  3680. if (mon_ops && mon_ops->mon_soc_detach[0])
  3681. mon_ops->mon_soc_detach[0](soc);
  3682. if (mon_ops && mon_ops->mon_soc_detach[1])
  3683. mon_ops->mon_soc_detach[1](soc);
  3684. }
  3685. /**
  3686. * dp_monitor_soc_init() - Monitor SOC init
  3687. * @soc: DP soc handle
  3688. *
  3689. * Return: void
  3690. */
  3691. static inline void dp_monitor_soc_init(struct dp_soc *soc)
  3692. {
  3693. struct dp_mon_ops *mon_ops;
  3694. mon_ops = dp_mon_ops_get(soc);
  3695. if (mon_ops && mon_ops->mon_soc_init[0])
  3696. mon_ops->mon_soc_init[0](soc);
  3697. if (mon_ops && mon_ops->mon_soc_init[1])
  3698. mon_ops->mon_soc_init[1](soc);
  3699. }
  3700. /**
  3701. * dp_monitor_soc_deinit() - Monitor SOC deinit
  3702. * @soc: DP soc handle
  3703. *
  3704. * Return: void
  3705. */
  3706. static inline void dp_monitor_soc_deinit(struct dp_soc *soc)
  3707. {
  3708. struct dp_mon_ops *mon_ops;
  3709. mon_ops = dp_mon_ops_get(soc);
  3710. if (mon_ops && mon_ops->mon_soc_deinit[0])
  3711. mon_ops->mon_soc_deinit[0](soc);
  3712. if (mon_ops && mon_ops->mon_soc_deinit[1])
  3713. mon_ops->mon_soc_deinit[1](soc);
  3714. }
  3715. /**
  3716. * dp_ppdu_desc_user_stats_update(): Function to update TX user stats
  3717. * @pdev: DP pdev handle
  3718. * @ppdu_info: per PPDU TLV descriptor
  3719. *
  3720. * Return: void
  3721. */
  3722. #ifdef QCA_ENHANCED_STATS_SUPPORT
  3723. void
  3724. dp_ppdu_desc_user_stats_update(struct dp_pdev *pdev,
  3725. struct ppdu_info *ppdu_info);
  3726. #else
  3727. static inline void
  3728. dp_ppdu_desc_user_stats_update(struct dp_pdev *pdev,
  3729. struct ppdu_info *ppdu_info)
  3730. {
  3731. }
  3732. #endif /* QCA_ENHANCED_STATS_SUPPORT */
  3733. /**
  3734. * dp_mon_ops_register_1_0(): register legacy monitor ops
  3735. * @mon_soc: monitor soc handle
  3736. *
  3737. * return: void
  3738. */
  3739. void dp_mon_ops_register_1_0(struct dp_mon_soc *mon_soc);
  3740. /**
  3741. * dp_mon_cdp_ops_register_1_0(): register legacy monitor cdp ops
  3742. * @ops: cdp ops handle
  3743. *
  3744. * return: void
  3745. */
  3746. void dp_mon_cdp_ops_register_1_0(struct cdp_ops *ops);
  3747. #if defined(WLAN_CFR_ENABLE) && defined(WLAN_ENH_CFR_ENABLE)
  3748. /**
  3749. * dp_cfr_filter_register_1_0(): register cfr filter setting API
  3750. * @ops: cdp ops handle
  3751. *
  3752. * return: void
  3753. */
  3754. void dp_cfr_filter_register_1_0(struct cdp_ops *ops);
  3755. #endif
  3756. QDF_STATUS dp_mon_pdev_htt_srng_setup_2_0(struct dp_soc *soc,
  3757. struct dp_pdev *pdev,
  3758. int mac_id,
  3759. int mac_for_pdev);
  3760. QDF_STATUS dp_mon_soc_htt_srng_setup_2_0(struct dp_soc *soc);
  3761. QDF_STATUS dp_mon_soc_attach_2_0(struct dp_soc *soc);
  3762. QDF_STATUS dp_mon_soc_init_2_0(struct dp_soc *soc);
  3763. void dp_mon_soc_deinit_2_0(struct dp_soc *soc);
  3764. QDF_STATUS dp_mon_soc_detach_2_0(struct dp_soc *soc);
  3765. void dp_pdev_mon_rings_deinit_2_0(struct dp_pdev *pdev);
  3766. QDF_STATUS dp_pdev_mon_rings_init_2_0(struct dp_pdev *pdev);
  3767. void dp_pdev_mon_rings_free_2_0(struct dp_pdev *pdev);
  3768. QDF_STATUS dp_pdev_mon_rings_alloc_2_0(struct dp_pdev *pdev);
  3769. #ifdef WLAN_PKT_CAPTURE_TX_2_0
  3770. /**
  3771. * dp_mon_ops_register_tx_2_0(): register monitor tx ops 2.0
  3772. * @mon_soc: monitor soc handle
  3773. *
  3774. * return: void
  3775. */
  3776. void dp_mon_ops_register_tx_2_0(struct dp_mon_soc *mon_soc);
  3777. /**
  3778. * dp_mon_ops_register_2_0(): register monitor ops
  3779. * @mon_soc: monitor soc handle
  3780. *
  3781. * return: void
  3782. */
  3783. void dp_mon_ops_register_2_0(struct dp_mon_soc *mon_soc);
  3784. /**
  3785. * dp_mon_cdp_ops_register_2_0(): register monitor cdp ops
  3786. * @ops: cdp ops handle
  3787. *
  3788. * return: void
  3789. */
  3790. void dp_mon_cdp_ops_register_2_0(struct cdp_ops *ops);
  3791. #if defined(WLAN_CFR_ENABLE) && defined(WLAN_ENH_CFR_ENABLE)
  3792. /**
  3793. * dp_cfr_filter_register_2_0(): register cfr filter setting API
  3794. * @ops: cdp ops handle
  3795. *
  3796. * return: void
  3797. */
  3798. void dp_cfr_filter_register_2_0(struct cdp_ops *ops);
  3799. #endif
  3800. #else
  3801. static inline
  3802. void dp_mon_ops_register_tx_2_0(struct dp_mon_soc *mon_soc)
  3803. {
  3804. }
  3805. #endif /* WLAN_PKT_CAPTURE_TX_2_0 */
  3806. #ifdef WLAN_PKT_CAPTURE_RX_2_0
  3807. /**
  3808. * dp_mon_ops_register_rx_2_0(): register monitor rx ops 2.0
  3809. * @mon_soc: monitor soc handle
  3810. *
  3811. * return: void
  3812. */
  3813. void dp_mon_ops_register_rx_2_0(struct dp_mon_soc *mon_soc);
  3814. #else
  3815. static inline
  3816. void dp_mon_ops_register_rx_2_0(struct dp_mon_soc *mon_soc)
  3817. {
  3818. }
  3819. #endif
  3820. /**
  3821. * dp_mon_register_feature_ops(): Register mon feature ops
  3822. * @soc: Datapath soc context
  3823. *
  3824. * return: void
  3825. */
  3826. static inline
  3827. void dp_mon_register_feature_ops(struct dp_soc *soc)
  3828. {
  3829. struct dp_mon_ops *mon_ops = NULL;
  3830. mon_ops = dp_mon_ops_get(soc);
  3831. if (!mon_ops) {
  3832. dp_mon_err("Monitor ops is NULL");
  3833. return;
  3834. }
  3835. if (mon_ops->mon_register_feature_ops)
  3836. mon_ops->mon_register_feature_ops(soc);
  3837. }
  3838. /**
  3839. * dp_pdev_get_rx_mon_stats(): Get pdev Rx monitor stats
  3840. * @soc_hdl: soc handle
  3841. * @pdev_id: id of pdev handle
  3842. * @stats: User allocated stats buffer
  3843. *
  3844. * return: status success/failure
  3845. */
  3846. QDF_STATUS dp_pdev_get_rx_mon_stats(struct cdp_soc_t *soc_hdl, uint8_t pdev_id,
  3847. struct cdp_pdev_mon_stats *stats);
  3848. /**
  3849. * dp_enable_mon_reap_timer() - enable/disable reap timer
  3850. * @soc_hdl: Datapath soc handle
  3851. * @source: trigger source of the timer
  3852. * @enable: Enable/Disable reap timer of monitor status ring
  3853. *
  3854. * Return: true if a timer-start/stop is performed, false otherwise.
  3855. */
  3856. bool dp_enable_mon_reap_timer(struct cdp_soc_t *soc_hdl,
  3857. enum cdp_mon_reap_source source, bool enable);
  3858. #ifdef QCA_ENHANCED_STATS_SUPPORT
  3859. /**
  3860. * dp_enable_enhanced_stats() - enable enhanced and MLD Link Peer stats
  3861. * @soc: Datapath soc handle
  3862. * @pdev_id: Pdev Id on which stats will get enable
  3863. *
  3864. * Return: status success/failure
  3865. */
  3866. QDF_STATUS
  3867. dp_enable_enhanced_stats(struct cdp_soc_t *soc, uint8_t pdev_id);
  3868. /**
  3869. * dp_disable_enhanced_stats() - disable enhanced and MLD Link Peer stats
  3870. * @soc: Datapath soc handle
  3871. * @pdev_id: Pdev Id on which stats will get disable
  3872. *
  3873. * Return: status success/failure
  3874. */
  3875. QDF_STATUS
  3876. dp_disable_enhanced_stats(struct cdp_soc_t *soc, uint8_t pdev_id);
  3877. #endif /* QCA_ENHANCED_STATS_SUPPORT */
  3878. /*
  3879. * dp_monitor_lite_mon_disable_rx() - disables rx lite mon
  3880. * @pdev: dp pdev
  3881. *
  3882. * Return: void
  3883. */
  3884. static inline void
  3885. dp_monitor_lite_mon_disable_rx(struct dp_pdev *pdev)
  3886. {
  3887. struct dp_mon_ops *monitor_ops;
  3888. struct dp_mon_soc *mon_soc = pdev->soc->monitor_soc;
  3889. if (!mon_soc) {
  3890. dp_mon_debug("monitor soc is NULL");
  3891. return;
  3892. }
  3893. monitor_ops = mon_soc->mon_ops;
  3894. if (!monitor_ops ||
  3895. !monitor_ops->mon_lite_mon_disable_rx) {
  3896. dp_mon_debug("callback not registered");
  3897. return;
  3898. }
  3899. return monitor_ops->mon_lite_mon_disable_rx(pdev);
  3900. }
  3901. /*
  3902. * dp_monitor_lite_mon_is_rx_adv_filter_enable()
  3903. * - check if advance mon filter is already applied
  3904. * @pdev: dp pdev
  3905. *
  3906. * Return: bool
  3907. */
  3908. static inline bool
  3909. dp_monitor_lite_mon_is_rx_adv_filter_enable(struct dp_pdev *pdev)
  3910. {
  3911. struct dp_mon_ops *monitor_ops;
  3912. struct dp_mon_soc *mon_soc = pdev->soc->monitor_soc;
  3913. if (!mon_soc) {
  3914. dp_mon_debug("monitor soc is NULL");
  3915. return false;
  3916. }
  3917. monitor_ops = mon_soc->mon_ops;
  3918. if (!monitor_ops ||
  3919. !monitor_ops->mon_lite_mon_disable_rx) {
  3920. dp_mon_debug("callback not registered");
  3921. return false;
  3922. }
  3923. return monitor_ops->mon_lite_mon_is_rx_adv_filter_enable(pdev);
  3924. }
  3925. #ifndef QCA_SUPPORT_LITE_MONITOR
  3926. static inline void
  3927. dp_lite_mon_disable_rx(struct dp_pdev *pdev)
  3928. {
  3929. }
  3930. static inline void
  3931. dp_lite_mon_disable_tx(struct dp_pdev *pdev)
  3932. {
  3933. }
  3934. static inline bool
  3935. dp_lite_mon_is_rx_adv_filter_enable(struct dp_pdev *pdev)
  3936. {
  3937. return false;
  3938. }
  3939. static inline bool
  3940. dp_lite_mon_get_filter_ucast_data(struct cdp_pdev *pdev_handle)
  3941. {
  3942. return false;
  3943. }
  3944. static inline bool
  3945. dp_lite_mon_get_filter_mcast_data(struct cdp_pdev *pdev_handle)
  3946. {
  3947. return false;
  3948. }
  3949. static inline bool
  3950. dp_lite_mon_get_filter_non_data(struct cdp_pdev *pdev_handle)
  3951. {
  3952. return false;
  3953. }
  3954. static inline int
  3955. dp_lite_mon_is_level_msdu(struct dp_mon_pdev *mon_pdev)
  3956. {
  3957. return 0;
  3958. }
  3959. static inline int
  3960. dp_lite_mon_is_rx_enabled(struct dp_mon_pdev *mon_pdev)
  3961. {
  3962. return 0;
  3963. }
  3964. static inline int
  3965. dp_lite_mon_is_tx_enabled(struct dp_mon_pdev *mon_pdev)
  3966. {
  3967. return 0;
  3968. }
  3969. static inline QDF_STATUS
  3970. dp_lite_mon_alloc(struct dp_pdev *pdev)
  3971. {
  3972. return QDF_STATUS_SUCCESS;
  3973. }
  3974. static inline void
  3975. dp_lite_mon_dealloc(struct dp_pdev *pdev)
  3976. {
  3977. }
  3978. static inline void
  3979. dp_lite_mon_vdev_delete(struct dp_pdev *pdev, struct dp_vdev *vdev)
  3980. {
  3981. }
  3982. static inline int
  3983. dp_lite_mon_config_nac_peer(struct cdp_soc_t *soc_hdl,
  3984. uint8_t vdev_id,
  3985. uint32_t cmd, uint8_t *macaddr)
  3986. {
  3987. return 0;
  3988. }
  3989. static inline QDF_STATUS
  3990. dp_lite_mon_config_nac_rssi_peer(struct cdp_soc_t *soc_hdl,
  3991. uint8_t vdev_id,
  3992. enum cdp_nac_param_cmd cmd,
  3993. char *bssid, char *macaddr,
  3994. uint8_t chan_num)
  3995. {
  3996. return QDF_STATUS_E_FAILURE;
  3997. }
  3998. static inline QDF_STATUS
  3999. dp_lite_mon_get_nac_peer_rssi(struct cdp_soc_t *soc_hdl,
  4000. uint8_t vdev_id, char *macaddr,
  4001. uint8_t *rssi)
  4002. {
  4003. return QDF_STATUS_E_FAILURE;
  4004. }
  4005. static inline QDF_STATUS
  4006. dp_lite_mon_rx_mpdu_process(struct dp_pdev *pdev,
  4007. struct hal_rx_ppdu_info *ppdu_info,
  4008. qdf_nbuf_t mon_mpdu, uint16_t mpdu_id,
  4009. uint8_t user)
  4010. {
  4011. return QDF_STATUS_E_FAILURE;
  4012. }
  4013. static inline int
  4014. dp_lite_mon_get_legacy_feature_enabled(struct cdp_soc_t *soc,
  4015. uint8_t pdev_id,
  4016. uint8_t direction)
  4017. {
  4018. return 0;
  4019. }
  4020. #endif
  4021. #ifdef WLAN_CONFIG_TELEMETRY_AGENT
  4022. static inline
  4023. void dp_monitor_peer_telemetry_stats(struct dp_peer *peer,
  4024. struct cdp_peer_telemetry_stats *stats)
  4025. {
  4026. struct dp_mon_peer_stats *mon_peer_stats = NULL;
  4027. uint8_t ac;
  4028. if (qdf_unlikely(!peer->monitor_peer))
  4029. return;
  4030. mon_peer_stats = &peer->monitor_peer->stats;
  4031. for (ac = 0; ac < WME_AC_MAX; ac++) {
  4032. stats->tx_airtime_consumption[ac] =
  4033. mon_peer_stats->airtime_stats.tx_airtime_consumption[ac].avg_consumption_per_sec;
  4034. stats->rx_airtime_consumption[ac] =
  4035. mon_peer_stats->airtime_stats.rx_airtime_consumption[ac].avg_consumption_per_sec;
  4036. }
  4037. stats->tx_mpdu_retried = mon_peer_stats->tx.retries;
  4038. stats->tx_mpdu_total = mon_peer_stats->tx.tx_mpdus_tried;
  4039. stats->rx_mpdu_retried = mon_peer_stats->rx.mpdu_retry_cnt;
  4040. stats->rx_mpdu_total = mon_peer_stats->rx.rx_mpdus;
  4041. stats->snr = CDP_SNR_OUT(mon_peer_stats->rx.avg_snr);
  4042. }
  4043. static inline
  4044. void dp_monitor_peer_deter_stats(struct dp_peer *peer,
  4045. struct cdp_peer_deter_stats *stats)
  4046. {
  4047. struct dp_mon_peer_stats *mon_peer_stats = NULL;
  4048. struct cdp_peer_deter_stats *deter_stats;
  4049. if (qdf_unlikely(!peer->monitor_peer))
  4050. return;
  4051. mon_peer_stats = &peer->monitor_peer->stats;
  4052. deter_stats = &mon_peer_stats->deter_stats.deter[0];
  4053. qdf_mem_copy(stats, deter_stats, sizeof(*stats) * CDP_DATA_TID_MAX);
  4054. }
  4055. #endif
  4056. /**
  4057. * dp_monitor_is_tx_cap_enabled() - get tx-cature enabled/disabled
  4058. * @peer: DP peer handle
  4059. *
  4060. * Return: true if tx-capture is enabled
  4061. */
  4062. static inline bool dp_monitor_is_tx_cap_enabled(struct dp_peer *peer)
  4063. {
  4064. return peer->monitor_peer ? peer->monitor_peer->tx_cap_enabled : 0;
  4065. }
  4066. /**
  4067. * dp_monitor_is_rx_cap_enabled() - get rx-cature enabled/disabled
  4068. * @peer: DP peer handle
  4069. *
  4070. * Return: true if rx-capture is enabled
  4071. */
  4072. static inline bool dp_monitor_is_rx_cap_enabled(struct dp_peer *peer)
  4073. {
  4074. return peer->monitor_peer ? peer->monitor_peer->rx_cap_enabled : 0;
  4075. }
  4076. #if !(!defined(DISABLE_MON_CONFIG) && (defined(WLAN_PKT_CAPTURE_TX_2_0) || \
  4077. defined(WLAN_PKT_CAPTURE_RX_2_0)))
  4078. /**
  4079. * dp_mon_get_context_size_be() - get BE specific size for mon pdev/soc
  4080. * @context_type: context type for which the size is needed
  4081. *
  4082. * Return: size in bytes for the context_type
  4083. */
  4084. static inline
  4085. qdf_size_t dp_mon_get_context_size_be(enum dp_context_type context_type)
  4086. {
  4087. switch (context_type) {
  4088. case DP_CONTEXT_TYPE_MON_SOC:
  4089. return sizeof(struct dp_mon_soc);
  4090. case DP_CONTEXT_TYPE_MON_PDEV:
  4091. return sizeof(struct dp_mon_pdev);
  4092. default:
  4093. return 0;
  4094. }
  4095. }
  4096. #endif
  4097. /**
  4098. * dp_mon_rx_print_advanced_stats() - print advanced monitor stats
  4099. * @soc: DP soc handle
  4100. * @pdev: DP pdev handle
  4101. *
  4102. * Return: void
  4103. */
  4104. static inline void
  4105. dp_mon_rx_print_advanced_stats(struct dp_soc *soc,
  4106. struct dp_pdev *pdev)
  4107. {
  4108. struct dp_mon_soc *mon_soc = soc->monitor_soc;
  4109. struct dp_mon_ops *monitor_ops;
  4110. if (!mon_soc) {
  4111. dp_mon_debug("mon soc is NULL");
  4112. return;
  4113. }
  4114. monitor_ops = mon_soc->mon_ops;
  4115. if (!monitor_ops ||
  4116. !monitor_ops->mon_rx_print_advanced_stats) {
  4117. dp_mon_debug("callback not registered");
  4118. return;
  4119. }
  4120. return monitor_ops->mon_rx_print_advanced_stats(soc, pdev);
  4121. }
  4122. #ifdef WLAN_CONFIG_TELEMETRY_AGENT
  4123. /*
  4124. * dp_update_pdev_mon_telemetry_airtime_stats() - update telemetry airtime
  4125. * stats in monitor pdev
  4126. *
  4127. *@soc: dp soc handle
  4128. *@pdev_id: pdev id
  4129. *
  4130. * This API is used to update telemetry airtime stats in monitor pdev
  4131. *
  4132. * Return: Success if stats are updated, else failure
  4133. */
  4134. QDF_STATUS dp_pdev_update_telemetry_airtime_stats(struct cdp_soc_t *soc,
  4135. uint8_t pdev_id);
  4136. #endif
  4137. /*
  4138. * dp_mon_register_lpc_ops_1_0() - set local packet capture 1_0 mon ops
  4139. * @mon_ops: monitor ops
  4140. *
  4141. * This function initializes the mon_ops callbacks.
  4142. * index [0] is for Monitor 1.0 and index [1] is for Monitor 2.0
  4143. * based on the @WLAN_FEATURE_LOCAL_PKT_CAPTURE macro, it sets the
  4144. * appropriate callbacks
  4145. *
  4146. * Return: None
  4147. */
  4148. void dp_mon_register_lpc_ops_1_0(struct dp_mon_ops *mon_ops);
  4149. /*
  4150. * dp_mon_register_tx_pkt_enh_ops_1_0() - set tx pkt enh mon ops
  4151. * @mon_ops: monitor ops
  4152. *
  4153. * Return: None
  4154. */
  4155. void dp_mon_register_tx_pkt_enh_ops_1_0(struct dp_mon_ops *mon_ops);
  4156. #ifdef WLAN_FEATURE_LOCAL_PKT_CAPTURE
  4157. /*
  4158. * dp_local_pkt_capture_tx_config() - local packet capture tx config
  4159. * @pdev: physical device handle
  4160. *
  4161. * Return: QDF_STATUS
  4162. */
  4163. QDF_STATUS dp_local_pkt_capture_tx_config(struct dp_pdev *pdev);
  4164. #else
  4165. static inline
  4166. QDF_STATUS dp_local_pkt_capture_tx_config(struct dp_pdev *pdev)
  4167. {
  4168. return QDF_STATUS_SUCCESS;
  4169. }
  4170. #endif
  4171. #endif /* _DP_MON_H_ */