dp_rx_mon.h 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185
  1. /*
  2. * Copyright (c) 2016-2019 The Linux Foundation. All rights reserved.
  3. *
  4. * Permission to use, copy, modify, and/or distribute this software for
  5. * any purpose with or without fee is hereby granted, provided that the
  6. * above copyright notice and this permission notice appear in all
  7. * copies.
  8. *
  9. * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
  10. * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
  11. * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
  12. * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
  13. * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
  14. * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
  15. * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  16. * PERFORMANCE OF THIS SOFTWARE.
  17. */
  18. #ifndef _DP_RX_MON_H_
  19. #define _DP_RX_MON_H_
  20. /**
  21. * dp_rx_mon_dest_process() - Brain of the Rx processing functionality
  22. * Called from the bottom half (tasklet/NET_RX_SOFTIRQ)
  23. * @soc: core txrx main context 164
  24. * @hal_ring: opaque pointer to the HAL Rx Ring, which will be serviced
  25. * @quota: No. of units (packets) that can be serviced in one shot.
  26. *
  27. * This function implements the core of Rx functionality. This is
  28. * expected to handle only non-error frames.
  29. *
  30. * Return: uint32_t: No. of elements processed
  31. */
  32. void dp_rx_mon_dest_process(struct dp_soc *soc, uint32_t mac_id,
  33. uint32_t quota);
  34. QDF_STATUS dp_rx_pdev_mon_attach(struct dp_pdev *pdev);
  35. QDF_STATUS dp_rx_pdev_mon_detach(struct dp_pdev *pdev);
  36. QDF_STATUS dp_rx_pdev_mon_status_attach(struct dp_pdev *pdev, int mac_id);
  37. QDF_STATUS dp_rx_pdev_mon_status_detach(struct dp_pdev *pdev, int mac_id);
  38. /**
  39. * dp_reset_monitor_mode() - Disable monitor mode
  40. * @pdev_handle: Datapath PDEV handle
  41. *
  42. * Return: QDF_STATUS
  43. */
  44. QDF_STATUS dp_reset_monitor_mode(struct cdp_pdev *pdev_handle);
  45. /**
  46. * dp_pdev_configure_monitor_rings() - configure monitor rings
  47. * @vdev_handle: Datapath VDEV handle
  48. *
  49. * Return: QDF_STATUS
  50. */
  51. QDF_STATUS dp_pdev_configure_monitor_rings(struct dp_pdev *pdev);
  52. /**
  53. * dp_mon_link_free() - free monitor link desc pool
  54. * @pdev: core txrx pdev context
  55. *
  56. * This function will release DP link desc pool for monitor mode from
  57. * main device context.
  58. *
  59. * Return: QDF_STATUS_SUCCESS: success
  60. * QDF_STATUS_E_RESOURCES: Error return
  61. */
  62. QDF_STATUS dp_mon_link_free(struct dp_pdev *pdev);
  63. uint32_t dp_mon_process(struct dp_soc *soc, uint32_t mac_id, uint32_t quota);
  64. QDF_STATUS dp_rx_mon_deliver(struct dp_soc *soc, uint32_t mac_id,
  65. qdf_nbuf_t head_msdu, qdf_nbuf_t tail_msdu);
  66. /*
  67. * dp_rx_mon_deliver_non_std() - deliver frames for non standard path
  68. * @soc: core txrx main contex
  69. * @mac_id: MAC ID
  70. *
  71. * This function delivers the radio tap and dummy MSDU
  72. * into user layer application for preamble only PPDU.
  73. *
  74. * Return: Operation status
  75. */
  76. QDF_STATUS dp_rx_mon_deliver_non_std(struct dp_soc *soc, uint32_t mac_id);
  77. uint32_t dp_rxdma_err_process(struct dp_soc *soc, uint32_t mac_id,
  78. uint32_t quota);
  79. #ifndef REMOVE_MON_DBG_STATS
  80. /*
  81. * dp_rx_mon_update_dbg_ppdu_stats() - Update status ring TLV count
  82. * @ppdu_info: HAL RX PPDU info retrieved from status ring TLV
  83. * @rx_mon_stats: monitor mode status/destination ring PPDU and MPDU count
  84. *
  85. * Update status ring PPDU start and end count. Keep track TLV state on
  86. * PPDU start and end to find out if start and end is matching. Keep
  87. * track missing PPDU start and end count. Keep track matching PPDU
  88. * start and end count.
  89. *
  90. * Return: None
  91. */
  92. static inline void
  93. dp_rx_mon_update_dbg_ppdu_stats(struct hal_rx_ppdu_info *ppdu_info,
  94. struct cdp_pdev_mon_stats *rx_mon_stats)
  95. {
  96. if (ppdu_info->rx_state ==
  97. HAL_RX_MON_PPDU_START) {
  98. rx_mon_stats->status_ppdu_start++;
  99. if (rx_mon_stats->status_ppdu_state
  100. != CDP_MON_PPDU_END)
  101. rx_mon_stats->status_ppdu_end_mis++;
  102. rx_mon_stats->status_ppdu_state
  103. = CDP_MON_PPDU_START;
  104. } else if (ppdu_info->rx_state ==
  105. HAL_RX_MON_PPDU_END) {
  106. rx_mon_stats->status_ppdu_end++;
  107. if (rx_mon_stats->status_ppdu_state
  108. != CDP_MON_PPDU_START)
  109. rx_mon_stats->status_ppdu_start_mis++;
  110. else
  111. rx_mon_stats->status_ppdu_compl++;
  112. rx_mon_stats->status_ppdu_state
  113. = CDP_MON_PPDU_END;
  114. }
  115. }
  116. /*
  117. * dp_rx_mon_init_dbg_ppdu_stats() - initialization for monitor mode stats
  118. * @ppdu_info: HAL RX PPDU info retrieved from status ring TLV
  119. * @rx_mon_stats: monitor mode status/destination ring PPDU and MPDU count
  120. *
  121. * Return: None
  122. */
  123. static inline void
  124. dp_rx_mon_init_dbg_ppdu_stats(struct hal_rx_ppdu_info *ppdu_info,
  125. struct cdp_pdev_mon_stats *rx_mon_stats)
  126. {
  127. ppdu_info->rx_state = HAL_RX_MON_PPDU_END;
  128. rx_mon_stats->status_ppdu_state
  129. = CDP_MON_PPDU_END;
  130. }
  131. /*
  132. * dp_rx_mon_dbg_dbg_ppdu_stats() - Print monitor mode status ring stats
  133. * @ppdu_info: HAL RX PPDU info retrieved from status ring TLV
  134. * @rx_mon_stats: monitor mode status/destination ring PPDU and MPDU count
  135. *
  136. * Print monitor mode PPDU start and end TLV count
  137. * Return: None
  138. */
  139. static inline void
  140. dp_rx_mon_print_dbg_ppdu_stats(struct cdp_pdev_mon_stats *rx_mon_stats)
  141. {
  142. DP_PRINT_STATS("status_ppdu_compl_cnt = %d",
  143. rx_mon_stats->status_ppdu_compl);
  144. DP_PRINT_STATS("status_ppdu_start_cnt = %d",
  145. rx_mon_stats->status_ppdu_start);
  146. DP_PRINT_STATS("status_ppdu_end_cnt = %d",
  147. rx_mon_stats->status_ppdu_end);
  148. DP_PRINT_STATS("status_ppdu_start_mis_cnt = %d",
  149. rx_mon_stats->status_ppdu_start_mis);
  150. DP_PRINT_STATS("status_ppdu_end_mis_cnt = %d",
  151. rx_mon_stats->status_ppdu_end_mis);
  152. }
  153. #else
  154. static inline void
  155. dp_rx_mon_update_dbg_ppdu_stats(struct hal_rx_ppdu_info *ppdu_info,
  156. struct cdp_pdev_mon_stats *rx_mon_stats)
  157. {
  158. }
  159. static inline void
  160. dp_rx_mon_init_dbg_ppdu_stats(struct hal_rx_ppdu_info *ppdu_info,
  161. struct cdp_pdev_mon_stats *rx_mon_stats)
  162. {
  163. }
  164. static inline void
  165. dp_rx_mon_print_dbg_ppdu_stats(struct hal_rx_ppdu_info *ppdu_info,
  166. struct cdp_pdev_mon_stats *rx_mon_stats)
  167. {
  168. }
  169. #endif
  170. #endif