Browse Source

[netpfga] add all broken defines

master
Nico Schottelius 3 years ago
parent
commit
6003d240c6
  1. 33
      p4src/actions_delta_checksum.p4

33
p4src/actions_delta_checksum.p4

@ -50,29 +50,33 @@ action delta_prepare()
v6sum();
}
action delta_udp_from_v4_to_v6()
#ifdef _SUME_SWITCH_P4_
#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;
#define delta_tcp_from_v6_to_v4 delta_prepare (); tmp17 = (bit<17>) hdr.tcp.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.tcp.checksum = (bit<16>) tmp17;
#define delta_tcp_from_v4_to_v6 delta_prepare(); tmp17 = (bit<17>) hdr.tcp.checksum + (bit<17>) meta.v6sum; if (tmp17[16:16] == 1) { tmp17 = tmp17 + 1; tmp17[16:16] = 0; } tmp17 = tmp17 + (bit<17>) (0xffff - meta.v4sum); if (tmp17[16:16] == 1) { tmp17 = tmp17 + 1; tmp17[16:16] = 0; } hdr.tcp.checksum = (bit<16>) tmp17;
#define delta_udp_from_v4_to_v6 delta_prepare(); tmp17 = (bit<17>) hdr.udp.checksum + (bit<17>) meta.v6sum; if (tmp17[16:16] == 1) { tmp17 = tmp17 + 1; tmp17[16:16] = 0; } tmp17 = tmp17 + (bit<17>) (0xffff - meta.v4sum); if (tmp17[16:16] == 1) { tmp17 = tmp17 + 1; tmp17[16:16] = 0; } hdr.udp.checksum = (bit<16>) tmp17;
#else
action delta_tcp_from_v6_to_v4()
{
delta_prepare();
bit<17> tmp = (bit<17>) hdr.udp.checksum + (bit<17>) meta.v6sum;
bit<17> tmp = (bit<17>) hdr.tcp.checksum + (bit<17>) meta.v4sum;
if (tmp[16:16] == 1) {
tmp = tmp + 1;
tmp[16:16] = 0;
}
tmp = tmp + (bit<17>) (0xffff - meta.v4sum);
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;
hdr.tcp.checksum = (bit<16>) tmp;
}
#ifdef _SUME_SWITCH_P4_
#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;
#define delta_tcp_from_v6_to_v4 delta_prepare (); tmp17 = (bit<17>) hdr.tcp.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.tcp.checksum = (bit<16>) tmp17;
#else
action delta_udp_from_v6_to_v4()
{
delta_prepare();
@ -108,26 +112,27 @@ action delta_tcp_from_v4_to_v6()
hdr.tcp.checksum = (bit<16>) tmp;
}
#endif
action delta_tcp_from_v6_to_v4()
action delta_udp_from_v4_to_v6()
{
delta_prepare();
bit<17> tmp = (bit<17>) hdr.tcp.checksum + (bit<17>) meta.v4sum;
bit<17> tmp = (bit<17>) hdr.udp.checksum + (bit<17>) meta.v6sum;
if (tmp[16:16] == 1) {
tmp = tmp + 1;
tmp[16:16] = 0;
}
tmp = tmp + (bit<17>) (0xffff - meta.v6sum);
tmp = tmp + (bit<17>) (0xffff - meta.v4sum);
if (tmp[16:16] == 1) {
tmp = tmp + 1;
tmp[16:16] = 0;
}
hdr.tcp.checksum = (bit<16>) tmp;
hdr.udp.checksum = (bit<16>) tmp;
}
#endif
action delta_ipv4_from_v6_to_v4()
{
bit<16> tmp = 0;

Loading…
Cancel
Save