xref: /openbmc/linux/drivers/net/wireless/mediatek/mt76/usb_trace.h (revision c900529f3d9161bfde5cca0754f83b4d3c3e0220)
10e3d6777SRyder Lee /* SPDX-License-Identifier: ISC */
2b40b15e1SLorenzo Bianconi /*
3b40b15e1SLorenzo Bianconi  * Copyright (C) 2018 Lorenzo Bianconi <lorenzo.bianconi83@gmail.com>
4b40b15e1SLorenzo Bianconi  */
5b40b15e1SLorenzo Bianconi 
6b40b15e1SLorenzo Bianconi #if !defined(__MT76_USB_TRACE_H) || defined(TRACE_HEADER_MULTI_READ)
7b40b15e1SLorenzo Bianconi #define __MT76_USB_TRACE_H
8b40b15e1SLorenzo Bianconi 
9b40b15e1SLorenzo Bianconi #include <linux/tracepoint.h>
10b40b15e1SLorenzo Bianconi #include "mt76.h"
11b40b15e1SLorenzo Bianconi 
12b40b15e1SLorenzo Bianconi #undef TRACE_SYSTEM
13b40b15e1SLorenzo Bianconi #define TRACE_SYSTEM mt76_usb
14b40b15e1SLorenzo Bianconi 
15b40b15e1SLorenzo Bianconi #define MAXNAME		32
16b40b15e1SLorenzo Bianconi #define DEV_ENTRY	__array(char, wiphy_name, 32)
17*d6b484b5SAzeem Shaikh #define DEV_ASSIGN	strscpy(__entry->wiphy_name,	\
1813381dcdSRyder Lee 				wiphy_name(dev->hw->wiphy), MAXNAME)
19b40b15e1SLorenzo Bianconi #define DEV_PR_FMT	"%s "
20b40b15e1SLorenzo Bianconi #define DEV_PR_ARG	__entry->wiphy_name
21b40b15e1SLorenzo Bianconi 
22b40b15e1SLorenzo Bianconi #define REG_ENTRY	__field(u32, reg) __field(u32, val)
23b40b15e1SLorenzo Bianconi #define REG_ASSIGN	__entry->reg = reg; __entry->val = val
24e0168dc6SLorenzo Bianconi #define REG_PR_FMT	"reg:0x%04x=0x%08x"
25b40b15e1SLorenzo Bianconi #define REG_PR_ARG	__entry->reg, __entry->val
26b40b15e1SLorenzo Bianconi 
27b40b15e1SLorenzo Bianconi DECLARE_EVENT_CLASS(dev_reg_evt,
28b40b15e1SLorenzo Bianconi 	TP_PROTO(struct mt76_dev *dev, u32 reg, u32 val),
29b40b15e1SLorenzo Bianconi 	TP_ARGS(dev, reg, val),
30b40b15e1SLorenzo Bianconi 	TP_STRUCT__entry(
31b40b15e1SLorenzo Bianconi 		DEV_ENTRY
32b40b15e1SLorenzo Bianconi 		REG_ENTRY
33b40b15e1SLorenzo Bianconi 	),
34b40b15e1SLorenzo Bianconi 	TP_fast_assign(
35b40b15e1SLorenzo Bianconi 		DEV_ASSIGN;
36b40b15e1SLorenzo Bianconi 		REG_ASSIGN;
37b40b15e1SLorenzo Bianconi 	),
38b40b15e1SLorenzo Bianconi 	TP_printk(
39b40b15e1SLorenzo Bianconi 		DEV_PR_FMT REG_PR_FMT,
40b40b15e1SLorenzo Bianconi 		DEV_PR_ARG, REG_PR_ARG
41b40b15e1SLorenzo Bianconi 	)
42b40b15e1SLorenzo Bianconi );
43b40b15e1SLorenzo Bianconi 
44b40b15e1SLorenzo Bianconi DEFINE_EVENT(dev_reg_evt, usb_reg_rr,
45b40b15e1SLorenzo Bianconi 	TP_PROTO(struct mt76_dev *dev, u32 reg, u32 val),
46b40b15e1SLorenzo Bianconi 	TP_ARGS(dev, reg, val)
47b40b15e1SLorenzo Bianconi );
48b40b15e1SLorenzo Bianconi 
49b40b15e1SLorenzo Bianconi DEFINE_EVENT(dev_reg_evt, usb_reg_wr,
50b40b15e1SLorenzo Bianconi 	TP_PROTO(struct mt76_dev *dev, u32 reg, u32 val),
51b40b15e1SLorenzo Bianconi 	TP_ARGS(dev, reg, val)
52b40b15e1SLorenzo Bianconi );
53b40b15e1SLorenzo Bianconi 
54e0168dc6SLorenzo Bianconi DECLARE_EVENT_CLASS(urb_transfer,
55e0168dc6SLorenzo Bianconi 	TP_PROTO(struct mt76_dev *dev, struct urb *u),
56e0168dc6SLorenzo Bianconi 	TP_ARGS(dev, u),
57e0168dc6SLorenzo Bianconi 	TP_STRUCT__entry(
5813381dcdSRyder Lee 		DEV_ENTRY __field(unsigned int, pipe) __field(u32, len)
59e0168dc6SLorenzo Bianconi 	),
60e0168dc6SLorenzo Bianconi 	TP_fast_assign(
61e0168dc6SLorenzo Bianconi 		DEV_ASSIGN;
62e0168dc6SLorenzo Bianconi 		__entry->pipe = u->pipe;
63e0168dc6SLorenzo Bianconi 		__entry->len = u->transfer_buffer_length;
64e0168dc6SLorenzo Bianconi 	),
65e0168dc6SLorenzo Bianconi 	TP_printk(DEV_PR_FMT "p:%08x len:%u",
66e0168dc6SLorenzo Bianconi 		  DEV_PR_ARG, __entry->pipe, __entry->len)
67e0168dc6SLorenzo Bianconi );
68e0168dc6SLorenzo Bianconi 
69e0168dc6SLorenzo Bianconi DEFINE_EVENT(urb_transfer, submit_urb,
70e0168dc6SLorenzo Bianconi 	TP_PROTO(struct mt76_dev *dev, struct urb *u),
71e0168dc6SLorenzo Bianconi 	TP_ARGS(dev, u)
72e0168dc6SLorenzo Bianconi );
73e0168dc6SLorenzo Bianconi 
74e0168dc6SLorenzo Bianconi DEFINE_EVENT(urb_transfer, rx_urb,
75e0168dc6SLorenzo Bianconi 	TP_PROTO(struct mt76_dev *dev, struct urb *u),
76e0168dc6SLorenzo Bianconi 	TP_ARGS(dev, u)
77e0168dc6SLorenzo Bianconi );
78e0168dc6SLorenzo Bianconi 
79b40b15e1SLorenzo Bianconi #endif
80b40b15e1SLorenzo Bianconi 
81b40b15e1SLorenzo Bianconi #undef TRACE_INCLUDE_PATH
82b40b15e1SLorenzo Bianconi #define TRACE_INCLUDE_PATH .
83b40b15e1SLorenzo Bianconi #undef TRACE_INCLUDE_FILE
84b40b15e1SLorenzo Bianconi #define TRACE_INCLUDE_FILE usb_trace
85b40b15e1SLorenzo Bianconi 
86b40b15e1SLorenzo Bianconi #include <trace/define_trace.h>
87