dp_rx_mon.h 32 KB

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