1 /* SPDX-License-Identifier: GPL-2.0 */
2 #if !defined(__TRACE_ATH5K_H) || defined(TRACE_HEADER_MULTI_READ)
3 #define __TRACE_ATH5K_H
4 
5 #include <linux/tracepoint.h>
6 
7 
8 #if !defined(CONFIG_ATH5K_TRACER) || defined(__CHECKER__)
9 #undef TRACE_EVENT
10 #define TRACE_EVENT(name, proto, ...) \
11 static inline void trace_ ## name(proto) {}
12 #endif
13 
14 struct sk_buff;
15 struct ath5k_txq;
16 struct ath5k_tx_status;
17 
18 #undef TRACE_SYSTEM
19 #define TRACE_SYSTEM ath5k
20 
21 TRACE_EVENT(ath5k_rx,
22 	TP_PROTO(struct ath5k_hw *priv, struct sk_buff *skb),
23 	TP_ARGS(priv, skb),
24 	TP_STRUCT__entry(
25 		__field(struct ath5k_hw *, priv)
26 		__field(unsigned long, skbaddr)
27 		__dynamic_array(u8, frame, skb->len)
28 	),
29 	TP_fast_assign(
30 		__entry->priv = priv;
31 		__entry->skbaddr = (unsigned long) skb;
32 		memcpy(__get_dynamic_array(frame), skb->data, skb->len);
33 	),
34 	TP_printk(
35 		"[%p] RX skb=%lx", __entry->priv, __entry->skbaddr
36 	)
37 );
38 
39 TRACE_EVENT(ath5k_tx,
40 	TP_PROTO(struct ath5k_hw *priv, struct sk_buff *skb,
41 		 struct ath5k_txq *q),
42 
43 	TP_ARGS(priv, skb, q),
44 
45 	TP_STRUCT__entry(
46 		__field(struct ath5k_hw *, priv)
47 		__field(unsigned long, skbaddr)
48 		__field(u8, qnum)
49 		__dynamic_array(u8, frame, skb->len)
50 	),
51 
52 	TP_fast_assign(
53 		__entry->priv = priv;
54 		__entry->skbaddr = (unsigned long) skb;
55 		__entry->qnum = (u8) q->qnum;
56 		memcpy(__get_dynamic_array(frame), skb->data, skb->len);
57 	),
58 
59 	TP_printk(
60 		"[%p] TX skb=%lx q=%d", __entry->priv, __entry->skbaddr,
61 		__entry->qnum
62 	)
63 );
64 
65 TRACE_EVENT(ath5k_tx_complete,
66 	TP_PROTO(struct ath5k_hw *priv, struct sk_buff *skb,
67 		 struct ath5k_txq *q, struct ath5k_tx_status *ts),
68 
69 	TP_ARGS(priv, skb, q, ts),
70 
71 	TP_STRUCT__entry(
72 		__field(struct ath5k_hw *, priv)
73 		__field(unsigned long, skbaddr)
74 		__field(u8, qnum)
75 		__field(u8, ts_status)
76 		__field(s8, ts_rssi)
77 		__field(u8, ts_antenna)
78 	),
79 
80 	TP_fast_assign(
81 		__entry->priv = priv;
82 		__entry->skbaddr = (unsigned long) skb;
83 		__entry->qnum = (u8) q->qnum;
84 		__entry->ts_status = ts->ts_status;
85 		__entry->ts_rssi =  ts->ts_rssi;
86 		__entry->ts_antenna = ts->ts_antenna;
87 	),
88 
89 	TP_printk(
90 		"[%p] TX end skb=%lx q=%d stat=%x rssi=%d ant=%x",
91 		__entry->priv, __entry->skbaddr, __entry->qnum,
92 		__entry->ts_status, __entry->ts_rssi, __entry->ts_antenna
93 	)
94 );
95 
96 #endif /* __TRACE_ATH5K_H */
97 
98 #if defined(CONFIG_ATH5K_TRACER) && !defined(__CHECKER__)
99 
100 #undef TRACE_INCLUDE_PATH
101 #define TRACE_INCLUDE_PATH .
102 #undef TRACE_INCLUDE_FILE
103 #define TRACE_INCLUDE_FILE trace
104 
105 #include <trace/define_trace.h>
106 
107 #endif
108