1 #if !defined(__IWM_TRACE_H__) || defined(TRACE_HEADER_MULTI_READ)
2 #define __IWM_TRACE_H__
4 #include <linux/tracepoint.h>
6 #if !defined(CONFIG_IWM_TRACING)
8 #define TRACE_EVENT(name, proto, ...) \
9 static inline void trace_ ## name(proto) {}
13 #define TRACE_SYSTEM iwm
15 #define IWM_ENTRY __array(char, ndev_name, 16)
16 #define IWM_ASSIGN strlcpy(__entry->ndev_name, iwm_to_ndev(iwm)->name, 16)
17 #define IWM_PR_FMT "%s"
18 #define IWM_PR_ARG __entry->ndev_name
20 TRACE_EVENT(iwm_tx_nonwifi_cmd
,
21 TP_PROTO(struct iwm_priv
*iwm
, struct iwm_udma_out_nonwifi_hdr
*hdr
),
39 __entry
->opcode
= GET_VAL32(hdr
->cmd
, UMAC_HDI_OUT_CMD_OPCODE
);
40 __entry
->resp
= GET_VAL32(hdr
->cmd
, UDMA_HDI_OUT_NW_CMD_RESP
);
41 __entry
->eot
= GET_VAL32(hdr
->cmd
, UMAC_HDI_OUT_CMD_EOT
);
42 __entry
->hw
= GET_VAL32(hdr
->cmd
, UDMA_HDI_OUT_NW_CMD_HANDLE_BY_HW
);
43 __entry
->seq
= GET_VAL32(hdr
->cmd
, UDMA_HDI_OUT_CMD_NON_WIFI_HW_SEQ_NUM
);
44 __entry
->addr
= le32_to_cpu(hdr
->addr
);
45 __entry
->op1
= le32_to_cpu(hdr
->op1_sz
);
46 __entry
->op2
= le32_to_cpu(hdr
->op2
);
50 IWM_PR_FMT
" Tx TARGET CMD: opcode 0x%x, resp %d, eot %d, "
51 "hw %d, seq 0x%x, addr 0x%x, op1 0x%x, op2 0x%x",
52 IWM_PR_ARG
, __entry
->opcode
, __entry
->resp
, __entry
->eot
,
53 __entry
->hw
, __entry
->seq
, __entry
->addr
, __entry
->op1
,
58 TRACE_EVENT(iwm_tx_wifi_cmd
,
59 TP_PROTO(struct iwm_priv
*iwm
, struct iwm_umac_wifi_out_hdr
*hdr
),
70 __field(u8
, credit_group
)
77 __entry
->opcode
= hdr
->sw_hdr
.cmd
.cmd
;
79 __entry
->seq
= __le16_to_cpu(hdr
->sw_hdr
.cmd
.seq_num
);
80 __entry
->resp
= GET_VAL8(hdr
->sw_hdr
.cmd
.flags
, UMAC_DEV_CMD_FLAGS_RESP_REQ
);
81 __entry
->color
= GET_VAL32(hdr
->sw_hdr
.meta_data
, UMAC_FW_CMD_TX_STA_COLOR
);
82 __entry
->eot
= GET_VAL32(hdr
->hw_hdr
.cmd
, UMAC_HDI_OUT_CMD_EOT
);
83 __entry
->ra_tid
= GET_VAL32(hdr
->hw_hdr
.meta_data
, UMAC_HDI_OUT_RATID
);
84 __entry
->credit_group
= GET_VAL32(hdr
->hw_hdr
.meta_data
, UMAC_HDI_OUT_CREDIT_GRP
);
85 if (__entry
->opcode
== UMAC_CMD_OPCODE_WIFI_PASS_THROUGH
||
86 __entry
->opcode
== UMAC_CMD_OPCODE_WIFI_IF_WRAPPER
) {
88 __entry
->opcode
= ((struct iwm_lmac_hdr
*)(hdr
+ 1))->id
;
93 IWM_PR_FMT
" Tx %cMAC CMD: opcode 0x%x, resp %d, eot %d, "
94 "seq 0x%x, sta_color 0x%x, ra_tid 0x%x, credit_group 0x%x",
95 IWM_PR_ARG
, __entry
->lmac
? 'L' : 'U', __entry
->opcode
,
96 __entry
->resp
, __entry
->eot
, __entry
->seq
, __entry
->color
,
97 __entry
->ra_tid
, __entry
->credit_group
101 TRACE_EVENT(iwm_tx_packets
,
102 TP_PROTO(struct iwm_priv
*iwm
, u8
*buf
, int len
),
104 TP_ARGS(iwm
, buf
, len
),
110 __field(u8
, credit_group
)
118 struct iwm_umac_wifi_out_hdr
*hdr
=
119 (struct iwm_umac_wifi_out_hdr
*)buf
;
122 __entry
->eot
= GET_VAL32(hdr
->hw_hdr
.cmd
, UMAC_HDI_OUT_CMD_EOT
);
123 __entry
->ra_tid
= GET_VAL32(hdr
->hw_hdr
.meta_data
, UMAC_HDI_OUT_RATID
);
124 __entry
->credit_group
= GET_VAL32(hdr
->hw_hdr
.meta_data
, UMAC_HDI_OUT_CREDIT_GRP
);
125 __entry
->color
= GET_VAL32(hdr
->sw_hdr
.meta_data
, UMAC_FW_CMD_TX_STA_COLOR
);
126 __entry
->seq
= __le16_to_cpu(hdr
->sw_hdr
.cmd
.seq_num
);
128 __entry
->bytes
= len
;
135 while (ptr
< buf
+ len
) {
136 count
= GET_VAL32(hdr
->sw_hdr
.meta_data
,
137 UMAC_FW_CMD_BYTE_COUNT
);
138 ptr
+= ALIGN(sizeof(*hdr
) + count
, 16);
139 hdr
= (struct iwm_umac_wifi_out_hdr
*)ptr
;
146 IWM_PR_FMT
" Tx %spacket: eot %d, seq 0x%x, sta_color 0x%x, "
147 "ra_tid 0x%x, credit_group 0x%x, embeded_packets %d, %d bytes",
148 IWM_PR_ARG
, !__entry
->eot
? "concatenated " : "",
149 __entry
->eot
, __entry
->seq
, __entry
->color
, __entry
->ra_tid
,
150 __entry
->credit_group
, __entry
->npkt
, __entry
->bytes
154 TRACE_EVENT(iwm_rx_nonwifi_cmd
,
155 TP_PROTO(struct iwm_priv
*iwm
, void *buf
, int len
),
157 TP_ARGS(iwm
, buf
, len
),
167 struct iwm_udma_in_hdr
*hdr
= buf
;
170 __entry
->opcode
= GET_VAL32(hdr
->cmd
, UDMA_HDI_IN_NW_CMD_OPCODE
);
171 __entry
->seq
= GET_VAL32(hdr
->cmd
, UDMA_HDI_IN_CMD_NON_WIFI_HW_SEQ_NUM
);
176 IWM_PR_FMT
" Rx TARGET RESP: opcode 0x%x, seq 0x%x, len 0x%x",
177 IWM_PR_ARG
, __entry
->opcode
, __entry
->seq
, __entry
->len
181 TRACE_EVENT(iwm_rx_wifi_cmd
,
182 TP_PROTO(struct iwm_priv
*iwm
, struct iwm_umac_wifi_in_hdr
*hdr
),
196 __entry
->cmd
= hdr
->sw_hdr
.cmd
.cmd
;
197 __entry
->source
= GET_VAL32(hdr
->hw_hdr
.cmd
, UMAC_HDI_IN_CMD_SOURCE
);
198 __entry
->count
= GET_VAL32(hdr
->sw_hdr
.meta_data
, UMAC_FW_CMD_BYTE_COUNT
);
199 __entry
->seq
= le16_to_cpu(hdr
->sw_hdr
.cmd
.seq_num
);
203 IWM_PR_FMT
" Rx %s RESP: cmd 0x%x, seq 0x%x, count 0x%x",
204 IWM_PR_ARG
, __entry
->source
== UMAC_HDI_IN_SOURCE_FHRX
? "LMAC" :
205 __entry
->source
== UMAC_HDI_IN_SOURCE_FW
? "UMAC" : "UDMA",
206 __entry
->cmd
, __entry
->seq
, __entry
->count
210 #define iwm_ticket_action_symbol \
211 { IWM_RX_TICKET_DROP, "DROP" }, \
212 { IWM_RX_TICKET_RELEASE, "RELEASE" }, \
213 { IWM_RX_TICKET_SNIFFER, "SNIFFER" }, \
214 { IWM_RX_TICKET_ENQUEUE, "ENQUEUE" }
216 TRACE_EVENT(iwm_rx_ticket
,
217 TP_PROTO(struct iwm_priv
*iwm
, void *buf
, int len
),
219 TP_ARGS(iwm
, buf
, len
),
230 struct iwm_rx_ticket
*ticket
=
231 ((struct iwm_umac_notif_rx_ticket
*)buf
)->tickets
;
234 __entry
->id
= le16_to_cpu(ticket
->id
);
235 __entry
->action
= le16_to_cpu(ticket
->action
);
236 __entry
->flags
= le16_to_cpu(ticket
->flags
);
237 __entry
->reason
= (__entry
->flags
& IWM_RX_TICKET_DROP_REASON_MSK
) >> IWM_RX_TICKET_DROP_REASON_POS
;
241 IWM_PR_FMT
" Rx ticket: id 0x%x, action %s, %s 0x%x%s",
242 IWM_PR_ARG
, __entry
->id
,
243 __print_symbolic(__entry
->action
, iwm_ticket_action_symbol
),
244 __entry
->reason
? "reason" : "flags",
245 __entry
->reason
? __entry
->reason
: __entry
->flags
,
246 __entry
->flags
& IWM_RX_TICKET_AMSDU_MSK
? ", AMSDU frame" : ""
250 TRACE_EVENT(iwm_rx_packet
,
251 TP_PROTO(struct iwm_priv
*iwm
, void *buf
, int len
),
253 TP_ARGS(iwm
, buf
, len
),
263 struct iwm_umac_wifi_in_hdr
*hdr
= buf
;
266 __entry
->source
= GET_VAL32(hdr
->hw_hdr
.cmd
, UMAC_HDI_IN_CMD_SOURCE
);
267 __entry
->id
= le16_to_cpu(hdr
->sw_hdr
.cmd
.seq_num
);
268 __entry
->len
= len
- sizeof(*hdr
);
272 IWM_PR_FMT
" Rx %s packet: id 0x%x, %d bytes",
273 IWM_PR_ARG
, __entry
->source
== UMAC_HDI_IN_SOURCE_FHRX
?
274 "LMAC" : "UMAC", __entry
->id
, __entry
->len
279 #undef TRACE_INCLUDE_PATH
280 #define TRACE_INCLUDE_PATH .
281 #undef TRACE_INCLUDE_FILE
282 #define TRACE_INCLUDE_FILE trace
283 #include <trace/define_trace.h>