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