xref: /linux/drivers/net/wireless/intel/iwlwifi/iwl-devtrace-data.h (revision 0526b56cbc3c489642bd6a5fe4b718dea7ef0ee8)
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 /******************************************************************************
3  *
4  * Copyright(c) 2009 - 2014 Intel Corporation. All rights reserved.
5  * Copyright(c) 2015        Intel Deutschland GmbH
6  * Copyright(c) 2018 - 2019 Intel Corporation
7  *****************************************************************************/
8 
9 #if !defined(__IWLWIFI_DEVICE_TRACE_DATA) || defined(TRACE_HEADER_MULTI_READ)
10 #define __IWLWIFI_DEVICE_TRACE_DATA
11 
12 #include <linux/tracepoint.h>
13 
14 #undef TRACE_SYSTEM
15 #define TRACE_SYSTEM iwlwifi_data
16 
17 TRACE_EVENT(iwlwifi_dev_tx_tb,
18 	TP_PROTO(const struct device *dev, struct sk_buff *skb,
19 		 u8 *data_src, dma_addr_t phys, size_t data_len),
20 	TP_ARGS(dev, skb, data_src, phys, data_len),
21 	TP_STRUCT__entry(
22 		DEV_ENTRY
23 		__field(u64, phys)
24 
25 		__dynamic_array(u8, data,
26 				iwl_trace_data(skb) ? data_len : 0)
27 	),
28 	TP_fast_assign(
29 		DEV_ASSIGN;
30 		__entry->phys = phys;
31 		if (iwl_trace_data(skb))
32 			memcpy(__get_dynamic_array(data), data_src, data_len);
33 	),
34 	TP_printk("[%s] TX frame data", __get_str(dev))
35 );
36 
37 TRACE_EVENT(iwlwifi_dev_rx_data,
38 	TP_PROTO(const struct device *dev,
39 		 const struct iwl_trans *trans,
40 		 void *rxbuf, size_t len),
41 	TP_ARGS(dev, trans, rxbuf, len),
42 	TP_STRUCT__entry(
43 		DEV_ENTRY
44 		__dynamic_array(u8, data,
45 				len - iwl_rx_trace_len(trans, rxbuf, len, NULL))
46 	),
47 	TP_fast_assign(
48 		size_t offs = iwl_rx_trace_len(trans, rxbuf, len, NULL);
49 		DEV_ASSIGN;
50 		if (offs < len)
51 			memcpy(__get_dynamic_array(data),
52 			       ((u8 *)rxbuf) + offs, len - offs);
53 	),
54 	TP_printk("[%s] RX frame data", __get_str(dev))
55 );
56 #endif /* __IWLWIFI_DEVICE_TRACE_DATA */
57 
58 #undef TRACE_INCLUDE_PATH
59 #define TRACE_INCLUDE_PATH .
60 #undef TRACE_INCLUDE_FILE
61 #define TRACE_INCLUDE_FILE iwl-devtrace-data
62 #include <trace/define_trace.h>
63