dp_rx_mon.h 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775
  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. struct dp_pdev *pdev);
  277. /*
  278. * dp_rx_populate_su_evm_details() - Populate su evm info
  279. * @ppdu_info: ppdu info structure from ppdu ring
  280. * @cdp_rx_ppdu: rx ppdu indication structure
  281. */
  282. void
  283. dp_rx_populate_su_evm_details(struct hal_rx_ppdu_info *ppdu_info,
  284. struct cdp_rx_indication_ppdu *cdp_rx_ppdu);
  285. /**
  286. * dp_rx_handle_ppdu_stats() - Allocate and deliver ppdu stats to cdp layer
  287. * @soc: core txrx main context
  288. * @pdev: pdev strcuture
  289. * @ppdu_info: structure for rx ppdu ring
  290. *
  291. * Return: none
  292. */
  293. void
  294. dp_rx_handle_ppdu_stats(struct dp_soc *soc, struct dp_pdev *pdev,
  295. struct hal_rx_ppdu_info *ppdu_info);
  296. #else
  297. static inline void
  298. dp_rx_populate_rx_rssi_chain(struct hal_rx_ppdu_info *ppdu_info,
  299. struct cdp_rx_indication_ppdu *cdp_rx_ppdu)
  300. {
  301. }
  302. static inline void
  303. dp_rx_populate_su_evm_details(struct hal_rx_ppdu_info *ppdu_info,
  304. struct cdp_rx_indication_ppdu *cdp_rx_ppdu)
  305. {
  306. }
  307. static inline void
  308. dp_rx_populate_cdp_indication_ppdu_user(struct dp_pdev *pdev,
  309. struct hal_rx_ppdu_info *ppdu_info,
  310. struct cdp_rx_indication_ppdu
  311. *cdp_rx_ppdu)
  312. {
  313. }
  314. static inline void
  315. dp_rx_populate_cdp_indication_ppdu(struct dp_pdev *pdev,
  316. struct hal_rx_ppdu_info *ppdu_info,
  317. struct cdp_rx_indication_ppdu *cdp_rx_ppdu)
  318. {
  319. }
  320. static inline void dp_rx_rate_stats_update(struct dp_peer *peer,
  321. struct cdp_rx_indication_ppdu *ppdu,
  322. uint32_t user)
  323. {
  324. }
  325. static inline void
  326. dp_rx_handle_ppdu_stats(struct dp_soc *soc, struct dp_pdev *pdev,
  327. struct hal_rx_ppdu_info *ppdu_info)
  328. {
  329. }
  330. #endif /* QCA_ENHANCED_STATS_SUPPORT */
  331. #ifdef QCA_UNDECODED_METADATA_SUPPORT
  332. /**
  333. * dp_rx_handle_ppdu_undecoded_metadata() - Allocate and deliver ppdu info
  334. * undecoded metadata to cdp layer
  335. * @soc: core txrx main context
  336. * @pdev: pdev strcuture
  337. * @ppdu_info: structure for rx ppdu ring
  338. *
  339. * Return: none
  340. */
  341. void
  342. dp_rx_handle_ppdu_undecoded_metadata(struct dp_soc *soc, struct dp_pdev *pdev,
  343. struct hal_rx_ppdu_info *ppdu_info);
  344. #else
  345. static inline void
  346. dp_rx_handle_ppdu_undecoded_metadata(struct dp_soc *soc, struct dp_pdev *pdev,
  347. struct hal_rx_ppdu_info *ppdu_info)
  348. {
  349. }
  350. #endif /* QCA_UNDECODED_METADATA_SUPPORT */
  351. #ifdef QCA_MCOPY_SUPPORT
  352. /**
  353. * dp_rx_handle_mcopy_mode() - Allocate and deliver first MSDU payload
  354. * @soc: core txrx main context
  355. * @pdev: pdev structure
  356. * @ppdu_info: structure for rx ppdu ring
  357. * @nbuf: QDF nbuf
  358. * @fcs_ok_mpdu_cnt: fcs passsed mpdu index
  359. * @deliver_frame: flag to deliver wdi event
  360. *
  361. * Return: QDF_STATUS_SUCCESS - If nbuf to be freed by caller
  362. * QDF_STATUS_E_ALREADY - If nbuf not to be freed by caller
  363. */
  364. QDF_STATUS
  365. dp_rx_handle_mcopy_mode(struct dp_soc *soc, struct dp_pdev *pdev,
  366. struct hal_rx_ppdu_info *ppdu_info, qdf_nbuf_t nbuf,
  367. uint8_t fcs_ok_mpdu_cnt, bool deliver_frame);
  368. /**
  369. * dp_rx_mcopy_handle_last_mpdu() - cache and delive last MPDU header in a
  370. * status buffer if MPDU end tlv is received in different buffer
  371. * @soc: core txrx main context
  372. * @pdev: pdev structure
  373. * @ppdu_info: structure for rx ppdu ring
  374. * @status_nbuf: QDF nbuf
  375. *
  376. * Return: void
  377. */
  378. void
  379. dp_rx_mcopy_handle_last_mpdu(struct dp_soc *soc, struct dp_pdev *pdev,
  380. struct hal_rx_ppdu_info *ppdu_info,
  381. qdf_nbuf_t status_nbuf);
  382. /**
  383. * dp_rx_mcopy_process_ppdu_info() - update mcopy ppdu info
  384. * @ppdu_info: structure for rx ppdu ring
  385. * @tlv_status: processed TLV status
  386. *
  387. * Return: void
  388. */
  389. void
  390. dp_rx_mcopy_process_ppdu_info(struct dp_pdev *pdev,
  391. struct hal_rx_ppdu_info *ppdu_info,
  392. uint32_t tlv_status);
  393. void
  394. dp_rx_process_mcopy_mode(struct dp_soc *soc, struct dp_pdev *pdev,
  395. struct hal_rx_ppdu_info *ppdu_info,
  396. uint32_t tlv_status,
  397. qdf_nbuf_t status_nbuf);
  398. #else
  399. static inline QDF_STATUS
  400. dp_rx_handle_mcopy_mode(struct dp_soc *soc, struct dp_pdev *pdev,
  401. struct hal_rx_ppdu_info *ppdu_info, qdf_nbuf_t nbuf,
  402. uint8_t fcs_ok_cnt, bool deliver_frame)
  403. {
  404. return QDF_STATUS_SUCCESS;
  405. }
  406. static inline void
  407. dp_rx_mcopy_handle_last_mpdu(struct dp_soc *soc, struct dp_pdev *pdev,
  408. struct hal_rx_ppdu_info *ppdu_info,
  409. qdf_nbuf_t status_nbuf)
  410. {
  411. }
  412. static inline void
  413. dp_rx_mcopy_process_ppdu_info(struct dp_pdev *pdev,
  414. struct hal_rx_ppdu_info *ppdu_info,
  415. uint32_t tlv_status)
  416. {
  417. }
  418. static inline void
  419. dp_rx_process_mcopy_mode(struct dp_soc *soc, struct dp_pdev *pdev,
  420. struct hal_rx_ppdu_info *ppdu_info,
  421. uint32_t tlv_status,
  422. qdf_nbuf_t status_nbuf)
  423. {
  424. }
  425. #endif /* QCA_MCOPY_SUPPORT */
  426. /**
  427. * dp_rx_handle_smart_mesh_mode() - Deliver header for smart mesh
  428. * @soc: Datapath SOC handle
  429. * @pdev: Datapath PDEV handle
  430. * @ppdu_info: Structure for rx ppdu info
  431. * @nbuf: Qdf nbuf abstraction for linux skb
  432. *
  433. * Return: 0 on success, 1 on failure
  434. */
  435. int
  436. dp_rx_handle_smart_mesh_mode(struct dp_soc *soc, struct dp_pdev *pdev,
  437. struct hal_rx_ppdu_info *ppdu_info,
  438. qdf_nbuf_t nbuf);
  439. /*
  440. * dp_rx_nbuf_prepare() - prepare RX nbuf
  441. * @soc: core txrx main context
  442. * @pdev: core txrx pdev context
  443. *
  444. * This function alloc & map nbuf for RX dma usage, retry it if failed
  445. * until retry times reaches max threshold or succeeded.
  446. *
  447. * Return: qdf_nbuf_t pointer if succeeded, NULL if failed.
  448. */
  449. qdf_nbuf_t
  450. dp_rx_nbuf_prepare(struct dp_soc *soc, struct dp_pdev *pdev);
  451. #if defined(WLAN_CFR_ENABLE) && defined(WLAN_ENH_CFR_ENABLE)
  452. /*
  453. * dp_rx_mon_handle_cfr_mu_info() - Gather macaddr and ast_index of peer(s) in
  454. * the PPDU received, this will be used for correlation of CFR data captured
  455. * for an UL-MU-PPDU
  456. * @pdev: pdev ctx
  457. * @ppdu_info: pointer to ppdu info structure populated from ppdu status TLVs
  458. * @cdp_rx_ppdu: Rx PPDU indication structure
  459. *
  460. * Return: none
  461. */
  462. void
  463. dp_rx_mon_handle_cfr_mu_info(struct dp_pdev *pdev,
  464. struct hal_rx_ppdu_info *ppdu_info,
  465. struct cdp_rx_indication_ppdu *cdp_rx_ppdu);
  466. /*
  467. * dp_rx_mon_populate_cfr_ppdu_info() - Populate cdp ppdu info from hal ppdu
  468. * info
  469. * @pdev: pdev ctx
  470. * @ppdu_info: ppdu info structure from ppdu ring
  471. * @cdp_rx_ppdu : Rx PPDU indication structure
  472. *
  473. * Return: none
  474. */
  475. void
  476. dp_rx_mon_populate_cfr_ppdu_info(struct dp_pdev *pdev,
  477. struct hal_rx_ppdu_info *ppdu_info,
  478. struct cdp_rx_indication_ppdu *cdp_rx_ppdu);
  479. /**
  480. * dp_cfr_rcc_mode_status() - Return status of cfr rcc mode
  481. * @pdev: pdev ctx
  482. *
  483. * Return: True or False
  484. */
  485. bool
  486. dp_cfr_rcc_mode_status(struct dp_pdev *pdev);
  487. /*
  488. * dp_rx_mon_populate_cfr_info() - Populate cdp ppdu info from hal cfr info
  489. * @pdev: pdev ctx
  490. * @ppdu_info: ppdu info structure from ppdu ring
  491. * @cdp_rx_ppdu: Rx PPDU indication structure
  492. *
  493. * Return: none
  494. */
  495. void
  496. dp_rx_mon_populate_cfr_info(struct dp_pdev *pdev,
  497. struct hal_rx_ppdu_info *ppdu_info,
  498. struct cdp_rx_indication_ppdu *cdp_rx_ppdu);
  499. /**
  500. * dp_update_cfr_dbg_stats() - Increment RCC debug statistics
  501. * @pdev: pdev structure
  502. * @ppdu_info: structure for rx ppdu ring
  503. *
  504. * Return: none
  505. */
  506. void
  507. dp_update_cfr_dbg_stats(struct dp_pdev *pdev,
  508. struct hal_rx_ppdu_info *ppdu_info);
  509. /*
  510. * dp_rx_handle_cfr() - Gather cfr info from hal ppdu info
  511. * @soc: core txrx main context
  512. * @pdev: pdev ctx
  513. * @ppdu_info: ppdu info structure from ppdu ring
  514. *
  515. * Return: none
  516. */
  517. void
  518. dp_rx_handle_cfr(struct dp_soc *soc, struct dp_pdev *pdev,
  519. struct hal_rx_ppdu_info *ppdu_info);
  520. /**
  521. * dp_rx_populate_cfr_non_assoc_sta() - Populate cfr ppdu info for PPDUs from
  522. * non-associated stations
  523. * @pdev: pdev ctx
  524. * @ppdu_info: ppdu info structure from ppdu ring
  525. * @cdp_rx_ppdu: Rx PPDU indication structure
  526. *
  527. * Return: none
  528. */
  529. void
  530. dp_rx_populate_cfr_non_assoc_sta(struct dp_pdev *pdev,
  531. struct hal_rx_ppdu_info *ppdu_info,
  532. struct cdp_rx_indication_ppdu *cdp_rx_ppdu);
  533. #else
  534. static inline void
  535. dp_rx_mon_handle_cfr_mu_info(struct dp_pdev *pdev,
  536. struct hal_rx_ppdu_info *ppdu_info,
  537. struct cdp_rx_indication_ppdu *cdp_rx_ppdu)
  538. {
  539. }
  540. static inline void
  541. dp_rx_mon_populate_cfr_ppdu_info(struct dp_pdev *pdev,
  542. struct hal_rx_ppdu_info *ppdu_info,
  543. struct cdp_rx_indication_ppdu *cdp_rx_ppdu)
  544. {
  545. }
  546. static inline void
  547. dp_rx_mon_populate_cfr_info(struct dp_pdev *pdev,
  548. struct hal_rx_ppdu_info *ppdu_info,
  549. struct cdp_rx_indication_ppdu *cdp_rx_ppdu)
  550. {
  551. }
  552. static inline void
  553. dp_rx_handle_cfr(struct dp_soc *soc, struct dp_pdev *pdev,
  554. struct hal_rx_ppdu_info *ppdu_info)
  555. {
  556. }
  557. static inline void
  558. dp_rx_populate_cfr_non_assoc_sta(struct dp_pdev *pdev,
  559. struct hal_rx_ppdu_info *ppdu_info,
  560. struct cdp_rx_indication_ppdu *cdp_rx_ppdu)
  561. {
  562. }
  563. static inline void
  564. dp_update_cfr_dbg_stats(struct dp_pdev *pdev,
  565. struct hal_rx_ppdu_info *ppdu_info)
  566. {
  567. }
  568. static inline bool
  569. dp_cfr_rcc_mode_status(struct dp_pdev *pdev)
  570. {
  571. return false;
  572. }
  573. #endif /* WLAN_CFR_ENABLE && WLAN_ENH_CFR_ENABLE */
  574. /*
  575. * dp_rx_mon_deliver(): function to deliver packets to stack
  576. * @soc: DP soc
  577. * @mac_id: MAC ID
  578. * @head_msdu: head of msdu list
  579. * @tail_msdu: tail of msdu list
  580. *
  581. * Return: status: 0 - Success, non-zero: Failure
  582. */
  583. QDF_STATUS dp_rx_mon_deliver(struct dp_soc *soc,
  584. uint32_t mac_id,
  585. qdf_nbuf_t head_msdu,
  586. qdf_nbuf_t tail_msdu);
  587. /**
  588. * dp_rx_mon_deliver_non_std()
  589. * @soc: core txrx main contex
  590. * @mac_id: MAC ID
  591. *
  592. * This function delivers the radio tap and dummy MSDU
  593. * into user layer application for preamble only PPDU.
  594. *
  595. * Return: QDF_STATUS
  596. */
  597. QDF_STATUS dp_rx_mon_deliver_non_std(struct dp_soc *soc,
  598. uint32_t mac_id);
  599. #ifdef DP_RX_MON_MEM_FRAG
  600. #if defined(WLAN_SUPPORT_RX_PROTOCOL_TYPE_TAG) ||\
  601. defined(WLAN_SUPPORT_RX_FLOW_TAG)
  602. void dp_rx_mon_update_pf_tag_to_buf_headroom(struct dp_soc *soc,
  603. qdf_nbuf_t nbuf);
  604. #else
  605. static inline
  606. void dp_rx_mon_update_pf_tag_to_buf_headroom(struct dp_soc *soc,
  607. qdf_nbuf_t nbuf)
  608. {
  609. }
  610. #endif
  611. #else
  612. static inline
  613. void dp_rx_mon_update_pf_tag_to_buf_headroom(struct dp_soc *soc,
  614. qdf_nbuf_t nbuf)
  615. {
  616. }
  617. #endif
  618. qdf_nbuf_t dp_rx_mon_restitch_mpdu(struct dp_soc *soc, uint32_t mac_id,
  619. qdf_nbuf_t head_msdu, qdf_nbuf_t tail_msdu,
  620. struct cdp_mon_status *rs);
  621. #ifdef DP_RX_MON_MEM_FRAG
  622. /**
  623. * dp_rx_mon_get_nbuf_80211_hdr() - Get 80211 hdr from nbuf
  624. * @nbuf: qdf_nbuf_t
  625. *
  626. * This function must be called after moving radiotap header.
  627. *
  628. * Return: Ptr pointing to 80211 header or NULL.
  629. */
  630. static inline
  631. qdf_frag_t dp_rx_mon_get_nbuf_80211_hdr(qdf_nbuf_t nbuf)
  632. {
  633. /* Return NULL if nr_frag is Zero */
  634. if (!qdf_nbuf_get_nr_frags(nbuf))
  635. return NULL;
  636. return qdf_nbuf_get_frag_addr(nbuf, 0);
  637. }
  638. #else
  639. static inline
  640. qdf_frag_t dp_rx_mon_get_nbuf_80211_hdr(qdf_nbuf_t nbuf)
  641. {
  642. return qdf_nbuf_data(nbuf);
  643. }
  644. #endif
  645. /*
  646. * dp_rx_mon_process_dest_pktlog(): function to log packet contents to
  647. * pktlog buffer and send to pktlog module
  648. * @soc: DP soc
  649. * @mac_id: MAC ID
  650. * @mpdu: MPDU buf
  651. * Return: status: 0 - Success, non-zero: Failure
  652. */
  653. QDF_STATUS dp_rx_mon_process_dest_pktlog(struct dp_soc *soc,
  654. uint32_t mac_id,
  655. qdf_nbuf_t mpdu);
  656. #ifdef WLAN_TX_PKT_CAPTURE_ENH
  657. void
  658. dp_handle_tx_capture(struct dp_soc *soc, struct dp_pdev *pdev,
  659. qdf_nbuf_t mon_mpdu);
  660. #else
  661. static inline void
  662. dp_handle_tx_capture(struct dp_soc *soc, struct dp_pdev *pdev,
  663. qdf_nbuf_t mon_mpdu)
  664. {
  665. }
  666. #endif
  667. /**
  668. * dp_rx_get_mon_desc_pool() - Return monitor descriptor pool
  669. * based on target
  670. * @soc: soc handle
  671. * @mac_id: mac id number
  672. * @pdev_id: pdev id number
  673. *
  674. * Return: descriptor pool address
  675. */
  676. static inline
  677. struct rx_desc_pool *dp_rx_get_mon_desc_pool(struct dp_soc *soc,
  678. uint8_t mac_id,
  679. uint8_t pdev_id)
  680. {
  681. if (soc->wlan_cfg_ctx->rxdma1_enable)
  682. return &soc->rx_desc_mon[mac_id];
  683. return &soc->rx_desc_buf[pdev_id];
  684. }
  685. /**
  686. * dp_rx_process_peer_based_pktlog() - Process Rx pktlog if peer based
  687. * filtering enabled
  688. * @soc: core txrx main context
  689. * @ppdu_info: Structure for rx ppdu info
  690. * @status_nbuf: Qdf nbuf abstraction for linux skb
  691. * @pdev_id: mac_id/pdev_id correspondinggly for MCL and WIN
  692. *
  693. * Return: none
  694. */
  695. void
  696. dp_rx_process_peer_based_pktlog(struct dp_soc *soc,
  697. struct hal_rx_ppdu_info *ppdu_info,
  698. qdf_nbuf_t status_nbuf, uint32_t pdev_id);
  699. uint32_t dp_mon_rx_add_tlv(uint8_t id, uint16_t len, void *value,
  700. qdf_nbuf_t mpdu_nbuf);
  701. #endif /* _DP_RX_MON_H_ */