Zhu Yi | 34dd5fe | 2010-02-25 14:15:27 +0800 | [diff] [blame] | 1 | #if !defined(__IWM_TRACE_H__) || defined(TRACE_HEADER_MULTI_READ) |
| 2 | #define __IWM_TRACE_H__ |
| 3 | |
| 4 | #include <linux/tracepoint.h> |
| 5 | |
| 6 | #if !defined(CONFIG_IWM_TRACING) |
| 7 | #undef TRACE_EVENT |
| 8 | #define TRACE_EVENT(name, proto, ...) \ |
| 9 | static inline void trace_ ## name(proto) {} |
| 10 | #endif |
| 11 | |
| 12 | #undef TRACE_SYSTEM |
| 13 | #define TRACE_SYSTEM iwm |
| 14 | |
| 15 | #define IWM_ENTRY __array(char, ndev_name, 16) |
| 16 | #define IWM_ASSIGN strlcpy(__entry->ndev_name, iwm_to_ndev(iwm)->name, 16) |
| 17 | #define IWM_PR_FMT "%s" |
| 18 | #define IWM_PR_ARG __entry->ndev_name |
| 19 | |
| 20 | TRACE_EVENT(iwm_tx_nonwifi_cmd, |
| 21 | TP_PROTO(struct iwm_priv *iwm, struct iwm_udma_out_nonwifi_hdr *hdr), |
| 22 | |
| 23 | TP_ARGS(iwm, hdr), |
| 24 | |
| 25 | TP_STRUCT__entry( |
| 26 | IWM_ENTRY |
| 27 | __field(u8, opcode) |
| 28 | __field(u8, resp) |
| 29 | __field(u8, eot) |
| 30 | __field(u8, hw) |
| 31 | __field(u16, seq) |
| 32 | __field(u32, addr) |
| 33 | __field(u32, op1) |
| 34 | __field(u32, op2) |
| 35 | ), |
| 36 | |
| 37 | TP_fast_assign( |
| 38 | IWM_ASSIGN; |
| 39 | __entry->opcode = GET_VAL32(hdr->cmd, UMAC_HDI_OUT_CMD_OPCODE); |
| 40 | __entry->resp = GET_VAL32(hdr->cmd, UDMA_HDI_OUT_NW_CMD_RESP); |
| 41 | __entry->eot = GET_VAL32(hdr->cmd, UMAC_HDI_OUT_CMD_EOT); |
| 42 | __entry->hw = GET_VAL32(hdr->cmd, UDMA_HDI_OUT_NW_CMD_HANDLE_BY_HW); |
| 43 | __entry->seq = GET_VAL32(hdr->cmd, UDMA_HDI_OUT_CMD_NON_WIFI_HW_SEQ_NUM); |
| 44 | __entry->addr = le32_to_cpu(hdr->addr); |
| 45 | __entry->op1 = le32_to_cpu(hdr->op1_sz); |
| 46 | __entry->op2 = le32_to_cpu(hdr->op2); |
| 47 | ), |
| 48 | |
| 49 | TP_printk( |
| 50 | IWM_PR_FMT " Tx TARGET CMD: opcode 0x%x, resp %d, eot %d, " |
| 51 | "hw %d, seq 0x%x, addr 0x%x, op1 0x%x, op2 0x%x", |
| 52 | IWM_PR_ARG, __entry->opcode, __entry->resp, __entry->eot, |
| 53 | __entry->hw, __entry->seq, __entry->addr, __entry->op1, |
| 54 | __entry->op2 |
| 55 | ) |
| 56 | ); |
| 57 | |
| 58 | TRACE_EVENT(iwm_tx_wifi_cmd, |
| 59 | TP_PROTO(struct iwm_priv *iwm, struct iwm_umac_wifi_out_hdr *hdr), |
| 60 | |
| 61 | TP_ARGS(iwm, hdr), |
| 62 | |
| 63 | TP_STRUCT__entry( |
| 64 | IWM_ENTRY |
| 65 | __field(u8, opcode) |
| 66 | __field(u8, lmac) |
| 67 | __field(u8, resp) |
| 68 | __field(u8, eot) |
| 69 | __field(u8, ra_tid) |
| 70 | __field(u8, credit_group) |
| 71 | __field(u8, color) |
| 72 | __field(u16, seq) |
| 73 | ), |
| 74 | |
| 75 | TP_fast_assign( |
| 76 | IWM_ASSIGN; |
| 77 | __entry->opcode = hdr->sw_hdr.cmd.cmd; |
| 78 | __entry->lmac = 0; |
Samuel Ortiz | 3c997e8 | 2010-04-16 09:28:43 +0800 | [diff] [blame] | 79 | __entry->seq = __le16_to_cpu(hdr->sw_hdr.cmd.seq_num); |
Zhu Yi | 34dd5fe | 2010-02-25 14:15:27 +0800 | [diff] [blame] | 80 | __entry->resp = GET_VAL8(hdr->sw_hdr.cmd.flags, UMAC_DEV_CMD_FLAGS_RESP_REQ); |
| 81 | __entry->color = GET_VAL32(hdr->sw_hdr.meta_data, UMAC_FW_CMD_TX_STA_COLOR); |
| 82 | __entry->eot = GET_VAL32(hdr->hw_hdr.cmd, UMAC_HDI_OUT_CMD_EOT); |
| 83 | __entry->ra_tid = GET_VAL32(hdr->hw_hdr.meta_data, UMAC_HDI_OUT_RATID); |
| 84 | __entry->credit_group = GET_VAL32(hdr->hw_hdr.meta_data, UMAC_HDI_OUT_CREDIT_GRP); |
| 85 | if (__entry->opcode == UMAC_CMD_OPCODE_WIFI_PASS_THROUGH || |
| 86 | __entry->opcode == UMAC_CMD_OPCODE_WIFI_IF_WRAPPER) { |
| 87 | __entry->lmac = 1; |
| 88 | __entry->opcode = ((struct iwm_lmac_hdr *)(hdr + 1))->id; |
| 89 | } |
| 90 | ), |
| 91 | |
| 92 | TP_printk( |
| 93 | IWM_PR_FMT " Tx %cMAC CMD: opcode 0x%x, resp %d, eot %d, " |
| 94 | "seq 0x%x, sta_color 0x%x, ra_tid 0x%x, credit_group 0x%x", |
| 95 | IWM_PR_ARG, __entry->lmac ? 'L' : 'U', __entry->opcode, |
| 96 | __entry->resp, __entry->eot, __entry->seq, __entry->color, |
| 97 | __entry->ra_tid, __entry->credit_group |
| 98 | ) |
| 99 | ); |
| 100 | |
| 101 | TRACE_EVENT(iwm_tx_packets, |
| 102 | TP_PROTO(struct iwm_priv *iwm, u8 *buf, int len), |
| 103 | |
| 104 | TP_ARGS(iwm, buf, len), |
| 105 | |
| 106 | TP_STRUCT__entry( |
| 107 | IWM_ENTRY |
| 108 | __field(u8, eot) |
| 109 | __field(u8, ra_tid) |
| 110 | __field(u8, credit_group) |
| 111 | __field(u8, color) |
| 112 | __field(u16, seq) |
| 113 | __field(u8, npkt) |
| 114 | __field(u32, bytes) |
| 115 | ), |
| 116 | |
| 117 | TP_fast_assign( |
| 118 | struct iwm_umac_wifi_out_hdr *hdr = |
| 119 | (struct iwm_umac_wifi_out_hdr *)buf; |
| 120 | |
| 121 | IWM_ASSIGN; |
| 122 | __entry->eot = GET_VAL32(hdr->hw_hdr.cmd, UMAC_HDI_OUT_CMD_EOT); |
| 123 | __entry->ra_tid = GET_VAL32(hdr->hw_hdr.meta_data, UMAC_HDI_OUT_RATID); |
| 124 | __entry->credit_group = GET_VAL32(hdr->hw_hdr.meta_data, UMAC_HDI_OUT_CREDIT_GRP); |
| 125 | __entry->color = GET_VAL32(hdr->sw_hdr.meta_data, UMAC_FW_CMD_TX_STA_COLOR); |
Samuel Ortiz | 3c997e8 | 2010-04-16 09:28:43 +0800 | [diff] [blame] | 126 | __entry->seq = __le16_to_cpu(hdr->sw_hdr.cmd.seq_num); |
Zhu Yi | 34dd5fe | 2010-02-25 14:15:27 +0800 | [diff] [blame] | 127 | __entry->npkt = 1; |
| 128 | __entry->bytes = len; |
| 129 | |
| 130 | if (!__entry->eot) { |
| 131 | int count; |
| 132 | u8 *ptr = buf; |
| 133 | |
| 134 | __entry->npkt = 0; |
| 135 | while (ptr < buf + len) { |
| 136 | count = GET_VAL32(hdr->sw_hdr.meta_data, |
| 137 | UMAC_FW_CMD_BYTE_COUNT); |
| 138 | ptr += ALIGN(sizeof(*hdr) + count, 16); |
| 139 | hdr = (struct iwm_umac_wifi_out_hdr *)ptr; |
| 140 | __entry->npkt++; |
| 141 | } |
| 142 | } |
| 143 | ), |
| 144 | |
| 145 | TP_printk( |
| 146 | IWM_PR_FMT " Tx %spacket: eot %d, seq 0x%x, sta_color 0x%x, " |
| 147 | "ra_tid 0x%x, credit_group 0x%x, embeded_packets %d, %d bytes", |
| 148 | IWM_PR_ARG, !__entry->eot ? "concatenated " : "", |
| 149 | __entry->eot, __entry->seq, __entry->color, __entry->ra_tid, |
| 150 | __entry->credit_group, __entry->npkt, __entry->bytes |
| 151 | ) |
| 152 | ); |
| 153 | |
| 154 | TRACE_EVENT(iwm_rx_nonwifi_cmd, |
| 155 | TP_PROTO(struct iwm_priv *iwm, void *buf, int len), |
| 156 | |
| 157 | TP_ARGS(iwm, buf, len), |
| 158 | |
| 159 | TP_STRUCT__entry( |
| 160 | IWM_ENTRY |
| 161 | __field(u8, opcode) |
| 162 | __field(u16, seq) |
| 163 | __field(u32, len) |
| 164 | ), |
| 165 | |
| 166 | TP_fast_assign( |
| 167 | struct iwm_udma_in_hdr *hdr = buf; |
| 168 | |
| 169 | IWM_ASSIGN; |
| 170 | __entry->opcode = GET_VAL32(hdr->cmd, UDMA_HDI_IN_NW_CMD_OPCODE); |
| 171 | __entry->seq = GET_VAL32(hdr->cmd, UDMA_HDI_IN_CMD_NON_WIFI_HW_SEQ_NUM); |
| 172 | __entry->len = len; |
| 173 | ), |
| 174 | |
| 175 | TP_printk( |
| 176 | IWM_PR_FMT " Rx TARGET RESP: opcode 0x%x, seq 0x%x, len 0x%x", |
| 177 | IWM_PR_ARG, __entry->opcode, __entry->seq, __entry->len |
| 178 | ) |
| 179 | ); |
| 180 | |
| 181 | TRACE_EVENT(iwm_rx_wifi_cmd, |
| 182 | TP_PROTO(struct iwm_priv *iwm, struct iwm_umac_wifi_in_hdr *hdr), |
| 183 | |
| 184 | TP_ARGS(iwm, hdr), |
| 185 | |
| 186 | TP_STRUCT__entry( |
| 187 | IWM_ENTRY |
| 188 | __field(u8, cmd) |
| 189 | __field(u8, source) |
| 190 | __field(u16, seq) |
| 191 | __field(u32, count) |
| 192 | ), |
| 193 | |
| 194 | TP_fast_assign( |
| 195 | IWM_ASSIGN; |
| 196 | __entry->cmd = hdr->sw_hdr.cmd.cmd; |
| 197 | __entry->source = GET_VAL32(hdr->hw_hdr.cmd, UMAC_HDI_IN_CMD_SOURCE); |
| 198 | __entry->count = GET_VAL32(hdr->sw_hdr.meta_data, UMAC_FW_CMD_BYTE_COUNT); |
| 199 | __entry->seq = le16_to_cpu(hdr->sw_hdr.cmd.seq_num); |
| 200 | ), |
| 201 | |
| 202 | TP_printk( |
| 203 | IWM_PR_FMT " Rx %s RESP: cmd 0x%x, seq 0x%x, count 0x%x", |
| 204 | IWM_PR_ARG, __entry->source == UMAC_HDI_IN_SOURCE_FHRX ? "LMAC" : |
| 205 | __entry->source == UMAC_HDI_IN_SOURCE_FW ? "UMAC" : "UDMA", |
| 206 | __entry->cmd, __entry->seq, __entry->count |
| 207 | ) |
| 208 | ); |
| 209 | |
| 210 | #define iwm_ticket_action_symbol \ |
| 211 | { IWM_RX_TICKET_DROP, "DROP" }, \ |
| 212 | { IWM_RX_TICKET_RELEASE, "RELEASE" }, \ |
| 213 | { IWM_RX_TICKET_SNIFFER, "SNIFFER" }, \ |
| 214 | { IWM_RX_TICKET_ENQUEUE, "ENQUEUE" } |
| 215 | |
| 216 | TRACE_EVENT(iwm_rx_ticket, |
| 217 | TP_PROTO(struct iwm_priv *iwm, void *buf, int len), |
| 218 | |
| 219 | TP_ARGS(iwm, buf, len), |
| 220 | |
| 221 | TP_STRUCT__entry( |
| 222 | IWM_ENTRY |
| 223 | __field(u8, action) |
| 224 | __field(u8, reason) |
| 225 | __field(u16, id) |
| 226 | __field(u16, flags) |
| 227 | ), |
| 228 | |
| 229 | TP_fast_assign( |
| 230 | struct iwm_rx_ticket *ticket = |
| 231 | ((struct iwm_umac_notif_rx_ticket *)buf)->tickets; |
| 232 | |
| 233 | IWM_ASSIGN; |
| 234 | __entry->id = le16_to_cpu(ticket->id); |
| 235 | __entry->action = le16_to_cpu(ticket->action); |
| 236 | __entry->flags = le16_to_cpu(ticket->flags); |
| 237 | __entry->reason = (__entry->flags & IWM_RX_TICKET_DROP_REASON_MSK) >> IWM_RX_TICKET_DROP_REASON_POS; |
| 238 | ), |
| 239 | |
| 240 | TP_printk( |
| 241 | IWM_PR_FMT " Rx ticket: id 0x%x, action %s, %s 0x%x%s", |
| 242 | IWM_PR_ARG, __entry->id, |
| 243 | __print_symbolic(__entry->action, iwm_ticket_action_symbol), |
| 244 | __entry->reason ? "reason" : "flags", |
| 245 | __entry->reason ? __entry->reason : __entry->flags, |
| 246 | __entry->flags & IWM_RX_TICKET_AMSDU_MSK ? ", AMSDU frame" : "" |
| 247 | ) |
| 248 | ); |
| 249 | |
| 250 | TRACE_EVENT(iwm_rx_packet, |
| 251 | TP_PROTO(struct iwm_priv *iwm, void *buf, int len), |
| 252 | |
| 253 | TP_ARGS(iwm, buf, len), |
| 254 | |
| 255 | TP_STRUCT__entry( |
| 256 | IWM_ENTRY |
| 257 | __field(u8, source) |
| 258 | __field(u16, id) |
| 259 | __field(u32, len) |
| 260 | ), |
| 261 | |
| 262 | TP_fast_assign( |
| 263 | struct iwm_umac_wifi_in_hdr *hdr = buf; |
| 264 | |
| 265 | IWM_ASSIGN; |
| 266 | __entry->source = GET_VAL32(hdr->hw_hdr.cmd, UMAC_HDI_IN_CMD_SOURCE); |
| 267 | __entry->id = le16_to_cpu(hdr->sw_hdr.cmd.seq_num); |
| 268 | __entry->len = len - sizeof(*hdr); |
| 269 | ), |
| 270 | |
| 271 | TP_printk( |
| 272 | IWM_PR_FMT " Rx %s packet: id 0x%x, %d bytes", |
| 273 | IWM_PR_ARG, __entry->source == UMAC_HDI_IN_SOURCE_FHRX ? |
| 274 | "LMAC" : "UMAC", __entry->id, __entry->len |
| 275 | ) |
| 276 | ); |
| 277 | #endif |
| 278 | |
| 279 | #undef TRACE_INCLUDE_PATH |
| 280 | #define TRACE_INCLUDE_PATH . |
| 281 | #undef TRACE_INCLUDE_FILE |
| 282 | #define TRACE_INCLUDE_FILE trace |
| 283 | #include <trace/define_trace.h> |