1 /* SPDX-License-Identifier: GPL-2.0-only */
2 /******************************************************************************
4 * Copyright(c) 2009 - 2014 Intel Corporation. All rights reserved.
5 * Copyright(c) 2015 Intel Mobile Communications GmbH
6 * Copyright(c) 2016 - 2017 Intel Deutschland GmbH
7 * Copyright(c) 2018, 2023-2024 Intel Corporation
8 *****************************************************************************/
10 #if !defined(__IWLWIFI_DEVICE_TRACE_IWLWIFI) || defined(TRACE_HEADER_MULTI_READ)
11 #define __IWLWIFI_DEVICE_TRACE_IWLWIFI
13 #include <linux/tracepoint.h>
16 #define TRACE_SYSTEM iwlwifi
18 TRACE_EVENT(iwlwifi_dev_hcmd
,
19 TP_PROTO(const struct device
*dev
,
20 struct iwl_host_cmd
*cmd
, u16 total_size
,
21 struct iwl_cmd_header_wide
*hdr
),
22 TP_ARGS(dev
, cmd
, total_size
, hdr
),
25 __dynamic_array(u8
, hcmd
, total_size
)
29 int i
, offset
= sizeof(struct iwl_cmd_header
);
32 offset
= sizeof(struct iwl_cmd_header_wide
);
35 __entry
->flags
= cmd
->flags
;
36 memcpy(__get_dynamic_array(hcmd
), hdr
, offset
);
38 for (i
= 0; i
< IWL_MAX_CMD_TBS_PER_TFD
; i
++) {
41 memcpy((u8
*)__get_dynamic_array(hcmd
) + offset
,
42 cmd
->data
[i
], cmd
->len
[i
]);
43 offset
+= cmd
->len
[i
];
46 TP_printk("[%s] hcmd %#.2x.%#.2x (%ssync)",
47 __get_str(dev
), ((u8
*)__get_dynamic_array(hcmd
))[1],
48 ((u8
*)__get_dynamic_array(hcmd
))[0],
49 __entry
->flags
& CMD_ASYNC
? "a" : "")
52 TRACE_EVENT(iwlwifi_dev_rx
,
53 TP_PROTO(const struct device
*dev
,
54 struct iwl_rx_packet
*pkt
, size_t len
, size_t trace_len
,
56 TP_ARGS(dev
, pkt
, len
, trace_len
, hdr_offset
),
60 __field(u8
, hdr_offset
)
61 __dynamic_array(u8
, rxbuf
, trace_len
)
65 __entry
->cmd
= WIDE_ID(pkt
->hdr
.group_id
, pkt
->hdr
.cmd
);
66 memcpy(__get_dynamic_array(rxbuf
), pkt
, trace_len
);
67 __entry
->hdr_offset
= hdr_offset
;
69 TP_printk("[%s] RX cmd %#.2x",
70 __get_str(dev
), __entry
->cmd
)
73 TRACE_EVENT(iwlwifi_dev_tx
,
74 TP_PROTO(const struct device
*dev
, struct sk_buff
*skb
,
75 void *tfd
, size_t tfdlen
,
76 void *buf0
, size_t buf0_len
,
78 TP_ARGS(dev
, skb
, tfd
, tfdlen
, buf0
, buf0_len
, hdr_len
),
81 __field(void *, skbaddr
)
82 __field(size_t, framelen
)
83 __dynamic_array(u8
, tfd
, tfdlen
)
86 * Do not insert between or below these items,
87 * we want to keep the frame together (except
88 * for the possible padding).
90 __dynamic_array(u8
, buf0
, buf0_len
)
91 __dynamic_array(u8
, buf1
, hdr_len
> 0 && !iwl_trace_data(skb
) ?
92 skb
->len
- hdr_len
: 0)
96 __entry
->skbaddr
= skb
;
97 __entry
->framelen
= buf0_len
;
99 __entry
->framelen
+= skb
->len
- hdr_len
;
100 memcpy(__get_dynamic_array(tfd
), tfd
, tfdlen
);
101 memcpy(__get_dynamic_array(buf0
), buf0
, buf0_len
);
102 if (__get_dynamic_array_len(buf1
))
103 skb_copy_bits(skb
, hdr_len
,
104 __get_dynamic_array(buf1
),
107 TP_printk("[%s] TX %.2x (%zu bytes) skbaddr=%p",
108 __get_str(dev
), ((u8
*)__get_dynamic_array(buf0
))[0],
109 __entry
->framelen
, __entry
->skbaddr
)
112 TRACE_EVENT(iwlwifi_dev_ucode_event
,
113 TP_PROTO(const struct device
*dev
, u32 time
, u32 data
, u32 ev
),
114 TP_ARGS(dev
, time
, data
, ev
),
124 __entry
->time
= time
;
125 __entry
->data
= data
;
128 TP_printk("[%s] EVT_LOGT:%010u:0x%08x:%04u",
129 __get_str(dev
), __entry
->time
, __entry
->data
, __entry
->ev
)
131 #endif /* __IWLWIFI_DEVICE_TRACE_IWLWIFI */
133 #undef TRACE_INCLUDE_PATH
134 #define TRACE_INCLUDE_PATH .
135 #undef TRACE_INCLUDE_FILE
136 #define TRACE_INCLUDE_FILE iwl-devtrace-iwlwifi
137 #include <trace/define_trace.h>