+notes; Try shifting the cast into the parser
This commit is contained in:
parent
0bd12260c6
commit
0ca0b94b1c
4 changed files with 22 additions and 7 deletions
|
|
@ -21,13 +21,11 @@ control MyVerifyChecksum(inout headers hdr, inout metadata meta) {
|
|||
|
||||
control MyComputeChecksum(inout headers hdr, inout metadata meta) {
|
||||
apply {
|
||||
bit<32> icmp6_len = (bit<32>) hdr.ipv6.payload_length;
|
||||
|
||||
update_checksum_with_payload(meta.calc_icmp6_checksum,
|
||||
{
|
||||
hdr.ipv6.src_addr, /* 128 */
|
||||
hdr.ipv6.dst_addr, /* 128 */
|
||||
icmp6_len, /* 32 */
|
||||
meta.cast_length, /* 32 */
|
||||
24w0, /* 24 0's */
|
||||
PROTO_ICMP6 /* 8 */
|
||||
},
|
||||
|
|
|
|||
|
|
@ -133,6 +133,7 @@ struct metadata {
|
|||
port_t ingress_port;
|
||||
task_t task;
|
||||
bit<16> tcp_length;
|
||||
bit<32> cast_length;
|
||||
bool calc_icmp6_checksum;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -37,6 +37,7 @@ parser MyParser(packet_in packet,
|
|||
state ipv6 {
|
||||
packet.extract(hdr.ipv6);
|
||||
meta.tcp_length = hdr.ipv6.payload_length;
|
||||
meta.cast_length = (<bit32>) hdr.ipv6.payload_length;
|
||||
|
||||
transition select(hdr.ipv6.next_header){
|
||||
PROTO_TCP: tcp;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue