WIP FPC-III support
[linux/fpc-iii.git] / drivers / net / wireless / intel / iwlwifi / iwl-devtrace-iwlwifi.h
blob72ca882daed5e0a686751da01258f342bec39034
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 /******************************************************************************
4 * Copyright(c) 2009 - 2014 Intel Corporation. All rights reserved.
5 * Copyright(c) 2015 Intel Mobile Communications GmbH
6 * Copyright(c) 2016 - 2017 Intel Deutschland GmbH
7 * Copyright(c) 2018 Intel Corporation
9 * Contact Information:
10 * Intel Linux Wireless <linuxwifi@intel.com>
11 * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
13 *****************************************************************************/
15 #if !defined(__IWLWIFI_DEVICE_TRACE_IWLWIFI) || defined(TRACE_HEADER_MULTI_READ)
16 #define __IWLWIFI_DEVICE_TRACE_IWLWIFI
18 #include <linux/tracepoint.h>
20 #undef TRACE_SYSTEM
21 #define TRACE_SYSTEM iwlwifi
23 TRACE_EVENT(iwlwifi_dev_hcmd,
24 TP_PROTO(const struct device *dev,
25 struct iwl_host_cmd *cmd, u16 total_size,
26 struct iwl_cmd_header_wide *hdr),
27 TP_ARGS(dev, cmd, total_size, hdr),
28 TP_STRUCT__entry(
29 DEV_ENTRY
30 __dynamic_array(u8, hcmd, total_size)
31 __field(u32, flags)
33 TP_fast_assign(
34 int i, offset = sizeof(struct iwl_cmd_header);
36 if (hdr->group_id)
37 offset = sizeof(struct iwl_cmd_header_wide);
39 DEV_ASSIGN;
40 __entry->flags = cmd->flags;
41 memcpy(__get_dynamic_array(hcmd), hdr, offset);
43 for (i = 0; i < IWL_MAX_CMD_TBS_PER_TFD; i++) {
44 if (!cmd->len[i])
45 continue;
46 memcpy((u8 *)__get_dynamic_array(hcmd) + offset,
47 cmd->data[i], cmd->len[i]);
48 offset += cmd->len[i];
51 TP_printk("[%s] hcmd %#.2x.%#.2x (%ssync)",
52 __get_str(dev), ((u8 *)__get_dynamic_array(hcmd))[1],
53 ((u8 *)__get_dynamic_array(hcmd))[0],
54 __entry->flags & CMD_ASYNC ? "a" : "")
57 TRACE_EVENT(iwlwifi_dev_rx,
58 TP_PROTO(const struct device *dev, const struct iwl_trans *trans,
59 struct iwl_rx_packet *pkt, size_t len),
60 TP_ARGS(dev, trans, pkt, len),
61 TP_STRUCT__entry(
62 DEV_ENTRY
63 __field(u16, cmd)
64 __field(u8, hdr_offset)
65 __dynamic_array(u8, rxbuf,
66 iwl_rx_trace_len(trans, pkt, len, NULL))
68 TP_fast_assign(
69 size_t hdr_offset = 0;
71 DEV_ASSIGN;
72 __entry->cmd = WIDE_ID(pkt->hdr.group_id, pkt->hdr.cmd);
73 memcpy(__get_dynamic_array(rxbuf), pkt,
74 iwl_rx_trace_len(trans, pkt, len, &hdr_offset));
75 __entry->hdr_offset = hdr_offset;
77 TP_printk("[%s] RX cmd %#.2x",
78 __get_str(dev), __entry->cmd)
81 TRACE_EVENT(iwlwifi_dev_tx,
82 TP_PROTO(const struct device *dev, struct sk_buff *skb,
83 void *tfd, size_t tfdlen,
84 void *buf0, size_t buf0_len,
85 int hdr_len),
86 TP_ARGS(dev, skb, tfd, tfdlen, buf0, buf0_len, hdr_len),
87 TP_STRUCT__entry(
88 DEV_ENTRY
89 __field(void *, skbaddr)
90 __field(size_t, framelen)
91 __dynamic_array(u8, tfd, tfdlen)
94 * Do not insert between or below these items,
95 * we want to keep the frame together (except
96 * for the possible padding).
98 __dynamic_array(u8, buf0, buf0_len)
99 __dynamic_array(u8, buf1, hdr_len > 0 && iwl_trace_data(skb) ?
100 0 : skb->len - hdr_len)
102 TP_fast_assign(
103 DEV_ASSIGN;
104 __entry->skbaddr = skb;
105 __entry->framelen = buf0_len;
106 if (hdr_len > 0)
107 __entry->framelen += skb->len - hdr_len;
108 memcpy(__get_dynamic_array(tfd), tfd, tfdlen);
109 memcpy(__get_dynamic_array(buf0), buf0, buf0_len);
110 if (hdr_len > 0 && !iwl_trace_data(skb))
111 skb_copy_bits(skb, hdr_len,
112 __get_dynamic_array(buf1),
113 skb->len - hdr_len);
115 TP_printk("[%s] TX %.2x (%zu bytes) skbaddr=%p",
116 __get_str(dev), ((u8 *)__get_dynamic_array(buf0))[0],
117 __entry->framelen, __entry->skbaddr)
120 TRACE_EVENT(iwlwifi_dev_ucode_event,
121 TP_PROTO(const struct device *dev, u32 time, u32 data, u32 ev),
122 TP_ARGS(dev, time, data, ev),
123 TP_STRUCT__entry(
124 DEV_ENTRY
126 __field(u32, time)
127 __field(u32, data)
128 __field(u32, ev)
130 TP_fast_assign(
131 DEV_ASSIGN;
132 __entry->time = time;
133 __entry->data = data;
134 __entry->ev = ev;
136 TP_printk("[%s] EVT_LOGT:%010u:0x%08x:%04u",
137 __get_str(dev), __entry->time, __entry->data, __entry->ev)
139 #endif /* __IWLWIFI_DEVICE_TRACE_IWLWIFI */
141 #undef TRACE_INCLUDE_PATH
142 #define TRACE_INCLUDE_PATH .
143 #undef TRACE_INCLUDE_FILE
144 #define TRACE_INCLUDE_FILE iwl-devtrace-iwlwifi
145 #include <trace/define_trace.h>