1 /****************************************************************************** 2 * 3 * Copyright(c) 2009 - 2014 Intel Corporation. All rights reserved. 4 * Copyright(c) 2015 Intel Mobile Communications GmbH 5 * Copyright(c) 2016 Intel Deutschland GmbH 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 * You should have received a copy of the GNU General Public License along with 17 * this program; if not, write to the Free Software Foundation, Inc., 18 * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA 19 * 20 * The full GNU General Public License is included in this distribution in the 21 * file called LICENSE. 22 * 23 * Contact Information: 24 * Intel Linux Wireless <linuxwifi@intel.com> 25 * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 26 * 27 *****************************************************************************/ 28 29 #if !defined(__IWLWIFI_DEVICE_TRACE_IWLWIFI) || defined(TRACE_HEADER_MULTI_READ) 30 #define __IWLWIFI_DEVICE_TRACE_IWLWIFI 31 32 #include <linux/tracepoint.h> 33 34 #undef TRACE_SYSTEM 35 #define TRACE_SYSTEM iwlwifi 36 37 TRACE_EVENT(iwlwifi_dev_hcmd, 38 TP_PROTO(const struct device *dev, 39 struct iwl_host_cmd *cmd, u16 total_size, 40 struct iwl_cmd_header_wide *hdr), 41 TP_ARGS(dev, cmd, total_size, hdr), 42 TP_STRUCT__entry( 43 DEV_ENTRY 44 __dynamic_array(u8, hcmd, total_size) 45 __field(u32, flags) 46 ), 47 TP_fast_assign( 48 int i, offset = sizeof(struct iwl_cmd_header); 49 50 if (hdr->group_id) 51 offset = sizeof(struct iwl_cmd_header_wide); 52 53 DEV_ASSIGN; 54 __entry->flags = cmd->flags; 55 memcpy(__get_dynamic_array(hcmd), hdr, offset); 56 57 for (i = 0; i < IWL_MAX_CMD_TBS_PER_TFD; i++) { 58 if (!cmd->len[i]) 59 continue; 60 memcpy((u8 *)__get_dynamic_array(hcmd) + offset, 61 cmd->data[i], cmd->len[i]); 62 offset += cmd->len[i]; 63 } 64 ), 65 TP_printk("[%s] hcmd %#.2x.%#.2x (%ssync)", 66 __get_str(dev), ((u8 *)__get_dynamic_array(hcmd))[1], 67 ((u8 *)__get_dynamic_array(hcmd))[0], 68 __entry->flags & CMD_ASYNC ? "a" : "") 69 ); 70 71 TRACE_EVENT(iwlwifi_dev_rx, 72 TP_PROTO(const struct device *dev, const struct iwl_trans *trans, 73 struct iwl_rx_packet *pkt, size_t len), 74 TP_ARGS(dev, trans, pkt, len), 75 TP_STRUCT__entry( 76 DEV_ENTRY 77 __field(u16, cmd) 78 __dynamic_array(u8, rxbuf, iwl_rx_trace_len(trans, pkt, len)) 79 ), 80 TP_fast_assign( 81 DEV_ASSIGN; 82 __entry->cmd = WIDE_ID(pkt->hdr.group_id, pkt->hdr.cmd); 83 memcpy(__get_dynamic_array(rxbuf), pkt, 84 iwl_rx_trace_len(trans, pkt, len)); 85 ), 86 TP_printk("[%s] RX cmd %#.2x", 87 __get_str(dev), __entry->cmd) 88 ); 89 90 TRACE_EVENT(iwlwifi_dev_tx, 91 TP_PROTO(const struct device *dev, struct sk_buff *skb, 92 void *tfd, size_t tfdlen, 93 void *buf0, size_t buf0_len, 94 void *buf1, size_t buf1_len), 95 TP_ARGS(dev, skb, tfd, tfdlen, buf0, buf0_len, buf1, buf1_len), 96 TP_STRUCT__entry( 97 DEV_ENTRY 98 99 __field(size_t, framelen) 100 __dynamic_array(u8, tfd, tfdlen) 101 102 /* 103 * Do not insert between or below these items, 104 * we want to keep the frame together (except 105 * for the possible padding). 106 */ 107 __dynamic_array(u8, buf0, buf0_len) 108 __dynamic_array(u8, buf1, iwl_trace_data(skb) ? 0 : buf1_len) 109 ), 110 TP_fast_assign( 111 DEV_ASSIGN; 112 __entry->framelen = buf0_len + buf1_len; 113 memcpy(__get_dynamic_array(tfd), tfd, tfdlen); 114 memcpy(__get_dynamic_array(buf0), buf0, buf0_len); 115 if (!iwl_trace_data(skb)) 116 memcpy(__get_dynamic_array(buf1), buf1, buf1_len); 117 ), 118 TP_printk("[%s] TX %.2x (%zu bytes)", 119 __get_str(dev), ((u8 *)__get_dynamic_array(buf0))[0], 120 __entry->framelen) 121 ); 122 123 TRACE_EVENT(iwlwifi_dev_ucode_error, 124 TP_PROTO(const struct device *dev, u32 desc, u32 tsf_low, 125 u32 data1, u32 data2, u32 line, u32 blink2, u32 ilink1, 126 u32 ilink2, u32 bcon_time, u32 gp1, u32 gp2, u32 rev_type, 127 u32 major, u32 minor, u32 hw_ver, u32 brd_ver), 128 TP_ARGS(dev, desc, tsf_low, data1, data2, line, 129 blink2, ilink1, ilink2, bcon_time, gp1, gp2, 130 rev_type, major, minor, hw_ver, brd_ver), 131 TP_STRUCT__entry( 132 DEV_ENTRY 133 __field(u32, desc) 134 __field(u32, tsf_low) 135 __field(u32, data1) 136 __field(u32, data2) 137 __field(u32, line) 138 __field(u32, blink2) 139 __field(u32, ilink1) 140 __field(u32, ilink2) 141 __field(u32, bcon_time) 142 __field(u32, gp1) 143 __field(u32, gp2) 144 __field(u32, rev_type) 145 __field(u32, major) 146 __field(u32, minor) 147 __field(u32, hw_ver) 148 __field(u32, brd_ver) 149 ), 150 TP_fast_assign( 151 DEV_ASSIGN; 152 __entry->desc = desc; 153 __entry->tsf_low = tsf_low; 154 __entry->data1 = data1; 155 __entry->data2 = data2; 156 __entry->line = line; 157 __entry->blink2 = blink2; 158 __entry->ilink1 = ilink1; 159 __entry->ilink2 = ilink2; 160 __entry->bcon_time = bcon_time; 161 __entry->gp1 = gp1; 162 __entry->gp2 = gp2; 163 __entry->rev_type = rev_type; 164 __entry->major = major; 165 __entry->minor = minor; 166 __entry->hw_ver = hw_ver; 167 __entry->brd_ver = brd_ver; 168 ), 169 TP_printk("[%s] #%02d %010u data 0x%08X 0x%08X line %u, " 170 "blink2 0x%05X ilink 0x%05X 0x%05X " 171 "bcon_tm %010u gp 0x%08X 0x%08X rev_type 0x%08X major 0x%08X " 172 "minor 0x%08X hw 0x%08X brd 0x%08X", 173 __get_str(dev), __entry->desc, __entry->tsf_low, 174 __entry->data1, __entry->data2, __entry->line, 175 __entry->blink2, __entry->ilink1, __entry->ilink2, 176 __entry->bcon_time, __entry->gp1, __entry->gp2, 177 __entry->rev_type, __entry->major, __entry->minor, 178 __entry->hw_ver, __entry->brd_ver) 179 ); 180 181 TRACE_EVENT(iwlwifi_dev_ucode_event, 182 TP_PROTO(const struct device *dev, u32 time, u32 data, u32 ev), 183 TP_ARGS(dev, time, data, ev), 184 TP_STRUCT__entry( 185 DEV_ENTRY 186 187 __field(u32, time) 188 __field(u32, data) 189 __field(u32, ev) 190 ), 191 TP_fast_assign( 192 DEV_ASSIGN; 193 __entry->time = time; 194 __entry->data = data; 195 __entry->ev = ev; 196 ), 197 TP_printk("[%s] EVT_LOGT:%010u:0x%08x:%04u", 198 __get_str(dev), __entry->time, __entry->data, __entry->ev) 199 ); 200 #endif /* __IWLWIFI_DEVICE_TRACE_IWLWIFI */ 201 202 #undef TRACE_INCLUDE_PATH 203 #define TRACE_INCLUDE_PATH . 204 #undef TRACE_INCLUDE_FILE 205 #define TRACE_INCLUDE_FILE iwl-devtrace-iwlwifi 206 #include <trace/define_trace.h> 207