From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751909AbaFMDNg (ORCPT ); Thu, 12 Jun 2014 23:13:36 -0400 Received: from cdptpa-outbound-snat.email.rr.com ([107.14.166.231]:40363 "EHLO cdptpa-oedge-vip.email.rr.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1750982AbaFMDNf (ORCPT ); Thu, 12 Jun 2014 23:13:35 -0400 Date: Thu, 12 Jun 2014 23:13:31 -0400 From: Steven Rostedt To: Arnaldo Carvalho de Melo Cc: Ingo Molnar , linux-kernel@vger.kernel.org, Jiri Olsa , Corey Ashford , David Ahern , Frederic Weisbecker , Ingo Molnar , Namhyung Kim , Paul Mackerras , Peter Zijlstra , Arnaldo Carvalho de Melo , Johannes Berg Subject: Re: [PATCH 27/38] tools lib traceevent: Add mac80211 plugin Message-ID: <20140612231331.2f30b312@gandalf.local.home> In-Reply-To: <1386187622-2928-28-git-send-email-acme@infradead.org> References: <1386187622-2928-1-git-send-email-acme@infradead.org> <1386187622-2928-28-git-send-email-acme@infradead.org> X-Mailer: Claws Mail 3.9.3 (GTK+ 2.24.23; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-RR-Connecting-IP: 107.14.168.142:25 X-Cloudmark-Score: 0 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 4 Dec 2013 17:06:51 -0300 Arnaldo Carvalho de Melo wrote: > From: Jiri Olsa > > Backporting mac80211 plugin. > > Backported from Steven Rostedt's trace-cmd repo (HEAD 0f2c2fb): > git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/trace-cmd.git > > This plugin adds changed field resolving for > mac80211:drv_bss_info_changed tracepoint event. > > The diff of 'perf script' output generated by old and new code: > (data was generated by 'perf record -e 'mac80211:drv_bss_info_changed' -a') > > --- script.mac80211.old > +++ script.mac80211.new > - ifconfig 3711 [000] 1290.446492: mac80211:drv_bss_info_changed: phy0 vif:wlan0(2) changed:0x309f > + ifconfig 3711 [000] 1290.446492: mac80211:drv_bss_info_changed: phy0 vif:wlan0(2) > + assoc:0 aid:2 cts:0 shortpre:0 shortslot:0 dtimper:1 > + bcnint:102 assoc_cap:0x431 basic_rates:0xf enable_beacon:0 > + ht_operation_mode:0 > > Omitting the mac80211:drv_config tracepoint handling because the kernel > tracepoint changed its prototype and the plugin handler is no longer > working. While doing my synchronization between trace-cmd and lib traceevent, I noticed that the mac80211 driver is quite different. Johannes, Jiri states that this plugin no longer works with the latest kernels. Is that true? -- Steve > > Signed-off-by: Jiri Olsa > Cc: Corey Ashford > Cc: David Ahern > Cc: Frederic Weisbecker > Cc: Ingo Molnar > Cc: Namhyung Kim > Cc: Paul Mackerras > Cc: Peter Zijlstra > Cc: Steven Rostedt > Link: http://lkml.kernel.org/r/1386076182-14484-17-git-send-email-jolsa@redhat.com > Signed-off-by: Arnaldo Carvalho de Melo > --- > tools/lib/traceevent/Makefile | 1 + > tools/lib/traceevent/plugin_mac80211.c | 95 ++++++++++++++++++++++++++++++++++ > 2 files changed, 96 insertions(+) > create mode 100644 tools/lib/traceevent/plugin_mac80211.c > > diff --git a/tools/lib/traceevent/Makefile b/tools/lib/traceevent/Makefile > index 226a8f9fb177..d0e0ca12aa10 100644 > --- a/tools/lib/traceevent/Makefile > +++ b/tools/lib/traceevent/Makefile > @@ -216,6 +216,7 @@ PLUGIN_OBJS = plugin_jbd2.o > PLUGIN_OBJS += plugin_hrtimer.o > PLUGIN_OBJS += plugin_kmem.o > PLUGIN_OBJS += plugin_kvm.o > +PLUGIN_OBJS += plugin_mac80211.o > > PLUGINS := $(PLUGIN_OBJS:.o=.so) > > diff --git a/tools/lib/traceevent/plugin_mac80211.c b/tools/lib/traceevent/plugin_mac80211.c > new file mode 100644 > index 000000000000..558a3b91c046 > --- /dev/null > +++ b/tools/lib/traceevent/plugin_mac80211.c > @@ -0,0 +1,95 @@ > +/* > + * Copyright (C) 2009 Johannes Berg > + * > + * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > + * This program is free software; you can redistribute it and/or > + * modify it under the terms of the GNU Lesser General Public > + * License as published by the Free Software Foundation; > + * version 2.1 of the License (not later!) > + * > + * This program is distributed in the hope that it will be useful, > + * but WITHOUT ANY WARRANTY; without even the implied warranty of > + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the > + * GNU Lesser General Public License for more details. > + * > + * You should have received a copy of the GNU Lesser General Public > + * License along with this program; if not, see > + * > + * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > + */ > +#include > +#include > +#include > + > +#include "event-parse.h" > + > +#define INDENT 65 > + > +static void print_string(struct trace_seq *s, struct event_format *event, > + const char *name, const void *data) > +{ > + struct format_field *f = pevent_find_field(event, name); > + int offset; > + int length; > + > + if (!f) { > + trace_seq_printf(s, "NOTFOUND:%s", name); > + return; > + } > + > + offset = f->offset; > + length = f->size; > + > + if (!strncmp(f->type, "__data_loc", 10)) { > + unsigned long long v; > + if (pevent_read_number_field(f, data, &v)) { > + trace_seq_printf(s, "invalid_data_loc"); > + return; > + } > + offset = v & 0xffff; > + length = v >> 16; > + } > + > + trace_seq_printf(s, "%.*s", length, (char *)data + offset); > +} > + > +#define SF(fn) pevent_print_num_field(s, fn ":%d", event, fn, record, 0) > +#define SFX(fn) pevent_print_num_field(s, fn ":%#x", event, fn, record, 0) > +#define SP() trace_seq_putc(s, ' ') > + > +static int drv_bss_info_changed(struct trace_seq *s, > + struct pevent_record *record, > + struct event_format *event, void *context) > +{ > + void *data = record->data; > + > + print_string(s, event, "wiphy_name", data); > + trace_seq_printf(s, " vif:"); > + print_string(s, event, "vif_name", data); > + pevent_print_num_field(s, "(%d)", event, "vif_type", record, 1); > + > + trace_seq_printf(s, "\n%*s", INDENT, ""); > + SF("assoc"); SP(); > + SF("aid"); SP(); > + SF("cts"); SP(); > + SF("shortpre"); SP(); > + SF("shortslot"); SP(); > + SF("dtimper"); SP(); > + trace_seq_printf(s, "\n%*s", INDENT, ""); > + SF("bcnint"); SP(); > + SFX("assoc_cap"); SP(); > + SFX("basic_rates"); SP(); > + SF("enable_beacon"); > + trace_seq_printf(s, "\n%*s", INDENT, ""); > + SF("ht_operation_mode"); > + > + return 0; > +} > + > +int PEVENT_PLUGIN_LOADER(struct pevent *pevent) > +{ > + pevent_register_event_handler(pevent, -1, "mac80211", > + "drv_bss_info_changed", > + drv_bss_info_changed, NULL); > + return 0; > +}