dp_mon.h 125 KB

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