wlan_logging_sock_svc.h 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190
  1. /*
  2. * Copyright (c) 2014-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. /******************************************************************************
  20. * wlan_logging_sock_svc.h
  21. *
  22. ******************************************************************************/
  23. #ifndef WLAN_LOGGING_SOCK_SVC_H
  24. #define WLAN_LOGGING_SOCK_SVC_H
  25. #include <wlan_nlink_srv.h>
  26. #include <qdf_status.h>
  27. #include <qdf_trace.h>
  28. #include <wlan_nlink_common.h>
  29. int wlan_logging_sock_init_svc(void);
  30. int wlan_logging_sock_deinit_svc(void);
  31. int wlan_log_to_user(QDF_TRACE_LEVEL log_level, char *to_be_sent, int length);
  32. /**
  33. * wlan_logging_set_flush_timer() - Sets the time period for log flush timer
  34. * @milliseconds: Time period in milliseconds
  35. *
  36. * This function sets the time period interval during which the log buffers
  37. * will be flushed out to user space. Setting this interval can set an
  38. * approximate maximum delay after which any message logged through QDF_TRACE
  39. * will appear at user-space
  40. *
  41. * Return: void
  42. */
  43. int wlan_logging_set_flush_timer(uint32_t milliseconds);
  44. /**
  45. * wlan_logging_notifier_init() - registers to panic notifier chain
  46. * @dump_at_kernel_enable: qdf logging at kernel level enabled
  47. *
  48. * This function registers an handler to panic notifier chain if
  49. * qdf logging at kernel level is disabled.
  50. *
  51. * Return: 0 on success
  52. */
  53. int wlan_logging_notifier_init(bool dump_at_kernel_enable);
  54. /**
  55. * wlan_logging_notifier_deinit() - unregisters to panic notifier chain
  56. * @dump_at_kernel_enable: qdf logging at kernel level enabled
  57. *
  58. * This function unregisters an handler to panic notifier chain if
  59. * qdf logging at kernel level is disabled.
  60. *
  61. * Return: 0 on success
  62. */
  63. int wlan_logging_notifier_deinit(bool dump_at_kernel_enable);
  64. #ifdef WLAN_LOGGING_SOCK_SVC_ENABLE
  65. /**
  66. * wlan_logging_wait_for_flush_log_completion() - Wait for flush log completion
  67. *
  68. * Return: QDF_STATUS
  69. */
  70. QDF_STATUS wlan_logging_wait_for_flush_log_completion(void);
  71. void wlan_logging_set_per_pkt_stats(void);
  72. /**
  73. * wlan_logging_set_connectivity_log() - INterrupt the gwlan_logging thread
  74. * to send the connectivity logs
  75. *
  76. * Return: None
  77. */
  78. void wlan_logging_set_connectivity_log(void);
  79. void wlan_logging_set_fw_flush_complete(void);
  80. void wlan_flush_host_logs_for_fatal(void);
  81. void wlan_logging_set_active(bool active);
  82. void wlan_set_console_log_levels(uint32_t console_log_levels);
  83. #else
  84. static inline QDF_STATUS wlan_logging_wait_for_flush_log_completion(void)
  85. {
  86. return QDF_STATUS_SUCCESS;
  87. }
  88. static inline void wlan_flush_host_logs_for_fatal(void) {}
  89. static inline void wlan_logging_set_per_pkt_stats(void) {}
  90. static inline void wlan_logging_set_fw_flush_complete(void) {}
  91. static inline void wlan_logging_set_active(bool active) {}
  92. static inline void wlan_set_console_log_levels(uint32_t console_log_levels) {}
  93. #endif /* WLAN_LOGGING_SOCK_SVC_ENABLE */
  94. #if defined(WLAN_LOGGING_SOCK_SVC_ENABLE) && \
  95. defined(CONNECTIVITY_PKTLOG)
  96. /**
  97. * wlan_deregister_txrx_packetdump() - tx/rx packet dump
  98. * deregistration
  99. * @pdev_id: id of the datapath pdev handle
  100. *
  101. * This function is used to deregister tx/rx packet dump callbacks
  102. * with ol, pe and htt layers
  103. *
  104. * Return: None
  105. *
  106. */
  107. void wlan_deregister_txrx_packetdump(uint8_t pdev_id);
  108. /**
  109. * wlan_register_txrx_packetdump() - tx/rx packet dump
  110. * registration
  111. * @pdev_id: id of the datapath pdev handle
  112. *
  113. * This function is used to register tx/rx packet dump callbacks
  114. * with ol, pe and htt layers
  115. *
  116. * Return: None
  117. *
  118. */
  119. void wlan_register_txrx_packetdump(uint8_t pdev_id);
  120. #else
  121. static inline void wlan_deregister_txrx_packetdump(uint8_t pdev_id) {}
  122. static inline void wlan_register_txrx_packetdump(uint8_t pdev_id) {}
  123. #endif
  124. #if defined(WLAN_LOGGING_SOCK_SVC_ENABLE) && defined(FEATURE_WLAN_DIAG_SUPPORT)
  125. void wlan_report_log_completion(uint32_t is_fatal,
  126. uint32_t indicator,
  127. uint32_t reason_code,
  128. uint8_t ring_id);
  129. #else
  130. static inline void wlan_report_log_completion(uint32_t is_fatal,
  131. uint32_t indicator,
  132. uint32_t reason_code,
  133. uint8_t ring_id)
  134. {
  135. return;
  136. }
  137. #endif /* FEATURE_WLAN_DIAG_SUPPORT */
  138. #if defined(WLAN_LOGGING_SOCK_SVC_ENABLE) && \
  139. defined(CONNECTIVITY_PKTLOG)
  140. void wlan_pkt_stats_to_logger_thread(void *pl_hdr, void *pkt_dump, void *data);
  141. #else
  142. static inline
  143. void wlan_pkt_stats_to_logger_thread(void *pl_hdr, void *pkt_dump, void *data)
  144. {
  145. }
  146. #endif
  147. /**
  148. * enum tx_status - tx status
  149. * @tx_status_ok: successfully sent + acked
  150. * @tx_status_discard: discard - not sent (congestion control)
  151. * @tx_status_no_ack: no_ack - sent, but no ack
  152. * @tx_status_download_fail: download_fail -
  153. * the host could not deliver the tx frame to the target
  154. * @tx_status_peer_del: peer_del - tx completion for
  155. * already deleted peer used for HL case
  156. *
  157. * This enum has tx status types
  158. */
  159. enum tx_status {
  160. tx_status_ok,
  161. tx_status_discard,
  162. tx_status_no_ack,
  163. tx_status_download_fail,
  164. tx_status_peer_del,
  165. };
  166. #ifdef WLAN_CHIPSET_STATS
  167. void wlan_set_chipset_stats_bit(void);
  168. #else
  169. static inline void wlan_set_chipset_stats_bit(void)
  170. {
  171. }
  172. #endif /* WLAN_CHIPSET_STATS */
  173. #endif /* WLAN_LOGGING_SOCK_SVC_H */