Yi Tseng | be34205 | 2017-11-03 10:21:23 -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/control/filtering.p4" |
| 21 | #include "include/control/forwarding.p4" |
| 22 | #include "include/control/next.p4" |
| 23 | #include "include/control/packetio.p4" |
| 24 | #include "include/control/port_counter.p4" |
| 25 | #include "include/header.p4" |
| 26 | #include "include/checksum.p4" |
| 27 | #include "include/parser.p4" |
| 28 | |
| 29 | control FabricIngress ( |
| 30 | inout parsed_headers_t hdr, |
| 31 | inout fabric_metadata_t fabric_metadata, |
| 32 | inout standard_metadata_t standard_metadata) { |
| 33 | PacketIoIngress() packet_io_ingress; |
| 34 | Filtering() filtering; |
| 35 | Forwarding() forwarding; |
| 36 | Next() next; |
| 37 | PortCountersControl() port_counters_control; |
Yi Tseng | 3a5731e | 2018-01-22 11:38:58 -0800 | [diff] [blame] | 38 | EgressNextControl() egress_next; |
Yi Tseng | be34205 | 2017-11-03 10:21:23 -0700 | [diff] [blame] | 39 | |
| 40 | apply { |
| 41 | packet_io_ingress.apply(hdr, fabric_metadata, standard_metadata); |
| 42 | filtering.apply(hdr, fabric_metadata, standard_metadata); |
| 43 | forwarding.apply(hdr, fabric_metadata, standard_metadata); |
| 44 | next.apply(hdr, fabric_metadata, standard_metadata); |
| 45 | port_counters_control.apply(hdr, fabric_metadata, standard_metadata); |
Yi Tseng | 3a5731e | 2018-01-22 11:38:58 -0800 | [diff] [blame] | 46 | egress_next.apply(hdr, fabric_metadata, standard_metadata); |
Yi Tseng | be34205 | 2017-11-03 10:21:23 -0700 | [diff] [blame] | 47 | } |
| 48 | } |
| 49 | |
| 50 | control FabricEgress (inout parsed_headers_t hdr, |
| 51 | inout fabric_metadata_t fabric_metadata, |
| 52 | inout standard_metadata_t standard_metadata) { |
Yi Tseng | 1d84267 | 2017-11-28 16:06:52 -0800 | [diff] [blame] | 53 | PacketIoEgress() pkt_io_egress; |
Yi Tseng | be34205 | 2017-11-03 10:21:23 -0700 | [diff] [blame] | 54 | apply { |
Yi Tseng | 1d84267 | 2017-11-28 16:06:52 -0800 | [diff] [blame] | 55 | pkt_io_egress.apply(hdr, fabric_metadata, standard_metadata); |
Yi Tseng | be34205 | 2017-11-03 10:21:23 -0700 | [diff] [blame] | 56 | } |
| 57 | } |
| 58 | |
| 59 | V1Switch( |
| 60 | FabricParser(), |
| 61 | FabricVerifyChecksum(), |
| 62 | FabricIngress(), |
| 63 | FabricEgress(), |
| 64 | FabricComputeChecksum(), |
| 65 | FabricDeparser() |
| 66 | ) main; |