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.
17 #ifndef OVN_CONTROLLER_H
18 #define OVN_CONTROLLER_H 1
21 #include "ovn/lib/ovn-sb-idl.h"
23 /* Linux supports a maximum of 64K zones, which seems like a fine default. */
24 #define MAX_CT_ZONES 65535
26 struct controller_ctx {
27 struct ovsdb_idl *ovnsb_idl;
28 struct ovsdb_idl_txn *ovnsb_idl_txn;
30 struct ovsdb_idl *ovs_idl;
31 struct ovsdb_idl_txn *ovs_idl_txn;
34 /* Contains hmap_node whose hash values are the tunnel_key of datapaths
35 * with at least one local port binding. It also stores the port binding of
36 * "localnet" port if such a port exists on the datapath, which indicates
37 * physical network should be used for inter-chassis communication through
38 * the localnet port */
39 struct local_datapath {
40 struct hmap_node hmap_node;
41 struct hmap_node uuid_hmap_node;
42 const struct uuid *uuid;
44 const struct sbrec_port_binding *localnet_port;
47 struct local_datapath *get_local_datapath(const struct hmap *,
50 /* Contains hmap_node whose hash values are the tunnel_key of datapaths
51 * with at least one logical patch port binding. */
52 struct patched_datapath {
53 struct hmap_node hmap_node;
54 bool local; /* 'True' if the datapath is for gateway router. */
55 const struct sbrec_port_binding *port_binding;
58 struct patched_datapath *get_patched_datapath(const struct hmap *,
61 const struct ovsrec_bridge *get_bridge(struct ovsdb_idl *,
64 const struct sbrec_chassis *get_chassis(struct ovsdb_idl *,
65 const char *chassis_id);
67 /* Must be a bit-field ordered from most-preferred (higher number) to
68 * least-preferred (lower number). */
69 enum chassis_tunnel_type {
75 uint32_t get_tunnel_type(const char *name);
78 #endif /* ovn/ovn-controller.h */