diff options
-rw-r--r-- | net/mac80211/Kconfig | 13 | ||||
-rw-r--r-- | net/mac80211/debug.h | 18 | ||||
-rw-r--r-- | net/mac80211/trace.c | 66 | ||||
-rw-r--r-- | net/mac80211/trace.h | 39 |
4 files changed, 136 insertions, 0 deletions
diff --git a/net/mac80211/Kconfig b/net/mac80211/Kconfig index 7475e266eb4e..63af25458fda 100644 --- a/net/mac80211/Kconfig +++ b/net/mac80211/Kconfig | |||
@@ -107,6 +107,19 @@ config MAC80211_DEBUGFS | |||
107 | 107 | ||
108 | Say N unless you know you need this. | 108 | Say N unless you know you need this. |
109 | 109 | ||
110 | config MAC80211_MESSAGE_TRACING | ||
111 | bool "Trace all mac80211 debug messages" | ||
112 | depends on MAC80211 | ||
113 | ---help--- | ||
114 | Select this option to have mac80211 register the | ||
115 | mac80211_msg trace subsystem with tracepoints to | ||
116 | collect all debugging messages, independent of | ||
117 | printing them into the kernel log. | ||
118 | |||
119 | The overhead in this option is that all the messages | ||
120 | need to be present in the binary and formatted at | ||
121 | runtime for tracing. | ||
122 | |||
110 | menuconfig MAC80211_DEBUG_MENU | 123 | menuconfig MAC80211_DEBUG_MENU |
111 | bool "Select mac80211 debugging features" | 124 | bool "Select mac80211 debugging features" |
112 | depends on MAC80211 | 125 | depends on MAC80211 |
diff --git a/net/mac80211/debug.h b/net/mac80211/debug.h index 6e6bbb9a9d41..8f383a576016 100644 --- a/net/mac80211/debug.h +++ b/net/mac80211/debug.h | |||
@@ -1,5 +1,6 @@ | |||
1 | #ifndef __MAC80211_DEBUG_H | 1 | #ifndef __MAC80211_DEBUG_H |
2 | #define __MAC80211_DEBUG_H | 2 | #define __MAC80211_DEBUG_H |
3 | #include <net/cfg80211.h> | ||
3 | 4 | ||
4 | #ifdef CONFIG_MAC80211_IBSS_DEBUG | 5 | #ifdef CONFIG_MAC80211_IBSS_DEBUG |
5 | #define MAC80211_IBSS_DEBUG 1 | 6 | #define MAC80211_IBSS_DEBUG 1 |
@@ -61,6 +62,22 @@ | |||
61 | #define MAC80211_MLME_DEBUG 0 | 62 | #define MAC80211_MLME_DEBUG 0 |
62 | #endif | 63 | #endif |
63 | 64 | ||
65 | #ifdef CONFIG_MAC80211_MESSAGE_TRACING | ||
66 | void __sdata_info(const char *fmt, ...) __printf(1, 2); | ||
67 | void __sdata_dbg(bool print, const char *fmt, ...) __printf(2, 3); | ||
68 | void __sdata_err(const char *fmt, ...) __printf(1, 2); | ||
69 | void __wiphy_dbg(struct wiphy *wiphy, bool print, const char *fmt, ...) | ||
70 | __printf(3, 4); | ||
71 | |||
72 | #define _sdata_info(sdata, fmt, ...) \ | ||
73 | __sdata_info("%s: " fmt, (sdata)->name, ##__VA_ARGS__) | ||
74 | #define _sdata_dbg(print, sdata, fmt, ...) \ | ||
75 | __sdata_dbg(print, "%s: " fmt, (sdata)->name, ##__VA_ARGS__) | ||
76 | #define _sdata_err(sdata, fmt, ...) \ | ||
77 | __sdata_err("%s: " fmt, (sdata)->name, ##__VA_ARGS__) | ||
78 | #define _wiphy_dbg(print, wiphy, fmt, ...) \ | ||
79 | __wiphy_dbg(wiphy, print, fmt, ##__VA_ARGS__) | ||
80 | #else | ||
64 | #define _sdata_info(sdata, fmt, ...) \ | 81 | #define _sdata_info(sdata, fmt, ...) \ |
65 | do { \ | 82 | do { \ |
66 | pr_info("%s: " fmt, \ | 83 | pr_info("%s: " fmt, \ |
@@ -85,6 +102,7 @@ do { \ | |||
85 | if (print) \ | 102 | if (print) \ |
86 | wiphy_dbg((wiphy), fmt, ##__VA_ARGS__); \ | 103 | wiphy_dbg((wiphy), fmt, ##__VA_ARGS__); \ |
87 | } while (0) | 104 | } while (0) |
105 | #endif | ||
88 | 106 | ||
89 | #define sdata_info(sdata, fmt, ...) \ | 107 | #define sdata_info(sdata, fmt, ...) \ |
90 | _sdata_info(sdata, fmt, ##__VA_ARGS__) | 108 | _sdata_info(sdata, fmt, ##__VA_ARGS__) |
diff --git a/net/mac80211/trace.c b/net/mac80211/trace.c index 943da6e7076c..386e45d8a958 100644 --- a/net/mac80211/trace.c +++ b/net/mac80211/trace.c | |||
@@ -3,7 +3,73 @@ | |||
3 | 3 | ||
4 | /* sparse isn't too happy with all macros... */ | 4 | /* sparse isn't too happy with all macros... */ |
5 | #ifndef __CHECKER__ | 5 | #ifndef __CHECKER__ |
6 | #include <net/cfg80211.h> | ||
6 | #include "driver-ops.h" | 7 | #include "driver-ops.h" |
8 | #include "debug.h" | ||
7 | #define CREATE_TRACE_POINTS | 9 | #define CREATE_TRACE_POINTS |
8 | #include "trace.h" | 10 | #include "trace.h" |
11 | |||
12 | #ifdef CONFIG_MAC80211_MESSAGE_TRACING | ||
13 | void __sdata_info(const char *fmt, ...) | ||
14 | { | ||
15 | struct va_format vaf = { | ||
16 | .fmt = fmt, | ||
17 | }; | ||
18 | va_list args; | ||
19 | |||
20 | va_start(args, fmt); | ||
21 | vaf.va = &args; | ||
22 | |||
23 | pr_info("%pV", &vaf); | ||
24 | trace_mac80211_info(&vaf); | ||
25 | va_end(args); | ||
26 | } | ||
27 | |||
28 | void __sdata_dbg(bool print, const char *fmt, ...) | ||
29 | { | ||
30 | struct va_format vaf = { | ||
31 | .fmt = fmt, | ||
32 | }; | ||
33 | va_list args; | ||
34 | |||
35 | va_start(args, fmt); | ||
36 | vaf.va = &args; | ||
37 | |||
38 | if (print) | ||
39 | pr_debug("%pV", &vaf); | ||
40 | trace_mac80211_dbg(&vaf); | ||
41 | va_end(args); | ||
42 | } | ||
43 | |||
44 | void __sdata_err(const char *fmt, ...) | ||
45 | { | ||
46 | struct va_format vaf = { | ||
47 | .fmt = fmt, | ||
48 | }; | ||
49 | va_list args; | ||
50 | |||
51 | va_start(args, fmt); | ||
52 | vaf.va = &args; | ||
53 | |||
54 | pr_err("%pV", &vaf); | ||
55 | trace_mac80211_err(&vaf); | ||
56 | va_end(args); | ||
57 | } | ||
58 | |||
59 | void __wiphy_dbg(struct wiphy *wiphy, bool print, const char *fmt, ...) | ||
60 | { | ||
61 | struct va_format vaf = { | ||
62 | .fmt = fmt, | ||
63 | }; | ||
64 | va_list args; | ||
65 | |||
66 | va_start(args, fmt); | ||
67 | vaf.va = &args; | ||
68 | |||
69 | if (print) | ||
70 | wiphy_dbg(wiphy, "%pV", &vaf); | ||
71 | trace_mac80211_dbg(&vaf); | ||
72 | va_end(args); | ||
73 | } | ||
74 | #endif | ||
9 | #endif | 75 | #endif |
diff --git a/net/mac80211/trace.h b/net/mac80211/trace.h index 392bcc9f6a12..2e60f4acd027 100644 --- a/net/mac80211/trace.h +++ b/net/mac80211/trace.h | |||
@@ -1632,6 +1632,45 @@ TRACE_EVENT(stop_queue, | |||
1632 | LOCAL_PR_ARG, __entry->queue, __entry->reason | 1632 | LOCAL_PR_ARG, __entry->queue, __entry->reason |
1633 | ) | 1633 | ) |
1634 | ); | 1634 | ); |
1635 | |||
1636 | #ifdef CONFIG_MAC80211_MESSAGE_TRACING | ||
1637 | #undef TRACE_SYSTEM | ||
1638 | #define TRACE_SYSTEM mac80211_msg | ||
1639 | |||
1640 | #define MAX_MSG_LEN 100 | ||
1641 | |||
1642 | DECLARE_EVENT_CLASS(mac80211_msg_event, | ||
1643 | TP_PROTO(struct va_format *vaf), | ||
1644 | |||
1645 | TP_ARGS(vaf), | ||
1646 | |||
1647 | TP_STRUCT__entry( | ||
1648 | __dynamic_array(char, msg, MAX_MSG_LEN) | ||
1649 | ), | ||
1650 | |||
1651 | TP_fast_assign( | ||
1652 | WARN_ON_ONCE(vsnprintf(__get_dynamic_array(msg), | ||
1653 | MAX_MSG_LEN, vaf->fmt, | ||
1654 | *vaf->va) >= MAX_MSG_LEN); | ||
1655 | ), | ||
1656 | |||
1657 | TP_printk("%s", __get_str(msg)) | ||
1658 | ); | ||
1659 | |||
1660 | DEFINE_EVENT(mac80211_msg_event, mac80211_info, | ||
1661 | TP_PROTO(struct va_format *vaf), | ||
1662 | TP_ARGS(vaf) | ||
1663 | ); | ||
1664 | DEFINE_EVENT(mac80211_msg_event, mac80211_dbg, | ||
1665 | TP_PROTO(struct va_format *vaf), | ||
1666 | TP_ARGS(vaf) | ||
1667 | ); | ||
1668 | DEFINE_EVENT(mac80211_msg_event, mac80211_err, | ||
1669 | TP_PROTO(struct va_format *vaf), | ||
1670 | TP_ARGS(vaf) | ||
1671 | ); | ||
1672 | #endif | ||
1673 | |||
1635 | #endif /* !__MAC80211_DRIVER_TRACE || TRACE_HEADER_MULTI_READ */ | 1674 | #endif /* !__MAC80211_DRIVER_TRACE || TRACE_HEADER_MULTI_READ */ |
1636 | 1675 | ||
1637 | #undef TRACE_INCLUDE_PATH | 1676 | #undef TRACE_INCLUDE_PATH |