dp_mon.h 121 KB

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