blob: a29130399c9a1f33addbf00023c444ba303607e0 [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"
21#include "include/defines.p4"
22#include "include/parsers.p4"
23#include "include/actions.p4"
24#include "include/port_counters.p4"
25#include "include/checksums.p4"
26#include "include/packet_io.p4"
27#include "include/table0.p4"
28#include "include/wcmp.p4"
29
30//------------------------------------------------------------------------------
31// INGRESS PIPELINE
32//------------------------------------------------------------------------------
33
34control ingress(inout headers_t hdr,
35 inout local_metadata_t local_metadata,
36 inout standard_metadata_t standard_metadata) {
37
38 apply {
39 port_counters_ingress.apply(hdr, standard_metadata);
40 packetio_ingress.apply(hdr, standard_metadata);
41 table0_control.apply(hdr, local_metadata, standard_metadata);
42 wcmp_control.apply(hdr, local_metadata, standard_metadata);
43 }
44}
45
46//------------------------------------------------------------------------------
47// EGRESS PIPELINE
48//------------------------------------------------------------------------------
49
50control egress(inout headers_t hdr,
51 inout local_metadata_t local_metadata,
52 inout standard_metadata_t standard_metadata) {
53
54 apply {
55 port_counters_egress.apply(hdr, standard_metadata);
56 packetio_egress.apply(hdr, standard_metadata);
57 }
58}
59
60//------------------------------------------------------------------------------
61// SWITCH INSTANTIATION
62//------------------------------------------------------------------------------
63
64V1Switch(parser_impl(),
65 verify_checksum_control(),
66 ingress(),
67 egress(),
68 compute_checksum_control(),
69 deparser()) main;