From dc7d78252ef502c97db1745e30a45e9975af1ec5 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Wed, 24 Jul 2019 22:48:21 +0200 Subject: [PATCH] Merge full IPv6 handling code from BMV2 side --- doc/plan.org | 23 +++++++++++++---------- p4src/minip4_solution.p4 | 23 +++++++++++++++++++++++ 2 files changed, 36 insertions(+), 10 deletions(-) diff --git a/doc/plan.org b/doc/plan.org index b00cda2..a158ecb 100644 --- a/doc/plan.org +++ b/doc/plan.org @@ -3329,14 +3329,15 @@ https://en.wikipedia.org/wiki/IPv4_header_checksum | eth2 <--> nf0 | | eth1 <--> nf3 | ** Compile log - VERSIONS -| 5.1. - 5.5 | failure due to variable renaming | -| 5.6 | subparser: compiled! | -| 5.7 | subcontrol: [nsg] | -| 5.8 | nat64 actions/table: OK | -| 5.9 | nat64+headers [esprimo]: | -| 6.1 | ARP: mixed matches in table, ABORT | -| 6.2 | No arp, Vivado Simulator kernel has encounted an exception | -| | | +| 5.1. - 5.5 | failure due to variable renaming | +| 5.6 | subparser: compiled! | +| 5.7 | subcontrol: [nsg] | +| 5.8 | nat64 actions/table: OK | +| 5.9 | nat64+headers [esprimo]: | +| 6.1 | ARP: mixed matches in table, ABORT | +| 6.2 | No arp, Vivado Simulator kernel has encounted an exception, ABORT | +| 6.3 | Fixed lpm bug, ABORT | +| 6.4 | table size = 64, [nsg] | ** TODO Benchmark/comparison *** TODO Setup / Benchmark Jool *** TODO Setup / Benchmark tayga @@ -6085,7 +6086,8 @@ def config_tables(): #+BEGIN_CENTER ~/master-thesis/netpfga/minip4/simple_sume_switch/test/sim_switch_default/config_writes.py #+END_CENTER -*** 2019-07-22: trying to "fix" the config_writes.py +*** DONE 2019-07-22: trying to "fix" the config_writes.py + CLOSED: [2019-07-24 Wed 22:44] #+BEGIN_CENTER nico@nsg-System:~/master-thesis/netpfga/minip4/simple_sume_switch/test/sim_switch_default$ cat config_writes.py @@ -6539,7 +6541,8 @@ s/sume-sdnet-switch/projects/minip4/nf_sume_sdnet_ip/SimpleSumeSwitch/realmain_l FATAL_ERROR: Vivado Simulator kernel has encounted an exception from DPI C function: LPM_VerifyDataset(). Please correct. Time: 2016466 ps Iteration: 0 Process: /SimpleSumeSwitch_tb/LPM_VerifyDataset File: /home/nico/projects/P4-NetFPGA/contrib-projects/sume-sdnet-switch/projects/minip4/nf_sume_sdnet_ip/SimpleSumeSwitch/Testbench/SimpleSumeSwitch_tb.sv -*** 2019-07-24: table size too small +*** DONE 2019-07-24: table size too small + CLOSED: [2019-07-24 Wed 22:44] - raising again - this is a total madness #+BEGIN_CENTER diff --git a/p4src/minip4_solution.p4 b/p4src/minip4_solution.p4 index bd46653..19be04d 100644 --- a/p4src/minip4_solution.p4 +++ b/p4src/minip4_solution.p4 @@ -2,6 +2,10 @@ #include #include "headers.p4" +/* required for netfpga */ +#define USE_NICO_DELTA_CHECKSUM 1 + + // typedef bit<48> EthAddr_t; // header Ethernet_h { // EthAddr_t dstAddr; @@ -75,6 +79,7 @@ control RealMain( #include "actions_nat64_generic.p4" #include "actions_egress.p4" + #include "actions_delta_checksum.p4" action swap_eth_addresses() { @@ -126,6 +131,7 @@ control RealMain( if(nat64.apply().hit) { /* generic / static nat64 done */ if(hdr.icmp6.isValid()) { nat64_icmp6_generic(); + if(hdr.icmp6.type == ICMP6_ECHO_REPLY) { hdr.icmp.type = ICMP_ECHO_REPLY; hdr.icmp.code = 0; @@ -134,7 +140,24 @@ control RealMain( hdr.icmp.type = ICMP_ECHO_REQUEST; hdr.icmp.code = 0; } + if(hdr.udp.isValid()) { + #ifdef USE_NICO_DELTA_CHECKSUM + delta_udp_from_v6_to_v4(); + #else + meta.chk_udp_v4 = 1; + #endif + } + if(hdr.tcp.isValid()) { + #ifdef USE_NICO_DELTA_CHECKSUM + delta_tcp_from_v6_to_v4(); + #else + meta.chk_tcp_v4 = 1; + #endif + } + + v4_networks.apply(); /* apply egress for IPv4 */ + exit; /* no further v6 processing */ } } }