1 /* SPDX-License-Identifier: GPL-2.0 or BSD-3-Clause */
3 * Copyright(c) 2016 - 2018 Intel Corporation.
5 #if !defined(__RVT_TRACE_CQ_H) || defined(TRACE_HEADER_MULTI_READ)
6 #define __RVT_TRACE_CQ_H
8 #include <linux/tracepoint.h>
9 #include <linux/trace_seq.h>
11 #include <rdma/ib_verbs.h>
12 #include <rdma/rdmavt_cq.h>
15 #define TRACE_SYSTEM rvt_cq
17 #define wc_opcode_name(opcode) { IB_WC_##opcode, #opcode }
18 #define show_wc_opcode(opcode) \
19 __print_symbolic(opcode, \
20 wc_opcode_name(SEND), \
21 wc_opcode_name(RDMA_WRITE), \
22 wc_opcode_name(RDMA_READ), \
23 wc_opcode_name(COMP_SWAP), \
24 wc_opcode_name(FETCH_ADD), \
25 wc_opcode_name(LSO), \
26 wc_opcode_name(LOCAL_INV), \
27 wc_opcode_name(REG_MR), \
28 wc_opcode_name(MASKED_COMP_SWAP), \
29 wc_opcode_name(RECV), \
30 wc_opcode_name(RECV_RDMA_WITH_IMM))
32 #define CQ_ATTR_PRINT \
33 "[%s] user cq %s cqe %u comp_vector %d comp_vector_cpu %d flags %x"
35 DECLARE_EVENT_CLASS(rvt_cq_template,
36 TP_PROTO(struct rvt_cq *cq,
37 const struct ib_cq_init_attr *attr),
39 TP_STRUCT__entry(RDI_DEV_ENTRY(cq->rdi)
40 __field(struct rvt_mmap_info *, ip)
41 __field(unsigned int, cqe)
42 __field(int, comp_vector)
43 __field(int, comp_vector_cpu)
46 TP_fast_assign(RDI_DEV_ASSIGN(cq->rdi);
48 __entry->cqe = attr->cqe;
49 __entry->comp_vector = attr->comp_vector;
50 __entry->comp_vector_cpu =
52 __entry->flags = attr->flags;
54 TP_printk(CQ_ATTR_PRINT, __get_str(dev),
55 __entry->ip ? "true" : "false", __entry->cqe,
56 __entry->comp_vector, __entry->comp_vector_cpu,
61 DEFINE_EVENT(rvt_cq_template, rvt_create_cq,
62 TP_PROTO(struct rvt_cq *cq, const struct ib_cq_init_attr *attr),
66 "[%s] idx %u wr_id %llx status %u opcode %u,%s length %u qpn %x flags %x imm %x"
69 rvt_cq_entry_template,
70 TP_PROTO(struct rvt_cq *cq, struct ib_wc *wc, u32 idx),
73 RDI_DEV_ENTRY(cq->rdi)
84 RDI_DEV_ASSIGN(cq->rdi);
85 __entry->wr_id = wc->wr_id;
86 __entry->status = wc->status;
87 __entry->opcode = wc->opcode;
88 __entry->length = wc->byte_len;
89 __entry->qpn = wc->qp->qp_num;
91 __entry->flags = wc->wc_flags;
92 __entry->imm = be32_to_cpu(wc->ex.imm_data);
100 __entry->opcode, show_wc_opcode(__entry->opcode),
109 rvt_cq_entry_template, rvt_cq_enter,
110 TP_PROTO(struct rvt_cq *cq, struct ib_wc *wc, u32 idx),
111 TP_ARGS(cq, wc, idx));
114 rvt_cq_entry_template, rvt_cq_poll,
115 TP_PROTO(struct rvt_cq *cq, struct ib_wc *wc, u32 idx),
116 TP_ARGS(cq, wc, idx));
118 #endif /* __RVT_TRACE_CQ_H */
120 #undef TRACE_INCLUDE_PATH
121 #undef TRACE_INCLUDE_FILE
122 #define TRACE_INCLUDE_PATH .
123 #define TRACE_INCLUDE_FILE trace_cq
124 #include <trace/define_trace.h>