dp_rx_mon.h 23 KB

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