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