blob: 93ab2a5637a7b2d6b27060741d26b8bf5ec79a2b [file] [log] [blame]
// Copyright (c) 2017, Google Inc.
//
// P4_16 specification for a middleblock switch in a Jupiter superblock.
// Status: WORK IN PROGRESS
// Note: This code has not been tested and is expected to contain bugs.
#include "parser.p4"
#include "class_id.p4"
#include "l3_fwd.p4"
#include "packetio.p4"
#include "punt.p4"
#include "vrf.p4"
#include "ipv4_checksum.p4"
control ingress_middleblock(inout parsed_packet_t hdr,
inout local_metadata_t local_metadata,
inout standard_metadata_t standard_metadata) {
apply {
if (hdr.packet_out.isValid()) {
packetio_ingress.apply(hdr, local_metadata, standard_metadata);
}
vrf.apply(hdr, local_metadata, standard_metadata);
class_id.apply(hdr, local_metadata, standard_metadata);
l3_fwd.apply(hdr, local_metadata, standard_metadata);
punt.apply(hdr, local_metadata, standard_metadata);
}
} // end ingress_middleblock
control egress_middleblock(inout parsed_packet_t hdr,
inout local_metadata_t local_metadata,
inout standard_metadata_t standard_metadata) {
apply {
packetio_egress.apply(hdr, local_metadata, standard_metadata);
}
} // end egress_middleblock
V1Switch(pkt_parser(), verify_checksum(), ingress_middleblock(),
egress_middleblock(), compute_checksum(), pkt_deparser()) main;