Try fixing shift errors (precendence!)

This commit is contained in:
Nico Schottelius 2019-07-21 10:48:35 +02:00
parent dda1aa9c3c
commit 266ab1d036
2 changed files with 20 additions and 5 deletions

View file

@ -5673,6 +5673,21 @@ TCP6:[2001:db8:1::a00:1]:2343"; sleep 2; done
Result: no reply, but translated packets seen on h3; wrong IPv4 Result: no reply, but translated packets seen on h3; wrong IPv4
checksum; tcp checksum is ok checksum; tcp checksum is ok
-> doing manual calculation to see where diff comes from -> doing manual calculation to see where diff comes from
*** TODO Shifting / compile errors
#+BEGIN_CENTER
p4c --target bmv2 --arch v1model --std p4-16 "../p4src/checksum_diff.p4" -o "/home/p4/master-thesis/p4src"
../p4src/actions_delta_checksum.p4(135): warning: <<: Shifting 16-bit value with 17
shift_tmp = ((bit<16>) hdr.ipv4.version) << 12 +
^
../p4src/actions_delta_checksum.p4(135): warning: 524288: value does not fit in 16 bits
shift_tmp = ((bit<16>) hdr.ipv4.version) << 12 +
^
../p4src/actions_delta_checksum.p4(158): error: <<: shift amount limited to 8 bits on this target
shift_tmp = ((bit<16>) hdr.ipv4.ttl) << 8 +
^
Compilation Error
#+END_CENTER
** The NetPFGA saga ** The NetPFGA saga
Problems encountered: Problems encountered:
- The logfile for a compile run is 10k+ lines - The logfile for a compile run is 10k+ lines

View file

@ -132,9 +132,9 @@ action delta_ipv4_from_v6_to_v4()
Does NOT contain payload! -> can be done manually */ Does NOT contain payload! -> can be done manually */
shift_tmp = ((bit<16>) hdr.ipv4.version) << 12 + shift_tmp = (bit<16>) (hdr.ipv4.version << 12) +
((bit<16>) hdr.ipv4.ihl) << 8 + (bit<16>) (hdr.ipv4.ihl << 8) +
((bit<16>) hdr.ipv4.diff_serv) << 2 + (bit<16>) (hdr.ipv4.diff_serv << 2) +
((bit<16>) hdr.ipv4.ecn); ((bit<16>) hdr.ipv4.ecn);
tmp = tmp + shift_tmp; tmp = tmp + shift_tmp;
@ -148,14 +148,14 @@ action delta_ipv4_from_v6_to_v4()
tmp = tmp + (bit<16>) hdr.ipv4.identification; /* 16 bit */ tmp = tmp + (bit<16>) hdr.ipv4.identification; /* 16 bit */
shift_tmp = ((bit<16>) hdr.ipv4.flags) << 13 + shift_tmp = ((bit<16>) (hdr.ipv4.flags) << 13) +
((bit<16>) hdr.ipv4.fragOffset); ((bit<16>) hdr.ipv4.fragOffset);
tmp = tmp + shift_tmp; tmp = tmp + shift_tmp;
// tmp = tmp + (bit<16>) hdr.ipv4.flags; /* 3 bit */ // tmp = tmp + (bit<16>) hdr.ipv4.flags; /* 3 bit */
// tmp = tmp + (bit<16>) hdr.ipv4.fragOffset; /* 13 bit */ // tmp = tmp + (bit<16>) hdr.ipv4.fragOffset; /* 13 bit */
shift_tmp = ((bit<16>) hdr.ipv4.ttl) << 8 + shift_tmp = ((bit<16>) (hdr.ipv4.ttl) << 8) +
((bit<16>) hdr.ipv4.protocol); ((bit<16>) hdr.ipv4.protocol);
tmp = tmp + shift_tmp; tmp = tmp + shift_tmp;