]>
Commit | Line | Data |
---|---|---|
2d9b49dd | 1 | /* Copyright (c) 2016, 2017 Nicira, Inc. |
d13ee228 BP |
2 | * |
3 | * Licensed under the Apache License, Version 2.0 (the "License"); | |
4 | * you may not use this file except in compliance with the License. | |
5 | * You may obtain a copy of the License at: | |
6 | * | |
7 | * http://www.apache.org/licenses/LICENSE-2.0 | |
8 | * | |
9 | * Unless required by applicable law or agreed to in writing, software | |
10 | * distributed under the License is distributed on an "AS IS" BASIS, | |
11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
12 | * See the License for the specific language governing permissions and | |
13 | * limitations under the License. */ | |
14 | ||
15 | #ifndef OFPROTO_DPIF_TRACE_H | |
16 | #define OFPROTO_DPIF_TRACE_H 1 | |
17 | ||
2d9b49dd BP |
18 | /* Tracing |
19 | * ======= | |
20 | * | |
21 | * The Open vSwitch software datapath based switch implementation supports | |
22 | * "tracing". A trace describes what happens to a particular kind of packet as | |
23 | * it passes through the switch, including information on each table, flow, and | |
24 | * action that would apply to the packet. The trace is internally represented | |
25 | * as a tree that reflects control flow; for example, an OpenFlow switch | |
26 | * top-level node (of type OFT_BRIDGE) has a child node for each table visited | |
27 | * by a packet (of type OFT_TABLE), and each table node has a child node for | |
28 | * each action (OFT_ACTION) executed in the table. | |
29 | */ | |
30 | ||
31 | #include "openvswitch/compiler.h" | |
32 | #include "openvswitch/list.h" | |
e6bc8e74 | 33 | #include "flow.h" |
2d9b49dd BP |
34 | |
35 | /* Type of a node within a trace. */ | |
36 | enum oftrace_node_type { | |
37 | /* Nodes that may have children (nonterminal nodes). */ | |
38 | OFT_BRIDGE, /* Packet travel through an OpenFlow switch. */ | |
39 | OFT_TABLE, /* Packet travel through a flow table. */ | |
40 | OFT_THAW, /* Thawing a frozen state. */ | |
41 | ||
42 | /* Nodes that never have children (terminal nodes). */ | |
43 | OFT_ACTION, /* An action. */ | |
44 | OFT_DETAIL, /* Some detail of an action. */ | |
45 | OFT_WARN, /* A worrisome situation. */ | |
46 | OFT_ERROR, /* An erroneous situation, worth logging. */ | |
47 | }; | |
48 | ||
e6bc8e74 YHW |
49 | /* Reason why a flow is in a recirculation queue. */ |
50 | enum oftrace_recirc_type { | |
51 | OFT_RECIRC_CONNTRACK, | |
52 | OFT_RECIRC_MPLS, | |
53 | OFT_RECIRC_BOND, | |
54 | }; | |
55 | ||
2d9b49dd BP |
56 | /* A node within a trace. */ |
57 | struct oftrace_node { | |
58 | struct ovs_list node; /* In parent. */ | |
59 | struct ovs_list subs; /* List of "struct oftrace_node" children. */ | |
60 | ||
61 | enum oftrace_node_type type; | |
62 | char *text; | |
63 | }; | |
64 | ||
e6bc8e74 YHW |
65 | /* A node within a recirculation queue. */ |
66 | struct oftrace_recirc_node { | |
67 | struct ovs_list node; /* In recirc_queue. */ | |
68 | ||
69 | enum oftrace_recirc_type type; | |
70 | uint32_t recirc_id; | |
71 | struct flow flow; | |
72 | struct dp_packet *packet; | |
73 | }; | |
74 | ||
0f2f05bb YHW |
75 | /* A node within a next_ct_states list. */ |
76 | struct oftrace_next_ct_state { | |
77 | struct ovs_list node; /* In next_ct_states. */ | |
78 | uint32_t state; | |
79 | }; | |
80 | ||
d13ee228 BP |
81 | void ofproto_dpif_trace_init(void); |
82 | ||
2d9b49dd BP |
83 | struct oftrace_node *oftrace_report(struct ovs_list *, enum oftrace_node_type, |
84 | const char *text); | |
e6bc8e74 YHW |
85 | bool oftrace_add_recirc_node(struct ovs_list *recirc_queue, |
86 | enum oftrace_recirc_type, const struct flow *, | |
5fdd80cc YHW |
87 | const struct dp_packet *, uint32_t recirc_id, |
88 | const uint16_t zone); | |
2d9b49dd | 89 | |
d13ee228 | 90 | #endif /* ofproto-dpif-trace.h */ |