1 /* SPDX-License-Identifier: GPL-2.0 */ 2 #undef TRACE_SYSTEM 3 #define TRACE_SYSTEM vsock 4 5 #if !defined(_TRACE_VSOCK_VIRTIO_TRANSPORT_COMMON_H) || \ 6 defined(TRACE_HEADER_MULTI_READ) 7 #define _TRACE_VSOCK_VIRTIO_TRANSPORT_COMMON_H 8 9 #include <linux/tracepoint.h> 10 11 TRACE_DEFINE_ENUM(VIRTIO_VSOCK_TYPE_STREAM); 12 TRACE_DEFINE_ENUM(VIRTIO_VSOCK_TYPE_SEQPACKET); 13 14 #define show_type(val) \ 15 __print_symbolic(val, \ 16 { VIRTIO_VSOCK_TYPE_STREAM, "STREAM" }, \ 17 { VIRTIO_VSOCK_TYPE_SEQPACKET, "SEQPACKET" }) 18 19 TRACE_DEFINE_ENUM(VIRTIO_VSOCK_OP_INVALID); 20 TRACE_DEFINE_ENUM(VIRTIO_VSOCK_OP_REQUEST); 21 TRACE_DEFINE_ENUM(VIRTIO_VSOCK_OP_RESPONSE); 22 TRACE_DEFINE_ENUM(VIRTIO_VSOCK_OP_RST); 23 TRACE_DEFINE_ENUM(VIRTIO_VSOCK_OP_SHUTDOWN); 24 TRACE_DEFINE_ENUM(VIRTIO_VSOCK_OP_RW); 25 TRACE_DEFINE_ENUM(VIRTIO_VSOCK_OP_CREDIT_UPDATE); 26 TRACE_DEFINE_ENUM(VIRTIO_VSOCK_OP_CREDIT_REQUEST); 27 28 #define show_op(val) \ 29 __print_symbolic(val, \ 30 { VIRTIO_VSOCK_OP_INVALID, "INVALID" }, \ 31 { VIRTIO_VSOCK_OP_REQUEST, "REQUEST" }, \ 32 { VIRTIO_VSOCK_OP_RESPONSE, "RESPONSE" }, \ 33 { VIRTIO_VSOCK_OP_RST, "RST" }, \ 34 { VIRTIO_VSOCK_OP_SHUTDOWN, "SHUTDOWN" }, \ 35 { VIRTIO_VSOCK_OP_RW, "RW" }, \ 36 { VIRTIO_VSOCK_OP_CREDIT_UPDATE, "CREDIT_UPDATE" }, \ 37 { VIRTIO_VSOCK_OP_CREDIT_REQUEST, "CREDIT_REQUEST" }) 38 39 TRACE_EVENT(virtio_transport_alloc_pkt, 40 TP_PROTO( 41 __u32 src_cid, __u32 src_port, 42 __u32 dst_cid, __u32 dst_port, 43 __u32 len, 44 __u16 type, 45 __u16 op, 46 __u32 flags, 47 bool zcopy 48 ), 49 TP_ARGS( 50 src_cid, src_port, 51 dst_cid, dst_port, 52 len, 53 type, 54 op, 55 flags, 56 zcopy 57 ), 58 TP_STRUCT__entry( 59 __field(__u32, src_cid) 60 __field(__u32, src_port) 61 __field(__u32, dst_cid) 62 __field(__u32, dst_port) 63 __field(__u32, len) 64 __field(__u16, type) 65 __field(__u16, op) 66 __field(__u32, flags) 67 __field(bool, zcopy) 68 ), 69 TP_fast_assign( 70 __entry->src_cid = src_cid; 71 __entry->src_port = src_port; 72 __entry->dst_cid = dst_cid; 73 __entry->dst_port = dst_port; 74 __entry->len = len; 75 __entry->type = type; 76 __entry->op = op; 77 __entry->flags = flags; 78 __entry->zcopy = zcopy; 79 ), 80 TP_printk("%u:%u -> %u:%u len=%u type=%s op=%s flags=%#x zcopy=%s", 81 __entry->src_cid, __entry->src_port, 82 __entry->dst_cid, __entry->dst_port, 83 __entry->len, 84 show_type(__entry->type), 85 show_op(__entry->op), 86 __entry->flags, __entry->zcopy ? "true" : "false") 87 ); 88 89 TRACE_EVENT(virtio_transport_recv_pkt, 90 TP_PROTO( 91 __u32 src_cid, __u32 src_port, 92 __u32 dst_cid, __u32 dst_port, 93 __u32 len, 94 __u16 type, 95 __u16 op, 96 __u32 flags, 97 __u32 buf_alloc, 98 __u32 fwd_cnt 99 ), 100 TP_ARGS( 101 src_cid, src_port, 102 dst_cid, dst_port, 103 len, 104 type, 105 op, 106 flags, 107 buf_alloc, 108 fwd_cnt 109 ), 110 TP_STRUCT__entry( 111 __field(__u32, src_cid) 112 __field(__u32, src_port) 113 __field(__u32, dst_cid) 114 __field(__u32, dst_port) 115 __field(__u32, len) 116 __field(__u16, type) 117 __field(__u16, op) 118 __field(__u32, flags) 119 __field(__u32, buf_alloc) 120 __field(__u32, fwd_cnt) 121 ), 122 TP_fast_assign( 123 __entry->src_cid = src_cid; 124 __entry->src_port = src_port; 125 __entry->dst_cid = dst_cid; 126 __entry->dst_port = dst_port; 127 __entry->len = len; 128 __entry->type = type; 129 __entry->op = op; 130 __entry->flags = flags; 131 __entry->buf_alloc = buf_alloc; 132 __entry->fwd_cnt = fwd_cnt; 133 ), 134 TP_printk("%u:%u -> %u:%u len=%u type=%s op=%s flags=%#x " 135 "buf_alloc=%u fwd_cnt=%u", 136 __entry->src_cid, __entry->src_port, 137 __entry->dst_cid, __entry->dst_port, 138 __entry->len, 139 show_type(__entry->type), 140 show_op(__entry->op), 141 __entry->flags, 142 __entry->buf_alloc, 143 __entry->fwd_cnt) 144 ); 145 146 #endif /* _TRACE_VSOCK_VIRTIO_TRANSPORT_COMMON_H */ 147 148 #undef TRACE_INCLUDE_FILE 149 #define TRACE_INCLUDE_FILE vsock_virtio_transport_common 150 151 /* This part must be outside protection */ 152 #include <trace/define_trace.h> 153