blob: a44e10e1606a7d7222730532bbabe2c8545189ac [file] [log] [blame]
Carmelo Casconeca94bcf2017-10-27 14:16:59 -07001/*
2 * Copyright 2017-present Open Networking Foundation
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17#include <core.p4>
18#include <v1model.p4>
19
20#include "include/headers.p4"
Jonghwan Hyun4a9a6712017-11-13 14:43:55 -080021#include "include/custom_headers.p4"
Carmelo Casconeca94bcf2017-10-27 14:16:59 -070022#include "include/defines.p4"
23#include "include/parsers.p4"
24#include "include/actions.p4"
25#include "include/port_counters.p4"
Frank Wangd7e3b4b2017-09-24 13:37:54 +090026#include "include/port_meters.p4"
Carmelo Casconeca94bcf2017-10-27 14:16:59 -070027#include "include/checksums.p4"
28#include "include/packet_io.p4"
29#include "include/table0.p4"
Frank Wangd7e3b4b2017-09-24 13:37:54 +090030#include "include/host_meter_table.p4"
Carmelo Casconeca94bcf2017-10-27 14:16:59 -070031#include "include/wcmp.p4"
32
33//------------------------------------------------------------------------------
34// INGRESS PIPELINE
35//------------------------------------------------------------------------------
36
37control ingress(inout headers_t hdr,
38 inout local_metadata_t local_metadata,
39 inout standard_metadata_t standard_metadata) {
40
41 apply {
42 port_counters_ingress.apply(hdr, standard_metadata);
Frank Wangd7e3b4b2017-09-24 13:37:54 +090043 port_meters_ingress.apply(hdr, standard_metadata);
Carmelo Casconeca94bcf2017-10-27 14:16:59 -070044 packetio_ingress.apply(hdr, standard_metadata);
45 table0_control.apply(hdr, local_metadata, standard_metadata);
Frank Wangd7e3b4b2017-09-24 13:37:54 +090046 host_meter_control.apply(hdr, local_metadata, standard_metadata);
Carmelo Casconeca94bcf2017-10-27 14:16:59 -070047 wcmp_control.apply(hdr, local_metadata, standard_metadata);
48 }
49}
50
51//------------------------------------------------------------------------------
52// EGRESS PIPELINE
53//------------------------------------------------------------------------------
54
55control egress(inout headers_t hdr,
56 inout local_metadata_t local_metadata,
57 inout standard_metadata_t standard_metadata) {
58
59 apply {
60 port_counters_egress.apply(hdr, standard_metadata);
Frank Wangd7e3b4b2017-09-24 13:37:54 +090061 port_meters_egress.apply(hdr, standard_metadata);
Carmelo Casconeca94bcf2017-10-27 14:16:59 -070062 packetio_egress.apply(hdr, standard_metadata);
63 }
64}
65
66//------------------------------------------------------------------------------
67// SWITCH INSTANTIATION
68//------------------------------------------------------------------------------
69
70V1Switch(parser_impl(),
71 verify_checksum_control(),
72 ingress(),
73 egress(),
74 compute_checksum_control(),
75 deparser()) main;