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