ovn: Add stateful ACL support.
[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 simap;
40 struct uuid;
41
42 /* OpenFlow table numbers.
43  *
44  * These are heavily documented in ovn-architecture(7), please update it if
45  * you make any changes. */
46 #define OFTABLE_PHY_TO_LOG            0
47 #define OFTABLE_LOG_INGRESS_PIPELINE 16 /* First of LOG_PIPELINE_LEN tables. */
48 #define OFTABLE_REMOTE_OUTPUT        32
49 #define OFTABLE_LOCAL_OUTPUT         33
50 #define OFTABLE_DROP_LOOPBACK        34
51 #define OFTABLE_LOG_EGRESS_PIPELINE  48 /* First of LOG_PIPELINE_LEN tables. */
52 #define OFTABLE_LOG_TO_PHY           64
53
54 /* The number of tables for the ingress and egress pipelines. */
55 #define LOG_PIPELINE_LEN 16
56
57 /* Logical fields.
58  *
59  * These values are documented in ovn-architecture(7), please update the
60  * documentation if you change any of them. */
61 #define MFF_LOG_DATAPATH MFF_METADATA /* Logical datapath (64 bits). */
62 #define MFF_LOG_CT_ZONE  MFF_REG5     /* Logical conntrack zone (32 bits). */
63 #define MFF_LOG_INPORT   MFF_REG6     /* Logical input port (32 bits). */
64 #define MFF_LOG_OUTPORT  MFF_REG7     /* Logical output port (32 bits). */
65
66 /* Logical registers.
67  *
68  * Make sure these don't overlap with the logical fields! */
69 #define MFF_LOG_REGS \
70     MFF_LOG_REG(MFF_REG0) \
71     MFF_LOG_REG(MFF_REG1) \
72     MFF_LOG_REG(MFF_REG2) \
73     MFF_LOG_REG(MFF_REG3) \
74     MFF_LOG_REG(MFF_REG4)
75
76 void lflow_init(void);
77 void lflow_run(struct controller_ctx *, struct hmap *flow_table,
78                const struct simap *ct_zones);
79 void lflow_destroy(void);
80
81 #endif /* ovn/lflow.h */