]>
git.proxmox.com Git - mirror_ovs.git/blob - ofproto/ofproto-dpif-trace.h
1 /* Copyright (c) 2016, 2017 Nicira, Inc.
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:
7 * http://www.apache.org/licenses/LICENSE-2.0
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. */
15 #ifndef OFPROTO_DPIF_TRACE_H
16 #define OFPROTO_DPIF_TRACE_H 1
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.
31 #include "openvswitch/dynamic-string.h"
32 #include "ofproto/ofproto-dpif.h"
33 #include "openvswitch/compiler.h"
34 #include "openvswitch/list.h"
37 /* Type of a node within a trace. */
38 enum oftrace_node_type
{
39 /* Nodes that may have children (nonterminal nodes). */
40 OFT_BRIDGE
, /* Packet travel through an OpenFlow switch. */
41 OFT_TABLE
, /* Packet travel through a flow table. */
42 OFT_BUCKET
, /* Executing a bucket in an OpenFlow group. */
43 OFT_THAW
, /* Thawing a frozen state. */
45 /* Nodes that never have children (terminal nodes). */
46 OFT_ACTION
, /* An action. */
47 OFT_DETAIL
, /* Some detail of an action. */
48 OFT_WARN
, /* A worrisome situation. */
49 OFT_ERROR
, /* An erroneous situation, worth logging. */
52 /* Reason why a flow is in a recirculation queue. */
53 enum oftrace_recirc_type
{
59 /* A node within a trace. */
61 struct ovs_list node
; /* In parent. */
62 struct ovs_list subs
; /* List of "struct oftrace_node" children. */
64 enum oftrace_node_type type
;
68 /* A node within a recirculation queue. */
69 struct oftrace_recirc_node
{
70 struct ovs_list node
; /* In recirc_queue. */
72 enum oftrace_recirc_type type
;
75 struct dp_packet
*packet
;
78 /* A node within a next_ct_states list. */
79 struct oftrace_next_ct_state
{
80 struct ovs_list node
; /* In next_ct_states. */
84 void ofproto_dpif_trace_init(void);
85 void ofproto_trace(struct ofproto_dpif
*ofproto
, const struct flow
*flow
,
86 const struct dp_packet
*packet
,
87 const struct ofpact
*, size_t ofpacts_len
,
88 struct ovs_list
*next_ct_states
, struct ds
*output
);
90 struct oftrace_node
*oftrace_report(struct ovs_list
*, enum oftrace_node_type
,
92 bool oftrace_add_recirc_node(struct ovs_list
*recirc_queue
,
93 enum oftrace_recirc_type
, const struct flow
*,
94 const struct dp_packet
*, uint32_t recirc_id
,
97 #endif /* ofproto-dpif-trace.h */