vsock_virtio_transport_common.h 3.5 KB

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