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