dp_mon.h 64 KB

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