Skip to content

Commit

Permalink
Issues in test case and its output files are corrected.
Browse files Browse the repository at this point in the history
Signed-off-by: Maheswari Subramanian <[email protected]>
  • Loading branch information
maheswari-s committed Dec 18, 2024
1 parent 2d4d3db commit dac8c5c
Show file tree
Hide file tree
Showing 9 changed files with 163 additions and 36 deletions.
27 changes: 20 additions & 7 deletions testdata/p4_16_samples/pna-ipv6-actions.p4
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down Expand Up @@ -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;
Expand Down
13 changes: 13 additions & 0 deletions testdata/p4_16_samples_outputs/pna-ipv6-actions-first.p4
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down Expand Up @@ -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();
Expand Down
17 changes: 15 additions & 2 deletions testdata/p4_16_samples_outputs/pna-ipv6-actions-frontend.p4
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand Down Expand Up @@ -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();
Expand Down
27 changes: 20 additions & 7 deletions testdata/p4_16_samples_outputs/pna-ipv6-actions-midend.p4
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand Down Expand Up @@ -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();
Expand Down Expand Up @@ -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<Ethernet_h>(headers.ethernet);
packet.emit<mpls_h>(headers.mpls);
packet.emit<IPv6_h>(headers.ipv6);
packet.emit<IPv4_h>(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();
}
}

Expand Down
22 changes: 9 additions & 13 deletions testdata/p4_16_samples_outputs/pna-ipv6-actions.p4
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand All @@ -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;
}
Expand Down Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion testdata/p4_16_samples_outputs/pna-ipv6-actions.p4-error
Original file line number Diff line number Diff line change
@@ -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;
^^^^
2 changes: 1 addition & 1 deletion testdata/p4_16_samples_outputs/pna-ipv6-actions.p4-stderr
Original file line number Diff line number Diff line change
@@ -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;
^^^^
47 changes: 47 additions & 0 deletions testdata/p4_16_samples_outputs/pna-ipv6-actions.p4.bfrt.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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",
Expand Down
42 changes: 37 additions & 5 deletions testdata/p4_16_samples_outputs/pna-ipv6-actions.p4.spec
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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
}
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
}

Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down

0 comments on commit dac8c5c

Please sign in to comment.