[PATCH 13/22] tools lib traceevent: Add cfg80211 plugin

From: Jiri Olsa
Date: Thu Nov 21 2013 - 06:04:51 EST


Adding cfg80211 plugin.

This plugin adds handler for __le16_to_cpup function
t properly parse following tracepoint events:
cfg80211:cfg80211_tx_mlme_mgmt
cfg80211:cfg80211_rx_mlme_mgmt
cfg80211:cfg80211_rx_unprot_mlme_mgmt

The diff of 'perf script' output generated by old and new code:
(data was generated by 'perf record -e 'cfg80211:*' -a')

--- script.cfg80211.old
+++ script.cfg80211.new
- ifconfig 2705 [003] 662.896560: cfg80211:cfg80211_tx_mlme_mgmt: [FAILED TO PARSE] name=wlan0 ifindex=3 frame=ARRAY[c0, 00, 00, 00, 00, 3a, 98, a0, 30, 51, 10, 0b, a9, c6, f4, 74, 00, 3a, 98, a0, 30, 51, 00, 00, 03, 00]
+ ifconfig 2705 [003] 662.896560: cfg80211:cfg80211_tx_mlme_mgmt: netdev:wlan0(3), ftype:0xc0
- kworker/u16:0 1697 [002] 664.808210: cfg80211:cfg80211_rx_mlme_mgmt: [FAILED TO PARSE] name=wlan0 ifindex=3 frame=ARRAY[b0, 00, da, 00, 10, 0b, a9, c6, f4, 74, d8, 24, bd, a1, 26, 31, d8, 24, bd, a1, 26, 31, 10, b7, 00, 00, 02, 00, 00, 00]
+ kworker/u16:0 1697 [002] 664.808210: cfg80211:cfg80211_rx_mlme_mgmt: netdev:wlan0(3), ftype:0xb0

Signed-off-by: Jiri Olsa <jolsa@xxxxxxxxxx>
Cc: Corey Ashford <cjashfor@xxxxxxxxxxxxxxxxxx>
Cc: Frederic Weisbecker <fweisbec@xxxxxxxxx>
Cc: Ingo Molnar <mingo@xxxxxxx>
Cc: Namhyung Kim <namhyung@xxxxxxxxxx>
Cc: Paul Mackerras <paulus@xxxxxxxxx>
Cc: Peter Zijlstra <a.p.zijlstra@xxxxxxxxx>
Cc: Arnaldo Carvalho de Melo <acme@xxxxxxxxxx>
Cc: Steven Rostedt <rostedt@xxxxxxxxxxx>
Cc: David Ahern <dsahern@xxxxxxxxx>
---
tools/lib/traceevent/Makefile | 1 +
tools/lib/traceevent/plugin_cfg80211.c | 23 +++++++++++++++++++++++
2 files changed, 24 insertions(+)
create mode 100644 tools/lib/traceevent/plugin_cfg80211.c

diff --git a/tools/lib/traceevent/Makefile b/tools/lib/traceevent/Makefile
index 88da8af..bbb2061 100644
--- a/tools/lib/traceevent/Makefile
+++ b/tools/lib/traceevent/Makefile
@@ -211,6 +211,7 @@ PLUGIN_OBJS += plugin_sched_switch.o
PLUGIN_OBJS += plugin_function.o
PLUGIN_OBJS += plugin_xen.o
PLUGIN_OBJS += plugin_scsi.o
+PLUGIN_OBJS += plugin_cfg80211.o

PLUGINS := $(PLUGIN_OBJS:.o=.so)

diff --git a/tools/lib/traceevent/plugin_cfg80211.c b/tools/lib/traceevent/plugin_cfg80211.c
new file mode 100644
index 0000000..0bbffb0
--- /dev/null
+++ b/tools/lib/traceevent/plugin_cfg80211.c
@@ -0,0 +1,23 @@
+#include <stdio.h>
+#include <string.h>
+#include <inttypes.h>
+#include <endian.h>
+#include "event-parse.h"
+
+unsigned long long process___le16_to_cpup(struct trace_seq *s,
+ unsigned long long *args)
+{
+ uint16_t *val = (uint16_t *) args[0];
+ return val ? (long long) le16toh(*val) : 0;
+}
+
+int PEVENT_PLUGIN_LOADER(struct pevent *pevent)
+{
+ pevent_register_print_function(pevent,
+ process___le16_to_cpup,
+ PEVENT_FUNC_ARG_INT,
+ "__le16_to_cpup",
+ PEVENT_FUNC_ARG_PTR,
+ PEVENT_FUNC_ARG_VOID);
+ return 0;
+}
--
1.8.3.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/