dp_rx_mon.h 31 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143
  1. /*
  2. * Copyright (c) 2016-2020 The Linux Foundation. All rights reserved.
  3. *
  4. * Permission to use, copy, modify, and/or distribute this software for
  5. * any purpose with or without fee is hereby granted, provided that the
  6. * above copyright notice and this permission notice appear in all
  7. * copies.
  8. *
  9. * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
  10. * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
  11. * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
  12. * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
  13. * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
  14. * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
  15. * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  16. * PERFORMANCE OF THIS SOFTWARE.
  17. */
  18. #ifndef _DP_RX_MON_H_
  19. #define _DP_RX_MON_H_
  20. /*
  21. * MON_BUF_MIN_ENTRIES macro defines minimum number of network buffers
  22. * to be refilled in the RXDMA monitor buffer ring at init, remaining
  23. * buffers are replenished at the time of monitor vap creation
  24. */
  25. #define MON_BUF_MIN_ENTRIES 64
  26. /*
  27. * The below macro defines the maximum number of ring entries that would
  28. * be processed in a single instance when processing each of the non-monitoring
  29. * RXDMA2SW ring.
  30. */
  31. #define MON_DROP_REAP_LIMIT 64
  32. /*
  33. * The maximum headroom reserved for monitor destination buffer to
  34. * accomodate radiotap header and protocol flow tag
  35. */
  36. #ifdef DP_RX_MON_MEM_FRAG
  37. /*
  38. * -------------------------------------------------
  39. * | Protocol & Flow TAG | Radiotap header|
  40. * | | Length(128 B) |
  41. * | ((4* QDF_NBUF_MAX_FRAGS) * 2) | |
  42. * -------------------------------------------------
  43. */
  44. #define DP_RX_MON_MAX_RADIO_TAP_HDR (128)
  45. #define DP_RX_MON_PF_TAG_LEN_PER_FRAG (4)
  46. #define DP_RX_MON_TOT_PF_TAG_LEN \
  47. ((DP_RX_MON_PF_TAG_LEN_PER_FRAG) * (QDF_NBUF_MAX_FRAGS))
  48. #define DP_RX_MON_MAX_MONITOR_HEADER \
  49. ((DP_RX_MON_TOT_PF_TAG_LEN * 2) + (DP_RX_MON_MAX_RADIO_TAP_HDR))
  50. #endif
  51. /* The maximum buffer length allocated for radiotap for monitor status buffer */
  52. #define MAX_MONITOR_HEADER (512)
  53. /* l2 header pad byte in case of Raw frame is Zero and 2 in non raw */
  54. #define DP_RX_MON_RAW_L2_HDR_PAD_BYTE (0)
  55. #define DP_RX_MON_NONRAW_L2_HDR_PAD_BYTE (2)
  56. #define dp_rx_mon_dest_alert(params...) QDF_TRACE_FATAL(QDF_MODULE_ID_DP_RX_MON_DEST, params)
  57. #define dp_rx_mon_dest_err(params...) QDF_TRACE_ERROR(QDF_MODULE_ID_DP_RX_MON_DEST, params)
  58. #define dp_rx_mon_dest_warn(params...) QDF_TRACE_WARN(QDF_MODULE_ID_DP_RX_MON_DEST, params)
  59. #define dp_rx_mon_dest_info(params...) \
  60. __QDF_TRACE_FL(QDF_TRACE_LEVEL_INFO_HIGH, QDF_MODULE_ID_DP_RX_MON_DEST, ## params)
  61. #define dp_rx_mon_dest_debug(params...) QDF_TRACE_DEBUG(QDF_MODULE_ID_DP_RX_MON_DEST, params)
  62. /**
  63. * enum dp_mon_reap_status - monitor status ring ppdu status
  64. *
  65. * @DP_MON_STATUS_NO_DMA - DMA not done for status ring entry
  66. * @DP_MON_STATUS_MATCH - status and dest ppdu id mathes
  67. * @DP_MON_STATUS_LAG - status ppdu id is lagging
  68. * @DP_MON_STATUS_LEAD - status ppdu id is leading
  69. * @DP_MON_STATUS_REPLENISH - status ring entry is NULL
  70. */
  71. enum dp_mon_reap_status {
  72. DP_MON_STATUS_NO_DMA,
  73. DP_MON_STATUS_MATCH,
  74. DP_MON_STATUS_LAG,
  75. DP_MON_STATUS_LEAD,
  76. DP_MON_STATUS_REPLENISH
  77. };
  78. /*
  79. * dp_rx_mon_status_process() - Process monitor status ring and
  80. * TLV in status ring.
  81. *
  82. * @soc: core txrx main context
  83. * @int_ctx: interrupt context
  84. * @mac_id: mac_id which is one of 3 mac_ids
  85. * @quota: No. of ring entry that can be serviced in one shot.
  86. * Return: uint32_t: No. of ring entry that is processed.
  87. */
  88. uint32_t
  89. dp_rx_mon_status_process(struct dp_soc *soc, struct dp_intr *int_ctx,
  90. uint32_t mac_id, uint32_t quota);
  91. /**
  92. * dp_rx_mon_dest_process() - Brain of the Rx processing functionality
  93. * Called from the bottom half (tasklet/NET_RX_SOFTIRQ)
  94. * @soc: core txrx main contex
  95. * @int_ctx: interrupt context
  96. * @hal_ring: opaque pointer to the HAL Rx Ring, which will be serviced
  97. * @quota: No. of units (packets) that can be serviced in one shot.
  98. *
  99. * This function implements the core of Rx functionality. This is
  100. * expected to handle only non-error frames.
  101. *
  102. * Return: none
  103. */
  104. void dp_rx_mon_dest_process(struct dp_soc *soc, struct dp_intr *int_ctx,
  105. uint32_t mac_id, uint32_t quota);
  106. QDF_STATUS dp_rx_pdev_mon_desc_pool_alloc(struct dp_pdev *pdev);
  107. QDF_STATUS dp_rx_pdev_mon_buffers_alloc(struct dp_pdev *pdev);
  108. void dp_rx_pdev_mon_buffers_free(struct dp_pdev *pdev);
  109. void dp_rx_pdev_mon_desc_pool_init(struct dp_pdev *pdev);
  110. void dp_rx_pdev_mon_desc_pool_deinit(struct dp_pdev *pdev);
  111. void dp_rx_pdev_mon_desc_pool_free(struct dp_pdev *pdev);
  112. void dp_rx_pdev_mon_buf_buffers_free(struct dp_pdev *pdev, uint32_t mac_id);
  113. QDF_STATUS dp_rx_pdev_mon_status_buffers_alloc(struct dp_pdev *pdev,
  114. uint32_t mac_id);
  115. QDF_STATUS dp_rx_pdev_mon_status_desc_pool_alloc(struct dp_pdev *pdev,
  116. uint32_t mac_id);
  117. void dp_rx_pdev_mon_status_desc_pool_init(struct dp_pdev *pdev,
  118. uint32_t mac_id);
  119. void dp_rx_pdev_mon_status_desc_pool_deinit(struct dp_pdev *pdev,
  120. uint32_t mac_id);
  121. void dp_rx_pdev_mon_status_desc_pool_free(struct dp_pdev *pdev,
  122. uint32_t mac_id);
  123. void dp_rx_pdev_mon_status_buffers_free(struct dp_pdev *pdev, uint32_t mac_id);
  124. QDF_STATUS
  125. dp_rx_pdev_mon_buf_buffers_alloc(struct dp_pdev *pdev, uint32_t mac_id,
  126. bool delayed_replenish);
  127. QDF_STATUS
  128. dp_rx_pdev_mon_buf_desc_pool_alloc(struct dp_pdev *pdev, uint32_t mac_id);
  129. void
  130. dp_rx_pdev_mon_buf_desc_pool_init(struct dp_pdev *pdev, uint32_t mac_id);
  131. /**
  132. * dp_rx_mon_handle_status_buf_done () - Handle DMA not done case for
  133. * monitor status ring
  134. *
  135. * @pdev: DP pdev handle
  136. * @mon_status_srng: Monitor status SRNG
  137. *
  138. * Return: enum dp_mon_reap_status
  139. */
  140. enum dp_mon_reap_status
  141. dp_rx_mon_handle_status_buf_done(struct dp_pdev *pdev,
  142. void *mon_status_srng);
  143. #ifdef QCA_SUPPORT_FULL_MON
  144. /**
  145. * dp_full_mon_attach() - Full monitor mode attach
  146. * This API initilises full monitor mode resources
  147. *
  148. * @pdev: dp pdev object
  149. *
  150. * Return: void
  151. *
  152. */
  153. void dp_full_mon_attach(struct dp_pdev *pdev);
  154. /**
  155. * dp_full_mon_detach() - Full monitor mode attach
  156. * This API deinitilises full monitor mode resources
  157. *
  158. * @pdev: dp pdev object
  159. *
  160. * Return: void
  161. *
  162. */
  163. void dp_full_mon_detach(struct dp_pdev *pdev);
  164. /**
  165. * dp_rx_mon_process ()- API to process monitor destination ring for
  166. * full monitor mode
  167. *
  168. * @soc: dp soc handle
  169. * @int_ctx: interrupt context
  170. * @mac_id: lmac id
  171. * @quota: No. of ring entry that can be serviced in one shot.
  172. */
  173. uint32_t dp_rx_mon_process(struct dp_soc *soc, struct dp_intr *int_ctx,
  174. uint32_t mac_id, uint32_t quota);
  175. #else
  176. /**
  177. * dp_full_mon_attach() - attach full monitor mode resources
  178. * @pdev: Datapath PDEV handle
  179. *
  180. * Return: void
  181. */
  182. static inline void dp_full_mon_attach(struct dp_pdev *pdev)
  183. {
  184. }
  185. /**
  186. * dp_full_mon_detach() - detach full monitor mode resources
  187. * @pdev: Datapath PDEV handle
  188. *
  189. * Return: void
  190. *
  191. */
  192. static inline void dp_full_mon_detach(struct dp_pdev *pdev)
  193. {
  194. }
  195. #endif
  196. /**
  197. * dp_reset_monitor_mode() - Disable monitor mode
  198. * @pdev_handle: Datapath PDEV handle
  199. *
  200. * Return: QDF_STATUS
  201. */
  202. QDF_STATUS dp_reset_monitor_mode(struct cdp_soc_t *soc_hdl,
  203. uint8_t pdev_id,
  204. uint8_t smart_monitor);
  205. /**
  206. * dp_mon_link_free() - free monitor link desc pool
  207. * @pdev: core txrx pdev context
  208. *
  209. * This function will release DP link desc pool for monitor mode from
  210. * main device context.
  211. *
  212. * Return: QDF_STATUS_SUCCESS: success
  213. * QDF_STATUS_E_RESOURCES: Error return
  214. */
  215. QDF_STATUS dp_mon_link_free(struct dp_pdev *pdev);
  216. /**
  217. * dp_mon_process() - Main monitor mode processing roution.
  218. * @soc: core txrx main context
  219. * @int_ctx: interrupt context
  220. * @mac_id: mac_id which is one of 3 mac_ids
  221. * @quota: No. of status ring entry that can be serviced in one shot.
  222. *
  223. * This call monitor status ring process then monitor
  224. * destination ring process.
  225. * Called from the bottom half (tasklet/NET_RX_SOFTIRQ)
  226. *
  227. * Return: uint32_t: No. of ring entry that is processed.
  228. */
  229. uint32_t dp_mon_process(struct dp_soc *soc, struct dp_intr *int_ctx,
  230. uint32_t mac_id, uint32_t quota);
  231. /**
  232. * dp_mon_drop_packets_for_mac() - Drop the mon status ring and
  233. * dest ring packets for a given mac. Packets in status ring and
  234. * dest ring are dropped independently.
  235. * @pdev: DP pdev
  236. * @mac_id: mac id
  237. * @quota: max number of status ring entries that can be processed
  238. *
  239. * Return: work done
  240. */
  241. uint32_t dp_mon_drop_packets_for_mac(struct dp_pdev *pdev, uint32_t mac_id,
  242. uint32_t quota);
  243. QDF_STATUS dp_rx_mon_deliver(struct dp_soc *soc, uint32_t mac_id,
  244. qdf_nbuf_t head_msdu, qdf_nbuf_t tail_msdu);
  245. /*
  246. * dp_rx_mon_deliver_non_std() - deliver frames for non standard path
  247. * @soc: core txrx main contex
  248. * @mac_id: MAC ID
  249. *
  250. * This function delivers the radio tap and dummy MSDU
  251. * into user layer application for preamble only PPDU.
  252. *
  253. * Return: Operation status
  254. */
  255. QDF_STATUS dp_rx_mon_deliver_non_std(struct dp_soc *soc, uint32_t mac_id);
  256. /**
  257. * dp_rxdma_err_process() - RxDMA error processing functionality
  258. * @soc: core txrx main contex
  259. * @mac_id: mac id which is one of 3 mac_ids
  260. * @hal_ring: opaque pointer to the HAL Rx Ring, which will be serviced
  261. * @quota: No. of units (packets) that can be serviced in one shot.
  262. *
  263. * Return: num of buffers processed
  264. */
  265. uint32_t dp_rxdma_err_process(struct dp_intr *int_ctx, struct dp_soc *soc,
  266. uint32_t mac_id, uint32_t quota);
  267. /**
  268. * dp_mon_buf_delayed_replenish() - Helper routine to replenish monitor dest buf
  269. * @pdev: DP pdev object
  270. *
  271. * Return: None
  272. */
  273. void dp_mon_buf_delayed_replenish(struct dp_pdev *pdev);
  274. /**
  275. * dp_rx_mon_link_desc_return() - Return a MPDU link descriptor to HW
  276. * (WBM), following error handling
  277. *
  278. * @dp_pdev: core txrx pdev context
  279. * @buf_addr_info: void pointer to monitor link descriptor buf addr info
  280. * Return: QDF_STATUS
  281. */
  282. QDF_STATUS
  283. dp_rx_mon_link_desc_return(struct dp_pdev *dp_pdev,
  284. hal_buff_addrinfo_t buf_addr_info,
  285. int mac_id);
  286. /**
  287. * dp_mon_adjust_frag_len() - MPDU and MSDU may spread across
  288. * multiple nbufs. This function
  289. * is to return data length in
  290. * fragmented buffer
  291. *
  292. * @total_len: pointer to remaining data length.
  293. * @frag_len: pointer to data length in this fragment.
  294. * @l2_hdr_pad: l2 header padding
  295. */
  296. static inline void dp_mon_adjust_frag_len(uint32_t *total_len,
  297. uint32_t *frag_len,
  298. uint16_t l2_hdr_pad)
  299. {
  300. if (*total_len >= (RX_MONITOR_BUFFER_SIZE - RX_PKT_TLVS_LEN)) {
  301. *frag_len = RX_MONITOR_BUFFER_SIZE - RX_PKT_TLVS_LEN -
  302. l2_hdr_pad;
  303. *total_len -= *frag_len;
  304. } else {
  305. *frag_len = *total_len;
  306. *total_len = 0;
  307. }
  308. }
  309. /**
  310. * dp_rx_mon_frag_adjust_frag_len() - MPDU and MSDU may spread across
  311. * multiple nbufs. This function is to return data length in
  312. * fragmented buffer.
  313. * It takes input as max_limit for any buffer(as it changes based
  314. * on decap type and buffer sequence in MSDU.
  315. *
  316. * If MSDU is divided into multiple buffer then below format will
  317. * be max limit.
  318. * Decap type Non-Raw
  319. *--------------------------------
  320. *| 1st | 2nd | ... | Last |
  321. *| 1662 | 1664 | 1664 | <=1664 |
  322. *--------------------------------
  323. * Decap type Raw
  324. *--------------------------------
  325. *| 1st | 2nd | ... | Last |
  326. *| 1664 | 1664 | 1664 | <=1664 |
  327. *--------------------------------
  328. *
  329. * It also calculate if current buffer has placeholder to keep padding byte.
  330. * --------------------------------
  331. * | MAX LIMIT(1662/1664) |
  332. * --------------------------------
  333. * | Actual Data | Pad byte Pholder |
  334. * --------------------------------
  335. *
  336. * @total_len: Remaining data length.
  337. * @frag_len: Data length in this fragment.
  338. * @max_limit: Max limit of current buffer/MSDU.
  339. */
  340. #ifdef DP_RX_MON_MEM_FRAG
  341. static inline
  342. void dp_rx_mon_frag_adjust_frag_len(uint32_t *total_len, uint32_t *frag_len,
  343. uint32_t max_limit)
  344. {
  345. if (*total_len >= max_limit) {
  346. *frag_len = max_limit;
  347. *total_len -= *frag_len;
  348. } else {
  349. *frag_len = *total_len;
  350. *total_len = 0;
  351. }
  352. }
  353. /**
  354. * DP_RX_MON_GET_NBUF_FROM_DESC() - Get nbuf from desc
  355. */
  356. #define DP_RX_MON_GET_NBUF_FROM_DESC(rx_desc) \
  357. NULL
  358. /**
  359. * dp_rx_mon_add_msdu_to_list_failure_handler() - Handler for nbuf buffer
  360. * attach failure
  361. *
  362. * @rx_tlv_hdr: rx_tlv_hdr
  363. * @pdev: struct dp_pdev *
  364. * @last: skb pointing to last skb in chained list at any moment
  365. * @head_msdu: parent skb in the chained list
  366. * @tail_msdu: Last skb in the chained list
  367. * @func_name: caller function name
  368. *
  369. * Return: void
  370. */
  371. static inline void
  372. dp_rx_mon_add_msdu_to_list_failure_handler(void *rx_tlv_hdr,
  373. struct dp_pdev *pdev,
  374. qdf_nbuf_t *last,
  375. qdf_nbuf_t *head_msdu,
  376. qdf_nbuf_t *tail_msdu,
  377. const char *func_name)
  378. {
  379. DP_STATS_INC(pdev, replenish.nbuf_alloc_fail, 1);
  380. qdf_frag_free(rx_tlv_hdr);
  381. if (head_msdu)
  382. qdf_nbuf_list_free(*head_msdu);
  383. dp_err("[%s] failed to allocate subsequent parent buffer to hold all frag\n",
  384. func_name);
  385. if (head_msdu)
  386. *head_msdu = NULL;
  387. if (last)
  388. *last = NULL;
  389. if (tail_msdu)
  390. *tail_msdu = NULL;
  391. }
  392. /**
  393. * dp_rx_mon_get_paddr_from_desc() - Get paddr from desc
  394. */
  395. static inline
  396. qdf_dma_addr_t dp_rx_mon_get_paddr_from_desc(struct dp_rx_desc *rx_desc)
  397. {
  398. return rx_desc->paddr_buf_start;
  399. }
  400. /**
  401. * DP_RX_MON_IS_BUFFER_ADDR_NULL() - Is Buffer received from hw is NULL
  402. */
  403. #define DP_RX_MON_IS_BUFFER_ADDR_NULL(rx_desc) \
  404. (!(rx_desc->rx_buf_start))
  405. #define DP_RX_MON_IS_MSDU_NOT_NULL(msdu) \
  406. true
  407. /**
  408. * dp_rx_mon_buffer_free() - Free nbuf or frag memory
  409. * Free nbuf if feature is disabled, else free frag.
  410. *
  411. * @rx_desc: Rx desc
  412. */
  413. static inline void
  414. dp_rx_mon_buffer_free(struct dp_rx_desc *rx_desc)
  415. {
  416. qdf_frag_free(rx_desc->rx_buf_start);
  417. }
  418. /**
  419. * dp_rx_mon_buffer_unmap() - Unmap nbuf or frag memory
  420. * Unmap nbuf if feature is disabled, else unmap frag.
  421. *
  422. * @soc: struct dp_soc *
  423. * @rx_desc: struct dp_rx_desc *
  424. * @size: Size to be unmapped
  425. */
  426. static inline void
  427. dp_rx_mon_buffer_unmap(struct dp_soc *soc, struct dp_rx_desc *rx_desc,
  428. uint16_t size)
  429. {
  430. qdf_mem_unmap_page(soc->osdev, rx_desc->paddr_buf_start,
  431. size, QDF_DMA_FROM_DEVICE);
  432. }
  433. /**
  434. * dp_rx_mon_alloc_parent_buffer() - Allocate parent buffer to hold
  435. * radiotap header and accommodate all frag memory in nr_frag.
  436. *
  437. * @head_msdu: Ptr to hold allocated Msdu
  438. *
  439. * Return: QDF_STATUS
  440. */
  441. static inline
  442. QDF_STATUS dp_rx_mon_alloc_parent_buffer(qdf_nbuf_t *head_msdu)
  443. {
  444. /*
  445. * Headroom should accommodate radiotap header
  446. * and protocol and flow tag for all frag
  447. * Length reserved to accommodate Radiotap header
  448. * is 128 bytes and length reserved for Protocol
  449. * flow tag will vary based on QDF_NBUF_MAX_FRAGS.
  450. */
  451. /* -------------------------------------------------
  452. * | Protocol & Flow TAG | Radiotap header|
  453. * | | Length(128 B) |
  454. * | ((4* QDF_NBUF_MAX_FRAGS) * 2) | |
  455. * -------------------------------------------------
  456. */
  457. *head_msdu = qdf_nbuf_alloc_no_recycler(DP_RX_MON_MAX_MONITOR_HEADER,
  458. DP_RX_MON_MAX_MONITOR_HEADER, 4);
  459. if (!(*head_msdu))
  460. return QDF_STATUS_E_FAILURE;
  461. qdf_mem_zero(qdf_nbuf_head(*head_msdu), qdf_nbuf_headroom(*head_msdu));
  462. /* Set *head_msdu->next as NULL as all msdus are
  463. * mapped via nr frags
  464. */
  465. qdf_nbuf_set_next(*head_msdu, NULL);
  466. return QDF_STATUS_SUCCESS;
  467. }
  468. /**
  469. * dp_rx_mon_parse_desc_buffer() - Parse desc buffer based.
  470. *
  471. * Below code will parse desc buffer, handle continuation frame,
  472. * adjust frag length and update l2_hdr_padding
  473. *
  474. * @soc : struct dp_soc*
  475. * @msdu_info : struct hal_rx_msdu_desc_info*
  476. * @is_frag_p : is_frag *
  477. * @total_frag_len_p : Remaining frag len to be updated
  478. * @frag_len_p : frag len
  479. * @l2_hdr_offset_p : l2 hdr offset
  480. * @rx_desc_tlv : rx_desc_tlv
  481. * @is_frag_non_raw_p : Non raw frag
  482. * @data : NBUF Data
  483. */
  484. static inline void
  485. dp_rx_mon_parse_desc_buffer(struct dp_soc *dp_soc,
  486. struct hal_rx_msdu_desc_info *msdu_info,
  487. bool *is_frag_p, uint32_t *total_frag_len_p,
  488. uint32_t *frag_len_p, uint16_t *l2_hdr_offset_p,
  489. qdf_frag_t rx_desc_tlv,
  490. bool *is_frag_non_raw_p, void *data)
  491. {
  492. struct hal_rx_mon_dest_buf_info frame_info;
  493. uint16_t tot_payload_len =
  494. RX_MONITOR_BUFFER_SIZE - RX_PKT_TLVS_LEN;
  495. if (msdu_info->msdu_flags & HAL_MSDU_F_MSDU_CONTINUATION) {
  496. /* First buffer of MSDU */
  497. if (!(*is_frag_p)) {
  498. /* Set total frag_len from msdu_len */
  499. *total_frag_len_p = msdu_info->msdu_len;
  500. *is_frag_p = true;
  501. if (HAL_HW_RX_DECAP_FORMAT_RAW ==
  502. HAL_RX_DESC_GET_DECAP_FORMAT(rx_desc_tlv)) {
  503. *l2_hdr_offset_p =
  504. DP_RX_MON_RAW_L2_HDR_PAD_BYTE;
  505. frame_info.is_decap_raw = 1;
  506. } else {
  507. *l2_hdr_offset_p =
  508. DP_RX_MON_NONRAW_L2_HDR_PAD_BYTE;
  509. frame_info.is_decap_raw = 0;
  510. *is_frag_non_raw_p = true;
  511. }
  512. dp_rx_mon_frag_adjust_frag_len(total_frag_len_p,
  513. frag_len_p,
  514. tot_payload_len -
  515. *l2_hdr_offset_p);
  516. frame_info.first_buffer = 1;
  517. frame_info.last_buffer = 0;
  518. hal_rx_mon_dest_set_buffer_info_to_tlv(rx_desc_tlv,
  519. &frame_info);
  520. } else {
  521. /*
  522. * Continuation Middle frame
  523. * Here max limit will be same for Raw and Non raw case.
  524. */
  525. *l2_hdr_offset_p = DP_RX_MON_RAW_L2_HDR_PAD_BYTE;
  526. dp_rx_mon_frag_adjust_frag_len(total_frag_len_p,
  527. frag_len_p,
  528. tot_payload_len);
  529. /* Update frame info if is non raw frame */
  530. if (*is_frag_non_raw_p)
  531. frame_info.is_decap_raw = 0;
  532. else
  533. frame_info.is_decap_raw = 1;
  534. frame_info.first_buffer = 0;
  535. frame_info.last_buffer = 0;
  536. hal_rx_mon_dest_set_buffer_info_to_tlv(rx_desc_tlv,
  537. &frame_info);
  538. }
  539. } else {
  540. /**
  541. * Last buffer of MSDU spread among multiple buffer
  542. * Here max limit will be same for Raw and Non raw case.
  543. */
  544. if (*is_frag_p) {
  545. *l2_hdr_offset_p = DP_RX_MON_RAW_L2_HDR_PAD_BYTE;
  546. dp_rx_mon_frag_adjust_frag_len(total_frag_len_p,
  547. frag_len_p,
  548. tot_payload_len);
  549. /* Update frame info if is non raw frame */
  550. if (*is_frag_non_raw_p)
  551. frame_info.is_decap_raw = 0;
  552. else
  553. frame_info.is_decap_raw = 1;
  554. frame_info.first_buffer = 0;
  555. frame_info.last_buffer = 1;
  556. hal_rx_mon_dest_set_buffer_info_to_tlv(rx_desc_tlv,
  557. &frame_info);
  558. } else {
  559. /* MSDU with single buffer */
  560. *frag_len_p = msdu_info->msdu_len;
  561. if (HAL_HW_RX_DECAP_FORMAT_RAW ==
  562. HAL_RX_DESC_GET_DECAP_FORMAT(rx_desc_tlv)) {
  563. *l2_hdr_offset_p =
  564. DP_RX_MON_RAW_L2_HDR_PAD_BYTE;
  565. frame_info.is_decap_raw = 1;
  566. } else {
  567. *l2_hdr_offset_p =
  568. DP_RX_MON_NONRAW_L2_HDR_PAD_BYTE;
  569. frame_info.is_decap_raw = 0;
  570. }
  571. frame_info.first_buffer = 1;
  572. frame_info.last_buffer = 1;
  573. hal_rx_mon_dest_set_buffer_info_to_tlv(
  574. rx_desc_tlv, &frame_info);
  575. }
  576. /* Reset bool after complete processing of MSDU */
  577. *is_frag_p = false;
  578. *is_frag_non_raw_p = false;
  579. }
  580. }
  581. /**
  582. * dp_rx_mon_buffer_set_pktlen() - set pktlen for buffer
  583. */
  584. static inline void dp_rx_mon_buffer_set_pktlen(qdf_nbuf_t msdu, uint32_t size)
  585. {
  586. }
  587. /**
  588. * dp_rx_mon_add_msdu_to_list()- Add msdu to list and update head_msdu
  589. * It will add reaped buffer frag to nr frag of parent msdu.
  590. *
  591. * @head_msdu: NULL if first time called else &msdu
  592. * @msdu: Msdu where frag address needs to be added via nr_frag
  593. * @last: Used to traverse in list if this feature is disabled.
  594. * @rx_desc_tlv: Frag address
  595. * @frag_len: Frag len
  596. * @l2_hdr_offset: l2 hdr padding
  597. */
  598. static inline
  599. QDF_STATUS dp_rx_mon_add_msdu_to_list(qdf_nbuf_t *head_msdu, qdf_nbuf_t msdu,
  600. qdf_nbuf_t *last, qdf_frag_t rx_desc_tlv,
  601. uint32_t frag_len,
  602. uint32_t l2_hdr_offset)
  603. {
  604. uint32_t num_frags;
  605. qdf_nbuf_t msdu_curr;
  606. /* Here head_msdu and *head_msdu must not be NULL */
  607. /* Dont add frag to skb if frag length is zero. Drop frame */
  608. if (qdf_unlikely(!frag_len || !head_msdu || !(*head_msdu))) {
  609. dp_err("[%s] frag_len[%d] || head_msdu[%pK] || *head_msdu is Null while adding frag to skb\n",
  610. __func__, frag_len, head_msdu);
  611. return QDF_STATUS_E_FAILURE;
  612. }
  613. /* In case of first desc of MPDU, assign curr msdu to *head_msdu */
  614. if (!qdf_nbuf_get_nr_frags(*head_msdu))
  615. msdu_curr = *head_msdu;
  616. else
  617. msdu_curr = *last;
  618. /* Current msdu must not be NULL */
  619. if (qdf_unlikely(!msdu_curr)) {
  620. dp_err("[%s] Current msdu can't be Null while adding frag to skb\n",
  621. __func__);
  622. return QDF_STATUS_E_FAILURE;
  623. }
  624. num_frags = qdf_nbuf_get_nr_frags(msdu_curr);
  625. if (num_frags < QDF_NBUF_MAX_FRAGS) {
  626. qdf_nbuf_add_rx_frag(rx_desc_tlv, msdu_curr,
  627. SIZE_OF_MONITOR_TLV,
  628. frag_len + l2_hdr_offset,
  629. RX_MONITOR_BUFFER_SIZE,
  630. false);
  631. if (*last != msdu_curr)
  632. *last = msdu_curr;
  633. return QDF_STATUS_SUCCESS;
  634. }
  635. /* Execution will reach here only if num_frags == QDF_NBUF_MAX_FRAGS */
  636. msdu_curr = NULL;
  637. if ((dp_rx_mon_alloc_parent_buffer(&msdu_curr))
  638. != QDF_STATUS_SUCCESS)
  639. return QDF_STATUS_E_FAILURE;
  640. qdf_nbuf_add_rx_frag(rx_desc_tlv, msdu_curr, SIZE_OF_MONITOR_TLV,
  641. frag_len + l2_hdr_offset, RX_MONITOR_BUFFER_SIZE,
  642. false);
  643. /* Add allocated nbuf in the chain */
  644. qdf_nbuf_set_next(*last, msdu_curr);
  645. /* Assign current msdu to last to avoid traversal */
  646. *last = msdu_curr;
  647. return QDF_STATUS_SUCCESS;
  648. }
  649. /**
  650. * dp_rx_mon_init_tail_msdu() - Initialize tail msdu
  651. *
  652. * @head_msdu: Parent buffer to hold MPDU data
  653. * @msdu: Msdu to be updated in tail_msdu
  654. * @last: last msdu
  655. * @tail_msdu: Last msdu
  656. */
  657. static inline
  658. void dp_rx_mon_init_tail_msdu(qdf_nbuf_t *head_msdu, qdf_nbuf_t msdu,
  659. qdf_nbuf_t last, qdf_nbuf_t *tail_msdu)
  660. {
  661. if (!head_msdu || !(*head_msdu)) {
  662. *tail_msdu = NULL;
  663. return;
  664. }
  665. if (last)
  666. qdf_nbuf_set_next(last, NULL);
  667. *tail_msdu = last;
  668. }
  669. /**
  670. * dp_rx_mon_remove_raw_frame_fcs_len() - Remove FCS length for Raw Frame
  671. *
  672. * If feature is disabled, then removal happens in restitch logic.
  673. *
  674. * @head_msdu: Head msdu
  675. * @tail_msdu: Tail msdu
  676. */
  677. static inline
  678. void dp_rx_mon_remove_raw_frame_fcs_len(qdf_nbuf_t *head_msdu,
  679. qdf_nbuf_t *tail_msdu)
  680. {
  681. qdf_frag_t addr;
  682. if (qdf_unlikely(!head_msdu || !tail_msdu || !(*head_msdu)))
  683. return;
  684. /* If *head_msdu is valid, then *tail_msdu must be valid */
  685. /* If head_msdu is valid, then it must have nr_frags */
  686. /* If tail_msdu is valid, then it must have nr_frags */
  687. /* Strip FCS_LEN for Raw frame */
  688. addr = qdf_nbuf_get_frag_addr(*head_msdu, 0);
  689. addr -= SIZE_OF_MONITOR_TLV;
  690. if (HAL_RX_DESC_GET_DECAP_FORMAT(addr) ==
  691. HAL_HW_RX_DECAP_FORMAT_RAW) {
  692. qdf_nbuf_trim_add_frag_size(*tail_msdu,
  693. qdf_nbuf_get_nr_frags(*tail_msdu) - 1,
  694. -HAL_RX_FCS_LEN, 0);
  695. }
  696. }
  697. /**
  698. * dp_rx_mon_get_buffer_data()- Get data from desc buffer
  699. * @rx_desc: desc
  700. *
  701. * Return address containing actual tlv content
  702. */
  703. static inline
  704. uint8_t *dp_rx_mon_get_buffer_data(struct dp_rx_desc *rx_desc)
  705. {
  706. return rx_desc->rx_buf_start;
  707. }
  708. /**
  709. * dp_rx_mon_get_nbuf_80211_hdr() - Get 80211 hdr from nbuf
  710. * @nbuf: qdf_nbuf_t
  711. *
  712. * This function must be called after moving radiotap header.
  713. *
  714. * Return: Ptr pointing to 80211 header or NULL.
  715. */
  716. static inline
  717. qdf_frag_t dp_rx_mon_get_nbuf_80211_hdr(qdf_nbuf_t nbuf)
  718. {
  719. /* Return NULL if nr_frag is Zero */
  720. if (!qdf_nbuf_get_nr_frags(nbuf))
  721. return NULL;
  722. return qdf_nbuf_get_frag_addr(nbuf, 0);
  723. }
  724. #else
  725. #define DP_RX_MON_GET_NBUF_FROM_DESC(rx_desc) \
  726. (rx_desc->nbuf)
  727. static inline void
  728. dp_rx_mon_add_msdu_to_list_failure_handler(void *rx_tlv_hdr,
  729. struct dp_pdev *pdev,
  730. qdf_nbuf_t *last,
  731. qdf_nbuf_t *head_msdu,
  732. qdf_nbuf_t *tail_msdu,
  733. const char *func_name)
  734. {
  735. }
  736. static inline
  737. qdf_dma_addr_t dp_rx_mon_get_paddr_from_desc(struct dp_rx_desc *rx_desc)
  738. {
  739. qdf_dma_addr_t paddr = 0;
  740. qdf_nbuf_t msdu = NULL;
  741. msdu = rx_desc->nbuf;
  742. if (msdu)
  743. paddr = qdf_nbuf_get_frag_paddr(msdu, 0);
  744. return paddr;
  745. }
  746. #define DP_RX_MON_IS_BUFFER_ADDR_NULL(rx_desc) \
  747. (!(rx_desc->nbuf))
  748. #define DP_RX_MON_IS_MSDU_NOT_NULL(msdu) \
  749. (msdu)
  750. static inline void
  751. dp_rx_mon_buffer_free(struct dp_rx_desc *rx_desc)
  752. {
  753. qdf_nbuf_free(rx_desc->nbuf);
  754. }
  755. static inline void
  756. dp_rx_mon_buffer_unmap(struct dp_soc *soc, struct dp_rx_desc *rx_desc,
  757. uint16_t size)
  758. {
  759. qdf_nbuf_unmap_nbytes_single(soc->osdev, rx_desc->nbuf,
  760. QDF_DMA_FROM_DEVICE, size);
  761. }
  762. static inline
  763. QDF_STATUS dp_rx_mon_alloc_parent_buffer(qdf_nbuf_t *head_msdu)
  764. {
  765. return QDF_STATUS_SUCCESS;
  766. }
  767. static inline void
  768. dp_rx_mon_parse_desc_buffer(struct dp_soc *dp_soc,
  769. struct hal_rx_msdu_desc_info *msdu_info,
  770. bool *is_frag_p, uint32_t *total_frag_len_p,
  771. uint32_t *frag_len_p, uint16_t *l2_hdr_offset_p,
  772. qdf_frag_t rx_desc_tlv,
  773. bool *is_frag_non_raw_p, void *data)
  774. {
  775. /*
  776. * HW structures call this L3 header padding
  777. * -- even though this is actually the offset
  778. * from the buffer beginning where the L2
  779. * header begins.
  780. */
  781. *l2_hdr_offset_p =
  782. hal_rx_msdu_end_l3_hdr_padding_get(dp_soc->hal_soc, data);
  783. if (msdu_info->msdu_flags & HAL_MSDU_F_MSDU_CONTINUATION) {
  784. if (!*(is_frag_p)) {
  785. *total_frag_len_p = msdu_info->msdu_len;
  786. *is_frag_p = true;
  787. }
  788. dp_mon_adjust_frag_len(total_frag_len_p, frag_len_p,
  789. *l2_hdr_offset_p);
  790. } else {
  791. if (*is_frag_p) {
  792. dp_mon_adjust_frag_len(total_frag_len_p, frag_len_p,
  793. *l2_hdr_offset_p);
  794. } else {
  795. *frag_len_p = msdu_info->msdu_len;
  796. }
  797. *is_frag_p = false;
  798. }
  799. }
  800. static inline void dp_rx_mon_buffer_set_pktlen(qdf_nbuf_t msdu, uint32_t size)
  801. {
  802. qdf_nbuf_set_pktlen(msdu, size);
  803. }
  804. static inline
  805. QDF_STATUS dp_rx_mon_add_msdu_to_list(qdf_nbuf_t *head_msdu, qdf_nbuf_t msdu,
  806. qdf_nbuf_t *last, qdf_frag_t rx_desc_tlv,
  807. uint32_t frag_len,
  808. uint32_t l2_hdr_offset)
  809. {
  810. if (head_msdu && !*head_msdu) {
  811. *head_msdu = msdu;
  812. } else {
  813. if (*last)
  814. qdf_nbuf_set_next(*last, msdu);
  815. }
  816. *last = msdu;
  817. return QDF_STATUS_SUCCESS;
  818. }
  819. static inline
  820. void dp_rx_mon_init_tail_msdu(qdf_nbuf_t *head_msdu, qdf_nbuf_t msdu,
  821. qdf_nbuf_t last, qdf_nbuf_t *tail_msdu)
  822. {
  823. if (last)
  824. qdf_nbuf_set_next(last, NULL);
  825. *tail_msdu = msdu;
  826. }
  827. static inline
  828. void dp_rx_mon_remove_raw_frame_fcs_len(qdf_nbuf_t *head_msdu,
  829. qdf_nbuf_t *tail_msdu)
  830. {
  831. }
  832. static inline
  833. uint8_t *dp_rx_mon_get_buffer_data(struct dp_rx_desc *rx_desc)
  834. {
  835. qdf_nbuf_t msdu = NULL;
  836. uint8_t *data = NULL;
  837. msdu = rx_desc->nbuf;
  838. if (qdf_likely(msdu))
  839. data = qdf_nbuf_data(msdu);
  840. return data;
  841. }
  842. static inline
  843. qdf_frag_t dp_rx_mon_get_nbuf_80211_hdr(qdf_nbuf_t nbuf)
  844. {
  845. return qdf_nbuf_data(nbuf);
  846. }
  847. #endif
  848. /**
  849. * dp_rx_cookie_2_mon_link_desc() - Retrieve Link descriptor based on target
  850. * @pdev: core physical device context
  851. * @hal_buf_info: structure holding the buffer info
  852. * mac_id: mac number
  853. *
  854. * Return: link descriptor address
  855. */
  856. static inline
  857. void *dp_rx_cookie_2_mon_link_desc(struct dp_pdev *pdev,
  858. struct hal_buf_info buf_info,
  859. uint8_t mac_id)
  860. {
  861. if (pdev->soc->wlan_cfg_ctx->rxdma1_enable)
  862. return dp_rx_cookie_2_mon_link_desc_va(pdev, &buf_info,
  863. mac_id);
  864. return dp_rx_cookie_2_link_desc_va(pdev->soc, &buf_info);
  865. }
  866. /**
  867. * dp_rx_monitor_link_desc_return() - Return Link descriptor based on target
  868. * @pdev: core physical device context
  869. * @p_last_buf_addr_info: MPDU Link descriptor
  870. * mac_id: mac number
  871. *
  872. * Return: QDF_STATUS
  873. */
  874. static inline
  875. QDF_STATUS dp_rx_monitor_link_desc_return(struct dp_pdev *pdev,
  876. hal_buff_addrinfo_t
  877. p_last_buf_addr_info,
  878. uint8_t mac_id, uint8_t bm_action)
  879. {
  880. if (pdev->soc->wlan_cfg_ctx->rxdma1_enable)
  881. return dp_rx_mon_link_desc_return(pdev, p_last_buf_addr_info,
  882. mac_id);
  883. return dp_rx_link_desc_return_by_addr(pdev->soc, p_last_buf_addr_info,
  884. bm_action);
  885. }
  886. /**
  887. * dp_rxdma_get_mon_dst_ring() - Return the pointer to rxdma_err_dst_ring
  888. * or mon_dst_ring based on the target
  889. * @pdev: core physical device context
  890. * @mac_for_pdev: mac_id number
  891. *
  892. * Return: ring address
  893. */
  894. static inline
  895. void *dp_rxdma_get_mon_dst_ring(struct dp_pdev *pdev,
  896. uint8_t mac_for_pdev)
  897. {
  898. if (pdev->soc->wlan_cfg_ctx->rxdma1_enable)
  899. return pdev->soc->rxdma_mon_dst_ring[mac_for_pdev].hal_srng;
  900. return pdev->soc->rxdma_err_dst_ring[mac_for_pdev].hal_srng;
  901. }
  902. /**
  903. * dp_rxdma_get_mon_buf_ring() - Return monitor buf ring address
  904. * based on target
  905. * @pdev: core physical device context
  906. * @mac_for_pdev: mac id number
  907. *
  908. * Return: ring address
  909. */
  910. static inline
  911. struct dp_srng *dp_rxdma_get_mon_buf_ring(struct dp_pdev *pdev,
  912. uint8_t mac_for_pdev)
  913. {
  914. if (pdev->soc->wlan_cfg_ctx->rxdma1_enable)
  915. return &pdev->soc->rxdma_mon_buf_ring[mac_for_pdev];
  916. /* For MCL there is only 1 rx refill ring */
  917. return &pdev->soc->rx_refill_buf_ring[0];
  918. }
  919. /**
  920. * dp_rx_get_mon_desc_pool() - Return monitor descriptor pool
  921. * based on target
  922. * @soc: soc handle
  923. * @mac_id: mac id number
  924. * @pdev_id: pdev id number
  925. *
  926. * Return: descriptor pool address
  927. */
  928. static inline
  929. struct rx_desc_pool *dp_rx_get_mon_desc_pool(struct dp_soc *soc,
  930. uint8_t mac_id,
  931. uint8_t pdev_id)
  932. {
  933. if (soc->wlan_cfg_ctx->rxdma1_enable)
  934. return &soc->rx_desc_mon[mac_id];
  935. return &soc->rx_desc_buf[pdev_id];
  936. }
  937. /**
  938. * dp_rx_get_mon_desc() - Return Rx descriptor based on target
  939. * @soc: soc handle
  940. * @cookie: cookie value
  941. *
  942. * Return: Rx descriptor
  943. */
  944. static inline
  945. struct dp_rx_desc *dp_rx_get_mon_desc(struct dp_soc *soc,
  946. uint32_t cookie)
  947. {
  948. if (soc->wlan_cfg_ctx->rxdma1_enable)
  949. return dp_rx_cookie_2_va_mon_buf(soc, cookie);
  950. return dp_rx_cookie_2_va_rxdma_buf(soc, cookie);
  951. }
  952. #ifndef REMOVE_MON_DBG_STATS
  953. /*
  954. * dp_rx_mon_update_dbg_ppdu_stats() - Update status ring TLV count
  955. * @ppdu_info: HAL RX PPDU info retrieved from status ring TLV
  956. * @rx_mon_stats: monitor mode status/destination ring PPDU and MPDU count
  957. *
  958. * Update status ring PPDU start and end count. Keep track TLV state on
  959. * PPDU start and end to find out if start and end is matching. Keep
  960. * track missing PPDU start and end count. Keep track matching PPDU
  961. * start and end count.
  962. *
  963. * Return: None
  964. */
  965. static inline void
  966. dp_rx_mon_update_dbg_ppdu_stats(struct hal_rx_ppdu_info *ppdu_info,
  967. struct cdp_pdev_mon_stats *rx_mon_stats)
  968. {
  969. if (ppdu_info->rx_state ==
  970. HAL_RX_MON_PPDU_START) {
  971. rx_mon_stats->status_ppdu_start++;
  972. if (rx_mon_stats->status_ppdu_state
  973. != CDP_MON_PPDU_END)
  974. rx_mon_stats->status_ppdu_end_mis++;
  975. rx_mon_stats->status_ppdu_state
  976. = CDP_MON_PPDU_START;
  977. ppdu_info->rx_state = HAL_RX_MON_PPDU_RESET;
  978. } else if (ppdu_info->rx_state ==
  979. HAL_RX_MON_PPDU_END) {
  980. rx_mon_stats->status_ppdu_end++;
  981. if (rx_mon_stats->status_ppdu_state
  982. != CDP_MON_PPDU_START)
  983. rx_mon_stats->status_ppdu_start_mis++;
  984. else
  985. rx_mon_stats->status_ppdu_compl++;
  986. rx_mon_stats->status_ppdu_state
  987. = CDP_MON_PPDU_END;
  988. ppdu_info->rx_state = HAL_RX_MON_PPDU_RESET;
  989. }
  990. }
  991. /*
  992. * dp_rx_mon_init_dbg_ppdu_stats() - initialization for monitor mode stats
  993. * @ppdu_info: HAL RX PPDU info retrieved from status ring TLV
  994. * @rx_mon_stats: monitor mode status/destination ring PPDU and MPDU count
  995. *
  996. * Return: None
  997. */
  998. static inline void
  999. dp_rx_mon_init_dbg_ppdu_stats(struct hal_rx_ppdu_info *ppdu_info,
  1000. struct cdp_pdev_mon_stats *rx_mon_stats)
  1001. {
  1002. ppdu_info->rx_state = HAL_RX_MON_PPDU_END;
  1003. rx_mon_stats->status_ppdu_state
  1004. = CDP_MON_PPDU_END;
  1005. }
  1006. #else
  1007. static inline void
  1008. dp_rx_mon_update_dbg_ppdu_stats(struct hal_rx_ppdu_info *ppdu_info,
  1009. struct cdp_pdev_mon_stats *rx_mon_stats)
  1010. {
  1011. }
  1012. static inline void
  1013. dp_rx_mon_init_dbg_ppdu_stats(struct hal_rx_ppdu_info *ppdu_info,
  1014. struct cdp_pdev_mon_stats *rx_mon_stats)
  1015. {
  1016. }
  1017. #endif
  1018. #if !defined(DISABLE_MON_CONFIG) && defined(MON_ENABLE_DROP_FOR_MAC)
  1019. /**
  1020. * dp_mon_dest_srng_drop_for_mac() - Drop the mon dest ring packets for
  1021. * a given mac
  1022. * @pdev: DP pdev
  1023. * @mac_id: mac id
  1024. *
  1025. * Return: None
  1026. */
  1027. uint32_t
  1028. dp_mon_dest_srng_drop_for_mac(struct dp_pdev *pdev, uint32_t mac_id);
  1029. #endif
  1030. #endif