vsock_virtio_transport_common.h 3.5 KB

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