dp_mon.h 121 KB

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