1 /* SPDX-License-Identifier: GPL-2.0-only */
3 * Copyright (C) 2014 Felix Fietkau <nbd@openwrt.org>
4 * Copyright (C) 2015 Jakub Kicinski <kubakici@wp.pl>
7 #if !defined(__MT7601U_TRACE_H) || defined(TRACE_HEADER_MULTI_READ)
8 #define __MT7601U_TRACE_H
10 #include <linux/tracepoint.h>
15 #define TRACE_SYSTEM mt7601u
18 #define DEV_ENTRY __array(char, wiphy_name, 32)
19 #define DEV_ASSIGN strlcpy(__entry->wiphy_name, \
20 wiphy_name(dev->hw->wiphy), MAXNAME)
21 #define DEV_PR_FMT "%s "
22 #define DEV_PR_ARG __entry->wiphy_name
24 #define REG_ENTRY __field(u32, reg) __field(u32, val)
25 #define REG_ASSIGN __entry->reg = reg; __entry->val = val
26 #define REG_PR_FMT "%04x=%08x"
27 #define REG_PR_ARG __entry->reg, __entry->val
29 DECLARE_EVENT_CLASS(dev_reg_evtu
,
30 TP_PROTO(struct mt7601u_dev
*dev
, u32 reg
, u32 val
),
31 TP_ARGS(dev
, reg
, val
),
41 DEV_PR_FMT REG_PR_FMT
,
42 DEV_PR_ARG
, REG_PR_ARG
46 DEFINE_EVENT(dev_reg_evtu
, reg_read
,
47 TP_PROTO(struct mt7601u_dev
*dev
, u32 reg
, u32 val
),
48 TP_ARGS(dev
, reg
, val
)
51 DEFINE_EVENT(dev_reg_evtu
, reg_write
,
52 TP_PROTO(struct mt7601u_dev
*dev
, u32 reg
, u32 val
),
53 TP_ARGS(dev
, reg
, val
)
56 TRACE_EVENT(mt_submit_urb
,
57 TP_PROTO(struct mt7601u_dev
*dev
, struct urb
*u
),
60 DEV_ENTRY
__field(unsigned, pipe
) __field(u32
, len
)
64 __entry
->pipe
= u
->pipe
;
65 __entry
->len
= u
->transfer_buffer_length
;
67 TP_printk(DEV_PR_FMT
"p:%08x len:%u",
68 DEV_PR_ARG
, __entry
->pipe
, __entry
->len
)
71 #define trace_mt_submit_urb_sync(__dev, __pipe, __len) ({ \
74 u.transfer_buffer_length = __len; \
75 trace_mt_submit_urb(__dev, &u); \
78 TRACE_EVENT(mt_mcu_msg_send
,
79 TP_PROTO(struct mt7601u_dev
*dev
,
80 struct sk_buff
*skb
, u32 csum
, bool resp
),
81 TP_ARGS(dev
, skb
, csum
, resp
),
90 __entry
->info
= *(u32
*)skb
->data
;
94 TP_printk(DEV_PR_FMT
"i:%08x c:%08x r:%d",
95 DEV_PR_ARG
, __entry
->info
, __entry
->csum
, __entry
->resp
)
98 TRACE_EVENT(mt_vend_req
,
99 TP_PROTO(struct mt7601u_dev
*dev
, unsigned pipe
, u8 req
, u8 req_type
,
100 u16 val
, u16 offset
, void *buf
, size_t buflen
, int ret
),
101 TP_ARGS(dev
, pipe
, req
, req_type
, val
, offset
, buf
, buflen
, ret
),
104 __field(unsigned, pipe
) __field(u8
, req
) __field(u8
, req_type
)
105 __field(u16
, val
) __field(u16
, offset
) __field(void*, buf
)
106 __field(int, buflen
) __field(int, ret
)
110 __entry
->pipe
= pipe
;
112 __entry
->req_type
= req_type
;
114 __entry
->offset
= offset
;
116 __entry
->buflen
= buflen
;
120 "%d p:%08x req:%02hhx %02hhx val:%04hx %04hx buf:%d %d",
121 DEV_PR_ARG
, __entry
->ret
, __entry
->pipe
, __entry
->req
,
122 __entry
->req_type
, __entry
->val
, __entry
->offset
,
123 !!__entry
->buf
, __entry
->buflen
)
127 TP_PROTO(struct mt7601u_dev
*dev
, int offset
, u16 val
),
128 TP_ARGS(dev
, offset
, val
),
131 __field(int, o
) __field(u16
, v
)
138 TP_printk(DEV_PR_FMT
"%04x=%04x", DEV_PR_ARG
, __entry
->o
, __entry
->v
)
141 DECLARE_EVENT_CLASS(dev_rf_reg_evt
,
142 TP_PROTO(struct mt7601u_dev
*dev
, u8 bank
, u8 reg
, u8 val
),
143 TP_ARGS(dev
, bank
, reg
, val
),
153 __entry
->bank
= bank
;
156 DEV_PR_FMT
"%02hhx:%02hhx=%02hhx",
157 DEV_PR_ARG
, __entry
->bank
, __entry
->reg
, __entry
->val
161 DEFINE_EVENT(dev_rf_reg_evt
, rf_read
,
162 TP_PROTO(struct mt7601u_dev
*dev
, u8 bank
, u8 reg
, u8 val
),
163 TP_ARGS(dev
, bank
, reg
, val
)
166 DEFINE_EVENT(dev_rf_reg_evt
, rf_write
,
167 TP_PROTO(struct mt7601u_dev
*dev
, u8 bank
, u8 reg
, u8 val
),
168 TP_ARGS(dev
, bank
, reg
, val
)
171 DECLARE_EVENT_CLASS(dev_bbp_reg_evt
,
172 TP_PROTO(struct mt7601u_dev
*dev
, u8 reg
, u8 val
),
173 TP_ARGS(dev
, reg
, val
),
184 DEV_PR_FMT
"%02hhx=%02hhx",
185 DEV_PR_ARG
, __entry
->reg
, __entry
->val
189 DEFINE_EVENT(dev_bbp_reg_evt
, bbp_read
,
190 TP_PROTO(struct mt7601u_dev
*dev
, u8 reg
, u8 val
),
191 TP_ARGS(dev
, reg
, val
)
194 DEFINE_EVENT(dev_bbp_reg_evt
, bbp_write
,
195 TP_PROTO(struct mt7601u_dev
*dev
, u8 reg
, u8 val
),
196 TP_ARGS(dev
, reg
, val
)
199 DECLARE_EVENT_CLASS(dev_simple_evt
,
200 TP_PROTO(struct mt7601u_dev
*dev
, u8 val
),
211 DEV_PR_FMT
"%02hhx", DEV_PR_ARG
, __entry
->val
215 DEFINE_EVENT(dev_simple_evt
, temp_mode
,
216 TP_PROTO(struct mt7601u_dev
*dev
, u8 val
),
220 DEFINE_EVENT(dev_simple_evt
, read_temp
,
221 TP_PROTO(struct mt7601u_dev
*dev
, u8 val
),
225 DEFINE_EVENT(dev_simple_evt
, freq_cal_adjust
,
226 TP_PROTO(struct mt7601u_dev
*dev
, u8 val
),
230 TRACE_EVENT(freq_cal_offset
,
231 TP_PROTO(struct mt7601u_dev
*dev
, u8 phy_mode
, s8 freq_off
),
232 TP_ARGS(dev
, phy_mode
, freq_off
),
235 __field(u8
, phy_mode
)
236 __field(s8
, freq_off
)
240 __entry
->phy_mode
= phy_mode
;
241 __entry
->freq_off
= freq_off
;
243 TP_printk(DEV_PR_FMT
"phy:%02hhx off:%02hhx",
244 DEV_PR_ARG
, __entry
->phy_mode
, __entry
->freq_off
)
248 TP_PROTO(struct mt7601u_dev
*dev
, struct mt7601u_rxwi
*rxwi
, u32 f
),
249 TP_ARGS(dev
, rxwi
, f
),
252 __field_struct(struct mt7601u_rxwi
, rxwi
)
253 __field(u32
, fce_info
)
257 __entry
->rxwi
= *rxwi
;
258 __entry
->fce_info
= f
;
260 TP_printk(DEV_PR_FMT
"rxi:%08x ctl:%08x frag_sn:%04hx rate:%04hx "
261 "uknw:%02hhx z:%02hhx%02hhx%02hhx snr:%02hhx "
262 "ant:%02hhx gain:%02hhx freq_o:%02hhx "
263 "r:%08x ea:%08x fce:%08x", DEV_PR_ARG
,
264 le32_to_cpu(__entry
->rxwi
.rxinfo
),
265 le32_to_cpu(__entry
->rxwi
.ctl
),
266 le16_to_cpu(__entry
->rxwi
.frag_sn
),
267 le16_to_cpu(__entry
->rxwi
.rate
),
268 __entry
->rxwi
.unknown
,
269 __entry
->rxwi
.zero
[0], __entry
->rxwi
.zero
[1],
270 __entry
->rxwi
.zero
[2],
271 __entry
->rxwi
.snr
, __entry
->rxwi
.ant
,
272 __entry
->rxwi
.gain
, __entry
->rxwi
.freq_off
,
273 __entry
->rxwi
.resv2
, __entry
->rxwi
.expert_ant
,
278 TP_PROTO(struct mt7601u_dev
*dev
, struct sk_buff
*skb
,
279 struct mt76_sta
*sta
, struct mt76_txwi
*h
),
280 TP_ARGS(dev
, skb
, sta
, h
),
283 __field_struct(struct mt76_txwi
, h
)
284 __field(struct sk_buff
*, skb
)
285 __field(struct mt76_sta
*, sta
)
293 TP_printk(DEV_PR_FMT
"skb:%p sta:%p flg:%04hx rate_ctl:%04hx "
294 "ack:%02hhx wcid:%02hhx len_ctl:%05hx", DEV_PR_ARG
,
295 __entry
->skb
, __entry
->sta
,
296 le16_to_cpu(__entry
->h
.flags
),
297 le16_to_cpu(__entry
->h
.rate_ctl
),
298 __entry
->h
.ack_ctl
, __entry
->h
.wcid
,
299 le16_to_cpu(__entry
->h
.len_ctl
))
302 TRACE_EVENT(mt_tx_dma_done
,
303 TP_PROTO(struct mt7601u_dev
*dev
, struct sk_buff
*skb
),
307 __field(struct sk_buff
*, skb
)
313 TP_printk(DEV_PR_FMT
"%p", DEV_PR_ARG
, __entry
->skb
)
316 TRACE_EVENT(mt_tx_status_cleaned
,
317 TP_PROTO(struct mt7601u_dev
*dev
, int cleaned
),
318 TP_ARGS(dev
, cleaned
),
321 __field(int, cleaned
)
325 __entry
->cleaned
= cleaned
;
327 TP_printk(DEV_PR_FMT
"%d", DEV_PR_ARG
, __entry
->cleaned
)
330 TRACE_EVENT(mt_tx_status
,
331 TP_PROTO(struct mt7601u_dev
*dev
, u32 stat1
, u32 stat2
),
332 TP_ARGS(dev
, stat1
, stat2
),
335 __field(u32
, stat1
) __field(u32
, stat2
)
339 __entry
->stat1
= stat1
;
340 __entry
->stat2
= stat2
;
342 TP_printk(DEV_PR_FMT
"%08x %08x",
343 DEV_PR_ARG
, __entry
->stat1
, __entry
->stat2
)
346 TRACE_EVENT(mt_rx_dma_aggr
,
347 TP_PROTO(struct mt7601u_dev
*dev
, int cnt
, bool paged
),
348 TP_ARGS(dev
, cnt
, paged
),
357 __entry
->paged
= paged
;
359 TP_printk(DEV_PR_FMT
"cnt:%d paged:%d",
360 DEV_PR_ARG
, __entry
->cnt
, __entry
->paged
)
363 DEFINE_EVENT(dev_simple_evt
, set_key
,
364 TP_PROTO(struct mt7601u_dev
*dev
, u8 val
),
368 TRACE_EVENT(set_shared_key
,
369 TP_PROTO(struct mt7601u_dev
*dev
, u8 vid
, u8 key
),
370 TP_ARGS(dev
, vid
, key
),
381 TP_printk(DEV_PR_FMT
"phy:%02hhx off:%02hhx",
382 DEV_PR_ARG
, __entry
->vid
, __entry
->key
)
387 #undef TRACE_INCLUDE_PATH
388 #define TRACE_INCLUDE_PATH .
389 #undef TRACE_INCLUDE_FILE
390 #define TRACE_INCLUDE_FILE trace
392 #include <trace/define_trace.h>