18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: (GPL-2.0 OR BSD-3-Clause) */
28c2ecf20Sopenharmony_ci/*
38c2ecf20Sopenharmony_ci * Copyright(c) 2018 Intel Corporation.
48c2ecf20Sopenharmony_ci *
58c2ecf20Sopenharmony_ci */
68c2ecf20Sopenharmony_ci#if !defined(__HFI1_TRACE_IOWAIT_H) || defined(TRACE_HEADER_MULTI_READ)
78c2ecf20Sopenharmony_ci#define __HFI1_TRACE_IOWAIT_H
88c2ecf20Sopenharmony_ci
98c2ecf20Sopenharmony_ci#include <linux/tracepoint.h>
108c2ecf20Sopenharmony_ci#include "iowait.h"
118c2ecf20Sopenharmony_ci#include "verbs.h"
128c2ecf20Sopenharmony_ci
138c2ecf20Sopenharmony_ci#undef TRACE_SYSTEM
148c2ecf20Sopenharmony_ci#define TRACE_SYSTEM hfi1_iowait
158c2ecf20Sopenharmony_ci
168c2ecf20Sopenharmony_ciDECLARE_EVENT_CLASS(hfi1_iowait_template,
178c2ecf20Sopenharmony_ci		    TP_PROTO(struct iowait *wait, u32 flag),
188c2ecf20Sopenharmony_ci		    TP_ARGS(wait, flag),
198c2ecf20Sopenharmony_ci		    TP_STRUCT__entry(/* entry */
208c2ecf20Sopenharmony_ci			    __field(unsigned long, addr)
218c2ecf20Sopenharmony_ci			    __field(unsigned long, flags)
228c2ecf20Sopenharmony_ci			    __field(u32, flag)
238c2ecf20Sopenharmony_ci			    __field(u32, qpn)
248c2ecf20Sopenharmony_ci			    ),
258c2ecf20Sopenharmony_ci		    TP_fast_assign(/* assign */
268c2ecf20Sopenharmony_ci			    __entry->addr = (unsigned long)wait;
278c2ecf20Sopenharmony_ci			    __entry->flags = wait->flags;
288c2ecf20Sopenharmony_ci			    __entry->flag = (1 << flag);
298c2ecf20Sopenharmony_ci			    __entry->qpn = iowait_to_qp(wait)->ibqp.qp_num;
308c2ecf20Sopenharmony_ci			    ),
318c2ecf20Sopenharmony_ci		    TP_printk(/* print */
328c2ecf20Sopenharmony_ci			    "iowait 0x%lx qp %u flags 0x%lx flag 0x%x",
338c2ecf20Sopenharmony_ci			    __entry->addr,
348c2ecf20Sopenharmony_ci			    __entry->qpn,
358c2ecf20Sopenharmony_ci			    __entry->flags,
368c2ecf20Sopenharmony_ci			    __entry->flag
378c2ecf20Sopenharmony_ci			    )
388c2ecf20Sopenharmony_ci	);
398c2ecf20Sopenharmony_ci
408c2ecf20Sopenharmony_ciDEFINE_EVENT(hfi1_iowait_template, hfi1_iowait_set,
418c2ecf20Sopenharmony_ci	     TP_PROTO(struct iowait *wait, u32 flag),
428c2ecf20Sopenharmony_ci	     TP_ARGS(wait, flag));
438c2ecf20Sopenharmony_ci
448c2ecf20Sopenharmony_ciDEFINE_EVENT(hfi1_iowait_template, hfi1_iowait_clear,
458c2ecf20Sopenharmony_ci	     TP_PROTO(struct iowait *wait, u32 flag),
468c2ecf20Sopenharmony_ci	     TP_ARGS(wait, flag));
478c2ecf20Sopenharmony_ci
488c2ecf20Sopenharmony_ci#endif /* __HFI1_TRACE_IOWAIT_H */
498c2ecf20Sopenharmony_ci
508c2ecf20Sopenharmony_ci#undef TRACE_INCLUDE_PATH
518c2ecf20Sopenharmony_ci#undef TRACE_INCLUDE_FILE
528c2ecf20Sopenharmony_ci#define TRACE_INCLUDE_PATH .
538c2ecf20Sopenharmony_ci#define TRACE_INCLUDE_FILE trace_iowait
548c2ecf20Sopenharmony_ci#include <trace/define_trace.h>
55