1*9ad28ba1STom Rix /* SPDX-License-Identifier: GPL-2.0-only */
22da4366fSEmmanuel Grumbach /*
32da4366fSEmmanuel Grumbach * Copyright(c) 2021 Intel Corporation
42da4366fSEmmanuel Grumbach */
52da4366fSEmmanuel Grumbach
6fe6db7edSEmmanuel Grumbach #if !defined(CONFIG_IWLWIFI_DEVICE_TRACING)
7fe6db7edSEmmanuel Grumbach
8fe6db7edSEmmanuel Grumbach #define trace_iwlmei_sap_data(...)
9fe6db7edSEmmanuel Grumbach
10fe6db7edSEmmanuel Grumbach #else
11fe6db7edSEmmanuel Grumbach
122da4366fSEmmanuel Grumbach #if !defined(__IWLWIFI_DEVICE_TRACE_IWLWIFI_SAP_DATA) || defined(TRACE_HEADER_MULTI_READ)
132da4366fSEmmanuel Grumbach
142da4366fSEmmanuel Grumbach #ifndef __IWLWIFI_DEVICE_TRACE_IWLWIFI_SAP_DATA
152da4366fSEmmanuel Grumbach enum iwl_sap_data_trace_type {
162da4366fSEmmanuel Grumbach IWL_SAP_RX_DATA_TO_AIR,
172da4366fSEmmanuel Grumbach IWL_SAP_TX_DATA_FROM_AIR,
182da4366fSEmmanuel Grumbach IWL_SAP_RX_DATA_DROPPED_FROM_AIR,
192da4366fSEmmanuel Grumbach IWL_SAP_TX_DHCP,
202da4366fSEmmanuel Grumbach };
212da4366fSEmmanuel Grumbach
222da4366fSEmmanuel Grumbach static inline size_t
iwlmei_sap_data_offset(enum iwl_sap_data_trace_type trace_type)232da4366fSEmmanuel Grumbach iwlmei_sap_data_offset(enum iwl_sap_data_trace_type trace_type)
242da4366fSEmmanuel Grumbach {
252da4366fSEmmanuel Grumbach switch (trace_type) {
262da4366fSEmmanuel Grumbach case IWL_SAP_RX_DATA_TO_AIR:
272da4366fSEmmanuel Grumbach return 0;
282da4366fSEmmanuel Grumbach case IWL_SAP_TX_DATA_FROM_AIR:
292da4366fSEmmanuel Grumbach case IWL_SAP_RX_DATA_DROPPED_FROM_AIR:
302da4366fSEmmanuel Grumbach return sizeof(struct iwl_sap_hdr);
312da4366fSEmmanuel Grumbach case IWL_SAP_TX_DHCP:
322da4366fSEmmanuel Grumbach return sizeof(struct iwl_sap_cb_data);
332da4366fSEmmanuel Grumbach default:
342da4366fSEmmanuel Grumbach WARN_ON_ONCE(1);
352da4366fSEmmanuel Grumbach }
362da4366fSEmmanuel Grumbach
372da4366fSEmmanuel Grumbach return 0;
382da4366fSEmmanuel Grumbach }
392da4366fSEmmanuel Grumbach #endif
402da4366fSEmmanuel Grumbach
412da4366fSEmmanuel Grumbach #define __IWLWIFI_DEVICE_TRACE_IWLWIFI_SAP_DATA
422da4366fSEmmanuel Grumbach
432da4366fSEmmanuel Grumbach #include <linux/tracepoint.h>
442da4366fSEmmanuel Grumbach #include <linux/skbuff.h>
452da4366fSEmmanuel Grumbach #include "sap.h"
462da4366fSEmmanuel Grumbach
472da4366fSEmmanuel Grumbach #undef TRACE_SYSTEM
482da4366fSEmmanuel Grumbach #define TRACE_SYSTEM iwlmei_sap_data
492da4366fSEmmanuel Grumbach
502da4366fSEmmanuel Grumbach TRACE_EVENT(iwlmei_sap_data,
512da4366fSEmmanuel Grumbach TP_PROTO(const struct sk_buff *skb,
522da4366fSEmmanuel Grumbach enum iwl_sap_data_trace_type trace_type),
532da4366fSEmmanuel Grumbach TP_ARGS(skb, trace_type),
542da4366fSEmmanuel Grumbach TP_STRUCT__entry(
552da4366fSEmmanuel Grumbach __dynamic_array(u8, data,
562da4366fSEmmanuel Grumbach skb->len - iwlmei_sap_data_offset(trace_type))
572da4366fSEmmanuel Grumbach __field(u32, trace_type)
582da4366fSEmmanuel Grumbach ),
592da4366fSEmmanuel Grumbach TP_fast_assign(
602da4366fSEmmanuel Grumbach size_t offset = iwlmei_sap_data_offset(trace_type);
612da4366fSEmmanuel Grumbach __entry->trace_type = trace_type;
622da4366fSEmmanuel Grumbach skb_copy_bits(skb, offset, __get_dynamic_array(data),
632da4366fSEmmanuel Grumbach skb->len - offset);
642da4366fSEmmanuel Grumbach ),
652da4366fSEmmanuel Grumbach TP_printk("sap_data:trace_type %d len %d",
662da4366fSEmmanuel Grumbach __entry->trace_type, __get_dynamic_array_len(data))
672da4366fSEmmanuel Grumbach );
682da4366fSEmmanuel Grumbach
69fe6db7edSEmmanuel Grumbach /*
70fe6db7edSEmmanuel Grumbach * If you add something here, add a stub in case
71fe6db7edSEmmanuel Grumbach * !defined(CONFIG_IWLWIFI_DEVICE_TRACING)
72fe6db7edSEmmanuel Grumbach */
73fe6db7edSEmmanuel Grumbach
742da4366fSEmmanuel Grumbach #endif /* __IWLWIFI_DEVICE_TRACE_IWLWIFI_SAP_DATA */
752da4366fSEmmanuel Grumbach
762da4366fSEmmanuel Grumbach #undef TRACE_INCLUDE_PATH
772da4366fSEmmanuel Grumbach #define TRACE_INCLUDE_PATH .
782da4366fSEmmanuel Grumbach #undef TRACE_INCLUDE_FILE
792da4366fSEmmanuel Grumbach #define TRACE_INCLUDE_FILE trace-data
802da4366fSEmmanuel Grumbach #include <trace/define_trace.h>
81fe6db7edSEmmanuel Grumbach
82fe6db7edSEmmanuel Grumbach #endif /* CONFIG_IWLWIFI_DEVICE_TRACING */
83