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" |
Frank Wang | d7e3b4b | 2017-09-24 13:37:54 +0900 | [diff] [blame] | 26 | #include "include/port_meters.p4" |
Carmelo Cascone | ca94bcf | 2017-10-27 14:16:59 -0700 | [diff] [blame] | 27 | #include "include/checksums.p4" |
| 28 | #include "include/packet_io.p4" |
| 29 | #include "include/table0.p4" |
Frank Wang | d7e3b4b | 2017-09-24 13:37:54 +0900 | [diff] [blame] | 30 | #include "include/host_meter_table.p4" |
Carmelo Cascone | ca94bcf | 2017-10-27 14:16:59 -0700 | [diff] [blame] | 31 | #include "include/wcmp.p4" |
| 32 | |
| 33 | //------------------------------------------------------------------------------ |
| 34 | // INGRESS PIPELINE |
| 35 | //------------------------------------------------------------------------------ |
| 36 | |
| 37 | control 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 Wang | d7e3b4b | 2017-09-24 13:37:54 +0900 | [diff] [blame] | 43 | port_meters_ingress.apply(hdr, standard_metadata); |
Carmelo Cascone | ca94bcf | 2017-10-27 14:16:59 -0700 | [diff] [blame] | 44 | packetio_ingress.apply(hdr, standard_metadata); |
| 45 | table0_control.apply(hdr, local_metadata, standard_metadata); |
Frank Wang | d7e3b4b | 2017-09-24 13:37:54 +0900 | [diff] [blame] | 46 | host_meter_control.apply(hdr, local_metadata, standard_metadata); |
Carmelo Cascone | ca94bcf | 2017-10-27 14:16:59 -0700 | [diff] [blame] | 47 | wcmp_control.apply(hdr, local_metadata, standard_metadata); |
| 48 | } |
| 49 | } |
| 50 | |
| 51 | //------------------------------------------------------------------------------ |
| 52 | // EGRESS PIPELINE |
| 53 | //------------------------------------------------------------------------------ |
| 54 | |
| 55 | control 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 Wang | d7e3b4b | 2017-09-24 13:37:54 +0900 | [diff] [blame] | 61 | port_meters_egress.apply(hdr, standard_metadata); |
Carmelo Cascone | ca94bcf | 2017-10-27 14:16:59 -0700 | [diff] [blame] | 62 | packetio_egress.apply(hdr, standard_metadata); |
| 63 | } |
| 64 | } |
| 65 | |
| 66 | //------------------------------------------------------------------------------ |
| 67 | // SWITCH INSTANTIATION |
| 68 | //------------------------------------------------------------------------------ |
| 69 | |
| 70 | V1Switch(parser_impl(), |
| 71 | verify_checksum_control(), |
| 72 | ingress(), |
| 73 | egress(), |
| 74 | compute_checksum_control(), |
| 75 | deparser()) main; |