dp_mon.h 83 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407
  1. /*
  2. * Copyright (c) 2016-2021, The Linux Foundation. All rights reserved.
  3. * Copyright (c) 2021 Qualcomm Innovation Center, Inc. All rights reserved.
  4. * Permission to use, copy, modify, and/or distribute this software for any
  5. * purpose with or without fee is hereby granted, provided that the above
  6. * copyright notice and this permission notice appear in all copies.
  7. *
  8. * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
  9. * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
  10. * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
  11. * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
  12. * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
  13. * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
  14. * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  15. */
  16. #ifndef _DP_MON_H_
  17. #define _DP_MON_H_
  18. #include "qdf_trace.h"
  19. #include "dp_internal.h"
  20. #include "dp_types.h"
  21. #include "dp_htt.h"
  22. #ifdef WLAN_TX_PKT_CAPTURE_ENH
  23. #include "dp_tx_capture.h"
  24. #endif
  25. #define DP_INTR_POLL_TIMER_MS 5
  26. #define MON_VDEV_TIMER_INIT 0x1
  27. #define MON_VDEV_TIMER_RUNNING 0x2
  28. /* Budget to reap monitor status ring */
  29. #define DP_MON_REAP_BUDGET 1024
  30. #define MON_BUF_MIN_ENTRIES 64
  31. #define RNG_ERR "SRNG setup failed for"
  32. #define dp_mon_info(params...) \
  33. __QDF_TRACE_FL(QDF_TRACE_LEVEL_INFO_HIGH, QDF_MODULE_ID_MON, ## params)
  34. #define dp_mon_err(params...) QDF_TRACE_ERROR(QDF_MODULE_ID_MON, params)
  35. #define dp_mon_debug(params...) QDF_TRACE_DEBUG(QDF_MODULE_ID_MON, params)
  36. #define dp_mon_warn(params...) QDF_TRACE_WARN(QDF_MODULE_ID_MON, params)
  37. #ifndef WLAN_TX_PKT_CAPTURE_ENH
  38. struct dp_pdev_tx_capture {
  39. };
  40. struct dp_peer_tx_capture {
  41. };
  42. #endif
  43. #ifndef WLAN_TX_PKT_CAPTURE_ENH
  44. static inline void
  45. dp_process_ppdu_stats_update_failed_bitmap(struct dp_pdev *pdev,
  46. void *data,
  47. uint32_t ppdu_id,
  48. uint32_t size)
  49. {
  50. }
  51. #endif
  52. #ifdef DP_CON_MON_MSI_ENABLED
  53. static inline bool dp_is_monitor_mode_using_poll(struct dp_soc *soc)
  54. {
  55. return false;
  56. }
  57. #else
  58. static inline bool dp_is_monitor_mode_using_poll(struct dp_soc *soc)
  59. {
  60. return true;
  61. }
  62. #endif
  63. /*
  64. * dp_mon_soc_attach() - DP monitor soc attach
  65. * @soc: Datapath SOC handle
  66. *
  67. * Return: QDF_STATUS_SUCCESS: Success
  68. * QDF_STATUS_E_NOMEM: Error
  69. */
  70. QDF_STATUS dp_mon_soc_attach(struct dp_soc *soc);
  71. /*
  72. * dp_mon_soc_detach() - DP monitor soc detach
  73. * @soc: Datapath SOC handle
  74. *
  75. * Return: QDF_STATUS_SUCCESS: Success
  76. * QDF_STATUS_E_FAILURE: Error
  77. */
  78. QDF_STATUS dp_mon_soc_detach(struct dp_soc *soc);
  79. /*
  80. * dp_mon_soc_cfg_init() - DP monitor soc config init
  81. * @soc: Datapath SOC handle
  82. *
  83. * Return: QDF_STATUS_SUCCESS: Success
  84. * QDF_STATUS_E_FAILURE: Error
  85. */
  86. QDF_STATUS dp_mon_soc_cfg_init(struct dp_soc *soc);
  87. /*
  88. * dp_mon_pdev_attach() - DP monitor pdev attach
  89. * @pdev: Datapath pdev handle
  90. *
  91. * Return: QDF_STATUS_SUCCESS: Success
  92. * QDF_STATUS_E_NOMEM: Error
  93. */
  94. QDF_STATUS dp_mon_pdev_attach(struct dp_pdev *pdev);
  95. /*
  96. * dp_mon_pdev_detach() - DP monitor pdev detach
  97. * @pdev: Datapath pdev handle
  98. *
  99. * Return: QDF_STATUS_SUCCESS: Success
  100. * QDF_STATUS_E_FAILURE: Error
  101. */
  102. QDF_STATUS dp_mon_pdev_detach(struct dp_pdev *pdev);
  103. /*
  104. * dp_mon_pdev_init() - DP monitor pdev init
  105. * @pdev: Datapath pdev handle
  106. *
  107. * Return: QDF_STATUS_SUCCESS: Success
  108. * QDF_STATUS_E_FAILURE: Error
  109. */
  110. QDF_STATUS dp_mon_pdev_init(struct dp_pdev *pdev);
  111. /*
  112. * dp_mon_pdev_deinit() - DP monitor pdev deinit
  113. * @pdev: Datapath pdev handle
  114. *
  115. * Return: QDF_STATUS_SUCCESS: Success
  116. * QDF_STATUS_E_FAILURE: Error
  117. */
  118. QDF_STATUS dp_mon_pdev_deinit(struct dp_pdev *pdev);
  119. /*
  120. * dp_mon_vdev_attach() - DP monitor vdev attach
  121. * @vdev: Datapath vdev handle
  122. *
  123. * Return: QDF_STATUS_SUCCESS: Success
  124. * QDF_STATUS_E_NOMEM: Error
  125. */
  126. QDF_STATUS dp_mon_vdev_attach(struct dp_vdev *vdev);
  127. /*
  128. * dp_mon_vdev_detach() - DP monitor vdev detach
  129. * @vdev: Datapath vdev handle
  130. *
  131. * Return: QDF_STATUS_SUCCESS: Success
  132. * QDF_STATUS_E_FAILURE: Error
  133. */
  134. QDF_STATUS dp_mon_vdev_detach(struct dp_vdev *vdev);
  135. /*
  136. * dp_mon_peer_attach() - DP monitor peer attach
  137. * @peer: Datapath peer handle
  138. *
  139. * Return: QDF_STATUS_SUCCESS: Success
  140. * QDF_STATUS_E_NOMEM: Error
  141. */
  142. #if defined(WLAN_TX_PKT_CAPTURE_ENH) || defined(FEATURE_PERPKT_INFO)
  143. QDF_STATUS dp_mon_peer_attach(struct dp_peer *peer);
  144. #else
  145. static inline
  146. QDF_STATUS dp_mon_peer_attach(struct dp_peer *peer)
  147. {
  148. return QDF_STATUS_SUCCESS;
  149. }
  150. #endif
  151. /*
  152. * dp_mon_peer_detach() - DP monitor peer detach
  153. * @peer: Datapath peer handle
  154. *
  155. * Return: QDF_STATUS_SUCCESS: Success
  156. * QDF_STATUS_E_FAILURE: Error
  157. */
  158. QDF_STATUS dp_mon_peer_detach(struct dp_peer *peer);
  159. /*
  160. * dp_mon_cdp_ops_register() - Register monitor cdp ops
  161. * @soc: Datapath soc handle
  162. *
  163. */
  164. void dp_mon_cdp_ops_register(struct dp_soc *soc);
  165. /*
  166. * dp_mon_cdp_ops_deregister() - deregister monitor cdp ops
  167. * @soc: Datapath soc handle
  168. *
  169. */
  170. void dp_mon_cdp_ops_deregister(struct dp_soc *soc);
  171. /*
  172. * dp_mon_intr_ops_deregister() - deregister monitor interrupt ops
  173. * @soc: Datapath soc handle
  174. *
  175. */
  176. void dp_mon_intr_ops_deregister(struct dp_soc *soc);
  177. /*
  178. * dp_mon_feature_ops_deregister() - deregister monitor feature ops
  179. * @soc: Datapath soc handle
  180. *
  181. */
  182. void dp_mon_feature_ops_deregister(struct dp_soc *soc);
  183. /*
  184. * dp_mon_ops_free() - free monitor ops
  185. * @soc: Datapath soc handle
  186. *
  187. */
  188. void dp_mon_ops_free(struct dp_soc *soc);
  189. /*
  190. * dp_mon_ops_register() - Register monitor ops
  191. * @soc: Datapath soc handle
  192. *
  193. */
  194. void dp_mon_ops_register(struct dp_soc *soc);
  195. #ifndef DISABLE_MON_CONFIG
  196. void dp_mon_register_intr_ops(struct dp_soc *soc);
  197. #else
  198. static inline void dp_mon_register_intr_ops(struct dp_soc *soc)
  199. {}
  200. #endif
  201. /*
  202. * dp_mon_htt_srng_setup() - DP mon htt srng setup
  203. * @soc: Datapath soc handle
  204. * @pdev: Datapath pdev handle
  205. * @mac_id: mac id
  206. * @mac_for_pdev: mac id mapped pdev
  207. *
  208. * Return: QDF_STATUS_SUCCESS: Success
  209. * QDF_STATUS_E_FAILURE: Error
  210. */
  211. QDF_STATUS dp_mon_htt_srng_setup(struct dp_soc *soc,
  212. struct dp_pdev *pdev,
  213. int mac_id,
  214. int mac_for_pdev);
  215. /*
  216. * dp_config_debug_sniffer()- API to enable/disable debug sniffer
  217. * @pdev: DP_PDEV handle
  218. * @val: user provided value
  219. *
  220. * Return: 0 for success. nonzero for failure.
  221. */
  222. #if defined(QCA_MCOPY_SUPPORT) || defined(QCA_TX_CAPTURE_SUPPORT)
  223. QDF_STATUS
  224. dp_config_debug_sniffer(struct dp_pdev *pdev, int val);
  225. #else
  226. static inline QDF_STATUS
  227. dp_config_debug_sniffer(struct dp_pdev *pdev, int val) {
  228. return QDF_STATUS_E_INVAL;
  229. }
  230. #endif /* QCA_MCOPY_SUPPORT || QCA_TX_CAPTURE_SUPPORT */
  231. /*
  232. * dp_htt_ppdu_stats_attach() - attach resources for HTT PPDU stats processing
  233. * @pdev: Datapath PDEV handle
  234. *
  235. * Return: QDF_STATUS_SUCCESS: Success
  236. * QDF_STATUS_E_NOMEM: Error
  237. */
  238. QDF_STATUS dp_htt_ppdu_stats_attach(struct dp_pdev *pdev);
  239. /*
  240. * dp_htt_ppdu_stats_detach() - detach stats resources
  241. * @pdev: Datapath PDEV handle
  242. *
  243. * Return: void
  244. */
  245. void dp_htt_ppdu_stats_detach(struct dp_pdev *pdev);
  246. /*
  247. *dp_set_bpr_enable() - API to enable/disable bpr feature
  248. *@pdev_handle: DP_PDEV handle.
  249. *@val: Provided value.
  250. *
  251. *Return: 0 for success. nonzero for failure.
  252. */
  253. #ifdef QCA_SUPPORT_BPR
  254. QDF_STATUS
  255. dp_set_bpr_enable(struct dp_pdev *pdev, int val);
  256. #endif
  257. #ifdef ATH_SUPPORT_NAC
  258. int dp_set_filter_neigh_peers(struct dp_pdev *pdev,
  259. bool val);
  260. #endif /* ATH_SUPPORT_NAC */
  261. #ifdef WLAN_ATF_ENABLE
  262. void dp_set_atf_stats_enable(struct dp_pdev *pdev, bool value);
  263. #endif
  264. /**
  265. * dp_set_bsscolor() - sets bsscolor for tx capture
  266. * @pdev: Datapath PDEV handle
  267. * @bsscolor: new bsscolor
  268. */
  269. void
  270. dp_mon_set_bsscolor(struct dp_pdev *pdev, uint8_t bsscolor);
  271. /**
  272. * dp_pdev_get_filter_ucast_data() - get DP PDEV monitor ucast filter
  273. * @soc : data path soc handle
  274. * @pdev_id : pdev_id
  275. * Return: true on ucast filter flag set
  276. */
  277. bool dp_pdev_get_filter_ucast_data(struct cdp_pdev *pdev_handle);
  278. /**
  279. * dp_pdev_get_filter_mcast_data() - get DP PDEV monitor mcast filter
  280. * @pdev_handle: Datapath PDEV handle
  281. * Return: true on mcast filter flag set
  282. */
  283. bool dp_pdev_get_filter_mcast_data(struct cdp_pdev *pdev_handle);
  284. /**
  285. * dp_pdev_get_filter_non_data() - get DP PDEV monitor non_data filter
  286. * @pdev_handle: Datapath PDEV handle
  287. * Return: true on non data filter flag set
  288. */
  289. bool dp_pdev_get_filter_non_data(struct cdp_pdev *pdev_handle);
  290. /*
  291. * dp_set_pktlog_wifi3() - attach txrx vdev
  292. * @pdev: Datapath PDEV handle
  293. * @event: which event's notifications are being subscribed to
  294. * @enable: WDI event subscribe or not. (True or False)
  295. *
  296. * Return: Success, NULL on failure
  297. */
  298. #ifdef WDI_EVENT_ENABLE
  299. int dp_set_pktlog_wifi3(struct dp_pdev *pdev, uint32_t event,
  300. bool enable);
  301. #endif
  302. /* MCL specific functions */
  303. #if defined(DP_CON_MON) && !defined(REMOVE_PKT_LOG)
  304. /**
  305. * dp_pktlogmod_exit() - API to cleanup pktlog info
  306. * @pdev: Pdev handle
  307. *
  308. * Return: none
  309. */
  310. void dp_pktlogmod_exit(struct dp_pdev *pdev);
  311. #else
  312. static inline
  313. void dp_pktlogmod_exit(struct dp_pdev *handle)
  314. {
  315. }
  316. #endif
  317. #ifdef QCA_MONITOR_PKT_SUPPORT
  318. /**
  319. * dp_vdev_set_monitor_mode_buf_rings () - set monitor mode buf rings
  320. *
  321. * Allocate SW descriptor pool, buffers, link descriptor memory
  322. * Initialize monitor related SRNGs
  323. *
  324. * @pdev: DP pdev object
  325. *
  326. * Return: void
  327. */
  328. void dp_vdev_set_monitor_mode_buf_rings(struct dp_pdev *pdev);
  329. /**
  330. * dp_vdev_set_monitor_mode_rings () - set monitor mode rings
  331. *
  332. * Allocate SW descriptor pool, buffers, link descriptor memory
  333. * Initialize monitor related SRNGs
  334. *
  335. * @pdev: DP pdev object
  336. *
  337. * Return: QDF_STATUS
  338. */
  339. QDF_STATUS dp_vdev_set_monitor_mode_rings(struct dp_pdev *pdev,
  340. uint8_t delayed_replenish);
  341. #else
  342. static inline void
  343. dp_vdev_set_monitor_mode_buf_rings(struct dp_pdev *pdev)
  344. {
  345. }
  346. static inline QDF_STATUS
  347. dp_vdev_set_monitor_mode_rings(struct dp_pdev *pdev,
  348. uint8_t delayed_replenish)
  349. {
  350. return QDF_STATUS_SUCCESS;
  351. }
  352. #endif
  353. #if defined(WDI_EVENT_ENABLE) &&\
  354. (defined(QCA_ENHANCED_STATS_SUPPORT) || !defined(REMOVE_PKT_LOG))
  355. /*
  356. * dp_ppdu_stats_ind_handler() - PPDU stats msg handler
  357. * @htt_soc: HTT SOC handle
  358. * @msg_word: Pointer to payload
  359. * @htt_t2h_msg: HTT msg nbuf
  360. *
  361. * Return: True if buffer should be freed by caller.
  362. */
  363. bool dp_ppdu_stats_ind_handler(struct htt_soc *soc,
  364. uint32_t *msg_word,
  365. qdf_nbuf_t htt_t2h_msg);
  366. #endif
  367. struct dp_mon_ops {
  368. QDF_STATUS (*mon_soc_cfg_init)(struct dp_soc *soc);
  369. QDF_STATUS (*mon_soc_attach)(struct dp_soc *soc);
  370. QDF_STATUS (*mon_soc_detach)(struct dp_soc *soc);
  371. QDF_STATUS (*mon_soc_init)(struct dp_soc *soc);
  372. QDF_STATUS (*mon_soc_deinit)(struct dp_soc *soc);
  373. QDF_STATUS (*mon_pdev_alloc)(struct dp_pdev *pdev);
  374. void (*mon_pdev_free)(struct dp_pdev *pdev);
  375. QDF_STATUS (*mon_pdev_attach)(struct dp_pdev *pdev);
  376. QDF_STATUS (*mon_pdev_detach)(struct dp_pdev *pdev);
  377. QDF_STATUS (*mon_pdev_init)(struct dp_pdev *pdev);
  378. QDF_STATUS (*mon_pdev_deinit)(struct dp_pdev *pdev);
  379. QDF_STATUS (*mon_vdev_attach)(struct dp_vdev *vdev);
  380. QDF_STATUS (*mon_vdev_detach)(struct dp_vdev *vdev);
  381. QDF_STATUS (*mon_peer_attach)(struct dp_peer *peer);
  382. QDF_STATUS (*mon_peer_detach)(struct dp_peer *peer);
  383. QDF_STATUS (*mon_config_debug_sniffer)(struct dp_pdev *pdev, int val);
  384. void (*mon_flush_rings)(struct dp_soc *soc);
  385. #if !defined(DISABLE_MON_CONFIG)
  386. QDF_STATUS (*mon_pdev_htt_srng_setup)(struct dp_soc *soc,
  387. struct dp_pdev *pdev,
  388. int mac_id,
  389. int mac_for_pdev);
  390. QDF_STATUS (*mon_soc_htt_srng_setup)(struct dp_soc *soc);
  391. #endif
  392. #if !defined(DISABLE_MON_CONFIG) && defined(MON_ENABLE_DROP_FOR_MAC)
  393. uint32_t (*mon_drop_packets_for_mac)(struct dp_pdev *pdev,
  394. uint32_t mac_id,
  395. uint32_t quota);
  396. #endif
  397. #if defined(DP_CON_MON)
  398. void (*mon_service_rings)(struct dp_soc *soc, uint32_t quota);
  399. #endif
  400. #ifndef DISABLE_MON_CONFIG
  401. uint32_t (*mon_rx_process)(struct dp_soc *soc,
  402. struct dp_intr *int_ctx,
  403. uint32_t mac_id,
  404. uint32_t quota);
  405. uint32_t (*mon_tx_process)(struct dp_soc *soc,
  406. struct dp_intr *int_ctx,
  407. uint32_t mac_id,
  408. uint32_t quota);
  409. #endif
  410. void (*mon_peer_tx_init)(struct dp_pdev *pdev, struct dp_peer *peer);
  411. void (*mon_peer_tx_cleanup)(struct dp_vdev *vdev,
  412. struct dp_peer *peer);
  413. #ifdef WLAN_TX_PKT_CAPTURE_ENH
  414. void (*mon_peer_tid_peer_id_update)(struct dp_peer *peer,
  415. uint16_t peer_id);
  416. void (*mon_tx_ppdu_stats_attach)(struct dp_pdev *pdev);
  417. void (*mon_tx_ppdu_stats_detach)(struct dp_pdev *pdev);
  418. QDF_STATUS (*mon_tx_capture_debugfs_init)(struct dp_pdev *pdev);
  419. void (*mon_peer_tx_capture_filter_check)(struct dp_pdev *pdev,
  420. struct dp_peer *peer);
  421. QDF_STATUS (*mon_tx_add_to_comp_queue)(struct dp_soc *soc,
  422. struct dp_tx_desc_s *desc,
  423. struct hal_tx_completion_status *ts,
  424. struct dp_peer *peer);
  425. QDF_STATUS (*mon_update_msdu_to_list)(struct dp_soc *soc,
  426. struct dp_pdev *pdev,
  427. struct dp_peer *peer,
  428. struct hal_tx_completion_status *ts,
  429. qdf_nbuf_t netbuf);
  430. #endif
  431. #if defined(WDI_EVENT_ENABLE) &&\
  432. (defined(QCA_ENHANCED_STATS_SUPPORT) || !defined(REMOVE_PKT_LOG))
  433. bool (*mon_ppdu_stats_ind_handler)(struct htt_soc *soc,
  434. uint32_t *msg_word,
  435. qdf_nbuf_t htt_t2h_msg);
  436. #endif
  437. QDF_STATUS (*mon_htt_ppdu_stats_attach)(struct dp_pdev *pdev);
  438. void (*mon_htt_ppdu_stats_detach)(struct dp_pdev *pdev);
  439. void (*mon_print_pdev_rx_mon_stats)(struct dp_pdev *pdev);
  440. #ifdef WLAN_TX_PKT_CAPTURE_ENH
  441. void (*mon_print_pdev_tx_capture_stats)(struct dp_pdev *pdev);
  442. QDF_STATUS (*mon_config_enh_tx_capture)(struct dp_pdev *pdev,
  443. uint8_t val);
  444. #endif
  445. #ifdef WLAN_RX_PKT_CAPTURE_ENH
  446. QDF_STATUS (*mon_config_enh_rx_capture)(struct dp_pdev *pdev,
  447. uint8_t val);
  448. #endif
  449. #ifdef QCA_SUPPORT_BPR
  450. QDF_STATUS (*mon_set_bpr_enable)(struct dp_pdev *pdev, int val);
  451. #endif
  452. #ifdef ATH_SUPPORT_NAC
  453. int (*mon_set_filter_neigh_peers)(struct dp_pdev *pdev, bool val);
  454. #endif
  455. #ifdef WLAN_ATF_ENABLE
  456. void (*mon_set_atf_stats_enable)(struct dp_pdev *pdev, bool value);
  457. #endif
  458. void (*mon_set_bsscolor)(struct dp_pdev *pdev, uint8_t bsscolor);
  459. bool (*mon_pdev_get_filter_ucast_data)(struct cdp_pdev *pdev_handle);
  460. bool (*mon_pdev_get_filter_non_data)(struct cdp_pdev *pdev_handle);
  461. bool (*mon_pdev_get_filter_mcast_data)(struct cdp_pdev *pdev_handle);
  462. #ifdef WDI_EVENT_ENABLE
  463. int (*mon_set_pktlog_wifi3)(struct dp_pdev *pdev, uint32_t event,
  464. bool enable);
  465. #endif
  466. #if defined(DP_CON_MON) && !defined(REMOVE_PKT_LOG)
  467. void (*mon_pktlogmod_exit)(struct dp_pdev *pdev);
  468. #endif
  469. void (*mon_vdev_set_monitor_mode_buf_rings)(struct dp_pdev *pdev);
  470. QDF_STATUS (*mon_vdev_set_monitor_mode_rings)(struct dp_pdev *pdev,
  471. uint8_t delayed_replenish);
  472. void (*mon_neighbour_peers_detach)(struct dp_pdev *pdev);
  473. #ifdef FEATURE_NAC_RSSI
  474. QDF_STATUS (*mon_filter_neighbour_peer)(struct dp_pdev *pdev,
  475. uint8_t *rx_pkt_hdr);
  476. #endif
  477. void (*mon_vdev_timer_init)(struct dp_soc *soc);
  478. void (*mon_vdev_timer_start)(struct dp_soc *soc);
  479. bool (*mon_vdev_timer_stop)(struct dp_soc *soc);
  480. void (*mon_vdev_timer_deinit)(struct dp_soc *soc);
  481. void (*mon_reap_timer_init)(struct dp_soc *soc);
  482. void (*mon_reap_timer_start)(struct dp_soc *soc);
  483. bool (*mon_reap_timer_stop)(struct dp_soc *soc);
  484. void (*mon_reap_timer_deinit)(struct dp_soc *soc);
  485. #ifdef QCA_MCOPY_SUPPORT
  486. QDF_STATUS (*mon_mcopy_check_deliver)(struct dp_pdev *pdev,
  487. uint16_t peer_id,
  488. uint32_t ppdu_id,
  489. uint8_t first_msdu);
  490. #endif
  491. void (*mon_neighbour_peer_add_ast)(struct dp_pdev *pdev,
  492. struct dp_peer *ta_peer,
  493. uint8_t *mac_addr,
  494. qdf_nbuf_t nbuf,
  495. uint32_t flags);
  496. #ifdef QCA_ENHANCED_STATS_SUPPORT
  497. void (*mon_filter_setup_enhanced_stats)(struct dp_pdev *pdev);
  498. void (*mon_filter_reset_enhanced_stats)(struct dp_pdev *pdev);
  499. void (*mon_tx_stats_update)(struct dp_peer *peer,
  500. struct cdp_tx_completion_ppdu_user *ppdu);
  501. #endif
  502. #ifdef QCA_MCOPY_SUPPORT
  503. void (*mon_filter_setup_mcopy_mode)(struct dp_pdev *pdev);
  504. void (*mon_filter_reset_mcopy_mode)(struct dp_pdev *pdev);
  505. #endif
  506. #if defined(ATH_SUPPORT_NAC_RSSI) || defined(ATH_SUPPORT_NAC)
  507. void (*mon_filter_setup_smart_monitor)(struct dp_pdev *pdev);
  508. void (*mon_filter_reset_smart_monitor)(struct dp_pdev *pdev);
  509. #endif
  510. #ifdef WLAN_RX_PKT_CAPTURE_ENH
  511. void (*mon_filter_setup_rx_enh_capture)(struct dp_pdev *pdev);
  512. void (*mon_filter_reset_rx_enh_capture)(struct dp_pdev *pdev);
  513. #endif
  514. void (*mon_filter_setup_mon_mode)(struct dp_pdev *pdev);
  515. void (*mon_filter_reset_mon_mode)(struct dp_pdev *pdev);
  516. #ifdef WDI_EVENT_ENABLE
  517. void (*mon_filter_setup_rx_pkt_log_full)(struct dp_pdev *pdev);
  518. void (*mon_filter_reset_rx_pkt_log_full)(struct dp_pdev *pdev);
  519. void (*mon_filter_setup_rx_pkt_log_lite)(struct dp_pdev *pdev);
  520. void (*mon_filter_reset_rx_pkt_log_lite)(struct dp_pdev *pdev);
  521. void (*mon_filter_setup_rx_pkt_log_cbf)(struct dp_pdev *pdev);
  522. void (*mon_filter_reset_rx_pkt_log_cbf)(struct dp_pdev *pdev);
  523. #ifdef QCA_WIFI_QCN9224
  524. void (*mon_filter_setup_pktlog_hybrid)(struct dp_pdev *pdev);
  525. void (*mon_filter_reset_pktlog_hybrid)(struct dp_pdev *pdev);
  526. #endif
  527. #endif
  528. QDF_STATUS (*mon_filter_update)(struct dp_pdev *pdev);
  529. QDF_STATUS (*mon_rings_alloc)(struct dp_pdev *pdev);
  530. void (*mon_rings_free)(struct dp_pdev *pdev);
  531. QDF_STATUS (*mon_rings_init)(struct dp_pdev *pdev);
  532. void (*mon_rings_deinit)(struct dp_pdev *pdev);
  533. QDF_STATUS (*rx_mon_buffers_alloc)(struct dp_pdev *pdev);
  534. void (*rx_mon_buffers_free)(struct dp_pdev *pdev);
  535. void (*rx_mon_desc_pool_init)(struct dp_pdev *pdev);
  536. void (*rx_mon_desc_pool_deinit)(struct dp_pdev *pdev);
  537. QDF_STATUS (*rx_mon_desc_pool_alloc)(struct dp_pdev *pdev);
  538. void (*rx_mon_desc_pool_free)(struct dp_pdev *pdev);
  539. void (*tx_mon_desc_pool_init)(struct dp_pdev *pdev);
  540. void (*tx_mon_desc_pool_deinit)(struct dp_pdev *pdev);
  541. QDF_STATUS (*tx_mon_desc_pool_alloc)(struct dp_pdev *pdev);
  542. void (*tx_mon_desc_pool_free)(struct dp_pdev *pdev);
  543. void (*rx_packet_length_set)(uint32_t *msg_word,
  544. struct htt_rx_ring_tlv_filter *tlv_filter);
  545. void (*rx_wmask_subscribe)(uint32_t *msg_word,
  546. struct htt_rx_ring_tlv_filter *tlv_filter);
  547. void (*rx_enable_mpdu_logging)(uint32_t *msg_word,
  548. struct htt_rx_ring_tlv_filter *tlv_filter);
  549. #ifndef DISABLE_MON_CONFIG
  550. void (*mon_register_intr_ops)(struct dp_soc *soc);
  551. #endif
  552. void (*mon_register_feature_ops)(struct dp_soc *soc);
  553. #ifdef QCA_ENHANCED_STATS_SUPPORT
  554. void (*mon_rx_stats_update)(struct dp_peer *peer,
  555. struct cdp_rx_indication_ppdu *ppdu,
  556. struct cdp_rx_stats_ppdu_user *ppdu_user);
  557. void (*mon_rx_populate_ppdu_usr_info)(struct mon_rx_user_status *rx_user_status,
  558. struct cdp_rx_stats_ppdu_user *ppdu_user);
  559. void (*mon_rx_populate_ppdu_info)(struct hal_rx_ppdu_info *hal_ppdu_info,
  560. struct cdp_rx_indication_ppdu *ppdu);
  561. #endif
  562. QDF_STATUS (*rx_mon_refill_buf_ring)(struct dp_intr *int_ctx);
  563. QDF_STATUS (*tx_mon_refill_buf_ring)(struct dp_intr *int_ctx);
  564. };
  565. struct dp_mon_soc {
  566. /* Holds all monitor related fields extracted from dp_soc */
  567. /* Holds pointer to monitor ops */
  568. /* monitor link descriptor pages */
  569. struct qdf_mem_multi_page_t mon_link_desc_pages[MAX_NUM_LMAC_HW];
  570. /* total link descriptors for monitor mode for each radio */
  571. uint32_t total_mon_link_descs[MAX_NUM_LMAC_HW];
  572. /* Monitor Link descriptor memory banks */
  573. struct link_desc_bank
  574. mon_link_desc_banks[MAX_NUM_LMAC_HW][MAX_MON_LINK_DESC_BANKS];
  575. uint32_t num_mon_link_desc_banks[MAX_NUM_LMAC_HW];
  576. /* Smart monitor capability for HKv2 */
  577. uint8_t hw_nac_monitor_support;
  578. /* Full monitor mode support */
  579. bool full_mon_mode;
  580. /*interrupt timer*/
  581. qdf_timer_t mon_reap_timer;
  582. uint8_t reap_timer_init;
  583. qdf_timer_t mon_vdev_timer;
  584. uint8_t mon_vdev_timer_state;
  585. struct dp_mon_ops *mon_ops;
  586. bool monitor_mode_v2;
  587. #ifndef DISABLE_MON_CONFIG
  588. uint32_t (*mon_rx_process)(struct dp_soc *soc,
  589. struct dp_intr *int_ctx,
  590. uint32_t mac_id,
  591. uint32_t quota);
  592. #endif
  593. };
  594. struct dp_mon_pdev {
  595. /* monitor */
  596. bool monitor_configured;
  597. struct dp_mon_filter **filter; /* Monitor Filter pointer */
  598. /* advance filter mode and type*/
  599. uint8_t mon_filter_mode;
  600. uint16_t fp_mgmt_filter;
  601. uint16_t fp_ctrl_filter;
  602. uint16_t fp_data_filter;
  603. uint16_t mo_mgmt_filter;
  604. uint16_t mo_ctrl_filter;
  605. uint16_t mo_data_filter;
  606. uint16_t md_data_filter;
  607. #ifdef WLAN_TX_PKT_CAPTURE_ENH
  608. struct dp_pdev_tx_capture tx_capture;
  609. bool stop_tx_capture_work_q_timer;
  610. #endif
  611. /* tx packet capture enhancement */
  612. enum cdp_tx_enh_capture_mode tx_capture_enabled;
  613. /* Stuck count on monitor destination ring MPDU process */
  614. uint32_t mon_dest_ring_stuck_cnt;
  615. /* monitor mode lock */
  616. qdf_spinlock_t mon_lock;
  617. /* Monitor mode operation channel */
  618. int mon_chan_num;
  619. /* Monitor mode operation frequency */
  620. qdf_freq_t mon_chan_freq;
  621. /* Monitor mode band */
  622. enum reg_wifi_band mon_chan_band;
  623. uint32_t mon_ppdu_status;
  624. /* monitor mode status/destination ring PPDU and MPDU count */
  625. struct cdp_pdev_mon_stats rx_mon_stats;
  626. /* Monitor mode interface and status storage */
  627. struct dp_vdev *mvdev;
  628. struct cdp_mon_status rx_mon_recv_status;
  629. /* to track duplicate link descriptor indications by HW for a WAR */
  630. uint64_t mon_last_linkdesc_paddr;
  631. /* to track duplicate buffer indications by HW for a WAR */
  632. uint32_t mon_last_buf_cookie;
  633. #ifdef QCA_SUPPORT_FULL_MON
  634. /* List to maintain all MPDUs for a PPDU in monitor mode */
  635. TAILQ_HEAD(, dp_mon_mpdu) mon_mpdu_q;
  636. /* TODO: define per-user mpdu list
  637. * struct dp_mon_mpdu_list mpdu_list[MAX_MU_USERS];
  638. */
  639. struct hal_rx_mon_desc_info *mon_desc;
  640. #endif
  641. /* Flag to hold on to monitor destination ring */
  642. bool hold_mon_dest_ring;
  643. /* Flag to inidicate monitor rings are initialized */
  644. uint8_t pdev_mon_init;
  645. #ifndef REMOVE_PKT_LOG
  646. bool pkt_log_init;
  647. struct pktlog_dev_t *pl_dev; /* Pktlog pdev */
  648. #endif /* #ifndef REMOVE_PKT_LOG */
  649. /* Smart Mesh */
  650. bool filter_neighbour_peers;
  651. /*flag to indicate neighbour_peers_list not empty */
  652. bool neighbour_peers_added;
  653. /* smart mesh mutex */
  654. qdf_spinlock_t neighbour_peer_mutex;
  655. /* Neighnour peer list */
  656. TAILQ_HEAD(, dp_neighbour_peer) neighbour_peers_list;
  657. /* Enhanced Stats is enabled */
  658. bool enhanced_stats_en;
  659. qdf_nbuf_queue_t rx_status_q;
  660. /* 128 bytes mpdu header queue per user for ppdu */
  661. qdf_nbuf_queue_t mpdu_q[MAX_MU_USERS];
  662. /* is this a mpdu header TLV and not msdu header TLV */
  663. bool is_mpdu_hdr[MAX_MU_USERS];
  664. /* per user 128 bytes msdu header list for MPDU */
  665. struct msdu_list msdu_list[MAX_MU_USERS];
  666. /* RX enhanced capture mode */
  667. uint8_t rx_enh_capture_mode;
  668. /* Rx per peer enhanced capture mode */
  669. bool rx_enh_capture_peer;
  670. struct dp_vdev *rx_enh_monitor_vdev;
  671. /* RX enhanced capture trailer enable/disable flag */
  672. bool is_rx_enh_capture_trailer_enabled;
  673. #ifdef WLAN_RX_PKT_CAPTURE_ENH
  674. /* RX per MPDU/PPDU information */
  675. struct cdp_rx_indication_mpdu mpdu_ind;
  676. #endif
  677. /* Packet log mode */
  678. uint8_t rx_pktlog_mode;
  679. /* Enable pktlog logging cbf */
  680. bool rx_pktlog_cbf;
  681. /* Enable pktlog logging hybrid */
  682. #ifdef QCA_WIFI_QCN9224
  683. bool pktlog_hybrid_mode;
  684. #endif
  685. bool tx_sniffer_enable;
  686. /* mirror copy mode */
  687. enum m_copy_mode mcopy_mode;
  688. bool enable_reap_timer_non_pkt;
  689. bool bpr_enable;
  690. /* Pdev level flag to check peer based pktlog enabled or
  691. * disabled
  692. */
  693. uint8_t dp_peer_based_pktlog;
  694. #ifdef WLAN_ATF_ENABLE
  695. /* ATF stats enable */
  696. bool dp_atf_stats_enable;
  697. #endif
  698. /* Maintains first status buffer's paddr of a PPDU */
  699. uint64_t status_buf_addr;
  700. struct hal_rx_ppdu_info ppdu_info;
  701. /* ppdu_id of last received HTT TX stats */
  702. uint32_t last_ppdu_id;
  703. struct {
  704. uint8_t last_user;
  705. qdf_nbuf_t buf;
  706. } tx_ppdu_info;
  707. struct {
  708. uint32_t tx_ppdu_id;
  709. uint16_t tx_peer_id;
  710. uint32_t rx_ppdu_id;
  711. } m_copy_id;
  712. /* To check if PPDU Tx stats are enabled for Pktlog */
  713. bool pktlog_ppdu_stats;
  714. #ifdef ATH_SUPPORT_NAC_RSSI
  715. bool nac_rssi_filtering;
  716. #endif
  717. /* ppdu_stats lock for queue concurrency between cores*/
  718. qdf_spinlock_t ppdu_stats_lock;
  719. /* list of ppdu tlvs */
  720. TAILQ_HEAD(, ppdu_info) ppdu_info_list;
  721. TAILQ_HEAD(, ppdu_info) sched_comp_ppdu_list;
  722. uint32_t sched_comp_list_depth;
  723. uint16_t delivered_sched_cmdid;
  724. uint16_t last_sched_cmdid;
  725. uint32_t tlv_count;
  726. uint32_t list_depth;
  727. struct {
  728. qdf_nbuf_t last_nbuf; /*Ptr to mgmt last buf */
  729. uint8_t *mgmt_buf; /* Ptr to mgmt. payload in HTT ppdu stats */
  730. uint32_t mgmt_buf_len; /* Len of mgmt. payload in ppdu stats */
  731. uint32_t ppdu_id;
  732. } mgmtctrl_frm_info;
  733. /* Context of cal client timer */
  734. struct cdp_cal_client *cal_client_ctx;
  735. uint32_t *ppdu_tlv_buf; /* Buffer to hold HTT ppdu stats TLVs*/
  736. qdf_nbuf_t mcopy_status_nbuf;
  737. bool is_dp_mon_pdev_initialized;
  738. /* indicates if spcl vap is configured */
  739. bool scan_spcl_vap_configured;
  740. #ifdef QCA_SUPPORT_SCAN_SPCL_VAP_STATS
  741. /* enable spcl vap stats reset on ch change */
  742. bool reset_scan_spcl_vap_stats_enable;
  743. #endif
  744. bool is_tlv_hdr_64_bit;
  745. };
  746. struct dp_mon_vdev {
  747. /* callback to hand rx monitor 802.11 MPDU to the OS shim */
  748. ol_txrx_rx_mon_fp osif_rx_mon;
  749. #ifdef QCA_SUPPORT_SCAN_SPCL_VAP_STATS
  750. struct cdp_scan_spcl_vap_stats *scan_spcl_vap_stats;
  751. #endif
  752. };
  753. struct dp_mon_peer {
  754. #ifdef WLAN_TX_PKT_CAPTURE_ENH
  755. struct dp_peer_tx_capture tx_capture;
  756. #endif
  757. #ifdef FEATURE_PERPKT_INFO
  758. /* delayed ba ppdu stats handling */
  759. struct cdp_delayed_tx_completion_ppdu_user delayed_ba_ppdu_stats;
  760. /* delayed ba flag */
  761. bool last_delayed_ba;
  762. /* delayed ba ppdu id */
  763. uint32_t last_delayed_ba_ppduid;
  764. #endif
  765. };
  766. #if defined(QCA_TX_CAPTURE_SUPPORT) || defined(QCA_ENHANCED_STATS_SUPPORT)
  767. void dp_deliver_mgmt_frm(struct dp_pdev *pdev, qdf_nbuf_t nbuf);
  768. #else
  769. static inline
  770. void dp_deliver_mgmt_frm(struct dp_pdev *pdev, qdf_nbuf_t nbuf)
  771. {
  772. }
  773. #endif
  774. #if defined(WLAN_SUPPORT_RX_PROTOCOL_TYPE_TAG) ||\
  775. defined(WLAN_SUPPORT_RX_FLOW_TAG)
  776. /**
  777. * dp_rx_mon_update_protocol_flow_tag() - Performs necessary checks for monitor
  778. * mode and then tags appropriate packets
  779. * @soc: core txrx main context
  780. * @vdev: pdev on which packet is received
  781. * @msdu: QDF packet buffer on which the protocol tag should be set
  782. * @rx_desc: base address where the RX TLVs start
  783. * Return: void
  784. */
  785. void dp_rx_mon_update_protocol_flow_tag(struct dp_soc *soc,
  786. struct dp_pdev *dp_pdev,
  787. qdf_nbuf_t msdu, void *rx_desc);
  788. #endif /* WLAN_SUPPORT_RX_PROTOCOL_TYPE_TAG || WLAN_SUPPORT_RX_FLOW_TAG */
  789. #if !defined(WLAN_SUPPORT_RX_PROTOCOL_TYPE_TAG) &&\
  790. !defined(WLAN_SUPPORT_RX_FLOW_TAG)
  791. /**
  792. * dp_rx_mon_update_protocol_flow_tag() - Performs necessary checks for monitor
  793. * mode and then tags appropriate packets
  794. * @soc: core txrx main context
  795. * @vdev: pdev on which packet is received
  796. * @msdu: QDF packet buffer on which the protocol tag should be set
  797. * @rx_desc: base address where the RX TLVs start
  798. * Return: void
  799. */
  800. static inline
  801. void dp_rx_mon_update_protocol_flow_tag(struct dp_soc *soc,
  802. struct dp_pdev *dp_pdev,
  803. qdf_nbuf_t msdu, void *rx_desc)
  804. {
  805. }
  806. #endif /* WLAN_SUPPORT_RX_PROTOCOL_TYPE_TAG || WLAN_SUPPORT_RX_FLOW_TAG */
  807. #ifndef WLAN_TX_PKT_CAPTURE_ENH
  808. static inline
  809. QDF_STATUS dp_peer_set_tx_capture_enabled(struct dp_pdev *pdev,
  810. struct dp_peer *peer_handle,
  811. uint8_t value, uint8_t *peer_mac)
  812. {
  813. return QDF_STATUS_SUCCESS;
  814. }
  815. /**
  816. * dp_peer_tid_queue_init() – Initialize ppdu stats queue per TID
  817. * @peer: Datapath peer
  818. *
  819. */
  820. static inline void dp_peer_tid_queue_init(struct dp_peer *peer)
  821. {
  822. }
  823. /**
  824. * dp_peer_tid_queue_cleanup() – remove ppdu stats queue per TID
  825. * @peer: Datapath peer
  826. *
  827. */
  828. static inline void dp_peer_tid_queue_cleanup(struct dp_peer *peer)
  829. {
  830. }
  831. /**
  832. * dp_peer_update_80211_hdr() – dp peer update 80211 hdr
  833. * @vdev: Datapath vdev
  834. * @peer: Datapath peer
  835. *
  836. */
  837. static inline void
  838. dp_peer_update_80211_hdr(struct dp_vdev *vdev, struct dp_peer *peer)
  839. {
  840. }
  841. /**
  842. * dp_tx_ppdu_stats_attach - Initialize Tx PPDU stats and enhanced capture
  843. * @pdev: DP PDEV
  844. *
  845. * Return: none
  846. */
  847. static inline void dp_tx_ppdu_stats_attach(struct dp_pdev *pdev)
  848. {
  849. }
  850. /**
  851. * dp_tx_ppdu_stats_detach - Cleanup Tx PPDU stats and enhanced capture
  852. * @pdev: DP PDEV
  853. *
  854. * Return: none
  855. */
  856. static inline void dp_tx_ppdu_stats_detach(struct dp_pdev *pdev)
  857. {
  858. }
  859. /**
  860. * dp_tx_add_to_comp_queue() - add completion msdu to queue
  861. * @soc: DP Soc handle
  862. * @tx_desc: software Tx descriptor
  863. * @ts : Tx completion status from HAL/HTT descriptor
  864. * @peer: DP peer
  865. *
  866. * Return: none
  867. */
  868. static inline
  869. QDF_STATUS dp_tx_add_to_comp_queue(struct dp_soc *soc,
  870. struct dp_tx_desc_s *desc,
  871. struct hal_tx_completion_status *ts,
  872. struct dp_peer *peer)
  873. {
  874. return QDF_STATUS_E_FAILURE;
  875. }
  876. /**
  877. * dp_update_msdu_to_list(): Function to queue msdu from wbm
  878. * @pdev: dp_pdev
  879. * @peer: dp_peer
  880. * @ts: hal tx completion status
  881. * @netbuf: msdu
  882. *
  883. * return: status
  884. */
  885. static inline
  886. QDF_STATUS dp_update_msdu_to_list(struct dp_soc *soc,
  887. struct dp_pdev *pdev,
  888. struct dp_peer *peer,
  889. struct hal_tx_completion_status *ts,
  890. qdf_nbuf_t netbuf)
  891. {
  892. return QDF_STATUS_E_FAILURE;
  893. }
  894. /*
  895. * dp_peer_tx_capture_filter_check: check filter is enable for the filter
  896. * and update tx_cap_enabled flag
  897. * @pdev: DP PDEV handle
  898. * @peer: DP PEER handle
  899. *
  900. * return: void
  901. */
  902. static inline
  903. void dp_peer_tx_capture_filter_check(struct dp_pdev *pdev,
  904. struct dp_peer *peer)
  905. {
  906. }
  907. /*
  908. * dp_tx_capture_debugfs_init: tx capture debugfs init
  909. * @pdev: DP PDEV handle
  910. *
  911. * return: QDF_STATUS
  912. */
  913. static inline
  914. QDF_STATUS dp_tx_capture_debugfs_init(struct dp_pdev *pdev)
  915. {
  916. return QDF_STATUS_E_FAILURE;
  917. }
  918. #endif
  919. #ifdef WLAN_TX_PKT_CAPTURE_ENH
  920. extern uint8_t
  921. dp_cpu_ring_map[DP_NSS_CPU_RING_MAP_MAX][WLAN_CFG_INT_NUM_CONTEXTS_MAX];
  922. #endif
  923. int
  924. dp_htt_get_ppdu_sniffer_ampdu_tlv_bitmap(uint32_t bitmap);
  925. #ifdef WDI_EVENT_ENABLE
  926. void dp_pkt_log_init(struct cdp_soc_t *soc_hdl, uint8_t pdev_id, void *scn);
  927. #else
  928. static inline void
  929. dp_pkt_log_init(struct cdp_soc_t *soc_hdl, uint8_t pdev_id, void *scn)
  930. {
  931. }
  932. #endif
  933. #ifdef WDI_EVENT_ENABLE
  934. QDF_STATUS dp_peer_stats_notify(struct dp_pdev *pdev, struct dp_peer *peer);
  935. #else
  936. static inline QDF_STATUS dp_peer_stats_notify(struct dp_pdev *pdev,
  937. struct dp_peer *peer)
  938. {
  939. return QDF_STATUS_SUCCESS;
  940. }
  941. #endif
  942. #ifndef WLAN_TX_PKT_CAPTURE_ENH
  943. /**
  944. * dp_tx_ppdu_stats_process - Deferred PPDU stats handler
  945. * @context: Opaque work context (PDEV)
  946. *
  947. * Return: none
  948. */
  949. static inline void dp_tx_ppdu_stats_process(void *context)
  950. {
  951. }
  952. /*
  953. * dp_tx_capture_htt_frame_counter: increment counter for htt_frame_type
  954. * pdev: DP pdev handle
  955. * htt_frame_type: htt frame type received from fw
  956. *
  957. * return: void
  958. */
  959. static inline
  960. void dp_tx_capture_htt_frame_counter(struct dp_pdev *pdev,
  961. uint32_t htt_frame_type)
  962. {
  963. }
  964. /*
  965. * dp_tx_cature_stats: print tx capture stats
  966. * @pdev: DP PDEV handle
  967. *
  968. * return: void
  969. */
  970. static inline
  971. void dp_print_pdev_tx_capture_stats(struct dp_pdev *pdev)
  972. {
  973. }
  974. #endif
  975. /**
  976. * dp_rx_cookie_2_mon_link_desc_va() - Converts cookie to a virtual address of
  977. * the MSDU Link Descriptor
  978. * @pdev: core txrx pdev context
  979. * @buf_info: buf_info includes cookie that used to lookup virtual address of
  980. * link descriptor. Normally this is just an index into a per pdev array.
  981. *
  982. * This is the VA of the link descriptor in monitor mode destination ring,
  983. * that HAL layer later uses to retrieve the list of MSDU's for a given MPDU.
  984. *
  985. * Return: void *: Virtual Address of the Rx descriptor
  986. */
  987. static inline
  988. void *dp_rx_cookie_2_mon_link_desc_va(struct dp_pdev *pdev,
  989. struct hal_buf_info *buf_info,
  990. int mac_id)
  991. {
  992. void *link_desc_va;
  993. struct qdf_mem_multi_page_t *pages;
  994. uint16_t page_id = LINK_DESC_COOKIE_PAGE_ID(buf_info->sw_cookie);
  995. struct dp_mon_soc *mon_soc = pdev->soc->monitor_soc;
  996. if (!mon_soc)
  997. return NULL;
  998. pages = &mon_soc->mon_link_desc_pages[mac_id];
  999. if (!pages)
  1000. return NULL;
  1001. if (qdf_unlikely(page_id >= pages->num_pages))
  1002. return NULL;
  1003. link_desc_va = pages->dma_pages[page_id].page_v_addr_start +
  1004. (buf_info->paddr - pages->dma_pages[page_id].page_p_addr);
  1005. return link_desc_va;
  1006. }
  1007. /**
  1008. * dp_soc_is_full_mon_enable () - Return if full monitor mode is enabled
  1009. * @soc: DP soc handle
  1010. *
  1011. * Return: Full monitor mode status
  1012. */
  1013. static inline bool dp_soc_is_full_mon_enable(struct dp_pdev *pdev)
  1014. {
  1015. return (pdev->soc->monitor_soc->full_mon_mode &&
  1016. pdev->monitor_pdev->monitor_configured) ? true : false;
  1017. }
  1018. /*
  1019. * dp_mon_is_enable_reap_timer_non_pkt() - check if mon reap timer is
  1020. * enabled by non-pkt log or not
  1021. * @pdev: point to dp pdev
  1022. *
  1023. * Return: true if mon reap timer is enabled by non-pkt log
  1024. */
  1025. static inline bool dp_mon_is_enable_reap_timer_non_pkt(struct dp_pdev *pdev)
  1026. {
  1027. if (qdf_unlikely(!pdev || !pdev->monitor_pdev))
  1028. return false;
  1029. return pdev->monitor_pdev->enable_reap_timer_non_pkt;
  1030. }
  1031. /*
  1032. * dp_monitor_is_enable_mcopy_mode() - check if mcopy mode is enabled
  1033. * @pdev: point to dp pdev
  1034. *
  1035. * Return: true if mcopy mode is enabled
  1036. */
  1037. static inline bool dp_monitor_is_enable_mcopy_mode(struct dp_pdev *pdev)
  1038. {
  1039. if (qdf_unlikely(!pdev || !pdev->monitor_pdev))
  1040. return false;
  1041. return pdev->monitor_pdev->mcopy_mode;
  1042. }
  1043. /*
  1044. * dp_monitor_is_enable_tx_sniffer() - check if tx sniffer is enabled
  1045. * @pdev: point to dp pdev
  1046. *
  1047. * Return: true if tx sniffer is enabled
  1048. */
  1049. static inline bool dp_monitor_is_enable_tx_sniffer(struct dp_pdev *pdev)
  1050. {
  1051. if (qdf_unlikely(!pdev || !pdev->monitor_pdev))
  1052. return false;
  1053. return pdev->monitor_pdev->tx_sniffer_enable;
  1054. }
  1055. /*
  1056. * dp_monitor_is_set_monitor_configured() - check if monitor configured is set
  1057. * @pdev: point to dp pdev
  1058. *
  1059. * Return: true if monitor configured is set
  1060. */
  1061. static inline bool dp_monitor_is_configured(struct dp_pdev *pdev)
  1062. {
  1063. if (qdf_unlikely(!pdev || !pdev->monitor_pdev))
  1064. return false;
  1065. return pdev->monitor_pdev->monitor_configured;
  1066. }
  1067. /*
  1068. * dp_monitor_check_com_info_ppdu_id() - check if msdu ppdu_id matches with
  1069. * com info ppdu_id
  1070. * @pdev: point to dp pdev
  1071. * @rx_desc: point to rx_desc
  1072. *
  1073. * Return: success if ppdu_id matches
  1074. */
  1075. static inline QDF_STATUS dp_monitor_check_com_info_ppdu_id(struct dp_pdev *pdev,
  1076. void *rx_desc)
  1077. {
  1078. struct cdp_mon_status *rs;
  1079. struct dp_mon_pdev *mon_pdev;
  1080. uint32_t msdu_ppdu_id = 0;
  1081. if (qdf_unlikely(!pdev || !pdev->monitor_pdev))
  1082. return QDF_STATUS_E_FAILURE;
  1083. mon_pdev = pdev->monitor_pdev;
  1084. if (qdf_likely(1 != mon_pdev->ppdu_info.rx_status.rxpcu_filter_pass))
  1085. return QDF_STATUS_E_FAILURE;
  1086. rs = &pdev->monitor_pdev->rx_mon_recv_status;
  1087. if (!rs || rs->cdp_rs_rxdma_err)
  1088. return QDF_STATUS_E_FAILURE;
  1089. msdu_ppdu_id = hal_rx_get_ppdu_id(pdev->soc->hal_soc, rx_desc);
  1090. if (msdu_ppdu_id != mon_pdev->ppdu_info.com_info.ppdu_id) {
  1091. QDF_TRACE(QDF_MODULE_ID_DP,
  1092. QDF_TRACE_LEVEL_ERROR,
  1093. "msdu_ppdu_id=%x,com_info.ppdu_id=%x",
  1094. msdu_ppdu_id,
  1095. mon_pdev->ppdu_info.com_info.ppdu_id);
  1096. return QDF_STATUS_E_FAILURE;
  1097. }
  1098. return QDF_STATUS_SUCCESS;
  1099. }
  1100. /*
  1101. * dp_monitor_get_rx_status() - get rx status
  1102. * @pdev: point to dp pdev
  1103. *
  1104. * Return: return rx status pointer
  1105. */
  1106. static inline struct mon_rx_status*
  1107. dp_monitor_get_rx_status(struct dp_pdev *pdev)
  1108. {
  1109. if (qdf_unlikely(!pdev || !pdev->monitor_pdev))
  1110. return NULL;
  1111. return &pdev->monitor_pdev->ppdu_info.rx_status;
  1112. }
  1113. /*
  1114. * dp_monitor_is_chan_band_known() - check if monitor chan band known
  1115. * @pdev: point to dp pdev
  1116. *
  1117. * Return: true if chan band known
  1118. */
  1119. static inline bool dp_monitor_is_chan_band_known(struct dp_pdev *pdev)
  1120. {
  1121. if (qdf_unlikely(!pdev || !pdev->monitor_pdev))
  1122. return false;
  1123. if (pdev->monitor_pdev->mon_chan_band != REG_BAND_UNKNOWN)
  1124. return true;
  1125. return false;
  1126. }
  1127. /*
  1128. * dp_monitor_get_chan_band() - get chan band
  1129. * @pdev: point to dp pdev
  1130. *
  1131. * Return: wifi channel band
  1132. */
  1133. static inline enum reg_wifi_band
  1134. dp_monitor_get_chan_band(struct dp_pdev *pdev)
  1135. {
  1136. return pdev->monitor_pdev->mon_chan_band;
  1137. }
  1138. /*
  1139. * dp_monitor_print_tx_stats() - print tx stats from monitor pdev
  1140. * @pdev: point to dp pdev
  1141. *
  1142. */
  1143. static inline void dp_monitor_print_tx_stats(struct dp_pdev *pdev)
  1144. {
  1145. if (qdf_unlikely(!pdev || !pdev->monitor_pdev))
  1146. return;
  1147. DP_PRINT_STATS("ppdu info schedule completion list depth: %d",
  1148. pdev->monitor_pdev->sched_comp_list_depth);
  1149. DP_PRINT_STATS("delivered sched cmdid: %d",
  1150. pdev->monitor_pdev->delivered_sched_cmdid);
  1151. DP_PRINT_STATS("cur sched cmdid: %d",
  1152. pdev->monitor_pdev->last_sched_cmdid);
  1153. DP_PRINT_STATS("ppdu info list depth: %d",
  1154. pdev->monitor_pdev->list_depth);
  1155. }
  1156. /*
  1157. * dp_monitor_set_chan_num() - set channel number
  1158. * @pdev: point to dp pdev
  1159. * @chan_num: channel number
  1160. *
  1161. */
  1162. static inline void dp_monitor_set_chan_num(struct dp_pdev *pdev, int chan_num)
  1163. {
  1164. if (qdf_unlikely(!pdev || !pdev->monitor_pdev))
  1165. return;
  1166. pdev->monitor_pdev->mon_chan_num = chan_num;
  1167. }
  1168. /*
  1169. * dp_monitor_set_chan_freq() - set channel frequency
  1170. * @pdev: point to dp pdev
  1171. * @chan_freq: channel frequency
  1172. *
  1173. */
  1174. static inline void
  1175. dp_monitor_set_chan_freq(struct dp_pdev *pdev, qdf_freq_t chan_freq)
  1176. {
  1177. if (qdf_unlikely(!pdev || !pdev->monitor_pdev))
  1178. return;
  1179. pdev->monitor_pdev->mon_chan_freq = chan_freq;
  1180. }
  1181. /*
  1182. * dp_monitor_set_chan_band() - set channel band
  1183. * @pdev: point to dp pdev
  1184. * @chan_band: channel band
  1185. *
  1186. */
  1187. static inline void
  1188. dp_monitor_set_chan_band(struct dp_pdev *pdev, enum reg_wifi_band chan_band)
  1189. {
  1190. if (qdf_unlikely(!pdev || !pdev->monitor_pdev))
  1191. return;
  1192. pdev->monitor_pdev->mon_chan_band = chan_band;
  1193. }
  1194. /*
  1195. * dp_monitor_get_mpdu_status() - get mpdu status
  1196. * @pdev: point to dp pdev
  1197. * @soc: point to dp soc
  1198. * @rx_tlv_hdr: point to rx tlv header
  1199. *
  1200. */
  1201. static inline void dp_monitor_get_mpdu_status(struct dp_pdev *pdev,
  1202. struct dp_soc *soc,
  1203. uint8_t *rx_tlv_hdr)
  1204. {
  1205. struct dp_mon_pdev *mon_pdev;
  1206. if (qdf_unlikely(!pdev || !pdev->monitor_pdev))
  1207. return;
  1208. mon_pdev = pdev->monitor_pdev;
  1209. hal_rx_mon_hw_desc_get_mpdu_status(soc->hal_soc, rx_tlv_hdr,
  1210. &mon_pdev->ppdu_info.rx_status);
  1211. }
  1212. #ifdef FEATURE_NAC_RSSI
  1213. /*
  1214. * dp_monitor_drop_inv_peer_pkts() - drop invalid peer pkts
  1215. * @vdev: point to dp vdev
  1216. *
  1217. * Return: success if sta mode and filter for neighbour peers enabled
  1218. */
  1219. static inline QDF_STATUS dp_monitor_drop_inv_peer_pkts(struct dp_vdev *vdev)
  1220. {
  1221. struct dp_pdev *pdev = vdev->pdev;
  1222. struct dp_soc *soc = pdev->soc;
  1223. if (!soc->monitor_soc)
  1224. return QDF_STATUS_E_FAILURE;
  1225. if (!soc->monitor_soc->hw_nac_monitor_support &&
  1226. pdev->monitor_pdev->filter_neighbour_peers &&
  1227. vdev->opmode == wlan_op_mode_sta)
  1228. return QDF_STATUS_SUCCESS;
  1229. return QDF_STATUS_E_FAILURE;
  1230. }
  1231. #endif
  1232. /*
  1233. * dp_peer_ppdu_delayed_ba_init() - Initialize ppdu in peer
  1234. * @peer: Datapath peer
  1235. *
  1236. * return: void
  1237. */
  1238. #ifdef FEATURE_PERPKT_INFO
  1239. static inline void dp_peer_ppdu_delayed_ba_init(struct dp_peer *peer)
  1240. {
  1241. struct dp_mon_peer *mon_peer = peer->monitor_peer;
  1242. if (!mon_peer)
  1243. return;
  1244. qdf_mem_zero(&mon_peer->delayed_ba_ppdu_stats,
  1245. sizeof(struct cdp_delayed_tx_completion_ppdu_user));
  1246. mon_peer->last_delayed_ba = false;
  1247. mon_peer->last_delayed_ba_ppduid = 0;
  1248. }
  1249. #else
  1250. static inline void dp_peer_ppdu_delayed_ba_init(struct dp_peer *peer)
  1251. {
  1252. }
  1253. #endif
  1254. /*
  1255. * dp_monitor_vdev_register_osif() - Register osif rx mon
  1256. * @vdev: point to vdev
  1257. * @txrx_ops: point to ol txrx ops
  1258. *
  1259. * Return: void
  1260. */
  1261. static inline void dp_monitor_vdev_register_osif(struct dp_vdev *vdev,
  1262. struct ol_txrx_ops *txrx_ops)
  1263. {
  1264. if (!vdev->monitor_vdev)
  1265. return;
  1266. vdev->monitor_vdev->osif_rx_mon = txrx_ops->rx.mon;
  1267. }
  1268. /*
  1269. * dp_monitor_get_monitor_vdev_from_pdev() - Get monitor vdev
  1270. * @pdev: point to pdev
  1271. *
  1272. * Return: pointer to vdev
  1273. */
  1274. static inline struct dp_vdev*
  1275. dp_monitor_get_monitor_vdev_from_pdev(struct dp_pdev *pdev)
  1276. {
  1277. if (!pdev || !pdev->monitor_pdev || !pdev->monitor_pdev->mvdev)
  1278. return NULL;
  1279. return pdev->monitor_pdev->mvdev;
  1280. }
  1281. /*
  1282. * dp_monitor_is_vdev_timer_running() - Get vdev timer status
  1283. * @soc: point to soc
  1284. *
  1285. * Return: true if timer running
  1286. */
  1287. static inline bool dp_monitor_is_vdev_timer_running(struct dp_soc *soc)
  1288. {
  1289. if (qdf_unlikely(!soc || !soc->monitor_soc))
  1290. return false;
  1291. return !!(soc->monitor_soc->mon_vdev_timer_state &
  1292. MON_VDEV_TIMER_RUNNING);
  1293. }
  1294. /*
  1295. * dp_monitor_get_link_desc_pages() - Get link desc pages
  1296. * @soc: point to soc
  1297. * @mac_id: mac id
  1298. *
  1299. * Return: return point to link desc pages
  1300. */
  1301. static inline struct qdf_mem_multi_page_t*
  1302. dp_monitor_get_link_desc_pages(struct dp_soc *soc, uint32_t mac_id)
  1303. {
  1304. if (qdf_unlikely(!soc || !soc->monitor_soc))
  1305. return NULL;
  1306. return &soc->monitor_soc->mon_link_desc_pages[mac_id];
  1307. }
  1308. /*
  1309. * dp_monitor_get_total_link_descs() - Get total link descs
  1310. * @soc: point to soc
  1311. * @mac_id: mac id
  1312. *
  1313. * Return: return point total link descs
  1314. */
  1315. static inline uint32_t *
  1316. dp_monitor_get_total_link_descs(struct dp_soc *soc, uint32_t mac_id)
  1317. {
  1318. return &soc->monitor_soc->total_mon_link_descs[mac_id];
  1319. }
  1320. /*
  1321. * dp_monitor_pdev_attach() - Monitor pdev attach
  1322. * @pdev: point to pdev
  1323. *
  1324. * Return: return QDF_STATUS
  1325. */
  1326. static inline QDF_STATUS dp_monitor_pdev_attach(struct dp_pdev *pdev)
  1327. {
  1328. struct dp_mon_ops *monitor_ops;
  1329. struct dp_mon_soc *mon_soc = pdev->soc->monitor_soc;
  1330. /*
  1331. * mon_soc uninitialized modular support enabled
  1332. * monitor related attach/detach/init/deinit
  1333. * will be done while monitor insmod
  1334. */
  1335. if (!mon_soc)
  1336. return QDF_STATUS_SUCCESS;
  1337. monitor_ops = mon_soc->mon_ops;
  1338. if (!monitor_ops || !monitor_ops->mon_pdev_attach) {
  1339. dp_mon_debug("callback not registered");
  1340. return QDF_STATUS_E_FAILURE;
  1341. }
  1342. return monitor_ops->mon_pdev_attach(pdev);
  1343. }
  1344. /*
  1345. * dp_monitor_pdev_detach() - Monitor pdev detach
  1346. * @pdev: point to pdev
  1347. *
  1348. * Return: return QDF_STATUS
  1349. */
  1350. static inline QDF_STATUS dp_monitor_pdev_detach(struct dp_pdev *pdev)
  1351. {
  1352. struct dp_mon_ops *monitor_ops;
  1353. struct dp_mon_soc *mon_soc = pdev->soc->monitor_soc;
  1354. /*
  1355. * mon_soc uninitialized modular support enabled
  1356. * monitor related attach/detach/init/deinit
  1357. * will be done while monitor insmod
  1358. */
  1359. if (!mon_soc)
  1360. return QDF_STATUS_SUCCESS;
  1361. monitor_ops = mon_soc->mon_ops;
  1362. if (!monitor_ops || !monitor_ops->mon_pdev_detach) {
  1363. dp_mon_debug("callback not registered");
  1364. return QDF_STATUS_E_FAILURE;
  1365. }
  1366. return monitor_ops->mon_pdev_detach(pdev);
  1367. }
  1368. /*
  1369. * dp_monitor_vdev_attach() - Monitor vdev attach
  1370. * @vdev: point to vdev
  1371. *
  1372. * Return: return QDF_STATUS
  1373. */
  1374. static inline QDF_STATUS dp_monitor_vdev_attach(struct dp_vdev *vdev)
  1375. {
  1376. struct dp_mon_ops *monitor_ops;
  1377. struct dp_mon_soc *mon_soc = vdev->pdev->soc->monitor_soc;
  1378. if (!mon_soc)
  1379. return QDF_STATUS_E_FAILURE;
  1380. monitor_ops = mon_soc->mon_ops;
  1381. if (!monitor_ops || !monitor_ops->mon_vdev_attach) {
  1382. dp_mon_debug("callback not registered");
  1383. return QDF_STATUS_E_FAILURE;
  1384. }
  1385. return monitor_ops->mon_vdev_attach(vdev);
  1386. }
  1387. /*
  1388. * dp_monitor_vdev_detach() - Monitor vdev detach
  1389. * @vdev: point to vdev
  1390. *
  1391. * Return: return QDF_STATUS
  1392. */
  1393. static inline QDF_STATUS dp_monitor_vdev_detach(struct dp_vdev *vdev)
  1394. {
  1395. struct dp_mon_ops *monitor_ops;
  1396. struct dp_mon_soc *mon_soc = vdev->pdev->soc->monitor_soc;
  1397. if (!mon_soc)
  1398. return QDF_STATUS_E_FAILURE;
  1399. monitor_ops = mon_soc->mon_ops;
  1400. if (!monitor_ops || !monitor_ops->mon_vdev_detach) {
  1401. dp_mon_debug("callback not registered");
  1402. return QDF_STATUS_E_FAILURE;
  1403. }
  1404. return monitor_ops->mon_vdev_detach(vdev);
  1405. }
  1406. /*
  1407. * dp_monitor_peer_attach() - Monitor peer attach
  1408. * @soc: point to soc
  1409. * @peer: point to peer
  1410. *
  1411. * Return: return QDF_STATUS
  1412. */
  1413. static inline QDF_STATUS dp_monitor_peer_attach(struct dp_soc *soc,
  1414. struct dp_peer *peer)
  1415. {
  1416. struct dp_mon_ops *monitor_ops;
  1417. struct dp_mon_soc *mon_soc = soc->monitor_soc;
  1418. if (!mon_soc)
  1419. return QDF_STATUS_E_FAILURE;
  1420. monitor_ops = mon_soc->mon_ops;
  1421. if (!monitor_ops || !monitor_ops->mon_peer_attach) {
  1422. dp_mon_debug("callback not registered");
  1423. return QDF_STATUS_E_FAILURE;
  1424. }
  1425. return monitor_ops->mon_peer_attach(peer);
  1426. }
  1427. /*
  1428. * dp_monitor_peer_detach() - Monitor peer detach
  1429. * @soc: point to soc
  1430. * @peer: point to peer
  1431. *
  1432. * Return: return QDF_STATUS
  1433. */
  1434. static inline QDF_STATUS dp_monitor_peer_detach(struct dp_soc *soc,
  1435. struct dp_peer *peer)
  1436. {
  1437. struct dp_mon_ops *monitor_ops;
  1438. struct dp_mon_soc *mon_soc = soc->monitor_soc;
  1439. if (!mon_soc)
  1440. return QDF_STATUS_E_FAILURE;
  1441. monitor_ops = mon_soc->mon_ops;
  1442. if (!monitor_ops || !monitor_ops->mon_peer_detach) {
  1443. dp_mon_debug("callback not registered");
  1444. return QDF_STATUS_E_FAILURE;
  1445. }
  1446. return monitor_ops->mon_peer_detach(peer);
  1447. }
  1448. /*
  1449. * dp_monitor_pdev_init() - Monitor pdev init
  1450. * @pdev: point to pdev
  1451. *
  1452. * Return: return QDF_STATUS
  1453. */
  1454. static inline QDF_STATUS dp_monitor_pdev_init(struct dp_pdev *pdev)
  1455. {
  1456. struct dp_mon_ops *monitor_ops;
  1457. struct dp_mon_soc *mon_soc = pdev->soc->monitor_soc;
  1458. /*
  1459. * mon_soc uninitialized when modular support enabled
  1460. * monitor related attach/detach/init/deinit
  1461. * will be done while monitor insmod
  1462. */
  1463. if (!mon_soc)
  1464. return QDF_STATUS_SUCCESS;
  1465. monitor_ops = mon_soc->mon_ops;
  1466. if (!monitor_ops || !monitor_ops->mon_pdev_init) {
  1467. dp_mon_debug("callback not registered");
  1468. return QDF_STATUS_E_FAILURE;
  1469. }
  1470. return monitor_ops->mon_pdev_init(pdev);
  1471. }
  1472. /*
  1473. * dp_monitor_pdev_deinit() - Monitor pdev deinit
  1474. * @pdev: point to pdev
  1475. *
  1476. * Return: return QDF_STATUS
  1477. */
  1478. static inline QDF_STATUS dp_monitor_pdev_deinit(struct dp_pdev *pdev)
  1479. {
  1480. struct dp_mon_ops *monitor_ops;
  1481. struct dp_mon_soc *mon_soc = pdev->soc->monitor_soc;
  1482. /*
  1483. * mon_soc uninitialized modular when support enabled
  1484. * monitor related attach/detach/init/deinit
  1485. * will be done while monitor insmod
  1486. */
  1487. if (!mon_soc)
  1488. return QDF_STATUS_SUCCESS;
  1489. monitor_ops = mon_soc->mon_ops;
  1490. if (!monitor_ops || !monitor_ops->mon_pdev_deinit) {
  1491. dp_mon_debug("callback not registered");
  1492. return QDF_STATUS_E_FAILURE;
  1493. }
  1494. return monitor_ops->mon_pdev_deinit(pdev);
  1495. }
  1496. /*
  1497. * dp_monitor_soc_cfg_init() - Monitor sco cfg init
  1498. * @soc: point to soc
  1499. *
  1500. * Return: return QDF_STATUS
  1501. */
  1502. static inline QDF_STATUS dp_monitor_soc_cfg_init(struct dp_soc *soc)
  1503. {
  1504. struct dp_mon_ops *monitor_ops;
  1505. struct dp_mon_soc *mon_soc = soc->monitor_soc;
  1506. /*
  1507. * this API is getting call from dp_soc_init,
  1508. * mon_soc will be uninitialized when monitor support enabled
  1509. * So returning QDF_STATUS_SUCCESS.
  1510. * soc cfg init will be done while monitor insmod.
  1511. */
  1512. if (!mon_soc)
  1513. return QDF_STATUS_SUCCESS;
  1514. monitor_ops = mon_soc->mon_ops;
  1515. if (!monitor_ops || !monitor_ops->mon_soc_cfg_init) {
  1516. dp_mon_debug("callback not registered");
  1517. return QDF_STATUS_E_FAILURE;
  1518. }
  1519. return monitor_ops->mon_soc_cfg_init(soc);
  1520. }
  1521. /*
  1522. * dp_monitor_config_debug_sniffer() - Monitor config debug sniffer
  1523. * @pdev: point to pdev
  1524. * @val: val
  1525. *
  1526. * Return: return QDF_STATUS
  1527. */
  1528. static inline QDF_STATUS dp_monitor_config_debug_sniffer(struct dp_pdev *pdev,
  1529. int val)
  1530. {
  1531. struct dp_mon_ops *monitor_ops;
  1532. struct dp_mon_soc *mon_soc = pdev->soc->monitor_soc;
  1533. if (!mon_soc)
  1534. return QDF_STATUS_E_FAILURE;
  1535. monitor_ops = mon_soc->mon_ops;
  1536. if (!monitor_ops || !monitor_ops->mon_config_debug_sniffer) {
  1537. dp_mon_debug("callback not registered");
  1538. return QDF_STATUS_E_FAILURE;
  1539. }
  1540. return monitor_ops->mon_config_debug_sniffer(pdev, val);
  1541. }
  1542. /*
  1543. * dp_monitor_flush_rings() - Flush monitor rings
  1544. * @soc: point to soc
  1545. *
  1546. * Return: None
  1547. */
  1548. static inline void dp_monitor_flush_rings(struct dp_soc *soc)
  1549. {
  1550. struct dp_mon_ops *monitor_ops;
  1551. struct dp_mon_soc *mon_soc = soc->monitor_soc;
  1552. if (!mon_soc) {
  1553. dp_mon_debug("monitor soc is NULL");
  1554. return;
  1555. }
  1556. monitor_ops = mon_soc->mon_ops;
  1557. if (!monitor_ops || !monitor_ops->mon_flush_rings) {
  1558. dp_mon_debug("callback not registered");
  1559. return;
  1560. }
  1561. return monitor_ops->mon_flush_rings(soc);
  1562. }
  1563. /*
  1564. * dp_monitor_htt_srng_setup() - Setup htt srng
  1565. * @soc: point to soc
  1566. * @pdev: point to pdev
  1567. * @mac_id: lmac id
  1568. * @mac for pdev: pdev id
  1569. *
  1570. * Return: QDF_STATUS
  1571. */
  1572. #if !defined(DISABLE_MON_CONFIG)
  1573. static inline QDF_STATUS dp_monitor_htt_srng_setup(struct dp_soc *soc,
  1574. struct dp_pdev *pdev,
  1575. int mac_id,
  1576. int mac_for_pdev)
  1577. {
  1578. struct dp_mon_ops *monitor_ops;
  1579. struct dp_mon_soc *mon_soc = soc->monitor_soc;
  1580. if (!mon_soc) {
  1581. dp_mon_debug("monitor soc is NULL");
  1582. return QDF_STATUS_SUCCESS;
  1583. }
  1584. monitor_ops = mon_soc->mon_ops;
  1585. if (!monitor_ops || !monitor_ops->mon_pdev_htt_srng_setup) {
  1586. dp_mon_debug("callback not registered");
  1587. return QDF_STATUS_E_FAILURE;
  1588. }
  1589. return monitor_ops->mon_pdev_htt_srng_setup(soc, pdev, mac_id,
  1590. mac_for_pdev);
  1591. }
  1592. static inline QDF_STATUS dp_monitor_soc_htt_srng_setup(struct dp_soc *soc)
  1593. {
  1594. struct dp_mon_ops *monitor_ops;
  1595. struct dp_mon_soc *mon_soc = soc->monitor_soc;
  1596. if (!mon_soc) {
  1597. dp_mon_debug("monitor soc is NULL");
  1598. return QDF_STATUS_SUCCESS;
  1599. }
  1600. monitor_ops = mon_soc->mon_ops;
  1601. if (!monitor_ops || !monitor_ops->mon_soc_htt_srng_setup) {
  1602. dp_mon_debug("callback not registered");
  1603. return QDF_STATUS_E_FAILURE;
  1604. }
  1605. return monitor_ops->mon_soc_htt_srng_setup(soc);
  1606. }
  1607. #else
  1608. static inline QDF_STATUS dp_monitor_htt_srng_setup(struct dp_soc *soc,
  1609. struct dp_pdev *pdev,
  1610. int mac_id,
  1611. int mac_for_pdev)
  1612. {
  1613. return QDF_STATUS_SUCCESS;
  1614. }
  1615. #endif
  1616. /*
  1617. * dp_monitor_service_mon_rings() - service monitor rings
  1618. * @soc: point to soc
  1619. * @quota: reap budget
  1620. *
  1621. * Return: None
  1622. */
  1623. #if defined(DP_CON_MON)
  1624. static inline
  1625. void dp_monitor_service_mon_rings(struct dp_soc *soc, uint32_t quota)
  1626. {
  1627. struct dp_mon_ops *monitor_ops;
  1628. struct dp_mon_soc *mon_soc = soc->monitor_soc;
  1629. if (!mon_soc) {
  1630. dp_mon_debug("monitor soc is NULL");
  1631. return;
  1632. }
  1633. monitor_ops = mon_soc->mon_ops;
  1634. if (!monitor_ops || !monitor_ops->mon_service_rings) {
  1635. dp_mon_debug("callback not registered");
  1636. return;
  1637. }
  1638. return monitor_ops->mon_service_rings(soc, quota);
  1639. }
  1640. #endif
  1641. /*
  1642. * dp_rx_monitor_process() - Process monitor
  1643. * @soc: point to soc
  1644. * @int_ctx: interrupt ctx
  1645. * @mac_id: lma
  1646. * @quota:
  1647. *
  1648. * Return: None
  1649. */
  1650. #ifndef DISABLE_MON_CONFIG
  1651. static inline
  1652. uint32_t dp_monitor_process(struct dp_soc *soc, struct dp_intr *int_ctx,
  1653. uint32_t mac_id, uint32_t quota)
  1654. {
  1655. struct dp_mon_soc *mon_soc = soc->monitor_soc;
  1656. if (!mon_soc) {
  1657. dp_mon_debug("monitor soc is NULL");
  1658. return 0;
  1659. }
  1660. if (!mon_soc->mon_rx_process) {
  1661. dp_mon_debug("callback not registered");
  1662. return 0;
  1663. }
  1664. return mon_soc->mon_rx_process(soc, int_ctx, mac_id, quota);
  1665. }
  1666. static inline
  1667. uint32_t dp_tx_mon_process(struct dp_soc *soc, struct dp_intr *int_ctx,
  1668. uint32_t mac_id, uint32_t quota)
  1669. {
  1670. return 0;
  1671. }
  1672. static inline
  1673. uint32_t dp_tx_mon_buf_refill(struct dp_intr *int_ctx)
  1674. {
  1675. struct dp_soc *soc = int_ctx->soc;
  1676. struct dp_mon_ops *monitor_ops;
  1677. struct dp_mon_soc *mon_soc = soc->monitor_soc;
  1678. if (!mon_soc) {
  1679. dp_mon_debug("monitor soc is NULL");
  1680. return 0;
  1681. }
  1682. monitor_ops = mon_soc->mon_ops;
  1683. if (!monitor_ops || !monitor_ops->tx_mon_refill_buf_ring) {
  1684. dp_mon_debug("callback not registered");
  1685. return 0;
  1686. }
  1687. return monitor_ops->tx_mon_refill_buf_ring(int_ctx);
  1688. }
  1689. static inline
  1690. uint32_t dp_rx_mon_buf_refill(struct dp_intr *int_ctx)
  1691. {
  1692. struct dp_soc *soc = int_ctx->soc;
  1693. struct dp_mon_ops *monitor_ops;
  1694. struct dp_mon_soc *mon_soc = soc->monitor_soc;
  1695. if (!mon_soc) {
  1696. dp_mon_debug("monitor soc is NULL");
  1697. return 0;
  1698. }
  1699. monitor_ops = mon_soc->mon_ops;
  1700. if (!monitor_ops || !monitor_ops->rx_mon_refill_buf_ring) {
  1701. dp_mon_debug("callback not registered");
  1702. return 0;
  1703. }
  1704. return monitor_ops->rx_mon_refill_buf_ring(int_ctx);
  1705. }
  1706. #else
  1707. static inline
  1708. uint32_t dp_monitor_process(struct dp_soc *soc, struct dp_intr *int_ctx,
  1709. uint32_t mac_id, uint32_t quota)
  1710. {
  1711. return 0;
  1712. }
  1713. static inline uint32_t
  1714. dp_tx_mon_process(struct dp_soc *soc, struct dp_intr *int_ctx,
  1715. uint32_t mac_id, uint32_t quota)
  1716. {
  1717. return 0;
  1718. }
  1719. static inline
  1720. uint32_t dp_tx_mon_buf_refill(struct dp_intr *int_ctx)
  1721. {
  1722. }
  1723. static inline
  1724. uint32_t dp_rx_mon_buf_refill(struct dp_intr *int_ctx)
  1725. {
  1726. }
  1727. #endif
  1728. /*
  1729. * dp_monitor_drop_packets_for_mac() - monitor_drop_packets_for_mac
  1730. * @pdev: point to pdev
  1731. * @mac_id:
  1732. * @quota:
  1733. *
  1734. * Return:
  1735. */
  1736. #if !defined(DISABLE_MON_CONFIG) && defined(MON_ENABLE_DROP_FOR_MAC)
  1737. static inline
  1738. uint32_t dp_monitor_drop_packets_for_mac(struct dp_pdev *pdev,
  1739. uint32_t mac_id, uint32_t quota)
  1740. {
  1741. struct dp_mon_ops *monitor_ops;
  1742. struct dp_mon_soc *mon_soc = pdev->soc->monitor_soc;
  1743. if (!mon_soc) {
  1744. dp_mon_debug("monitor soc is NULL");
  1745. return 0;
  1746. }
  1747. monitor_ops = mon_soc->mon_ops;
  1748. if (!monitor_ops || !monitor_ops->mon_drop_packets_for_mac) {
  1749. dp_mon_debug("callback not registered");
  1750. return 0;
  1751. }
  1752. return monitor_ops->mon_drop_packets_for_mac(pdev,
  1753. mac_id, quota);
  1754. }
  1755. #else
  1756. static inline
  1757. uint32_t dp_monitor_drop_packets_for_mac(struct dp_pdev *pdev,
  1758. uint32_t mac_id, uint32_t quota)
  1759. {
  1760. return 0;
  1761. }
  1762. #endif
  1763. /*
  1764. * dp_monitor_peer_tx_init() - peer tx init
  1765. * @pdev: point to pdev
  1766. * @peer: point to peer
  1767. *
  1768. * Return: None
  1769. */
  1770. static inline void dp_monitor_peer_tx_init(struct dp_pdev *pdev,
  1771. struct dp_peer *peer)
  1772. {
  1773. struct dp_mon_ops *monitor_ops;
  1774. struct dp_mon_soc *mon_soc = pdev->soc->monitor_soc;
  1775. if (!mon_soc) {
  1776. dp_mon_debug("monitor soc is NULL");
  1777. return;
  1778. }
  1779. monitor_ops = mon_soc->mon_ops;
  1780. if (!monitor_ops || !monitor_ops->mon_peer_tx_init) {
  1781. dp_mon_debug("callback not registered");
  1782. return;
  1783. }
  1784. return monitor_ops->mon_peer_tx_init(pdev, peer);
  1785. }
  1786. /*
  1787. * dp_monitor_peer_tx_cleanup() - peer tx cleanup
  1788. * @vdev: point to vdev
  1789. * @peer: point to peer
  1790. *
  1791. * Return: None
  1792. */
  1793. static inline void dp_monitor_peer_tx_cleanup(struct dp_vdev *vdev,
  1794. struct dp_peer *peer)
  1795. {
  1796. struct dp_mon_ops *monitor_ops;
  1797. struct dp_mon_soc *mon_soc = vdev->pdev->soc->monitor_soc;
  1798. if (!mon_soc) {
  1799. dp_mon_debug("monitor soc is NULL");
  1800. return;
  1801. }
  1802. monitor_ops = mon_soc->mon_ops;
  1803. if (!monitor_ops || !monitor_ops->mon_peer_tx_cleanup) {
  1804. dp_mon_debug("callback not registered");
  1805. return;
  1806. }
  1807. return monitor_ops->mon_peer_tx_cleanup(vdev, peer);
  1808. }
  1809. #ifdef WLAN_TX_PKT_CAPTURE_ENH
  1810. /*
  1811. * dp_monitor_peer_tid_peer_id_update() - peer tid update
  1812. * @soc: point to soc
  1813. * @peer: point to peer
  1814. * @peer_id: peer id
  1815. *
  1816. * Return: None
  1817. */
  1818. static inline
  1819. void dp_monitor_peer_tid_peer_id_update(struct dp_soc *soc,
  1820. struct dp_peer *peer,
  1821. uint16_t peer_id)
  1822. {
  1823. struct dp_mon_ops *monitor_ops;
  1824. struct dp_mon_soc *mon_soc = soc->monitor_soc;
  1825. if (!mon_soc) {
  1826. dp_mon_debug("monitor soc is NULL");
  1827. return;
  1828. }
  1829. monitor_ops = mon_soc->mon_ops;
  1830. if (!monitor_ops || !monitor_ops->mon_peer_tid_peer_id_update) {
  1831. dp_mon_debug("callback not registered");
  1832. return;
  1833. }
  1834. return monitor_ops->mon_peer_tid_peer_id_update(peer, peer_id);
  1835. }
  1836. /*
  1837. * dp_monitor_tx_ppdu_stats_attach() - Attach tx ppdu stats
  1838. * @pdev: point to pdev
  1839. *
  1840. * Return: None
  1841. */
  1842. static inline void dp_monitor_tx_ppdu_stats_attach(struct dp_pdev *pdev)
  1843. {
  1844. struct dp_mon_ops *monitor_ops;
  1845. struct dp_mon_soc *mon_soc = pdev->soc->monitor_soc;
  1846. if (!mon_soc) {
  1847. dp_mon_debug("monitor soc is NULL");
  1848. return;
  1849. }
  1850. monitor_ops = mon_soc->mon_ops;
  1851. if (!monitor_ops || !monitor_ops->mon_tx_ppdu_stats_attach) {
  1852. dp_mon_debug("callback not registered");
  1853. return;
  1854. }
  1855. return monitor_ops->mon_tx_ppdu_stats_attach(pdev);
  1856. }
  1857. /*
  1858. * dp_monitor_tx_ppdu_stats_detach() - Detach tx ppdu stats
  1859. * @pdev: point to pdev
  1860. *
  1861. * Return: None
  1862. */
  1863. static inline void dp_monitor_tx_ppdu_stats_detach(struct dp_pdev *pdev)
  1864. {
  1865. struct dp_mon_ops *monitor_ops;
  1866. struct dp_mon_soc *mon_soc = pdev->soc->monitor_soc;
  1867. if (!mon_soc) {
  1868. dp_mon_debug("monitor soc is NULL");
  1869. return;
  1870. }
  1871. monitor_ops = mon_soc->mon_ops;
  1872. if (!monitor_ops || !monitor_ops->mon_tx_ppdu_stats_detach) {
  1873. dp_mon_debug("callback not registered");
  1874. return;
  1875. }
  1876. return monitor_ops->mon_tx_ppdu_stats_detach(pdev);
  1877. }
  1878. /*
  1879. * dp_monitor_tx_capture_debugfs_init() - Init tx capture debugfs
  1880. * @pdev: point to pdev
  1881. *
  1882. * Return: QDF_STATUS_SUCCESS
  1883. */
  1884. static inline
  1885. QDF_STATUS dp_monitor_tx_capture_debugfs_init(struct dp_pdev *pdev)
  1886. {
  1887. struct dp_mon_ops *monitor_ops;
  1888. struct dp_mon_soc *mon_soc = pdev->soc->monitor_soc;
  1889. if (!mon_soc) {
  1890. dp_mon_debug("monitor soc is NULL");
  1891. return QDF_STATUS_E_FAILURE;
  1892. }
  1893. monitor_ops = mon_soc->mon_ops;
  1894. if (!monitor_ops || !monitor_ops->mon_tx_capture_debugfs_init) {
  1895. dp_mon_debug("callback not registered");
  1896. return QDF_STATUS_E_FAILURE;
  1897. }
  1898. return monitor_ops->mon_tx_capture_debugfs_init(pdev);
  1899. }
  1900. /*
  1901. * dp_monitor_peer_tx_capture_filter_check() - Check tx capture filter
  1902. * @pdev: point to pdev
  1903. * @peer: point to peer
  1904. *
  1905. * Return: None
  1906. */
  1907. static inline void dp_monitor_peer_tx_capture_filter_check(struct dp_pdev *pdev,
  1908. struct dp_peer *peer)
  1909. {
  1910. struct dp_mon_ops *monitor_ops;
  1911. struct dp_mon_soc *mon_soc = pdev->soc->monitor_soc;
  1912. if (!mon_soc) {
  1913. dp_mon_debug("monitor soc is NULL");
  1914. return;
  1915. }
  1916. monitor_ops = mon_soc->mon_ops;
  1917. if (!monitor_ops || !monitor_ops->mon_peer_tx_capture_filter_check) {
  1918. dp_mon_debug("callback not registered");
  1919. return;
  1920. }
  1921. return monitor_ops->mon_peer_tx_capture_filter_check(pdev, peer);
  1922. }
  1923. /*
  1924. * dp_monitor_tx_add_to_comp_queue() - add completion msdu to queue
  1925. *
  1926. * This API returns QDF_STATUS_SUCCESS in case where buffer is added
  1927. * to txmonitor queue successfuly caller will not free the buffer in
  1928. * this case. In other cases this API return QDF_STATUS_E_FAILURE and
  1929. * caller frees the buffer
  1930. *
  1931. * @soc: point to soc
  1932. * @desc: point to tx desc
  1933. * @ts: Tx completion status from HAL/HTT descriptor
  1934. * @peer: DP peer
  1935. *
  1936. * Return: QDF_STATUS
  1937. *
  1938. */
  1939. static inline
  1940. QDF_STATUS dp_monitor_tx_add_to_comp_queue(struct dp_soc *soc,
  1941. struct dp_tx_desc_s *desc,
  1942. struct hal_tx_completion_status *ts,
  1943. struct dp_peer *peer)
  1944. {
  1945. struct dp_mon_ops *monitor_ops;
  1946. struct dp_mon_soc *mon_soc = soc->monitor_soc;
  1947. if (!mon_soc) {
  1948. dp_mon_debug("monitor soc is NULL");
  1949. return QDF_STATUS_E_FAILURE;
  1950. }
  1951. monitor_ops = mon_soc->mon_ops;
  1952. if (!monitor_ops || !monitor_ops->mon_tx_add_to_comp_queue) {
  1953. dp_mon_debug("callback not registered");
  1954. return QDF_STATUS_E_FAILURE;
  1955. }
  1956. return monitor_ops->mon_tx_add_to_comp_queue(soc, desc, ts, peer);
  1957. }
  1958. static inline
  1959. QDF_STATUS monitor_update_msdu_to_list(struct dp_soc *soc,
  1960. struct dp_pdev *pdev,
  1961. struct dp_peer *peer,
  1962. struct hal_tx_completion_status *ts,
  1963. qdf_nbuf_t netbuf)
  1964. {
  1965. struct dp_mon_ops *monitor_ops;
  1966. struct dp_mon_soc *mon_soc = soc->monitor_soc;
  1967. if (!mon_soc) {
  1968. dp_mon_debug("monitor soc is NULL");
  1969. return QDF_STATUS_SUCCESS;
  1970. }
  1971. monitor_ops = mon_soc->mon_ops;
  1972. if (!monitor_ops || !monitor_ops->mon_update_msdu_to_list) {
  1973. dp_mon_debug("callback not registered");
  1974. return QDF_STATUS_E_FAILURE;
  1975. }
  1976. return monitor_ops->mon_update_msdu_to_list(soc, pdev,
  1977. peer, ts, netbuf);
  1978. }
  1979. #else
  1980. static inline
  1981. void dp_monitor_peer_tid_peer_id_update(struct dp_soc *soc,
  1982. struct dp_peer *peer,
  1983. uint16_t peer_id)
  1984. {
  1985. }
  1986. static inline void dp_monitor_tx_ppdu_stats_attach(struct dp_pdev *pdev)
  1987. {
  1988. }
  1989. static inline void dp_monitor_tx_ppdu_stats_detach(struct dp_pdev *pdev)
  1990. {
  1991. }
  1992. static inline
  1993. QDF_STATUS dp_monitor_tx_capture_debugfs_init(struct dp_pdev *pdev)
  1994. {
  1995. return QDF_STATUS_E_FAILURE;
  1996. }
  1997. static inline void dp_monitor_peer_tx_capture_filter_check(struct dp_pdev *pdev,
  1998. struct dp_peer *peer)
  1999. {
  2000. }
  2001. static inline
  2002. QDF_STATUS dp_monitor_tx_add_to_comp_queue(struct dp_soc *soc,
  2003. struct dp_tx_desc_s *desc,
  2004. struct hal_tx_completion_status *ts,
  2005. struct dp_peer *peer)
  2006. {
  2007. return QDF_STATUS_E_FAILURE;
  2008. }
  2009. static inline
  2010. QDF_STATUS monitor_update_msdu_to_list(struct dp_soc *soc,
  2011. struct dp_pdev *pdev,
  2012. struct dp_peer *peer,
  2013. struct hal_tx_completion_status *ts,
  2014. qdf_nbuf_t netbuf)
  2015. {
  2016. return QDF_STATUS_E_FAILURE;
  2017. }
  2018. #endif
  2019. /*
  2020. * dp_monitor_ppdu_stats_ind_handler() - PPDU stats msg handler
  2021. * @htt_soc: HTT SOC handle
  2022. * @msg_word: Pointer to payload
  2023. * @htt_t2h_msg: HTT msg nbuf
  2024. *
  2025. * Return: True if buffer should be freed by caller.
  2026. */
  2027. #if defined(WDI_EVENT_ENABLE) &&\
  2028. (defined(QCA_ENHANCED_STATS_SUPPORT) || !defined(REMOVE_PKT_LOG))
  2029. static inline bool dp_monitor_ppdu_stats_ind_handler(struct htt_soc *soc,
  2030. uint32_t *msg_word,
  2031. qdf_nbuf_t htt_t2h_msg)
  2032. {
  2033. struct dp_mon_ops *monitor_ops;
  2034. struct dp_mon_soc *mon_soc = soc->dp_soc->monitor_soc;
  2035. if (!mon_soc) {
  2036. dp_mon_debug("monitor soc is NULL");
  2037. return true;
  2038. }
  2039. monitor_ops = mon_soc->mon_ops;
  2040. if (!monitor_ops || !monitor_ops->mon_ppdu_stats_ind_handler) {
  2041. dp_mon_debug("callback not registered");
  2042. return true;
  2043. }
  2044. return monitor_ops->mon_ppdu_stats_ind_handler(soc, msg_word,
  2045. htt_t2h_msg);
  2046. }
  2047. #else
  2048. static inline bool dp_monitor_ppdu_stats_ind_handler(struct htt_soc *soc,
  2049. uint32_t *msg_word,
  2050. qdf_nbuf_t htt_t2h_msg)
  2051. {
  2052. return true;
  2053. }
  2054. #endif
  2055. /*
  2056. * dp_monitor_htt_ppdu_stats_attach() - attach resources for HTT PPDU
  2057. * stats processing
  2058. * @pdev: Datapath PDEV handle
  2059. *
  2060. * Return: QDF_STATUS
  2061. */
  2062. static inline QDF_STATUS dp_monitor_htt_ppdu_stats_attach(struct dp_pdev *pdev)
  2063. {
  2064. struct dp_mon_ops *monitor_ops;
  2065. struct dp_mon_soc *mon_soc = pdev->soc->monitor_soc;
  2066. if (!mon_soc) {
  2067. dp_mon_debug("monitor soc is NULL");
  2068. return QDF_STATUS_SUCCESS;
  2069. }
  2070. monitor_ops = mon_soc->mon_ops;
  2071. if (!monitor_ops || !monitor_ops->mon_htt_ppdu_stats_attach) {
  2072. dp_mon_debug("callback not registered");
  2073. return QDF_STATUS_E_FAILURE;
  2074. }
  2075. return monitor_ops->mon_htt_ppdu_stats_attach(pdev);
  2076. }
  2077. /*
  2078. * dp_monitor_htt_ppdu_stats_detach() - detach stats resources
  2079. * @pdev: Datapath PDEV handle
  2080. *
  2081. * Return: void
  2082. */
  2083. static inline void dp_monitor_htt_ppdu_stats_detach(struct dp_pdev *pdev)
  2084. {
  2085. struct dp_mon_ops *monitor_ops;
  2086. struct dp_mon_soc *mon_soc = pdev->soc->monitor_soc;
  2087. if (!mon_soc) {
  2088. dp_mon_debug("monitor soc is NULL");
  2089. return;
  2090. }
  2091. monitor_ops = mon_soc->mon_ops;
  2092. if (!monitor_ops || !monitor_ops->mon_htt_ppdu_stats_detach) {
  2093. dp_mon_debug("callback not registered");
  2094. return;
  2095. }
  2096. return monitor_ops->mon_htt_ppdu_stats_detach(pdev);
  2097. }
  2098. /*
  2099. * dp_monitor_print_pdev_rx_mon_stats() - print rx mon stats
  2100. * @pdev: Datapath PDEV handle
  2101. *
  2102. * Return: void
  2103. */
  2104. static inline void dp_monitor_print_pdev_rx_mon_stats(struct dp_pdev *pdev)
  2105. {
  2106. struct dp_mon_ops *monitor_ops;
  2107. struct dp_mon_soc *mon_soc = pdev->soc->monitor_soc;
  2108. if (!mon_soc) {
  2109. dp_mon_debug("monitor soc is NULL");
  2110. return;
  2111. }
  2112. monitor_ops = mon_soc->mon_ops;
  2113. if (!monitor_ops || !monitor_ops->mon_print_pdev_rx_mon_stats) {
  2114. dp_mon_debug("callback not registered");
  2115. return;
  2116. }
  2117. return monitor_ops->mon_print_pdev_rx_mon_stats(pdev);
  2118. }
  2119. /*
  2120. * dp_monitor_print_pdev_tx_capture_stats() - print tx capture stats
  2121. * @pdev: Datapath PDEV handle
  2122. *
  2123. * Return: void
  2124. */
  2125. #ifdef WLAN_TX_PKT_CAPTURE_ENH
  2126. static inline void dp_monitor_print_pdev_tx_capture_stats(struct dp_pdev *pdev)
  2127. {
  2128. struct dp_mon_ops *monitor_ops;
  2129. struct dp_mon_soc *mon_soc = pdev->soc->monitor_soc;
  2130. if (!mon_soc) {
  2131. dp_mon_debug("monitor soc is NULL");
  2132. return;
  2133. }
  2134. monitor_ops = mon_soc->mon_ops;
  2135. if (!monitor_ops || !monitor_ops->mon_print_pdev_tx_capture_stats) {
  2136. dp_mon_debug("callback not registered");
  2137. return;
  2138. }
  2139. return monitor_ops->mon_print_pdev_tx_capture_stats(pdev);
  2140. }
  2141. static inline QDF_STATUS dp_monitor_config_enh_tx_capture(struct dp_pdev *pdev,
  2142. uint32_t val)
  2143. {
  2144. struct dp_mon_ops *monitor_ops;
  2145. struct dp_mon_soc *mon_soc = pdev->soc->monitor_soc;
  2146. if (!mon_soc) {
  2147. dp_mon_debug("monitor soc is NULL");
  2148. return QDF_STATUS_E_FAILURE;
  2149. }
  2150. monitor_ops = mon_soc->mon_ops;
  2151. if (!monitor_ops || !monitor_ops->mon_config_enh_tx_capture) {
  2152. dp_mon_debug("callback not registered");
  2153. return QDF_STATUS_E_FAILURE;
  2154. }
  2155. return monitor_ops->mon_config_enh_tx_capture(pdev, val);
  2156. }
  2157. #else
  2158. static inline void dp_monitor_print_pdev_tx_capture_stats(struct dp_pdev *pdev)
  2159. {
  2160. }
  2161. static inline QDF_STATUS dp_monitor_config_enh_tx_capture(struct dp_pdev *pdev,
  2162. uint32_t val)
  2163. {
  2164. return QDF_STATUS_E_INVAL;
  2165. }
  2166. #endif
  2167. #ifdef WLAN_RX_PKT_CAPTURE_ENH
  2168. static inline QDF_STATUS dp_monitor_config_enh_rx_capture(struct dp_pdev *pdev,
  2169. uint32_t val)
  2170. {
  2171. struct dp_mon_ops *monitor_ops;
  2172. struct dp_mon_soc *mon_soc = pdev->soc->monitor_soc;
  2173. if (!mon_soc) {
  2174. dp_mon_debug("monitor soc is NULL");
  2175. return QDF_STATUS_E_FAILURE;
  2176. }
  2177. monitor_ops = mon_soc->mon_ops;
  2178. if (!monitor_ops || !monitor_ops->mon_config_enh_rx_capture) {
  2179. dp_mon_debug("callback not registered");
  2180. return QDF_STATUS_E_FAILURE;
  2181. }
  2182. return monitor_ops->mon_config_enh_rx_capture(pdev, val);
  2183. }
  2184. #else
  2185. static inline QDF_STATUS dp_monitor_config_enh_rx_capture(struct dp_pdev *pdev,
  2186. uint32_t val)
  2187. {
  2188. return QDF_STATUS_E_INVAL;
  2189. }
  2190. #endif
  2191. #ifdef QCA_SUPPORT_BPR
  2192. static inline QDF_STATUS dp_monitor_set_bpr_enable(struct dp_pdev *pdev,
  2193. uint32_t val)
  2194. {
  2195. struct dp_mon_ops *monitor_ops;
  2196. struct dp_mon_soc *mon_soc = pdev->soc->monitor_soc;
  2197. if (!mon_soc) {
  2198. dp_mon_debug("monitor soc is NULL");
  2199. return QDF_STATUS_E_FAILURE;
  2200. }
  2201. monitor_ops = mon_soc->mon_ops;
  2202. if (!monitor_ops || !monitor_ops->mon_set_bpr_enable) {
  2203. dp_mon_debug("callback not registered");
  2204. return QDF_STATUS_E_FAILURE;
  2205. }
  2206. return monitor_ops->mon_set_bpr_enable(pdev, val);
  2207. }
  2208. #else
  2209. static inline QDF_STATUS dp_monitor_set_bpr_enable(struct dp_pdev *pdev,
  2210. uint32_t val)
  2211. {
  2212. return QDF_STATUS_E_FAILURE;
  2213. }
  2214. #endif
  2215. #ifdef ATH_SUPPORT_NAC
  2216. static inline
  2217. int dp_monitor_set_filter_neigh_peers(struct dp_pdev *pdev, bool val)
  2218. {
  2219. struct dp_mon_ops *monitor_ops;
  2220. struct dp_mon_soc *mon_soc = pdev->soc->monitor_soc;
  2221. if (!mon_soc) {
  2222. dp_mon_debug("monitor soc is NULL");
  2223. return 0;
  2224. }
  2225. monitor_ops = mon_soc->mon_ops;
  2226. if (!monitor_ops || !monitor_ops->mon_set_filter_neigh_peers) {
  2227. dp_mon_debug("callback not registered");
  2228. return 0;
  2229. }
  2230. return monitor_ops->mon_set_filter_neigh_peers(pdev, val);
  2231. }
  2232. #else
  2233. static inline
  2234. int dp_monitor_set_filter_neigh_peers(struct dp_pdev *pdev, bool val)
  2235. {
  2236. return 0;
  2237. }
  2238. #endif
  2239. #ifdef WLAN_ATF_ENABLE
  2240. static inline
  2241. void dp_monitor_set_atf_stats_enable(struct dp_pdev *pdev, bool value)
  2242. {
  2243. struct dp_mon_ops *monitor_ops;
  2244. struct dp_mon_soc *mon_soc = pdev->soc->monitor_soc;
  2245. if (!mon_soc) {
  2246. dp_mon_debug("monitor soc is NULL");
  2247. return;
  2248. }
  2249. monitor_ops = mon_soc->mon_ops;
  2250. if (!monitor_ops || !monitor_ops->mon_set_atf_stats_enable) {
  2251. dp_mon_debug("callback not registered");
  2252. return;
  2253. }
  2254. return monitor_ops->mon_set_atf_stats_enable(pdev, value);
  2255. }
  2256. #else
  2257. static inline
  2258. void dp_monitor_set_atf_stats_enable(struct dp_pdev *pdev, bool value)
  2259. {
  2260. }
  2261. #endif
  2262. static inline
  2263. void dp_monitor_set_bsscolor(struct dp_pdev *pdev, uint8_t bsscolor)
  2264. {
  2265. struct dp_mon_ops *monitor_ops;
  2266. struct dp_mon_soc *mon_soc = pdev->soc->monitor_soc;
  2267. if (!mon_soc) {
  2268. dp_mon_debug("monitor soc is NULL");
  2269. return;
  2270. }
  2271. monitor_ops = mon_soc->mon_ops;
  2272. if (!monitor_ops || !monitor_ops->mon_set_bsscolor) {
  2273. dp_mon_debug("callback not registered");
  2274. return;
  2275. }
  2276. return monitor_ops->mon_set_bsscolor(pdev, bsscolor);
  2277. }
  2278. static inline
  2279. bool dp_monitor_pdev_get_filter_mcast_data(struct cdp_pdev *pdev_handle)
  2280. {
  2281. struct dp_mon_ops *monitor_ops;
  2282. struct dp_pdev *pdev = (struct dp_pdev *)pdev_handle;
  2283. struct dp_mon_soc *mon_soc = pdev->soc->monitor_soc;
  2284. if (!mon_soc) {
  2285. dp_mon_debug("monitor soc is NULL");
  2286. return false;
  2287. }
  2288. monitor_ops = mon_soc->mon_ops;
  2289. if (!monitor_ops || !monitor_ops->mon_pdev_get_filter_mcast_data) {
  2290. dp_mon_debug("callback not registered");
  2291. return false;
  2292. }
  2293. return monitor_ops->mon_pdev_get_filter_mcast_data(pdev_handle);
  2294. }
  2295. static inline
  2296. bool dp_monitor_pdev_get_filter_non_data(struct cdp_pdev *pdev_handle)
  2297. {
  2298. struct dp_mon_ops *monitor_ops;
  2299. struct dp_pdev *pdev = (struct dp_pdev *)pdev_handle;
  2300. struct dp_mon_soc *mon_soc = pdev->soc->monitor_soc;
  2301. if (!mon_soc) {
  2302. dp_mon_debug("monitor soc is NULL");
  2303. return false;
  2304. }
  2305. monitor_ops = mon_soc->mon_ops;
  2306. if (!monitor_ops || !monitor_ops->mon_pdev_get_filter_non_data) {
  2307. dp_mon_debug("callback not registered");
  2308. return false;
  2309. }
  2310. return monitor_ops->mon_pdev_get_filter_non_data(pdev_handle);
  2311. }
  2312. static inline
  2313. bool dp_monitor_pdev_get_filter_ucast_data(struct cdp_pdev *pdev_handle)
  2314. {
  2315. struct dp_mon_ops *monitor_ops;
  2316. struct dp_pdev *pdev = (struct dp_pdev *)pdev_handle;
  2317. struct dp_mon_soc *mon_soc = pdev->soc->monitor_soc;
  2318. if (!mon_soc) {
  2319. dp_mon_debug("monitor soc is NULL");
  2320. return false;
  2321. }
  2322. monitor_ops = mon_soc->mon_ops;
  2323. if (!monitor_ops || !monitor_ops->mon_pdev_get_filter_ucast_data) {
  2324. dp_mon_debug("callback not registered");
  2325. return false;
  2326. }
  2327. return monitor_ops->mon_pdev_get_filter_ucast_data(pdev_handle);
  2328. }
  2329. #ifdef WDI_EVENT_ENABLE
  2330. static inline
  2331. int dp_monitor_set_pktlog_wifi3(struct dp_pdev *pdev, uint32_t event,
  2332. bool enable)
  2333. {
  2334. struct dp_mon_ops *monitor_ops;
  2335. struct dp_mon_soc *mon_soc = pdev->soc->monitor_soc;
  2336. if (!mon_soc) {
  2337. dp_mon_debug("monitor soc is NULL");
  2338. return 0;
  2339. }
  2340. monitor_ops = mon_soc->mon_ops;
  2341. if (!monitor_ops || !monitor_ops->mon_set_pktlog_wifi3) {
  2342. dp_mon_debug("callback not registered");
  2343. return 0;
  2344. }
  2345. return monitor_ops->mon_set_pktlog_wifi3(pdev, event, enable);
  2346. }
  2347. #else
  2348. static inline
  2349. int dp_monitor_set_pktlog_wifi3(struct dp_pdev *pdev, uint32_t event,
  2350. bool enable)
  2351. {
  2352. return 0;
  2353. }
  2354. #endif
  2355. #if defined(DP_CON_MON) && !defined(REMOVE_PKT_LOG)
  2356. static inline void dp_monitor_pktlogmod_exit(struct dp_pdev *pdev)
  2357. {
  2358. struct dp_mon_ops *monitor_ops;
  2359. struct dp_mon_soc *mon_soc = pdev->soc->monitor_soc;
  2360. if (!mon_soc) {
  2361. dp_mon_debug("monitor soc is NULL");
  2362. return;
  2363. }
  2364. monitor_ops = mon_soc->mon_ops;
  2365. if (!monitor_ops || !monitor_ops->mon_pktlogmod_exit) {
  2366. dp_mon_debug("callback not registered");
  2367. return;
  2368. }
  2369. return monitor_ops->mon_pktlogmod_exit(pdev);
  2370. }
  2371. #else
  2372. static inline void dp_monitor_pktlogmod_exit(struct dp_pdev *pdev) {}
  2373. #endif
  2374. static inline
  2375. void dp_monitor_vdev_set_monitor_mode_buf_rings(struct dp_pdev *pdev)
  2376. {
  2377. struct dp_mon_ops *monitor_ops;
  2378. struct dp_mon_soc *mon_soc = pdev->soc->monitor_soc;
  2379. if (!mon_soc) {
  2380. dp_mon_debug("monitor soc is NULL");
  2381. return;
  2382. }
  2383. monitor_ops = mon_soc->mon_ops;
  2384. if (!monitor_ops || !monitor_ops->mon_vdev_set_monitor_mode_buf_rings) {
  2385. dp_mon_debug("callback not registered");
  2386. return;
  2387. }
  2388. return monitor_ops->mon_vdev_set_monitor_mode_buf_rings(pdev);
  2389. }
  2390. static inline
  2391. void dp_monitor_neighbour_peers_detach(struct dp_pdev *pdev)
  2392. {
  2393. struct dp_mon_ops *monitor_ops;
  2394. struct dp_mon_soc *mon_soc = pdev->soc->monitor_soc;
  2395. if (!mon_soc) {
  2396. dp_mon_debug("monitor soc is NULL");
  2397. return;
  2398. }
  2399. monitor_ops = mon_soc->mon_ops;
  2400. if (!monitor_ops || !monitor_ops->mon_neighbour_peers_detach) {
  2401. dp_mon_debug("callback not registered");
  2402. return;
  2403. }
  2404. return monitor_ops->mon_neighbour_peers_detach(pdev);
  2405. }
  2406. #ifdef FEATURE_NAC_RSSI
  2407. static inline QDF_STATUS dp_monitor_filter_neighbour_peer(struct dp_pdev *pdev,
  2408. uint8_t *rx_pkt_hdr)
  2409. {
  2410. struct dp_mon_ops *monitor_ops;
  2411. struct dp_mon_soc *mon_soc = pdev->soc->monitor_soc;
  2412. if (!mon_soc) {
  2413. dp_mon_debug("monitor soc is NULL");
  2414. return QDF_STATUS_E_FAILURE;
  2415. }
  2416. monitor_ops = mon_soc->mon_ops;
  2417. if (!monitor_ops || !monitor_ops->mon_filter_neighbour_peer) {
  2418. dp_mon_debug("callback not registered");
  2419. return QDF_STATUS_E_FAILURE;
  2420. }
  2421. return monitor_ops->mon_filter_neighbour_peer(pdev, rx_pkt_hdr);
  2422. }
  2423. #endif
  2424. static inline
  2425. void dp_monitor_reap_timer_init(struct dp_soc *soc)
  2426. {
  2427. struct dp_mon_ops *monitor_ops;
  2428. struct dp_mon_soc *mon_soc = soc->monitor_soc;
  2429. if (!mon_soc) {
  2430. dp_mon_debug("monitor soc is NULL");
  2431. return;
  2432. }
  2433. monitor_ops = mon_soc->mon_ops;
  2434. if (!monitor_ops || !monitor_ops->mon_reap_timer_init) {
  2435. dp_mon_debug("callback not registered");
  2436. return;
  2437. }
  2438. monitor_ops->mon_reap_timer_init(soc);
  2439. }
  2440. static inline
  2441. void dp_monitor_reap_timer_deinit(struct dp_soc *soc)
  2442. {
  2443. struct dp_mon_ops *monitor_ops;
  2444. struct dp_mon_soc *mon_soc = soc->monitor_soc;
  2445. if (!mon_soc) {
  2446. dp_mon_debug("monitor soc is NULL");
  2447. return;
  2448. }
  2449. monitor_ops = mon_soc->mon_ops;
  2450. if (!monitor_ops || !monitor_ops->mon_reap_timer_deinit) {
  2451. dp_mon_debug("callback not registered");
  2452. return;
  2453. }
  2454. monitor_ops->mon_reap_timer_deinit(soc);
  2455. }
  2456. static inline
  2457. void dp_monitor_reap_timer_start(struct dp_soc *soc)
  2458. {
  2459. struct dp_mon_ops *monitor_ops;
  2460. struct dp_mon_soc *mon_soc = soc->monitor_soc;
  2461. if (!mon_soc) {
  2462. dp_mon_debug("monitor soc is NULL");
  2463. return;
  2464. }
  2465. monitor_ops = mon_soc->mon_ops;
  2466. if (!monitor_ops || !monitor_ops->mon_reap_timer_start) {
  2467. dp_mon_debug("callback not registered");
  2468. return;
  2469. }
  2470. monitor_ops->mon_reap_timer_start(soc);
  2471. }
  2472. static inline
  2473. bool dp_monitor_reap_timer_stop(struct dp_soc *soc)
  2474. {
  2475. struct dp_mon_ops *monitor_ops;
  2476. struct dp_mon_soc *mon_soc = soc->monitor_soc;
  2477. if (!mon_soc) {
  2478. dp_mon_debug("monitor soc is NULL");
  2479. return false;
  2480. }
  2481. monitor_ops = mon_soc->mon_ops;
  2482. if (!monitor_ops || !monitor_ops->mon_reap_timer_stop) {
  2483. dp_mon_debug("callback not registered");
  2484. return false;
  2485. }
  2486. return monitor_ops->mon_reap_timer_stop(soc);
  2487. }
  2488. static inline
  2489. void dp_monitor_vdev_timer_init(struct dp_soc *soc)
  2490. {
  2491. struct dp_mon_ops *monitor_ops;
  2492. struct dp_mon_soc *mon_soc = soc->monitor_soc;
  2493. if (!mon_soc) {
  2494. dp_mon_debug("monitor soc is NULL");
  2495. return;
  2496. }
  2497. monitor_ops = mon_soc->mon_ops;
  2498. if (!monitor_ops || !monitor_ops->mon_vdev_timer_init) {
  2499. dp_mon_debug("callback not registered");
  2500. return;
  2501. }
  2502. monitor_ops->mon_vdev_timer_init(soc);
  2503. }
  2504. static inline
  2505. void dp_monitor_vdev_timer_deinit(struct dp_soc *soc)
  2506. {
  2507. struct dp_mon_ops *monitor_ops;
  2508. struct dp_mon_soc *mon_soc = soc->monitor_soc;
  2509. if (!mon_soc) {
  2510. dp_mon_debug("monitor soc is NULL");
  2511. return;
  2512. }
  2513. monitor_ops = mon_soc->mon_ops;
  2514. if (!monitor_ops || !monitor_ops->mon_vdev_timer_deinit) {
  2515. dp_mon_debug("callback not registered");
  2516. return;
  2517. }
  2518. monitor_ops->mon_vdev_timer_deinit(soc);
  2519. }
  2520. static inline
  2521. void dp_monitor_vdev_timer_start(struct dp_soc *soc)
  2522. {
  2523. struct dp_mon_ops *monitor_ops;
  2524. struct dp_mon_soc *mon_soc = soc->monitor_soc;
  2525. if (!mon_soc) {
  2526. dp_mon_debug("monitor soc is NULL");
  2527. return;
  2528. }
  2529. monitor_ops = mon_soc->mon_ops;
  2530. if (!monitor_ops || !monitor_ops->mon_vdev_timer_start) {
  2531. dp_mon_debug("callback not registered");
  2532. return;
  2533. }
  2534. monitor_ops->mon_vdev_timer_start(soc);
  2535. }
  2536. static inline
  2537. bool dp_monitor_vdev_timer_stop(struct dp_soc *soc)
  2538. {
  2539. struct dp_mon_ops *monitor_ops;
  2540. struct dp_mon_soc *mon_soc = soc->monitor_soc;
  2541. if (!mon_soc) {
  2542. dp_mon_debug("monitor soc is NULL");
  2543. return false;
  2544. }
  2545. monitor_ops = mon_soc->mon_ops;
  2546. if (!monitor_ops || !monitor_ops->mon_vdev_timer_stop) {
  2547. dp_mon_debug("callback not registered");
  2548. return false;
  2549. }
  2550. return monitor_ops->mon_vdev_timer_stop(soc);
  2551. }
  2552. #ifdef QCA_MCOPY_SUPPORT
  2553. static inline
  2554. QDF_STATUS dp_monitor_mcopy_check_deliver(struct dp_pdev *pdev,
  2555. uint16_t peer_id, uint32_t ppdu_id,
  2556. uint8_t first_msdu)
  2557. {
  2558. struct dp_mon_ops *monitor_ops;
  2559. struct dp_mon_soc *mon_soc = pdev->soc->monitor_soc;
  2560. if (!mon_soc) {
  2561. dp_mon_debug("monitor soc is NULL");
  2562. return QDF_STATUS_E_FAILURE;
  2563. }
  2564. monitor_ops = mon_soc->mon_ops;
  2565. if (!monitor_ops || !monitor_ops->mon_mcopy_check_deliver) {
  2566. dp_mon_debug("callback not registered");
  2567. return QDF_STATUS_E_FAILURE;
  2568. }
  2569. return monitor_ops->mon_mcopy_check_deliver(pdev, peer_id,
  2570. ppdu_id, first_msdu);
  2571. }
  2572. #else
  2573. static inline
  2574. QDF_STATUS dp_monitor_mcopy_check_deliver(struct dp_pdev *pdev,
  2575. uint16_t peer_id, uint32_t ppdu_id,
  2576. uint8_t first_msdu)
  2577. {
  2578. return QDF_STATUS_SUCCESS;
  2579. }
  2580. #endif
  2581. /*
  2582. * dp_monitor_neighbour_peer_add_ast() - Add ast entry
  2583. * @pdev: point to dp pdev
  2584. * @ta_peer: point to peer
  2585. * @mac_addr: mac address
  2586. * @nbuf: point to nbuf
  2587. * @flags: flags
  2588. *
  2589. * Return: void
  2590. */
  2591. static inline void
  2592. dp_monitor_neighbour_peer_add_ast(struct dp_pdev *pdev,
  2593. struct dp_peer *ta_peer,
  2594. uint8_t *mac_addr,
  2595. qdf_nbuf_t nbuf,
  2596. uint32_t flags)
  2597. {
  2598. struct dp_mon_soc *mon_soc = pdev->soc->monitor_soc;
  2599. struct dp_mon_ops *monitor_ops;
  2600. if (!mon_soc) {
  2601. dp_mon_debug("monitor soc is NULL");
  2602. return;
  2603. }
  2604. monitor_ops = mon_soc->mon_ops;
  2605. if (!monitor_ops || !monitor_ops->mon_neighbour_peer_add_ast) {
  2606. dp_mon_debug("callback not registered");
  2607. return;
  2608. }
  2609. return monitor_ops->mon_neighbour_peer_add_ast(pdev, ta_peer, mac_addr,
  2610. nbuf, flags);
  2611. }
  2612. /*
  2613. * dp_monitor_vdev_delete() - delete monitor vdev
  2614. * @soc: point to dp soc
  2615. * @vdev: point to dp vdev
  2616. *
  2617. * Return: void
  2618. */
  2619. static inline void dp_monitor_vdev_delete(struct dp_soc *soc,
  2620. struct dp_vdev *vdev)
  2621. {
  2622. if (soc->intr_mode == DP_INTR_POLL) {
  2623. qdf_timer_sync_cancel(&soc->int_timer);
  2624. dp_monitor_flush_rings(soc);
  2625. } else if (soc->intr_mode == DP_INTR_MSI) {
  2626. if (dp_monitor_vdev_timer_stop(soc))
  2627. dp_monitor_flush_rings(soc);
  2628. }
  2629. dp_monitor_vdev_detach(vdev);
  2630. }
  2631. #ifdef DP_POWER_SAVE
  2632. /*
  2633. * dp_monitor_pktlog_reap_pending_frames() - reap pending frames
  2634. * @pdev: point to dp pdev
  2635. *
  2636. * Return: void
  2637. */
  2638. static inline void dp_monitor_pktlog_reap_pending_frames(struct dp_pdev *pdev)
  2639. {
  2640. struct dp_soc *soc;
  2641. if (qdf_unlikely(!pdev || !pdev->monitor_pdev))
  2642. return;
  2643. soc = pdev->soc;
  2644. if (((pdev->monitor_pdev->rx_pktlog_mode != DP_RX_PKTLOG_DISABLED) ||
  2645. dp_mon_is_enable_reap_timer_non_pkt(pdev))) {
  2646. if (dp_monitor_reap_timer_stop(soc))
  2647. dp_monitor_service_mon_rings(soc, DP_MON_REAP_BUDGET);
  2648. }
  2649. }
  2650. /*
  2651. * dp_monitor_pktlog_start_reap_timer() - start reap timer
  2652. * @pdev: point to dp pdev
  2653. *
  2654. * Return: void
  2655. */
  2656. static inline void dp_monitor_pktlog_start_reap_timer(struct dp_pdev *pdev)
  2657. {
  2658. struct dp_soc *soc;
  2659. if (qdf_unlikely(!pdev || !pdev->monitor_pdev))
  2660. return;
  2661. soc = pdev->soc;
  2662. if (((pdev->monitor_pdev->rx_pktlog_mode != DP_RX_PKTLOG_DISABLED) ||
  2663. dp_mon_is_enable_reap_timer_non_pkt(pdev)))
  2664. dp_monitor_reap_timer_start(soc);
  2665. }
  2666. #endif
  2667. /*
  2668. * dp_monitor_neighbour_peer_list_remove() - remove neighbour peer list
  2669. * @pdev: point to dp pdev
  2670. * @vdev: point to dp vdev
  2671. * @peer: point to dp_neighbour_peer
  2672. *
  2673. * Return: void
  2674. */
  2675. static inline
  2676. void dp_monitor_neighbour_peer_list_remove(struct dp_pdev *pdev,
  2677. struct dp_vdev *vdev,
  2678. struct dp_neighbour_peer *peer)
  2679. {
  2680. struct dp_mon_pdev *mon_pdev;
  2681. struct dp_neighbour_peer *temp_peer = NULL;
  2682. if (qdf_unlikely(!pdev || !pdev->monitor_pdev))
  2683. return;
  2684. mon_pdev = pdev->monitor_pdev;
  2685. qdf_spin_lock_bh(&mon_pdev->neighbour_peer_mutex);
  2686. if (!pdev->soc->monitor_soc->hw_nac_monitor_support) {
  2687. TAILQ_FOREACH(peer, &mon_pdev->neighbour_peers_list,
  2688. neighbour_peer_list_elem) {
  2689. QDF_ASSERT(peer->vdev != vdev);
  2690. }
  2691. } else {
  2692. TAILQ_FOREACH_SAFE(peer, &mon_pdev->neighbour_peers_list,
  2693. neighbour_peer_list_elem, temp_peer) {
  2694. if (peer->vdev == vdev) {
  2695. TAILQ_REMOVE(&mon_pdev->neighbour_peers_list,
  2696. peer,
  2697. neighbour_peer_list_elem);
  2698. qdf_mem_free(peer);
  2699. }
  2700. }
  2701. }
  2702. qdf_spin_unlock_bh(&mon_pdev->neighbour_peer_mutex);
  2703. }
  2704. static inline
  2705. void dp_monitor_pdev_set_mon_vdev(struct dp_vdev *vdev)
  2706. {
  2707. if (!vdev->pdev->monitor_pdev)
  2708. return;
  2709. vdev->pdev->monitor_pdev->mvdev = vdev;
  2710. }
  2711. static inline
  2712. void dp_monitor_pdev_config_scan_spcl_vap(struct dp_pdev *pdev, bool val)
  2713. {
  2714. if (!pdev || !pdev->monitor_pdev)
  2715. return;
  2716. pdev->monitor_pdev->scan_spcl_vap_configured = val;
  2717. }
  2718. #ifdef QCA_SUPPORT_SCAN_SPCL_VAP_STATS
  2719. static inline
  2720. void dp_monitor_pdev_reset_scan_spcl_vap_stats_enable(struct dp_pdev *pdev,
  2721. bool val)
  2722. {
  2723. if (!pdev || !pdev->monitor_pdev)
  2724. return;
  2725. pdev->monitor_pdev->reset_scan_spcl_vap_stats_enable = val;
  2726. }
  2727. #else
  2728. static inline
  2729. void dp_monitor_pdev_reset_scan_spcl_vap_stats_enable(struct dp_pdev *pdev,
  2730. bool val)
  2731. {
  2732. }
  2733. #endif
  2734. static inline void
  2735. dp_mon_rx_wmask_subscribe(struct dp_soc *soc, uint32_t *msg_word,
  2736. struct htt_rx_ring_tlv_filter *tlv_filter)
  2737. {
  2738. struct dp_mon_soc *mon_soc = soc->monitor_soc;
  2739. struct dp_mon_ops *monitor_ops;
  2740. if (!mon_soc) {
  2741. dp_mon_debug("mon soc is NULL");
  2742. return;
  2743. }
  2744. monitor_ops = mon_soc->mon_ops;
  2745. if (!monitor_ops || !monitor_ops->rx_wmask_subscribe) {
  2746. dp_mon_debug("callback not registered");
  2747. return;
  2748. }
  2749. monitor_ops->rx_wmask_subscribe(msg_word, tlv_filter);
  2750. }
  2751. static inline void
  2752. dp_mon_rx_enable_mpdu_logging(struct dp_soc *soc, uint32_t *msg_word,
  2753. struct htt_rx_ring_tlv_filter *tlv_filter)
  2754. {
  2755. struct dp_mon_soc *mon_soc = soc->monitor_soc;
  2756. struct dp_mon_ops *monitor_ops;
  2757. if (!mon_soc) {
  2758. dp_mon_debug("mon soc is NULL");
  2759. return;
  2760. }
  2761. monitor_ops = mon_soc->mon_ops;
  2762. if (!monitor_ops || !monitor_ops->rx_enable_mpdu_logging) {
  2763. dp_mon_debug("callback not registered");
  2764. return;
  2765. }
  2766. monitor_ops->rx_enable_mpdu_logging(msg_word, tlv_filter);
  2767. }
  2768. static inline void
  2769. dp_mon_rx_packet_length_set(struct dp_soc *soc, uint32_t *msg_word,
  2770. struct htt_rx_ring_tlv_filter *tlv_filter)
  2771. {
  2772. struct dp_mon_soc *mon_soc = soc->monitor_soc;
  2773. struct dp_mon_ops *monitor_ops;
  2774. if (!mon_soc) {
  2775. dp_mon_debug("mon soc is NULL");
  2776. return;
  2777. }
  2778. monitor_ops = mon_soc->mon_ops;
  2779. if (!monitor_ops || !monitor_ops->rx_packet_length_set) {
  2780. dp_mon_debug("callback not registered");
  2781. return;
  2782. }
  2783. monitor_ops->rx_packet_length_set(msg_word, tlv_filter);
  2784. }
  2785. #ifdef QCA_ENHANCED_STATS_SUPPORT
  2786. QDF_STATUS dp_peer_qos_stats_notify(struct dp_pdev *dp_pdev,
  2787. struct cdp_rx_stats_ppdu_user *ppdu_user);
  2788. #endif
  2789. /*
  2790. * dp_print_pdev_rx_mon_stats() - print rx mon stats
  2791. * @pdev: device object
  2792. *
  2793. * Return: void
  2794. */
  2795. void
  2796. dp_print_pdev_rx_mon_stats(struct dp_pdev *pdev);
  2797. /**
  2798. * dp_mcopy_check_deliver() - mcopy check deliver
  2799. * @pdev: DP pdev handle
  2800. * @peer_id: peer id
  2801. * @ppdu_id: ppdu
  2802. * @first_msdu: flag to indicate first msdu of ppdu
  2803. * Return: 0 on success, not 0 on failure
  2804. */
  2805. QDF_STATUS dp_mcopy_check_deliver(struct dp_pdev *pdev,
  2806. uint16_t peer_id,
  2807. uint32_t ppdu_id,
  2808. uint8_t first_msdu);
  2809. /**
  2810. * dp_pdev_set_advance_monitor_filter() - Set DP PDEV monitor filter
  2811. * @soc: soc handle
  2812. * @pdev_id: id of Datapath PDEV handle
  2813. * @filter_val: Flag to select Filter for monitor mode
  2814. * Return: 0 on success, not 0 on failure
  2815. */
  2816. #ifdef QCA_ADVANCE_MON_FILTER_SUPPORT
  2817. QDF_STATUS
  2818. dp_pdev_set_advance_monitor_filter(struct cdp_soc_t *soc_hdl, uint8_t pdev_id,
  2819. struct cdp_monitor_filter *filter_val);
  2820. #else
  2821. static inline QDF_STATUS
  2822. dp_pdev_set_advance_monitor_filter(struct cdp_soc_t *soc_hdl, uint8_t pdev_id,
  2823. struct cdp_monitor_filter *filter_val)
  2824. {
  2825. return QDF_STATUS_E_INVAL;
  2826. }
  2827. #endif /* QCA_ADVANCE_MON_FILTER_SUPPORT */
  2828. /**
  2829. * dp_deliver_tx_mgmt() - Deliver mgmt frame for tx capture
  2830. * @cdp_soc : data path soc handle
  2831. * @pdev_id : pdev_id
  2832. * @nbuf: Management frame buffer
  2833. */
  2834. QDF_STATUS
  2835. dp_deliver_tx_mgmt(struct cdp_soc_t *cdp_soc, uint8_t pdev_id, qdf_nbuf_t nbuf);
  2836. /**
  2837. * dp_filter_neighbour_peer() - API to filter neighbour peer
  2838. * @pdev : DP pdev handle
  2839. * @rx_pkt_hdr : packet header
  2840. *
  2841. * return: QDF_STATUS_SUCCESS on success
  2842. * QDF_STATUS_E_FAILURE on failure
  2843. */
  2844. #ifdef FEATURE_NAC_RSSI
  2845. QDF_STATUS dp_filter_neighbour_peer(struct dp_pdev *pdev,
  2846. uint8_t *rx_pkt_hdr);
  2847. #else
  2848. static inline
  2849. QDF_STATUS dp_filter_neighbour_peer(struct dp_pdev *pdev,
  2850. uint8_t *rx_pkt_hdr)
  2851. {
  2852. return QDF_STATUS_SUCCESS;
  2853. }
  2854. #endif /* FEATURE_NAC_RSSI */
  2855. /*
  2856. * dp_neighbour_peers_detach() - Detach neighbour peers(nac clients)
  2857. * @pdev: device object
  2858. *
  2859. * Return: void
  2860. */
  2861. void dp_neighbour_peers_detach(struct dp_pdev *pdev);
  2862. /**
  2863. * dp_reset_monitor_mode() - Disable monitor mode
  2864. * @soc_hdl: Datapath soc handle
  2865. * @pdev_id: id of datapath PDEV handle
  2866. * @smart_monitor: smart monitor flag
  2867. *
  2868. * Return: QDF_STATUS
  2869. */
  2870. QDF_STATUS dp_reset_monitor_mode(struct cdp_soc_t *soc_hdl,
  2871. uint8_t pdev_id,
  2872. uint8_t smart_monitor);
  2873. static inline
  2874. struct dp_mon_ops *dp_mon_ops_get(struct dp_soc *soc)
  2875. {
  2876. if (soc && soc->monitor_soc)
  2877. return soc->monitor_soc->mon_ops;
  2878. return NULL;
  2879. }
  2880. static inline
  2881. struct cdp_mon_ops *dp_mon_cdp_ops_get(struct dp_soc *soc)
  2882. {
  2883. struct cdp_ops *ops = soc->cdp_soc.ops;
  2884. return ops->mon_ops;
  2885. }
  2886. /**
  2887. * dp_ppdu_desc_user_stats_update(): Function to update TX user stats
  2888. * @pdev: DP pdev handle
  2889. * @ppdu_info: per PPDU TLV descriptor
  2890. *
  2891. * return: void
  2892. */
  2893. #ifdef QCA_ENHANCED_STATS_SUPPORT
  2894. void
  2895. dp_ppdu_desc_user_stats_update(struct dp_pdev *pdev,
  2896. struct ppdu_info *ppdu_info);
  2897. #else
  2898. static inline void
  2899. dp_ppdu_desc_user_stats_update(struct dp_pdev *pdev,
  2900. struct ppdu_info *ppdu_info)
  2901. {
  2902. }
  2903. #endif /* QCA_ENHANCED_STATS_SUPPORT */
  2904. /**
  2905. * dp_mon_ops_register_1_0(): register legacy monitor ops
  2906. * @mon_soc: monitor soc handle
  2907. *
  2908. * return: void
  2909. */
  2910. void dp_mon_ops_register_1_0(struct dp_mon_soc *mon_soc);
  2911. /**
  2912. * dp_mon_cdp_ops_register_1_0(): register legacy monitor cdp ops
  2913. * @ops: cdp ops handle
  2914. *
  2915. * return: void
  2916. */
  2917. void dp_mon_cdp_ops_register_1_0(struct cdp_ops *ops);
  2918. #ifdef QCA_MONITOR_2_0_SUPPORT
  2919. /**
  2920. * dp_mon_ops_register_2_0(): register monitor ops
  2921. * @mon_soc: monitor soc handle
  2922. *
  2923. * return: void
  2924. */
  2925. void dp_mon_ops_register_2_0(struct dp_mon_soc *mon_soc);
  2926. /**
  2927. * dp_mon_cdp_ops_register_2_0(): register monitor cdp ops
  2928. * @ops: cdp ops handle
  2929. *
  2930. * return: void
  2931. */
  2932. void dp_mon_cdp_ops_register_2_0(struct cdp_ops *ops);
  2933. #endif /* QCA_MONITOR_2_0_SUPPORT */
  2934. /**
  2935. * dp_mon_register_feature_ops(): Register mon feature ops
  2936. * @soc: Datapath soc context
  2937. *
  2938. * return: void
  2939. */
  2940. static inline
  2941. void dp_mon_register_feature_ops(struct dp_soc *soc)
  2942. {
  2943. struct dp_mon_ops *mon_ops = NULL;
  2944. mon_ops = dp_mon_ops_get(soc);
  2945. if (!mon_ops) {
  2946. dp_mon_err("Monitor ops is NULL");
  2947. return;
  2948. }
  2949. if (mon_ops->mon_register_feature_ops)
  2950. mon_ops->mon_register_feature_ops(soc);
  2951. }
  2952. #endif /* _DP_MON_H_ */