Loading...
Note: File does not exist in v3.15.
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>
8
9#include "event-parse.h"
10#include "trace-seq.h"
11
12#define INDENT 65
13
14static void print_string(struct trace_seq *s, struct tep_event *event,
15 const char *name, const void *data)
16{
17 struct tep_format_field *f = tep_find_field(event, name);
18 int offset;
19 int length;
20
21 if (!f) {
22 trace_seq_printf(s, "NOTFOUND:%s", name);
23 return;
24 }
25
26 offset = f->offset;
27 length = f->size;
28
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;
34 }
35 offset = v & 0xffff;
36 length = v >> 16;
37 }
38
39 trace_seq_printf(s, "%.*s", length, (char *)data + offset);
40}
41
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, ' ')
45
46static int drv_bss_info_changed(struct trace_seq *s,
47 struct tep_record *record,
48 struct tep_event *event, void *context)
49{
50 void *data = record->data;
51
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);
56
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");
71
72 return 0;
73}
74
75int TEP_PLUGIN_LOADER(struct tep_handle *tep)
76{
77 tep_register_event_handler(tep, -1, "mac80211",
78 "drv_bss_info_changed",
79 drv_bss_info_changed, NULL);
80 return 0;
81}
82
83void TEP_PLUGIN_UNLOADER(struct tep_handle *tep)
84{
85 tep_unregister_event_handler(tep, -1, "mac80211",
86 "drv_bss_info_changed",
87 drv_bss_info_changed, NULL);
88}