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