Merge branch 'master' of gitlab.ethz.ch:nicosc/master-thesis

This commit is contained in:
Nico Schottelius 2019-07-24 10:14:33 +02:00
commit 05008b5c97
4 changed files with 8906 additions and 22 deletions

View file

@ -6343,6 +6343,51 @@ endtask
#+END_CENTER #+END_CENTER
*** DONE the netpfga madness: Renaming variables breaks the compilation.
CLOSED: [2019-07-24 Wed 09:33]
#+BEGIN_CENTER
@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);
}
+
+
}
#+END_CENTER
*** state names are fixed
#+BEGIN_CENTER
make[1]: Entering directory '/home/nico/projects/P4-NetFPGA/contrib-projects/sume-sdnet-switch/projects/minip4/src'
p4c-sdnet -o minip4.sdnet --sdnet_info .sdnet_switch_info.dat minip4_solution.p4
minip4_solution.p4(37): warning: start: implicit transition to `reject'
state start {
^^^^^
minip4_solution.p4(52): warning: realparser: unused instance
RealParser() realparser;
^^^^^^^^^^
minip4_solution.p4(45): error: parser TopParser: parser does not have a `start' state
parser TopParser(
^^^^^^^^^
minip4_solution.p4(45): warning: accept state in parser TopParser is unreachable
parser TopParser(
^^^^^^^^^
Makefile:34: recipe for target 'all' failed
make[1]: *** [all] Error 1
make[1]: Leaving directory '/home/nico/projects/P4-NetFPGA/contrib-projects/sume-sdnet-switch/projects/minip4/src'
Makefile:31: recipe for target 'frontend' failed
#+END_CENTER
*** TODO Further notes P4/master thesis *** TODO Further notes P4/master thesis
- Cannot easily run P4 on notebook - changes to the system very - Cannot easily run P4 on notebook - changes to the system very
invasive invasive

100
netpfga/log/breaking-diff Normal file
View file

@ -0,0 +1,100 @@
--- 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

File diff suppressed because one or more lines are too long

View file

@ -4,8 +4,8 @@
typedef bit<48> EthAddr_t; typedef bit<48> EthAddr_t;
header Ethernet_h { header Ethernet_h {
EthAddr_t dst_addr; EthAddr_t dstAddr;
EthAddr_t src_addr; EthAddr_t srcAddr;
bit<16> etherType; bit<16> etherType;
} }
@ -26,39 +26,51 @@ struct digest_data_t {
/******************************************************************************** /********************************************************************************
* Parser * Parser
*/ */
parser RealParser(
@Xilinx_MaxPacketRegion(1024)
parser TopParser(
packet_in packet, packet_in packet,
out Parsed_packet hdr, out Parsed_packet hdr,
out user_metadata_t user_metadata, out user_metadata_t meta,
out digest_data_t digest_data, out digest_data_t digest_data,
inout sume_metadata_t standard_metadata) { inout sume_metadata_t standard_metadata) {
state start { state start {
packet.extract(hdr.ethernet); packet.extract(hdr.ethernet);
user_metadata.unused = 0; meta.unused = 0;
digest_data.unused = 0; digest_data.unused = 0;
transition accept; transition accept;
} }
} }
@Xilinx_MaxPacketRegion(1024)
parser TopParser(
packet_in b,
out Parsed_packet p,
out user_metadata_t user_metadata,
out digest_data_t digest_data,
inout sume_metadata_t sume_metadata) {
RealParser() realparser;
state start {
realparser.apply(b, p, user_metadata, digest_data, sume_metadata);
transition accept;
}
}
/******************************************************************************** /********************************************************************************
* Main * Main
*/ */
control TopPipe( control TopPipe(
inout Parsed_packet hdr, inout Parsed_packet p,
inout user_metadata_t user_metadata, inout user_metadata_t user_metadata,
inout digest_data_t digest_data, inout digest_data_t digest_data,
inout sume_metadata_t sume_metadata) { inout sume_metadata_t sume_metadata) {
action swap_eth_addresses() { action swap_eth_addresses() {
EthAddr_t temp = hdr.ethernet.dst_addr; EthAddr_t temp = p.ethernet.dstAddr;
hdr.ethernet.dst_addr = hdr.ethernet.src_addr; p.ethernet.dstAddr = p.ethernet.srcAddr;
hdr.ethernet.src_addr = temp; p.ethernet.srcAddr = temp;
/* set egress port */ /* set egress port */
sume_metadata.dst_port = sume_metadata.src_port; sume_metadata.dst_port = sume_metadata.src_port;
@ -81,12 +93,12 @@ control TopPipe(
} }
action do_nothing() { action do_nothing() {
EthAddr_t temp = hdr.ethernet.dst_addr; EthAddr_t temp = p.ethernet.dstAddr;
} }
table lookup_table { table lookup_table {
key = { key = {
hdr.ethernet.dst_addr: exact; p.ethernet.dstAddr: exact;
} }
actions = { actions = {
@ -110,17 +122,15 @@ control TopPipe(
@Xilinx_MaxPacketRegion(1024) @Xilinx_MaxPacketRegion(1024)
control TopDeparser( control TopDeparser(
packet_out packet, packet_out b,
in Parsed_packet hdr, in Parsed_packet p,
in user_metadata_t user_metadata, in user_metadata_t user_metadata,
inout digest_data_t digest_data, inout digest_data_t digest_data,
inout sume_metadata_t sume_metadata) { inout sume_metadata_t sume_metadata) {
apply { apply {
packet.emit(hdr.ethernet); b.emit(p.ethernet);
} }
} }
/******************************************************************************** /********************************************************************************