cachepc-linux

Fork of AMDESE/linux with modifications for CachePC side-channel attack
git clone https://git.sinitax.com/sinitax/cachepc-linux
Log | Files | Refs | README | LICENSE | sfeed.txt

iwl-devtrace-iwlwifi.h (4020B)


      1/* SPDX-License-Identifier: GPL-2.0-only */
      2/******************************************************************************
      3 *
      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
      8 *****************************************************************************/
      9
     10#if !defined(__IWLWIFI_DEVICE_TRACE_IWLWIFI) || defined(TRACE_HEADER_MULTI_READ)
     11#define __IWLWIFI_DEVICE_TRACE_IWLWIFI
     12
     13#include <linux/tracepoint.h>
     14
     15#undef TRACE_SYSTEM
     16#define TRACE_SYSTEM iwlwifi
     17
     18TRACE_EVENT(iwlwifi_dev_hcmd,
     19	TP_PROTO(const struct device *dev,
     20		 struct iwl_host_cmd *cmd, u16 total_size,
     21		 struct iwl_cmd_header_wide *hdr),
     22	TP_ARGS(dev, cmd, total_size, hdr),
     23	TP_STRUCT__entry(
     24		DEV_ENTRY
     25		__dynamic_array(u8, hcmd, total_size)
     26		__field(u32, flags)
     27	),
     28	TP_fast_assign(
     29		int i, offset = sizeof(struct iwl_cmd_header);
     30
     31		if (hdr->group_id)
     32			offset = sizeof(struct iwl_cmd_header_wide);
     33
     34		DEV_ASSIGN;
     35		__entry->flags = cmd->flags;
     36		memcpy(__get_dynamic_array(hcmd), hdr, offset);
     37
     38		for (i = 0; i < IWL_MAX_CMD_TBS_PER_TFD; i++) {
     39			if (!cmd->len[i])
     40				continue;
     41			memcpy((u8 *)__get_dynamic_array(hcmd) + offset,
     42			       cmd->data[i], cmd->len[i]);
     43			offset += cmd->len[i];
     44		}
     45	),
     46	TP_printk("[%s] hcmd %#.2x.%#.2x (%ssync)",
     47		  __get_str(dev), ((u8 *)__get_dynamic_array(hcmd))[1],
     48		  ((u8 *)__get_dynamic_array(hcmd))[0],
     49		  __entry->flags & CMD_ASYNC ? "a" : "")
     50);
     51
     52TRACE_EVENT(iwlwifi_dev_rx,
     53	TP_PROTO(const struct device *dev, const struct iwl_trans *trans,
     54		 struct iwl_rx_packet *pkt, size_t len),
     55	TP_ARGS(dev, trans, pkt, len),
     56	TP_STRUCT__entry(
     57		DEV_ENTRY
     58		__field(u16, cmd)
     59		__field(u8, hdr_offset)
     60		__dynamic_array(u8, rxbuf,
     61				iwl_rx_trace_len(trans, pkt, len, NULL))
     62	),
     63	TP_fast_assign(
     64		size_t hdr_offset = 0;
     65
     66		DEV_ASSIGN;
     67		__entry->cmd = WIDE_ID(pkt->hdr.group_id, pkt->hdr.cmd);
     68		memcpy(__get_dynamic_array(rxbuf), pkt,
     69		       iwl_rx_trace_len(trans, pkt, len, &hdr_offset));
     70		__entry->hdr_offset = hdr_offset;
     71	),
     72	TP_printk("[%s] RX cmd %#.2x",
     73		  __get_str(dev), __entry->cmd)
     74);
     75
     76TRACE_EVENT(iwlwifi_dev_tx,
     77	TP_PROTO(const struct device *dev, struct sk_buff *skb,
     78		 void *tfd, size_t tfdlen,
     79		 void *buf0, size_t buf0_len,
     80		 int hdr_len),
     81	TP_ARGS(dev, skb, tfd, tfdlen, buf0, buf0_len, hdr_len),
     82	TP_STRUCT__entry(
     83		DEV_ENTRY
     84		__field(void *, skbaddr)
     85		__field(size_t, framelen)
     86		__dynamic_array(u8, tfd, tfdlen)
     87
     88		/*
     89		 * Do not insert between or below these items,
     90		 * we want to keep the frame together (except
     91		 * for the possible padding).
     92		 */
     93		__dynamic_array(u8, buf0, buf0_len)
     94		__dynamic_array(u8, buf1, hdr_len > 0 && iwl_trace_data(skb) ?
     95						0 : skb->len - hdr_len)
     96	),
     97	TP_fast_assign(
     98		DEV_ASSIGN;
     99		__entry->skbaddr = skb;
    100		__entry->framelen = buf0_len;
    101		if (hdr_len > 0)
    102			__entry->framelen += skb->len - hdr_len;
    103		memcpy(__get_dynamic_array(tfd), tfd, tfdlen);
    104		memcpy(__get_dynamic_array(buf0), buf0, buf0_len);
    105		if (hdr_len > 0 && !iwl_trace_data(skb))
    106			skb_copy_bits(skb, hdr_len,
    107				      __get_dynamic_array(buf1),
    108				      skb->len - hdr_len);
    109	),
    110	TP_printk("[%s] TX %.2x (%zu bytes) skbaddr=%p",
    111		  __get_str(dev), ((u8 *)__get_dynamic_array(buf0))[0],
    112		  __entry->framelen, __entry->skbaddr)
    113);
    114
    115TRACE_EVENT(iwlwifi_dev_ucode_event,
    116	TP_PROTO(const struct device *dev, u32 time, u32 data, u32 ev),
    117	TP_ARGS(dev, time, data, ev),
    118	TP_STRUCT__entry(
    119		DEV_ENTRY
    120
    121		__field(u32, time)
    122		__field(u32, data)
    123		__field(u32, ev)
    124	),
    125	TP_fast_assign(
    126		DEV_ASSIGN;
    127		__entry->time = time;
    128		__entry->data = data;
    129		__entry->ev = ev;
    130	),
    131	TP_printk("[%s] EVT_LOGT:%010u:0x%08x:%04u",
    132		  __get_str(dev), __entry->time, __entry->data, __entry->ev)
    133);
    134#endif /* __IWLWIFI_DEVICE_TRACE_IWLWIFI */
    135
    136#undef TRACE_INCLUDE_PATH
    137#define TRACE_INCLUDE_PATH .
    138#undef TRACE_INCLUDE_FILE
    139#define TRACE_INCLUDE_FILE iwl-devtrace-iwlwifi
    140#include <trace/define_trace.h>