master-thesis/netpfga/log/breaking-diff

101 lines
2.4 KiB
Text
Raw Normal View History

--- minip4_solution-mirror.p4 2019-07-23 23:17:55.151317107 +0200
+++ minip4_solution.p4 2019-07-24 09:11:13.430196299 +0200
@@ -4,8 +4,8 @@
typedef bit<48> EthAddr_t;
header Ethernet_h {
- EthAddr_t dstAddr;
- EthAddr_t srcAddr;
+ EthAddr_t dst_addr;
+ EthAddr_t src_addr;
bit<16> etherType;
}
@@ -30,14 +30,14 @@
@Xilinx_MaxPacketRegion(1024)
parser TopParser(
- packet_in b,
- out Parsed_packet p,
+ packet_in packet,
+ out Parsed_packet hdr,
out user_metadata_t user_metadata,
out digest_data_t digest_data,
- inout sume_metadata_t sume_metadata) {
+ inout sume_metadata_t standard_metadata) {
state start {
- b.extract(p.ethernet);
+ packet.extract(hdr.ethernet);
user_metadata.unused = 0;
digest_data.unused = 0;
@@ -45,19 +45,20 @@
}
}
+
/********************************************************************************
* Main
*/
control TopPipe(
- inout Parsed_packet p,
+ inout Parsed_packet hdr,
inout user_metadata_t user_metadata,
inout digest_data_t digest_data,
inout sume_metadata_t sume_metadata) {
action swap_eth_addresses() {
- EthAddr_t temp = p.ethernet.dstAddr;
- p.ethernet.dstAddr = p.ethernet.srcAddr;
- p.ethernet.srcAddr = temp;
+ 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;
@@ -80,12 +81,12 @@
}
action do_nothing() {
- EthAddr_t temp = p.ethernet.dstAddr;
+ EthAddr_t temp = hdr.ethernet.dst_addr;
}
table lookup_table {
key = {
- p.ethernet.dstAddr: exact;
+ hdr.ethernet.dst_addr: exact;
}
actions = {
@@ -109,15 +110,17 @@
@Xilinx_MaxPacketRegion(1024)
control TopDeparser(
- packet_out b,
- in Parsed_packet p,
+ packet_out packet,
+ in Parsed_packet hdr,
in user_metadata_t user_metadata,
inout digest_data_t digest_data,
inout sume_metadata_t sume_metadata) {
apply {
- b.emit(p.ethernet);
+ packet.emit(hdr.ethernet);
}
+
+
}
/********************************************************************************
@@ -128,4 +131,4 @@
TopParser(),
TopPipe(),
TopDeparser()
-) main;
+) main;
\ No newline at end of file