dp_rx_mon.h 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742
  1. /*
  2. * Copyright (c) 2016-2021 The Linux Foundation. All rights reserved.
  3. * Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
  4. *
  5. * Permission to use, copy, modify, and/or distribute this software for
  6. * any purpose with or without fee is hereby granted, provided that the
  7. * above copyright notice and this permission notice appear in all
  8. * copies.
  9. *
  10. * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
  11. * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
  12. * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
  13. * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
  14. * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
  15. * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
  16. * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  17. * PERFORMANCE OF THIS SOFTWARE.
  18. */
  19. #ifndef _DP_RX_MON_H_
  20. #define _DP_RX_MON_H_
  21. #define dp_rx_mon_status_alert(params...) QDF_TRACE_FATAL(QDF_MODULE_ID_DP_RX_MON_STATUS, params)
  22. #define dp_rx_mon_status_err(params...) QDF_TRACE_ERROR(QDF_MODULE_ID_DP_RX_MON_STATUS, params)
  23. #define dp_rx_mon_status_warn(params...) QDF_TRACE_WARN(QDF_MODULE_ID_DP_RX_MON_STATUS, params)
  24. #define dp_rx_mon_status_info(params...) \
  25. __QDF_TRACE_FL(QDF_TRACE_LEVEL_INFO_HIGH, QDF_MODULE_ID_DP_RX_MON_STATUS, ## params)
  26. #define dp_rx_mon_status_debug(params...) QDF_TRACE_DEBUG(QDF_MODULE_ID_DP_RX_MON_STATUS, params)
  27. #define dp_rx_mon_dest_alert(params...) QDF_TRACE_FATAL(QDF_MODULE_ID_DP_RX_MON_DEST, params)
  28. #define dp_rx_mon_dest_err(params...) QDF_TRACE_ERROR(QDF_MODULE_ID_DP_RX_MON_DEST, params)
  29. #define dp_rx_mon_dest_warn(params...) QDF_TRACE_WARN(QDF_MODULE_ID_DP_RX_MON_DEST, params)
  30. #define dp_rx_mon_dest_info(params...) \
  31. __QDF_TRACE_FL(QDF_TRACE_LEVEL_INFO_HIGH, QDF_MODULE_ID_DP_RX_MON_DEST, ## params)
  32. #define dp_rx_mon_dest_debug(params...) QDF_TRACE_DEBUG(QDF_MODULE_ID_DP_RX_MON_DEST, params)
  33. /* The maximum buffer length allocated for radiotap for monitor status buffer */
  34. #define MAX_MONITOR_HEADER (512)
  35. /**
  36. * enum dp_mon_reap_status - monitor status ring ppdu status
  37. *
  38. * @DP_MON_STATUS_NO_DMA - DMA not done for status ring entry
  39. * @DP_MON_STATUS_MATCH - status and dest ppdu id mathes
  40. * @DP_MON_STATUS_LAG - status ppdu id is lagging
  41. * @DP_MON_STATUS_LEAD - status ppdu id is leading
  42. * @DP_MON_STATUS_REPLENISH - status ring entry is NULL
  43. */
  44. enum dp_mon_reap_status {
  45. DP_MON_STATUS_NO_DMA,
  46. DP_MON_STATUS_MATCH,
  47. DP_MON_STATUS_LAG,
  48. DP_MON_STATUS_LEAD,
  49. DP_MON_STATUS_REPLENISH
  50. };
  51. /*
  52. * dp_rx_mon_status_process() - Process monitor status ring and
  53. * TLV in status ring.
  54. *
  55. * @soc: core txrx main context
  56. * @int_ctx: interrupt context
  57. * @mac_id: mac_id which is one of 3 mac_ids
  58. * @quota: No. of ring entry that can be serviced in one shot.
  59. * Return: uint32_t: No. of ring entry that is processed.
  60. */
  61. uint32_t
  62. dp_rx_mon_status_process(struct dp_soc *soc, struct dp_intr *int_ctx,
  63. uint32_t mac_id, uint32_t quota);
  64. /*
  65. * dp_rx_populate_cbf_hdr - Send CBF frame with htt header
  66. * @soc: Datapath soc handle
  67. * @mac_id: Datapath mac id
  68. * @event: WDI event
  69. * @mpdu: mpdu buffer
  70. * @msdu_timesstamp: time stamp
  71. *
  72. * Return: QDF_STATUS
  73. */
  74. QDF_STATUS dp_rx_populate_cbf_hdr(struct dp_soc *soc,
  75. uint32_t mac_id, uint32_t event,
  76. qdf_nbuf_t data, uint32_t msdu_timestamp);
  77. /**
  78. * dp_rx_mon_handle_status_buf_done () - Handle DMA not done case for
  79. * monitor status ring
  80. *
  81. * @pdev: DP pdev handle
  82. * @mon_status_srng: Monitor status SRNG
  83. *
  84. * Return: enum dp_mon_reap_status
  85. */
  86. enum dp_mon_reap_status
  87. dp_rx_mon_handle_status_buf_done(struct dp_pdev *pdev,
  88. void *mon_status_srng);
  89. #ifdef QCA_SUPPORT_FULL_MON
  90. /**
  91. * dp_full_mon_attach() - Full monitor mode attach
  92. * This API initilises full monitor mode resources
  93. *
  94. * @pdev: dp pdev object
  95. *
  96. * Return: void
  97. *
  98. */
  99. void dp_full_mon_attach(struct dp_pdev *pdev);
  100. /**
  101. * dp_full_mon_detach() - Full monitor mode attach
  102. * This API deinitilises full monitor mode resources
  103. *
  104. * @pdev: dp pdev object
  105. *
  106. * Return: void
  107. *
  108. */
  109. void dp_full_mon_detach(struct dp_pdev *pdev);
  110. /**
  111. * dp_rx_mon_process ()- API to process monitor destination ring for
  112. * full monitor mode
  113. *
  114. * @soc: dp soc handle
  115. * @int_ctx: interrupt context
  116. * @mac_id: lmac id
  117. * @quota: No. of ring entry that can be serviced in one shot.
  118. */
  119. uint32_t dp_rx_mon_process(struct dp_soc *soc, struct dp_intr *int_ctx,
  120. uint32_t mac_id, uint32_t quota);
  121. #else
  122. /**
  123. * dp_full_mon_attach() - attach full monitor mode resources
  124. * @pdev: Datapath PDEV handle
  125. *
  126. * Return: void
  127. */
  128. static inline void dp_full_mon_attach(struct dp_pdev *pdev)
  129. {
  130. }
  131. /**
  132. * dp_full_mon_detach() - detach full monitor mode resources
  133. * @pdev: Datapath PDEV handle
  134. *
  135. * Return: void
  136. *
  137. */
  138. static inline void dp_full_mon_detach(struct dp_pdev *pdev)
  139. {
  140. }
  141. #endif
  142. /**
  143. * dp_mon_link_free() - free monitor link desc pool
  144. * @pdev: core txrx pdev context
  145. *
  146. * This function will release DP link desc pool for monitor mode from
  147. * main device context.
  148. *
  149. * Return: QDF_STATUS_SUCCESS: success
  150. * QDF_STATUS_E_RESOURCES: Error return
  151. */
  152. QDF_STATUS dp_mon_link_free(struct dp_pdev *pdev);
  153. /**
  154. * dp_mon_process() - Main monitor mode processing roution.
  155. * @soc: core txrx main context
  156. * @int_ctx: interrupt context
  157. * @mac_id: mac_id which is one of 3 mac_ids
  158. * @quota: No. of status ring entry that can be serviced in one shot.
  159. *
  160. * This call monitor status ring process then monitor
  161. * destination ring process.
  162. * Called from the bottom half (tasklet/NET_RX_SOFTIRQ)
  163. *
  164. * Return: uint32_t: No. of ring entry that is processed.
  165. */
  166. uint32_t dp_mon_process(struct dp_soc *soc, struct dp_intr *int_ctx,
  167. uint32_t mac_id, uint32_t quota);
  168. QDF_STATUS dp_rx_mon_deliver(struct dp_soc *soc, uint32_t mac_id,
  169. qdf_nbuf_t head_msdu, qdf_nbuf_t tail_msdu);
  170. /*
  171. * dp_rx_mon_deliver_non_std() - deliver frames for non standard path
  172. * @soc: core txrx main contex
  173. * @mac_id: MAC ID
  174. *
  175. * This function delivers the radio tap and dummy MSDU
  176. * into user layer application for preamble only PPDU.
  177. *
  178. * Return: Operation status
  179. */
  180. QDF_STATUS dp_rx_mon_deliver_non_std(struct dp_soc *soc, uint32_t mac_id);
  181. #ifndef REMOVE_MON_DBG_STATS
  182. /*
  183. * dp_rx_mon_update_dbg_ppdu_stats() - Update status ring TLV count
  184. * @ppdu_info: HAL RX PPDU info retrieved from status ring TLV
  185. * @rx_mon_stats: monitor mode status/destination ring PPDU and MPDU count
  186. *
  187. * Update status ring PPDU start and end count. Keep track TLV state on
  188. * PPDU start and end to find out if start and end is matching. Keep
  189. * track missing PPDU start and end count. Keep track matching PPDU
  190. * start and end count.
  191. *
  192. * Return: None
  193. */
  194. static inline void
  195. dp_rx_mon_update_dbg_ppdu_stats(struct hal_rx_ppdu_info *ppdu_info,
  196. struct cdp_pdev_mon_stats *rx_mon_stats)
  197. {
  198. if (ppdu_info->rx_state ==
  199. HAL_RX_MON_PPDU_START) {
  200. rx_mon_stats->status_ppdu_start++;
  201. if (rx_mon_stats->status_ppdu_state
  202. != CDP_MON_PPDU_END)
  203. rx_mon_stats->status_ppdu_end_mis++;
  204. rx_mon_stats->status_ppdu_state
  205. = CDP_MON_PPDU_START;
  206. ppdu_info->rx_state = HAL_RX_MON_PPDU_RESET;
  207. } else if (ppdu_info->rx_state ==
  208. HAL_RX_MON_PPDU_END) {
  209. rx_mon_stats->status_ppdu_end++;
  210. if (rx_mon_stats->status_ppdu_state
  211. != CDP_MON_PPDU_START)
  212. rx_mon_stats->status_ppdu_start_mis++;
  213. else
  214. rx_mon_stats->status_ppdu_compl++;
  215. rx_mon_stats->status_ppdu_state
  216. = CDP_MON_PPDU_END;
  217. ppdu_info->rx_state = HAL_RX_MON_PPDU_RESET;
  218. }
  219. }
  220. /*
  221. * dp_rx_mon_init_dbg_ppdu_stats() - initialization for monitor mode stats
  222. * @ppdu_info: HAL RX PPDU info retrieved from status ring TLV
  223. * @rx_mon_stats: monitor mode status/destination ring PPDU and MPDU count
  224. *
  225. * Return: None
  226. */
  227. static inline void
  228. dp_rx_mon_init_dbg_ppdu_stats(struct hal_rx_ppdu_info *ppdu_info,
  229. struct cdp_pdev_mon_stats *rx_mon_stats)
  230. {
  231. ppdu_info->rx_state = HAL_RX_MON_PPDU_END;
  232. rx_mon_stats->status_ppdu_state
  233. = CDP_MON_PPDU_END;
  234. }
  235. #else
  236. static inline void
  237. dp_rx_mon_update_dbg_ppdu_stats(struct hal_rx_ppdu_info *ppdu_info,
  238. struct cdp_pdev_mon_stats *rx_mon_stats)
  239. {
  240. }
  241. static inline void
  242. dp_rx_mon_init_dbg_ppdu_stats(struct hal_rx_ppdu_info *ppdu_info,
  243. struct cdp_pdev_mon_stats *rx_mon_stats)
  244. {
  245. }
  246. #endif
  247. #ifdef QCA_ENHANCED_STATS_SUPPORT
  248. void
  249. dp_rx_populate_rx_rssi_chain(struct hal_rx_ppdu_info *ppdu_info,
  250. struct cdp_rx_indication_ppdu *cdp_rx_ppdu);
  251. /*
  252. * dp_rx_populate_su_evm_details() - Populate su evm info
  253. * @ppdu_info: ppdu info structure from ppdu ring
  254. * @cdp_rx_ppdu: rx ppdu indication structure
  255. */
  256. void
  257. dp_rx_populate_su_evm_details(struct hal_rx_ppdu_info *ppdu_info,
  258. struct cdp_rx_indication_ppdu *cdp_rx_ppdu);
  259. /**
  260. * dp_rx_handle_ppdu_stats() - Allocate and deliver ppdu stats to cdp layer
  261. * @soc: core txrx main context
  262. * @pdev: pdev strcuture
  263. * @ppdu_info: structure for rx ppdu ring
  264. *
  265. * Return: none
  266. */
  267. void
  268. dp_rx_handle_ppdu_stats(struct dp_soc *soc, struct dp_pdev *pdev,
  269. struct hal_rx_ppdu_info *ppdu_info);
  270. #else
  271. static inline void
  272. dp_rx_populate_rx_rssi_chain(struct hal_rx_ppdu_info *ppdu_info,
  273. struct cdp_rx_indication_ppdu *cdp_rx_ppdu)
  274. {
  275. }
  276. static inline void
  277. dp_rx_populate_su_evm_details(struct hal_rx_ppdu_info *ppdu_info,
  278. struct cdp_rx_indication_ppdu *cdp_rx_ppdu)
  279. {
  280. }
  281. static inline void
  282. dp_rx_populate_cdp_indication_ppdu_user(struct dp_pdev *pdev,
  283. struct hal_rx_ppdu_info *ppdu_info,
  284. struct cdp_rx_indication_ppdu
  285. *cdp_rx_ppdu)
  286. {
  287. }
  288. static inline void
  289. dp_rx_populate_cdp_indication_ppdu(struct dp_pdev *pdev,
  290. struct hal_rx_ppdu_info *ppdu_info,
  291. struct cdp_rx_indication_ppdu *cdp_rx_ppdu)
  292. {
  293. }
  294. static inline void dp_rx_rate_stats_update(struct dp_peer *peer,
  295. struct cdp_rx_indication_ppdu *ppdu,
  296. uint32_t user)
  297. {
  298. }
  299. static inline void
  300. dp_rx_handle_ppdu_stats(struct dp_soc *soc, struct dp_pdev *pdev,
  301. struct hal_rx_ppdu_info *ppdu_info)
  302. {
  303. }
  304. #endif /* QCA_ENHANCED_STATS_SUPPORT */
  305. #ifdef QCA_UNDECODED_METADATA_SUPPORT
  306. /**
  307. * dp_rx_handle_ppdu_undecoded_metadata() - Allocate and deliver ppdu info
  308. * undecoded metadata to cdp layer
  309. * @soc: core txrx main context
  310. * @pdev: pdev strcuture
  311. * @ppdu_info: structure for rx ppdu ring
  312. *
  313. * Return: none
  314. */
  315. void
  316. dp_rx_handle_ppdu_undecoded_metadata(struct dp_soc *soc, struct dp_pdev *pdev,
  317. struct hal_rx_ppdu_info *ppdu_info);
  318. #else
  319. static inline void
  320. dp_rx_handle_ppdu_undecoded_metadata(struct dp_soc *soc, struct dp_pdev *pdev,
  321. struct hal_rx_ppdu_info *ppdu_info)
  322. {
  323. }
  324. #endif /* QCA_UNDECODED_METADATA_SUPPORT */
  325. #ifdef QCA_MCOPY_SUPPORT
  326. /**
  327. * dp_rx_handle_mcopy_mode() - Allocate and deliver first MSDU payload
  328. * @soc: core txrx main context
  329. * @pdev: pdev structure
  330. * @ppdu_info: structure for rx ppdu ring
  331. * @nbuf: QDF nbuf
  332. * @fcs_ok_mpdu_cnt: fcs passsed mpdu index
  333. * @deliver_frame: flag to deliver wdi event
  334. *
  335. * Return: QDF_STATUS_SUCCESS - If nbuf to be freed by caller
  336. * QDF_STATUS_E_ALREADY - If nbuf not to be freed by caller
  337. */
  338. QDF_STATUS
  339. dp_rx_handle_mcopy_mode(struct dp_soc *soc, struct dp_pdev *pdev,
  340. struct hal_rx_ppdu_info *ppdu_info, qdf_nbuf_t nbuf,
  341. uint8_t fcs_ok_mpdu_cnt, bool deliver_frame);
  342. /**
  343. * dp_rx_mcopy_handle_last_mpdu() - cache and delive last MPDU header in a
  344. * status buffer if MPDU end tlv is received in different buffer
  345. * @soc: core txrx main context
  346. * @pdev: pdev structure
  347. * @ppdu_info: structure for rx ppdu ring
  348. * @status_nbuf: QDF nbuf
  349. *
  350. * Return: void
  351. */
  352. void
  353. dp_rx_mcopy_handle_last_mpdu(struct dp_soc *soc, struct dp_pdev *pdev,
  354. struct hal_rx_ppdu_info *ppdu_info,
  355. qdf_nbuf_t status_nbuf);
  356. /**
  357. * dp_rx_mcopy_process_ppdu_info() - update mcopy ppdu info
  358. * @ppdu_info: structure for rx ppdu ring
  359. * @tlv_status: processed TLV status
  360. *
  361. * Return: void
  362. */
  363. void
  364. dp_rx_mcopy_process_ppdu_info(struct dp_pdev *pdev,
  365. struct hal_rx_ppdu_info *ppdu_info,
  366. uint32_t tlv_status);
  367. void
  368. dp_rx_process_mcopy_mode(struct dp_soc *soc, struct dp_pdev *pdev,
  369. struct hal_rx_ppdu_info *ppdu_info,
  370. uint32_t tlv_status,
  371. qdf_nbuf_t status_nbuf);
  372. #else
  373. static inline QDF_STATUS
  374. dp_rx_handle_mcopy_mode(struct dp_soc *soc, struct dp_pdev *pdev,
  375. struct hal_rx_ppdu_info *ppdu_info, qdf_nbuf_t nbuf,
  376. uint8_t fcs_ok_cnt, bool deliver_frame)
  377. {
  378. return QDF_STATUS_SUCCESS;
  379. }
  380. static inline void
  381. dp_rx_mcopy_handle_last_mpdu(struct dp_soc *soc, struct dp_pdev *pdev,
  382. struct hal_rx_ppdu_info *ppdu_info,
  383. qdf_nbuf_t status_nbuf)
  384. {
  385. }
  386. static inline void
  387. dp_rx_mcopy_process_ppdu_info(struct dp_pdev *pdev,
  388. struct hal_rx_ppdu_info *ppdu_info,
  389. uint32_t tlv_status)
  390. {
  391. }
  392. static inline void
  393. dp_rx_process_mcopy_mode(struct dp_soc *soc, struct dp_pdev *pdev,
  394. struct hal_rx_ppdu_info *ppdu_info,
  395. uint32_t tlv_status,
  396. qdf_nbuf_t status_nbuf)
  397. {
  398. }
  399. #endif /* QCA_MCOPY_SUPPORT */
  400. /**
  401. * dp_rx_handle_smart_mesh_mode() - Deliver header for smart mesh
  402. * @soc: Datapath SOC handle
  403. * @pdev: Datapath PDEV handle
  404. * @ppdu_info: Structure for rx ppdu info
  405. * @nbuf: Qdf nbuf abstraction for linux skb
  406. *
  407. * Return: 0 on success, 1 on failure
  408. */
  409. int
  410. dp_rx_handle_smart_mesh_mode(struct dp_soc *soc, struct dp_pdev *pdev,
  411. struct hal_rx_ppdu_info *ppdu_info,
  412. qdf_nbuf_t nbuf);
  413. /*
  414. * dp_rx_nbuf_prepare() - prepare RX nbuf
  415. * @soc: core txrx main context
  416. * @pdev: core txrx pdev context
  417. *
  418. * This function alloc & map nbuf for RX dma usage, retry it if failed
  419. * until retry times reaches max threshold or succeeded.
  420. *
  421. * Return: qdf_nbuf_t pointer if succeeded, NULL if failed.
  422. */
  423. qdf_nbuf_t
  424. dp_rx_nbuf_prepare(struct dp_soc *soc, struct dp_pdev *pdev);
  425. #if defined(WLAN_CFR_ENABLE) && defined(WLAN_ENH_CFR_ENABLE)
  426. /*
  427. * dp_rx_mon_handle_cfr_mu_info() - Gather macaddr and ast_index of peer(s) in
  428. * the PPDU received, this will be used for correlation of CFR data captured
  429. * for an UL-MU-PPDU
  430. * @pdev: pdev ctx
  431. * @ppdu_info: pointer to ppdu info structure populated from ppdu status TLVs
  432. * @cdp_rx_ppdu: Rx PPDU indication structure
  433. *
  434. * Return: none
  435. */
  436. void
  437. dp_rx_mon_handle_cfr_mu_info(struct dp_pdev *pdev,
  438. struct hal_rx_ppdu_info *ppdu_info,
  439. struct cdp_rx_indication_ppdu *cdp_rx_ppdu);
  440. /*
  441. * dp_rx_mon_populate_cfr_ppdu_info() - Populate cdp ppdu info from hal ppdu
  442. * info
  443. * @pdev: pdev ctx
  444. * @ppdu_info: ppdu info structure from ppdu ring
  445. * @cdp_rx_ppdu : Rx PPDU indication structure
  446. *
  447. * Return: none
  448. */
  449. void
  450. dp_rx_mon_populate_cfr_ppdu_info(struct dp_pdev *pdev,
  451. struct hal_rx_ppdu_info *ppdu_info,
  452. struct cdp_rx_indication_ppdu *cdp_rx_ppdu);
  453. /**
  454. * dp_cfr_rcc_mode_status() - Return status of cfr rcc mode
  455. * @pdev: pdev ctx
  456. *
  457. * Return: True or False
  458. */
  459. bool
  460. dp_cfr_rcc_mode_status(struct dp_pdev *pdev);
  461. /*
  462. * dp_rx_mon_populate_cfr_info() - Populate cdp ppdu info from hal cfr info
  463. * @pdev: pdev ctx
  464. * @ppdu_info: ppdu info structure from ppdu ring
  465. * @cdp_rx_ppdu: Rx PPDU indication structure
  466. *
  467. * Return: none
  468. */
  469. void
  470. dp_rx_mon_populate_cfr_info(struct dp_pdev *pdev,
  471. struct hal_rx_ppdu_info *ppdu_info,
  472. struct cdp_rx_indication_ppdu *cdp_rx_ppdu);
  473. /**
  474. * dp_update_cfr_dbg_stats() - Increment RCC debug statistics
  475. * @pdev: pdev structure
  476. * @ppdu_info: structure for rx ppdu ring
  477. *
  478. * Return: none
  479. */
  480. void
  481. dp_update_cfr_dbg_stats(struct dp_pdev *pdev,
  482. struct hal_rx_ppdu_info *ppdu_info);
  483. /*
  484. * dp_rx_handle_cfr() - Gather cfr info from hal ppdu info
  485. * @soc: core txrx main context
  486. * @pdev: pdev ctx
  487. * @ppdu_info: ppdu info structure from ppdu ring
  488. *
  489. * Return: none
  490. */
  491. void
  492. dp_rx_handle_cfr(struct dp_soc *soc, struct dp_pdev *pdev,
  493. struct hal_rx_ppdu_info *ppdu_info);
  494. /**
  495. * dp_rx_populate_cfr_non_assoc_sta() - Populate cfr ppdu info for PPDUs from
  496. * non-associated stations
  497. * @pdev: pdev ctx
  498. * @ppdu_info: ppdu info structure from ppdu ring
  499. * @cdp_rx_ppdu: Rx PPDU indication structure
  500. *
  501. * Return: none
  502. */
  503. void
  504. dp_rx_populate_cfr_non_assoc_sta(struct dp_pdev *pdev,
  505. struct hal_rx_ppdu_info *ppdu_info,
  506. struct cdp_rx_indication_ppdu *cdp_rx_ppdu);
  507. #else
  508. static inline void
  509. dp_rx_mon_handle_cfr_mu_info(struct dp_pdev *pdev,
  510. struct hal_rx_ppdu_info *ppdu_info,
  511. struct cdp_rx_indication_ppdu *cdp_rx_ppdu)
  512. {
  513. }
  514. static inline void
  515. dp_rx_mon_populate_cfr_ppdu_info(struct dp_pdev *pdev,
  516. struct hal_rx_ppdu_info *ppdu_info,
  517. struct cdp_rx_indication_ppdu *cdp_rx_ppdu)
  518. {
  519. }
  520. static inline void
  521. dp_rx_mon_populate_cfr_info(struct dp_pdev *pdev,
  522. struct hal_rx_ppdu_info *ppdu_info,
  523. struct cdp_rx_indication_ppdu *cdp_rx_ppdu)
  524. {
  525. }
  526. static inline void
  527. dp_rx_handle_cfr(struct dp_soc *soc, struct dp_pdev *pdev,
  528. struct hal_rx_ppdu_info *ppdu_info)
  529. {
  530. }
  531. static inline void
  532. dp_rx_populate_cfr_non_assoc_sta(struct dp_pdev *pdev,
  533. struct hal_rx_ppdu_info *ppdu_info,
  534. struct cdp_rx_indication_ppdu *cdp_rx_ppdu)
  535. {
  536. }
  537. static inline void
  538. dp_update_cfr_dbg_stats(struct dp_pdev *pdev,
  539. struct hal_rx_ppdu_info *ppdu_info)
  540. {
  541. }
  542. static inline bool
  543. dp_cfr_rcc_mode_status(struct dp_pdev *pdev)
  544. {
  545. return false;
  546. }
  547. #endif /* WLAN_CFR_ENABLE && WLAN_ENH_CFR_ENABLE */
  548. /*
  549. * dp_rx_mon_deliver(): function to deliver packets to stack
  550. * @soc: DP soc
  551. * @mac_id: MAC ID
  552. * @head_msdu: head of msdu list
  553. * @tail_msdu: tail of msdu list
  554. *
  555. * Return: status: 0 - Success, non-zero: Failure
  556. */
  557. QDF_STATUS dp_rx_mon_deliver(struct dp_soc *soc,
  558. uint32_t mac_id,
  559. qdf_nbuf_t head_msdu,
  560. qdf_nbuf_t tail_msdu);
  561. /**
  562. * dp_rx_mon_deliver_non_std()
  563. * @soc: core txrx main contex
  564. * @mac_id: MAC ID
  565. *
  566. * This function delivers the radio tap and dummy MSDU
  567. * into user layer application for preamble only PPDU.
  568. *
  569. * Return: QDF_STATUS
  570. */
  571. QDF_STATUS dp_rx_mon_deliver_non_std(struct dp_soc *soc,
  572. uint32_t mac_id);
  573. #ifdef DP_RX_MON_MEM_FRAG
  574. #if defined(WLAN_SUPPORT_RX_PROTOCOL_TYPE_TAG) ||\
  575. defined(WLAN_SUPPORT_RX_FLOW_TAG)
  576. void dp_rx_mon_update_pf_tag_to_buf_headroom(struct dp_soc *soc,
  577. qdf_nbuf_t nbuf);
  578. #else
  579. static inline
  580. void dp_rx_mon_update_pf_tag_to_buf_headroom(struct dp_soc *soc,
  581. qdf_nbuf_t nbuf)
  582. {
  583. }
  584. #endif
  585. #else
  586. static inline
  587. void dp_rx_mon_update_pf_tag_to_buf_headroom(struct dp_soc *soc,
  588. qdf_nbuf_t nbuf)
  589. {
  590. }
  591. #endif
  592. qdf_nbuf_t dp_rx_mon_restitch_mpdu(struct dp_soc *soc, uint32_t mac_id,
  593. qdf_nbuf_t head_msdu, qdf_nbuf_t tail_msdu,
  594. struct cdp_mon_status *rs);
  595. #ifdef DP_RX_MON_MEM_FRAG
  596. /**
  597. * dp_rx_mon_get_nbuf_80211_hdr() - Get 80211 hdr from nbuf
  598. * @nbuf: qdf_nbuf_t
  599. *
  600. * This function must be called after moving radiotap header.
  601. *
  602. * Return: Ptr pointing to 80211 header or NULL.
  603. */
  604. static inline
  605. qdf_frag_t dp_rx_mon_get_nbuf_80211_hdr(qdf_nbuf_t nbuf)
  606. {
  607. /* Return NULL if nr_frag is Zero */
  608. if (!qdf_nbuf_get_nr_frags(nbuf))
  609. return NULL;
  610. return qdf_nbuf_get_frag_addr(nbuf, 0);
  611. }
  612. #else
  613. static inline
  614. qdf_frag_t dp_rx_mon_get_nbuf_80211_hdr(qdf_nbuf_t nbuf)
  615. {
  616. return qdf_nbuf_data(nbuf);
  617. }
  618. #endif
  619. /*
  620. * dp_rx_mon_process_dest_pktlog(): function to log packet contents to
  621. * pktlog buffer and send to pktlog module
  622. * @soc: DP soc
  623. * @mac_id: MAC ID
  624. * @mpdu: MPDU buf
  625. * Return: status: 0 - Success, non-zero: Failure
  626. */
  627. QDF_STATUS dp_rx_mon_process_dest_pktlog(struct dp_soc *soc,
  628. uint32_t mac_id,
  629. qdf_nbuf_t mpdu);
  630. #ifdef WLAN_TX_PKT_CAPTURE_ENH
  631. void
  632. dp_handle_tx_capture(struct dp_soc *soc, struct dp_pdev *pdev,
  633. qdf_nbuf_t mon_mpdu);
  634. #else
  635. static inline void
  636. dp_handle_tx_capture(struct dp_soc *soc, struct dp_pdev *pdev,
  637. qdf_nbuf_t mon_mpdu)
  638. {
  639. }
  640. #endif
  641. /**
  642. * dp_rx_get_mon_desc_pool() - Return monitor descriptor pool
  643. * based on target
  644. * @soc: soc handle
  645. * @mac_id: mac id number
  646. * @pdev_id: pdev id number
  647. *
  648. * Return: descriptor pool address
  649. */
  650. static inline
  651. struct rx_desc_pool *dp_rx_get_mon_desc_pool(struct dp_soc *soc,
  652. uint8_t mac_id,
  653. uint8_t pdev_id)
  654. {
  655. if (soc->wlan_cfg_ctx->rxdma1_enable)
  656. return &soc->rx_desc_mon[mac_id];
  657. return &soc->rx_desc_buf[pdev_id];
  658. }
  659. /**
  660. * dp_rx_process_peer_based_pktlog() - Process Rx pktlog if peer based
  661. * filtering enabled
  662. * @soc: core txrx main context
  663. * @ppdu_info: Structure for rx ppdu info
  664. * @status_nbuf: Qdf nbuf abstraction for linux skb
  665. * @pdev_id: mac_id/pdev_id correspondinggly for MCL and WIN
  666. *
  667. * Return: none
  668. */
  669. void
  670. dp_rx_process_peer_based_pktlog(struct dp_soc *soc,
  671. struct hal_rx_ppdu_info *ppdu_info,
  672. qdf_nbuf_t status_nbuf, uint32_t pdev_id);
  673. #endif /* _DP_RX_MON_H_ */