Reinette Chatre | bb5d2db | 2010-01-15 13:42:59 -0800 | [diff] [blame] | 1 | /****************************************************************************** |
| 2 | * |
Johannes Berg | 128e63e | 2013-01-21 21:39:26 +0100 | [diff] [blame] | 3 | * Copyright(c) 2009 - 2013 Intel Corporation. All rights reserved. |
Reinette Chatre | bb5d2db | 2010-01-15 13:42:59 -0800 | [diff] [blame] | 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 | |
Johannes Berg | be1a71a | 2009-10-02 13:44:02 -0700 | [diff] [blame] | 27 | #if !defined(__IWLWIFI_DEVICE_TRACE) || defined(TRACE_HEADER_MULTI_READ) |
Johannes Berg | f042c2e | 2012-09-05 22:34:44 +0200 | [diff] [blame] | 28 | #include <linux/skbuff.h> |
| 29 | #include <linux/ieee80211.h> |
| 30 | #include <net/cfg80211.h> |
| 31 | #include "iwl-trans.h" |
| 32 | #if !defined(__IWLWIFI_DEVICE_TRACE) |
| 33 | static inline bool iwl_trace_data(struct sk_buff *skb) |
| 34 | { |
| 35 | struct ieee80211_hdr *hdr = (void *)skb->data; |
Johannes Berg | af61a16 | 2013-07-02 18:09:12 +0200 | [diff] [blame] | 36 | struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); |
Johannes Berg | f042c2e | 2012-09-05 22:34:44 +0200 | [diff] [blame] | 37 | |
Johannes Berg | af61a16 | 2013-07-02 18:09:12 +0200 | [diff] [blame] | 38 | if (!ieee80211_is_data(hdr->frame_control)) |
| 39 | return false; |
| 40 | return !(info->control.flags & IEEE80211_TX_CTRL_PORT_CTRL_PROTO); |
Johannes Berg | f042c2e | 2012-09-05 22:34:44 +0200 | [diff] [blame] | 41 | } |
| 42 | |
| 43 | static inline size_t iwl_rx_trace_len(const struct iwl_trans *trans, |
| 44 | void *rxbuf, size_t len) |
| 45 | { |
| 46 | struct iwl_cmd_header *cmd = (void *)((u8 *)rxbuf + sizeof(__le32)); |
| 47 | struct ieee80211_hdr *hdr; |
| 48 | |
| 49 | if (cmd->cmd != trans->rx_mpdu_cmd) |
| 50 | return len; |
| 51 | |
| 52 | hdr = (void *)((u8 *)cmd + sizeof(struct iwl_cmd_header) + |
| 53 | trans->rx_mpdu_cmd_hdr_size); |
| 54 | if (!ieee80211_is_data(hdr->frame_control)) |
| 55 | return len; |
| 56 | /* maybe try to identify EAPOL frames? */ |
| 57 | return sizeof(__le32) + sizeof(*cmd) + trans->rx_mpdu_cmd_hdr_size + |
| 58 | ieee80211_hdrlen(hdr->frame_control); |
| 59 | } |
| 60 | #endif |
| 61 | |
Johannes Berg | be1a71a | 2009-10-02 13:44:02 -0700 | [diff] [blame] | 62 | #define __IWLWIFI_DEVICE_TRACE |
| 63 | |
| 64 | #include <linux/tracepoint.h> |
Johannes Berg | 1023fdc | 2012-05-15 12:16:34 +0200 | [diff] [blame] | 65 | #include <linux/device.h> |
Johannes Berg | 45eab7c | 2012-09-05 00:33:53 +0200 | [diff] [blame] | 66 | #include "iwl-trans.h" |
Johannes Berg | be1a71a | 2009-10-02 13:44:02 -0700 | [diff] [blame] | 67 | |
Emmanuel Grumbach | 83ed901 | 2011-08-25 23:11:14 -0700 | [diff] [blame] | 68 | |
Johannes Berg | be1a71a | 2009-10-02 13:44:02 -0700 | [diff] [blame] | 69 | #if !defined(CONFIG_IWLWIFI_DEVICE_TRACING) || defined(__CHECKER__) |
| 70 | #undef TRACE_EVENT |
| 71 | #define TRACE_EVENT(name, proto, ...) \ |
| 72 | static inline void trace_ ## name(proto) {} |
Johannes Berg | 2655e31 | 2012-01-31 21:08:37 -0800 | [diff] [blame] | 73 | #undef DECLARE_EVENT_CLASS |
| 74 | #define DECLARE_EVENT_CLASS(...) |
| 75 | #undef DEFINE_EVENT |
| 76 | #define DEFINE_EVENT(evt_class, name, proto, ...) \ |
| 77 | static inline void trace_ ## name(proto) {} |
Johannes Berg | be1a71a | 2009-10-02 13:44:02 -0700 | [diff] [blame] | 78 | #endif |
| 79 | |
Johannes Berg | 6c1011e | 2012-03-06 13:30:48 -0800 | [diff] [blame] | 80 | #define DEV_ENTRY __string(dev, dev_name(dev)) |
| 81 | #define DEV_ASSIGN __assign_str(dev, dev_name(dev)) |
Johannes Berg | be1a71a | 2009-10-02 13:44:02 -0700 | [diff] [blame] | 82 | |
| 83 | #undef TRACE_SYSTEM |
Johannes Berg | 0fd95af | 2009-11-20 12:05:02 -0800 | [diff] [blame] | 84 | #define TRACE_SYSTEM iwlwifi_io |
Johannes Berg | be1a71a | 2009-10-02 13:44:02 -0700 | [diff] [blame] | 85 | |
| 86 | TRACE_EVENT(iwlwifi_dev_ioread32, |
Johannes Berg | 6c1011e | 2012-03-06 13:30:48 -0800 | [diff] [blame] | 87 | TP_PROTO(const struct device *dev, u32 offs, u32 val), |
| 88 | TP_ARGS(dev, offs, val), |
Johannes Berg | be1a71a | 2009-10-02 13:44:02 -0700 | [diff] [blame] | 89 | TP_STRUCT__entry( |
Johannes Berg | 6c1011e | 2012-03-06 13:30:48 -0800 | [diff] [blame] | 90 | DEV_ENTRY |
Johannes Berg | be1a71a | 2009-10-02 13:44:02 -0700 | [diff] [blame] | 91 | __field(u32, offs) |
| 92 | __field(u32, val) |
| 93 | ), |
| 94 | TP_fast_assign( |
Johannes Berg | 6c1011e | 2012-03-06 13:30:48 -0800 | [diff] [blame] | 95 | DEV_ASSIGN; |
Johannes Berg | be1a71a | 2009-10-02 13:44:02 -0700 | [diff] [blame] | 96 | __entry->offs = offs; |
| 97 | __entry->val = val; |
| 98 | ), |
Johannes Berg | 6c1011e | 2012-03-06 13:30:48 -0800 | [diff] [blame] | 99 | TP_printk("[%s] read io[%#x] = %#x", |
| 100 | __get_str(dev), __entry->offs, __entry->val) |
Johannes Berg | be1a71a | 2009-10-02 13:44:02 -0700 | [diff] [blame] | 101 | ); |
| 102 | |
Ben Cahill | 4e03185 | 2009-11-20 12:04:52 -0800 | [diff] [blame] | 103 | TRACE_EVENT(iwlwifi_dev_iowrite8, |
Johannes Berg | 6c1011e | 2012-03-06 13:30:48 -0800 | [diff] [blame] | 104 | TP_PROTO(const struct device *dev, u32 offs, u8 val), |
| 105 | TP_ARGS(dev, offs, val), |
Ben Cahill | 4e03185 | 2009-11-20 12:04:52 -0800 | [diff] [blame] | 106 | TP_STRUCT__entry( |
Johannes Berg | 6c1011e | 2012-03-06 13:30:48 -0800 | [diff] [blame] | 107 | DEV_ENTRY |
Ben Cahill | 4e03185 | 2009-11-20 12:04:52 -0800 | [diff] [blame] | 108 | __field(u32, offs) |
| 109 | __field(u8, val) |
| 110 | ), |
| 111 | TP_fast_assign( |
Johannes Berg | 6c1011e | 2012-03-06 13:30:48 -0800 | [diff] [blame] | 112 | DEV_ASSIGN; |
Ben Cahill | 4e03185 | 2009-11-20 12:04:52 -0800 | [diff] [blame] | 113 | __entry->offs = offs; |
| 114 | __entry->val = val; |
| 115 | ), |
Johannes Berg | 6c1011e | 2012-03-06 13:30:48 -0800 | [diff] [blame] | 116 | TP_printk("[%s] write io[%#x] = %#x)", |
| 117 | __get_str(dev), __entry->offs, __entry->val) |
Ben Cahill | 4e03185 | 2009-11-20 12:04:52 -0800 | [diff] [blame] | 118 | ); |
| 119 | |
Johannes Berg | be1a71a | 2009-10-02 13:44:02 -0700 | [diff] [blame] | 120 | TRACE_EVENT(iwlwifi_dev_iowrite32, |
Johannes Berg | 6c1011e | 2012-03-06 13:30:48 -0800 | [diff] [blame] | 121 | TP_PROTO(const struct device *dev, u32 offs, u32 val), |
| 122 | TP_ARGS(dev, offs, val), |
Johannes Berg | be1a71a | 2009-10-02 13:44:02 -0700 | [diff] [blame] | 123 | TP_STRUCT__entry( |
Johannes Berg | 6c1011e | 2012-03-06 13:30:48 -0800 | [diff] [blame] | 124 | DEV_ENTRY |
Johannes Berg | be1a71a | 2009-10-02 13:44:02 -0700 | [diff] [blame] | 125 | __field(u32, offs) |
| 126 | __field(u32, val) |
| 127 | ), |
| 128 | TP_fast_assign( |
Johannes Berg | 6c1011e | 2012-03-06 13:30:48 -0800 | [diff] [blame] | 129 | DEV_ASSIGN; |
Johannes Berg | be1a71a | 2009-10-02 13:44:02 -0700 | [diff] [blame] | 130 | __entry->offs = offs; |
| 131 | __entry->val = val; |
| 132 | ), |
Johannes Berg | 6c1011e | 2012-03-06 13:30:48 -0800 | [diff] [blame] | 133 | TP_printk("[%s] write io[%#x] = %#x)", |
| 134 | __get_str(dev), __entry->offs, __entry->val) |
Johannes Berg | be1a71a | 2009-10-02 13:44:02 -0700 | [diff] [blame] | 135 | ); |
| 136 | |
Emmanuel Grumbach | 6a06b6c | 2012-12-02 13:07:30 +0200 | [diff] [blame] | 137 | TRACE_EVENT(iwlwifi_dev_iowrite_prph32, |
| 138 | TP_PROTO(const struct device *dev, u32 offs, u32 val), |
| 139 | TP_ARGS(dev, offs, val), |
| 140 | TP_STRUCT__entry( |
| 141 | DEV_ENTRY |
| 142 | __field(u32, offs) |
| 143 | __field(u32, val) |
| 144 | ), |
| 145 | TP_fast_assign( |
| 146 | DEV_ASSIGN; |
| 147 | __entry->offs = offs; |
| 148 | __entry->val = val; |
| 149 | ), |
| 150 | TP_printk("[%s] write PRPH[%#x] = %#x)", |
| 151 | __get_str(dev), __entry->offs, __entry->val) |
| 152 | ); |
| 153 | |
| 154 | TRACE_EVENT(iwlwifi_dev_ioread_prph32, |
| 155 | TP_PROTO(const struct device *dev, u32 offs, u32 val), |
| 156 | TP_ARGS(dev, offs, val), |
| 157 | TP_STRUCT__entry( |
| 158 | DEV_ENTRY |
| 159 | __field(u32, offs) |
| 160 | __field(u32, val) |
| 161 | ), |
| 162 | TP_fast_assign( |
| 163 | DEV_ASSIGN; |
| 164 | __entry->offs = offs; |
| 165 | __entry->val = val; |
| 166 | ), |
| 167 | TP_printk("[%s] read PRPH[%#x] = %#x", |
| 168 | __get_str(dev), __entry->offs, __entry->val) |
| 169 | ); |
| 170 | |
Johannes Berg | b80667e | 2011-12-09 07:26:13 -0800 | [diff] [blame] | 171 | TRACE_EVENT(iwlwifi_dev_irq, |
Johannes Berg | 6c1011e | 2012-03-06 13:30:48 -0800 | [diff] [blame] | 172 | TP_PROTO(const struct device *dev), |
| 173 | TP_ARGS(dev), |
Johannes Berg | b80667e | 2011-12-09 07:26:13 -0800 | [diff] [blame] | 174 | TP_STRUCT__entry( |
Johannes Berg | 6c1011e | 2012-03-06 13:30:48 -0800 | [diff] [blame] | 175 | DEV_ENTRY |
Johannes Berg | b80667e | 2011-12-09 07:26:13 -0800 | [diff] [blame] | 176 | ), |
| 177 | TP_fast_assign( |
Johannes Berg | 6c1011e | 2012-03-06 13:30:48 -0800 | [diff] [blame] | 178 | DEV_ASSIGN; |
Johannes Berg | b80667e | 2011-12-09 07:26:13 -0800 | [diff] [blame] | 179 | ), |
| 180 | /* TP_printk("") doesn't compile */ |
| 181 | TP_printk("%d", 0) |
| 182 | ); |
| 183 | |
| 184 | TRACE_EVENT(iwlwifi_dev_ict_read, |
Johannes Berg | 6c1011e | 2012-03-06 13:30:48 -0800 | [diff] [blame] | 185 | TP_PROTO(const struct device *dev, u32 index, u32 value), |
| 186 | TP_ARGS(dev, index, value), |
Johannes Berg | b80667e | 2011-12-09 07:26:13 -0800 | [diff] [blame] | 187 | TP_STRUCT__entry( |
Johannes Berg | 6c1011e | 2012-03-06 13:30:48 -0800 | [diff] [blame] | 188 | DEV_ENTRY |
Johannes Berg | b80667e | 2011-12-09 07:26:13 -0800 | [diff] [blame] | 189 | __field(u32, index) |
| 190 | __field(u32, value) |
| 191 | ), |
| 192 | TP_fast_assign( |
Johannes Berg | 6c1011e | 2012-03-06 13:30:48 -0800 | [diff] [blame] | 193 | DEV_ASSIGN; |
Johannes Berg | b80667e | 2011-12-09 07:26:13 -0800 | [diff] [blame] | 194 | __entry->index = index; |
| 195 | __entry->value = value; |
| 196 | ), |
Johannes Berg | 6c1011e | 2012-03-06 13:30:48 -0800 | [diff] [blame] | 197 | TP_printk("[%s] read ict[%d] = %#.8x", |
| 198 | __get_str(dev), __entry->index, __entry->value) |
Johannes Berg | b80667e | 2011-12-09 07:26:13 -0800 | [diff] [blame] | 199 | ); |
| 200 | |
Johannes Berg | 0fd95af | 2009-11-20 12:05:02 -0800 | [diff] [blame] | 201 | #undef TRACE_SYSTEM |
Wey-Yi Guy | a9e1cb6 | 2009-12-10 14:37:26 -0800 | [diff] [blame] | 202 | #define TRACE_SYSTEM iwlwifi_ucode |
| 203 | |
| 204 | TRACE_EVENT(iwlwifi_dev_ucode_cont_event, |
Johannes Berg | 6c1011e | 2012-03-06 13:30:48 -0800 | [diff] [blame] | 205 | TP_PROTO(const struct device *dev, u32 time, u32 data, u32 ev), |
| 206 | TP_ARGS(dev, time, data, ev), |
Wey-Yi Guy | a9e1cb6 | 2009-12-10 14:37:26 -0800 | [diff] [blame] | 207 | TP_STRUCT__entry( |
Johannes Berg | 6c1011e | 2012-03-06 13:30:48 -0800 | [diff] [blame] | 208 | DEV_ENTRY |
Wey-Yi Guy | a9e1cb6 | 2009-12-10 14:37:26 -0800 | [diff] [blame] | 209 | |
| 210 | __field(u32, time) |
| 211 | __field(u32, data) |
| 212 | __field(u32, ev) |
| 213 | ), |
| 214 | TP_fast_assign( |
Johannes Berg | 6c1011e | 2012-03-06 13:30:48 -0800 | [diff] [blame] | 215 | DEV_ASSIGN; |
Wey-Yi Guy | a9e1cb6 | 2009-12-10 14:37:26 -0800 | [diff] [blame] | 216 | __entry->time = time; |
| 217 | __entry->data = data; |
| 218 | __entry->ev = ev; |
| 219 | ), |
Johannes Berg | 6c1011e | 2012-03-06 13:30:48 -0800 | [diff] [blame] | 220 | TP_printk("[%s] EVT_LOGT:%010u:0x%08x:%04u", |
| 221 | __get_str(dev), __entry->time, __entry->data, __entry->ev) |
Wey-Yi Guy | a9e1cb6 | 2009-12-10 14:37:26 -0800 | [diff] [blame] | 222 | ); |
| 223 | |
| 224 | TRACE_EVENT(iwlwifi_dev_ucode_wrap_event, |
Johannes Berg | 6c1011e | 2012-03-06 13:30:48 -0800 | [diff] [blame] | 225 | TP_PROTO(const struct device *dev, u32 wraps, u32 n_entry, u32 p_entry), |
| 226 | TP_ARGS(dev, wraps, n_entry, p_entry), |
Wey-Yi Guy | a9e1cb6 | 2009-12-10 14:37:26 -0800 | [diff] [blame] | 227 | TP_STRUCT__entry( |
Johannes Berg | 6c1011e | 2012-03-06 13:30:48 -0800 | [diff] [blame] | 228 | DEV_ENTRY |
Wey-Yi Guy | a9e1cb6 | 2009-12-10 14:37:26 -0800 | [diff] [blame] | 229 | |
| 230 | __field(u32, wraps) |
| 231 | __field(u32, n_entry) |
| 232 | __field(u32, p_entry) |
| 233 | ), |
| 234 | TP_fast_assign( |
Johannes Berg | 6c1011e | 2012-03-06 13:30:48 -0800 | [diff] [blame] | 235 | DEV_ASSIGN; |
Wey-Yi Guy | a9e1cb6 | 2009-12-10 14:37:26 -0800 | [diff] [blame] | 236 | __entry->wraps = wraps; |
| 237 | __entry->n_entry = n_entry; |
| 238 | __entry->p_entry = p_entry; |
| 239 | ), |
Johannes Berg | 6c1011e | 2012-03-06 13:30:48 -0800 | [diff] [blame] | 240 | TP_printk("[%s] wraps=#%02d n=0x%X p=0x%X", |
| 241 | __get_str(dev), __entry->wraps, __entry->n_entry, |
Wey-Yi Guy | a9e1cb6 | 2009-12-10 14:37:26 -0800 | [diff] [blame] | 242 | __entry->p_entry) |
| 243 | ); |
| 244 | |
| 245 | #undef TRACE_SYSTEM |
Johannes Berg | 2655e31 | 2012-01-31 21:08:37 -0800 | [diff] [blame] | 246 | #define TRACE_SYSTEM iwlwifi_msg |
| 247 | |
Johannes Berg | eecf21a | 2012-06-22 15:21:02 +0200 | [diff] [blame] | 248 | #define MAX_MSG_LEN 110 |
Johannes Berg | 2655e31 | 2012-01-31 21:08:37 -0800 | [diff] [blame] | 249 | |
| 250 | DECLARE_EVENT_CLASS(iwlwifi_msg_event, |
| 251 | TP_PROTO(struct va_format *vaf), |
| 252 | TP_ARGS(vaf), |
| 253 | TP_STRUCT__entry( |
| 254 | __dynamic_array(char, msg, MAX_MSG_LEN) |
| 255 | ), |
| 256 | TP_fast_assign( |
| 257 | WARN_ON_ONCE(vsnprintf(__get_dynamic_array(msg), |
| 258 | MAX_MSG_LEN, vaf->fmt, |
| 259 | *vaf->va) >= MAX_MSG_LEN); |
| 260 | ), |
Johannes Berg | 94bfa4a | 2012-06-22 19:39:23 +0200 | [diff] [blame] | 261 | TP_printk("%s", __get_str(msg)) |
Johannes Berg | 2655e31 | 2012-01-31 21:08:37 -0800 | [diff] [blame] | 262 | ); |
| 263 | |
| 264 | DEFINE_EVENT(iwlwifi_msg_event, iwlwifi_err, |
| 265 | TP_PROTO(struct va_format *vaf), |
| 266 | TP_ARGS(vaf) |
| 267 | ); |
| 268 | |
| 269 | DEFINE_EVENT(iwlwifi_msg_event, iwlwifi_warn, |
| 270 | TP_PROTO(struct va_format *vaf), |
| 271 | TP_ARGS(vaf) |
| 272 | ); |
| 273 | |
| 274 | DEFINE_EVENT(iwlwifi_msg_event, iwlwifi_info, |
| 275 | TP_PROTO(struct va_format *vaf), |
| 276 | TP_ARGS(vaf) |
| 277 | ); |
| 278 | |
| 279 | DEFINE_EVENT(iwlwifi_msg_event, iwlwifi_crit, |
| 280 | TP_PROTO(struct va_format *vaf), |
| 281 | TP_ARGS(vaf) |
| 282 | ); |
| 283 | |
| 284 | TRACE_EVENT(iwlwifi_dbg, |
| 285 | TP_PROTO(u32 level, bool in_interrupt, const char *function, |
| 286 | struct va_format *vaf), |
| 287 | TP_ARGS(level, in_interrupt, function, vaf), |
| 288 | TP_STRUCT__entry( |
| 289 | __field(u32, level) |
| 290 | __field(u8, in_interrupt) |
| 291 | __string(function, function) |
| 292 | __dynamic_array(char, msg, MAX_MSG_LEN) |
| 293 | ), |
| 294 | TP_fast_assign( |
| 295 | __entry->level = level; |
| 296 | __entry->in_interrupt = in_interrupt; |
| 297 | __assign_str(function, function); |
| 298 | WARN_ON_ONCE(vsnprintf(__get_dynamic_array(msg), |
| 299 | MAX_MSG_LEN, vaf->fmt, |
| 300 | *vaf->va) >= MAX_MSG_LEN); |
| 301 | ), |
Johannes Berg | 9047e4a | 2013-02-20 16:29:37 +0100 | [diff] [blame] | 302 | TP_printk("%s", __get_str(msg)) |
Johannes Berg | 2655e31 | 2012-01-31 21:08:37 -0800 | [diff] [blame] | 303 | ); |
| 304 | |
| 305 | #undef TRACE_SYSTEM |
Johannes Berg | f042c2e | 2012-09-05 22:34:44 +0200 | [diff] [blame] | 306 | #define TRACE_SYSTEM iwlwifi_data |
| 307 | |
| 308 | TRACE_EVENT(iwlwifi_dev_tx_data, |
| 309 | TP_PROTO(const struct device *dev, |
| 310 | struct sk_buff *skb, |
| 311 | void *data, size_t data_len), |
| 312 | TP_ARGS(dev, skb, data, data_len), |
| 313 | TP_STRUCT__entry( |
| 314 | DEV_ENTRY |
| 315 | |
| 316 | __dynamic_array(u8, data, iwl_trace_data(skb) ? data_len : 0) |
| 317 | ), |
| 318 | TP_fast_assign( |
| 319 | DEV_ASSIGN; |
| 320 | if (iwl_trace_data(skb)) |
| 321 | memcpy(__get_dynamic_array(data), data, data_len); |
| 322 | ), |
| 323 | TP_printk("[%s] TX frame data", __get_str(dev)) |
| 324 | ); |
| 325 | |
| 326 | TRACE_EVENT(iwlwifi_dev_rx_data, |
| 327 | TP_PROTO(const struct device *dev, |
| 328 | const struct iwl_trans *trans, |
| 329 | void *rxbuf, size_t len), |
| 330 | TP_ARGS(dev, trans, rxbuf, len), |
| 331 | TP_STRUCT__entry( |
| 332 | DEV_ENTRY |
| 333 | |
| 334 | __dynamic_array(u8, data, |
| 335 | len - iwl_rx_trace_len(trans, rxbuf, len)) |
| 336 | ), |
| 337 | TP_fast_assign( |
| 338 | size_t offs = iwl_rx_trace_len(trans, rxbuf, len); |
| 339 | DEV_ASSIGN; |
| 340 | if (offs < len) |
| 341 | memcpy(__get_dynamic_array(data), |
| 342 | ((u8 *)rxbuf) + offs, len - offs); |
| 343 | ), |
Johannes Berg | 2e6e6b1 | 2012-11-06 12:37:21 +0100 | [diff] [blame] | 344 | TP_printk("[%s] RX frame data", __get_str(dev)) |
Johannes Berg | f042c2e | 2012-09-05 22:34:44 +0200 | [diff] [blame] | 345 | ); |
| 346 | |
| 347 | #undef TRACE_SYSTEM |
Johannes Berg | 0fd95af | 2009-11-20 12:05:02 -0800 | [diff] [blame] | 348 | #define TRACE_SYSTEM iwlwifi |
| 349 | |
Johannes Berg | be1a71a | 2009-10-02 13:44:02 -0700 | [diff] [blame] | 350 | TRACE_EVENT(iwlwifi_dev_hcmd, |
Johannes Berg | 45eab7c | 2012-09-05 00:33:53 +0200 | [diff] [blame] | 351 | TP_PROTO(const struct device *dev, |
| 352 | struct iwl_host_cmd *cmd, u16 total_size, |
Johannes Berg | 8a964f4 | 2013-02-25 16:01:34 +0100 | [diff] [blame] | 353 | struct iwl_cmd_header *hdr), |
| 354 | TP_ARGS(dev, cmd, total_size, hdr), |
Johannes Berg | be1a71a | 2009-10-02 13:44:02 -0700 | [diff] [blame] | 355 | TP_STRUCT__entry( |
Johannes Berg | 6c1011e | 2012-03-06 13:30:48 -0800 | [diff] [blame] | 356 | DEV_ENTRY |
Johannes Berg | 45eab7c | 2012-09-05 00:33:53 +0200 | [diff] [blame] | 357 | __dynamic_array(u8, hcmd, total_size) |
Johannes Berg | be1a71a | 2009-10-02 13:44:02 -0700 | [diff] [blame] | 358 | __field(u32, flags) |
| 359 | ), |
| 360 | TP_fast_assign( |
Johannes Berg | 8a964f4 | 2013-02-25 16:01:34 +0100 | [diff] [blame] | 361 | int i, offset = sizeof(*hdr); |
Johannes Berg | 45eab7c | 2012-09-05 00:33:53 +0200 | [diff] [blame] | 362 | |
Johannes Berg | 6c1011e | 2012-03-06 13:30:48 -0800 | [diff] [blame] | 363 | DEV_ASSIGN; |
Johannes Berg | 45eab7c | 2012-09-05 00:33:53 +0200 | [diff] [blame] | 364 | __entry->flags = cmd->flags; |
Johannes Berg | 8a964f4 | 2013-02-25 16:01:34 +0100 | [diff] [blame] | 365 | memcpy(__get_dynamic_array(hcmd), hdr, sizeof(*hdr)); |
Johannes Berg | 45eab7c | 2012-09-05 00:33:53 +0200 | [diff] [blame] | 366 | |
Johannes Berg | 1afbfb6 | 2013-02-26 11:32:26 +0100 | [diff] [blame] | 367 | for (i = 0; i < IWL_MAX_CMD_TBS_PER_TFD; i++) { |
Johannes Berg | 45eab7c | 2012-09-05 00:33:53 +0200 | [diff] [blame] | 368 | if (!cmd->len[i]) |
| 369 | continue; |
Johannes Berg | 45eab7c | 2012-09-05 00:33:53 +0200 | [diff] [blame] | 370 | memcpy((u8 *)__get_dynamic_array(hcmd) + offset, |
| 371 | cmd->data[i], cmd->len[i]); |
| 372 | offset += cmd->len[i]; |
| 373 | } |
Johannes Berg | be1a71a | 2009-10-02 13:44:02 -0700 | [diff] [blame] | 374 | ), |
Johannes Berg | 6c1011e | 2012-03-06 13:30:48 -0800 | [diff] [blame] | 375 | TP_printk("[%s] hcmd %#.2x (%ssync)", |
Johannes Berg | 45eab7c | 2012-09-05 00:33:53 +0200 | [diff] [blame] | 376 | __get_str(dev), ((u8 *)__get_dynamic_array(hcmd))[0], |
Johannes Berg | be1a71a | 2009-10-02 13:44:02 -0700 | [diff] [blame] | 377 | __entry->flags & CMD_ASYNC ? "a" : "") |
| 378 | ); |
| 379 | |
| 380 | TRACE_EVENT(iwlwifi_dev_rx, |
Johannes Berg | f042c2e | 2012-09-05 22:34:44 +0200 | [diff] [blame] | 381 | TP_PROTO(const struct device *dev, const struct iwl_trans *trans, |
| 382 | void *rxbuf, size_t len), |
| 383 | TP_ARGS(dev, trans, rxbuf, len), |
Johannes Berg | be1a71a | 2009-10-02 13:44:02 -0700 | [diff] [blame] | 384 | TP_STRUCT__entry( |
Johannes Berg | 6c1011e | 2012-03-06 13:30:48 -0800 | [diff] [blame] | 385 | DEV_ENTRY |
Johannes Berg | f042c2e | 2012-09-05 22:34:44 +0200 | [diff] [blame] | 386 | __dynamic_array(u8, rxbuf, iwl_rx_trace_len(trans, rxbuf, len)) |
Johannes Berg | be1a71a | 2009-10-02 13:44:02 -0700 | [diff] [blame] | 387 | ), |
| 388 | TP_fast_assign( |
Johannes Berg | 6c1011e | 2012-03-06 13:30:48 -0800 | [diff] [blame] | 389 | DEV_ASSIGN; |
Johannes Berg | f042c2e | 2012-09-05 22:34:44 +0200 | [diff] [blame] | 390 | memcpy(__get_dynamic_array(rxbuf), rxbuf, |
| 391 | iwl_rx_trace_len(trans, rxbuf, len)); |
Johannes Berg | be1a71a | 2009-10-02 13:44:02 -0700 | [diff] [blame] | 392 | ), |
Johannes Berg | 6c1011e | 2012-03-06 13:30:48 -0800 | [diff] [blame] | 393 | TP_printk("[%s] RX cmd %#.2x", |
| 394 | __get_str(dev), ((u8 *)__get_dynamic_array(rxbuf))[4]) |
Johannes Berg | be1a71a | 2009-10-02 13:44:02 -0700 | [diff] [blame] | 395 | ); |
| 396 | |
| 397 | TRACE_EVENT(iwlwifi_dev_tx, |
Johannes Berg | f042c2e | 2012-09-05 22:34:44 +0200 | [diff] [blame] | 398 | TP_PROTO(const struct device *dev, struct sk_buff *skb, |
| 399 | void *tfd, size_t tfdlen, |
Johannes Berg | be1a71a | 2009-10-02 13:44:02 -0700 | [diff] [blame] | 400 | void *buf0, size_t buf0_len, |
| 401 | void *buf1, size_t buf1_len), |
Johannes Berg | f042c2e | 2012-09-05 22:34:44 +0200 | [diff] [blame] | 402 | TP_ARGS(dev, skb, tfd, tfdlen, buf0, buf0_len, buf1, buf1_len), |
Johannes Berg | be1a71a | 2009-10-02 13:44:02 -0700 | [diff] [blame] | 403 | TP_STRUCT__entry( |
Johannes Berg | 6c1011e | 2012-03-06 13:30:48 -0800 | [diff] [blame] | 404 | DEV_ENTRY |
Johannes Berg | be1a71a | 2009-10-02 13:44:02 -0700 | [diff] [blame] | 405 | |
| 406 | __field(size_t, framelen) |
| 407 | __dynamic_array(u8, tfd, tfdlen) |
| 408 | |
| 409 | /* |
| 410 | * Do not insert between or below these items, |
| 411 | * we want to keep the frame together (except |
| 412 | * for the possible padding). |
| 413 | */ |
| 414 | __dynamic_array(u8, buf0, buf0_len) |
Johannes Berg | f042c2e | 2012-09-05 22:34:44 +0200 | [diff] [blame] | 415 | __dynamic_array(u8, buf1, iwl_trace_data(skb) ? 0 : buf1_len) |
Johannes Berg | be1a71a | 2009-10-02 13:44:02 -0700 | [diff] [blame] | 416 | ), |
| 417 | TP_fast_assign( |
Johannes Berg | 6c1011e | 2012-03-06 13:30:48 -0800 | [diff] [blame] | 418 | DEV_ASSIGN; |
Johannes Berg | be1a71a | 2009-10-02 13:44:02 -0700 | [diff] [blame] | 419 | __entry->framelen = buf0_len + buf1_len; |
| 420 | memcpy(__get_dynamic_array(tfd), tfd, tfdlen); |
| 421 | memcpy(__get_dynamic_array(buf0), buf0, buf0_len); |
Johannes Berg | f042c2e | 2012-09-05 22:34:44 +0200 | [diff] [blame] | 422 | if (!iwl_trace_data(skb)) |
| 423 | memcpy(__get_dynamic_array(buf1), buf1, buf1_len); |
Johannes Berg | be1a71a | 2009-10-02 13:44:02 -0700 | [diff] [blame] | 424 | ), |
Johannes Berg | 6c1011e | 2012-03-06 13:30:48 -0800 | [diff] [blame] | 425 | TP_printk("[%s] TX %.2x (%zu bytes)", |
| 426 | __get_str(dev), ((u8 *)__get_dynamic_array(buf0))[0], |
Johannes Berg | be1a71a | 2009-10-02 13:44:02 -0700 | [diff] [blame] | 427 | __entry->framelen) |
| 428 | ); |
| 429 | |
| 430 | TRACE_EVENT(iwlwifi_dev_ucode_error, |
Johannes Berg | 6c1011e | 2012-03-06 13:30:48 -0800 | [diff] [blame] | 431 | TP_PROTO(const struct device *dev, u32 desc, u32 tsf_low, |
Johannes Berg | be1a71a | 2009-10-02 13:44:02 -0700 | [diff] [blame] | 432 | u32 data1, u32 data2, u32 line, u32 blink1, |
Wey-Yi Guy | 5065054 | 2011-05-04 16:56:52 -0700 | [diff] [blame] | 433 | u32 blink2, u32 ilink1, u32 ilink2, u32 bcon_time, |
| 434 | u32 gp1, u32 gp2, u32 gp3, u32 ucode_ver, u32 hw_ver, |
| 435 | u32 brd_ver), |
Johannes Berg | 6c1011e | 2012-03-06 13:30:48 -0800 | [diff] [blame] | 436 | TP_ARGS(dev, desc, tsf_low, data1, data2, line, |
Wey-Yi Guy | 5065054 | 2011-05-04 16:56:52 -0700 | [diff] [blame] | 437 | blink1, blink2, ilink1, ilink2, bcon_time, gp1, gp2, |
| 438 | gp3, ucode_ver, hw_ver, brd_ver), |
Johannes Berg | be1a71a | 2009-10-02 13:44:02 -0700 | [diff] [blame] | 439 | TP_STRUCT__entry( |
Johannes Berg | 6c1011e | 2012-03-06 13:30:48 -0800 | [diff] [blame] | 440 | DEV_ENTRY |
Johannes Berg | be1a71a | 2009-10-02 13:44:02 -0700 | [diff] [blame] | 441 | __field(u32, desc) |
Wey-Yi Guy | 5065054 | 2011-05-04 16:56:52 -0700 | [diff] [blame] | 442 | __field(u32, tsf_low) |
Johannes Berg | be1a71a | 2009-10-02 13:44:02 -0700 | [diff] [blame] | 443 | __field(u32, data1) |
| 444 | __field(u32, data2) |
| 445 | __field(u32, line) |
| 446 | __field(u32, blink1) |
| 447 | __field(u32, blink2) |
| 448 | __field(u32, ilink1) |
| 449 | __field(u32, ilink2) |
Wey-Yi Guy | 5065054 | 2011-05-04 16:56:52 -0700 | [diff] [blame] | 450 | __field(u32, bcon_time) |
| 451 | __field(u32, gp1) |
| 452 | __field(u32, gp2) |
| 453 | __field(u32, gp3) |
| 454 | __field(u32, ucode_ver) |
| 455 | __field(u32, hw_ver) |
| 456 | __field(u32, brd_ver) |
Johannes Berg | be1a71a | 2009-10-02 13:44:02 -0700 | [diff] [blame] | 457 | ), |
| 458 | TP_fast_assign( |
Johannes Berg | 6c1011e | 2012-03-06 13:30:48 -0800 | [diff] [blame] | 459 | DEV_ASSIGN; |
Johannes Berg | be1a71a | 2009-10-02 13:44:02 -0700 | [diff] [blame] | 460 | __entry->desc = desc; |
Wey-Yi Guy | 5065054 | 2011-05-04 16:56:52 -0700 | [diff] [blame] | 461 | __entry->tsf_low = tsf_low; |
Johannes Berg | be1a71a | 2009-10-02 13:44:02 -0700 | [diff] [blame] | 462 | __entry->data1 = data1; |
| 463 | __entry->data2 = data2; |
| 464 | __entry->line = line; |
| 465 | __entry->blink1 = blink1; |
| 466 | __entry->blink2 = blink2; |
| 467 | __entry->ilink1 = ilink1; |
| 468 | __entry->ilink2 = ilink2; |
Wey-Yi Guy | 5065054 | 2011-05-04 16:56:52 -0700 | [diff] [blame] | 469 | __entry->bcon_time = bcon_time; |
| 470 | __entry->gp1 = gp1; |
| 471 | __entry->gp2 = gp2; |
| 472 | __entry->gp3 = gp3; |
| 473 | __entry->ucode_ver = ucode_ver; |
| 474 | __entry->hw_ver = hw_ver; |
| 475 | __entry->brd_ver = brd_ver; |
Johannes Berg | be1a71a | 2009-10-02 13:44:02 -0700 | [diff] [blame] | 476 | ), |
Johannes Berg | 6c1011e | 2012-03-06 13:30:48 -0800 | [diff] [blame] | 477 | TP_printk("[%s] #%02d %010u data 0x%08X 0x%08X line %u, " |
Wey-Yi Guy | 5065054 | 2011-05-04 16:56:52 -0700 | [diff] [blame] | 478 | "blink 0x%05X 0x%05X ilink 0x%05X 0x%05X " |
| 479 | "bcon_tm %010u gp 0x%08X 0x%08X 0x%08X uCode 0x%08X " |
| 480 | "hw 0x%08X brd 0x%08X", |
Johannes Berg | 6c1011e | 2012-03-06 13:30:48 -0800 | [diff] [blame] | 481 | __get_str(dev), __entry->desc, __entry->tsf_low, |
Wey-Yi Guy | 5065054 | 2011-05-04 16:56:52 -0700 | [diff] [blame] | 482 | __entry->data1, |
Johannes Berg | be1a71a | 2009-10-02 13:44:02 -0700 | [diff] [blame] | 483 | __entry->data2, __entry->line, __entry->blink1, |
Wey-Yi Guy | 5065054 | 2011-05-04 16:56:52 -0700 | [diff] [blame] | 484 | __entry->blink2, __entry->ilink1, __entry->ilink2, |
| 485 | __entry->bcon_time, __entry->gp1, __entry->gp2, |
| 486 | __entry->gp3, __entry->ucode_ver, __entry->hw_ver, |
| 487 | __entry->brd_ver) |
Johannes Berg | be1a71a | 2009-10-02 13:44:02 -0700 | [diff] [blame] | 488 | ); |
| 489 | |
| 490 | TRACE_EVENT(iwlwifi_dev_ucode_event, |
Johannes Berg | 6c1011e | 2012-03-06 13:30:48 -0800 | [diff] [blame] | 491 | TP_PROTO(const struct device *dev, u32 time, u32 data, u32 ev), |
| 492 | TP_ARGS(dev, time, data, ev), |
Johannes Berg | be1a71a | 2009-10-02 13:44:02 -0700 | [diff] [blame] | 493 | TP_STRUCT__entry( |
Johannes Berg | 6c1011e | 2012-03-06 13:30:48 -0800 | [diff] [blame] | 494 | DEV_ENTRY |
Johannes Berg | be1a71a | 2009-10-02 13:44:02 -0700 | [diff] [blame] | 495 | |
| 496 | __field(u32, time) |
| 497 | __field(u32, data) |
| 498 | __field(u32, ev) |
| 499 | ), |
| 500 | TP_fast_assign( |
Johannes Berg | 6c1011e | 2012-03-06 13:30:48 -0800 | [diff] [blame] | 501 | DEV_ASSIGN; |
Johannes Berg | be1a71a | 2009-10-02 13:44:02 -0700 | [diff] [blame] | 502 | __entry->time = time; |
| 503 | __entry->data = data; |
| 504 | __entry->ev = ev; |
| 505 | ), |
Johannes Berg | 6c1011e | 2012-03-06 13:30:48 -0800 | [diff] [blame] | 506 | TP_printk("[%s] EVT_LOGT:%010u:0x%08x:%04u", |
| 507 | __get_str(dev), __entry->time, __entry->data, __entry->ev) |
Johannes Berg | be1a71a | 2009-10-02 13:44:02 -0700 | [diff] [blame] | 508 | ); |
| 509 | #endif /* __IWLWIFI_DEVICE_TRACE */ |
| 510 | |
| 511 | #undef TRACE_INCLUDE_PATH |
| 512 | #define TRACE_INCLUDE_PATH . |
| 513 | #undef TRACE_INCLUDE_FILE |
| 514 | #define TRACE_INCLUDE_FILE iwl-devtrace |
| 515 | #include <trace/define_trace.h> |