update P4D2 and SIGCOMM2017 examples for new checksum API (#56)

This commit is contained in:
Han Wang
2017-10-07 11:25:24 -07:00
committed by GitHub
parent ef64a2cfd8
commit 28a8414c58
24 changed files with 53 additions and 61 deletions

View File

@@ -138,7 +138,7 @@ inout standard_metadata_t standard_metadata) {
************ C H E C K S U M V E R I F I C A T I O N *************
*************************************************************************/
control verifyChecksum(in headers hdr, inout metadata meta) {
control verifyChecksum(inout headers hdr, inout metadata meta) {
apply { }
}
@@ -228,13 +228,9 @@ control computeChecksum(
inout headers hdr,
inout metadata meta)
{
Checksum16() ipv4_checksum;
apply {
if (hdr.ipv4.isValid()) {
hdr.ipv4.hdrChecksum = ipv4_checksum.get(
{
hdr.ipv4.version,
update_checksum(true,
{ hdr.ipv4.version,
hdr.ipv4.ihl,
hdr.ipv4.diffserv,
hdr.ipv4.totalLen,
@@ -245,8 +241,8 @@ inout metadata meta)
hdr.ipv4.protocol,
hdr.ipv4.srcAddr,
hdr.ipv4.dstAddr
});
}
},
hdr.ipv4.hdrChecksum, HashAlgorithm.csum16);
}
}