dp_mon.h 76 KB

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