5cac76c90609cac4359877449f1ae19c9649e7ed
[cascardo/ovs.git] / ovn / controller / lflow.h
1 /* Copyright (c) 2015 Nicira, Inc.
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
16
17 #ifndef OVN_LFLOW_H
18 #define OVN_LFLOW_H 1
19
20 /* Logical_Flow table translation to OpenFlow
21  * ==========================================
22  *
23  * The Logical_Flow table obtained from the OVN_Southbound database works in
24  * terms of logical entities, that is, logical flows among logical datapaths
25  * and logical ports.  This code translates these logical flows into OpenFlow
26  * flows that, again, work in terms of logical entities implemented through
27  * OpenFlow extensions (e.g. registers represent the logical input and output
28  * ports).
29  *
30  * Physical-to-logical and logical-to-physical translation are implemented in
31  * physical.[ch] as separate OpenFlow tables that run before and after,
32  * respectively, the logical pipeline OpenFlow tables.
33  */
34
35 #include <stdint.h>
36
37 struct controller_ctx;
38 struct hmap;
39 struct uuid;
40
41 /* OpenFlow table numbers.
42  *
43  * These are heavily documented in ovn-architecture(7), please update it if
44  * you make any changes. */
45 #define OFTABLE_PHY_TO_LOG            0
46 #define OFTABLE_LOG_INGRESS_PIPELINE 16 /* First of LOG_PIPELINE_LEN tables. */
47 #define OFTABLE_REMOTE_OUTPUT        32
48 #define OFTABLE_LOCAL_OUTPUT         33
49 #define OFTABLE_DROP_LOOPBACK        34
50 #define OFTABLE_LOG_EGRESS_PIPELINE  48 /* First of LOG_PIPELINE_LEN tables. */
51 #define OFTABLE_LOG_TO_PHY           64
52
53 /* The number of tables for the ingress and egress pipelines. */
54 #define LOG_PIPELINE_LEN 16
55
56 /* Logical fields.
57  *
58  * These values are documented in ovn-architecture(7), please update the
59  * documentation if you change any of them. */
60 #define MFF_LOG_DATAPATH MFF_METADATA /* Logical datapath (64 bits). */
61 #define MFF_LOG_INPORT   MFF_REG6     /* Logical input port (32 bits). */
62 #define MFF_LOG_OUTPORT  MFF_REG7     /* Logical output port (32 bits). */
63
64 /* Logical registers.
65  *
66  * Make sure these don't overlap with the logical fields! */
67 #define MFF_LOG_REGS \
68     MFF_LOG_REG(MFF_REG0) \
69     MFF_LOG_REG(MFF_REG1) \
70     MFF_LOG_REG(MFF_REG2) \
71     MFF_LOG_REG(MFF_REG3) \
72     MFF_LOG_REG(MFF_REG4) \
73     MFF_LOG_REG(MFF_REG5)
74
75 void lflow_init(void);
76 void lflow_run(struct controller_ctx *, struct hmap *flow_table);
77 void lflow_destroy(void);
78
79 #endif /* ovn/lflow.h */