dp_rx_mon.h 21 KB

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