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