From 36e374737ca732ec7c7860d2b97db8baabcbb9b1 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Wed, 24 Jul 2019 23:28:05 +0200 Subject: [PATCH] Really, really ugly hack to get the thing compile again REALLY ugly, but works. --- p4src/actions_delta_checksum.p4 | 17 +---------------- p4src/minip4_solution.p4 | 4 +++- 2 files changed, 4 insertions(+), 17 deletions(-) diff --git a/p4src/actions_delta_checksum.p4 b/p4src/actions_delta_checksum.p4 index 31a0261..8e2597c 100644 --- a/p4src/actions_delta_checksum.p4 +++ b/p4src/actions_delta_checksum.p4 @@ -68,23 +68,8 @@ action delta_udp_from_v4_to_v6() hdr.udp.checksum = (bit<16>) tmp; } -action delta_udp_from_v6_to_v4() -{ - delta_prepare(); +#define delta_udp_from_v6_to_v4 delta_prepare (); tmp17 = (bit<17>) hdr.udp.checksum + (bit<17>) meta.v4sum; if (tmp17[16:16] == 1) { tmp17 = tmp17 + 1; tmp17[16:16] = 0; } tmp17 = tmp17 + (bit<17>) (0xffff - meta.v6sum); if (tmp17[16:16] == 1) { tmp17 = tmp17 + 1; tmp17[16:16] = 0; } hdr.udp.checksum = (bit<16>) tmp17; - bit<17> tmp = (bit<17>) hdr.udp.checksum + (bit<17>) meta.v4sum; - if (tmp[16:16] == 1) { - tmp = tmp + 1; - tmp[16:16] = 0; - } - // tmp = tmp + (bit<17>) (0xffff - meta.v6sum); - // if (tmp[16:16] == 1) { - // tmp = tmp + 1; - // tmp[16:16] = 0; - // } - - hdr.udp.checksum = (bit<16>) tmp; -} action delta_tcp_from_v4_to_v6() { diff --git a/p4src/minip4_solution.p4 b/p4src/minip4_solution.p4 index 3ccbce3..5c3a16a 100644 --- a/p4src/minip4_solution.p4 +++ b/p4src/minip4_solution.p4 @@ -143,9 +143,11 @@ control RealMain( } if(hdr.udp.isValid()) { + bit<17> tmp17 = 0; //delta_prepare(); - delta_udp_from_v6_to_v4(); + //delta_udp_from_v6_to_v4(); //stupid(); + delta_udp_from_v6_to_v4 } // if(hdr.tcp.isValid()) { // #ifdef USE_NICO_DELTA_CHECKSUM