dp_rx_mon.h 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187
  1. /*
  2. * Copyright (c) 2016-2018 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. #ifdef CONFIG_MCL
  21. #include <cds_ieee80211_defines.h>
  22. #endif
  23. /**
  24. * dp_rx_mon_dest_process() - Brain of the Rx processing functionality
  25. * Called from the bottom half (tasklet/NET_RX_SOFTIRQ)
  26. * @soc: core txrx main context 164
  27. * @hal_ring: opaque pointer to the HAL Rx Ring, which will be serviced
  28. * @quota: No. of units (packets) that can be serviced in one shot.
  29. *
  30. * This function implements the core of Rx functionality. This is
  31. * expected to handle only non-error frames.
  32. *
  33. * Return: uint32_t: No. of elements processed
  34. */
  35. void dp_rx_mon_dest_process(struct dp_soc *soc, uint32_t mac_id,
  36. uint32_t quota);
  37. #ifndef QCA_WIFI_QCA6390
  38. QDF_STATUS dp_rx_pdev_mon_attach(struct dp_pdev *pdev);
  39. QDF_STATUS dp_rx_pdev_mon_detach(struct dp_pdev *pdev);
  40. QDF_STATUS dp_rx_pdev_mon_status_attach(struct dp_pdev *pdev, int mac_id);
  41. QDF_STATUS dp_rx_pdev_mon_status_detach(struct dp_pdev *pdev, int mac_id);
  42. #else
  43. static inline
  44. QDF_STATUS dp_rx_pdev_mon_attach(struct dp_pdev *pdev)
  45. {
  46. return QDF_STATUS_SUCCESS;
  47. }
  48. static inline
  49. QDF_STATUS dp_rx_pdev_mon_detach(struct dp_pdev *pdev)
  50. {
  51. return QDF_STATUS_SUCCESS;
  52. }
  53. static inline
  54. QDF_STATUS dp_rx_pdev_mon_status_attach(struct dp_pdev *pdev, int mac_id)
  55. {
  56. return QDF_STATUS_SUCCESS;
  57. }
  58. static inline
  59. QDF_STATUS dp_rx_pdev_mon_status_detach(struct dp_pdev *pdev, int mac_id)
  60. {
  61. return QDF_STATUS_SUCCESS;
  62. }
  63. #endif
  64. uint32_t dp_mon_process(struct dp_soc *soc, uint32_t mac_id, uint32_t quota);
  65. QDF_STATUS dp_rx_mon_deliver(struct dp_soc *soc, uint32_t mac_id,
  66. qdf_nbuf_t head_msdu, qdf_nbuf_t tail_msdu);
  67. /*
  68. * dp_rx_mon_deliver_non_std() - deliver frames for non standard path
  69. * @soc: core txrx main contex
  70. * @mac_id: MAC ID
  71. *
  72. * This function delivers the radio tap and dummy MSDU
  73. * into user layer application for preamble only PPDU.
  74. *
  75. * Return: Operation status
  76. */
  77. QDF_STATUS dp_rx_mon_deliver_non_std(struct dp_soc *soc, uint32_t mac_id);
  78. uint32_t dp_rxdma_err_process(struct dp_soc *soc, uint32_t mac_id,
  79. uint32_t quota);
  80. #ifndef REMOVE_MON_DBG_STATS
  81. /*
  82. * dp_rx_mon_update_dbg_ppdu_stats() - Update status ring TLV count
  83. * @ppdu_info: HAL RX PPDU info retrieved from status ring TLV
  84. * @rx_mon_stats: monitor mode status/destination ring PPDU and MPDU count
  85. *
  86. * Update status ring PPDU start and end count. Keep track TLV state on
  87. * PPDU start and end to find out if start and end is matching. Keep
  88. * track missing PPDU start and end count. Keep track matching PPDU
  89. * start and end count.
  90. *
  91. * Return: None
  92. */
  93. static inline void
  94. dp_rx_mon_update_dbg_ppdu_stats(struct hal_rx_ppdu_info *ppdu_info,
  95. struct cdp_pdev_mon_stats *rx_mon_stats)
  96. {
  97. if (ppdu_info->rx_state ==
  98. HAL_RX_MON_PPDU_START) {
  99. rx_mon_stats->status_ppdu_start++;
  100. if (rx_mon_stats->status_ppdu_state
  101. != CDP_MON_PPDU_END)
  102. rx_mon_stats->status_ppdu_end_mis++;
  103. rx_mon_stats->status_ppdu_state
  104. = CDP_MON_PPDU_START;
  105. } else if (ppdu_info->rx_state ==
  106. HAL_RX_MON_PPDU_END) {
  107. rx_mon_stats->status_ppdu_end++;
  108. if (rx_mon_stats->status_ppdu_state
  109. != CDP_MON_PPDU_START)
  110. rx_mon_stats->status_ppdu_start_mis++;
  111. else
  112. rx_mon_stats->status_ppdu_compl++;
  113. rx_mon_stats->status_ppdu_state
  114. = CDP_MON_PPDU_END;
  115. }
  116. }
  117. /*
  118. * dp_rx_mon_init_dbg_ppdu_stats() - initialization for monitor mode stats
  119. * @ppdu_info: HAL RX PPDU info retrieved from status ring TLV
  120. * @rx_mon_stats: monitor mode status/destination ring PPDU and MPDU count
  121. *
  122. * Return: None
  123. */
  124. static inline void
  125. dp_rx_mon_init_dbg_ppdu_stats(struct hal_rx_ppdu_info *ppdu_info,
  126. struct cdp_pdev_mon_stats *rx_mon_stats)
  127. {
  128. ppdu_info->rx_state = HAL_RX_MON_PPDU_END;
  129. rx_mon_stats->status_ppdu_state
  130. = CDP_MON_PPDU_END;
  131. }
  132. /*
  133. * dp_rx_mon_dbg_dbg_ppdu_stats() - Print monitor mode status ring stats
  134. * @ppdu_info: HAL RX PPDU info retrieved from status ring TLV
  135. * @rx_mon_stats: monitor mode status/destination ring PPDU and MPDU count
  136. *
  137. * Print monitor mode PPDU start and end TLV count
  138. * Return: None
  139. */
  140. static inline void
  141. dp_rx_mon_print_dbg_ppdu_stats(struct cdp_pdev_mon_stats *rx_mon_stats)
  142. {
  143. DP_PRINT_STATS("status_ppdu_compl_cnt = %d",
  144. rx_mon_stats->status_ppdu_compl);
  145. DP_PRINT_STATS("status_ppdu_start_cnt = %d",
  146. rx_mon_stats->status_ppdu_start);
  147. DP_PRINT_STATS("status_ppdu_end_cnt = %d",
  148. rx_mon_stats->status_ppdu_end);
  149. DP_PRINT_STATS("status_ppdu_start_mis_cnt = %d",
  150. rx_mon_stats->status_ppdu_start_mis);
  151. DP_PRINT_STATS("status_ppdu_end_mis_cnt = %d",
  152. rx_mon_stats->status_ppdu_end_mis);
  153. }
  154. #else
  155. static inline void
  156. dp_rx_mon_update_dbg_ppdu_stats(struct hal_rx_ppdu_info *ppdu_info,
  157. struct cdp_pdev_mon_stats *rx_mon_stats)
  158. {
  159. }
  160. static inline void
  161. dp_rx_mon_init_dbg_ppdu_stats(struct hal_rx_ppdu_info *ppdu_info,
  162. struct cdp_pdev_mon_stats *rx_mon_stats)
  163. {
  164. }
  165. static inline void
  166. dp_rx_mon_print_dbg_ppdu_stats(struct hal_rx_ppdu_info *ppdu_info,
  167. struct cdp_pdev_mon_stats *rx_mon_stats)
  168. {
  169. }
  170. #endif
  171. #endif