xref: /wlan-dirver/qca-wifi-host-cmn/qdf/inc/qdf_trace.h (revision 99a10d078d8c08bacd095650c5bfcdcef8f8bf20)
1 /*
2  * Copyright (c) 2014-2017 The Linux Foundation. All rights reserved.
3  *
4  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
5  *
6  *
7  * Permission to use, copy, modify, and/or distribute this software for
8  * any purpose with or without fee is hereby granted, provided that the
9  * above copyright notice and this permission notice appear in all
10  * copies.
11  *
12  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
13  * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
14  * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
15  * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
16  * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
17  * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
18  * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
19  * PERFORMANCE OF THIS SOFTWARE.
20  */
21 
22 /*
23  * This file was originally distributed by Qualcomm Atheros, Inc.
24  * under proprietary terms before Copyright ownership was assigned
25  * to the Linux Foundation.
26  */
27 
28 #if !defined(__QDF_TRACE_H)
29 #define __QDF_TRACE_H
30 
31 /**
32  *  DOC: qdf_trace
33  *  QCA driver framework trace APIs
34  *  Trace, logging, and debugging definitions and APIs
35  */
36 
37 /* Include Files */
38 #include  <qdf_types.h>         /* For QDF_MODULE_ID... */
39 #include  <stdarg.h>            /* For va_list... */
40 #include  <qdf_status.h>
41 #include  <qdf_nbuf.h>
42 #include  <i_qdf_types.h>
43 
44 /* Type declarations */
45 
46 #define FL(x)    "%s: %d: " x, __func__, __LINE__
47 #define QDF_TRACE_BUFFER_SIZE (512)
48 
49 #ifdef CONFIG_MCL
50 #define QDF_DEFAULT_TRACE_LEVEL \
51 	((1 << QDF_TRACE_LEVEL_FATAL) | (1 << QDF_TRACE_LEVEL_ERROR))
52 #else
53 #define QDF_DEFAULT_TRACE_LEVEL (1 << QDF_TRACE_LEVEL_INFO)
54 #endif
55 
56 /*
57  * Log levels
58  */
59 #define QDF_DEBUG_FUNCTRACE     0x01
60 #define QDF_DEBUG_LEVEL0        0x02
61 #define QDF_DEBUG_LEVEL1        0x04
62 #define QDF_DEBUG_LEVEL2        0x08
63 #define QDF_DEBUG_LEVEL3        0x10
64 #define QDF_DEBUG_ERROR         0x20
65 #define QDF_DEBUG_CFG           0x40
66 
67 #ifdef CONFIG_MCL
68 /**
69  * qdf_set_pidx() - Sets the global qdf_pidx.
70  * @pidx : Index of print control object assigned to the module
71  *
72  */
73 void qdf_set_pidx(int pidx);
74 
75 /**
76  * qdf_get_pidx() - Returns the global qdf_pidx.
77  *
78  * Return : Current qdf print index.
79  */
80 int qdf_get_pidx(void);
81 
82 /* By default Data Path module will have all log levels enabled, except debug
83  * log level. Debug level will be left up to the framework or user space modules
84  * to be enabled when issue is detected
85  */
86 #define QDF_DATA_PATH_TRACE_LEVEL \
87 	((1 << QDF_TRACE_LEVEL_FATAL) | (1 << QDF_TRACE_LEVEL_ERROR) | \
88 	(1 << QDF_TRACE_LEVEL_WARN) | (1 << QDF_TRACE_LEVEL_INFO) | \
89 	(1 << QDF_TRACE_LEVEL_INFO_HIGH) | (1 << QDF_TRACE_LEVEL_INFO_MED) | \
90 	(1 << QDF_TRACE_LEVEL_INFO_LOW))
91 
92 /* Preprocessor definitions and constants */
93 #define ASSERT_BUFFER_SIZE (512)
94 
95 #define MAX_QDF_TRACE_RECORDS 4000
96 #define INVALID_QDF_TRACE_ADDR 0xffffffff
97 #define DEFAULT_QDF_TRACE_DUMP_COUNT 0
98 
99 #define DUMP_DP_TRACE       0
100 #define ENABLE_DP_TRACE_LIVE_MODE	1
101 #define CLEAR_DP_TRACE_BUFFER	2
102 
103 #ifdef TRACE_RECORD
104 
105 #define MTRACE(p) p
106 #define NO_SESSION 0xFF
107 
108 #else
109 #define MTRACE(p) {  }
110 
111 #endif
112 
113 /**
114  * typedef struct qdf_trace_record_s - keep trace record
115  * @qtime: qtimer ticks
116  * @time: user timestamp
117  * @module: module name
118  * @code: hold record of code
119  * @session: hold record of session
120  * @data: hold data
121  * @pid: hold pid of the process
122  */
123 typedef struct qdf_trace_record_s {
124 	uint64_t qtime;
125 	char time[18];
126 	uint8_t module;
127 	uint8_t code;
128 	uint16_t session;
129 	uint32_t data;
130 	uint32_t pid;
131 } qdf_trace_record_t, *tp_qdf_trace_record;
132 
133 /**
134  * typedef struct s_qdf_trace_data - MTRACE logs are stored in ring buffer
135  * @head: position of first record
136  * @tail: position of last record
137  * @num: count of total record
138  * @num_since_last_dump: count from last dump
139  * @enable: config for controlling the trace
140  * @dump_count: Dump after number of records reach this number
141  */
142 typedef struct s_qdf_trace_data {
143 	uint32_t head;
144 	uint32_t tail;
145 	uint32_t num;
146 	uint16_t num_since_last_dump;
147 	uint8_t enable;
148 	uint16_t dump_count;
149 } t_qdf_trace_data;
150 
151 #define CASE_RETURN_STRING(str) case ((str)): return (uint8_t *)(# str);
152 
153 /* DP Trace Implementation */
154 #ifdef FEATURE_DP_TRACE
155 #define DPTRACE(p) p
156 #else
157 #define DPTRACE(p)
158 #endif
159 
160 #define MAX_QDF_DP_TRACE_RECORDS       4000
161 #define QDF_DP_TRACE_RECORD_SIZE       16
162 #define INVALID_QDF_DP_TRACE_ADDR      0xffffffff
163 #define QDF_DP_TRACE_VERBOSITY_HIGH    3
164 #define QDF_DP_TRACE_VERBOSITY_MEDIUM  2
165 #define QDF_DP_TRACE_VERBOSITY_LOW     1
166 #define QDF_DP_TRACE_VERBOSITY_DEFAULT 0
167 
168 /**
169  * enum QDF_DP_TRACE_ID - Generic ID to identify various events in data path
170  * @QDF_DP_TRACE_INVALID - invalid
171  * @QDF_DP_TRACE_DROP_PACKET_RECORD - record drop packet
172  * @QDF_DP_TRACE_EAPOL_PACKET_RECORD - record EAPOL packet
173  * @QDF_DP_TRACE_DHCP_PACKET_RECORD - record DHCP packet
174  * @QDF_DP_TRACE_ARP_PACKET_RECORD - record ARP packet
175  * @QDF_DP_TRACE_MGMT_PACKET_RECORD - record MGMT pacekt
176  * QDF_DP_TRACE_EVENT_RECORD - record events
177  * @QDF_DP_TRACE_DEFAULT_VERBOSITY - below this are part of default verbosity
178  * @QDF_DP_TRACE_HDD_TX_TIMEOUT - HDD tx timeout
179  * @QDF_DP_TRACE_HDD_SOFTAP_TX_TIMEOUT- SOFTAP HDD tx timeout
180  * @QDF_DP_TRACE_HDD_TX_PACKET_PTR_RECORD - HDD layer ptr record
181  * @QDF_DP_TRACE_CE_PACKET_PTR_RECORD - CE layer ptr record
182  * @QDF_DP_TRACE_CE_FAST_PACKET_PTR_RECORD- CE fastpath ptr record
183  * @QDF_DP_TRACE_FREE_PACKET_PTR_RECORD - tx completion ptr record
184  * @QDF_DP_TRACE_RX_HTT_PACKET_PTR_RECORD - HTT RX record
185  * @QDF_DP_TRACE_RX_OFFLOAD_HTT_PACKET_PTR_RECORD- HTT RX offload record
186  * @QDF_DP_TRACE_RX_HDD_PACKET_PTR_RECORD - HDD RX record
187  * @QDF_DP_TRACE_LOW_VERBOSITY - below this are part of low verbosity
188  * @QDF_DP_TRACE_TXRX_QUEUE_PACKET_PTR_RECORD -tx queue ptr record
189  * @QDF_DP_TRACE_TXRX_PACKET_PTR_RECORD - txrx packet ptr record
190  * @QDF_DP_TRACE_TXRX_FAST_PACKET_PTR_RECORD - txrx fast path record
191  * @QDF_DP_TRACE_HTT_PACKET_PTR_RECORD - htt packet ptr record
192  * @QDF_DP_TRACE_HTC_PACKET_PTR_RECORD - htc packet ptr record
193  * @QDF_DP_TRACE_HIF_PACKET_PTR_RECORD - hif packet ptr record
194  * @QDF_DP_TRACE_RX_TXRX_PACKET_PTR_RECORD - txrx packet ptr record
195  * @QDF_DP_TRACE_MED_VERBOSITY - below this are part of med verbosity
196  * @QDF_DP_TRACE_HDD_TX_PACKET_RECORD - record 32 bytes of tx pkt at HDD
197  * @QDF_DP_TRACE_HDD_RX_PACKET_RECORD - record 32 bytes of rx pkt at HDD
198  * @QDF_DP_TRACE_HIGH_VERBOSITY - below this are part of high verbosity
199  */
200 enum  QDF_DP_TRACE_ID {
201 	QDF_DP_TRACE_INVALID,
202 	QDF_DP_TRACE_DROP_PACKET_RECORD,
203 	QDF_DP_TRACE_EAPOL_PACKET_RECORD,
204 	QDF_DP_TRACE_DHCP_PACKET_RECORD,
205 	QDF_DP_TRACE_ARP_PACKET_RECORD,
206 	QDF_DP_TRACE_MGMT_PACKET_RECORD,
207 	QDF_DP_TRACE_EVENT_RECORD,
208 	QDF_DP_TRACE_DEFAULT_VERBOSITY,
209 	QDF_DP_TRACE_HDD_TX_TIMEOUT,
210 	QDF_DP_TRACE_HDD_SOFTAP_TX_TIMEOUT,
211 	QDF_DP_TRACE_HDD_TX_PACKET_PTR_RECORD,
212 	QDF_DP_TRACE_CE_PACKET_PTR_RECORD,
213 	QDF_DP_TRACE_CE_FAST_PACKET_PTR_RECORD,
214 	QDF_DP_TRACE_FREE_PACKET_PTR_RECORD,
215 	QDF_DP_TRACE_RX_HTT_PACKET_PTR_RECORD,
216 	QDF_DP_TRACE_RX_OFFLOAD_HTT_PACKET_PTR_RECORD,
217 	QDF_DP_TRACE_RX_HDD_PACKET_PTR_RECORD,
218 	QDF_DP_TRACE_LOW_VERBOSITY,
219 	QDF_DP_TRACE_TXRX_QUEUE_PACKET_PTR_RECORD,
220 	QDF_DP_TRACE_TXRX_PACKET_PTR_RECORD,
221 	QDF_DP_TRACE_TXRX_FAST_PACKET_PTR_RECORD,
222 	QDF_DP_TRACE_HTT_PACKET_PTR_RECORD,
223 	QDF_DP_TRACE_HTC_PACKET_PTR_RECORD,
224 	QDF_DP_TRACE_HIF_PACKET_PTR_RECORD,
225 	QDF_DP_TRACE_RX_TXRX_PACKET_PTR_RECORD,
226 	QDF_DP_TRACE_MED_VERBOSITY,
227 	QDF_DP_TRACE_HDD_TX_PACKET_RECORD,
228 	QDF_DP_TRACE_HDD_RX_PACKET_RECORD,
229 	QDF_DP_TRACE_HIGH_VERBOSITY,
230 	QDF_DP_TRACE_MAX
231 };
232 
233 /**
234  * qdf_proto_dir - direction
235  * @QDF_TX: TX direction
236  * @QDF_RX: RX direction
237  * @QDF_NA: not applicable
238  */
239 enum qdf_proto_dir {
240 	QDF_TX,
241 	QDF_RX,
242 	QDF_NA
243 };
244 
245 /**
246  * struct qdf_dp_trace_ptr_buf - pointer record buffer
247  * @cookie: cookie value
248  * @msdu_id: msdu_id
249  * @status: completion status
250  */
251 struct qdf_dp_trace_ptr_buf {
252 	uint64_t cookie;
253 	uint16_t msdu_id;
254 	uint16_t status;
255 };
256 
257 /**
258  * struct qdf_dp_trace_proto_buf - proto packet buffer
259  * @sa: source address
260  * @da: destination address
261  * @vdev_id : vdev id
262  * @type: packet type
263  * @subtype: packet subtype
264  * @dir: direction
265  */
266 struct qdf_dp_trace_proto_buf {
267 	struct qdf_mac_addr sa;
268 	struct qdf_mac_addr da;
269 	uint8_t vdev_id;
270 	uint8_t type;
271 	uint8_t subtype;
272 	uint8_t dir;
273 };
274 
275 /**
276  * struct qdf_dp_trace_mgmt_buf - mgmt packet buffer
277  * @vdev_id : vdev id
278  * @type: packet type
279  * @subtype: packet subtype
280  */
281 struct qdf_dp_trace_mgmt_buf {
282 	uint8_t vdev_id;
283 	uint8_t type;
284 	uint8_t subtype;
285 };
286 
287 /**
288  * struct qdf_dp_trace_event_buf - event buffer
289  * @vdev_id : vdev id
290  * @type: packet type
291  * @subtype: packet subtype
292  */
293 struct qdf_dp_trace_event_buf {
294 	uint8_t vdev_id;
295 	uint8_t type;
296 	uint8_t subtype;
297 };
298 
299 /**
300  * struct qdf_dp_trace_record_s - Describes a record in DP trace
301  * @time: time when it got stored
302  * @code: Describes the particular event
303  * @data: buffer to store data
304  * @size: Length of the valid data stored in this record
305  * @pid : process id which stored the data in this record
306  */
307 struct qdf_dp_trace_record_s {
308 	char time[20];
309 	uint8_t code;
310 	uint8_t data[QDF_DP_TRACE_RECORD_SIZE];
311 	uint8_t size;
312 	uint32_t pid;
313 };
314 
315 /**
316  * struct qdf_dp_trace_data - Parameters to configure/control DP trace
317  * @head: Position of first record
318  * @tail: Position of last record
319  * @num:  Current index
320  * @proto_bitmap: defines which protocol to be traced
321  * @no_of_record: defines every nth packet to be traced
322  * @verbosity : defines verbosity level
323  * @enable: enable/disable DP trace
324  * @count: current packet number
325  */
326 struct s_qdf_dp_trace_data {
327 	uint32_t head;
328 	uint32_t tail;
329 	uint32_t num;
330 	uint8_t proto_bitmap;
331 	uint8_t no_of_record;
332 	uint8_t verbosity;
333 	bool enable;
334 	uint32_t tx_count;
335 	uint32_t rx_count;
336 	bool live_mode;
337 };
338 
339 
340 /* Function declarations and documenation */
341 
342 /**
343  * qdf_trace_set_level() - Set the trace level for a particular module
344  * @level : trace level
345  *
346  * Trace level is a member of the QDF_TRACE_LEVEL enumeration indicating
347  * the severity of the condition causing the trace message to be issued.
348  * More severe conditions are more likely to be logged.
349  *
350  * This is an external API that allows trace levels to be set for each module.
351  *
352  * Return:  nothing
353  */
354 void qdf_trace_set_level(QDF_MODULE_ID module, QDF_TRACE_LEVEL level);
355 
356 /**
357  * qdf_trace_get_level() - get the trace level
358  * @level : trace level
359  *
360  * This is an external API that returns a bool value to signify if a
361  * particular trace level is set for the specified module.
362  * A member of the QDF_TRACE_LEVEL enumeration indicating the severity
363  * of the condition causing the trace message to be issued.
364  *
365  * Note that individual trace levels are the only valid values
366  * for this API.  QDF_TRACE_LEVEL_NONE and QDF_TRACE_LEVEL_ALL
367  * are not valid input and will return false
368  *
369  * Return:
370  *  false - the specified trace level for the specified module is OFF
371  *  true - the specified trace level for the specified module is ON
372  */
373 bool qdf_trace_get_level(QDF_MODULE_ID module, QDF_TRACE_LEVEL level);
374 
375 typedef void (*tp_qdf_trace_cb)(void *p_mac, tp_qdf_trace_record, uint16_t);
376 typedef void (*tp_qdf_state_info_cb) (char **buf, uint16_t *size);
377 void qdf_register_debugcb_init(void);
378 void qdf_register_debug_callback(QDF_MODULE_ID module_id,
379 					tp_qdf_state_info_cb qdf_state_infocb);
380 QDF_STATUS qdf_state_info_dump_all(char *buf, uint16_t size,
381 			uint16_t *driver_dump_size);
382 void qdf_trace(uint8_t module, uint8_t code, uint16_t session, uint32_t data);
383 void qdf_trace_register(QDF_MODULE_ID, tp_qdf_trace_cb);
384 QDF_STATUS qdf_trace_spin_lock_init(void);
385 void qdf_trace_init(void);
386 void qdf_trace_enable(uint32_t, uint8_t enable);
387 void qdf_trace_dump_all(void *, uint8_t, uint8_t, uint32_t, uint32_t);
388 
389 
390 #ifdef FEATURE_DP_TRACE
391 void qdf_dp_trace_log_pkt(uint8_t session_id, struct sk_buff *skb,
392 				enum qdf_proto_dir dir);
393 void qdf_dp_trace_init(void);
394 void qdf_dp_trace_spin_lock_init(void);
395 void qdf_dp_trace_set_value(uint8_t proto_bitmap, uint8_t no_of_records,
396 			 uint8_t verbosity);
397 void qdf_dp_trace_set_track(qdf_nbuf_t nbuf, enum qdf_proto_dir dir);
398 void qdf_dp_trace(qdf_nbuf_t nbuf, enum QDF_DP_TRACE_ID code,
399 			uint8_t *data, uint8_t size, enum qdf_proto_dir dir);
400 void qdf_dp_trace_dump_all(uint32_t count);
401 typedef void (*tp_qdf_dp_trace_cb)(struct qdf_dp_trace_record_s* , uint16_t);
402 void qdf_dp_display_record(struct qdf_dp_trace_record_s *record,
403 							uint16_t index);
404 void qdf_dp_trace_ptr(qdf_nbuf_t nbuf, enum QDF_DP_TRACE_ID code,
405 		uint8_t *data, uint8_t size, uint16_t msdu_id, uint16_t status);
406 
407 void qdf_dp_display_ptr_record(struct qdf_dp_trace_record_s *pRecord,
408 				uint16_t recIndex);
409 uint8_t qdf_dp_get_proto_bitmap(void);
410 void
411 qdf_dp_trace_proto_pkt(enum QDF_DP_TRACE_ID code, uint8_t vdev_id,
412 		uint8_t *sa, uint8_t *da, enum qdf_proto_type type,
413 		enum qdf_proto_subtype subtype, enum qdf_proto_dir dir);
414 void qdf_dp_display_proto_pkt(struct qdf_dp_trace_record_s *record,
415 				uint16_t index);
416 void qdf_dp_trace_enable_live_mode(void);
417 void qdf_dp_trace_clear_buffer(void);
418 void qdf_dp_trace_mgmt_pkt(enum QDF_DP_TRACE_ID code, uint8_t vdev_id,
419 		enum qdf_proto_type type, enum qdf_proto_subtype subtype);
420 void qdf_dp_display_mgmt_pkt(struct qdf_dp_trace_record_s *record,
421 			      uint16_t index);
422 void qdf_dp_display_event_record(struct qdf_dp_trace_record_s *record,
423 			      uint16_t index);
424 void qdf_dp_trace_record_event(enum QDF_DP_TRACE_ID code, uint8_t vdev_id,
425 		enum qdf_proto_type type, enum qdf_proto_subtype subtype);
426 #else
427 static inline
428 void qdf_dp_trace_log_pkt(uint8_t session_id, struct sk_buff *skb,
429 				enum qdf_proto_dir dir)
430 {
431 }
432 static inline
433 void qdf_dp_trace_init(void)
434 {
435 }
436 static inline
437 void qdf_dp_trace_set_track(qdf_nbuf_t nbuf, enum qdf_proto_dir dir)
438 {
439 }
440 static inline
441 void qdf_dp_trace_set_value(uint8_t proto_bitmap, uint8_t no_of_records,
442 			 uint8_t verbosity)
443 {
444 }
445 static inline
446 void qdf_dp_trace_dump_all(uint32_t count)
447 {
448 }
449 
450 static inline
451 void qdf_dp_trace_enable_live_mode(void)
452 {
453 }
454 
455 static inline
456 void qdf_dp_trace_clear_buffer(void)
457 {
458 }
459 
460 #endif
461 
462 
463 void qdf_trace_hex_dump(QDF_MODULE_ID module, QDF_TRACE_LEVEL level,
464 			void *data, int buf_len);
465 
466 void qdf_trace_display(void);
467 
468 void qdf_trace_set_value(QDF_MODULE_ID module, QDF_TRACE_LEVEL level,
469 			 uint8_t on);
470 
471 void qdf_trace_set_module_trace_level(QDF_MODULE_ID module, uint32_t level);
472 
473 void __printf(3, 4) qdf_snprintf(char *str_buffer, unsigned int size,
474 		  char *str_format, ...);
475 
476 #define QDF_SNPRINTF qdf_snprintf
477 #else
478 
479 #define DPTRACE(x)
480 #define qdf_trace_hex_dump(x, y, z, q)
481 
482 #endif /* CONFIG_MCL */
483 
484 #define ERROR_CODE                      -1
485 #define QDF_MAX_NAME_SIZE               32
486 #define MAX_PRINT_CONFIG_SUPPORTED      32
487 
488 #define MAX_SUPPORTED_CATEGORY QDF_MODULE_ID_MAX
489 
490 /*
491  * Shared print control index
492  * for converged debug framework
493  */
494 #define QDF_PRINT_IDX_SHARED -1
495 
496 /**
497  * QDF_PRINT_INFO() - Generic wrapper API for logging
498  * @idx : Index of print control object
499  * @module : Module identifier. A member of QDF_MODULE_ID enumeration that
500  *           identifies the module issuing the trace message
501  * @level : Trace level. A member of QDF_TRACE_LEVEL enumeration indicating
502  *          the severity of the condition causing the trace message to be
503  *          issued.
504  * @str_format : Format string that contains the message to be logged.
505  *
506  *
507  * This wrapper will be used for any generic logging messages. Wrapper will
508  * compile a call to converged QDF trace message API.
509  *
510  * Return : Nothing
511  *
512  */
513 void QDF_PRINT_INFO(unsigned int idx, QDF_MODULE_ID module,
514 		    QDF_TRACE_LEVEL level,
515 		    char *str_format, ...);
516 
517 /**
518  * struct category_info  : Category information structure
519  * @category_verbose_mask: Embeds information about category's verbose level
520  */
521 struct category_info {
522 	uint16_t category_verbose_mask;
523 };
524 
525 /**
526  * struct category_name_info  : Category name information structure
527  * @category_name_str: Embeds information about category name
528  */
529 struct category_name_info {
530 	unsigned char category_name_str[QDF_MAX_NAME_SIZE];
531 };
532 
533 /**
534  * qdf_trace_msg_cmn()- Converged logging API
535  * @idx: Index of print control object assigned to the module
536  * @category: Category identifier. A member of the QDF_MODULE_ID enumeration
537  *            that identifies the category issuing the trace message.
538  * @verbose: Verbose level. A member of the QDF_TRACE_LEVEL enumeration
539  *           indicating the severity of the condition causing the trace
540  *           message to be issued. More severe conditions are more likely
541  *           to be logged.
542  * @str_format: Format string. The message to be logged. This format string
543  *              contains printf-like replacement parameters, which follow this
544  *              parameter in the variable argument list.
545  * @val: Variable argument list part of the log message
546  *
547  * Return: nothing
548  *
549  */
550 void qdf_trace_msg_cmn(unsigned int idx,
551 			QDF_MODULE_ID category,
552 			QDF_TRACE_LEVEL verbose,
553 			const char *str_format,
554 			va_list val);
555 
556 /**
557  * struct qdf_print_ctrl: QDF Print Control structure
558  *                        Statically allocated objects of print control
559  *                        structure are declared that will support maximum of
560  *                        32 print control objects. Any module that needs to
561  *                        register to the print control framework needs to
562  *                        obtain a print control object using
563  *                        qdf_print_ctrl_register API. It will have to pass
564  *                        pointer to category info structure, name and
565  *                        custom print function to be used if required.
566  * @name                : Optional name for the control object
567  * @cat_info            : Array of category_info struct
568  * @custom_print        : Custom print handler
569  * @custom_ctxt         : Custom print context
570  * @dbglvlmac_on        : Flag to enable/disable MAC level filtering
571  * @in_use              : Boolean to indicate if control object is in use
572  */
573 struct qdf_print_ctrl {
574 	char name[QDF_MAX_NAME_SIZE];
575 	struct category_info cat_info[MAX_SUPPORTED_CATEGORY];
576 	void (*custom_print)(void *ctxt, const char *fmt, va_list args);
577 	void *custom_ctxt;
578 #ifdef DBG_LVL_MAC_FILTERING
579 	unsigned char dbglvlmac_on;
580 #endif
581 	bool in_use;
582 };
583 
584 /**
585  * qdf_print_ctrl_register() - Allocate QDF print control object, assign
586  *                             pointer to category info or print control
587  *                             structure and return the index to the callee
588  * @cinfo                 : Pointer to array of category info structure
589  * @custom_print_handler  : Pointer to custom print handler
590  * @custom_ctx            : Pointer to custom context
591  * @pctrl_name            : Pointer to print control object name
592  *
593  * Return                 : Index of qdf_print_ctrl structure
594  *
595  */
596 int qdf_print_ctrl_register(const struct category_info *cinfo,
597 			    void *custom_print_handler,
598 			    void *custom_ctx,
599 			    const char *pctrl_name);
600 
601 /**
602  * qdf_print_setup() - Setup default values to all the print control objects
603  *
604  * Register new print control object for the callee
605  *
606  * Return :             QDF_STATUS_SUCCESS on success and QDF_STATUS_E_FAILURE
607  *                      on failure
608  */
609 QDF_STATUS qdf_print_setup(void);
610 
611 /**
612  * qdf_print_ctrl_cleanup() - Clean up a print control object
613  *
614  * Cleanup the print control object for the callee
615  *
616  * @pctrl : Index of print control object
617  *
618  * Return : QDF_STATUS_SUCCESS on success and QDF_STATUS_E_FAILURE on failure
619  */
620 QDF_STATUS qdf_print_ctrl_cleanup(unsigned int idx);
621 
622 /**
623  * qdf_print_set_category_verbose() - Enable/Disable category for a
624  *                                    print control object with
625  *                                    user provided verbose level
626  *
627  * @idx : Index of the print control object assigned to callee
628  * @category : Category information
629  * @verbose: Verbose information
630  * @is_set: Flag indicating if verbose level needs to be enabled or disabled
631  *
632  * Return : QDF_STATUS_SUCCESS for success and QDF_STATUS_E_FAILURE for failure
633  */
634 QDF_STATUS qdf_print_set_category_verbose(unsigned int idx,
635 					  QDF_MODULE_ID category,
636 					  QDF_TRACE_LEVEL verbose,
637 					  bool is_set);
638 
639 /**
640  * qdf_print_is_category_enabled() - Get category information for the
641  *                                   print control object
642  *
643  * @idx : Index of print control object
644  * @category : Category information
645  *
646  * Return : Verbose enabled(true) or disabled(false) or invalid input (false)
647  */
648 bool qdf_print_is_category_enabled(unsigned int idx,
649 				   QDF_MODULE_ID category);
650 
651 /**
652  * qdf_print_is_verbose_enabled() - Get verbose information of a category for
653  *                                  the print control object
654  *
655  * @idx : Index of print control object
656  * @category : Category information
657  * @verbose : Verbose information
658  *
659  * Return : Verbose enabled(true) or disabled(false) or invalid input (false)
660  */
661 bool qdf_print_is_verbose_enabled(unsigned int idx,
662 				  QDF_MODULE_ID category,
663 				  QDF_TRACE_LEVEL verbose);
664 
665 /**
666  * qdf_print_clean_node_flag() - Clean up node flag for print control object
667  *
668  * @idx : Index of print control object
669  *
670  * Return : None
671  */
672 void qdf_print_clean_node_flag(unsigned int idx);
673 
674 #ifdef DBG_LVL_MAC_FILTERING
675 
676 /**
677  * qdf_print_set_node_flag() - Set flag to enable MAC level filtering
678  *
679  * @idx : Index of print control object
680  * @enable : Enable/Disable bit sent by callee
681  *
682  * Return : QDF_STATUS_SUCCESS on Success and QDF_STATUS_E_FAILURE on Failure
683  */
684 QDF_STATUS qdf_print_set_node_flag(unsigned int idx,
685 				   uint8_t enable);
686 
687 /**
688  * qdf_print_get_node_flag() - Get flag that controls MAC level filtering
689  *
690  * @idx : Index of print control object
691  *
692  * Return : Flag that indicates enable(1) or disable(0) or invalid(-1)
693  */
694 bool qdf_print_get_node_flag(unsigned int idx);
695 
696 #endif
697 
698 /**
699  * qdf_logging_init() - Initialize msg logging functionality
700  *
701  *
702  * Return : void
703  */
704 void qdf_logging_init(void);
705 
706 /**
707  * qdf_logging_exit() - Cleanup msg logging functionality
708  *
709  *
710  * Return : void
711  */
712 void qdf_logging_exit(void);
713 
714 #endif /* __QDF_TRACE_H */
715