diff --git a/testdata/p4_16_samples/pna-ipv6-actions.p4 b/testdata/p4_16_samples/pna-ipv6-actions.p4 index b410edaf41..18214c5b1c 100644 --- a/testdata/p4_16_samples/pna-ipv6-actions.p4 +++ b/testdata/p4_16_samples/pna-ipv6-actions.p4 @@ -137,14 +137,24 @@ control MainControlImpl( headers.ipv6.dstAddr = headers.ipv6.dstAddr ^ tmp; } - action ipv6_addr_comp1() { - headers.ipv6.dstAddr = (headers.ipv6.dstAddr == headers.ipv6.srcAddr) ? headers.ipv6.dstAddr : headers.ipv6.srcAddr; + action ipv6_addr_xor2(bit<128> arg) { + headers.ipv6.dstAddr = arg; } - action ipv6_addr_comp2() { - headers.ipv6.dstAddr = (headers.ipv6.dstAddr != headers.ipv6.srcAddr) ? headers.ipv6.dstAddr : headers.ipv6.srcAddr; + action ipv6_modify_dstAddr2(bit<32> dstAddr) { + headers.ipv6.dstAddr = (bit<128>)dstAddr; + } + action ipv6_swap_addr2() { + headers.ipv6.dstAddr = headers.ipv6.srcAddr; + headers.ipv6.srcAddr = 128w0x123456789abcdef0AABBCCDDEEFF0011; } + action ipv6_addr_comp1() { + headers.ipv6.dstAddr = (headers.ipv6.dstAddr == headers.ipv6.srcAddr ? headers.ipv6.dstAddr : headers.ipv6.srcAddr); + } + action ipv6_addr_comp2() { + headers.ipv6.dstAddr = (headers.ipv6.dstAddr != headers.ipv6.srcAddr ? headers.ipv6.dstAddr : headers.ipv6.srcAddr); + } action ipv6_addr_cmpl() { headers.ipv6.dstAddr = ~headers.ipv6.srcAddr; } @@ -189,10 +199,13 @@ control MainControlImpl( ipv6_swap_addr; set_flowlabel; ipv6_addr_or; - ipv6_addr_or2; - ipv6_addr_xor; + ipv6_addr_or2; // + ipv6_addr_xor; // + ipv6_addr_xor2; // ipv6_addr_and; - ipv6_addr_and2; + ipv6_addr_and2; // + ipv6_modify_dstAddr2; // + ipv6_swap_addr2; // ipv6_addr_comp1; ipv6_addr_comp2; ipv6_addr_cmpl; diff --git a/testdata/p4_16_samples_outputs/pna-ipv6-actions-first.p4 b/testdata/p4_16_samples_outputs/pna-ipv6-actions-first.p4 index be069dbbd0..7aaecc0cf9 100644 --- a/testdata/p4_16_samples_outputs/pna-ipv6-actions-first.p4 +++ b/testdata/p4_16_samples_outputs/pna-ipv6-actions-first.p4 @@ -106,6 +106,16 @@ control MainControlImpl(inout headers_t headers, inout main_metadata_t meta, in action ipv6_addr_xor() { headers.ipv6.dstAddr = headers.ipv6.dstAddr ^ tmp; } + action ipv6_addr_xor2(bit<128> arg) { + headers.ipv6.dstAddr = arg; + } + action ipv6_modify_dstAddr2(bit<32> dstAddr) { + headers.ipv6.dstAddr = (bit<128>)dstAddr; + } + action ipv6_swap_addr2() { + headers.ipv6.dstAddr = headers.ipv6.srcAddr; + headers.ipv6.srcAddr = 128w0x123456789abcdef0aabbccddeeff0011; + } action ipv6_addr_comp1() { headers.ipv6.dstAddr = (headers.ipv6.dstAddr == headers.ipv6.srcAddr ? headers.ipv6.dstAddr : headers.ipv6.srcAddr); } @@ -150,8 +160,11 @@ control MainControlImpl(inout headers_t headers, inout main_metadata_t meta, in ipv6_addr_or(); ipv6_addr_or2(); ipv6_addr_xor(); + ipv6_addr_xor2(); ipv6_addr_and(); ipv6_addr_and2(); + ipv6_modify_dstAddr2(); + ipv6_swap_addr2(); ipv6_addr_comp1(); ipv6_addr_comp2(); ipv6_addr_cmpl(); diff --git a/testdata/p4_16_samples_outputs/pna-ipv6-actions-frontend.p4 b/testdata/p4_16_samples_outputs/pna-ipv6-actions-frontend.p4 index 3a4a0e73e7..ac0b003085 100644 --- a/testdata/p4_16_samples_outputs/pna-ipv6-actions-frontend.p4 +++ b/testdata/p4_16_samples_outputs/pna-ipv6-actions-frontend.p4 @@ -91,8 +91,8 @@ control MainControlImpl(inout headers_t headers, inout main_metadata_t meta, in @name("MainControlImpl.Reject") action Reject() { drop_packet(); } - @name("MainControlImpl.ipv6_modify_dstAddr") action ipv6_modify_dstAddr(@name("dstAddr") bit<32> dstAddr_1) { - headers.ipv6.dstAddr = (bit<128>)dstAddr_1; + @name("MainControlImpl.ipv6_modify_dstAddr") action ipv6_modify_dstAddr(@name("dstAddr") bit<32> dstAddr_2) { + headers.ipv6.dstAddr = (bit<128>)dstAddr_2; } @name("MainControlImpl.ipv6_addr_or") action ipv6_addr_or() { headers.ipv6.dstAddr = headers.ipv6.dstAddr | headers.ipv6.srcAddr; @@ -109,6 +109,16 @@ control MainControlImpl(inout headers_t headers, inout main_metadata_t meta, in @name("MainControlImpl.ipv6_addr_xor") action ipv6_addr_xor() { headers.ipv6.dstAddr = headers.ipv6.dstAddr ^ tmp; } + @name("MainControlImpl.ipv6_addr_xor2") action ipv6_addr_xor2(@name("arg") bit<128> arg) { + headers.ipv6.dstAddr = arg; + } + @name("MainControlImpl.ipv6_modify_dstAddr2") action ipv6_modify_dstAddr2(@name("dstAddr") bit<32> dstAddr_3) { + headers.ipv6.dstAddr = (bit<128>)dstAddr_3; + } + @name("MainControlImpl.ipv6_swap_addr2") action ipv6_swap_addr2() { + headers.ipv6.dstAddr = headers.ipv6.srcAddr; + headers.ipv6.srcAddr = 128w0x123456789abcdef0aabbccddeeff0011; + } @name("MainControlImpl.ipv6_addr_comp1") action ipv6_addr_comp1() { if (headers.ipv6.dstAddr == headers.ipv6.srcAddr) { tmp_0 = headers.ipv6.dstAddr; @@ -160,8 +170,11 @@ control MainControlImpl(inout headers_t headers, inout main_metadata_t meta, in ipv6_addr_or(); ipv6_addr_or2(); ipv6_addr_xor(); + ipv6_addr_xor2(); ipv6_addr_and(); ipv6_addr_and2(); + ipv6_modify_dstAddr2(); + ipv6_swap_addr2(); ipv6_addr_comp1(); ipv6_addr_comp2(); ipv6_addr_cmpl(); diff --git a/testdata/p4_16_samples_outputs/pna-ipv6-actions-midend.p4 b/testdata/p4_16_samples_outputs/pna-ipv6-actions-midend.p4 index 48f1f8346f..cb67611554 100644 --- a/testdata/p4_16_samples_outputs/pna-ipv6-actions-midend.p4 +++ b/testdata/p4_16_samples_outputs/pna-ipv6-actions-midend.p4 @@ -89,8 +89,8 @@ control MainControlImpl(inout headers_t headers, inout main_metadata_t meta, in @name("MainControlImpl.Reject") action Reject() { drop_packet(); } - @name("MainControlImpl.ipv6_modify_dstAddr") action ipv6_modify_dstAddr(@name("dstAddr") bit<32> dstAddr_1) { - headers.ipv6.dstAddr = (bit<128>)dstAddr_1; + @name("MainControlImpl.ipv6_modify_dstAddr") action ipv6_modify_dstAddr(@name("dstAddr") bit<32> dstAddr_2) { + headers.ipv6.dstAddr = (bit<128>)dstAddr_2; } @name("MainControlImpl.ipv6_addr_or") action ipv6_addr_or() { headers.ipv6.dstAddr = headers.ipv6.dstAddr | headers.ipv6.srcAddr; @@ -107,6 +107,16 @@ control MainControlImpl(inout headers_t headers, inout main_metadata_t meta, in @name("MainControlImpl.ipv6_addr_xor") action ipv6_addr_xor() { headers.ipv6.dstAddr = headers.ipv6.dstAddr ^ tmp; } + @name("MainControlImpl.ipv6_addr_xor2") action ipv6_addr_xor2(@name("arg") bit<128> arg) { + headers.ipv6.dstAddr = arg; + } + @name("MainControlImpl.ipv6_modify_dstAddr2") action ipv6_modify_dstAddr2(@name("dstAddr") bit<32> dstAddr_3) { + headers.ipv6.dstAddr = (bit<128>)dstAddr_3; + } + @name("MainControlImpl.ipv6_swap_addr2") action ipv6_swap_addr2() { + headers.ipv6.dstAddr = headers.ipv6.srcAddr; + headers.ipv6.srcAddr = 128w0x123456789abcdef0aabbccddeeff0011; + } @name("MainControlImpl.ipv6_addr_comp1") action ipv6_addr_comp1() { if (headers.ipv6.dstAddr == headers.ipv6.srcAddr) { tmp_0 = headers.ipv6.dstAddr; @@ -158,8 +168,11 @@ control MainControlImpl(inout headers_t headers, inout main_metadata_t meta, in ipv6_addr_or(); ipv6_addr_or2(); ipv6_addr_xor(); + ipv6_addr_xor2(); ipv6_addr_and(); ipv6_addr_and2(); + ipv6_modify_dstAddr2(); + ipv6_swap_addr2(); ipv6_addr_comp1(); ipv6_addr_comp2(); ipv6_addr_cmpl(); @@ -188,20 +201,20 @@ control MainControlImpl(inout headers_t headers, inout main_metadata_t meta, in } control MainDeparserImpl(packet_out packet, in headers_t headers, in main_metadata_t user_meta, in pna_main_output_metadata_t ostd) { - @hidden action pnaipv6actions220() { + @hidden action pnaipv6actions233() { packet.emit(headers.ethernet); packet.emit(headers.mpls); packet.emit(headers.ipv6); packet.emit(headers.ipv4); } - @hidden table tbl_pnaipv6actions220 { + @hidden table tbl_pnaipv6actions233 { actions = { - pnaipv6actions220(); + pnaipv6actions233(); } - const default_action = pnaipv6actions220(); + const default_action = pnaipv6actions233(); } apply { - tbl_pnaipv6actions220.apply(); + tbl_pnaipv6actions233.apply(); } } diff --git a/testdata/p4_16_samples_outputs/pna-ipv6-actions.p4 b/testdata/p4_16_samples_outputs/pna-ipv6-actions.p4 index 5cbab4418e..40bd434f82 100644 --- a/testdata/p4_16_samples_outputs/pna-ipv6-actions.p4 +++ b/testdata/p4_16_samples_outputs/pna-ipv6-actions.p4 @@ -106,19 +106,16 @@ control MainControlImpl(inout headers_t headers, inout main_metadata_t meta, in action ipv6_addr_xor() { headers.ipv6.dstAddr = headers.ipv6.dstAddr ^ tmp; } - action ipv6_addr_xor2(bit<128> arg) { headers.ipv6.dstAddr = arg; } - action ipv6_modify_dstAddr2(bit<32> dstAddr) { - headers.ipv6.dstAddr = (bit<128>)dstAddr; + headers.ipv6.dstAddr = (bit<128>)dstAddr; } action ipv6_swap_addr2() { - headers.ipv6.dstAddr = headers.ipv6.srcAddr; - headers.ipv6.srcAddr = 128w0x123456789abcdef0AABBCCDDEEFF0011; + headers.ipv6.dstAddr = headers.ipv6.srcAddr; + headers.ipv6.srcAddr = 128w0x123456789abcdef0aabbccddeeff0011; } - action ipv6_addr_comp1() { headers.ipv6.dstAddr = (headers.ipv6.dstAddr == headers.ipv6.srcAddr ? headers.ipv6.dstAddr : headers.ipv6.srcAddr); } @@ -132,7 +129,6 @@ control MainControlImpl(inout headers_t headers, inout main_metadata_t meta, in headers.ipv6.dstAddr = headers.ipv6.srcAddr; headers.ipv6.srcAddr = tmp; } - action set_flowlabel(bit<20> label) { headers.ipv6.flowLabel = label; } @@ -162,13 +158,13 @@ control MainControlImpl(inout headers_t headers, inout main_metadata_t meta, in ipv6_swap_addr; set_flowlabel; ipv6_addr_or; - ipv6_addr_or2; // - ipv6_addr_xor; // - ipv6_addr_xor2; // + ipv6_addr_or2; + ipv6_addr_xor; + ipv6_addr_xor2; ipv6_addr_and; - ipv6_addr_and2; // - ipv6_modify_dstAddr2; // - ipv6_swap_addr2; // + ipv6_addr_and2; + ipv6_modify_dstAddr2; + ipv6_swap_addr2; ipv6_addr_comp1; ipv6_addr_comp2; ipv6_addr_cmpl; diff --git a/testdata/p4_16_samples_outputs/pna-ipv6-actions.p4-error b/testdata/p4_16_samples_outputs/pna-ipv6-actions.p4-error index 07e906e59b..3aa4c5505c 100644 --- a/testdata/p4_16_samples_outputs/pna-ipv6-actions.p4-error +++ b/testdata/p4_16_samples_outputs/pna-ipv6-actions.p4-error @@ -1,3 +1,3 @@ -pna-ipv6-actions.p4(168): [--Wwarn=uninitialized_use] warning: tmp1 may be uninitialized +pna-ipv6-actions.p4(178): [--Wwarn=uninitialized_use] warning: tmp1 may be uninitialized headers.ipv6.srcAddr = (bit<128>)tmp1; ^^^^ diff --git a/testdata/p4_16_samples_outputs/pna-ipv6-actions.p4-stderr b/testdata/p4_16_samples_outputs/pna-ipv6-actions.p4-stderr index 07e906e59b..3aa4c5505c 100644 --- a/testdata/p4_16_samples_outputs/pna-ipv6-actions.p4-stderr +++ b/testdata/p4_16_samples_outputs/pna-ipv6-actions.p4-stderr @@ -1,3 +1,3 @@ -pna-ipv6-actions.p4(168): [--Wwarn=uninitialized_use] warning: tmp1 may be uninitialized +pna-ipv6-actions.p4(178): [--Wwarn=uninitialized_use] warning: tmp1 may be uninitialized headers.ipv6.srcAddr = (bit<128>)tmp1; ^^^^ diff --git a/testdata/p4_16_samples_outputs/pna-ipv6-actions.p4.bfrt.json b/testdata/p4_16_samples_outputs/pna-ipv6-actions.p4.bfrt.json index 5b7a6902ed..7b384fa9b7 100644 --- a/testdata/p4_16_samples_outputs/pna-ipv6-actions.p4.bfrt.json +++ b/testdata/p4_16_samples_outputs/pna-ipv6-actions.p4.bfrt.json @@ -92,6 +92,26 @@ "annotations" : [], "data" : [] }, + { + "id" : 32253890, + "name" : "MainControlImpl.ipv6_addr_xor2", + "action_scope" : "TableAndDefault", + "annotations" : [], + "data" : [ + { + "id" : 1, + "name" : "arg", + "repeated" : false, + "mandatory" : true, + "read_only" : false, + "annotations" : [], + "type" : { + "type" : "bytes", + "width" : 128 + } + } + ] + }, { "id" : 22390528, "name" : "MainControlImpl.ipv6_addr_and", @@ -106,6 +126,33 @@ "annotations" : [], "data" : [] }, + { + "id" : 26143176, + "name" : "MainControlImpl.ipv6_modify_dstAddr2", + "action_scope" : "TableAndDefault", + "annotations" : [], + "data" : [ + { + "id" : 1, + "name" : "dstAddr", + "repeated" : false, + "mandatory" : true, + "read_only" : false, + "annotations" : [], + "type" : { + "type" : "bytes", + "width" : 32 + } + } + ] + }, + { + "id" : 25482724, + "name" : "MainControlImpl.ipv6_swap_addr2", + "action_scope" : "TableAndDefault", + "annotations" : [], + "data" : [] + }, { "id" : 17555934, "name" : "MainControlImpl.ipv6_addr_comp1", diff --git a/testdata/p4_16_samples_outputs/pna-ipv6-actions.p4.spec b/testdata/p4_16_samples_outputs/pna-ipv6-actions.p4.spec index d4d633ec7e..85920feada 100644 --- a/testdata/p4_16_samples_outputs/pna-ipv6-actions.p4.spec +++ b/testdata/p4_16_samples_outputs/pna-ipv6-actions.p4.spec @@ -35,7 +35,8 @@ struct IPv6_h { struct dpdk_pseudo_header_t { bit<32> pseudo bit<32> pseudo_0 - bit<64> pseudo_1 + bit<32> pseudo_1 + bit<64> pseudo_2 } struct _p4c_tmp128_t { @@ -47,6 +48,14 @@ struct _p4c_sandbox_header_t { bit<64> lower_half } +struct ipv6_addr_xor2_arg_t { + bit<128> arg +} + +struct ipv6_modify_dstAddr2_arg_t { + bit<32> dstAddr +} + struct ipv6_modify_dstAddr_arg_t { bit<32> dstAddr } @@ -188,6 +197,26 @@ action ipv6_addr_xor args none { return } +action ipv6_addr_xor2 args instanceof ipv6_addr_xor2_arg_t { + mov h.ipv6.dstAddr t.arg + return +} + +action ipv6_modify_dstAddr2 args instanceof ipv6_modify_dstAddr2_arg_t { + mov h.dpdk_pseudo_header.pseudo_0 t.dstAddr + mov h.ipv6.dstAddr h.dpdk_pseudo_header.pseudo_0 + return +} + +action ipv6_swap_addr2 args none { + mov h.ipv6.dstAddr h.ipv6.srcAddr + mov h.srcAddr_128.upper_half 0x123456789ABCDEF0 + mov h.srcAddr_128.lower_half 0xAABBCCDDEEFF0011 + mov h.ipv6.srcAddr h.srcAddr_128.lower_half + movh h.ipv6.srcAddr h.srcAddr_128.upper_half + return +} + action ipv6_addr_comp1 args none { movh h.dstAddr_128.upper_half h.ipv6.dstAddr mov h.dstAddr_128.lower_half h.ipv6.dstAddr @@ -262,8 +291,8 @@ action set_traffic_class_flow_label args instanceof set_traffic_class_flow_label and m.MainControlT_tmp_8 0xFFFFF mov h.ipv6.version_trafficClass_flowLabel m.MainControlT_tmp_6 or h.ipv6.version_trafficClass_flowLabel m.MainControlT_tmp_8 - mov h.dpdk_pseudo_header.pseudo_0 m.MainControlT_tmp1 - mov h.ipv6.srcAddr h.dpdk_pseudo_header.pseudo_0 + mov h.dpdk_pseudo_header.pseudo_1 m.MainControlT_tmp1 + mov h.ipv6.srcAddr h.dpdk_pseudo_header.pseudo_1 return } @@ -300,8 +329,11 @@ table filter_tbl { ipv6_addr_or ipv6_addr_or2 ipv6_addr_xor + ipv6_addr_xor2 ipv6_addr_and ipv6_addr_and2 + ipv6_modify_dstAddr2 + ipv6_swap_addr2 ipv6_addr_comp1 ipv6_addr_comp2 ipv6_addr_cmpl @@ -328,8 +360,8 @@ apply { MAINPARSERIMPL_IPV4 : extract h.ipv4 jmp MAINPARSERIMPL_ACCEPT MAINPARSERIMPL_IPV6 : extract h.ipv6 - MAINPARSERIMPL_ACCEPT : mov h.dpdk_pseudo_header.pseudo_1 0x76 - mov m.MainControlT_tmp_13 h.dpdk_pseudo_header.pseudo_1 + MAINPARSERIMPL_ACCEPT : mov h.dpdk_pseudo_header.pseudo_2 0x76 + mov m.MainControlT_tmp_13 h.dpdk_pseudo_header.pseudo_2 table filter_tbl emit h.ethernet emit h.mpls