185630469SLior David /* SPDX-License-Identifier: ISC */ 298658095SVladimir Kondratiev /* 3b874ddecSLior David * Copyright (c) 2013-2016 Qualcomm Atheros, Inc. 4bf0353a6SAhmad Masri * Copyright (c) 2019, The Linux Foundation. All rights reserved. 598658095SVladimir Kondratiev */ 698658095SVladimir Kondratiev 798658095SVladimir Kondratiev #undef TRACE_SYSTEM 898658095SVladimir Kondratiev #define TRACE_SYSTEM wil6210 998658095SVladimir Kondratiev #if !defined(WIL6210_TRACE_H) || defined(TRACE_HEADER_MULTI_READ) 1098658095SVladimir Kondratiev #define WIL6210_TRACE_H 1198658095SVladimir Kondratiev 1298658095SVladimir Kondratiev #include <linux/tracepoint.h> 1398658095SVladimir Kondratiev #include "wil6210.h" 1498658095SVladimir Kondratiev #include "txrx.h" 1598658095SVladimir Kondratiev 1698658095SVladimir Kondratiev /* create empty functions when tracing is disabled */ 1798658095SVladimir Kondratiev #if !defined(CONFIG_WIL6210_TRACING) || defined(__CHECKER__) 1898658095SVladimir Kondratiev 1998658095SVladimir Kondratiev #undef TRACE_EVENT 2098658095SVladimir Kondratiev #define TRACE_EVENT(name, proto, ...) \ 2198658095SVladimir Kondratiev static inline void trace_ ## name(proto) {} 2298658095SVladimir Kondratiev #undef DECLARE_EVENT_CLASS 2398658095SVladimir Kondratiev #define DECLARE_EVENT_CLASS(...) 2498658095SVladimir Kondratiev #undef DEFINE_EVENT 2598658095SVladimir Kondratiev #define DEFINE_EVENT(evt_class, name, proto, ...) \ 2698658095SVladimir Kondratiev static inline void trace_ ## name(proto) {} 2798658095SVladimir Kondratiev #endif /* !CONFIG_WIL6210_TRACING || defined(__CHECKER__) */ 2898658095SVladimir Kondratiev 2998658095SVladimir Kondratiev DECLARE_EVENT_CLASS(wil6210_wmi, 30b874ddecSLior David TP_PROTO(struct wmi_cmd_hdr *wmi, void *buf, u16 buf_len), 3198658095SVladimir Kondratiev 32f988b23fSVladimir Kondratiev TP_ARGS(wmi, buf, buf_len), 3398658095SVladimir Kondratiev 3498658095SVladimir Kondratiev TP_STRUCT__entry( 35f988b23fSVladimir Kondratiev __field(u8, mid) 36b874ddecSLior David __field(u16, command_id) 37b874ddecSLior David __field(u32, fw_timestamp) 3898658095SVladimir Kondratiev __field(u16, buf_len) 3998658095SVladimir Kondratiev __dynamic_array(u8, buf, buf_len) 4098658095SVladimir Kondratiev ), 4198658095SVladimir Kondratiev 4298658095SVladimir Kondratiev TP_fast_assign( 43f988b23fSVladimir Kondratiev __entry->mid = wmi->mid; 44b874ddecSLior David __entry->command_id = le16_to_cpu(wmi->command_id); 45b874ddecSLior David __entry->fw_timestamp = le32_to_cpu(wmi->fw_timestamp); 4698658095SVladimir Kondratiev __entry->buf_len = buf_len; 4798658095SVladimir Kondratiev memcpy(__get_dynamic_array(buf), buf, buf_len); 4898658095SVladimir Kondratiev ), 4998658095SVladimir Kondratiev 5098658095SVladimir Kondratiev TP_printk( 51f988b23fSVladimir Kondratiev "MID %d id 0x%04x len %d timestamp %d", 52b874ddecSLior David __entry->mid, __entry->command_id, __entry->buf_len, 53b874ddecSLior David __entry->fw_timestamp 5498658095SVladimir Kondratiev ) 5598658095SVladimir Kondratiev ); 5698658095SVladimir Kondratiev 5798658095SVladimir Kondratiev DEFINE_EVENT(wil6210_wmi, wil6210_wmi_cmd, 58b874ddecSLior David TP_PROTO(struct wmi_cmd_hdr *wmi, void *buf, u16 buf_len), 59f988b23fSVladimir Kondratiev TP_ARGS(wmi, buf, buf_len) 6098658095SVladimir Kondratiev ); 6198658095SVladimir Kondratiev 6298658095SVladimir Kondratiev DEFINE_EVENT(wil6210_wmi, wil6210_wmi_event, 63b874ddecSLior David TP_PROTO(struct wmi_cmd_hdr *wmi, void *buf, u16 buf_len), 64f988b23fSVladimir Kondratiev TP_ARGS(wmi, buf, buf_len) 6598658095SVladimir Kondratiev ); 6698658095SVladimir Kondratiev 6798658095SVladimir Kondratiev #define WIL6210_MSG_MAX (200) 6898658095SVladimir Kondratiev 6998658095SVladimir Kondratiev DECLARE_EVENT_CLASS(wil6210_log_event, 7098658095SVladimir Kondratiev TP_PROTO(struct va_format *vaf), 7198658095SVladimir Kondratiev TP_ARGS(vaf), 7298658095SVladimir Kondratiev TP_STRUCT__entry( 73*c01406f8SSteven Rostedt (Google) __vstring(msg, vaf->fmt, vaf->va) 7498658095SVladimir Kondratiev ), 7598658095SVladimir Kondratiev TP_fast_assign( 76*c01406f8SSteven Rostedt (Google) __assign_vstr(msg, vaf->fmt, vaf->va); 7798658095SVladimir Kondratiev ), 7898658095SVladimir Kondratiev TP_printk("%s", __get_str(msg)) 7998658095SVladimir Kondratiev ); 8098658095SVladimir Kondratiev 8198658095SVladimir Kondratiev DEFINE_EVENT(wil6210_log_event, wil6210_log_err, 8298658095SVladimir Kondratiev TP_PROTO(struct va_format *vaf), 8398658095SVladimir Kondratiev TP_ARGS(vaf) 8498658095SVladimir Kondratiev ); 8598658095SVladimir Kondratiev 8698658095SVladimir Kondratiev DEFINE_EVENT(wil6210_log_event, wil6210_log_info, 8798658095SVladimir Kondratiev TP_PROTO(struct va_format *vaf), 8898658095SVladimir Kondratiev TP_ARGS(vaf) 8998658095SVladimir Kondratiev ); 9098658095SVladimir Kondratiev 9198658095SVladimir Kondratiev DEFINE_EVENT(wil6210_log_event, wil6210_log_dbg, 9298658095SVladimir Kondratiev TP_PROTO(struct va_format *vaf), 9398658095SVladimir Kondratiev TP_ARGS(vaf) 9498658095SVladimir Kondratiev ); 9598658095SVladimir Kondratiev 9698658095SVladimir Kondratiev #define wil_pseudo_irq_cause(x) __print_flags(x, "|", \ 9798658095SVladimir Kondratiev {BIT_DMA_PSEUDO_CAUSE_RX, "Rx" }, \ 9898658095SVladimir Kondratiev {BIT_DMA_PSEUDO_CAUSE_TX, "Tx" }, \ 9998658095SVladimir Kondratiev {BIT_DMA_PSEUDO_CAUSE_MISC, "Misc" }) 10098658095SVladimir Kondratiev 10198658095SVladimir Kondratiev TRACE_EVENT(wil6210_irq_pseudo, 10298658095SVladimir Kondratiev TP_PROTO(u32 x), 10398658095SVladimir Kondratiev TP_ARGS(x), 10498658095SVladimir Kondratiev TP_STRUCT__entry( 10598658095SVladimir Kondratiev __field(u32, x) 10698658095SVladimir Kondratiev ), 10798658095SVladimir Kondratiev TP_fast_assign( 10898658095SVladimir Kondratiev __entry->x = x; 10998658095SVladimir Kondratiev ), 11098658095SVladimir Kondratiev TP_printk("cause 0x%08x : %s", __entry->x, 11198658095SVladimir Kondratiev wil_pseudo_irq_cause(__entry->x)) 11298658095SVladimir Kondratiev ); 11398658095SVladimir Kondratiev 11498658095SVladimir Kondratiev DECLARE_EVENT_CLASS(wil6210_irq, 11598658095SVladimir Kondratiev TP_PROTO(u32 x), 11698658095SVladimir Kondratiev TP_ARGS(x), 11798658095SVladimir Kondratiev TP_STRUCT__entry( 11898658095SVladimir Kondratiev __field(u32, x) 11998658095SVladimir Kondratiev ), 12098658095SVladimir Kondratiev TP_fast_assign( 12198658095SVladimir Kondratiev __entry->x = x; 12298658095SVladimir Kondratiev ), 12398658095SVladimir Kondratiev TP_printk("cause 0x%08x", __entry->x) 12498658095SVladimir Kondratiev ); 12598658095SVladimir Kondratiev 12698658095SVladimir Kondratiev DEFINE_EVENT(wil6210_irq, wil6210_irq_rx, 12798658095SVladimir Kondratiev TP_PROTO(u32 x), 12898658095SVladimir Kondratiev TP_ARGS(x) 12998658095SVladimir Kondratiev ); 13098658095SVladimir Kondratiev 13198658095SVladimir Kondratiev DEFINE_EVENT(wil6210_irq, wil6210_irq_tx, 13298658095SVladimir Kondratiev TP_PROTO(u32 x), 13398658095SVladimir Kondratiev TP_ARGS(x) 13498658095SVladimir Kondratiev ); 13598658095SVladimir Kondratiev 13698658095SVladimir Kondratiev DEFINE_EVENT(wil6210_irq, wil6210_irq_misc, 13798658095SVladimir Kondratiev TP_PROTO(u32 x), 13898658095SVladimir Kondratiev TP_ARGS(x) 13998658095SVladimir Kondratiev ); 14098658095SVladimir Kondratiev 14198658095SVladimir Kondratiev DEFINE_EVENT(wil6210_irq, wil6210_irq_misc_thread, 14298658095SVladimir Kondratiev TP_PROTO(u32 x), 14398658095SVladimir Kondratiev TP_ARGS(x) 14498658095SVladimir Kondratiev ); 14598658095SVladimir Kondratiev 14698658095SVladimir Kondratiev TRACE_EVENT(wil6210_rx, 14798658095SVladimir Kondratiev TP_PROTO(u16 index, struct vring_rx_desc *d), 14898658095SVladimir Kondratiev TP_ARGS(index, d), 14998658095SVladimir Kondratiev TP_STRUCT__entry( 15098658095SVladimir Kondratiev __field(u16, index) 15198658095SVladimir Kondratiev __field(unsigned int, len) 15298658095SVladimir Kondratiev __field(u8, mid) 15398658095SVladimir Kondratiev __field(u8, cid) 15498658095SVladimir Kondratiev __field(u8, tid) 15598658095SVladimir Kondratiev __field(u8, type) 15698658095SVladimir Kondratiev __field(u8, subtype) 15798658095SVladimir Kondratiev __field(u16, seq) 15898658095SVladimir Kondratiev __field(u8, mcs) 15998658095SVladimir Kondratiev ), 16098658095SVladimir Kondratiev TP_fast_assign( 16198658095SVladimir Kondratiev __entry->index = index; 16298658095SVladimir Kondratiev __entry->len = d->dma.length; 16398658095SVladimir Kondratiev __entry->mid = wil_rxdesc_mid(d); 16498658095SVladimir Kondratiev __entry->cid = wil_rxdesc_cid(d); 16598658095SVladimir Kondratiev __entry->tid = wil_rxdesc_tid(d); 16698658095SVladimir Kondratiev __entry->type = wil_rxdesc_ftype(d); 16798658095SVladimir Kondratiev __entry->subtype = wil_rxdesc_subtype(d); 16898658095SVladimir Kondratiev __entry->seq = wil_rxdesc_seq(d); 16998658095SVladimir Kondratiev __entry->mcs = wil_rxdesc_mcs(d); 17098658095SVladimir Kondratiev ), 171bf0353a6SAhmad Masri TP_printk("index %d len %d mid %d cid (%%8) %d tid %d mcs %d seq 0x%03x" 17298658095SVladimir Kondratiev " type 0x%1x subtype 0x%1x", __entry->index, __entry->len, 17398658095SVladimir Kondratiev __entry->mid, __entry->cid, __entry->tid, __entry->mcs, 17498658095SVladimir Kondratiev __entry->seq, __entry->type, __entry->subtype) 17598658095SVladimir Kondratiev ); 17698658095SVladimir Kondratiev 1777be13fc3SGidon Studinski TRACE_EVENT(wil6210_rx_status, 1787be13fc3SGidon Studinski TP_PROTO(struct wil6210_priv *wil, u8 use_compressed, u16 buff_id, 1797be13fc3SGidon Studinski void *msg), 1807be13fc3SGidon Studinski TP_ARGS(wil, use_compressed, buff_id, msg), 1817be13fc3SGidon Studinski TP_STRUCT__entry(__field(u8, use_compressed) 1827be13fc3SGidon Studinski __field(u16, buff_id) 1837be13fc3SGidon Studinski __field(unsigned int, len) 1847be13fc3SGidon Studinski __field(u8, mid) 1857be13fc3SGidon Studinski __field(u8, cid) 1867be13fc3SGidon Studinski __field(u8, tid) 1877be13fc3SGidon Studinski __field(u8, type) 1887be13fc3SGidon Studinski __field(u8, subtype) 1897be13fc3SGidon Studinski __field(u16, seq) 1907be13fc3SGidon Studinski __field(u8, mcs) 1917be13fc3SGidon Studinski ), 1927be13fc3SGidon Studinski TP_fast_assign(__entry->use_compressed = use_compressed; 1937be13fc3SGidon Studinski __entry->buff_id = buff_id; 1947be13fc3SGidon Studinski __entry->len = wil_rx_status_get_length(msg); 1957be13fc3SGidon Studinski __entry->mid = wil_rx_status_get_mid(msg); 1967be13fc3SGidon Studinski __entry->cid = wil_rx_status_get_cid(msg); 1977be13fc3SGidon Studinski __entry->tid = wil_rx_status_get_tid(msg); 1987be13fc3SGidon Studinski __entry->type = wil_rx_status_get_frame_type(wil, 1997be13fc3SGidon Studinski msg); 2007be13fc3SGidon Studinski __entry->subtype = wil_rx_status_get_fc1(wil, msg); 2017be13fc3SGidon Studinski __entry->seq = wil_rx_status_get_seq(wil, msg); 2027be13fc3SGidon Studinski __entry->mcs = wil_rx_status_get_mcs(msg); 2037be13fc3SGidon Studinski ), 2047be13fc3SGidon Studinski TP_printk( 2057be13fc3SGidon Studinski "compressed %d buff_id %d len %d mid %d cid %d tid %d mcs %d seq 0x%03x type 0x%1x subtype 0x%1x", 2067be13fc3SGidon Studinski __entry->use_compressed, __entry->buff_id, __entry->len, 2077be13fc3SGidon Studinski __entry->mid, __entry->cid, __entry->tid, __entry->mcs, 2087be13fc3SGidon Studinski __entry->seq, __entry->type, __entry->subtype) 2097be13fc3SGidon Studinski ); 2107be13fc3SGidon Studinski 21198658095SVladimir Kondratiev TRACE_EVENT(wil6210_tx, 21298658095SVladimir Kondratiev TP_PROTO(u8 vring, u16 index, unsigned int len, u8 frags), 21398658095SVladimir Kondratiev TP_ARGS(vring, index, len, frags), 21498658095SVladimir Kondratiev TP_STRUCT__entry( 21598658095SVladimir Kondratiev __field(u8, vring) 21698658095SVladimir Kondratiev __field(u8, frags) 21798658095SVladimir Kondratiev __field(u16, index) 21898658095SVladimir Kondratiev __field(unsigned int, len) 21998658095SVladimir Kondratiev ), 22098658095SVladimir Kondratiev TP_fast_assign( 22198658095SVladimir Kondratiev __entry->vring = vring; 22298658095SVladimir Kondratiev __entry->frags = frags; 22398658095SVladimir Kondratiev __entry->index = index; 22498658095SVladimir Kondratiev __entry->len = len; 22598658095SVladimir Kondratiev ), 22698658095SVladimir Kondratiev TP_printk("vring %d index %d len %d frags %d", 22798658095SVladimir Kondratiev __entry->vring, __entry->index, __entry->len, __entry->frags) 22898658095SVladimir Kondratiev ); 22998658095SVladimir Kondratiev 23098658095SVladimir Kondratiev TRACE_EVENT(wil6210_tx_done, 23198658095SVladimir Kondratiev TP_PROTO(u8 vring, u16 index, unsigned int len, u8 err), 23298658095SVladimir Kondratiev TP_ARGS(vring, index, len, err), 23398658095SVladimir Kondratiev TP_STRUCT__entry( 23498658095SVladimir Kondratiev __field(u8, vring) 23598658095SVladimir Kondratiev __field(u8, err) 23698658095SVladimir Kondratiev __field(u16, index) 23798658095SVladimir Kondratiev __field(unsigned int, len) 23898658095SVladimir Kondratiev ), 23998658095SVladimir Kondratiev TP_fast_assign( 24098658095SVladimir Kondratiev __entry->vring = vring; 24198658095SVladimir Kondratiev __entry->index = index; 24298658095SVladimir Kondratiev __entry->len = len; 24398658095SVladimir Kondratiev __entry->err = err; 24498658095SVladimir Kondratiev ), 24598658095SVladimir Kondratiev TP_printk("vring %d index %d len %d err 0x%02x", 24698658095SVladimir Kondratiev __entry->vring, __entry->index, __entry->len, 24798658095SVladimir Kondratiev __entry->err) 24898658095SVladimir Kondratiev ); 24998658095SVladimir Kondratiev 2509202d7b6SMaya Erez TRACE_EVENT(wil6210_tx_status, 2519202d7b6SMaya Erez TP_PROTO(struct wil_ring_tx_status *msg, u16 index, 2529202d7b6SMaya Erez unsigned int len), 2539202d7b6SMaya Erez TP_ARGS(msg, index, len), 2549202d7b6SMaya Erez TP_STRUCT__entry(__field(u16, index) 2559202d7b6SMaya Erez __field(unsigned int, len) 2569202d7b6SMaya Erez __field(u8, num_descs) 2579202d7b6SMaya Erez __field(u8, ring_id) 2589202d7b6SMaya Erez __field(u8, status) 2599202d7b6SMaya Erez __field(u8, mcs) 2609202d7b6SMaya Erez 2619202d7b6SMaya Erez ), 2629202d7b6SMaya Erez TP_fast_assign(__entry->index = index; 2639202d7b6SMaya Erez __entry->len = len; 2649202d7b6SMaya Erez __entry->num_descs = msg->num_descriptors; 2659202d7b6SMaya Erez __entry->ring_id = msg->ring_id; 2669202d7b6SMaya Erez __entry->status = msg->status; 2679202d7b6SMaya Erez __entry->mcs = wil_tx_status_get_mcs(msg); 2689202d7b6SMaya Erez ), 2699202d7b6SMaya Erez TP_printk( 2709202d7b6SMaya Erez "ring_id %d swtail 0x%x len %d num_descs %d status 0x%x mcs %d", 2719202d7b6SMaya Erez __entry->ring_id, __entry->index, __entry->len, 2729202d7b6SMaya Erez __entry->num_descs, __entry->status, __entry->mcs) 2739202d7b6SMaya Erez ); 2749202d7b6SMaya Erez 27598658095SVladimir Kondratiev #endif /* WIL6210_TRACE_H || TRACE_HEADER_MULTI_READ*/ 27698658095SVladimir Kondratiev 27798658095SVladimir Kondratiev #if defined(CONFIG_WIL6210_TRACING) && !defined(__CHECKER__) 27898658095SVladimir Kondratiev /* we don't want to use include/trace/events */ 27998658095SVladimir Kondratiev #undef TRACE_INCLUDE_PATH 28098658095SVladimir Kondratiev #define TRACE_INCLUDE_PATH . 28198658095SVladimir Kondratiev #undef TRACE_INCLUDE_FILE 28298658095SVladimir Kondratiev #define TRACE_INCLUDE_FILE trace 28398658095SVladimir Kondratiev 28498658095SVladimir Kondratiev /* This part must be outside protection */ 28598658095SVladimir Kondratiev #include <trace/define_trace.h> 28698658095SVladimir Kondratiev #endif /* defined(CONFIG_WIL6210_TRACING) && !defined(__CHECKER__) */ 287