dp_mon.h 120 KB

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