dp_mon.h 76 KB

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