1 /* SPDX-License-Identifier: GPL-2.0-only */
2 /*
3 * Copyright(c) 2021 Intel Corporation
4 */
5
6 #if !defined(CONFIG_IWLWIFI_DEVICE_TRACING)
7
8 #define trace_iwlmei_sap_data(...)
9
10 #else
11
12 #if !defined(__IWLWIFI_DEVICE_TRACE_IWLWIFI_SAP_DATA) || defined(TRACE_HEADER_MULTI_READ)
13
14 #ifndef __IWLWIFI_DEVICE_TRACE_IWLWIFI_SAP_DATA
15 enum iwl_sap_data_trace_type {
16 IWL_SAP_RX_DATA_TO_AIR,
17 IWL_SAP_TX_DATA_FROM_AIR,
18 IWL_SAP_RX_DATA_DROPPED_FROM_AIR,
19 IWL_SAP_TX_DHCP,
20 };
21
22 static inline size_t
iwlmei_sap_data_offset(enum iwl_sap_data_trace_type trace_type)23 iwlmei_sap_data_offset(enum iwl_sap_data_trace_type trace_type)
24 {
25 switch (trace_type) {
26 case IWL_SAP_RX_DATA_TO_AIR:
27 return 0;
28 case IWL_SAP_TX_DATA_FROM_AIR:
29 case IWL_SAP_RX_DATA_DROPPED_FROM_AIR:
30 return sizeof(struct iwl_sap_hdr);
31 case IWL_SAP_TX_DHCP:
32 return sizeof(struct iwl_sap_cb_data);
33 default:
34 WARN_ON_ONCE(1);
35 }
36
37 return 0;
38 }
39 #endif
40
41 #define __IWLWIFI_DEVICE_TRACE_IWLWIFI_SAP_DATA
42
43 #include <linux/tracepoint.h>
44 #include <linux/skbuff.h>
45 #include "sap.h"
46
47 #undef TRACE_SYSTEM
48 #define TRACE_SYSTEM iwlmei_sap_data
49
50 TRACE_EVENT(iwlmei_sap_data,
51 TP_PROTO(const struct sk_buff *skb,
52 enum iwl_sap_data_trace_type trace_type),
53 TP_ARGS(skb, trace_type),
54 TP_STRUCT__entry(
55 __dynamic_array(u8, data,
56 skb->len - iwlmei_sap_data_offset(trace_type))
57 __field(u32, trace_type)
58 ),
59 TP_fast_assign(
60 size_t offset = iwlmei_sap_data_offset(trace_type);
61 __entry->trace_type = trace_type;
62 skb_copy_bits(skb, offset, __get_dynamic_array(data),
63 skb->len - offset);
64 ),
65 TP_printk("sap_data:trace_type %d len %d",
66 __entry->trace_type, __get_dynamic_array_len(data))
67 );
68
69 /*
70 * If you add something here, add a stub in case
71 * !defined(CONFIG_IWLWIFI_DEVICE_TRACING)
72 */
73
74 #endif /* __IWLWIFI_DEVICE_TRACE_IWLWIFI_SAP_DATA */
75
76 #undef TRACE_INCLUDE_PATH
77 #define TRACE_INCLUDE_PATH .
78 #undef TRACE_INCLUDE_FILE
79 #define TRACE_INCLUDE_FILE trace-data
80 #include <trace/define_trace.h>
81
82 #endif /* CONFIG_IWLWIFI_DEVICE_TRACING */
83