]> git.karo-electronics.de Git - linux-beck.git/commitdiff
ath: Add support for tracing
authorSujith Manoharan <c_manoha@qca.qualcomm.com>
Sat, 27 Sep 2014 07:57:45 +0000 (13:27 +0530)
committerJohn W. Linville <linville@tuxdriver.com>
Thu, 2 Oct 2014 18:23:14 +0000 (14:23 -0400)
Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
drivers/net/wireless/ath/Kconfig
drivers/net/wireless/ath/Makefile
drivers/net/wireless/ath/ath.h
drivers/net/wireless/ath/main.c
drivers/net/wireless/ath/trace.c [new file with mode: 0644]
drivers/net/wireless/ath/trace.h [new file with mode: 0644]

index c63d1159db5ca939718f4c34385347865b53ef67..ce7826009eeb9dbc4375ff8329cf898e9d738e9c 100644 (file)
@@ -25,6 +25,14 @@ config ATH_DEBUG
          Say Y, if you want to debug atheros wireless drivers.
          Right now only ath9k makes use of this.
 
+config ATH_TRACEPOINTS
+       bool "Atheros wireless tracing"
+       depends on ATH_DEBUG
+       depends on EVENT_TRACING
+       ---help---
+         This option enables tracepoints for atheros wireless drivers.
+        Currently, ath9k makes use of this facility.
+
 config ATH_REG_DYNAMIC_USER_REG_HINTS
        bool "Atheros dynamic user regulatory hints"
        depends on CFG80211_CERTIFICATION_ONUS
index 7d023b0f13b47d064cd2db064c58690e2da8e1ea..89f8d5979402dfaecd9d7565798804ed581cf261 100644 (file)
@@ -17,4 +17,8 @@ ath-objs :=   main.o \
                dfs_pri_detector.o
 
 ath-$(CONFIG_ATH_DEBUG) += debug.o
+ath-$(CONFIG_ATH_TRACEPOINTS) += trace.o
+
 ccflags-y += -D__CHECK_ENDIAN__
+
+CFLAGS_trace.o := -I$(src)
index a3b6e27d91219a54778114f2f8195713cf911e61..e5ba6faf32815173fa47fa81fd303082688202bd 100644 (file)
@@ -268,6 +268,7 @@ enum ATH_DEBUG {
 };
 
 #define ATH_DBG_DEFAULT (ATH_DBG_FATAL)
+#define ATH_DBG_MAX_LEN 512
 
 #ifdef CONFIG_ATH_DEBUG
 
index 8b0ac14d5c32dc2030515f4b103e3e4b1bcb0fb2..83f47af19280de4c3cd0cdf528c997b3d149187d 100644 (file)
@@ -20,6 +20,7 @@
 #include <linux/module.h>
 
 #include "ath.h"
+#include "trace.h"
 
 MODULE_AUTHOR("Atheros Communications");
 MODULE_DESCRIPTION("Shared library for Atheros wireless LAN cards.");
@@ -84,6 +85,8 @@ void ath_printk(const char *level, const struct ath_common* common,
        else
                printk("%sath: %pV", level, &vaf);
 
+       trace_ath_log(common->hw->wiphy, &vaf);
+
        va_end(args);
 }
 EXPORT_SYMBOL(ath_printk);
diff --git a/drivers/net/wireless/ath/trace.c b/drivers/net/wireless/ath/trace.c
new file mode 100644 (file)
index 0000000..18fb3a0
--- /dev/null
@@ -0,0 +1,20 @@
+/*
+ * Copyright (c) 2014 Qualcomm Atheros, Inc.
+ *
+ * Permission to use, copy, modify, and/or distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#include <linux/module.h>
+
+#define CREATE_TRACE_POINTS
+#include "trace.h"
diff --git a/drivers/net/wireless/ath/trace.h b/drivers/net/wireless/ath/trace.h
new file mode 100644 (file)
index 0000000..ba71164
--- /dev/null
@@ -0,0 +1,71 @@
+/*
+ * Copyright (c) 2014 Qualcomm Atheros, Inc.
+ *
+ * Permission to use, copy, modify, and/or distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#if !defined(_TRACE_H) || defined(TRACE_HEADER_MULTI_READ)
+#define _TRACE_H
+
+#include <linux/tracepoint.h>
+#include "ath.h"
+
+#undef TRACE_SYSTEM
+#define TRACE_SYSTEM ath
+
+#if !defined(CONFIG_ATH_TRACEPOINTS)
+
+#undef TRACE_EVENT
+#define TRACE_EVENT(name, proto, ...) static inline void trace_ ## name(proto) {}
+
+#endif /* CONFIG_ATH_TRACEPOINTS */
+
+TRACE_EVENT(ath_log,
+
+           TP_PROTO(struct wiphy *wiphy,
+                    struct va_format *vaf),
+
+           TP_ARGS(wiphy, vaf),
+
+           TP_STRUCT__entry(
+                   __string(device, wiphy_name(wiphy))
+                   __string(driver, KBUILD_MODNAME)
+                   __dynamic_array(char, msg, ATH_DBG_MAX_LEN)
+           ),
+
+           TP_fast_assign(
+                   __assign_str(device, wiphy_name(wiphy));
+                   __assign_str(driver, KBUILD_MODNAME);
+                   WARN_ON_ONCE(vsnprintf(__get_dynamic_array(msg),
+                                          ATH_DBG_MAX_LEN,
+                                          vaf->fmt,
+                                          *vaf->va) >= ATH_DBG_MAX_LEN);
+           ),
+
+           TP_printk(
+                   "%s %s %s",
+                   __get_str(driver),
+                   __get_str(device),
+                   __get_str(msg)
+           )
+);
+
+#endif /* _TRACE_H || TRACE_HEADER_MULTI_READ */
+
+#undef TRACE_INCLUDE_PATH
+#define TRACE_INCLUDE_PATH .
+#undef TRACE_INCLUDE_FILE
+#define TRACE_INCLUDE_FILE trace
+
+/* This part must be outside protection */
+#include <trace/define_trace.h>