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_tb,
34 	TP_PROTO(const struct device *dev, struct sk_buff *skb,
35 		 u8 *data_src, size_t data_len),
36 	TP_ARGS(dev, skb, data_src, data_len),
37 	TP_STRUCT__entry(
38 		DEV_ENTRY
39 
40 		__dynamic_array(u8, data,
41 				iwl_trace_data(skb) ? data_len : 0)
42 	),
43 	TP_fast_assign(
44 		DEV_ASSIGN;
45 		if (iwl_trace_data(skb))
46 			memcpy(__get_dynamic_array(data), data_src, data_len);
47 	),
48 	TP_printk("[%s] TX frame data", __get_str(dev))
49 );
50 
51 TRACE_EVENT(iwlwifi_dev_rx_data,
52 	TP_PROTO(const struct device *dev,
53 		 const struct iwl_trans *trans,
54 		 void *rxbuf, size_t len),
55 	TP_ARGS(dev, trans, rxbuf, len),
56 	TP_STRUCT__entry(
57 		DEV_ENTRY
58 		__dynamic_array(u8, data,
59 				len - iwl_rx_trace_len(trans, rxbuf, len, NULL))
60 	),
61 	TP_fast_assign(
62 		size_t offs = iwl_rx_trace_len(trans, rxbuf, len, NULL);
63 		DEV_ASSIGN;
64 		if (offs < len)
65 			memcpy(__get_dynamic_array(data),
66 			       ((u8 *)rxbuf) + offs, len - offs);
67 	),
68 	TP_printk("[%s] RX frame data", __get_str(dev))
69 );
70 #endif /* __IWLWIFI_DEVICE_TRACE_DATA */
71 
72 #undef TRACE_INCLUDE_PATH
73 #define TRACE_INCLUDE_PATH .
74 #undef TRACE_INCLUDE_FILE
75 #define TRACE_INCLUDE_FILE iwl-devtrace-data
76 #include <trace/define_trace.h>
77