Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 or BSD-3-Clause */
0002 /*
0003  * Copyright(c) 2016 - 2018 Intel Corporation.
0004  */
0005 #if !defined(__RVT_TRACE_CQ_H) || defined(TRACE_HEADER_MULTI_READ)
0006 #define __RVT_TRACE_CQ_H
0007 
0008 #include <linux/tracepoint.h>
0009 #include <linux/trace_seq.h>
0010 
0011 #include <rdma/ib_verbs.h>
0012 #include <rdma/rdmavt_cq.h>
0013 
0014 #undef TRACE_SYSTEM
0015 #define TRACE_SYSTEM rvt_cq
0016 
0017 #define wc_opcode_name(opcode) { IB_WC_##opcode, #opcode  }
0018 #define show_wc_opcode(opcode)                                \
0019 __print_symbolic(opcode,                                      \
0020     wc_opcode_name(SEND),                                 \
0021     wc_opcode_name(RDMA_WRITE),                           \
0022     wc_opcode_name(RDMA_READ),                            \
0023     wc_opcode_name(COMP_SWAP),                            \
0024     wc_opcode_name(FETCH_ADD),                            \
0025     wc_opcode_name(LSO),                                  \
0026     wc_opcode_name(LOCAL_INV),                            \
0027     wc_opcode_name(REG_MR),                               \
0028     wc_opcode_name(MASKED_COMP_SWAP),                     \
0029     wc_opcode_name(RECV),                                 \
0030     wc_opcode_name(RECV_RDMA_WITH_IMM))
0031 
0032 #define CQ_ATTR_PRINT \
0033 "[%s] user cq %s cqe %u comp_vector %d comp_vector_cpu %d flags %x"
0034 
0035 DECLARE_EVENT_CLASS(rvt_cq_template,
0036             TP_PROTO(struct rvt_cq *cq,
0037                  const struct ib_cq_init_attr *attr),
0038             TP_ARGS(cq, attr),
0039             TP_STRUCT__entry(RDI_DEV_ENTRY(cq->rdi)
0040                      __field(struct rvt_mmap_info *, ip)
0041                      __field(unsigned int, cqe)
0042                      __field(int, comp_vector)
0043                      __field(int, comp_vector_cpu)
0044                      __field(u32, flags)
0045                      ),
0046             TP_fast_assign(RDI_DEV_ASSIGN(cq->rdi);
0047                    __entry->ip = cq->ip;
0048                    __entry->cqe = attr->cqe;
0049                    __entry->comp_vector = attr->comp_vector;
0050                    __entry->comp_vector_cpu =
0051                             cq->comp_vector_cpu;
0052                    __entry->flags = attr->flags;
0053                    ),
0054             TP_printk(CQ_ATTR_PRINT, __get_str(dev),
0055                   __entry->ip ? "true" : "false", __entry->cqe,
0056                   __entry->comp_vector, __entry->comp_vector_cpu,
0057                   __entry->flags
0058                   )
0059 );
0060 
0061 DEFINE_EVENT(rvt_cq_template, rvt_create_cq,
0062          TP_PROTO(struct rvt_cq *cq, const struct ib_cq_init_attr *attr),
0063          TP_ARGS(cq, attr));
0064 
0065 #define CQ_PRN \
0066 "[%s] idx %u wr_id %llx status %u opcode %u,%s length %u qpn %x flags %x imm %x"
0067 
0068 DECLARE_EVENT_CLASS(
0069     rvt_cq_entry_template,
0070     TP_PROTO(struct rvt_cq *cq, struct ib_wc *wc, u32 idx),
0071     TP_ARGS(cq, wc, idx),
0072     TP_STRUCT__entry(
0073         RDI_DEV_ENTRY(cq->rdi)
0074         __field(u64, wr_id)
0075         __field(u32, status)
0076         __field(u32, opcode)
0077         __field(u32, qpn)
0078         __field(u32, length)
0079         __field(u32, idx)
0080         __field(u32, flags)
0081         __field(u32, imm)
0082     ),
0083     TP_fast_assign(
0084         RDI_DEV_ASSIGN(cq->rdi);
0085         __entry->wr_id = wc->wr_id;
0086         __entry->status = wc->status;
0087         __entry->opcode = wc->opcode;
0088         __entry->length = wc->byte_len;
0089         __entry->qpn = wc->qp->qp_num;
0090         __entry->idx = idx;
0091         __entry->flags = wc->wc_flags;
0092         __entry->imm = be32_to_cpu(wc->ex.imm_data);
0093     ),
0094     TP_printk(
0095         CQ_PRN,
0096         __get_str(dev),
0097         __entry->idx,
0098         __entry->wr_id,
0099         __entry->status,
0100         __entry->opcode, show_wc_opcode(__entry->opcode),
0101         __entry->length,
0102         __entry->qpn,
0103         __entry->flags,
0104         __entry->imm
0105     )
0106 );
0107 
0108 DEFINE_EVENT(
0109     rvt_cq_entry_template, rvt_cq_enter,
0110     TP_PROTO(struct rvt_cq *cq, struct ib_wc *wc, u32 idx),
0111     TP_ARGS(cq, wc, idx));
0112 
0113 DEFINE_EVENT(
0114     rvt_cq_entry_template, rvt_cq_poll,
0115     TP_PROTO(struct rvt_cq *cq, struct ib_wc *wc, u32 idx),
0116     TP_ARGS(cq, wc, idx));
0117 
0118 #endif /* __RVT_TRACE_CQ_H */
0119 
0120 #undef TRACE_INCLUDE_PATH
0121 #undef TRACE_INCLUDE_FILE
0122 #define TRACE_INCLUDE_PATH .
0123 #define TRACE_INCLUDE_FILE trace_cq
0124 #include <trace/define_trace.h>