[netpfga] re-introduce old parser, rename variables

This commit is contained in:
Nico Schottelius 2019-07-23 16:06:18 +02:00
parent 1be73a0e50
commit e6951c6210

View file

@ -45,23 +45,24 @@ struct digest_data_t {
// out user_metadata_t user_metadata,
// out digest_data_t digest_data,
// inout sume_metadata_t sume_metadata) {
// state start {
// b.extract(p.ethernet);
// user_metadata.unused = 0;
// digest_data.unused = 0;
// transition accept;
// }
// }
@Xilinx_MaxPacketRegion(1024)
parser TopParser(packet_in packet,
out headers hdr,
out metadata meta,
// out metadata meta,
out user_metadata_t user_metadata,
out digest_data_t digest_data,
inout sume_metadata_t standard_metadata) {
state start {
packet.extract(hdr.ethernet);
user_metadata.unused = 0;
digest_data.unused = 0;
#include "parsers.p4"
transition accept;
}
// #include "parsers.p4"
}
@ -87,6 +88,8 @@ control TopPipe(inout headers hdr,
// #include "actions_arp.p4" // includes v4_arp, v4_egress
// #include "actions_delta_checksum.p4" // non payload based checksumming
// apply {
// if(hdr.ipv6.isValid()) {
// if(nat64.apply().hit) { /* generic / static nat64 done */
@ -168,30 +171,37 @@ control TopPipe(inout headers hdr,
// }
action swap_eth_addresses() {
EthAddr_t temp = hdr.ethernet.dst_addr;
hdr.ethernet.dst_addr = hdr.ethernet.src_addr;
hdr.ethernet.src_addr = temp;
action swap_eth_addresses() {
EthAddr_t temp = hdr.ethernet.dst_addr;
hdr.ethernet.dst_addr = hdr.ethernet.src_addr;
hdr.ethernet.src_addr = temp;
/* set egress port */
sume_metadata.dst_port = sume_metadata.src_port;
}
/* set egress port */
sume_metadata.dst_port = sume_metadata.src_port;
}
action send_to_port1() {
sume_metadata.dst_port = 1;
}
action send_to_port1() {
sume_metadata.dst_port = 1;
}
action send_to_all_ports() {
/* Taken from commands.txt of the "int" project:
table_cam_add_entry forward set_output_port 0xffffffffffff => 0b01010101
// action send_testdata_to_port1() {
// // python: MAC2 = "08:22:22:22:22:08"
// if(hdr.ethernet.dst_addr == 0x082222222208) {
// sume_metadata.dst_port = 1;
// }
// }
python convert:
>>> 0b01010101
85
action send_to_all_ports() {
/* Taken from commands.txt of the "int" project:
table_cam_add_entry forward set_output_port 0xffffffffffff => 0b01010101
*/
sume_metadata.dst_port = 85;
}
python convert:
>>> 0b01010101
85
*/
sume_metadata.dst_port = 85;
}
action do_nothing() {
EthAddr_t temp = hdr.ethernet.dst_addr;
@ -239,17 +249,17 @@ control TopDeparser(packet_out packet,
// @Xilinx_MaxPacketRegion(1024)
// control TopDeparser(packet_out b,
// in Parsed_packet p,
// in user_metadata_t user_metadata,
// inout digest_data_t digest_data,
// inout sume_metadata_t sume_metadata) {
// in Parsed_packet p,
// in user_metadata_t user_metadata,
// inout digest_data_t digest_data,
// inout sume_metadata_t sume_metadata) {
// apply {
// packet.emit(hdr.ethernet);
// }
apply {
packet.emit(hdr.ethernet);
}
#include "deparser.p4"
// #include "deparser.p4"
}