diff options
author | Sujith Manoharan <c_manoha@qca.qualcomm.com> | 2014-09-27 03:57:45 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2014-10-02 14:23:14 -0400 |
commit | e6664dff0608440f117b0348594b887cb9725e4f (patch) | |
tree | 27be5e5114b4b2cee1e2b8d2ef39cf91bc5deb34 | |
parent | f6cd071891c5c7971866fda8340202b73ce35206 (diff) |
ath: Add support for tracing
Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
-rw-r--r-- | drivers/net/wireless/ath/Kconfig | 8 | ||||
-rw-r--r-- | drivers/net/wireless/ath/Makefile | 4 | ||||
-rw-r--r-- | drivers/net/wireless/ath/ath.h | 1 | ||||
-rw-r--r-- | drivers/net/wireless/ath/main.c | 3 | ||||
-rw-r--r-- | drivers/net/wireless/ath/trace.c | 20 | ||||
-rw-r--r-- | drivers/net/wireless/ath/trace.h | 71 |
6 files changed, 107 insertions, 0 deletions
diff --git a/drivers/net/wireless/ath/Kconfig b/drivers/net/wireless/ath/Kconfig index c63d1159db5c..ce7826009eeb 100644 --- a/drivers/net/wireless/ath/Kconfig +++ b/drivers/net/wireless/ath/Kconfig | |||
@@ -25,6 +25,14 @@ config ATH_DEBUG | |||
25 | Say Y, if you want to debug atheros wireless drivers. | 25 | Say Y, if you want to debug atheros wireless drivers. |
26 | Right now only ath9k makes use of this. | 26 | Right now only ath9k makes use of this. |
27 | 27 | ||
28 | config ATH_TRACEPOINTS | ||
29 | bool "Atheros wireless tracing" | ||
30 | depends on ATH_DEBUG | ||
31 | depends on EVENT_TRACING | ||
32 | ---help--- | ||
33 | This option enables tracepoints for atheros wireless drivers. | ||
34 | Currently, ath9k makes use of this facility. | ||
35 | |||
28 | config ATH_REG_DYNAMIC_USER_REG_HINTS | 36 | config ATH_REG_DYNAMIC_USER_REG_HINTS |
29 | bool "Atheros dynamic user regulatory hints" | 37 | bool "Atheros dynamic user regulatory hints" |
30 | depends on CFG80211_CERTIFICATION_ONUS | 38 | depends on CFG80211_CERTIFICATION_ONUS |
diff --git a/drivers/net/wireless/ath/Makefile b/drivers/net/wireless/ath/Makefile index 7d023b0f13b4..89f8d5979402 100644 --- a/drivers/net/wireless/ath/Makefile +++ b/drivers/net/wireless/ath/Makefile | |||
@@ -17,4 +17,8 @@ ath-objs := main.o \ | |||
17 | dfs_pri_detector.o | 17 | dfs_pri_detector.o |
18 | 18 | ||
19 | ath-$(CONFIG_ATH_DEBUG) += debug.o | 19 | ath-$(CONFIG_ATH_DEBUG) += debug.o |
20 | ath-$(CONFIG_ATH_TRACEPOINTS) += trace.o | ||
21 | |||
20 | ccflags-y += -D__CHECK_ENDIAN__ | 22 | ccflags-y += -D__CHECK_ENDIAN__ |
23 | |||
24 | CFLAGS_trace.o := -I$(src) | ||
diff --git a/drivers/net/wireless/ath/ath.h b/drivers/net/wireless/ath/ath.h index a3b6e27d9121..e5ba6faf3281 100644 --- a/drivers/net/wireless/ath/ath.h +++ b/drivers/net/wireless/ath/ath.h | |||
@@ -268,6 +268,7 @@ enum ATH_DEBUG { | |||
268 | }; | 268 | }; |
269 | 269 | ||
270 | #define ATH_DBG_DEFAULT (ATH_DBG_FATAL) | 270 | #define ATH_DBG_DEFAULT (ATH_DBG_FATAL) |
271 | #define ATH_DBG_MAX_LEN 512 | ||
271 | 272 | ||
272 | #ifdef CONFIG_ATH_DEBUG | 273 | #ifdef CONFIG_ATH_DEBUG |
273 | 274 | ||
diff --git a/drivers/net/wireless/ath/main.c b/drivers/net/wireless/ath/main.c index 8b0ac14d5c32..83f47af19280 100644 --- a/drivers/net/wireless/ath/main.c +++ b/drivers/net/wireless/ath/main.c | |||
@@ -20,6 +20,7 @@ | |||
20 | #include <linux/module.h> | 20 | #include <linux/module.h> |
21 | 21 | ||
22 | #include "ath.h" | 22 | #include "ath.h" |
23 | #include "trace.h" | ||
23 | 24 | ||
24 | MODULE_AUTHOR("Atheros Communications"); | 25 | MODULE_AUTHOR("Atheros Communications"); |
25 | MODULE_DESCRIPTION("Shared library for Atheros wireless LAN cards."); | 26 | MODULE_DESCRIPTION("Shared library for Atheros wireless LAN cards."); |
@@ -84,6 +85,8 @@ void ath_printk(const char *level, const struct ath_common* common, | |||
84 | else | 85 | else |
85 | printk("%sath: %pV", level, &vaf); | 86 | printk("%sath: %pV", level, &vaf); |
86 | 87 | ||
88 | trace_ath_log(common->hw->wiphy, &vaf); | ||
89 | |||
87 | va_end(args); | 90 | va_end(args); |
88 | } | 91 | } |
89 | EXPORT_SYMBOL(ath_printk); | 92 | EXPORT_SYMBOL(ath_printk); |
diff --git a/drivers/net/wireless/ath/trace.c b/drivers/net/wireless/ath/trace.c new file mode 100644 index 000000000000..18fb3a071931 --- /dev/null +++ b/drivers/net/wireless/ath/trace.c | |||
@@ -0,0 +1,20 @@ | |||
1 | /* | ||
2 | * Copyright (c) 2014 Qualcomm Atheros, Inc. | ||
3 | * | ||
4 | * Permission to use, copy, modify, and/or distribute this software for any | ||
5 | * purpose with or without fee is hereby granted, provided that the above | ||
6 | * copyright notice and this permission notice appear in all copies. | ||
7 | * | ||
8 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | ||
9 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | ||
10 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR | ||
11 | * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | ||
12 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN | ||
13 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | ||
14 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | ||
15 | */ | ||
16 | |||
17 | #include <linux/module.h> | ||
18 | |||
19 | #define CREATE_TRACE_POINTS | ||
20 | #include "trace.h" | ||
diff --git a/drivers/net/wireless/ath/trace.h b/drivers/net/wireless/ath/trace.h new file mode 100644 index 000000000000..ba711644d27e --- /dev/null +++ b/drivers/net/wireless/ath/trace.h | |||
@@ -0,0 +1,71 @@ | |||
1 | /* | ||
2 | * Copyright (c) 2014 Qualcomm Atheros, Inc. | ||
3 | * | ||
4 | * Permission to use, copy, modify, and/or distribute this software for any | ||
5 | * purpose with or without fee is hereby granted, provided that the above | ||
6 | * copyright notice and this permission notice appear in all copies. | ||
7 | * | ||
8 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | ||
9 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | ||
10 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR | ||
11 | * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | ||
12 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN | ||
13 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | ||
14 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | ||
15 | */ | ||
16 | |||
17 | #if !defined(_TRACE_H) || defined(TRACE_HEADER_MULTI_READ) | ||
18 | #define _TRACE_H | ||
19 | |||
20 | #include <linux/tracepoint.h> | ||
21 | #include "ath.h" | ||
22 | |||
23 | #undef TRACE_SYSTEM | ||
24 | #define TRACE_SYSTEM ath | ||
25 | |||
26 | #if !defined(CONFIG_ATH_TRACEPOINTS) | ||
27 | |||
28 | #undef TRACE_EVENT | ||
29 | #define TRACE_EVENT(name, proto, ...) static inline void trace_ ## name(proto) {} | ||
30 | |||
31 | #endif /* CONFIG_ATH_TRACEPOINTS */ | ||
32 | |||
33 | TRACE_EVENT(ath_log, | ||
34 | |||
35 | TP_PROTO(struct wiphy *wiphy, | ||
36 | struct va_format *vaf), | ||
37 | |||
38 | TP_ARGS(wiphy, vaf), | ||
39 | |||
40 | TP_STRUCT__entry( | ||
41 | __string(device, wiphy_name(wiphy)) | ||
42 | __string(driver, KBUILD_MODNAME) | ||
43 | __dynamic_array(char, msg, ATH_DBG_MAX_LEN) | ||
44 | ), | ||
45 | |||
46 | TP_fast_assign( | ||
47 | __assign_str(device, wiphy_name(wiphy)); | ||
48 | __assign_str(driver, KBUILD_MODNAME); | ||
49 | WARN_ON_ONCE(vsnprintf(__get_dynamic_array(msg), | ||
50 | ATH_DBG_MAX_LEN, | ||
51 | vaf->fmt, | ||
52 | *vaf->va) >= ATH_DBG_MAX_LEN); | ||
53 | ), | ||
54 | |||
55 | TP_printk( | ||
56 | "%s %s %s", | ||
57 | __get_str(driver), | ||
58 | __get_str(device), | ||
59 | __get_str(msg) | ||
60 | ) | ||
61 | ); | ||
62 | |||
63 | #endif /* _TRACE_H || TRACE_HEADER_MULTI_READ */ | ||
64 | |||
65 | #undef TRACE_INCLUDE_PATH | ||
66 | #define TRACE_INCLUDE_PATH . | ||
67 | #undef TRACE_INCLUDE_FILE | ||
68 | #define TRACE_INCLUDE_FILE trace | ||
69 | |||
70 | /* This part must be outside protection */ | ||
71 | #include <trace/define_trace.h> | ||