dp_rx_mon.h 22 KB

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