dp_rx_mon.h 22 KB

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