dp_rx_mon.h 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150
  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. QDF_STATUS dp_rx_pdev_mon_attach(struct dp_pdev *pdev);
  38. QDF_STATUS dp_rx_pdev_mon_detach(struct dp_pdev *pdev);
  39. QDF_STATUS dp_rx_pdev_mon_status_attach(struct dp_pdev *pdev, int mac_id);
  40. QDF_STATUS dp_rx_pdev_mon_status_detach(struct dp_pdev *pdev, int mac_id);
  41. uint32_t dp_mon_process(struct dp_soc *soc, uint32_t mac_id, uint32_t quota);
  42. QDF_STATUS dp_rx_mon_deliver(struct dp_soc *soc, uint32_t mac_id,
  43. qdf_nbuf_t head_msdu, qdf_nbuf_t tail_msdu);
  44. uint32_t dp_rxdma_err_process(struct dp_soc *soc, uint32_t mac_id,
  45. uint32_t quota);
  46. #ifndef REMOVE_MON_DBG_STATS
  47. /*
  48. * dp_rx_mon_update_dbg_ppdu_stats() - Update status ring TLV count
  49. * @ppdu_info: HAL RX PPDU info retrieved from status ring TLV
  50. * @rx_mon_stats: monitor mode status/destination ring PPDU and MPDU count
  51. *
  52. * Update status ring PPDU start and end count. Keep track TLV state on
  53. * PPDU start and end to find out if start and end is matching. Keep
  54. * track missing PPDU start and end count. Keep track matching PPDU
  55. * start and end count.
  56. *
  57. * Return: None
  58. */
  59. static inline void
  60. dp_rx_mon_update_dbg_ppdu_stats(struct hal_rx_ppdu_info *ppdu_info,
  61. struct cdp_pdev_mon_stats *rx_mon_stats)
  62. {
  63. if (ppdu_info->rx_state ==
  64. HAL_RX_MON_PPDU_START) {
  65. rx_mon_stats->status_ppdu_start++;
  66. if (rx_mon_stats->status_ppdu_state
  67. != CDP_MON_PPDU_END)
  68. rx_mon_stats->status_ppdu_end_mis++;
  69. rx_mon_stats->status_ppdu_state
  70. = CDP_MON_PPDU_START;
  71. } else if (ppdu_info->rx_state ==
  72. HAL_RX_MON_PPDU_END) {
  73. rx_mon_stats->status_ppdu_end++;
  74. if (rx_mon_stats->status_ppdu_state
  75. != CDP_MON_PPDU_START)
  76. rx_mon_stats->status_ppdu_start_mis++;
  77. else
  78. rx_mon_stats->status_ppdu_compl++;
  79. rx_mon_stats->status_ppdu_state
  80. = CDP_MON_PPDU_END;
  81. }
  82. }
  83. /*
  84. * dp_rx_mon_init_dbg_ppdu_stats() - initialization for monitor mode stats
  85. * @ppdu_info: HAL RX PPDU info retrieved from status ring TLV
  86. * @rx_mon_stats: monitor mode status/destination ring PPDU and MPDU count
  87. *
  88. * Return: None
  89. */
  90. static inline void
  91. dp_rx_mon_init_dbg_ppdu_stats(struct hal_rx_ppdu_info *ppdu_info,
  92. struct cdp_pdev_mon_stats *rx_mon_stats)
  93. {
  94. ppdu_info->rx_state = HAL_RX_MON_PPDU_END;
  95. rx_mon_stats->status_ppdu_state
  96. = CDP_MON_PPDU_END;
  97. }
  98. /*
  99. * dp_rx_mon_dbg_dbg_ppdu_stats() - Print monitor mode status ring stats
  100. * @ppdu_info: HAL RX PPDU info retrieved from status ring TLV
  101. * @rx_mon_stats: monitor mode status/destination ring PPDU and MPDU count
  102. *
  103. * Print monitor mode PPDU start and end TLV count
  104. * Return: None
  105. */
  106. static inline void
  107. dp_rx_mon_print_dbg_ppdu_stats(struct cdp_pdev_mon_stats *rx_mon_stats)
  108. {
  109. DP_PRINT_STATS("status_ppdu_compl_cnt = %d",
  110. rx_mon_stats->status_ppdu_compl);
  111. DP_PRINT_STATS("status_ppdu_start_cnt = %d",
  112. rx_mon_stats->status_ppdu_start);
  113. DP_PRINT_STATS("status_ppdu_end_cnt = %d",
  114. rx_mon_stats->status_ppdu_end);
  115. DP_PRINT_STATS("status_ppdu_start_mis_cnt = %d",
  116. rx_mon_stats->status_ppdu_start_mis);
  117. DP_PRINT_STATS("status_ppdu_end_mis_cnt = %d",
  118. rx_mon_stats->status_ppdu_end_mis);
  119. }
  120. #else
  121. static inline void
  122. dp_rx_mon_update_dbg_ppdu_stats(struct hal_rx_ppdu_info *ppdu_info,
  123. struct cdp_pdev_mon_stats *rx_mon_stats)
  124. {
  125. }
  126. static inline void
  127. dp_rx_mon_init_dbg_ppdu_stats(struct hal_rx_ppdu_info *ppdu_info,
  128. struct cdp_pdev_mon_stats *rx_mon_stats)
  129. {
  130. }
  131. static inline void
  132. dp_rx_mon_print_dbg_ppdu_stats(struct hal_rx_ppdu_info *ppdu_info,
  133. struct cdp_pdev_mon_stats *rx_mon_stats)
  134. {
  135. }
  136. #endif
  137. #endif