tools list traceevent: Add cfg80211 plugin
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')
Signed-off-by: Jiri Olsa <jolsa@redhat.com>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
diff --git a/Makefile b/Makefile
index 0dcaf91..1b82027 100644
--- a/Makefile
+++ b/Makefile
@@ -328,6 +328,7 @@
PLUGIN_OBJS += plugin_function.o
PLUGIN_OBJS += plugin_kvm.o
PLUGIN_OBJS += plugin_blk.o
+PLUGIN_OBJS += plugin_cfg80211.o
PLUGINS := $(PLUGIN_OBJS:.o=.so)
diff --git a/plugin_cfg80211.c b/plugin_cfg80211.c
new file mode 100644
index 0000000..2685870
--- /dev/null
+++ b/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 (long long) le16toh(*val);
+}
+
+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;
+}