xref: /linux/net/openvswitch/openvswitch_trace.h (revision da1d9caf95def6f0320819cf941c9fd1069ba9e1)
1 /* SPDX-License-Identifier: GPL-2.0 */
2 #undef TRACE_SYSTEM
3 #define TRACE_SYSTEM openvswitch
4 
5 #if !defined(_TRACE_OPENVSWITCH_H) || defined(TRACE_HEADER_MULTI_READ)
6 #define _TRACE_OPENVSWITCH_H
7 
8 #include <linux/tracepoint.h>
9 
10 #include "datapath.h"
11 
12 TRACE_EVENT(ovs_do_execute_action,
13 
14 	TP_PROTO(struct datapath *dp, struct sk_buff *skb,
15 		 struct sw_flow_key *key, const struct nlattr *a, int rem),
16 
17 	TP_ARGS(dp, skb, key, a, rem),
18 
19 	TP_STRUCT__entry(
20 		__field(	void *,		dpaddr			)
21 		__string(	dp_name,	ovs_dp_name(dp)		)
22 		__string(	dev_name,	skb->dev->name		)
23 		__field(	void *,		skbaddr			)
24 		__field(	unsigned int,	len			)
25 		__field(	unsigned int,	data_len		)
26 		__field(	unsigned int,	truesize		)
27 		__field(	u8,		nr_frags		)
28 		__field(	u16,		gso_size		)
29 		__field(	u16,		gso_type		)
30 		__field(	u32,		ovs_flow_hash		)
31 		__field(	u32,		recirc_id		)
32 		__field(	void *,		keyaddr			)
33 		__field(	u16,		key_eth_type		)
34 		__field(	u8,		key_ct_state		)
35 		__field(	u8,		key_ct_orig_proto	)
36 		__field(	u16,		key_ct_zone		)
37 		__field(	unsigned int,	flow_key_valid		)
38 		__field(	u8,		action_type		)
39 		__field(	unsigned int,	action_len		)
40 		__field(	void *,		action_data		)
41 		__field(	u8,		is_last			)
42 	),
43 
44 	TP_fast_assign(
45 		__entry->dpaddr = dp;
46 		__assign_str(dp_name, ovs_dp_name(dp));
47 		__assign_str(dev_name, skb->dev->name);
48 		__entry->skbaddr = skb;
49 		__entry->len = skb->len;
50 		__entry->data_len = skb->data_len;
51 		__entry->truesize = skb->truesize;
52 		__entry->nr_frags = skb_shinfo(skb)->nr_frags;
53 		__entry->gso_size = skb_shinfo(skb)->gso_size;
54 		__entry->gso_type = skb_shinfo(skb)->gso_type;
55 		__entry->ovs_flow_hash = key->ovs_flow_hash;
56 		__entry->recirc_id = key->recirc_id;
57 		__entry->keyaddr = key;
58 		__entry->key_eth_type = key->eth.type;
59 		__entry->key_ct_state = key->ct_state;
60 		__entry->key_ct_orig_proto = key->ct_orig_proto;
61 		__entry->key_ct_zone = key->ct_zone;
62 		__entry->flow_key_valid = !(key->mac_proto & SW_FLOW_KEY_INVALID);
63 		__entry->action_type = nla_type(a);
64 		__entry->action_len = nla_len(a);
65 		__entry->action_data = nla_data(a);
66 		__entry->is_last = nla_is_last(a, rem);
67 	),
68 
69 	TP_printk("dpaddr=%p dp_name=%s dev=%s skbaddr=%p len=%u data_len=%u truesize=%u nr_frags=%d gso_size=%d gso_type=%#x ovs_flow_hash=0x%08x recirc_id=0x%08x keyaddr=%p eth_type=0x%04x ct_state=%02x ct_orig_proto=%02x ct_Zone=%04x flow_key_valid=%d action_type=%u action_len=%u action_data=%p is_last=%d",
70 		  __entry->dpaddr, __get_str(dp_name), __get_str(dev_name),
71 		  __entry->skbaddr, __entry->len, __entry->data_len,
72 		  __entry->truesize, __entry->nr_frags, __entry->gso_size,
73 		  __entry->gso_type, __entry->ovs_flow_hash,
74 		  __entry->recirc_id, __entry->keyaddr, __entry->key_eth_type,
75 		  __entry->key_ct_state, __entry->key_ct_orig_proto,
76 		  __entry->key_ct_zone,
77 		  __entry->flow_key_valid,
78 		  __entry->action_type, __entry->action_len,
79 		  __entry->action_data, __entry->is_last)
80 );
81 
82 TRACE_EVENT(ovs_dp_upcall,
83 
84 	TP_PROTO(struct datapath *dp, struct sk_buff *skb,
85 		 const struct sw_flow_key *key,
86 		 const struct dp_upcall_info *upcall_info),
87 
88 	TP_ARGS(dp, skb, key, upcall_info),
89 
90 	TP_STRUCT__entry(
91 		__field(	void *,		dpaddr			)
92 		__string(	dp_name,	ovs_dp_name(dp)		)
93 		__string(	dev_name,	skb->dev->name		)
94 		__field(	void *,		skbaddr			)
95 		__field(	unsigned int,	len			)
96 		__field(	unsigned int,	data_len		)
97 		__field(	unsigned int,	truesize		)
98 		__field(	u8,		nr_frags		)
99 		__field(	u16,		gso_size		)
100 		__field(	u16,		gso_type		)
101 		__field(	u32,		ovs_flow_hash		)
102 		__field(	u32,		recirc_id		)
103 		__field(	const void *,	keyaddr			)
104 		__field(	u16,		key_eth_type		)
105 		__field(	u8,		key_ct_state		)
106 		__field(	u8,		key_ct_orig_proto	)
107 		__field(	u16,		key_ct_zone		)
108 		__field(	unsigned int,	flow_key_valid		)
109 		__field(	u8,		upcall_cmd		)
110 		__field(	u32,		upcall_port		)
111 		__field(	u16,		upcall_mru		)
112 	),
113 
114 	TP_fast_assign(
115 		__entry->dpaddr = dp;
116 		__assign_str(dp_name, ovs_dp_name(dp));
117 		__assign_str(dev_name, skb->dev->name);
118 		__entry->skbaddr = skb;
119 		__entry->len = skb->len;
120 		__entry->data_len = skb->data_len;
121 		__entry->truesize = skb->truesize;
122 		__entry->nr_frags = skb_shinfo(skb)->nr_frags;
123 		__entry->gso_size = skb_shinfo(skb)->gso_size;
124 		__entry->gso_type = skb_shinfo(skb)->gso_type;
125 		__entry->ovs_flow_hash = key->ovs_flow_hash;
126 		__entry->recirc_id = key->recirc_id;
127 		__entry->keyaddr = key;
128 		__entry->key_eth_type = key->eth.type;
129 		__entry->key_ct_state = key->ct_state;
130 		__entry->key_ct_orig_proto = key->ct_orig_proto;
131 		__entry->key_ct_zone = key->ct_zone;
132 		__entry->flow_key_valid =  !(key->mac_proto & SW_FLOW_KEY_INVALID);
133 		__entry->upcall_cmd = upcall_info->cmd;
134 		__entry->upcall_port = upcall_info->portid;
135 		__entry->upcall_mru = upcall_info->mru;
136 	),
137 
138 	TP_printk("dpaddr=%p dp_name=%s dev=%s skbaddr=%p len=%u data_len=%u truesize=%u nr_frags=%d gso_size=%d gso_type=%#x ovs_flow_hash=0x%08x recirc_id=0x%08x keyaddr=%p eth_type=0x%04x ct_state=%02x ct_orig_proto=%02x ct_zone=%04x flow_key_valid=%d upcall_cmd=%u upcall_port=%u upcall_mru=%u",
139 		  __entry->dpaddr, __get_str(dp_name), __get_str(dev_name),
140 		  __entry->skbaddr, __entry->len, __entry->data_len,
141 		  __entry->truesize, __entry->nr_frags, __entry->gso_size,
142 		  __entry->gso_type, __entry->ovs_flow_hash,
143 		  __entry->recirc_id, __entry->keyaddr, __entry->key_eth_type,
144 		  __entry->key_ct_state, __entry->key_ct_orig_proto,
145 		  __entry->key_ct_zone,
146 		  __entry->flow_key_valid,
147 		  __entry->upcall_cmd, __entry->upcall_port,
148 		  __entry->upcall_mru)
149 );
150 
151 #endif /* _TRACE_OPENVSWITCH_H */
152 
153 /* This part must be outside protection */
154 #undef TRACE_INCLUDE_PATH
155 #define TRACE_INCLUDE_PATH .
156 #undef TRACE_INCLUDE_FILE
157 #define TRACE_INCLUDE_FILE openvswitch_trace
158 #include <trace/define_trace.h>
159