1 /*
2 * Copyright (c) 2014-2018, 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 #ifndef __WLAN_HDD_TRACE_H__
20 #define __WLAN_HDD_TRACE_H__
21
22 #include "mac_trace.h"
23
24 #define NO_SESSION 0xFF
25
26 #undef ENUMS
27 #define ENUMS \
28 ENUM(TRACE_CODE_HDD_OPEN_REQUEST) \
29 ENUM(TRACE_CODE_HDD_STOP_REQUEST) \
30 ENUM(TRACE_CODE_HDD_TX_TIMEOUT) \
31 ENUM(TRACE_CODE_HDD_P2P_DEV_ADDR_IOCTL) \
32 ENUM(TRACE_CODE_HDD_SETSUSPENDMODE_IOCTL) \
33 ENUM(TRACE_CODE_HDD_SETROAMTRIGGER_IOCTL) \
34 ENUM(TRACE_CODE_HDD_GETROAMTRIGGER_IOCTL) \
35 ENUM(TRACE_CODE_HDD_SETROAMSCANPERIOD_IOCTL) \
36 ENUM(TRACE_CODE_HDD_GETROAMSCANPERIOD_IOCTL) \
37 ENUM(TRACE_CODE_HDD_SETROAMDELTA_IOCTL) \
38 ENUM(TRACE_CODE_HDD_GETROAMDELTA_IOCTL) \
39 ENUM(TRACE_CODE_HDD_GETBAND_IOCTL) \
40 ENUM(TRACE_CODE_HDD_GETCOUNTRYREV_IOCTL) \
41 ENUM(TRACE_CODE_HDD_SETROAMSCANCHANNELS_IOCTL) \
42 ENUM(TRACE_CODE_HDD_GETROAMSCANCHANNELS_IOCTL) \
43 ENUM(TRACE_CODE_HDD_HOSTAPD_OPEN_REQUEST) \
44 ENUM(TRACE_CODE_HDD_HOSTAPD_STOP_REQUEST) \
45 ENUM(TRACE_CODE_HDD_HOSTAPD_UNINIT_REQUEST) \
46 ENUM(TRACE_CODE_HDD_SOFTAP_TX_TIMEOUT) \
47 ENUM(TRACE_CODE_HDD_HOSTAPD_SET_MAC_ADDR) \
48 ENUM(TRACE_CODE_HDD_HOSTAPD_P2P_SET_NOA_IOCTL) \
49 ENUM(TRACE_CODE_HDD_HOSTAPD_P2P_SET_PS_IOCTL) \
50 ENUM(TRACE_CODE_HDD_HOSTAPD_SET_SAP_CHANNEL_LIST_IOCTL) \
51 ENUM(TRACE_CODE_HDD_ADD_VIRTUAL_INTF) \
52 ENUM(TRACE_CODE_HDD_DEL_VIRTUAL_INTF) \
53 ENUM(TRACE_CODE_HDD_CHANGE_VIRTUAL_INTF) \
54 ENUM(TRACE_CODE_HDD_CFG80211_START_AP) \
55 ENUM(TRACE_CODE_HDD_CFG80211_CHANGE_BEACON) \
56 ENUM(TRACE_CODE_HDD_CFG80211_STOP_AP) \
57 ENUM(TRACE_CODE_HDD_CFG80211_CHANGE_BSS) \
58 ENUM(TRACE_CODE_HDD_CFG80211_ADD_KEY) \
59 ENUM(TRACE_CODE_HDD_CFG80211_GET_KEY) \
60 ENUM(TRACE_CODE_HDD_CFG80211_SET_DEFAULT_KEY) \
61 ENUM(TRACE_CODE_HDD_CFG80211_CONNECT) \
62 ENUM(TRACE_CODE_HDD_CFG80211_DISCONNECT) \
63 ENUM(TRACE_CODE_HDD_CFG80211_SET_WIPHY_PARAMS) \
64 ENUM(TRACE_CODE_HDD_CFG80211_SET_TXPOWER) \
65 ENUM(TRACE_CODE_HDD_CFG80211_GET_TXPOWER) \
66 ENUM(TRACE_CODE_HDD_CFG80211_SET_CHANNEL) \
67 ENUM(TRACE_CODE_HDD_CFG80211_ADD_BEACON) \
68 ENUM(TRACE_CODE_HDD_CFG80211_SET_BEACON) \
69 ENUM(TRACE_CODE_HDD_CFG80211_CHANGE_IFACE) \
70 ENUM(TRACE_CODE_HDD_CHANGE_STATION) \
71 ENUM(TRACE_CODE_HDD_CFG80211_UPDATE_BSS) \
72 ENUM(TRACE_CODE_HDD_CFG80211_SCAN) \
73 ENUM(TRACE_CODE_HDD_REMAIN_ON_CHANNEL) \
74 ENUM(TRACE_CODE_HDD_REMAINCHANREADYHANDLER) \
75 ENUM(TRACE_CODE_HDD_CFG80211_CANCEL_REMAIN_ON_CHANNEL) \
76 ENUM(TRACE_CODE_HDD_ACTION) \
77 ENUM(TRACE_CODE_HDD_MGMT_TX_CANCEL_WAIT) \
78 ENUM(TRACE_CODE_HDD_CFG80211_GET_STA) \
79 ENUM(TRACE_CODE_HDD_CFG80211_SET_POWER_MGMT) \
80 ENUM(TRACE_CODE_HDD_CFG80211_DEL_STA) \
81 ENUM(TRACE_CODE_HDD_CFG80211_ADD_STA) \
82 ENUM(TRACE_CODE_HDD_CFG80211_SET_PMKSA) \
83 ENUM(TRACE_CODE_HDD_CFG80211_UPDATE_FT_IES) \
84 ENUM(TRACE_CODE_HDD_CFG80211_TDLS_MGMT) \
85 ENUM(TRACE_CODE_HDD_CFG80211_TDLS_OPER) \
86 ENUM(TRACE_CODE_HDD_CFG80211_SET_REKEY_DATA) \
87 ENUM(TRACE_CODE_HDD_UNSUPPORTED_IOCTL) \
88 ENUM(TRACE_CODE_HDD_SETROAMSCANCHANNELMINTIME_IOCTL) \
89 ENUM(TRACE_CODE_HDD_GETROAMSCANCHANNELMINTIME_IOCTL) \
90 ENUM(TRACE_CODE_HDD_STORE_JOIN_REQ) \
91 ENUM(TRACE_CODE_HDD_CLEAR_JOIN_REQ) \
92 ENUM(TRACE_CODE_HDD_ISSUE_JOIN_REQ) \
93 ENUM(TRACE_CODE_HDD_CFG80211_RESUME_WLAN) \
94 ENUM(TRACE_CODE_HDD_CFG80211_SUSPEND_WLAN) \
95 ENUM(TRACE_CODE_HDD_CFG80211_SET_MAC_ACL) \
96 ENUM(TRACE_CODE_HDD_CFG80211_TESTMODE) \
97 ENUM(TRACE_CODE_HDD_CFG80211_DUMP_SURVEY) \
98 ENUM(TRACE_CODE_HDD_CFG80211_SCHED_SCAN_START) \
99 ENUM(TRACE_CODE_HDD_CFG80211_SCHED_SCAN_STOP) \
100 ENUM(TRACE_CODE_HDD_CFG80211_DEL_PMKSA) \
101 ENUM(TRACE_CODE_HDD_SEND_MGMT_TX) \
102 /*
103 * New CFG80211 enums to be added before this comment.
104 * TRACE_CODE_HDD_RX_SME_MSG is used as code for MTRACE commands.
105 */ \
106 ENUM(TRACE_CODE_HDD_RX_SME_MSG)
107
108 enum {
109 #undef ENUM
110 #define ENUM(enum) enum,
111 ENUMS
112 };
113
114 /**
115 * hdd_trace_event_string() - Convert trace event to string
116 * @code: trace event enumeration to convert
117 *
118 * Return: string representation of the input enumeration
119 */
hdd_trace_event_string(uint32_t code)120 static inline const char *hdd_trace_event_string(uint32_t code)
121 {
122 switch (code) {
123 default:
124 return "UNKNOWN";
125 #undef ENUM
126 #define ENUM(enum) CASE_RETURN_STRING(enum)
127 ENUMS
128 }
129 }
130
131 #undef ENUMS
132 #undef ENUM
133
134 #ifdef HDD_TRACE_RECORD
135 void hdd_trace_init(void);
136 #else
hdd_trace_init(void)137 static inline void hdd_trace_init(void) {}
138 #endif
139
140 #endif
141