2019-02-21 22:19:17 +00:00
|
|
|
/* -*- P4_16 -*- */
|
|
|
|
#ifndef CHECKSUMS_P4
|
|
|
|
#define CHECKSUMS_P4
|
|
|
|
|
|
|
|
#include <core.p4>
|
|
|
|
#include <v1model.p4>
|
|
|
|
|
|
|
|
#include "headers.p4"
|
|
|
|
|
|
|
|
/*************************************************************************
|
|
|
|
************* C H E C K S U M V E R I F I C A T I O N *************
|
|
|
|
*************************************************************************/
|
|
|
|
|
|
|
|
control MyVerifyChecksum(inout headers hdr, inout metadata meta) {
|
|
|
|
apply {}
|
|
|
|
}
|
|
|
|
|
|
|
|
/*************************************************************************
|
|
|
|
************** C H E C K S U M C O M P U T A T I O N **************
|
|
|
|
*************************************************************************/
|
|
|
|
|
|
|
|
control MyComputeChecksum(inout headers hdr, inout metadata meta) {
|
|
|
|
apply {
|
2019-03-06 12:59:41 +00:00
|
|
|
// GRRRRR update_checksum_with_payload(meta.do_cksum,
|
|
|
|
// GRRRRR {
|
|
|
|
// GRRRRR hdr.ipv6.src_addr, /* 128 */
|
|
|
|
// GRRRRR hdr.ipv6.dst_addr, /* 128 */
|
|
|
|
// GRRRRR 16w0, /* 16 try implicit cast */
|
|
|
|
// GRRRRR hdr.ipv6.payload_length, /* 16 */
|
|
|
|
// GRRRRR 24w0, /* 24 0's */
|
|
|
|
// GRRRRR PROTO_ICMP6 /* 8 */
|
|
|
|
// GRRRRR },
|
|
|
|
// GRRRRR hdr.icmp6.checksum,
|
|
|
|
// GRRRRR HashAlgorithm.csum16
|
|
|
|
// GRRRRR );
|
2019-02-21 22:19:17 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#endif
|