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 ), 48 TP_ARGS( 49 src_cid, src_port, 50 dst_cid, dst_port, 51 len, 52 type, 53 op, 54 flags 55 ), 56 TP_STRUCT__entry( 57 __field(__u32, src_cid) 58 __field(__u32, src_port) 59 __field(__u32, dst_cid) 60 __field(__u32, dst_port) 61 __field(__u32, len) 62 __field(__u16, type) 63 __field(__u16, op) 64 __field(__u32, flags) 65 ), 66 TP_fast_assign( 67 __entry->src_cid = src_cid; 68 __entry->src_port = src_port; 69 __entry->dst_cid = dst_cid; 70 __entry->dst_port = dst_port; 71 __entry->len = len; 72 __entry->type = type; 73 __entry->op = op; 74 __entry->flags = flags; 75 ), 76 TP_printk("%u:%u -> %u:%u len=%u type=%s op=%s flags=%#x", 77 __entry->src_cid, __entry->src_port, 78 __entry->dst_cid, __entry->dst_port, 79 __entry->len, 80 show_type(__entry->type), 81 show_op(__entry->op), 82 __entry->flags) 83 ); 84 85 TRACE_EVENT(virtio_transport_recv_pkt, 86 TP_PROTO( 87 __u32 src_cid, __u32 src_port, 88 __u32 dst_cid, __u32 dst_port, 89 __u32 len, 90 __u16 type, 91 __u16 op, 92 __u32 flags, 93 __u32 buf_alloc, 94 __u32 fwd_cnt 95 ), 96 TP_ARGS( 97 src_cid, src_port, 98 dst_cid, dst_port, 99 len, 100 type, 101 op, 102 flags, 103 buf_alloc, 104 fwd_cnt 105 ), 106 TP_STRUCT__entry( 107 __field(__u32, src_cid) 108 __field(__u32, src_port) 109 __field(__u32, dst_cid) 110 __field(__u32, dst_port) 111 __field(__u32, len) 112 __field(__u16, type) 113 __field(__u16, op) 114 __field(__u32, flags) 115 __field(__u32, buf_alloc) 116 __field(__u32, fwd_cnt) 117 ), 118 TP_fast_assign( 119 __entry->src_cid = src_cid; 120 __entry->src_port = src_port; 121 __entry->dst_cid = dst_cid; 122 __entry->dst_port = dst_port; 123 __entry->len = len; 124 __entry->type = type; 125 __entry->op = op; 126 __entry->flags = flags; 127 __entry->buf_alloc = buf_alloc; 128 __entry->fwd_cnt = fwd_cnt; 129 ), 130 TP_printk("%u:%u -> %u:%u len=%u type=%s op=%s flags=%#x " 131 "buf_alloc=%u fwd_cnt=%u", 132 __entry->src_cid, __entry->src_port, 133 __entry->dst_cid, __entry->dst_port, 134 __entry->len, 135 show_type(__entry->type), 136 show_op(__entry->op), 137 __entry->flags, 138 __entry->buf_alloc, 139 __entry->fwd_cnt) 140 ); 141 142 #endif /* _TRACE_VSOCK_VIRTIO_TRANSPORT_COMMON_H */ 143 144 #undef TRACE_INCLUDE_FILE 145 #define TRACE_INCLUDE_FILE vsock_virtio_transport_common 146 147 /* This part must be outside protection */ 148 #include <trace/define_trace.h> 149