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
);
13 #define show_type(val) \
14 __print_symbolic(val, { VIRTIO_VSOCK_TYPE_STREAM, "STREAM" })
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
);
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" })
36 TRACE_EVENT(virtio_transport_alloc_pkt
,
38 __u32 src_cid
, __u32 src_port
,
39 __u32 dst_cid
, __u32 dst_port
,
54 __field(__u32
, src_cid
)
55 __field(__u32
, src_port
)
56 __field(__u32
, dst_cid
)
57 __field(__u32
, dst_port
)
64 __entry
->src_cid
= src_cid
;
65 __entry
->src_port
= src_port
;
66 __entry
->dst_cid
= dst_cid
;
67 __entry
->dst_port
= dst_port
;
71 __entry
->flags
= flags
;
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
,
77 show_type(__entry
->type
),
82 TRACE_EVENT(virtio_transport_recv_pkt
,
84 __u32 src_cid
, __u32 src_port
,
85 __u32 dst_cid
, __u32 dst_port
,
104 __field(__u32
, src_cid
)
105 __field(__u32
, src_port
)
106 __field(__u32
, dst_cid
)
107 __field(__u32
, dst_port
)
111 __field(__u32
, flags
)
112 __field(__u32
, buf_alloc
)
113 __field(__u32
, fwd_cnt
)
116 __entry
->src_cid
= src_cid
;
117 __entry
->src_port
= src_port
;
118 __entry
->dst_cid
= dst_cid
;
119 __entry
->dst_port
= dst_port
;
121 __entry
->type
= type
;
123 __entry
->flags
= flags
;
124 __entry
->buf_alloc
= buf_alloc
;
125 __entry
->fwd_cnt
= fwd_cnt
;
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
,
132 show_type(__entry
->type
),
133 show_op(__entry
->op
),
139 #endif /* _TRACE_VSOCK_VIRTIO_TRANSPORT_COMMON_H */
141 #undef TRACE_INCLUDE_FILE
142 #define TRACE_INCLUDE_FILE vsock_virtio_transport_common
144 /* This part must be outside protection */
145 #include <trace/define_trace.h>