summaryrefslogtreecommitdiff
path: root/drivers/net/wireless/ath/ath6kl/trace.h
blob: 9db616c2ac96596f522df6c7b583f2a4ec5f3329 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
#if !defined(_ATH6KL_TRACE_H) || defined(TRACE_HEADER_MULTI_READ)

#include <net/cfg80211.h>
#include <linux/skbuff.h>
#include <linux/tracepoint.h>
#include "wmi.h"
#include "hif.h"

#if !defined(_ATH6KL_TRACE_H)
static inline unsigned int ath6kl_get_wmi_id(void *buf, size_t buf_len)
{
	struct wmi_cmd_hdr *hdr = buf;

	if (buf_len < sizeof(*hdr))
		return 0;

	return le16_to_cpu(hdr->cmd_id);
}
#endif /* __ATH6KL_TRACE_H */

#define _ATH6KL_TRACE_H

/* create empty functions when tracing is disabled */
#if !defined(CONFIG_ATH6KL_TRACING)
#undef TRACE_EVENT
#define TRACE_EVENT(name, proto, ...) \
static inline void trace_ ## name(proto) {}
#endif /* !CONFIG_ATH6KL_TRACING || __CHECKER__ */

#undef TRACE_SYSTEM
#define TRACE_SYSTEM ath6kl

TRACE_EVENT(ath6kl_wmi_cmd,
	TP_PROTO(void *buf, size_t buf_len),

	TP_ARGS(buf, buf_len),

	TP_STRUCT__entry(
		__field(unsigned int, id)
		__field(size_t, buf_len)
		__dynamic_array(u8, buf, buf_len)
	),

	TP_fast_assign(
		__entry->id = ath6kl_get_wmi_id(buf, buf_len);
		__entry->buf_len = buf_len;
		memcpy(__get_dynamic_array(buf), buf, buf_len);
	),

	TP_printk(
		"id %d len %d",
		__entry->id, __entry->buf_len
	)
);

TRACE_EVENT(ath6kl_wmi_event,
	TP_PROTO(void *buf, size_t buf_len),

	TP_ARGS(buf, buf_len),

	TP_STRUCT__entry(
		__field(unsigned int, id)
		__field(size_t, buf_len)
		__dynamic_array(u8, buf, buf_len)
	),

	TP_fast_assign(
		__entry->id = ath6kl_get_wmi_id(buf, buf_len);
		__entry->buf_len = buf_len;
		memcpy(__get_dynamic_array(buf), buf, buf_len);
	),

	TP_printk(
		"id %d len %d",
		__entry->id, __entry->buf_len
	)
);

TRACE_EVENT(ath6kl_sdio,
	TP_PROTO(unsigned int addr, int flags,
		 void *buf, size_t buf_len),

	TP_ARGS(addr, flags, buf, buf_len),

	TP_STRUCT__entry(
		__field(unsigned int, tx)
		__field(unsigned int, addr)
		__field(int, flags)
		__field(size_t, buf_len)
		__dynamic_array(u8, buf, buf_len)
	),

	TP_fast_assign(
		__entry->addr = addr;
		__entry->flags = flags;
		__entry->buf_len = buf_len;
		memcpy(__get_dynamic_array(buf), buf, buf_len);

		if (flags & HIF_WRITE)
			__entry->tx = 1;
		else
			__entry->tx = 0;
	),

	TP_printk(
		"%s addr 0x%x flags 0x%x len %d\n",
		__entry->tx ? "tx" : "rx",
		__entry->addr,
		__entry->flags,
		__entry->buf_len
	)
);

TRACE_EVENT(ath6kl_sdio_scat,
	TP_PROTO(unsigned int addr, int flags, unsigned int total_len,
		 unsigned int entries, struct hif_scatter_item *list),

	TP_ARGS(addr, flags, total_len, entries, list),

	TP_STRUCT__entry(
		__field(unsigned int, tx)
		__field(unsigned int, addr)
		__field(int, flags)
		__field(unsigned int, entries)
		__field(size_t, total_len)
		__dynamic_array(unsigned int, len_array, entries)
		__dynamic_array(u8, data, total_len)
	),

	TP_fast_assign(
		unsigned int *len_array;
		int i, offset = 0;
		size_t len;

		__entry->addr = addr;
		__entry->flags = flags;
		__entry->entries = entries;
		__entry->total_len = total_len;

		if (flags & HIF_WRITE)
			__entry->tx = 1;
		else
			__entry->tx = 0;

		len_array = __get_dynamic_array(len_array);

		for (i = 0; i < entries; i++) {
			len = list[i].len;

			memcpy((u8 *) __get_dynamic_array(data) + offset,
			       list[i].buf, len);

			len_array[i] = len;
			offset += len;
		}
	),

	TP_printk(
		"%s addr 0x%x flags 0x%x entries %d total_len %d\n",
		__entry->tx ? "tx" : "rx",
		__entry->addr,
		__entry->flags,
		__entry->entries,
		__entry->total_len
	)
);

#endif /* _ ATH6KL_TRACE_H || TRACE_HEADER_MULTI_READ*/

/* we don't want to use include/trace/events */
#undef TRACE_INCLUDE_PATH
#define TRACE_INCLUDE_PATH .
#undef TRACE_INCLUDE_FILE
#define TRACE_INCLUDE_FILE trace

/* This part must be outside protection */
#include <trace/define_trace.h>