dp_mon.h 121 KB

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