1 /* Copyright (c) 2015, 2016 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.
19 #include "ovn/logical-fields.h"
21 /* Logical_Flow table translation to OpenFlow
22 * ==========================================
24 * The Logical_Flow table obtained from the OVN_Southbound database works in
25 * terms of logical entities, that is, logical flows among logical datapaths
26 * and logical ports. This code translates these logical flows into OpenFlow
27 * flows that, again, work in terms of logical entities implemented through
28 * OpenFlow extensions (e.g. registers represent the logical input and output
31 * Physical-to-logical and logical-to-physical translation are implemented in
32 * physical.[ch] as separate OpenFlow tables that run before and after,
33 * respectively, the logical pipeline OpenFlow tables.
38 struct ovn_extend_table
;
39 struct ovsdb_idl_index
;
40 struct ovn_desired_flow_table
;
43 struct sbrec_dhcp_options_table
;
44 struct sbrec_dhcpv6_options_table
;
45 struct sbrec_logical_flow_table
;
46 struct sbrec_mac_binding_table
;
51 /* OpenFlow table numbers.
53 * These are heavily documented in ovn-architecture(7), please update it if
54 * you make any changes. */
55 #define OFTABLE_PHY_TO_LOG 0
56 #define OFTABLE_LOG_INGRESS_PIPELINE 8 /* First of LOG_PIPELINE_LEN tables. */
57 #define OFTABLE_REMOTE_OUTPUT 32
58 #define OFTABLE_LOCAL_OUTPUT 33
59 #define OFTABLE_CHECK_LOOPBACK 34
60 #define OFTABLE_LOG_EGRESS_PIPELINE 40 /* First of LOG_PIPELINE_LEN tables. */
61 #define OFTABLE_SAVE_INPORT 64
62 #define OFTABLE_LOG_TO_PHY 65
63 #define OFTABLE_MAC_BINDING 66
65 /* The number of tables for the ingress and egress pipelines. */
66 #define LOG_PIPELINE_LEN 24
68 void lflow_init(void);
69 void lflow_run(struct ovsdb_idl_index
*sbrec_multicast_group_by_name_datapath
,
70 struct ovsdb_idl_index
*sbrec_port_binding_by_name
,
71 const struct sbrec_dhcp_options_table
*,
72 const struct sbrec_dhcpv6_options_table
*,
73 const struct sbrec_logical_flow_table
*,
74 const struct sbrec_mac_binding_table
*,
75 const struct sbrec_chassis
*chassis
,
76 const struct hmap
*local_datapaths
,
77 const struct shash
*addr_sets
,
78 const struct shash
*port_groups
,
79 const struct sset
*active_tunnels
,
80 const struct sset
*local_lport_ids
,
81 struct ovn_desired_flow_table
*,
82 struct ovn_extend_table
*group_table
,
83 struct ovn_extend_table
*meter_table
,
84 uint32_t *conj_id_ofs
);
86 bool lflow_handle_changed_flows(
87 struct ovsdb_idl_index
*sbrec_multicast_group_by_name_datapath
,
88 struct ovsdb_idl_index
*sbrec_port_binding_by_name
,
89 const struct sbrec_dhcp_options_table
*,
90 const struct sbrec_dhcpv6_options_table
*,
91 const struct sbrec_logical_flow_table
*,
92 const struct hmap
*local_datapaths
,
93 const struct sbrec_chassis
*,
94 const struct shash
*addr_sets
,
95 const struct shash
*port_groups
,
96 const struct sset
*active_tunnels
,
97 const struct sset
*local_lport_ids
,
98 struct ovn_desired_flow_table
*,
99 struct ovn_extend_table
*group_table
,
100 struct ovn_extend_table
*meter_table
,
101 uint32_t *conj_id_ofs
);
103 void lflow_destroy(void);
105 #endif /* ovn/lflow.h */