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  * Contact Information:
9  *  Intel Linux Wireless <linuxwifi@intel.com>
10  * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
11  *
12  *****************************************************************************/
13 
14 #if !defined(__IWLWIFI_DEVICE_TRACE_DATA) || defined(TRACE_HEADER_MULTI_READ)
15 #define __IWLWIFI_DEVICE_TRACE_DATA
16 
17 #include <linux/tracepoint.h>
18 
19 #undef TRACE_SYSTEM
20 #define TRACE_SYSTEM iwlwifi_data
21 
22 TRACE_EVENT(iwlwifi_dev_tx_tb,
23 	TP_PROTO(const struct device *dev, struct sk_buff *skb,
24 		 u8 *data_src, dma_addr_t phys, size_t data_len),
25 	TP_ARGS(dev, skb, data_src, phys, data_len),
26 	TP_STRUCT__entry(
27 		DEV_ENTRY
28 		__field(u64, phys)
29 
30 		__dynamic_array(u8, data,
31 				iwl_trace_data(skb) ? data_len : 0)
32 	),
33 	TP_fast_assign(
34 		DEV_ASSIGN;
35 		__entry->phys = phys;
36 		if (iwl_trace_data(skb))
37 			memcpy(__get_dynamic_array(data), data_src, data_len);
38 	),
39 	TP_printk("[%s] TX frame data", __get_str(dev))
40 );
41 
42 TRACE_EVENT(iwlwifi_dev_rx_data,
43 	TP_PROTO(const struct device *dev,
44 		 const struct iwl_trans *trans,
45 		 void *rxbuf, size_t len),
46 	TP_ARGS(dev, trans, rxbuf, len),
47 	TP_STRUCT__entry(
48 		DEV_ENTRY
49 		__dynamic_array(u8, data,
50 				len - iwl_rx_trace_len(trans, rxbuf, len, NULL))
51 	),
52 	TP_fast_assign(
53 		size_t offs = iwl_rx_trace_len(trans, rxbuf, len, NULL);
54 		DEV_ASSIGN;
55 		if (offs < len)
56 			memcpy(__get_dynamic_array(data),
57 			       ((u8 *)rxbuf) + offs, len - offs);
58 	),
59 	TP_printk("[%s] RX frame data", __get_str(dev))
60 );
61 #endif /* __IWLWIFI_DEVICE_TRACE_DATA */
62 
63 #undef TRACE_INCLUDE_PATH
64 #define TRACE_INCLUDE_PATH .
65 #undef TRACE_INCLUDE_FILE
66 #define TRACE_INCLUDE_FILE iwl-devtrace-data
67 #include <trace/define_trace.h>
68