1 /* SPDX-License-Identifier: GPL-2.0 */
3 #define TRACE_SYSTEM vsock
5 #if !defined(_TRACE_VSOCK_VIRTIO_TRANSPORT_COMMON_H) || \
6 defined(TRACE_HEADER_MULTI_READ)
7 #define _TRACE_VSOCK_VIRTIO_TRANSPORT_COMMON_H
9 #include <linux/tracepoint.h>
11 TRACE_DEFINE_ENUM(VIRTIO_VSOCK_TYPE_STREAM
);
12 TRACE_DEFINE_ENUM(VIRTIO_VSOCK_TYPE_SEQPACKET
);
14 #define show_type(val) \
15 __print_symbolic(val, \
16 { VIRTIO_VSOCK_TYPE_STREAM, "STREAM" }, \
17 { VIRTIO_VSOCK_TYPE_SEQPACKET, "SEQPACKET" })
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
);
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" })
39 TRACE_EVENT(virtio_transport_alloc_pkt
,
41 __u32 src_cid
, __u32 src_port
,
42 __u32 dst_cid
, __u32 dst_port
,
59 __field(__u32
, src_cid
)
60 __field(__u32
, src_port
)
61 __field(__u32
, dst_cid
)
62 __field(__u32
, dst_port
)
70 __entry
->src_cid
= src_cid
;
71 __entry
->src_port
= src_port
;
72 __entry
->dst_cid
= dst_cid
;
73 __entry
->dst_port
= dst_port
;
77 __entry
->flags
= flags
;
78 __entry
->zcopy
= zcopy
;
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
,
84 show_type(__entry
->type
),
86 __entry
->flags
, __entry
->zcopy
? "true" : "false")
89 TRACE_EVENT(virtio_transport_recv_pkt
,
91 __u32 src_cid
, __u32 src_port
,
92 __u32 dst_cid
, __u32 dst_port
,
111 __field(__u32
, src_cid
)
112 __field(__u32
, src_port
)
113 __field(__u32
, dst_cid
)
114 __field(__u32
, dst_port
)
118 __field(__u32
, flags
)
119 __field(__u32
, buf_alloc
)
120 __field(__u32
, fwd_cnt
)
123 __entry
->src_cid
= src_cid
;
124 __entry
->src_port
= src_port
;
125 __entry
->dst_cid
= dst_cid
;
126 __entry
->dst_port
= dst_port
;
128 __entry
->type
= type
;
130 __entry
->flags
= flags
;
131 __entry
->buf_alloc
= buf_alloc
;
132 __entry
->fwd_cnt
= fwd_cnt
;
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
,
139 show_type(__entry
->type
),
140 show_op(__entry
->op
),
146 #endif /* _TRACE_VSOCK_VIRTIO_TRANSPORT_COMMON_H */
148 #undef TRACE_INCLUDE_FILE
149 #define TRACE_INCLUDE_FILE vsock_virtio_transport_common
151 /* This part must be outside protection */
152 #include <trace/define_trace.h>