1 /* SPDX-License-Identifier: GPL-2.0-only */
2 /*
3  * Copyright(c) 2021        Intel Corporation
4  */
5 
6 #if !defined(CONFIG_IWLWIFI_DEVICE_TRACING)
7 
8 #define trace_iwlmei_sap_cmd(...)
9 #define trace_iwlmei_me_msg(...)
10 
11 #else
12 
13 #if !defined(__IWLWIFI_DEVICE_TRACE_IWLWIFI_SAP_CMD) || defined(TRACE_HEADER_MULTI_READ)
14 #define __IWLWIFI_DEVICE_TRACE_IWLWIFI_SAP_CMD
15 
16 #include <linux/tracepoint.h>
17 
18 #undef TRACE_SYSTEM
19 #define TRACE_SYSTEM iwlmei_sap_cmd
20 
21 #include "mei/sap.h"
22 
23 TRACE_EVENT(iwlmei_sap_cmd,
24 	TP_PROTO(const struct iwl_sap_hdr *sap_cmd, bool tx),
25 	TP_ARGS(sap_cmd, tx),
26 	TP_STRUCT__entry(
27 		__dynamic_array(u8, cmd,
28 				le16_to_cpu(sap_cmd->len) + sizeof(*sap_cmd))
29 		__field(u8, tx)
30 		__field(u16, type)
31 		__field(u16, len)
32 		__field(u32, seq)
33 	),
34 	TP_fast_assign(
35 		memcpy(__get_dynamic_array(cmd), sap_cmd,
36 		       le16_to_cpu(sap_cmd->len) + sizeof(*sap_cmd));
37 		__entry->tx = tx;
38 		__entry->type = le16_to_cpu(sap_cmd->type);
39 		__entry->len = le16_to_cpu(sap_cmd->len);
40 		__entry->seq = le32_to_cpu(sap_cmd->seq_num);
41 	),
42 	TP_printk("sap_cmd %s: type %d len %d seq %d", __entry->tx ? "Tx" : "Rx",
43 		  __entry->type, __entry->len, __entry->seq)
44 );
45 
46 TRACE_EVENT(iwlmei_me_msg,
47 	TP_PROTO(const struct iwl_sap_me_msg_hdr *hdr, bool tx),
48 	TP_ARGS(hdr, tx),
49 	TP_STRUCT__entry(
50 		__field(u8, type)
51 		__field(u8, tx)
52 		__field(u32, seq_num)
53 	),
54 	TP_fast_assign(
55 		__entry->type = le32_to_cpu(hdr->type);
56 		__entry->seq_num = le32_to_cpu(hdr->seq_num);
57 		__entry->tx = tx;
58 	),
59 	TP_printk("ME message: %s: type %d seq %d", __entry->tx ? "Tx" : "Rx",
60 		  __entry->type, __entry->seq_num)
61 );
62 
63 /*
64  * If you add something here, add a stub in case
65  * !defined(CONFIG_IWLWIFI_DEVICE_TRACING)
66  */
67 
68 #endif /* __IWLWIFI_DEVICE_TRACE_IWLWIFI_SAP_CMD */
69 
70 #undef TRACE_INCLUDE_PATH
71 #define TRACE_INCLUDE_PATH .
72 #undef TRACE_INCLUDE_FILE
73 #define TRACE_INCLUDE_FILE trace
74 #include <trace/define_trace.h>
75 
76 #endif /* CONFIG_IWLWIFI_DEVICE_TRACING */
77