1462b6b21SSebastian Sanchez /*
25f14e4e6SSebastian Sanchez * Copyright(c) 2015, 2016, 2017 Intel Corporation.
3462b6b21SSebastian Sanchez *
4462b6b21SSebastian Sanchez * This file is provided under a dual BSD/GPLv2 license.  When using or
5462b6b21SSebastian Sanchez * redistributing this file, you may do so under either license.
6462b6b21SSebastian Sanchez *
7462b6b21SSebastian Sanchez * GPL LICENSE SUMMARY
8462b6b21SSebastian Sanchez *
9462b6b21SSebastian Sanchez * This program is free software; you can redistribute it and/or modify
10462b6b21SSebastian Sanchez * it under the terms of version 2 of the GNU General Public License as
11462b6b21SSebastian Sanchez * published by the Free Software Foundation.
12462b6b21SSebastian Sanchez *
13462b6b21SSebastian Sanchez * This program is distributed in the hope that it will be useful, but
14462b6b21SSebastian Sanchez * WITHOUT ANY WARRANTY; without even the implied warranty of
15462b6b21SSebastian Sanchez * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16462b6b21SSebastian Sanchez * General Public License for more details.
17462b6b21SSebastian Sanchez *
18462b6b21SSebastian Sanchez * BSD LICENSE
19462b6b21SSebastian Sanchez *
20462b6b21SSebastian Sanchez * Redistribution and use in source and binary forms, with or without
21462b6b21SSebastian Sanchez * modification, are permitted provided that the following conditions
22462b6b21SSebastian Sanchez * are met:
23462b6b21SSebastian Sanchez *
24462b6b21SSebastian Sanchez *  - Redistributions of source code must retain the above copyright
25462b6b21SSebastian Sanchez *    notice, this list of conditions and the following disclaimer.
26462b6b21SSebastian Sanchez *  - Redistributions in binary form must reproduce the above copyright
27462b6b21SSebastian Sanchez *    notice, this list of conditions and the following disclaimer in
28462b6b21SSebastian Sanchez *    the documentation and/or other materials provided with the
29462b6b21SSebastian Sanchez *    distribution.
30462b6b21SSebastian Sanchez *  - Neither the name of Intel Corporation nor the names of its
31462b6b21SSebastian Sanchez *    contributors may be used to endorse or promote products derived
32462b6b21SSebastian Sanchez *    from this software without specific prior written permission.
33462b6b21SSebastian Sanchez *
34462b6b21SSebastian Sanchez * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
35462b6b21SSebastian Sanchez * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
36462b6b21SSebastian Sanchez * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
37462b6b21SSebastian Sanchez * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
38462b6b21SSebastian Sanchez * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
39462b6b21SSebastian Sanchez * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
40462b6b21SSebastian Sanchez * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
41462b6b21SSebastian Sanchez * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
42462b6b21SSebastian Sanchez * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
43462b6b21SSebastian Sanchez * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
44462b6b21SSebastian Sanchez * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
45462b6b21SSebastian Sanchez *
46462b6b21SSebastian Sanchez */
47462b6b21SSebastian Sanchez #if !defined(__HFI1_TRACE_RC_H) || defined(TRACE_HEADER_MULTI_READ)
48462b6b21SSebastian Sanchez #define __HFI1_TRACE_RC_H
49462b6b21SSebastian Sanchez 
50462b6b21SSebastian Sanchez #include <linux/tracepoint.h>
51462b6b21SSebastian Sanchez #include <linux/trace_seq.h>
52462b6b21SSebastian Sanchez 
53462b6b21SSebastian Sanchez #include "hfi.h"
54462b6b21SSebastian Sanchez 
55462b6b21SSebastian Sanchez #undef TRACE_SYSTEM
56462b6b21SSebastian Sanchez #define TRACE_SYSTEM hfi1_rc
57462b6b21SSebastian Sanchez 
58462b6b21SSebastian Sanchez DECLARE_EVENT_CLASS(hfi1_rc_template,
59462b6b21SSebastian Sanchez 		    TP_PROTO(struct rvt_qp *qp, u32 psn),
60462b6b21SSebastian Sanchez 		    TP_ARGS(qp, psn),
61462b6b21SSebastian Sanchez 		    TP_STRUCT__entry(
62462b6b21SSebastian Sanchez 			DD_DEV_ENTRY(dd_from_ibdev(qp->ibqp.device))
63462b6b21SSebastian Sanchez 			__field(u32, qpn)
64462b6b21SSebastian Sanchez 			__field(u32, s_flags)
65462b6b21SSebastian Sanchez 			__field(u32, psn)
66462b6b21SSebastian Sanchez 			__field(u32, s_psn)
67462b6b21SSebastian Sanchez 			__field(u32, s_next_psn)
68462b6b21SSebastian Sanchez 			__field(u32, s_sending_psn)
69462b6b21SSebastian Sanchez 			__field(u32, s_sending_hpsn)
70462b6b21SSebastian Sanchez 			__field(u32, r_psn)
71462b6b21SSebastian Sanchez 			),
72462b6b21SSebastian Sanchez 		    TP_fast_assign(
73*78c14b38SJoe Perches 			DD_DEV_ASSIGN(dd_from_ibdev(qp->ibqp.device));
74462b6b21SSebastian Sanchez 			__entry->qpn = qp->ibqp.qp_num;
75462b6b21SSebastian Sanchez 			__entry->s_flags = qp->s_flags;
76462b6b21SSebastian Sanchez 			__entry->psn = psn;
77462b6b21SSebastian Sanchez 			__entry->s_psn = qp->s_psn;
78462b6b21SSebastian Sanchez 			__entry->s_next_psn = qp->s_next_psn;
79462b6b21SSebastian Sanchez 			__entry->s_sending_psn = qp->s_sending_psn;
80462b6b21SSebastian Sanchez 			__entry->s_sending_hpsn = qp->s_sending_hpsn;
81462b6b21SSebastian Sanchez 			__entry->r_psn = qp->r_psn;
82462b6b21SSebastian Sanchez 			),
83462b6b21SSebastian Sanchez 		    TP_printk(
84462b6b21SSebastian Sanchez 			"[%s] qpn 0x%x s_flags 0x%x psn 0x%x s_psn 0x%x s_next_psn 0x%x s_sending_psn 0x%x sending_hpsn 0x%x r_psn 0x%x",
85462b6b21SSebastian Sanchez 			__get_str(dev),
86462b6b21SSebastian Sanchez 			__entry->qpn,
87462b6b21SSebastian Sanchez 			__entry->s_flags,
88462b6b21SSebastian Sanchez 			__entry->psn,
89462b6b21SSebastian Sanchez 			__entry->s_psn,
90462b6b21SSebastian Sanchez 			__entry->s_next_psn,
91462b6b21SSebastian Sanchez 			__entry->s_sending_psn,
92462b6b21SSebastian Sanchez 			__entry->s_sending_hpsn,
93462b6b21SSebastian Sanchez 			__entry->r_psn
94462b6b21SSebastian Sanchez 			)
95462b6b21SSebastian Sanchez );
96462b6b21SSebastian Sanchez 
97462b6b21SSebastian Sanchez DEFINE_EVENT(hfi1_rc_template, hfi1_sendcomplete,
98462b6b21SSebastian Sanchez 	     TP_PROTO(struct rvt_qp *qp, u32 psn),
99462b6b21SSebastian Sanchez 	     TP_ARGS(qp, psn)
100462b6b21SSebastian Sanchez );
101462b6b21SSebastian Sanchez 
102462b6b21SSebastian Sanchez DEFINE_EVENT(hfi1_rc_template, hfi1_ack,
103462b6b21SSebastian Sanchez 	     TP_PROTO(struct rvt_qp *qp, u32 psn),
104462b6b21SSebastian Sanchez 	     TP_ARGS(qp, psn)
105462b6b21SSebastian Sanchez );
106462b6b21SSebastian Sanchez 
107462b6b21SSebastian Sanchez DEFINE_EVENT(hfi1_rc_template, hfi1_rcv_error,
108462b6b21SSebastian Sanchez 	     TP_PROTO(struct rvt_qp *qp, u32 psn),
109462b6b21SSebastian Sanchez 	     TP_ARGS(qp, psn)
110462b6b21SSebastian Sanchez );
111462b6b21SSebastian Sanchez 
1123ce5daa2SKaike Wan DEFINE_EVENT(/* event */
1133ce5daa2SKaike Wan 	hfi1_rc_template, hfi1_rc_completion,
1143ce5daa2SKaike Wan 	TP_PROTO(struct rvt_qp *qp, u32 psn),
1153ce5daa2SKaike Wan 	TP_ARGS(qp, psn)
1163ce5daa2SKaike Wan );
1173ce5daa2SKaike Wan 
1183ce5daa2SKaike Wan DECLARE_EVENT_CLASS(/* rc_ack */
1193ce5daa2SKaike Wan 	hfi1_rc_ack_template,
1203ce5daa2SKaike Wan 	TP_PROTO(struct rvt_qp *qp, u32 aeth, u32 psn,
1213ce5daa2SKaike Wan 		 struct rvt_swqe *wqe),
1223ce5daa2SKaike Wan 	TP_ARGS(qp, aeth, psn, wqe),
1233ce5daa2SKaike Wan 	TP_STRUCT__entry(/* entry */
1243ce5daa2SKaike Wan 		DD_DEV_ENTRY(dd_from_ibdev(qp->ibqp.device))
1253ce5daa2SKaike Wan 		__field(u32, qpn)
1263ce5daa2SKaike Wan 		__field(u32, aeth)
1273ce5daa2SKaike Wan 		__field(u32, psn)
1283ce5daa2SKaike Wan 		__field(u8, opcode)
1293ce5daa2SKaike Wan 		__field(u32, spsn)
1303ce5daa2SKaike Wan 		__field(u32, lpsn)
1313ce5daa2SKaike Wan 	),
1323ce5daa2SKaike Wan 	TP_fast_assign(/* assign */
133*78c14b38SJoe Perches 		DD_DEV_ASSIGN(dd_from_ibdev(qp->ibqp.device));
1343ce5daa2SKaike Wan 		__entry->qpn = qp->ibqp.qp_num;
1353ce5daa2SKaike Wan 		__entry->aeth = aeth;
1363ce5daa2SKaike Wan 		__entry->psn = psn;
1373ce5daa2SKaike Wan 		__entry->opcode = wqe->wr.opcode;
1383ce5daa2SKaike Wan 		__entry->spsn = wqe->psn;
1393ce5daa2SKaike Wan 		__entry->lpsn = wqe->lpsn;
1403ce5daa2SKaike Wan 	),
1413ce5daa2SKaike Wan 	TP_printk(/* print */
1423ce5daa2SKaike Wan 		"[%s] qpn 0x%x aeth 0x%x psn 0x%x opcode 0x%x spsn 0x%x lpsn 0x%x",
1433ce5daa2SKaike Wan 		__get_str(dev),
1443ce5daa2SKaike Wan 		__entry->qpn,
1453ce5daa2SKaike Wan 		__entry->aeth,
1463ce5daa2SKaike Wan 		__entry->psn,
1473ce5daa2SKaike Wan 		__entry->opcode,
1483ce5daa2SKaike Wan 		__entry->spsn,
1493ce5daa2SKaike Wan 		__entry->lpsn
1503ce5daa2SKaike Wan 	)
1513ce5daa2SKaike Wan );
1523ce5daa2SKaike Wan 
1533ce5daa2SKaike Wan DEFINE_EVENT(/* do_rc_ack */
1543ce5daa2SKaike Wan 	hfi1_rc_ack_template, hfi1_rc_ack_do,
1553ce5daa2SKaike Wan 	TP_PROTO(struct rvt_qp *qp, u32 aeth, u32 psn,
1563ce5daa2SKaike Wan 		 struct rvt_swqe *wqe),
1573ce5daa2SKaike Wan 	TP_ARGS(qp, aeth, psn, wqe)
1583ce5daa2SKaike Wan );
1593ce5daa2SKaike Wan 
160462b6b21SSebastian Sanchez #endif /* __HFI1_TRACE_RC_H */
161462b6b21SSebastian Sanchez 
162462b6b21SSebastian Sanchez #undef TRACE_INCLUDE_PATH
163462b6b21SSebastian Sanchez #undef TRACE_INCLUDE_FILE
164462b6b21SSebastian Sanchez #define TRACE_INCLUDE_PATH .
165462b6b21SSebastian Sanchez #define TRACE_INCLUDE_FILE trace_rc
166462b6b21SSebastian Sanchez #include <trace/define_trace.h>
167