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