Carmelo Cascone | 9ab4061 | 2017-09-19 16:31:55 +0900 | [diff] [blame^] | 1 | // Copyright (c) 2017, Google Inc. |
| 2 | // |
| 3 | // P4_16 specification for a Spine switch. |
| 4 | // Status: WORK IN PROGRESS |
| 5 | // Note: This code has not been tested and is expected to contain bugs. |
| 6 | |
| 7 | #include "parser.p4" |
| 8 | #include "class_id.p4" |
| 9 | #include "l3_fwd.p4" |
| 10 | #include "packetio.p4" |
| 11 | #include "punt.p4" |
| 12 | #include "vrf.p4" |
| 13 | #include "ipv4_checksum.p4" |
| 14 | |
| 15 | |
| 16 | control ingress_spine(inout parsed_packet_t hdr, |
| 17 | inout local_metadata_t local_metadata, |
| 18 | inout standard_metadata_t standard_metadata) { |
| 19 | apply { |
| 20 | if (hdr.packet_out.isValid()) { |
| 21 | packetio_ingress.apply(hdr, local_metadata, standard_metadata); |
| 22 | } |
| 23 | vrf.apply(hdr, local_metadata, standard_metadata); |
| 24 | class_id.apply(hdr, local_metadata, standard_metadata); |
| 25 | l3_fwd.apply(hdr, local_metadata, standard_metadata); |
| 26 | punt.apply(hdr, local_metadata, standard_metadata); |
| 27 | } |
| 28 | } // end ingress_spine |
| 29 | |
| 30 | control egress_spine(inout parsed_packet_t hdr, |
| 31 | inout local_metadata_t local_metadata, |
| 32 | inout standard_metadata_t standard_metadata) { |
| 33 | apply { |
| 34 | packetio_egress.apply(hdr, local_metadata, standard_metadata); |
| 35 | } |
| 36 | } // end egress_spine |
| 37 | |
| 38 | V1Switch(pkt_parser(), verify_checksum(), ingress_spine(), egress_spine(), |
| 39 | compute_checksum(), pkt_deparser()) main; |