dp_mon.h 81 KB

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