2019-07-23 10:21:49 +00:00
|
|
|
#include <core.p4>
|
|
|
|
#include <sume_switch.p4>
|
|
|
|
#include "headers.p4"
|
|
|
|
|
2019-08-02 10:03:26 +00:00
|
|
|
|
2019-07-24 10:15:26 +00:00
|
|
|
#define Parsed_packet headers
|
|
|
|
#define user_metadata_t metadata
|
2019-07-24 10:01:47 +00:00
|
|
|
|
2019-08-04 11:30:45 +00:00
|
|
|
// 1500 mtu * 8 = 12000
|
2019-08-04 11:52:30 +00:00
|
|
|
#define MAX_NETPFGA_PACKET_SIZE_BITS 16384
|
2019-08-04 11:30:45 +00:00
|
|
|
|
2019-07-24 21:45:40 +00:00
|
|
|
// digest_data, MUST be 256 bits -- not using it
|
2019-07-23 10:21:49 +00:00
|
|
|
struct digest_data_t {
|
|
|
|
bit<256> unused;
|
|
|
|
}
|
|
|
|
|
|
|
|
/********************************************************************************
|
|
|
|
* Parser
|
2019-07-24 07:49:17 +00:00
|
|
|
*/
|
|
|
|
parser RealParser(
|
|
|
|
packet_in packet,
|
|
|
|
out Parsed_packet hdr,
|
|
|
|
out user_metadata_t meta,
|
|
|
|
out digest_data_t digest_data,
|
|
|
|
inout sume_metadata_t standard_metadata) {
|
|
|
|
|
2019-07-29 14:29:12 +00:00
|
|
|
|
|
|
|
#include "parsers.p4"
|
2019-07-24 07:49:17 +00:00
|
|
|
}
|
2019-07-23 10:21:49 +00:00
|
|
|
|
2019-08-04 11:30:45 +00:00
|
|
|
@Xilinx_MaxPacketRegion(MAX_NETPFGA_PACKET_SIZE_BITS)
|
2019-07-23 21:20:41 +00:00
|
|
|
parser TopParser(
|
2019-07-24 07:36:24 +00:00
|
|
|
packet_in b,
|
|
|
|
out Parsed_packet p,
|
2019-07-23 21:20:41 +00:00
|
|
|
out user_metadata_t user_metadata,
|
|
|
|
out digest_data_t digest_data,
|
2019-07-24 07:36:24 +00:00
|
|
|
inout sume_metadata_t sume_metadata) {
|
2019-07-23 21:20:41 +00:00
|
|
|
|
2019-07-24 07:49:17 +00:00
|
|
|
RealParser() realparser;
|
2019-07-23 14:06:18 +00:00
|
|
|
|
2019-07-24 07:53:13 +00:00
|
|
|
state start {
|
2019-07-24 07:49:17 +00:00
|
|
|
realparser.apply(b, p, user_metadata, digest_data, sume_metadata);
|
2019-07-23 14:06:18 +00:00
|
|
|
transition accept;
|
|
|
|
}
|
2019-07-23 21:20:41 +00:00
|
|
|
}
|
2019-07-23 10:22:31 +00:00
|
|
|
|
2019-07-23 21:20:41 +00:00
|
|
|
/********************************************************************************
|
|
|
|
* Main
|
2019-07-24 09:22:32 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
control RealMain(
|
|
|
|
inout Parsed_packet hdr,
|
|
|
|
inout user_metadata_t meta,
|
2019-07-23 21:20:41 +00:00
|
|
|
inout digest_data_t digest_data,
|
|
|
|
inout sume_metadata_t sume_metadata) {
|
|
|
|
|
2019-07-24 09:45:37 +00:00
|
|
|
#include "actions_nat64_generic.p4"
|
2019-07-24 11:08:02 +00:00
|
|
|
#include "actions_egress.p4"
|
2019-07-24 20:48:21 +00:00
|
|
|
#include "actions_delta_checksum.p4"
|
2019-07-24 20:27:36 +00:00
|
|
|
|
2019-07-29 19:34:07 +00:00
|
|
|
//#include "netpfga_dummy.p4"
|
2019-07-28 18:08:28 +00:00
|
|
|
|
2019-07-23 21:20:41 +00:00
|
|
|
apply {
|
2019-07-24 21:45:40 +00:00
|
|
|
bit<17> tmp17 = 0;
|
2019-07-25 13:06:56 +00:00
|
|
|
|
2019-07-28 18:08:28 +00:00
|
|
|
/* does not compile without a table - give it a table */
|
2019-07-29 19:34:07 +00:00
|
|
|
//dummy_table_for_netpfga.apply();
|
2019-07-25 13:06:56 +00:00
|
|
|
|
2019-07-28 18:08:28 +00:00
|
|
|
/* continue without tables */
|
2019-07-29 14:35:05 +00:00
|
|
|
//#include "netpfga_nat64_stupid_hardcoded.p4"
|
2019-07-29 19:34:07 +00:00
|
|
|
|
|
|
|
#include "netpfga_nat64.p4"
|
|
|
|
|
2019-07-23 21:20:41 +00:00
|
|
|
}
|
2019-07-25 12:40:20 +00:00
|
|
|
|
2019-07-23 10:21:49 +00:00
|
|
|
}
|
|
|
|
|
2019-07-24 09:22:32 +00:00
|
|
|
control TopPipe(
|
|
|
|
inout Parsed_packet p,
|
|
|
|
inout user_metadata_t user_metadata,
|
|
|
|
inout digest_data_t digest_data,
|
|
|
|
inout sume_metadata_t sume_metadata) {
|
|
|
|
|
|
|
|
RealMain() realmain;
|
|
|
|
|
|
|
|
apply {
|
|
|
|
realmain.apply(p, user_metadata, digest_data, sume_metadata);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-07-23 21:20:41 +00:00
|
|
|
/********************************************************************************
|
|
|
|
* Deparser
|
|
|
|
*/
|
|
|
|
|
2019-07-29 14:29:12 +00:00
|
|
|
control RealDeParser(
|
|
|
|
packet_out packet,
|
|
|
|
in Parsed_packet hdr,
|
|
|
|
in user_metadata_t meta,
|
|
|
|
inout digest_data_t digest_data,
|
|
|
|
inout sume_metadata_t sume_metadata) {
|
|
|
|
|
|
|
|
#include "deparser.p4"
|
|
|
|
}
|
|
|
|
|
2019-08-04 11:30:45 +00:00
|
|
|
@Xilinx_MaxPacketRegion(MAX_NETPFGA_PACKET_SIZE_BITS)
|
2019-07-23 21:20:41 +00:00
|
|
|
control TopDeparser(
|
2019-07-24 07:36:24 +00:00
|
|
|
packet_out b,
|
|
|
|
in Parsed_packet p,
|
2019-07-23 21:20:41 +00:00
|
|
|
in user_metadata_t user_metadata,
|
|
|
|
inout digest_data_t digest_data,
|
|
|
|
inout sume_metadata_t sume_metadata) {
|
|
|
|
|
2019-07-29 14:29:12 +00:00
|
|
|
RealDeParser() realdeparser;
|
|
|
|
|
2019-07-23 21:20:41 +00:00
|
|
|
apply {
|
2019-07-29 14:29:12 +00:00
|
|
|
realdeparser.apply(b, p, user_metadata, digest_data, sume_metadata);
|
2019-07-23 21:20:41 +00:00
|
|
|
}
|
2019-07-29 14:29:12 +00:00
|
|
|
|
2019-07-23 21:20:41 +00:00
|
|
|
}
|
2019-07-23 10:22:31 +00:00
|
|
|
|
2019-07-23 10:21:49 +00:00
|
|
|
/********************************************************************************
|
2019-07-23 21:20:41 +00:00
|
|
|
* Switch
|
|
|
|
*/
|
|
|
|
|
|
|
|
SimpleSumeSwitch(
|
|
|
|
TopParser(),
|
|
|
|
TopPipe(),
|
|
|
|
TopDeparser()
|
2019-07-24 07:36:24 +00:00
|
|
|
) main;
|