1 /******************************************************************************
2  *
3  * Copyright(c) 2009 - 2014 Intel Corporation. All rights reserved.
4  * Copyright(c) 2015        Intel Deutschland GmbH
5  * Copyright(c) 2018        Intel Corporation
6  *
7  * This program is free software; you can redistribute it and/or modify it
8  * under the terms of version 2 of the GNU General Public License as
9  * published by the Free Software Foundation.
10  *
11  * This program is distributed in the hope that it will be useful, but WITHOUT
12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
14  * more details.
15  *
16  * The full GNU General Public License is included in this distribution in the
17  * file called LICENSE.
18  *
19  * Contact Information:
20  *  Intel Linux Wireless <linuxwifi@intel.com>
21  * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
22  *
23  *****************************************************************************/
24 
25 #if !defined(__IWLWIFI_DEVICE_TRACE_DATA) || defined(TRACE_HEADER_MULTI_READ)
26 #define __IWLWIFI_DEVICE_TRACE_DATA
27 
28 #include <linux/tracepoint.h>
29 
30 #undef TRACE_SYSTEM
31 #define TRACE_SYSTEM iwlwifi_data
32 
33 TRACE_EVENT(iwlwifi_dev_tx_data,
34 	TP_PROTO(const struct device *dev,
35 		 struct sk_buff *skb, u8 hdr_len),
36 	TP_ARGS(dev, skb, hdr_len),
37 	TP_STRUCT__entry(
38 		DEV_ENTRY
39 
40 		__dynamic_array(u8, data,
41 				iwl_trace_data(skb) ? skb->len - hdr_len : 0)
42 	),
43 	TP_fast_assign(
44 		DEV_ASSIGN;
45 		if (iwl_trace_data(skb))
46 			skb_copy_bits(skb, hdr_len,
47 				      __get_dynamic_array(data),
48 				      skb->len - hdr_len);
49 	),
50 	TP_printk("[%s] TX frame data", __get_str(dev))
51 );
52 
53 TRACE_EVENT(iwlwifi_dev_tx_tso_chunk,
54 	TP_PROTO(const struct device *dev,
55 		 u8 *data_src, size_t data_len),
56 	TP_ARGS(dev, data_src, data_len),
57 	TP_STRUCT__entry(
58 		DEV_ENTRY
59 
60 		__dynamic_array(u8, data, data_len)
61 	),
62 	TP_fast_assign(
63 		DEV_ASSIGN;
64 		memcpy(__get_dynamic_array(data), data_src, data_len);
65 	),
66 	TP_printk("[%s] TX frame data", __get_str(dev))
67 );
68 
69 TRACE_EVENT(iwlwifi_dev_rx_data,
70 	TP_PROTO(const struct device *dev,
71 		 const struct iwl_trans *trans,
72 		 void *rxbuf, size_t len),
73 	TP_ARGS(dev, trans, rxbuf, len),
74 	TP_STRUCT__entry(
75 		DEV_ENTRY
76 		__dynamic_array(u8, data,
77 				len - iwl_rx_trace_len(trans, rxbuf, len, NULL))
78 	),
79 	TP_fast_assign(
80 		size_t offs = iwl_rx_trace_len(trans, rxbuf, len, NULL);
81 		DEV_ASSIGN;
82 		if (offs < len)
83 			memcpy(__get_dynamic_array(data),
84 			       ((u8 *)rxbuf) + offs, len - offs);
85 	),
86 	TP_printk("[%s] RX frame data", __get_str(dev))
87 );
88 #endif /* __IWLWIFI_DEVICE_TRACE_DATA */
89 
90 #undef TRACE_INCLUDE_PATH
91 #define TRACE_INCLUDE_PATH .
92 #undef TRACE_INCLUDE_FILE
93 #define TRACE_INCLUDE_FILE iwl-devtrace-data
94 #include <trace/define_trace.h>
95