18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */
28c2ecf20Sopenharmony_ci/*
38c2ecf20Sopenharmony_ci * Portions of this file
48c2ecf20Sopenharmony_ci * Copyright (C) 2019 Intel Corporation
58c2ecf20Sopenharmony_ci */
68c2ecf20Sopenharmony_ci
78c2ecf20Sopenharmony_ci#ifdef CONFIG_MAC80211_MESSAGE_TRACING
88c2ecf20Sopenharmony_ci
98c2ecf20Sopenharmony_ci#if !defined(__MAC80211_MSG_DRIVER_TRACE) || defined(TRACE_HEADER_MULTI_READ)
108c2ecf20Sopenharmony_ci#define __MAC80211_MSG_DRIVER_TRACE
118c2ecf20Sopenharmony_ci
128c2ecf20Sopenharmony_ci#include <linux/tracepoint.h>
138c2ecf20Sopenharmony_ci#include <net/mac80211.h>
148c2ecf20Sopenharmony_ci#include "ieee80211_i.h"
158c2ecf20Sopenharmony_ci
168c2ecf20Sopenharmony_ci#undef TRACE_SYSTEM
178c2ecf20Sopenharmony_ci#define TRACE_SYSTEM mac80211_msg
188c2ecf20Sopenharmony_ci
198c2ecf20Sopenharmony_ci#define MAX_MSG_LEN	120
208c2ecf20Sopenharmony_ci
218c2ecf20Sopenharmony_ciDECLARE_EVENT_CLASS(mac80211_msg_event,
228c2ecf20Sopenharmony_ci	TP_PROTO(struct va_format *vaf),
238c2ecf20Sopenharmony_ci
248c2ecf20Sopenharmony_ci	TP_ARGS(vaf),
258c2ecf20Sopenharmony_ci
268c2ecf20Sopenharmony_ci	TP_STRUCT__entry(
278c2ecf20Sopenharmony_ci		__dynamic_array(char, msg, MAX_MSG_LEN)
288c2ecf20Sopenharmony_ci	),
298c2ecf20Sopenharmony_ci
308c2ecf20Sopenharmony_ci	TP_fast_assign(
318c2ecf20Sopenharmony_ci		WARN_ON_ONCE(vsnprintf(__get_dynamic_array(msg),
328c2ecf20Sopenharmony_ci				       MAX_MSG_LEN, vaf->fmt,
338c2ecf20Sopenharmony_ci				       *vaf->va) >= MAX_MSG_LEN);
348c2ecf20Sopenharmony_ci	),
358c2ecf20Sopenharmony_ci
368c2ecf20Sopenharmony_ci	TP_printk("%s", __get_str(msg))
378c2ecf20Sopenharmony_ci);
388c2ecf20Sopenharmony_ci
398c2ecf20Sopenharmony_ciDEFINE_EVENT(mac80211_msg_event, mac80211_info,
408c2ecf20Sopenharmony_ci	TP_PROTO(struct va_format *vaf),
418c2ecf20Sopenharmony_ci	TP_ARGS(vaf)
428c2ecf20Sopenharmony_ci);
438c2ecf20Sopenharmony_ciDEFINE_EVENT(mac80211_msg_event, mac80211_dbg,
448c2ecf20Sopenharmony_ci	TP_PROTO(struct va_format *vaf),
458c2ecf20Sopenharmony_ci	TP_ARGS(vaf)
468c2ecf20Sopenharmony_ci);
478c2ecf20Sopenharmony_ciDEFINE_EVENT(mac80211_msg_event, mac80211_err,
488c2ecf20Sopenharmony_ci	TP_PROTO(struct va_format *vaf),
498c2ecf20Sopenharmony_ci	TP_ARGS(vaf)
508c2ecf20Sopenharmony_ci);
518c2ecf20Sopenharmony_ci#endif /* !__MAC80211_MSG_DRIVER_TRACE || TRACE_HEADER_MULTI_READ */
528c2ecf20Sopenharmony_ci
538c2ecf20Sopenharmony_ci#undef TRACE_INCLUDE_PATH
548c2ecf20Sopenharmony_ci#define TRACE_INCLUDE_PATH .
558c2ecf20Sopenharmony_ci#undef TRACE_INCLUDE_FILE
568c2ecf20Sopenharmony_ci#define TRACE_INCLUDE_FILE trace_msg
578c2ecf20Sopenharmony_ci#include <trace/define_trace.h>
588c2ecf20Sopenharmony_ci
598c2ecf20Sopenharmony_ci#endif
60