xref: /wlan-dirver/qca-wifi-host-cmn/qdf/inc/qdf_trace.h (revision 4865edfd190c086bbe2c69aae12a8226f877b91e)
1 /*
2  * Copyright (c) 2014-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 
19 #if !defined(__QDF_TRACE_H)
20 #define __QDF_TRACE_H
21 
22 /**
23  *  DOC: qdf_trace
24  *  QCA driver framework trace APIs
25  *  Trace, logging, and debugging definitions and APIs
26  */
27 
28 /* Include Files */
29 #include  <qdf_types.h>         /* For QDF_MODULE_ID... */
30 #include  <stdarg.h>            /* For va_list... */
31 #include  <qdf_status.h>
32 #include  <qdf_nbuf.h>
33 #include  <i_qdf_types.h>
34 #include <qdf_debugfs.h>
35 
36 
37 /* Type declarations */
38 
39 #define FL(x)    "%s: %d: " x, __func__, __LINE__
40 #define QDF_TRACE_BUFFER_SIZE (512)
41 
42 #ifdef CONFIG_MCL
43 #define QDF_DEFAULT_TRACE_LEVEL \
44 	((1 << QDF_TRACE_LEVEL_FATAL) | (1 << QDF_TRACE_LEVEL_ERROR))
45 #else
46 #define QDF_DEFAULT_TRACE_LEVEL (1 << QDF_TRACE_LEVEL_INFO)
47 #endif
48 
49 #define QDF_CATEGORY_INFO_U16(val) (((val >> 16) & 0x0000FFFF))
50 #define QDF_TRACE_LEVEL_INFO_L16(val) (val & 0x0000FFFF)
51 
52 typedef int (qdf_abstract_print)(void *priv, const char *fmt, ...);
53 
54 /*
55  * Log levels
56  */
57 #define QDF_DEBUG_FUNCTRACE     0x01
58 #define QDF_DEBUG_LEVEL0        0x02
59 #define QDF_DEBUG_LEVEL1        0x04
60 #define QDF_DEBUG_LEVEL2        0x08
61 #define QDF_DEBUG_LEVEL3        0x10
62 #define QDF_DEBUG_ERROR         0x20
63 #define QDF_DEBUG_CFG           0x40
64 
65 
66 /* DP Trace Implementation */
67 #ifdef CONFIG_DP_TRACE
68 #define DPTRACE(p) p
69 #define DPTRACE_PRINT(args...) QDF_TRACE_DEBUG(QDF_MODULE_ID_QDF, args)
70 #else
71 #define DPTRACE(p)
72 #define DPTRACE_PRINT(args...)
73 #endif
74 
75 /* By default Data Path module will have all log levels enabled, except debug
76  * log level. Debug level will be left up to the framework or user space modules
77  * to be enabled when issue is detected
78  */
79 #define QDF_DATA_PATH_TRACE_LEVEL \
80 	((1 << QDF_TRACE_LEVEL_FATAL) | (1 << QDF_TRACE_LEVEL_ERROR) | \
81 	(1 << QDF_TRACE_LEVEL_WARN) | (1 << QDF_TRACE_LEVEL_INFO) | \
82 	(1 << QDF_TRACE_LEVEL_INFO_HIGH) | (1 << QDF_TRACE_LEVEL_INFO_MED) | \
83 	(1 << QDF_TRACE_LEVEL_INFO_LOW))
84 
85 /* Preprocessor definitions and constants */
86 #define ASSERT_BUFFER_SIZE (512)
87 
88 #define QDF_TRACE_DEFAULT_PDEV_ID 0xff
89 #define MAX_QDF_TRACE_RECORDS 4000
90 #define INVALID_QDF_TRACE_ADDR 0xffffffff
91 #define DEFAULT_QDF_TRACE_DUMP_COUNT 0
92 
93 /*
94  * first parameter to iwpriv command - dump_dp_trace
95  * iwpriv wlan0 dump_dp_trace 0 0 -> dump full buffer
96  * iwpriv wlan0 dump_dp_trace 1 0 -> enable live view mode
97  * iwpriv wlan0 dump_dp_trace 2 0 -> clear dp trace buffer
98  * iwpriv wlan0 dump_dp_trace 3 0 -> disable live view mode
99  */
100 #define DUMP_DP_TRACE			0
101 #define ENABLE_DP_TRACE_LIVE_MODE	1
102 #define CLEAR_DP_TRACE_BUFFER		2
103 #define DISABLE_DP_TRACE_LIVE_MODE	3
104 
105 
106 #ifdef TRACE_RECORD
107 
108 #define MTRACE(p) p
109 
110 #else
111 #define MTRACE(p) do { } while (0)
112 
113 #endif
114 #define NO_SESSION 0xFF
115 
116 /**
117  * typedef struct qdf_trace_record_s - keep trace record
118  * @qtime: qtimer ticks
119  * @time: user timestamp
120  * @module: module name
121  * @code: hold record of code
122  * @session: hold record of session
123  * @data: hold data
124  * @pid: hold pid of the process
125  */
126 typedef struct qdf_trace_record_s {
127 	uint64_t qtime;
128 	char time[18];
129 	uint8_t module;
130 	uint8_t code;
131 	uint16_t session;
132 	uint32_t data;
133 	uint32_t pid;
134 } qdf_trace_record_t, *tp_qdf_trace_record;
135 
136 /**
137  * typedef struct s_qdf_trace_data - MTRACE logs are stored in ring buffer
138  * @head: position of first record
139  * @tail: position of last record
140  * @num: count of total record
141  * @num_since_last_dump: count from last dump
142  * @enable: config for controlling the trace
143  * @dump_count: Dump after number of records reach this number
144  */
145 typedef struct s_qdf_trace_data {
146 	uint32_t head;
147 	uint32_t tail;
148 	uint32_t num;
149 	uint16_t num_since_last_dump;
150 	uint8_t enable;
151 	uint16_t dump_count;
152 } t_qdf_trace_data;
153 
154 #define CASE_RETURN_STRING(str) case ((str)): return (uint8_t *)(# str);
155 
156 
157 #define MAX_QDF_DP_TRACE_RECORDS       2000
158 #define QDF_DP_TRACE_RECORD_SIZE       40
159 #define INVALID_QDF_DP_TRACE_ADDR      0xffffffff
160 #define QDF_DP_TRACE_VERBOSITY_HIGH    3
161 #define QDF_DP_TRACE_VERBOSITY_MEDIUM  2
162 #define QDF_DP_TRACE_VERBOSITY_LOW     1
163 #define QDF_DP_TRACE_VERBOSITY_BASE    0
164 
165 /**
166  * enum QDF_DP_TRACE_ID - Generic ID to identify various events in data path
167  * @QDF_DP_TRACE_INVALID - invalid
168  * @QDF_DP_TRACE_DROP_PACKET_RECORD - record drop packet
169  * @QDF_DP_TRACE_EAPOL_PACKET_RECORD - record EAPOL packet
170  * @QDF_DP_TRACE_DHCP_PACKET_RECORD - record DHCP packet
171  * @QDF_DP_TRACE_ARP_PACKET_RECORD - record ARP packet
172  * @QDF_DP_TRACE_MGMT_PACKET_RECORD - record MGMT pacekt
173  * QDF_DP_TRACE_EVENT_RECORD - record events
174  * @QDF_DP_TRACE_BASE_VERBOSITY - below this are part of base verbosity
175  * @QDF_DP_TRACE_ICMP_PACKET_RECORD - record ICMP packet
176  * @QDF_DP_TRACE_ICMPv6_PACKET_RECORD - record ICMPv6 packet
177  * @QDF_DP_TRACE_HDD_TX_PACKET_RECORD - record 32 bytes of tx pkt at HDD
178  * @QDF_DP_TRACE_HDD_RX_PACKET_RECORD - record 32 bytes of rx pkt at HDD
179  * @QDF_DP_TRACE_TX_PACKET_RECORD - record 32 bytes of tx pkt at any layer
180  * @QDF_DP_TRACE_RX_PACKET_RECORD - record 32 bytes of rx pkt at any layer
181  * @QDF_DP_TRACE_HDD_TX_TIMEOUT - HDD tx timeout
182  * @QDF_DP_TRACE_HDD_SOFTAP_TX_TIMEOUT- SOFTAP HDD tx timeout
183  * @QDF_DP_TRACE_FREE_PACKET_PTR_RECORD - tx completion ptr record
184  * @QDF_DP_TRACE_LOW_VERBOSITY - below this are part of low verbosity
185  * @QDF_DP_TRACE_HDD_TX_PACKET_PTR_RECORD - HDD layer ptr record
186  * @QDF_DP_TRACE_LI_DP_TX_PACKET_PTR_RECORD - Lithium DP layer ptr record
187  * @QDF_DP_TRACE_CE_PACKET_PTR_RECORD - CE layer ptr record
188  * @QDF_DP_TRACE_CE_FAST_PACKET_PTR_RECORD- CE fastpath ptr record
189  * @QDF_DP_TRACE_CE_FAST_PACKET_ERR_RECORD- CE fastpath error record
190  * @QDF_DP_TRACE_RX_HTT_PACKET_PTR_RECORD - HTT RX record
191  * @QDF_DP_TRACE_RX_OFFLOAD_HTT_PACKET_PTR_RECORD- HTT RX offload record
192  * @QDF_DP_TRACE_RX_HDD_PACKET_PTR_RECORD - HDD RX record
193  * @QDF_DP_TRACE_RX_LI_DP_PACKET_PTR_RECORD - Lithium DP RX record
194   * @QDF_DP_TRACE_MED_VERBOSITY - below this are part of med verbosity
195  * @QDF_DP_TRACE_TXRX_QUEUE_PACKET_PTR_RECORD -tx queue ptr record
196  * @QDF_DP_TRACE_TXRX_PACKET_PTR_RECORD - txrx packet ptr record
197  * @QDF_DP_TRACE_TXRX_FAST_PACKET_PTR_RECORD - txrx fast path record
198  * @QDF_DP_TRACE_HTT_PACKET_PTR_RECORD - htt packet ptr record
199  * @QDF_DP_TRACE_HTC_PACKET_PTR_RECORD - htc packet ptr record
200  * @QDF_DP_TRACE_HIF_PACKET_PTR_RECORD - hif packet ptr record
201  * @QDF_DP_TRACE_RX_TXRX_PACKET_PTR_RECORD - txrx packet ptr record
202  * @QDF_DP_TRACE_LI_DP_TX_PACKET_RECORD - record 32 bytes of tx pkt at LI_DP
203  * @QDF_DP_TRACE_LI_DP_RX_PACKET_RECORD - record 32 bytes of rx pkt at LI_DP
204  * @QDF_DP_TRACE_LI_DP_NULL_RX_PACKET_RECORD
205  *		- record 32 bytes of rx null_queue pkt at LI_DP
206  * @QDF_DP_TRACE_HIGH_VERBOSITY - below this are part of high verbosity
207  */
208 enum  QDF_DP_TRACE_ID {
209 	QDF_DP_TRACE_INVALID,
210 	QDF_DP_TRACE_DROP_PACKET_RECORD,
211 	QDF_DP_TRACE_EAPOL_PACKET_RECORD,
212 	QDF_DP_TRACE_DHCP_PACKET_RECORD,
213 	QDF_DP_TRACE_ARP_PACKET_RECORD,
214 	QDF_DP_TRACE_MGMT_PACKET_RECORD,
215 	QDF_DP_TRACE_EVENT_RECORD,
216 	QDF_DP_TRACE_BASE_VERBOSITY,
217 	QDF_DP_TRACE_ICMP_PACKET_RECORD,
218 	QDF_DP_TRACE_ICMPv6_PACKET_RECORD,
219 	QDF_DP_TRACE_HDD_TX_PACKET_RECORD,
220 	QDF_DP_TRACE_HDD_RX_PACKET_RECORD,
221 	QDF_DP_TRACE_TX_PACKET_RECORD,
222 	QDF_DP_TRACE_RX_PACKET_RECORD,
223 	QDF_DP_TRACE_HDD_TX_TIMEOUT,
224 	QDF_DP_TRACE_HDD_SOFTAP_TX_TIMEOUT,
225 	QDF_DP_TRACE_FREE_PACKET_PTR_RECORD,
226 	QDF_DP_TRACE_LOW_VERBOSITY,
227 	QDF_DP_TRACE_HDD_TX_PACKET_PTR_RECORD,
228 	QDF_DP_TRACE_LI_DP_TX_PACKET_PTR_RECORD,
229 	QDF_DP_TRACE_RX_HDD_PACKET_PTR_RECORD,
230 	QDF_DP_TRACE_CE_PACKET_PTR_RECORD,
231 	QDF_DP_TRACE_CE_FAST_PACKET_PTR_RECORD,
232 	QDF_DP_TRACE_CE_FAST_PACKET_ERR_RECORD,
233 	QDF_DP_TRACE_RX_HTT_PACKET_PTR_RECORD,
234 	QDF_DP_TRACE_RX_OFFLOAD_HTT_PACKET_PTR_RECORD,
235 	QDF_DP_TRACE_RX_LI_DP_PACKET_PTR_RECORD,
236 	QDF_DP_TRACE_MED_VERBOSITY,
237 	QDF_DP_TRACE_TXRX_QUEUE_PACKET_PTR_RECORD,
238 	QDF_DP_TRACE_TXRX_PACKET_PTR_RECORD,
239 	QDF_DP_TRACE_TXRX_FAST_PACKET_PTR_RECORD,
240 	QDF_DP_TRACE_HTT_PACKET_PTR_RECORD,
241 	QDF_DP_TRACE_HTC_PACKET_PTR_RECORD,
242 	QDF_DP_TRACE_HIF_PACKET_PTR_RECORD,
243 	QDF_DP_TRACE_RX_TXRX_PACKET_PTR_RECORD,
244 	QDF_DP_TRACE_LI_DP_TX_PACKET_RECORD,
245 	QDF_DP_TRACE_LI_DP_RX_PACKET_RECORD,
246 	QDF_DP_TRACE_LI_DP_NULL_RX_PACKET_RECORD,
247 	QDF_DP_TRACE_HIGH_VERBOSITY,
248 	QDF_DP_TRACE_MAX
249 };
250 
251 /**
252  * qdf_proto_dir - direction
253  * @QDF_TX: TX direction
254  * @QDF_RX: RX direction
255  * @QDF_NA: not applicable
256  */
257 enum qdf_proto_dir {
258 	QDF_TX,
259 	QDF_RX,
260 	QDF_NA
261 };
262 
263 /**
264  * struct qdf_dp_trace_ptr_buf - pointer record buffer
265  * @cookie: cookie value
266  * @msdu_id: msdu_id
267  * @status: completion status
268  */
269 struct qdf_dp_trace_ptr_buf {
270 	uint64_t cookie;
271 	uint16_t msdu_id;
272 	uint16_t status;
273 };
274 
275 /**
276  * struct qdf_dp_trace_proto_buf - proto packet buffer
277  * @sa: source address
278  * @da: destination address
279  * @vdev_id : vdev id
280  * @type: packet type
281  * @subtype: packet subtype
282  * @dir: direction
283  */
284 struct qdf_dp_trace_proto_buf {
285 	struct qdf_mac_addr sa;
286 	struct qdf_mac_addr da;
287 	uint8_t vdev_id;
288 	uint8_t type;
289 	uint8_t subtype;
290 	uint8_t dir;
291 };
292 
293 /**
294  * struct qdf_dp_trace_mgmt_buf - mgmt packet buffer
295  * @vdev_id : vdev id
296  * @type: packet type
297  * @subtype: packet subtype
298  */
299 struct qdf_dp_trace_mgmt_buf {
300 	uint8_t vdev_id;
301 	uint8_t type;
302 	uint8_t subtype;
303 };
304 
305 /**
306  * struct qdf_dp_trace_event_buf - event buffer
307  * @vdev_id : vdev id
308  * @type: packet type
309  * @subtype: packet subtype
310  */
311 struct qdf_dp_trace_event_buf {
312 	uint8_t vdev_id;
313 	uint8_t type;
314 	uint8_t subtype;
315 };
316 
317 /**
318  * struct qdf_dp_trace_data_buf - nbuf data buffer
319  * @msdu_id : msdu id
320  */
321 struct qdf_dp_trace_data_buf {
322 	uint16_t msdu_id;
323 };
324 
325 /**
326  * struct qdf_dp_trace_record_s - Describes a record in DP trace
327  * @time: time when it got stored
328  * @code: Describes the particular event
329  * @data: buffer to store data
330  * @size: Length of the valid data stored in this record
331  * @pid : process id which stored the data in this record
332  */
333 struct qdf_dp_trace_record_s {
334 	uint64_t time;
335 	uint8_t code;
336 	uint8_t data[QDF_DP_TRACE_RECORD_SIZE];
337 	uint8_t size;
338 	uint32_t pid;
339 	uint8_t pdev_id;
340 };
341 
342 /**
343  * struct qdf_dp_trace_data - Parameters to configure/control DP trace
344  * @head: Position of first record
345  * @tail: Position of last record
346  * @num:  Current index
347  * @proto_bitmap: defines which protocol to be traced
348  * @no_of_record: defines every nth packet to be traced
349  * @verbosity : defines verbosity level
350  * @enable: enable/disable DP trace
351  * @count: current packet number
352  * @live_mode_config: configuration as received during initialization
353  * @live_mode: current live mode, enabled or disabled, can be throttled based
354  *             on throughput
355  * @force_live_mode: flag to enable live mode all the time for all packets.
356  *                  This can be set/unset from userspace and overrides other
357  *                  live mode flags.
358  * @print_pkt_cnt: count of number of packets printed in live mode
359  * @high_tput_thresh: thresh beyond which live mode is turned off
360  * @thresh_time_limit: max time, in terms of BW timer intervals to wait,
361  *          for determining if high_tput_thresh has been crossed. ~1s
362  * @arp_req: stats for arp reqs
363  * @arp_resp: stats for arp resps
364  * @icmp_req: stats for icmp reqs
365  * @icmp_resp: stats for icmp resps
366  * @dhcp_disc: stats for dhcp discover msgs
367  * @dhcp_req: stats for dhcp req msgs
368  * @dhcp_off: stats for dhcp offer msgs
369  * @dhcp_ack: stats for dhcp ack msgs
370  * @dhcp_nack: stats for dhcp nack msgs
371  * @dhcp_others: stats for other dhcp pkts types
372  * @eapol_m1: stats for eapol m1
373  * @eapol_m2: stats for eapol m2
374  * @eapol_m3: stats for eapol m3
375  * @eapol_m4: stats for eapol m4
376  * @eapol_others: stats for other eapol pkt types
377  * @icmpv6_req: stats for icmpv6 reqs
378  * @icmpv6_resp: stats for icmpv6 resps
379  * @icmpv6_ns: stats for icmpv6 nss
380  * @icmpv6_na: stats for icmpv6 nas
381  * @icmpv6_rs: stats for icmpv6 rss
382  * @icmpv6_ra: stats for icmpv6 ras
383  */
384 struct s_qdf_dp_trace_data {
385 	uint32_t head;
386 	uint32_t tail;
387 	uint32_t num;
388 	uint8_t proto_bitmap;
389 	uint8_t no_of_record;
390 	uint8_t verbosity;
391 	bool enable;
392 	bool live_mode_config;
393 	bool live_mode;
394 	uint32_t curr_pos;
395 	uint32_t saved_tail;
396 	bool force_live_mode;
397 	uint8_t print_pkt_cnt;
398 	uint8_t high_tput_thresh;
399 	uint16_t thresh_time_limit;
400 	/* Stats */
401 	uint32_t tx_count;
402 	uint32_t rx_count;
403 	u16 arp_req;
404 	u16 arp_resp;
405 	u16 dhcp_disc;
406 	u16 dhcp_req;
407 	u16 dhcp_off;
408 	u16 dhcp_ack;
409 	u16 dhcp_nack;
410 	u16 dhcp_others;
411 	u16 eapol_m1;
412 	u16 eapol_m2;
413 	u16 eapol_m3;
414 	u16 eapol_m4;
415 	u16 eapol_others;
416 	u16 icmp_req;
417 	u16 icmp_resp;
418 	u16 icmpv6_req;
419 	u16 icmpv6_resp;
420 	u16 icmpv6_ns;
421 	u16 icmpv6_na;
422 	u16 icmpv6_rs;
423 	u16 icmpv6_ra;
424 };
425 
426 /**
427  * struct qdf_dpt_debugfs_state - state to control read to debugfs file
428  * @QDF_DPT_DEBUGFS_STATE_SHOW_STATE_INVALID: invalid state
429  * @QDF_DPT_DEBUGFS_STATE_SHOW_STATE_INIT: initial state
430  * @QDF_DPT_DEBUGFS_STATE_SHOW_IN_PROGRESS: read is in progress
431  * @QDF_DPT_DEBUGFS_STATE_SHOW_COMPLETE:  read complete
432  */
433 
434 enum qdf_dpt_debugfs_state {
435 	QDF_DPT_DEBUGFS_STATE_SHOW_STATE_INVALID,
436 	QDF_DPT_DEBUGFS_STATE_SHOW_STATE_INIT,
437 	QDF_DPT_DEBUGFS_STATE_SHOW_IN_PROGRESS,
438 	QDF_DPT_DEBUGFS_STATE_SHOW_COMPLETE,
439 };
440 
441 /* Function declarations and documenation */
442 
443 /**
444  * qdf_trace_set_level() - Set the trace level for a particular module
445  * @level : trace level
446  *
447  * Trace level is a member of the QDF_TRACE_LEVEL enumeration indicating
448  * the severity of the condition causing the trace message to be issued.
449  * More severe conditions are more likely to be logged.
450  *
451  * This is an external API that allows trace levels to be set for each module.
452  *
453  * Return:  nothing
454  */
455 void qdf_trace_set_level(QDF_MODULE_ID module, QDF_TRACE_LEVEL level);
456 
457 /**
458  * qdf_trace_get_level() - get the trace level
459  * @level : trace level
460  *
461  * This is an external API that returns a bool value to signify if a
462  * particular trace level is set for the specified module.
463  * A member of the QDF_TRACE_LEVEL enumeration indicating the severity
464  * of the condition causing the trace message to be issued.
465  *
466  * Note that individual trace levels are the only valid values
467  * for this API.  QDF_TRACE_LEVEL_NONE and QDF_TRACE_LEVEL_ALL
468  * are not valid input and will return false
469  *
470  * Return:
471  *  false - the specified trace level for the specified module is OFF
472  *  true - the specified trace level for the specified module is ON
473  */
474 bool qdf_trace_get_level(QDF_MODULE_ID module, QDF_TRACE_LEVEL level);
475 
476 typedef void (*tp_qdf_trace_cb)(void *p_mac, tp_qdf_trace_record, uint16_t);
477 typedef void (*tp_qdf_state_info_cb) (char **buf, uint16_t *size);
478 #ifdef WLAN_FEATURE_MEMDUMP_ENABLE
479 void qdf_register_debugcb_init(void);
480 void qdf_register_debug_callback(QDF_MODULE_ID module_id,
481 					tp_qdf_state_info_cb qdf_state_infocb);
482 QDF_STATUS qdf_state_info_dump_all(char *buf, uint16_t size,
483 			uint16_t *driver_dump_size);
484 #else /* WLAN_FEATURE_MEMDUMP_ENABLE */
485 static inline void qdf_register_debugcb_init(void)
486 {
487 }
488 #endif /* WLAN_FEATURE_MEMDUMP_ENABLE */
489 
490 #ifdef TRACE_RECORD
491 void qdf_trace_register(QDF_MODULE_ID, tp_qdf_trace_cb);
492 void qdf_trace_init(void);
493 void qdf_trace(uint8_t module, uint8_t code, uint16_t session, uint32_t data);
494 void qdf_trace_enable(uint32_t, uint8_t enable);
495 void qdf_trace_dump_all(void *, uint8_t, uint8_t, uint32_t, uint32_t);
496 QDF_STATUS qdf_trace_spin_lock_init(void);
497 #else
498 #ifdef CONFIG_MCL
499 static inline
500 void qdf_trace_init(void)
501 {
502 }
503 
504 static inline
505 void qdf_trace_enable(uint32_t bitmask_of_module_id, uint8_t enable)
506 {
507 }
508 static inline
509 void qdf_trace(uint8_t module, uint8_t code, uint16_t session, uint32_t data)
510 {
511 }
512 
513 static inline
514 void qdf_trace_dump_all(void *p_mac, uint8_t code, uint8_t session,
515 			uint32_t count, uint32_t bitmask_of_module)
516 {
517 }
518 
519 static inline
520 QDF_STATUS qdf_trace_spin_lock_init(void)
521 {
522 	return QDF_STATUS_E_INVAL;
523 }
524 #endif
525 #endif
526 
527 #ifdef CONFIG_DP_TRACE
528 void qdf_dp_set_proto_bitmap(uint32_t val);
529 void qdf_dp_trace_set_verbosity(uint32_t val);
530 void qdf_dp_set_no_of_record(uint32_t val);
531 #define QDF_DP_TRACE_RECORD_INFO_LIVE (0x1)
532 #define QDF_DP_TRACE_RECORD_INFO_THROTTLED (0x1 << 1)
533 
534 bool qdf_dp_trace_log_pkt(uint8_t session_id, struct sk_buff *skb,
535 				enum qdf_proto_dir dir, uint8_t pdev_id);
536 void qdf_dp_trace_init(bool live_mode_config, uint8_t thresh,
537 				uint16_t time_limit, uint8_t verbosity,
538 				uint8_t proto_bitmap);
539 void qdf_dp_trace_spin_lock_init(void);
540 void qdf_dp_trace_set_value(uint8_t proto_bitmap, uint8_t no_of_records,
541 			 uint8_t verbosity);
542 void qdf_dp_trace_set_track(qdf_nbuf_t nbuf, enum qdf_proto_dir dir);
543 void qdf_dp_trace(qdf_nbuf_t nbuf, enum QDF_DP_TRACE_ID code, uint8_t pdev_id,
544 			uint8_t *data, uint8_t size, enum qdf_proto_dir dir);
545 void qdf_dp_trace_dump_all(uint32_t count, uint8_t pdev_id);
546 
547 /**
548  * qdf_dpt_get_curr_pos_debugfs() - get curr position to start read
549  * @file: debugfs file to read
550  * @state: state to control read to debugfs file
551  *
552  * Return: curr pos
553  */
554 uint32_t qdf_dpt_get_curr_pos_debugfs(qdf_debugfs_file_t file,
555 				enum qdf_dpt_debugfs_state state);
556 /**
557  * qdf_dpt_dump_stats_debugfs() - dump DP Trace stats to debugfs file
558  * @file: debugfs file to read
559  * @curr_pos: curr position to start read
560  *
561  * Return: QDF_STATUS
562  */
563 QDF_STATUS qdf_dpt_dump_stats_debugfs(qdf_debugfs_file_t file,
564 				      uint32_t curr_pos);
565 
566 /**
567  * qdf_dpt_set_value_debugfs() - dump DP Trace stats to debugfs file
568  * @file: debugfs file to read
569  * @curr_pos: curr position to start read
570  *
571  * Return: none
572  */
573 void qdf_dpt_set_value_debugfs(uint8_t proto_bitmap, uint8_t no_of_record,
574 			    uint8_t verbosity);
575 
576 
577 /**
578  * qdf_dp_trace_dump_stats() - dump DP Trace stats
579  *
580  * Return: none
581  */
582 void qdf_dp_trace_dump_stats(void);
583 typedef void (*tp_qdf_dp_trace_cb)(struct qdf_dp_trace_record_s*,
584 				   uint16_t, uint8_t, uint8_t info);
585 /**
586  * qdf_dp_display_record() - Displays a record in DP trace
587  * @record: pointer to a record in DP trace
588  * @index: record index
589  * @pdev_id: pdev id for the mgmt pkt
590  * @info: info used to display pkt (live mode, throttling)
591  *
592  * Return: None
593  */
594 void qdf_dp_display_record(struct qdf_dp_trace_record_s *record,
595 			   uint16_t index, uint8_t pdev_id,
596 			   uint8_t info);
597 
598 /**
599  * qdf_dp_display_ptr_record() - display record
600  * @record: dptrace record
601  * @rec_index: index
602  * @pdev_id: pdev id for the mgmt pkt
603  * @info: info used to display pkt (live mode, throttling)
604  *
605  * Return: none
606  */
607 void qdf_dp_display_ptr_record(struct qdf_dp_trace_record_s *record,
608 			       uint16_t rec_index, uint8_t pdev_id,
609 			       uint8_t info);
610 
611 /**
612  * qdf_dp_display_proto_pkt() - display proto packet
613  * @record: dptrace record
614  * @index: index
615  * @pdev_id: pdev id for the mgmt pkt
616  * @info: info used to display pkt (live mode, throttling)
617  *
618  * Return: none
619  */
620 void qdf_dp_display_proto_pkt(struct qdf_dp_trace_record_s *record,
621 			      uint16_t index, uint8_t pdev_id,
622 			      uint8_t info);
623 /**
624  * qdf_dp_display_data_pkt_record() - Displays a data packet in DP trace
625  * @record: pointer to a record in DP trace
626  * @rec_index: record index
627  * @pdev_id: pdev id
628  * @info: display info regarding record
629  *
630  * Return: None
631  */
632 void
633 qdf_dp_display_data_pkt_record(struct qdf_dp_trace_record_s *record,
634 			       uint16_t rec_index, uint8_t pdev_id,
635 			       uint8_t info);
636 
637 void qdf_dp_trace_ptr(qdf_nbuf_t nbuf, enum QDF_DP_TRACE_ID code,
638 		      uint8_t pdev_id, uint8_t *data, uint8_t size,
639 		      uint16_t msdu_id, uint16_t status);
640 void qdf_dp_trace_throttle_live_mode(bool high_bw_request);
641 
642 /**
643  * qdf_dp_trace_data_pkt() - trace data packet
644  * @nbuf: nbuf which needs to be traced
645  * @pdev_id: pdev_id
646  * @code: QDF_DP_TRACE_ID for the packet (TX or RX)
647  * @msdu_id: tx desc id for the nbuf (Only applies to TX packets)
648  * @dir: TX or RX packet direction
649  *
650  * Return: None
651  */
652 void qdf_dp_trace_data_pkt(qdf_nbuf_t nbuf, uint8_t pdev_id,
653 			   enum QDF_DP_TRACE_ID code, uint16_t msdu_id,
654 			   enum qdf_proto_dir dir);
655 
656 uint8_t qdf_dp_get_proto_bitmap(void);
657 uint8_t qdf_dp_get_verbosity(void);
658 uint8_t qdf_dp_get_no_of_record(void);
659 
660 /**
661  * qdf_dp_trace_proto_pkt() - record proto packet
662  * @code: dptrace code
663  * @vdev_id: vdev id
664  * @sa: source mac address
665  * @da: destination mac address
666  * @type: proto type
667  * @subtype: proto subtype
668  * @dir: direction
669  * @pdev_id: pdev id
670  * @print: to print this proto pkt or not
671  *
672  * Return: none
673  */
674 void
675 qdf_dp_trace_proto_pkt(enum QDF_DP_TRACE_ID code, uint8_t vdev_id,
676 	uint8_t *sa, uint8_t *da, enum qdf_proto_type type,
677 	enum qdf_proto_subtype subtype, enum qdf_proto_dir dir,
678 	uint8_t pdev_id, bool print);
679 
680 void qdf_dp_trace_disable_live_mode(void);
681 void qdf_dp_trace_enable_live_mode(void);
682 void qdf_dp_trace_clear_buffer(void);
683 /**
684  * qdf_dp_trace_mgmt_pkt() - record mgmt packet
685  * @code: dptrace code
686  * @vdev_id: vdev id
687  * @pdev_id: pdev_id
688  * @type: proto type
689  * @subtype: proto subtype
690  *
691  * Return: none
692  */
693 void qdf_dp_trace_mgmt_pkt(enum QDF_DP_TRACE_ID code, uint8_t vdev_id,
694 			   uint8_t pdev_id, enum qdf_proto_type type,
695 			   enum qdf_proto_subtype subtype);
696 
697 /**
698  * qdf_dp_display_mgmt_pkt() - display proto packet
699  * @record: dptrace record
700  * @index: index
701  * @pdev_id: pdev id for the mgmt pkt
702  * @info: info used to display pkt (live mode, throttling)
703  *
704  * Return: none
705  */
706 void qdf_dp_display_mgmt_pkt(struct qdf_dp_trace_record_s *record,
707 			     uint16_t index, uint8_t pdev_id, uint8_t info);
708 
709 /**
710  * qdf_dp_display_event_record() - display event records
711  * @record: dptrace record
712  * @index: index
713  * @pdev_id: pdev id for the mgmt pkt
714  * @info: info used to display pkt (live mode, throttling)
715  *
716  * Return: none
717  */
718 void qdf_dp_display_event_record(struct qdf_dp_trace_record_s *record,
719 				 uint16_t index, uint8_t pdev_id, uint8_t info);
720 
721 void qdf_dp_trace_record_event(enum QDF_DP_TRACE_ID code, uint8_t vdev_id,
722 			       uint8_t pdev_id, enum qdf_proto_type type,
723 			       enum qdf_proto_subtype subtype);
724 #else
725 static inline
726 bool qdf_dp_trace_log_pkt(uint8_t session_id, struct sk_buff *skb,
727 				enum qdf_proto_dir dir, uint8_t pdev_id)
728 {
729 	return false;
730 }
731 static inline
732 void qdf_dp_trace_init(bool live_mode_config, uint8_t thresh,
733 				uint16_t time_limit, uint8_t verbosity,
734 				uint8_t proto_bitmap)
735 {
736 }
737 static inline
738 void qdf_dp_trace_set_track(qdf_nbuf_t nbuf, enum qdf_proto_dir dir)
739 {
740 }
741 static inline
742 void qdf_dp_trace_set_value(uint8_t proto_bitmap, uint8_t no_of_records,
743 			 uint8_t verbosity)
744 {
745 }
746 
747 static inline
748 void qdf_dp_trace_dump_all(uint32_t count, uint8_t pdev_id)
749 {
750 }
751 
752 static inline
753 uint32_t qdf_dpt_get_curr_pos_debugfs(qdf_debugfs_file_t file,
754 				      enum qdf_dpt_debugfs_state state)
755 {
756 }
757 
758 static inline
759 QDF_STATUS qdf_dpt_dump_stats_debugfs(qdf_debugfs_file_t file,
760 				      uint32_t curr_pos)
761 {
762 }
763 
764 static inline
765 void qdf_dpt_set_value_debugfs(uint8_t proto_bitmap, uint8_t no_of_record,
766 			    uint8_t verbosity)
767 {
768 }
769 
770 static inline void qdf_dp_trace_dump_stats(void)
771 {
772 }
773 
774 static inline
775 void qdf_dp_trace_disable_live_mode(void)
776 {
777 }
778 
779 static inline
780 void qdf_dp_trace_enable_live_mode(void)
781 {
782 }
783 
784 static inline
785 void qdf_dp_trace_throttle_live_mode(bool high_bw_request)
786 {
787 }
788 
789 static inline
790 void qdf_dp_trace_clear_buffer(void)
791 {
792 }
793 
794 void qdf_dp_trace_data_pkt(qdf_nbuf_t nbuf, uint8_t pdev_id,
795 			   enum QDF_DP_TRACE_ID code, uint16_t msdu_id,
796 			   enum qdf_proto_dir dir)
797 {
798 }
799 #endif
800 
801 void qdf_trace_display(void);
802 
803 void qdf_trace_set_value(QDF_MODULE_ID module, QDF_TRACE_LEVEL level,
804 			 uint8_t on);
805 
806 void qdf_trace_set_module_trace_level(QDF_MODULE_ID module, uint32_t level);
807 
808 void __printf(3, 4) qdf_snprintf(char *str_buffer, unsigned int size,
809 		  char *str_format, ...);
810 
811 #define QDF_SNPRINTF qdf_snprintf
812 
813 #ifdef TSOSEG_DEBUG
814 
815 static inline void qdf_tso_seg_dbg_bug(char *msg)
816 {
817 	qdf_print("%s", msg);
818 	QDF_BUG(0);
819 };
820 
821 /**
822  * qdf_tso_seg_dbg_init - initialize TSO segment debug structure
823  * @tsoseg : structure to initialize
824  *
825  * TSO segment dbg structures are attached to qdf_tso_seg_elem_t
826  * structures and are allocated only of TSOSEG_DEBUG is defined.
827  * When allocated, at the time of the tso_seg_pool initialization,
828  * which goes with tx_desc initialization (1:1), each structure holds
829  * a number of (currently 16) history entries, basically describing
830  * what operation has been performed on this particular tso_seg_elem.
831  * This history buffer is a circular buffer and the current index is
832  * held in an atomic variable called cur. It is incremented every
833  * operation. Each of these operations are added with the function
834  * qdf_tso_seg_dbg_record.
835  * For each segment, this initialization function MUST be called PRIOR
836  * TO any _dbg_record() function calls.
837  * On free, qdf_tso_seg_elem structure is cleared (using qdf_tso_seg_dbg_zero)
838  * which clears the tso_desc, BUT DOES NOT CLEAR THE HISTORY element.
839  *
840  * Return:
841  *   None
842  */
843 static inline
844 void qdf_tso_seg_dbg_init(struct qdf_tso_seg_elem_t *tsoseg)
845 {
846 	tsoseg->dbg.txdesc = NULL;
847 	qdf_atomic_init(&tsoseg->dbg.cur); /* history empty */
848 }
849 
850 /**
851  * qdf_tso_seg_dbg_record - add a history entry to TSO debug structure
852  * @tsoseg : structure to initialize
853  * @id     : operation ID (identifies the caller)
854  *
855  * Adds a history entry to the history circular buffer. Each entry
856  * contains an operation id (caller, as currently each ID is used only
857  * once in the source, so it directly identifies the src line that invoked
858  * the recording.
859  *
860  * qdf_tso_seg_dbg_record CAN ONLY BE CALLED AFTER the entry is initialized
861  * by qdf_tso_seg_dbg_init.
862  *
863  * The entry to be added is written at the location pointed by the atomic
864  * variable called cur. Cur is an ever increasing atomic variable. It is
865  * masked so that only the lower 4 bits are used (16 history entries).
866  *
867  * Return:
868  *   int: the entry this record was recorded at
869  */
870 static inline
871 int qdf_tso_seg_dbg_record(struct qdf_tso_seg_elem_t *tsoseg, short id)
872 {
873 	int rc = -1;
874 	unsigned int c;
875 
876 	qdf_assert(tsoseg);
877 
878 	if (id == TSOSEG_LOC_ALLOC) {
879 		c = qdf_atomic_read(&tsoseg->dbg.cur);
880 		/* dont crash on the very first alloc on the segment */
881 		c &= 0x0f;
882 		/* allow only INIT and FREE ops before ALLOC */
883 		if (tsoseg->dbg.h[c].id >= id)
884 			qdf_tso_seg_dbg_bug("Rogue TSO seg alloc");
885 	}
886 	c = qdf_atomic_inc_return(&tsoseg->dbg.cur);
887 
888 	c &= 0x0f;
889 	tsoseg->dbg.h[c].ts = qdf_get_log_timestamp();
890 	tsoseg->dbg.h[c].id = id;
891 	rc = c;
892 
893 	return rc;
894 };
895 
896 static inline void
897 qdf_tso_seg_dbg_setowner(struct qdf_tso_seg_elem_t *tsoseg, void *owner)
898 {
899 	if (tsoseg)
900 		tsoseg->dbg.txdesc = owner;
901 };
902 
903 static inline void
904 qdf_tso_seg_dbg_zero(struct qdf_tso_seg_elem_t *tsoseg)
905 {
906 	memset(tsoseg, 0, offsetof(struct qdf_tso_seg_elem_t, dbg));
907 	return;
908 };
909 
910 #else
911 static inline
912 void qdf_tso_seg_dbg_init(struct qdf_tso_seg_elem_t *tsoseg)
913 {
914 };
915 static inline
916 int qdf_tso_seg_dbg_record(struct qdf_tso_seg_elem_t *tsoseg, short id)
917 {
918 	return 0;
919 };
920 static inline void qdf_tso_seg_dbg_bug(char *msg)
921 {
922 };
923 static inline void
924 qdf_tso_seg_dbg_setowner(struct qdf_tso_seg_elem_t *tsoseg, void *owner)
925 {
926 };
927 static inline int
928 qdf_tso_seg_dbg_zero(struct qdf_tso_seg_elem_t *tsoseg)
929 {
930 	memset(tsoseg, 0, sizeof(struct qdf_tso_seg_elem_t));
931 	return 0;
932 };
933 
934 #endif /* TSOSEG_DEBUG */
935 
936 void qdf_trace_hex_dump(QDF_MODULE_ID module, QDF_TRACE_LEVEL level,
937 			void *data, int buf_len);
938 
939 #define ERROR_CODE                      -1
940 #define QDF_MAX_NAME_SIZE               32
941 #define MAX_PRINT_CONFIG_SUPPORTED      32
942 
943 #define MAX_SUPPORTED_CATEGORY QDF_MODULE_ID_MAX
944 
945 /**
946  * qdf_set_pidx() - Sets the global qdf_pidx.
947  * @pidx : Index of print control object assigned to the module
948  *
949  */
950 void qdf_set_pidx(int pidx);
951 
952 /**
953  * qdf_get_pidx() - Returns the global qdf_pidx.
954  *
955  * Return : Current qdf print index.
956  */
957 int qdf_get_pidx(void);
958 /*
959  * Shared print control index
960  * for converged debug framework
961  */
962 
963 #define QDF_PRINT_IDX_SHARED -1
964 
965 /**
966  * QDF_PRINT_INFO() - Generic wrapper API for logging
967  * @idx : Index of print control object
968  * @module : Module identifier. A member of QDF_MODULE_ID enumeration that
969  *           identifies the module issuing the trace message
970  * @level : Trace level. A member of QDF_TRACE_LEVEL enumeration indicating
971  *          the severity of the condition causing the trace message to be
972  *          issued.
973  * @str_format : Format string that contains the message to be logged.
974  *
975  *
976  * This wrapper will be used for any generic logging messages. Wrapper will
977  * compile a call to converged QDF trace message API.
978  *
979  * Return : Nothing
980  *
981  */
982 void QDF_PRINT_INFO(unsigned int idx, QDF_MODULE_ID module,
983 		    QDF_TRACE_LEVEL level,
984 		    char *str_format, ...);
985 
986 /**
987  * struct category_info  : Category information structure
988  * @category_verbose_mask: Embeds information about category's verbose level
989  */
990 struct category_info {
991 	uint16_t category_verbose_mask;
992 };
993 
994 /**
995  * struct category_name_info  : Category name information structure
996  * @category_name_str: Embeds information about category name
997  */
998 struct category_name_info {
999 	unsigned char category_name_str[QDF_MAX_NAME_SIZE];
1000 };
1001 
1002 /**
1003  * qdf_trace_msg_cmn()- Converged logging API
1004  * @idx: Index of print control object assigned to the module
1005  * @category: Category identifier. A member of the QDF_MODULE_ID enumeration
1006  *            that identifies the category issuing the trace message.
1007  * @verbose: Verbose level. A member of the QDF_TRACE_LEVEL enumeration
1008  *           indicating the severity of the condition causing the trace
1009  *           message to be issued. More severe conditions are more likely
1010  *           to be logged.
1011  * @str_format: Format string. The message to be logged. This format string
1012  *              contains printf-like replacement parameters, which follow this
1013  *              parameter in the variable argument list.
1014  * @val: Variable argument list part of the log message
1015  *
1016  * Return: nothing
1017  *
1018  */
1019 void qdf_trace_msg_cmn(unsigned int idx,
1020 			QDF_MODULE_ID category,
1021 			QDF_TRACE_LEVEL verbose,
1022 			const char *str_format,
1023 			va_list val);
1024 
1025 /**
1026  * struct qdf_print_ctrl: QDF Print Control structure
1027  *                        Statically allocated objects of print control
1028  *                        structure are declared that will support maximum of
1029  *                        32 print control objects. Any module that needs to
1030  *                        register to the print control framework needs to
1031  *                        obtain a print control object using
1032  *                        qdf_print_ctrl_register API. It will have to pass
1033  *                        pointer to category info structure, name and
1034  *                        custom print function to be used if required.
1035  * @name                : Optional name for the control object
1036  * @cat_info            : Array of category_info struct
1037  * @custom_print        : Custom print handler
1038  * @custom_ctxt         : Custom print context
1039  * @dbglvlmac_on        : Flag to enable/disable MAC level filtering
1040  * @in_use              : Boolean to indicate if control object is in use
1041  */
1042 struct qdf_print_ctrl {
1043 	char name[QDF_MAX_NAME_SIZE];
1044 	struct category_info cat_info[MAX_SUPPORTED_CATEGORY];
1045 	void (*custom_print)(void *ctxt, const char *fmt, va_list args);
1046 	void *custom_ctxt;
1047 #ifdef DBG_LVL_MAC_FILTERING
1048 	unsigned char dbglvlmac_on;
1049 #endif
1050 	bool in_use;
1051 };
1052 
1053 /**
1054  * qdf_print_ctrl_register() - Allocate QDF print control object, assign
1055  *                             pointer to category info or print control
1056  *                             structure and return the index to the callee
1057  * @cinfo                 : Pointer to array of category info structure
1058  * @custom_print_handler  : Pointer to custom print handler
1059  * @custom_ctx            : Pointer to custom context
1060  * @pctrl_name            : Pointer to print control object name
1061  *
1062  * Return                 : Index of qdf_print_ctrl structure
1063  *
1064  */
1065 int qdf_print_ctrl_register(const struct category_info *cinfo,
1066 			    void *custom_print_handler,
1067 			    void *custom_ctx,
1068 			    const char *pctrl_name);
1069 
1070 /**
1071  * qdf_shared_print_ctrl_init() - Initialize the shared print ctrl obj with
1072  *                                all categories set to the default level
1073  *
1074  * Return                 : void
1075  *
1076  */
1077 void qdf_shared_print_ctrl_init(void);
1078 
1079 /**
1080  * qdf_print_setup() - Setup default values to all the print control objects
1081  *
1082  * Register new print control object for the callee
1083  *
1084  * Return :             QDF_STATUS_SUCCESS on success and QDF_STATUS_E_FAILURE
1085  *                      on failure
1086  */
1087 QDF_STATUS qdf_print_setup(void);
1088 
1089 /**
1090  * qdf_print_ctrl_cleanup() - Clean up a print control object
1091  *
1092  * Cleanup the print control object for the callee
1093  *
1094  * @pctrl : Index of print control object
1095  *
1096  * Return : QDF_STATUS_SUCCESS on success and QDF_STATUS_E_FAILURE on failure
1097  */
1098 QDF_STATUS qdf_print_ctrl_cleanup(unsigned int idx);
1099 
1100 /**
1101  * qdf_print_ctrl_shared_cleanup() - Clean up of the shared object
1102  *
1103  * Cleanup the shared print-ctrl-object
1104  *
1105  * Return : void
1106  */
1107 void qdf_shared_print_ctrl_cleanup(void);
1108 
1109 /**
1110  * qdf_print_set_category_verbose() - Enable/Disable category for a
1111  *                                    print control object with
1112  *                                    user provided verbose level
1113  *
1114  * @idx : Index of the print control object assigned to callee
1115  * @category : Category information
1116  * @verbose: Verbose information
1117  * @is_set: Flag indicating if verbose level needs to be enabled or disabled
1118  *
1119  * Return : QDF_STATUS_SUCCESS for success and QDF_STATUS_E_FAILURE for failure
1120  */
1121 QDF_STATUS qdf_print_set_category_verbose(unsigned int idx,
1122 					  QDF_MODULE_ID category,
1123 					  QDF_TRACE_LEVEL verbose,
1124 					  bool is_set);
1125 
1126 /**
1127  * qdf_print_is_category_enabled() - Get category information for the
1128  *                                   print control object
1129  *
1130  * @idx : Index of print control object
1131  * @category : Category information
1132  *
1133  * Return : Verbose enabled(true) or disabled(false) or invalid input (false)
1134  */
1135 bool qdf_print_is_category_enabled(unsigned int idx,
1136 				   QDF_MODULE_ID category);
1137 
1138 /**
1139  * qdf_print_is_verbose_enabled() - Get verbose information of a category for
1140  *                                  the print control object
1141  *
1142  * @idx : Index of print control object
1143  * @category : Category information
1144  * @verbose : Verbose information
1145  *
1146  * Return : Verbose enabled(true) or disabled(false) or invalid input (false)
1147  */
1148 bool qdf_print_is_verbose_enabled(unsigned int idx,
1149 				  QDF_MODULE_ID category,
1150 				  QDF_TRACE_LEVEL verbose);
1151 
1152 /**
1153  * qdf_print_clean_node_flag() - Clean up node flag for print control object
1154  *
1155  * @idx : Index of print control object
1156  *
1157  * Return : None
1158  */
1159 void qdf_print_clean_node_flag(unsigned int idx);
1160 
1161 #ifdef DBG_LVL_MAC_FILTERING
1162 
1163 /**
1164  * qdf_print_set_node_flag() - Set flag to enable MAC level filtering
1165  *
1166  * @idx : Index of print control object
1167  * @enable : Enable/Disable bit sent by callee
1168  *
1169  * Return : QDF_STATUS_SUCCESS on Success and QDF_STATUS_E_FAILURE on Failure
1170  */
1171 QDF_STATUS qdf_print_set_node_flag(unsigned int idx,
1172 				   uint8_t enable);
1173 
1174 /**
1175  * qdf_print_get_node_flag() - Get flag that controls MAC level filtering
1176  *
1177  * @idx : Index of print control object
1178  *
1179  * Return : Flag that indicates enable(1) or disable(0) or invalid(-1)
1180  */
1181 bool qdf_print_get_node_flag(unsigned int idx);
1182 
1183 #endif
1184 
1185 /**
1186  * qdf_logging_init() - Initialize msg logging functionality
1187  *
1188  *
1189  * Return : void
1190  */
1191 void qdf_logging_init(void);
1192 
1193 /**
1194  * qdf_logging_exit() - Cleanup msg logging functionality
1195  *
1196  *
1197  * Return : void
1198  */
1199 void qdf_logging_exit(void);
1200 
1201 #define QDF_SYMBOL_LEN __QDF_SYMBOL_LEN
1202 
1203 /**
1204  * qdf_sprint_symbol() - prints the name of a symbol into a string buffer
1205  * @buffer: the string buffer to print into
1206  * @addr: address of the symbol to lookup and print
1207  *
1208  * Return: number of characters printed
1209  */
1210 int qdf_sprint_symbol(char *buffer, void *addr);
1211 
1212 #endif /* __QDF_TRACE_H */
1213