dp_mon.h 121 KB

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