xref: /wlan-driver/qca-wifi-host-cmn/utils/logging/inc/wlan_logging_sock_svc.h (revision 5113495b16420b49004c444715d2daae2066e7dc)
1*5113495bSYour Name /*
2*5113495bSYour Name  * Copyright (c) 2014-2021 The Linux Foundation. All rights reserved.
3*5113495bSYour Name  * Copyright (c) 2022,2024 Qualcomm Innovation Center, Inc. All rights reserved.
4*5113495bSYour Name  *
5*5113495bSYour Name  * Permission to use, copy, modify, and/or distribute this software for
6*5113495bSYour Name  * any purpose with or without fee is hereby granted, provided that the
7*5113495bSYour Name  * above copyright notice and this permission notice appear in all
8*5113495bSYour Name  * copies.
9*5113495bSYour Name  *
10*5113495bSYour Name  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
11*5113495bSYour Name  * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
12*5113495bSYour Name  * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
13*5113495bSYour Name  * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
14*5113495bSYour Name  * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
15*5113495bSYour Name  * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
16*5113495bSYour Name  * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
17*5113495bSYour Name  * PERFORMANCE OF THIS SOFTWARE.
18*5113495bSYour Name  */
19*5113495bSYour Name 
20*5113495bSYour Name /******************************************************************************
21*5113495bSYour Name * wlan_logging_sock_svc.h
22*5113495bSYour Name *
23*5113495bSYour Name ******************************************************************************/
24*5113495bSYour Name 
25*5113495bSYour Name #ifndef WLAN_LOGGING_SOCK_SVC_H
26*5113495bSYour Name #define WLAN_LOGGING_SOCK_SVC_H
27*5113495bSYour Name 
28*5113495bSYour Name #include <wlan_nlink_srv.h>
29*5113495bSYour Name #include <qdf_status.h>
30*5113495bSYour Name #include <qdf_trace.h>
31*5113495bSYour Name #include <wlan_nlink_common.h>
32*5113495bSYour Name 
33*5113495bSYour Name int wlan_logging_sock_init_svc(void);
34*5113495bSYour Name int wlan_logging_sock_deinit_svc(void);
35*5113495bSYour Name int wlan_log_to_user(QDF_TRACE_LEVEL log_level, char *to_be_sent, int length);
36*5113495bSYour Name 
37*5113495bSYour Name /**
38*5113495bSYour Name  * wlan_logging_set_flush_timer() - Sets the time period for log flush timer
39*5113495bSYour Name  * @milliseconds: Time period in milliseconds
40*5113495bSYour Name  *
41*5113495bSYour Name  * This function sets the time period interval during which the log buffers
42*5113495bSYour Name  * will be flushed out to user space. Setting this interval can set an
43*5113495bSYour Name  * approximate maximum delay after which any message logged through QDF_TRACE
44*5113495bSYour Name  * will appear at user-space
45*5113495bSYour Name  *
46*5113495bSYour Name  * Return: void
47*5113495bSYour Name  */
48*5113495bSYour Name int wlan_logging_set_flush_timer(uint32_t milliseconds);
49*5113495bSYour Name 
50*5113495bSYour Name /**
51*5113495bSYour Name  * wlan_logging_notifier_init() - registers to panic notifier chain
52*5113495bSYour Name  * @dump_at_kernel_enable: qdf logging at kernel level enabled
53*5113495bSYour Name  *
54*5113495bSYour Name  * This function registers an handler to panic notifier chain if
55*5113495bSYour Name  * qdf logging at kernel level is disabled.
56*5113495bSYour Name  *
57*5113495bSYour Name  * Return: 0 on success
58*5113495bSYour Name  */
59*5113495bSYour Name int wlan_logging_notifier_init(bool dump_at_kernel_enable);
60*5113495bSYour Name 
61*5113495bSYour Name /**
62*5113495bSYour Name  * wlan_logging_notifier_deinit() - unregisters to panic notifier chain
63*5113495bSYour Name  * @dump_at_kernel_enable: qdf logging at kernel level enabled
64*5113495bSYour Name  *
65*5113495bSYour Name  * This function unregisters an handler to panic notifier chain if
66*5113495bSYour Name  * qdf logging at kernel level is disabled.
67*5113495bSYour Name  *
68*5113495bSYour Name  * Return: 0 on success
69*5113495bSYour Name  */
70*5113495bSYour Name int wlan_logging_notifier_deinit(bool dump_at_kernel_enable);
71*5113495bSYour Name 
72*5113495bSYour Name #ifdef WLAN_LOGGING_SOCK_SVC_ENABLE
73*5113495bSYour Name /**
74*5113495bSYour Name  * wlan_logging_wait_for_flush_log_completion() -  Wait for flush log completion
75*5113495bSYour Name  *
76*5113495bSYour Name  * Return: QDF_STATUS
77*5113495bSYour Name  */
78*5113495bSYour Name QDF_STATUS wlan_logging_wait_for_flush_log_completion(void);
79*5113495bSYour Name 
80*5113495bSYour Name void wlan_logging_set_per_pkt_stats(void);
81*5113495bSYour Name 
82*5113495bSYour Name /**
83*5113495bSYour Name  * wlan_logging_set_connectivity_log() - INterrupt the gwlan_logging thread
84*5113495bSYour Name  * to send the connectivity logs
85*5113495bSYour Name  *
86*5113495bSYour Name  * Return: None
87*5113495bSYour Name  */
88*5113495bSYour Name void wlan_logging_set_connectivity_log(void);
89*5113495bSYour Name void wlan_logging_set_fw_flush_complete(void);
90*5113495bSYour Name void wlan_flush_host_logs_for_fatal(void);
91*5113495bSYour Name void wlan_logging_set_active(bool active);
92*5113495bSYour Name void wlan_set_console_log_levels(uint32_t console_log_levels);
93*5113495bSYour Name #else
wlan_logging_wait_for_flush_log_completion(void)94*5113495bSYour Name static inline QDF_STATUS wlan_logging_wait_for_flush_log_completion(void)
95*5113495bSYour Name {
96*5113495bSYour Name 	return QDF_STATUS_SUCCESS;
97*5113495bSYour Name }
wlan_flush_host_logs_for_fatal(void)98*5113495bSYour Name static inline void wlan_flush_host_logs_for_fatal(void) {}
wlan_logging_set_per_pkt_stats(void)99*5113495bSYour Name static inline void wlan_logging_set_per_pkt_stats(void) {}
wlan_logging_set_fw_flush_complete(void)100*5113495bSYour Name static inline void wlan_logging_set_fw_flush_complete(void) {}
wlan_logging_set_active(bool active)101*5113495bSYour Name static inline void wlan_logging_set_active(bool active) {}
wlan_set_console_log_levels(uint32_t console_log_levels)102*5113495bSYour Name static inline void wlan_set_console_log_levels(uint32_t console_log_levels) {}
103*5113495bSYour Name #endif /* WLAN_LOGGING_SOCK_SVC_ENABLE */
104*5113495bSYour Name 
105*5113495bSYour Name #if defined(WLAN_LOGGING_SOCK_SVC_ENABLE) && \
106*5113495bSYour Name 	defined(CONNECTIVITY_PKTLOG)
107*5113495bSYour Name /**
108*5113495bSYour Name  * wlan_deregister_txrx_packetdump() - tx/rx packet dump
109*5113495bSYour Name  *  deregistration
110*5113495bSYour Name  * @pdev_id: id of the datapath pdev handle
111*5113495bSYour Name  *
112*5113495bSYour Name  * This function is used to deregister tx/rx packet dump callbacks
113*5113495bSYour Name  * with ol, pe and htt layers
114*5113495bSYour Name  *
115*5113495bSYour Name  * Return: None
116*5113495bSYour Name  *
117*5113495bSYour Name  */
118*5113495bSYour Name void wlan_deregister_txrx_packetdump(uint8_t pdev_id);
119*5113495bSYour Name 
120*5113495bSYour Name /**
121*5113495bSYour Name  * wlan_register_txrx_packetdump() - tx/rx packet dump
122*5113495bSYour Name  * registration
123*5113495bSYour Name  * @pdev_id: id of the datapath pdev handle
124*5113495bSYour Name  *
125*5113495bSYour Name  * This function is used to register tx/rx packet dump callbacks
126*5113495bSYour Name  * with ol, pe and htt layers
127*5113495bSYour Name  *
128*5113495bSYour Name  * Return: None
129*5113495bSYour Name  *
130*5113495bSYour Name  */
131*5113495bSYour Name void wlan_register_txrx_packetdump(uint8_t pdev_id);
132*5113495bSYour Name #else
wlan_deregister_txrx_packetdump(uint8_t pdev_id)133*5113495bSYour Name static inline void wlan_deregister_txrx_packetdump(uint8_t pdev_id) {}
wlan_register_txrx_packetdump(uint8_t pdev_id)134*5113495bSYour Name static inline void wlan_register_txrx_packetdump(uint8_t pdev_id) {}
135*5113495bSYour Name #endif
136*5113495bSYour Name 
137*5113495bSYour Name #if defined(WLAN_LOGGING_SOCK_SVC_ENABLE) && defined(FEATURE_WLAN_DIAG_SUPPORT)
138*5113495bSYour Name void wlan_report_log_completion(uint32_t is_fatal,
139*5113495bSYour Name 		uint32_t indicator,
140*5113495bSYour Name 		uint32_t reason_code,
141*5113495bSYour Name 		uint8_t ring_id);
142*5113495bSYour Name #else
wlan_report_log_completion(uint32_t is_fatal,uint32_t indicator,uint32_t reason_code,uint8_t ring_id)143*5113495bSYour Name static inline void wlan_report_log_completion(uint32_t is_fatal,
144*5113495bSYour Name 		uint32_t indicator,
145*5113495bSYour Name 		uint32_t reason_code,
146*5113495bSYour Name 		uint8_t ring_id)
147*5113495bSYour Name {
148*5113495bSYour Name 	return;
149*5113495bSYour Name }
150*5113495bSYour Name 
151*5113495bSYour Name #endif /* FEATURE_WLAN_DIAG_SUPPORT */
152*5113495bSYour Name 
153*5113495bSYour Name #if defined(WLAN_LOGGING_SOCK_SVC_ENABLE) && \
154*5113495bSYour Name 	defined(CONNECTIVITY_PKTLOG)
155*5113495bSYour Name void wlan_pkt_stats_to_logger_thread(void *pl_hdr, void *pkt_dump, void *data);
156*5113495bSYour Name #else
157*5113495bSYour Name static inline
wlan_pkt_stats_to_logger_thread(void * pl_hdr,void * pkt_dump,void * data)158*5113495bSYour Name void wlan_pkt_stats_to_logger_thread(void *pl_hdr, void *pkt_dump, void *data)
159*5113495bSYour Name {
160*5113495bSYour Name }
161*5113495bSYour Name #endif
162*5113495bSYour Name 
163*5113495bSYour Name /**
164*5113495bSYour Name  * enum tx_status - tx status
165*5113495bSYour Name  * @tx_status_ok: successfully sent + acked
166*5113495bSYour Name  * @tx_status_discard: discard - not sent (congestion control)
167*5113495bSYour Name  * @tx_status_no_ack: no_ack - sent, but no ack
168*5113495bSYour Name  * @tx_status_download_fail: download_fail -
169*5113495bSYour Name  * the host could not deliver the tx frame to the target
170*5113495bSYour Name  * @tx_status_peer_del: peer_del - tx completion for
171*5113495bSYour Name  * already deleted peer used for HL case
172*5113495bSYour Name  *
173*5113495bSYour Name  * This enum has tx status types
174*5113495bSYour Name  */
175*5113495bSYour Name enum tx_status {
176*5113495bSYour Name 	tx_status_ok,
177*5113495bSYour Name 	tx_status_discard,
178*5113495bSYour Name 	tx_status_no_ack,
179*5113495bSYour Name 	tx_status_download_fail,
180*5113495bSYour Name 	tx_status_peer_del,
181*5113495bSYour Name };
182*5113495bSYour Name 
183*5113495bSYour Name #ifdef WLAN_CHIPSET_STATS
184*5113495bSYour Name void wlan_set_chipset_stats_bit(void);
185*5113495bSYour Name #else
wlan_set_chipset_stats_bit(void)186*5113495bSYour Name static inline void wlan_set_chipset_stats_bit(void)
187*5113495bSYour Name {
188*5113495bSYour Name }
189*5113495bSYour Name #endif /* WLAN_CHIPSET_STATS */
190*5113495bSYour Name #endif /* WLAN_LOGGING_SOCK_SVC_H */
191