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