WIP FPC-III support
[linux/fpc-iii.git] / tools / lib / traceevent / plugins / plugin_mac80211.c
blobf48071e3cfb831160d95cb826cb6615ca9f7f2af
1 // SPDX-License-Identifier: LGPL-2.1
2 /*
3 * Copyright (C) 2009 Johannes Berg <johannes@sipsolutions.net>
4 */
5 #include <stdio.h>
6 #include <stdlib.h>
7 #include <string.h>
9 #include "event-parse.h"
10 #include "trace-seq.h"
12 #define INDENT 65
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);
18 int offset;
19 int length;
21 if (!f) {
22 trace_seq_printf(s, "NOTFOUND:%s", name);
23 return;
26 offset = f->offset;
27 length = f->size;
29 if (!strncmp(f->type, "__data_loc", 10)) {
30 unsigned long long v;
31 if (tep_read_number_field(f, data, &v)) {
32 trace_seq_printf(s, "invalid_data_loc");
33 return;
35 offset = v & 0xffff;
36 length = v >> 16;
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, "");
58 SF("assoc"); SP();
59 SF("aid"); SP();
60 SF("cts"); SP();
61 SF("shortpre"); SP();
62 SF("shortslot"); SP();
63 SF("dtimper"); SP();
64 trace_seq_printf(s, "\n%*s", INDENT, "");
65 SF("bcnint"); SP();
66 SFX("assoc_cap"); SP();
67 SFX("basic_rates"); SP();
68 SF("enable_beacon");
69 trace_seq_printf(s, "\n%*s", INDENT, "");
70 SF("ht_operation_mode");
72 return 0;
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);
80 return 0;
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);