1 // SPDX-License-Identifier: LGPL-2.1
9 #include "event-parse.h"
10 #include "trace-seq.h"
14 static void print_string(struct trace_seq *s, struct tep_event *event,
15 const char *name, const void *data)
17 struct tep_format_field *f = tep_find_field(event, name);
22 trace_seq_printf(s, "NOTFOUND:%s", name);
29 if (!strncmp(f->type, "__data_loc", 10)) {
31 if (tep_read_number_field(f, data, &v)) {
32 trace_seq_printf(s, "invalid_data_loc");
39 trace_seq_printf(s, "%.*s", length, (char *)data + offset);
42 #define SF(fn) tep_print_num_field(s, fn ":%d", event, fn, record, 0)
43 #define SFX(fn) tep_print_num_field(s, fn ":%#x", event, fn, record, 0)
44 #define SP() trace_seq_putc(s, ' ')
46 static int drv_bss_info_changed(struct trace_seq *s,
47 struct tep_record *record,
48 struct tep_event *event, void *context)
50 void *data = record->data;
52 print_string(s, event, "wiphy_name", data);
53 trace_seq_printf(s, " vif:");
54 print_string(s, event, "vif_name", data);
55 tep_print_num_field(s, "(%d)", event, "vif_type", record, 1);
57 trace_seq_printf(s, "\n%*s", INDENT, "");
62 SF("shortslot"); SP();
64 trace_seq_printf(s, "\n%*s", INDENT, "");
66 SFX("assoc_cap"); SP();
67 SFX("basic_rates"); SP();
69 trace_seq_printf(s, "\n%*s", INDENT, "");
70 SF("ht_operation_mode");
75 int TEP_PLUGIN_LOADER(struct tep_handle *tep)
77 tep_register_event_handler(tep, -1, "mac80211",
78 "drv_bss_info_changed",
79 drv_bss_info_changed, NULL);
83 void TEP_PLUGIN_UNLOADER(struct tep_handle *tep)
85 tep_unregister_event_handler(tep, -1, "mac80211",
86 "drv_bss_info_changed",
87 drv_bss_info_changed, NULL);