netvsc_trace.h 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. #if !defined(_NETVSC_TRACE_H) || defined(TRACE_HEADER_MULTI_READ)
  3. #define _NETVSC_TRACE_H
  4. #include <linux/tracepoint.h>
  5. #undef TRACE_SYSTEM
  6. #define TRACE_SYSTEM netvsc
  7. #define TRACE_INCLUDE_FILE netvsc_trace
  8. TRACE_DEFINE_ENUM(RNDIS_MSG_PACKET);
  9. TRACE_DEFINE_ENUM(RNDIS_MSG_INDICATE);
  10. TRACE_DEFINE_ENUM(RNDIS_MSG_INIT);
  11. TRACE_DEFINE_ENUM(RNDIS_MSG_INIT_C);
  12. TRACE_DEFINE_ENUM(RNDIS_MSG_HALT);
  13. TRACE_DEFINE_ENUM(RNDIS_MSG_QUERY);
  14. TRACE_DEFINE_ENUM(RNDIS_MSG_QUERY_C);
  15. TRACE_DEFINE_ENUM(RNDIS_MSG_SET);
  16. TRACE_DEFINE_ENUM(RNDIS_MSG_SET_C);
  17. TRACE_DEFINE_ENUM(RNDIS_MSG_RESET);
  18. TRACE_DEFINE_ENUM(RNDIS_MSG_RESET_C);
  19. TRACE_DEFINE_ENUM(RNDIS_MSG_KEEPALIVE);
  20. TRACE_DEFINE_ENUM(RNDIS_MSG_KEEPALIVE_C);
  21. #define show_rndis_type(type) \
  22. __print_symbolic(type, \
  23. { RNDIS_MSG_PACKET, "PACKET" }, \
  24. { RNDIS_MSG_INDICATE, "INDICATE", }, \
  25. { RNDIS_MSG_INIT, "INIT", }, \
  26. { RNDIS_MSG_INIT_C, "INIT_C", }, \
  27. { RNDIS_MSG_HALT, "HALT", }, \
  28. { RNDIS_MSG_QUERY, "QUERY", }, \
  29. { RNDIS_MSG_QUERY_C, "QUERY_C", }, \
  30. { RNDIS_MSG_SET, "SET", }, \
  31. { RNDIS_MSG_SET_C, "SET_C", }, \
  32. { RNDIS_MSG_RESET, "RESET", }, \
  33. { RNDIS_MSG_RESET_C, "RESET_C", }, \
  34. { RNDIS_MSG_KEEPALIVE, "KEEPALIVE", }, \
  35. { RNDIS_MSG_KEEPALIVE_C, "KEEPALIVE_C", })
  36. DECLARE_EVENT_CLASS(rndis_msg_class,
  37. TP_PROTO(const struct net_device *ndev, u16 q,
  38. const struct rndis_message *msg),
  39. TP_ARGS(ndev, q, msg),
  40. TP_STRUCT__entry(
  41. __string( name, ndev->name )
  42. __field( u16, queue )
  43. __field( u32, req_id )
  44. __field( u32, msg_type )
  45. __field( u32, msg_len )
  46. ),
  47. TP_fast_assign(
  48. __assign_str(name, ndev->name);
  49. __entry->queue = q;
  50. __entry->req_id = msg->msg.init_req.req_id;
  51. __entry->msg_type = msg->ndis_msg_type;
  52. __entry->msg_len = msg->msg_len;
  53. ),
  54. TP_printk("dev=%s q=%u req=%#x type=%s msg_len=%u",
  55. __get_str(name), __entry->queue, __entry->req_id,
  56. show_rndis_type(__entry->msg_type), __entry->msg_len)
  57. );
  58. DEFINE_EVENT(rndis_msg_class, rndis_send,
  59. TP_PROTO(const struct net_device *ndev, u16 q,
  60. const struct rndis_message *msg),
  61. TP_ARGS(ndev, q, msg)
  62. );
  63. DEFINE_EVENT(rndis_msg_class, rndis_recv,
  64. TP_PROTO(const struct net_device *ndev, u16 q,
  65. const struct rndis_message *msg),
  66. TP_ARGS(ndev, q, msg)
  67. );
  68. TRACE_DEFINE_ENUM(NVSP_MSG_TYPE_INIT);
  69. TRACE_DEFINE_ENUM(NVSP_MSG_TYPE_INIT_COMPLETE);
  70. TRACE_DEFINE_ENUM(NVSP_MSG1_TYPE_SEND_NDIS_VER);
  71. TRACE_DEFINE_ENUM(NVSP_MSG1_TYPE_SEND_RECV_BUF);
  72. TRACE_DEFINE_ENUM(NVSP_MSG1_TYPE_SEND_RECV_BUF_COMPLETE);
  73. TRACE_DEFINE_ENUM(NVSP_MSG1_TYPE_REVOKE_RECV_BUF);
  74. TRACE_DEFINE_ENUM(NVSP_MSG1_TYPE_SEND_SEND_BUF);
  75. TRACE_DEFINE_ENUM(NVSP_MSG1_TYPE_SEND_SEND_BUF_COMPLETE);
  76. TRACE_DEFINE_ENUM(NVSP_MSG1_TYPE_REVOKE_SEND_BUF);
  77. TRACE_DEFINE_ENUM(NVSP_MSG1_TYPE_SEND_RNDIS_PKT);
  78. TRACE_DEFINE_ENUM(NVSP_MSG1_TYPE_SEND_RNDIS_PKT_COMPLETE);
  79. TRACE_DEFINE_ENUM(NVSP_MSG2_TYPE_SEND_NDIS_CONFIG);
  80. TRACE_DEFINE_ENUM(NVSP_MSG4_TYPE_SEND_VF_ASSOCIATION);
  81. TRACE_DEFINE_ENUM(NVSP_MSG4_TYPE_SWITCH_DATA_PATH);
  82. TRACE_DEFINE_ENUM(NVSP_MSG5_TYPE_SUBCHANNEL);
  83. TRACE_DEFINE_ENUM(NVSP_MSG5_TYPE_SEND_INDIRECTION_TABLE);
  84. #define show_nvsp_type(type) \
  85. __print_symbolic(type, \
  86. { NVSP_MSG_TYPE_INIT, "INIT" }, \
  87. { NVSP_MSG_TYPE_INIT_COMPLETE, "INIT_COMPLETE" }, \
  88. { NVSP_MSG1_TYPE_SEND_NDIS_VER, "SEND_NDIS_VER" }, \
  89. { NVSP_MSG1_TYPE_SEND_RECV_BUF, "SEND_RECV_BUF" }, \
  90. { NVSP_MSG1_TYPE_SEND_RECV_BUF_COMPLETE, "SEND_RECV_BUF_COMPLETE" }, \
  91. { NVSP_MSG1_TYPE_REVOKE_RECV_BUF, "REVOKE_RECV_BUF" }, \
  92. { NVSP_MSG1_TYPE_SEND_SEND_BUF, "SEND_SEND_BUF" }, \
  93. { NVSP_MSG1_TYPE_SEND_SEND_BUF_COMPLETE, "SEND_SEND_BUF_COMPLETE" }, \
  94. { NVSP_MSG1_TYPE_REVOKE_SEND_BUF, "REVOKE_SEND_BUF" }, \
  95. { NVSP_MSG1_TYPE_SEND_RNDIS_PKT, "SEND_RNDIS_PKT" }, \
  96. { NVSP_MSG1_TYPE_SEND_RNDIS_PKT_COMPLETE, "SEND_RNDIS_PKT_COMPLETE" },\
  97. { NVSP_MSG2_TYPE_SEND_NDIS_CONFIG, "SEND_NDIS_CONFIG" }, \
  98. { NVSP_MSG4_TYPE_SEND_VF_ASSOCIATION, "SEND_VF_ASSOCIATION" }, \
  99. { NVSP_MSG4_TYPE_SWITCH_DATA_PATH, "SWITCH_DATA_PATH" }, \
  100. { NVSP_MSG5_TYPE_SUBCHANNEL, "SUBCHANNEL" }, \
  101. { NVSP_MSG5_TYPE_SEND_INDIRECTION_TABLE, "SEND_INDIRECTION_TABLE" })
  102. TRACE_EVENT(nvsp_send,
  103. TP_PROTO(const struct net_device *ndev,
  104. const struct nvsp_message *msg),
  105. TP_ARGS(ndev, msg),
  106. TP_STRUCT__entry(
  107. __string( name, ndev->name )
  108. __field( u32, msg_type )
  109. ),
  110. TP_fast_assign(
  111. __assign_str(name, ndev->name);
  112. __entry->msg_type = msg->hdr.msg_type;
  113. ),
  114. TP_printk("dev=%s type=%s",
  115. __get_str(name),
  116. show_nvsp_type(__entry->msg_type))
  117. );
  118. TRACE_EVENT(nvsp_send_pkt,
  119. TP_PROTO(const struct net_device *ndev,
  120. const struct vmbus_channel *chan,
  121. const struct nvsp_1_message_send_rndis_packet *rpkt),
  122. TP_ARGS(ndev, chan, rpkt),
  123. TP_STRUCT__entry(
  124. __string( name, ndev->name )
  125. __field( u16, qid )
  126. __field( u32, channel_type )
  127. __field( u32, section_index )
  128. __field( u32, section_size )
  129. ),
  130. TP_fast_assign(
  131. __assign_str(name, ndev->name);
  132. __entry->qid = chan->offermsg.offer.sub_channel_index;
  133. __entry->channel_type = rpkt->channel_type;
  134. __entry->section_index = rpkt->send_buf_section_index;
  135. __entry->section_size = rpkt->send_buf_section_size;
  136. ),
  137. TP_printk("dev=%s qid=%u type=%s section=%u size=%d",
  138. __get_str(name), __entry->qid,
  139. __entry->channel_type ? "CONTROL" : "DATA",
  140. __entry->section_index, __entry->section_size)
  141. );
  142. TRACE_EVENT(nvsp_recv,
  143. TP_PROTO(const struct net_device *ndev,
  144. const struct vmbus_channel *chan,
  145. const struct nvsp_message *msg),
  146. TP_ARGS(ndev, chan, msg),
  147. TP_STRUCT__entry(
  148. __string( name, ndev->name )
  149. __field( u16, qid )
  150. __field( u32, msg_type )
  151. ),
  152. TP_fast_assign(
  153. __assign_str(name, ndev->name);
  154. __entry->qid = chan->offermsg.offer.sub_channel_index;
  155. __entry->msg_type = msg->hdr.msg_type;
  156. ),
  157. TP_printk("dev=%s qid=%u type=%s",
  158. __get_str(name), __entry->qid,
  159. show_nvsp_type(__entry->msg_type))
  160. );
  161. #endif /* _NETVSC_TRACE_H */
  162. /* This part must be outside protection */
  163. #undef TRACE_INCLUDE_PATH
  164. #define TRACE_INCLUDE_PATH ../../drivers/net/hyperv
  165. #include <trace/define_trace.h>