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 #ifdef HDD_TRACE_RECORD
20 
21 /**
22  * DOC: wlan_hdd_trace.c
23  *
24  * WLAN Host Device Driver trace implementation
25  *
26  */
27 
28 #include "qdf_trace.h"
29 #include "qdf_types.h"
30 #include "wlan_hdd_trace.h"
31 #include "wlan_hdd_main.h"
32 
33 /**
34  * hdd_trace_dump() - Dump an HDD-specific trace record
35  * @mac: (unused) global MAC handle
36  * @record: trace record that was previously recorded
37  * @index: index of the trace record
38  *
39  * Return: none
40  */
41 static void
hdd_trace_dump(void * mac,tp_qdf_trace_record record,uint16_t index)42 hdd_trace_dump(void *mac, tp_qdf_trace_record record, uint16_t index)
43 {
44 	if (TRACE_CODE_HDD_RX_SME_MSG == record->code)
45 		hdd_nofl_debug("%04d %012llu %s S%d %-14s %-30s(0x%x)",
46 			       index, record->qtime, record->time,
47 			       record->session, "RX SME MSG:",
48 			       get_e_roam_cmd_status_str(record->data),
49 							 record->data);
50 	else
51 		hdd_nofl_debug("%04d %012llu %s S%d %-14s %-30s(0x%x)",
52 			       index, record->qtime, record->time,
53 			       record->session, "HDD Event:",
54 			       hdd_trace_event_string(record->code),
55 						      record->data);
56 }
57 
58 /**
59  * hdd_trace_init() - HDD trace subsystem initialization
60  *
61  * Registers HDD with the debug trace subsystem
62  *
63  * Return: none
64  */
hdd_trace_init(void)65 void hdd_trace_init(void)
66 {
67 	qdf_trace_register(QDF_MODULE_ID_HDD, hdd_trace_dump);
68 }
69 
70 #endif /* ifdef HDD_TRACE_RECORD */
71