diff --git a/backends/dpdk/DpdkXfail.cmake b/backends/dpdk/DpdkXfail.cmake index f6aab99a0e0..f0d1e97b487 100644 --- a/backends/dpdk/DpdkXfail.cmake +++ b/backends/dpdk/DpdkXfail.cmake @@ -1,3 +1,38 @@ +p4c_add_xfail_reason("dpdk" + "Unhandled type for varbit<32> Ingress_s" + testdata/p4_16_samples/psa-dpdk-issue447-5.p4 + ) + + p4c_add_xfail_reason("dpdk" + "Field local_metadata_ipv4_lkp_ipv4_sa is not a member of structure struct M" + testdata/p4_16_samples/psa-dpdk-hash.p4 + ) + + p4c_add_xfail_reason("dpdk" + "ostd: declaration not found" + testdata/p4_16_samples/psa-dpdk-issue1660.p4 + ) + + p4c_add_xfail_reason("dpdk" + "not implemented" + testdata/p4_16_samples/psa-dpdk-issue1630.p4 + ) + + p4c_add_xfail_reason("dpdk" + "Error compiling" + testdata/p4_16_samples/psa-dpdk-issue2314.p4 +) + + p4c_add_xfail_reason("dpdk" + "Error compiling" + testdata/p4_16_samples/psa-dpdk-pred.p4 +) + +p4c_add_xfail_reason("dpdk" +"Error compiling" +testdata/p4_16_samples/psa-dpdk-issue1653-complex.p4 +) + p4c_add_xfail_reason("dpdk" "Expected packet length argument for count method of indirect counter" testdata/p4_16_samples/psa-example-counters-bmv2.p4 diff --git a/testdata/p4_16_samples/arith-inline-skeleton-d.p4 b/testdata/p4_16_samples/arith-inline-skeleton-d.p4 new file mode 100644 index 00000000000..da722bed379 --- /dev/null +++ b/testdata/p4_16_samples/arith-inline-skeleton-d.p4 @@ -0,0 +1,100 @@ +/* +Copyright 2013-present Barefoot Networks, Inc. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// P4 program fragment - used by the arith-* compiler tests +// This fragment expects a two definitions: +// - a header hdr +// - a control compute(inout hdr h) + +// This is false if the P4 core library has not been included +#ifdef _CORE_P4_ + +struct Headers { + hdr h; +} + +struct Meta {} + +parser p(packet_in b, out Headers h, inout Meta m, in psa_ingress_parser_input_metadata_t x, + in EMPTY_RESUB resub_meta, + in EMPTY_RECIRC recirc_meta) { + state start { + b.extract(h.h); + transition accept; + } +} + +parser egressParserImpl( + packet_in buffer, + out EMPTY_H a, + inout Meta b, + in psa_egress_parser_input_metadata_t c, + in EMPTY_BRIDGE d, + in EMPTY_CLONE e, + in EMPTY_CLONE f) { + state start { + transition accept; + } +} + +control ingress(inout Headers h, inout Meta m, in psa_ingress_input_metadata_t istd, + inout psa_ingress_output_metadata_t ostd) { + compute() c; + apply { + c.apply(h.h); + ostd.egress_port = (PortId_t)(PortIdUint_t)0; + } +} + +control egressControlImpl( + inout EMPTY_H h, + inout Meta meta, + in psa_egress_input_metadata_t x, + inout psa_egress_output_metadata_t ostd) +{ + apply { } +} + +control deparser(packet_out b, out EMPTY_CLONE clone_i2e_meta, + out EMPTY_RESUB resubmit_meta, + out EMPTY_BRIDGE normal_meta, + inout Headers h, + in Meta local_metadata, + in psa_ingress_output_metadata_t istd) { + apply { b.emit(h.h); } +} + +control egressDeparserImpl( + packet_out buffer, + out EMPTY_CLONE a, + out EMPTY_RECIRC b, + inout EMPTY_H c, + in Meta d, + in psa_egress_output_metadata_t e, + in psa_egress_deparser_input_metadata_t f) { + apply { } +} + +IngressPipeline(p(), ingress(), deparser()) ip; +EgressPipeline(egressParserImpl(), egressControlImpl(), egressDeparserImpl()) ep; + +PSA_Switch( + ip, + PacketReplicationEngine(), + ep, + BufferingQueueingEngine()) main; + +#endif \ No newline at end of file diff --git a/testdata/p4_16_samples/arith-skeleton-d.p4 b/testdata/p4_16_samples/arith-skeleton-d.p4 new file mode 100644 index 00000000000..678118e6cf6 --- /dev/null +++ b/testdata/p4_16_samples/arith-skeleton-d.p4 @@ -0,0 +1,72 @@ +/* +Copyright 2013-present Barefoot Networks, Inc. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// P4 program fragment - used by the arith-* compiler tests + +// This is false if the P4 core library has not been included +#ifdef _CORE_P4_ + +struct Headers { + hdr h; +} + +struct Meta {} + +parser p(packet_in b, out Headers h, inout Meta m, in psa_ingress_parser_input_metadata_t x, + in EMPTY_RESUB resub_meta, + in EMPTY_RECIRC recirc_meta) { + state start { + b.extract(h.h); + transition accept; + } +} + +parser egressParserImpl( + packet_in buffer, + out EMPTY_H a, + inout Meta b, + in psa_egress_parser_input_metadata_t c, + in EMPTY_BRIDGE d, + in EMPTY_CLONE e, + in EMPTY_CLONE f) { + state start { + transition accept; + } +} + +control deparser(packet_out b, out EMPTY_CLONE clone_i2e_meta, + out EMPTY_RESUB resubmit_meta, + out EMPTY_BRIDGE normal_meta, + inout Headers h, + in Meta local_metadata, + in psa_ingress_output_metadata_t istd ) { + apply { b.emit(h.h); } +} + +control egressDeparserImpl( + packet_out buffer, + out EMPTY_CLONE a, + out EMPTY_RECIRC b, + inout EMPTY_H c, + in Meta d, + in psa_egress_output_metadata_t e, + in psa_egress_deparser_input_metadata_t f) { + apply { } +} + + + +#endif \ No newline at end of file diff --git a/testdata/p4_16_samples/p4-dpdk-multicast.p4 b/testdata/p4_16_samples/p4-dpdk-multicast.p4 new file mode 100644 index 00000000000..c5462cd7813 --- /dev/null +++ b/testdata/p4_16_samples/p4-dpdk-multicast.p4 @@ -0,0 +1,179 @@ +#include +#include + +header EMPTY_H {}; +struct EMPTY_RESUB {}; +struct EMPTY_CLONE {}; +struct EMPTY_BRIDGE {}; +struct EMPTY_RECIRC {}; + + +struct routing_metadata_t { + bit<32> nhop_ipv4; +} + +header ethernet_t { + bit<48> dstAddr; + bit<48> srcAddr; + bit<16> etherType; +} + +header ipv4_t { + bit<4> version; + bit<4> ihl; + bit<8> diffserv; + bit<16> totalLen; + bit<16> identification; + bit<3> flags; + bit<13> fragOffset; + bit<8> ttl; + bit<8> protocol; + bit<16> hdrChecksum; + bit<32> srcAddr; + bit<32> dstAddr; +} + +struct metadata { + @name("routing_metadata") + routing_metadata_t routing_metadata; +} + +struct headers { + @name("ethernet") + ethernet_t ethernet; + @name("ipv4") + ipv4_t ipv4; +} + +parser ParserImpl(packet_in packet, out headers hdr, inout metadata meta, in psa_ingress_parser_input_metadata_t x, + in EMPTY_RESUB resub_meta, + in EMPTY_RECIRC recirc_meta) { + @name("parse_ethernet") state parse_ethernet { + packet.extract(hdr.ethernet); + transition select(hdr.ethernet.etherType) { + 16w0x800: parse_ipv4; + default: accept; + } + } + @name("parse_ipv4") state parse_ipv4 { + packet.extract(hdr.ipv4); + transition accept; + } + @name("start") state start { + transition parse_ethernet; + } +} + +parser egressParserImpl( + packet_in buffer, + out EMPTY_H a, + inout metadata b, + in psa_egress_parser_input_metadata_t c, + in EMPTY_BRIDGE d, + in EMPTY_CLONE e, + in EMPTY_CLONE f) { + state start { + transition accept; + } +} + + + +control ingress(inout headers hdr, inout metadata meta, in psa_ingress_input_metadata_t istd, + inout psa_ingress_output_metadata_t ostd) { + @name(".bcast") action bcast() { + ostd.multicast_group = (MulticastGroup_t)(MulticastGroupUint_t)1; + } + @name(".set_dmac") action set_dmac(bit<48> dmac) { + hdr.ethernet.dstAddr = dmac; + } + @name("._drop") action _drop() { + ingress_drop(ostd); + } + @name(".set_nhop") action set_nhop(bit<32> nhop_ipv4, bit<9> port) { + meta.routing_metadata.nhop_ipv4 = nhop_ipv4; + ostd.egress_port = (PortId_t)(PortIdUint_t)port; + hdr.ipv4.ttl = hdr.ipv4.ttl + 8w255; + } + @name(".set_nhop_redirect") action set_nhop_redirect(bit<32> nhop_ipv4, bit<9> port) { + meta.routing_metadata.nhop_ipv4 = nhop_ipv4; + ostd.egress_port = (PortId_t)(PortIdUint_t)port; + hdr.ipv4.ttl = hdr.ipv4.ttl + 8w255; + } + @name("broadcast") table broadcast { + actions = { + bcast; + } + size = 1; + } + @name("forward") table forward { + actions = { + set_dmac; + _drop; + } + key = { + meta.routing_metadata.nhop_ipv4: exact; + } + size = 512; + } + @name("ipv4_lpm") table ipv4_lpm { + actions = { + set_nhop; + _drop; + } + key = { + hdr.ipv4.dstAddr: lpm; + } + size = 1024; + } + apply { + if (hdr.ipv4.isValid()) { + ipv4_lpm.apply(); + forward.apply(); + } + else { + broadcast.apply(); + } + } +} + +control egressControlImpl( + inout EMPTY_H hdr, + inout metadata meta, + in psa_egress_input_metadata_t x, + inout psa_egress_output_metadata_t ostd) +{ + apply { } +} + +control DeparserImpl(packet_out packet, out EMPTY_CLONE clone_i2e_meta, + out EMPTY_RESUB resubmit_meta, + out EMPTY_BRIDGE normal_meta, + inout headers hdr, + in metadata local_metadata, + in psa_ingress_output_metadata_t istd ) { + apply { + packet.emit(hdr.ethernet); + packet.emit(hdr.ipv4); + } +} + +control egressDeparserImpl( + packet_out buffer, + out EMPTY_CLONE a, + out EMPTY_RECIRC b, + inout EMPTY_H c, + in metadata d, + in psa_egress_output_metadata_t e, + in psa_egress_deparser_input_metadata_t f) { + apply { } +} + +IngressPipeline(ParserImpl(), ingress(), DeparserImpl()) ip; +EgressPipeline(egressParserImpl(), egressControlImpl(), egressDeparserImpl()) ep; + +PSA_Switch( + ip, + PacketReplicationEngine(), + ep, + BufferingQueueingEngine()) main; diff --git a/testdata/p4_16_samples/psa-dpdk-arith.p4 b/testdata/p4_16_samples/psa-dpdk-arith.p4 new file mode 100644 index 00000000000..6c8d678c9a4 --- /dev/null +++ b/testdata/p4_16_samples/psa-dpdk-arith.p4 @@ -0,0 +1,63 @@ +/* +Copyright 2013-present Barefoot Networks, Inc. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +#include +#include + +header EMPTY_H {}; +struct EMPTY_RESUB {}; +struct EMPTY_CLONE {}; +struct EMPTY_BRIDGE {}; +struct EMPTY_RECIRC {}; + +header hdr { + bit<32> a; + bit<32> b; + bit<64> c; +} + +#include "arith-skeleton-d.p4" + +control ingress(inout Headers h, inout Meta m, in psa_ingress_input_metadata_t istd, + inout psa_ingress_output_metadata_t ostd) { + action add() + { h.h.c = (bit<64>)(h.h.a + h.h.b); ostd.egress_port = (PortId_t)(PortIdUint_t)0; } + table t { + actions = { add; } + const default_action = add; + } + apply { t.apply(); } +} + +control egressControlImpl( + inout EMPTY_H h, + inout Meta meta, + in psa_egress_input_metadata_t x, + inout psa_egress_output_metadata_t ostd) +{ + apply { } +} + +IngressPipeline(p(), ingress(), deparser()) ip; +EgressPipeline(egressParserImpl(), egressControlImpl(), egressDeparserImpl()) ep; + +PSA_Switch( + ip, + PacketReplicationEngine(), + ep, + BufferingQueueingEngine()) main; + + diff --git a/testdata/p4_16_samples/psa-dpdk-bvec_union.p4 b/testdata/p4_16_samples/psa-dpdk-bvec_union.p4 new file mode 100644 index 00000000000..af59209590a --- /dev/null +++ b/testdata/p4_16_samples/psa-dpdk-bvec_union.p4 @@ -0,0 +1,144 @@ +/* +Copyright 2018 MNK Consulting LLC. +http://mnkcg.com + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +#include +#include + +header EMPTY_H {}; +struct EMPTY_RESUB {}; +struct EMPTY_CLONE {}; +struct EMPTY_BRIDGE {}; +struct EMPTY_RECIRC {}; + +struct alt_t { + bit<1> valid; + bit<7> port; +}; + +struct row_t { + alt_t alt0; + alt_t alt1; +}; + +header Hdr1 { + bit<8> a; + row_t row0; + row_t row1; +} + +header Hdr2 { + bit<16> b; + row_t row; +} + +header_union U { + Hdr1 h1; + Hdr2 h2; +} + +struct Headers { + Hdr1 h1; + U u; +} + +struct Meta {} + +parser p(packet_in b, out Headers h, inout Meta m, in psa_ingress_parser_input_metadata_t x, + in EMPTY_RESUB resub_meta, + in EMPTY_RECIRC recirc_meta) { + state start { + b.extract(h.h1); + transition select(h.h1.a) { + 0: getH1; + default: getH2; + } + } + + state getH1 { + b.extract(h.u.h1); + transition accept; + } + + state getH2 { + b.extract(h.u.h2); + transition accept; + } +} + +parser egressParserImpl( + packet_in buffer, + out EMPTY_H a, + inout Meta b, + in psa_egress_parser_input_metadata_t c, + in EMPTY_BRIDGE d, + in EMPTY_CLONE e, + in EMPTY_CLONE f) { + state start { + transition accept; + } +} + + + +control ingress(inout Headers h, inout Meta m, in psa_ingress_input_metadata_t istd, + inout psa_ingress_output_metadata_t ostd) { + apply { + if (h.u.h2.isValid()) + h.u.h2.setInvalid(); + } +} + +control egressControlImpl( + inout EMPTY_H hdr, + inout Meta meta, + in psa_egress_input_metadata_t x, + inout psa_egress_output_metadata_t ostd) +{ + apply { } +} + + +control deparser(packet_out b, out EMPTY_CLONE clone_i2e_meta, + out EMPTY_RESUB resubmit_meta, + out EMPTY_BRIDGE normal_meta, + inout Headers h, + in Meta local_metadata, + in psa_ingress_output_metadata_t istd) { + apply { + b.emit(h.h1); + b.emit(h.u); + } +} + +control egressDeparserImpl( + packet_out buffer, + out EMPTY_CLONE a, + out EMPTY_RECIRC b, + inout EMPTY_H c, + in Meta d, + in psa_egress_output_metadata_t e, + in psa_egress_deparser_input_metadata_t f) { + apply { } +} +IngressPipeline(p(), ingress(), deparser()) ip; +EgressPipeline(egressParserImpl(), egressControlImpl(), egressDeparserImpl()) ep; + +PSA_Switch( + ip, + PacketReplicationEngine(), + ep, + BufferingQueueingEngine()) main; diff --git a/testdata/p4_16_samples/psa-dpdk-control-hs-index-test2.p4 b/testdata/p4_16_samples/psa-dpdk-control-hs-index-test2.p4 new file mode 100644 index 00000000000..0c997dd1174 --- /dev/null +++ b/testdata/p4_16_samples/psa-dpdk-control-hs-index-test2.p4 @@ -0,0 +1,117 @@ +#include +#include + +header EMPTY_H {}; +struct EMPTY_RESUB {}; +struct EMPTY_CLONE {}; +struct EMPTY_BRIDGE {}; +struct EMPTY_RECIRC {}; + + +header ethernet_t { + bit<48> dst_addr; + bit<48> src_addr; + bit<16> eth_type; +} + +header h_index { + bit<32> index; +} + +header h_stack { + bit<32> a; +} + +struct headers { + ethernet_t eth_hdr; + h_stack[3] h; + h_index i; +} + +struct Meta { +} + +parser p(packet_in pkt, out headers hdr, inout Meta m, in psa_ingress_parser_input_metadata_t x, + in EMPTY_RESUB resub_meta, + in EMPTY_RECIRC recirc_meta) { + state start { + transition parse_hdrs; + } + state parse_hdrs { + pkt.extract(hdr.eth_hdr); + pkt.extract(hdr.h[0]); + pkt.extract(hdr.h[1]); + pkt.extract(hdr.h[2]); + pkt.extract(hdr.i); + transition accept; + } +} + +parser egressParserImpl( + packet_in buffer, + out EMPTY_H a, + inout Meta b, + in psa_egress_parser_input_metadata_t c, + in EMPTY_BRIDGE d, + in EMPTY_CLONE e, + in EMPTY_CLONE f) { + state start { + transition accept; + } +} + +control ingress(inout headers h, inout Meta m,in psa_ingress_input_metadata_t istd, + inout psa_ingress_output_metadata_t ostd) { + apply { + if (h.h[h.i.index + 1].a > 10) { + h.h[h.i.index + 1].a = 1; + } + } +} + + + +control egressControlImpl( + inout EMPTY_H hdr, + inout Meta meta, + in psa_egress_input_metadata_t x, + inout psa_egress_output_metadata_t ostd) +{ + apply { } +} + + +control deparser(packet_out pkt, out EMPTY_CLONE clone_i2e_meta, + out EMPTY_RESUB resubmit_meta, + out EMPTY_BRIDGE normal_meta, + inout headers h, + in Meta local_metadata, + in psa_ingress_output_metadata_t istd) { + apply { + pkt.emit(h.eth_hdr); + pkt.emit(h.h[0]); + pkt.emit(h.h[1]); + pkt.emit(h.h[2]); + pkt.emit(h.i); + } +} + +control egressDeparserImpl( + packet_out buffer, + out EMPTY_CLONE a, + out EMPTY_RECIRC b, + inout EMPTY_H c, + in Meta d, + in psa_egress_output_metadata_t e, + in psa_egress_deparser_input_metadata_t f) { + apply { } +} + +IngressPipeline(p(), ingress(), deparser()) ip; +EgressPipeline(egressParserImpl(), egressControlImpl(), egressDeparserImpl()) ep; + +PSA_Switch( + ip, + PacketReplicationEngine(), + ep, + BufferingQueueingEngine()) main; diff --git a/testdata/p4_16_samples/psa-dpdk-default_action.p4 b/testdata/p4_16_samples/psa-dpdk-default_action.p4 new file mode 100644 index 00000000000..295b1856f9a --- /dev/null +++ b/testdata/p4_16_samples/psa-dpdk-default_action.p4 @@ -0,0 +1,41 @@ +/* +Copyright 2013-present Barefoot Networks, Inc. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +#include +#include + +header EMPTY_H {}; +struct EMPTY_RESUB {}; +struct EMPTY_CLONE {}; +struct EMPTY_BRIDGE {}; +struct EMPTY_RECIRC {}; + +header hdr { + bit<32> a; + bit<32> b; +} + +control compute(inout hdr h) { + action add(bit<32> data) + { h.b = h.a + data; } + table t { + actions = { add; } + const default_action = add(10); + } + apply { t.apply(); } +} + +#include "arith-inline-skeleton-d.p4" diff --git a/testdata/p4_16_samples/psa-dpdk-free-form-annotation.p4 b/testdata/p4_16_samples/psa-dpdk-free-form-annotation.p4 new file mode 100644 index 00000000000..17015f1e903 --- /dev/null +++ b/testdata/p4_16_samples/psa-dpdk-free-form-annotation.p4 @@ -0,0 +1,114 @@ +/* +Copyright 2013-present Barefoot Networks, Inc. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +#include +#include + +header EMPTY_H {}; +struct EMPTY_RESUB {}; +struct EMPTY_CLONE {}; +struct EMPTY_BRIDGE {}; +struct EMPTY_RECIRC {}; + +// Test free-form annotations. +@scrabble( + - What do you get if you multiply six by nine? + - Six by nine. Forty two. + - That's it. That's all there is. + - I always thought there was something fundamentally wrong with the + universe. + 0xdeadbeef +) +header hdr { + bit<112> field; +} + +struct Header_t { + hdr h; +} + +struct Meta_t {} + +parser p(packet_in b, + out Header_t h, + inout Meta_t m, + in psa_ingress_parser_input_metadata_t x, + in EMPTY_RESUB resub_meta, + in EMPTY_RECIRC recirc_meta) { + state start { + transition accept; + } +} + +parser egressParserImpl( + packet_in buffer, + out EMPTY_H a, + inout Meta_t b, + in psa_egress_parser_input_metadata_t c, + in EMPTY_BRIDGE d, + in EMPTY_CLONE e, + in EMPTY_CLONE f) { + state start { + transition accept; + } +} + +control c(inout Header_t h, inout Meta_t m) { apply {} } + +control ingress(inout Header_t h, + inout Meta_t m, + in psa_ingress_input_metadata_t istd, + inout psa_ingress_output_metadata_t ostd) { + apply {} +} + +control egressControlImpl( + inout EMPTY_H h, + inout Meta_t meta, + in psa_egress_input_metadata_t x, + inout psa_egress_output_metadata_t ostd) +{ + apply { } +} + + +control deparser(packet_out b,out EMPTY_CLONE clone_i2e_meta, + out EMPTY_RESUB resubmit_meta, + out EMPTY_BRIDGE normal_meta, + inout Header_t h, + in Meta_t local_metadata, + in psa_ingress_output_metadata_t istd) { apply {} } + +control egressDeparserImpl( + packet_out buffer, + out EMPTY_CLONE a, + out EMPTY_RECIRC b, + inout EMPTY_H c1, + in Meta_t d, + in psa_egress_output_metadata_t e, + in psa_egress_deparser_input_metadata_t f) { + apply { } +} + +IngressPipeline(p(), ingress(), deparser()) ip; +EgressPipeline(egressParserImpl(), egressControlImpl(), egressDeparserImpl()) ep; + +PSA_Switch( + ip, + PacketReplicationEngine(), + ep, + BufferingQueueingEngine()) main; + diff --git a/testdata/p4_16_samples/psa-dpdk-gauntlet_arithref_cast.p4 b/testdata/p4_16_samples/psa-dpdk-gauntlet_arithref_cast.p4 new file mode 100644 index 00000000000..dfb33527e8c --- /dev/null +++ b/testdata/p4_16_samples/psa-dpdk-gauntlet_arithref_cast.p4 @@ -0,0 +1,97 @@ +#include +#include + +header EMPTY_H {}; +struct EMPTY_RESUB {}; +struct EMPTY_CLONE {}; +struct EMPTY_BRIDGE {}; +struct EMPTY_RECIRC {}; + +header ethernet_t { + bit<48> dst_addr; + bit<48> src_addr; + bit<16> eth_type; +} + +struct Headers { + ethernet_t eth_hdr; +} + +struct Meta {} + +bit<8> do_thing() { + return 8w2; +} + +parser p(packet_in pkt, out Headers hdr, inout Meta m, in psa_ingress_parser_input_metadata_t x, + in EMPTY_RESUB resub_meta, + in EMPTY_RECIRC recirc_meta) { + state start { + pkt.extract(hdr.eth_hdr); + transition accept; + } +} + +parser egressParserImpl( + packet_in buffer, + out EMPTY_H a, + inout Meta b, + in psa_egress_parser_input_metadata_t c, + in EMPTY_BRIDGE d, + in EMPTY_CLONE e, + in EMPTY_CLONE f) { + state start { + transition accept; + } +} + +control ingress(inout Headers h, inout Meta m, in psa_ingress_input_metadata_t istd, + inout psa_ingress_output_metadata_t ostd) { + apply { + if (h.eth_hdr.src_addr < 10) { + h.eth_hdr.eth_type = (bit<16>)(h.eth_hdr.dst_addr << do_thing()); + } + } +} + +control egressControlImpl( + inout EMPTY_H hdr, + inout Meta meta, + in psa_egress_input_metadata_t x, + inout psa_egress_output_metadata_t ostd) +{ + apply { } +} + + + +control deparser(packet_out pkt, out EMPTY_CLONE clone_i2e_meta, + out EMPTY_RESUB resubmit_meta, + out EMPTY_BRIDGE normal_meta, + inout Headers hdr, + in Meta local_metadata, + in psa_ingress_output_metadata_t istd) { + apply { + pkt.emit(hdr); + } +} + +control egressDeparserImpl( + packet_out buffer, + out EMPTY_CLONE a, + out EMPTY_RECIRC b, + inout EMPTY_H c, + in Meta d, + in psa_egress_output_metadata_t e, + in psa_egress_deparser_input_metadata_t f) { + apply { } +} + +IngressPipeline(p(), ingress(), deparser()) ip; +EgressPipeline(egressParserImpl(), egressControlImpl(), egressDeparserImpl()) ep; + +PSA_Switch( + ip, + PacketReplicationEngine(), + ep, + BufferingQueueingEngine()) main; diff --git a/testdata/p4_16_samples/psa-dpdk-gauntlet_exit_combination_11.p4 b/testdata/p4_16_samples/psa-dpdk-gauntlet_exit_combination_11.p4 new file mode 100644 index 00000000000..e28c8015018 --- /dev/null +++ b/testdata/p4_16_samples/psa-dpdk-gauntlet_exit_combination_11.p4 @@ -0,0 +1,118 @@ +#include +#include + +header EMPTY_H {}; +struct EMPTY_RESUB {}; +struct EMPTY_CLONE {}; +struct EMPTY_BRIDGE {}; +struct EMPTY_RECIRC {}; + + +header ethernet_t { + bit<48> dst_addr; + bit<48> src_addr; + bit<16> eth_type; +} + +struct Headers { + ethernet_t eth_hdr; +} + +struct Meta {} + +parser p(packet_in pkt, out Headers hdr, inout Meta m, in psa_ingress_parser_input_metadata_t x, + in EMPTY_RESUB resub_meta, + in EMPTY_RECIRC recirc_meta) { + state start { + transition parse_hdrs; + } + state parse_hdrs { + pkt.extract(hdr.eth_hdr); + transition accept; + } +} + +parser egressParserImpl( + packet_in buffer, + out EMPTY_H a, + inout Meta b, + in psa_egress_parser_input_metadata_t c, + in EMPTY_BRIDGE d, + in EMPTY_CLONE e, + in EMPTY_CLONE f) { + state start { + transition accept; + } +} + +control ingress(inout Headers h, inout Meta m, in psa_ingress_input_metadata_t istd, + inout psa_ingress_output_metadata_t ostd) { + + action simple_action() { + if (false) { + return; + } else { + exit; + } + } + table simple_table { + key = { + 64w1: exact @name("key") ; + } + actions = { + simple_action(); + } + } + apply { + switch (simple_table.apply().action_run) { + simple_action: { + h.eth_hdr.eth_type = 16w1; + + } + } + + exit; + + } +} + +control egressControlImpl( + inout EMPTY_H hdr, + inout Meta meta, + in psa_egress_input_metadata_t x, + inout psa_egress_output_metadata_t ostd) +{ + apply { } +} + +control deparser(packet_out pkt, out EMPTY_CLONE clone_i2e_meta, + out EMPTY_RESUB resubmit_meta, + out EMPTY_BRIDGE normal_meta, + inout Headers h, + in Meta local_metadata, + in psa_ingress_output_metadata_t istd) { + apply { + pkt.emit(h); + } +} + + +control egressDeparserImpl( + packet_out buffer, + out EMPTY_CLONE a, + out EMPTY_RECIRC b, + inout EMPTY_H c, + in Meta d, + in psa_egress_output_metadata_t e, + in psa_egress_deparser_input_metadata_t f) { + apply { } +} + +IngressPipeline(p(), ingress(), deparser()) ip; +EgressPipeline(egressParserImpl(), egressControlImpl(), egressDeparserImpl()) ep; + +PSA_Switch( + ip, + PacketReplicationEngine(), + ep, + BufferingQueueingEngine()) main; diff --git a/testdata/p4_16_samples/psa-dpdk-gauntlet_exit_combination_15.p4 b/testdata/p4_16_samples/psa-dpdk-gauntlet_exit_combination_15.p4 new file mode 100644 index 00000000000..761c7291ca4 --- /dev/null +++ b/testdata/p4_16_samples/psa-dpdk-gauntlet_exit_combination_15.p4 @@ -0,0 +1,119 @@ +#include +#include + +header EMPTY_H {}; +struct EMPTY_RESUB {}; +struct EMPTY_CLONE {}; +struct EMPTY_BRIDGE {}; +struct EMPTY_RECIRC {}; +header ethernet_t { + bit<48> dst_addr; + bit<48> src_addr; + bit<16> eth_type; +} + +struct Headers { + ethernet_t eth_hdr; +} + +struct Meta {} + +parser p(packet_in pkt, out Headers hdr, inout Meta m, in psa_ingress_parser_input_metadata_t x, + in EMPTY_RESUB resub_meta, + in EMPTY_RECIRC recirc_meta) { + state start { + transition parse_hdrs; + } + state parse_hdrs { + pkt.extract(hdr.eth_hdr); + transition accept; + } +} + +parser egressParserImpl( + packet_in buffer, + out EMPTY_H a, + inout Meta b, + in psa_egress_parser_input_metadata_t c, + in EMPTY_BRIDGE d, + in EMPTY_CLONE e, + in EMPTY_CLONE f) { + state start { + transition accept; + } +} + +control ingress(inout Headers h, inout Meta m,in psa_ingress_input_metadata_t istd, + inout psa_ingress_output_metadata_t ostd) { + + action simple_action() { + h.eth_hdr.src_addr = 1; + } + table simple_table { + key = { + 48w1: exact @name("Vmhbwk") ; + } + actions = { + simple_action(); + NoAction(); + } + } + apply { + switch (simple_table.apply().action_run) { + simple_action: { + h.eth_hdr.eth_type = 16w1; + exit; + } + NoAction: { + h.eth_hdr.eth_type = 16w2; + exit; + } + default: { + h.eth_hdr.eth_type = 16w3; + exit; + } + } + h.eth_hdr.eth_type = 16w4; + exit; + + } +} +control egressControlImpl( + inout EMPTY_H hdr, + inout Meta meta, + in psa_egress_input_metadata_t x, + inout psa_egress_output_metadata_t ostd) +{ + apply { } +} + +control deparser(packet_out pkt,out EMPTY_CLONE clone_i2e_meta, + out EMPTY_RESUB resubmit_meta, + out EMPTY_BRIDGE normal_meta, + inout Headers h, + in Meta local_metadata, + in psa_ingress_output_metadata_t istd) { + apply { + pkt.emit(h); + } +} +control egressDeparserImpl( + packet_out buffer, + out EMPTY_CLONE a, + out EMPTY_RECIRC b, + inout EMPTY_H c, + in Meta d, + in psa_egress_output_metadata_t e, + in psa_egress_deparser_input_metadata_t f) { + apply { } +} + + +IngressPipeline(p(), ingress(), deparser()) ip; +EgressPipeline(egressParserImpl(), egressControlImpl(), egressDeparserImpl()) ep; + +PSA_Switch( + ip, + PacketReplicationEngine(), + ep, + BufferingQueueingEngine()) main; diff --git a/testdata/p4_16_samples/psa-dpdk-gauntlet_exit_combination_17.p4 b/testdata/p4_16_samples/psa-dpdk-gauntlet_exit_combination_17.p4 new file mode 100644 index 00000000000..755b02b7990 --- /dev/null +++ b/testdata/p4_16_samples/psa-dpdk-gauntlet_exit_combination_17.p4 @@ -0,0 +1,124 @@ +#include +#include + +header EMPTY_H {}; +struct EMPTY_RESUB {}; +struct EMPTY_CLONE {}; +struct EMPTY_BRIDGE {}; +struct EMPTY_RECIRC {}; + + +header ethernet_t { + bit<48> dst_addr; + bit<48> src_addr; + bit<16> eth_type; +} + +struct Headers { + ethernet_t eth_hdr; +} + +struct Meta {} + +parser p(packet_in pkt, out Headers hdr, inout Meta m,in psa_ingress_parser_input_metadata_t x, + in EMPTY_RESUB resub_meta, + in EMPTY_RECIRC recirc_meta) { + state start { + transition parse_hdrs; + } + state parse_hdrs { + pkt.extract(hdr.eth_hdr); + transition accept; + } +} + +parser egressParserImpl( + packet_in buffer, + out EMPTY_H a, + inout Meta b, + in psa_egress_parser_input_metadata_t c, + in EMPTY_BRIDGE d, + in EMPTY_CLONE e, + in EMPTY_CLONE f) { + state start { + transition accept; + } +} + +control ingress(inout Headers h, inout Meta m,in psa_ingress_input_metadata_t istd, + inout psa_ingress_output_metadata_t ostd) { + action dummy_action() { } + table simple_table_1 { + key = { + 48w1 : exact @name("key") ; + } + actions = { + dummy_action(); + } + } + table simple_table_2 { + key = { + 48w1 : exact @name("key") ; + } + actions = { + dummy_action(); + } + } + apply { + switch (simple_table_1.apply().action_run) { + dummy_action: { + switch (simple_table_2.apply().action_run) { + dummy_action: { + h.eth_hdr.src_addr = 4; + return; + } + } + } + } + exit; + + } +} + + +control egressControlImpl( + inout EMPTY_H hdr, + inout Meta meta, + in psa_egress_input_metadata_t x, + inout psa_egress_output_metadata_t ostd) +{ + apply { } +} + + +control deparser(packet_out pkt,out EMPTY_CLONE clone_i2e_meta, + out EMPTY_RESUB resubmit_meta, + out EMPTY_BRIDGE normal_meta, + inout Headers hdr, + in Meta local_metadata, + in psa_ingress_output_metadata_t istd) { + apply { + pkt.emit(hdr); + } +} + +control egressDeparserImpl( + packet_out buffer, + out EMPTY_CLONE a, + out EMPTY_RECIRC b, + inout EMPTY_H c, + in Meta d, + in psa_egress_output_metadata_t e, + in psa_egress_deparser_input_metadata_t f) { + apply { } +} + + +IngressPipeline(p(), ingress(), deparser()) ip; +EgressPipeline(egressParserImpl(), egressControlImpl(), egressDeparserImpl()) ep; + +PSA_Switch( + ip, + PacketReplicationEngine(), + ep, + BufferingQueueingEngine()) main; diff --git a/testdata/p4_16_samples/psa-dpdk-gauntlet_exit_combination_20.p4 b/testdata/p4_16_samples/psa-dpdk-gauntlet_exit_combination_20.p4 new file mode 100644 index 00000000000..66dd696db05 --- /dev/null +++ b/testdata/p4_16_samples/psa-dpdk-gauntlet_exit_combination_20.p4 @@ -0,0 +1,105 @@ +#include +#include + +header EMPTY_H {}; +struct EMPTY_RESUB {}; +struct EMPTY_CLONE {}; +struct EMPTY_BRIDGE {}; +struct EMPTY_RECIRC {}; + + +header ethernet_t { + bit<48> dst_addr; + bit<48> src_addr; + bit<16> eth_type; +} + +struct Headers { + ethernet_t eth_hdr; +} + +struct Meta {} + +parser p(packet_in pkt, out Headers hdr, inout Meta m, in psa_ingress_parser_input_metadata_t x, + in EMPTY_RESUB resub_meta, + in EMPTY_RECIRC recirc_meta) { + state start { + transition parse_hdrs; + } + state parse_hdrs { + pkt.extract(hdr.eth_hdr); + transition accept; + } +} + +parser egressParserImpl( + packet_in buffer, + out EMPTY_H a, + inout Meta b, + in psa_egress_parser_input_metadata_t c, + in EMPTY_BRIDGE d, + in EMPTY_CLONE e, + in EMPTY_CLONE f) { + state start { + transition accept; + } +} + +control ingress(inout Headers h, inout Meta m,in psa_ingress_input_metadata_t istd, + inout psa_ingress_output_metadata_t ostd) { + + action simple_action() { + if (!true) { + } else { + return; + } + h.eth_hdr.eth_type = 16w1; + exit; + } + + apply { + simple_action(); + h.eth_hdr.eth_type = 16w2; + + } +} + +control egressControlImpl( + inout EMPTY_H hdr, + inout Meta meta, + in psa_egress_input_metadata_t x, + inout psa_egress_output_metadata_t ostd) +{ + apply { } +} + +control deparser(packet_out pkt, out EMPTY_CLONE clone_i2e_meta, + out EMPTY_RESUB resubmit_meta, + out EMPTY_BRIDGE normal_meta, + inout Headers hdr, + in Meta local_metadata, + in psa_ingress_output_metadata_t istd) { + apply { + pkt.emit(hdr); + } +} + +control egressDeparserImpl( + packet_out buffer, + out EMPTY_CLONE a, + out EMPTY_RECIRC b, + inout EMPTY_H c, + in Meta d, + in psa_egress_output_metadata_t e, + in psa_egress_deparser_input_metadata_t f) { + apply { } +} + +IngressPipeline(p(), ingress(), deparser()) ip; +EgressPipeline(egressParserImpl(), egressControlImpl(), egressDeparserImpl()) ep; + +PSA_Switch( + ip, + PacketReplicationEngine(), + ep, + BufferingQueueingEngine()) main; diff --git a/testdata/p4_16_samples/psa-dpdk-gauntlet_exit_combination_23.p4 b/testdata/p4_16_samples/psa-dpdk-gauntlet_exit_combination_23.p4 new file mode 100644 index 00000000000..7c172c576ed --- /dev/null +++ b/testdata/p4_16_samples/psa-dpdk-gauntlet_exit_combination_23.p4 @@ -0,0 +1,112 @@ +#include +#include + +header EMPTY_H {}; +struct EMPTY_RESUB {}; +struct EMPTY_CLONE {}; +struct EMPTY_BRIDGE {}; +struct EMPTY_RECIRC {}; + + +header ethernet_t { + bit<48> dst_addr; + bit<48> src_addr; + bit<16> eth_type; +} + +struct Headers { + ethernet_t eth_hdr; +} + +struct Meta {} + +parser p(packet_in pkt, out Headers hdr, inout Meta m,in psa_ingress_parser_input_metadata_t x, + in EMPTY_RESUB resub_meta, + in EMPTY_RECIRC recirc_meta) { + state start { + transition parse_hdrs; + } + state parse_hdrs { + pkt.extract(hdr.eth_hdr); + transition accept; + } +} + +parser egressParserImpl( + packet_in buffer, + out EMPTY_H a, + inout Meta b, + in psa_egress_parser_input_metadata_t c, + in EMPTY_BRIDGE d, + in EMPTY_CLONE e, + in EMPTY_CLONE f) { + state start { + transition accept; + } +} + +control ingress(inout Headers h, inout Meta m, in psa_ingress_input_metadata_t istd, + inout psa_ingress_output_metadata_t ostd) { + action simple_action() { + h.eth_hdr.dst_addr = 1; + exit; + } + + table simple_table { + key = { + h.eth_hdr.eth_type: exact @name("key") ; + } + actions = { + simple_action(); + } + } + apply { + switch (simple_table.apply().action_run) { + simple_action: { + exit; + } + } + h.eth_hdr.dst_addr = h.eth_hdr.src_addr + h.eth_hdr.dst_addr; + } +} + +control egressControlImpl( + inout EMPTY_H hdr, + inout Meta meta, + in psa_egress_input_metadata_t x, + inout psa_egress_output_metadata_t ostd) +{ + apply { } +} + +control deparser(packet_out pkt,out EMPTY_CLONE clone_i2e_meta, + out EMPTY_RESUB resubmit_meta, + out EMPTY_BRIDGE normal_meta, + inout Headers hdr, + in Meta local_metadata, + in psa_ingress_output_metadata_t istd) { + apply { + pkt.emit(hdr); + } +} + +control egressDeparserImpl( + packet_out buffer, + out EMPTY_CLONE a, + out EMPTY_RECIRC b, + inout EMPTY_H c, + in Meta d, + in psa_egress_output_metadata_t e, + in psa_egress_deparser_input_metadata_t f) { + apply { } +} + + +IngressPipeline(p(), ingress(), deparser()) ip; +EgressPipeline(egressParserImpl(), egressControlImpl(), egressDeparserImpl()) ep; + +PSA_Switch( + ip, + PacketReplicationEngine(), + ep, + BufferingQueueingEngine()) main; diff --git a/testdata/p4_16_samples/psa-dpdk-gauntlet_exit_combination_9.p4 b/testdata/p4_16_samples/psa-dpdk-gauntlet_exit_combination_9.p4 new file mode 100644 index 00000000000..4be2a1e8a5a --- /dev/null +++ b/testdata/p4_16_samples/psa-dpdk-gauntlet_exit_combination_9.p4 @@ -0,0 +1,120 @@ +#include +#include + +header EMPTY_H {}; +struct EMPTY_RESUB {}; +struct EMPTY_CLONE {}; +struct EMPTY_BRIDGE {}; +struct EMPTY_RECIRC {}; + +header ethernet_t { + bit<48> dst_addr; + bit<48> src_addr; + bit<16> eth_type; +} + +struct Headers { + ethernet_t eth_hdr; +} + +struct Meta {} + +parser p(packet_in pkt, out Headers hdr, inout Meta m,in psa_ingress_parser_input_metadata_t x, + in EMPTY_RESUB resub_meta, + in EMPTY_RECIRC recirc_meta) { + state start { + transition parse_hdrs; + } + state parse_hdrs { + pkt.extract(hdr.eth_hdr); + + transition accept; + } +} + +parser egressParserImpl( + packet_in buffer, + out EMPTY_H a, + inout Meta b, + in psa_egress_parser_input_metadata_t c, + in EMPTY_BRIDGE d, + in EMPTY_CLONE e, + in EMPTY_CLONE f) { + state start { + transition accept; + } +} + + +control ingress(inout Headers h, inout Meta m, in psa_ingress_input_metadata_t istd, + inout psa_ingress_output_metadata_t ostd) { + + action simple_action() { + h.eth_hdr.src_addr = 1; + + } + table simple_table { + key = { + 48w1: exact @name("Vmhbwk") ; + } + actions = { + simple_action(); + } + } + apply { + switch (simple_table.apply().action_run) { + simple_action: { + if (true) { + return; + } else { + h.eth_hdr.eth_type = 16w1; + } + } + } + h.eth_hdr.eth_type = 16w2; + exit; + + } +} + +control egressControlImpl( + inout EMPTY_H hdr, + inout Meta meta, + in psa_egress_input_metadata_t x, + inout psa_egress_output_metadata_t ostd) +{ + apply { } +} + + +control deparser(packet_out pkt,out EMPTY_CLONE clone_i2e_meta, + out EMPTY_RESUB resubmit_meta, + out EMPTY_BRIDGE normal_meta, + inout Headers h, + in Meta local_metadata, + in psa_ingress_output_metadata_t istd) { + apply { + pkt.emit(h); + } +} + +control egressDeparserImpl( + packet_out buffer, + out EMPTY_CLONE a, + out EMPTY_RECIRC b, + inout EMPTY_H c, + in Meta d, + in psa_egress_output_metadata_t e, + in psa_egress_deparser_input_metadata_t f) { + apply { } +} + + +IngressPipeline(p(), ingress(), deparser()) ip; +EgressPipeline(egressParserImpl(), egressControlImpl(), egressDeparserImpl()) ep; + +PSA_Switch( + ip, + PacketReplicationEngine(), + ep, + BufferingQueueingEngine()) main; diff --git a/testdata/p4_16_samples/psa-dpdk-gauntlet_function_if_hdr_return.p4 b/testdata/p4_16_samples/psa-dpdk-gauntlet_function_if_hdr_return.p4 new file mode 100644 index 00000000000..9c6ace40e7c --- /dev/null +++ b/testdata/p4_16_samples/psa-dpdk-gauntlet_function_if_hdr_return.p4 @@ -0,0 +1,104 @@ +#include +#include + +header EMPTY_H {}; +struct EMPTY_RESUB {}; +struct EMPTY_CLONE {}; +struct EMPTY_BRIDGE {}; +struct EMPTY_RECIRC {}; + + +header ethernet_t { + bit<48> dst_addr; + bit<48> src_addr; + bit<16> eth_type; +} + +struct Headers { + ethernet_t eth_hdr; +} + +struct Meta { +} + +ethernet_t do_function() { + if (true) { + if (true) { + return { 1, 1, 1 }; + } + } + return { 2, 2, 2 }; +} +parser p(packet_in pkt, out Headers hdr, inout Meta m, in psa_ingress_parser_input_metadata_t x, + in EMPTY_RESUB resub_meta, + in EMPTY_RECIRC recirc_meta) { + state start { + transition parse_hdrs; + } + state parse_hdrs { + pkt.extract(hdr.eth_hdr); + transition accept; + } +} + +parser egressParserImpl( + packet_in buffer, + out EMPTY_H a, + inout Meta b, + in psa_egress_parser_input_metadata_t c, + in EMPTY_BRIDGE d, + in EMPTY_CLONE e, + in EMPTY_CLONE f) { + state start { + transition accept; + } +} + + +control ingress(inout Headers h, inout Meta m,in psa_ingress_input_metadata_t istd, + inout psa_ingress_output_metadata_t ostd) { + apply { + h.eth_hdr = do_function(); + } +} + +control egressControlImpl( + inout EMPTY_H hdr, + inout Meta meta, + in psa_egress_input_metadata_t x, + inout psa_egress_output_metadata_t ostd) +{ + apply { } +} + + +control deparser(packet_out pkt,out EMPTY_CLONE clone_i2e_meta, + out EMPTY_RESUB resubmit_meta, + out EMPTY_BRIDGE normal_meta, + inout Headers h, + in Meta local_metadata, + in psa_ingress_output_metadata_t istd) { + apply { + pkt.emit(h); + } +} + +control egressDeparserImpl( + packet_out buffer, + out EMPTY_CLONE a, + out EMPTY_RECIRC b, + inout EMPTY_H c, + in Meta d, + in psa_egress_output_metadata_t e, + in psa_egress_deparser_input_metadata_t f) { + apply { } +} + +IngressPipeline(p(), ingress(), deparser()) ip; +EgressPipeline(egressParserImpl(), egressControlImpl(), egressDeparserImpl()) ep; + +PSA_Switch( + ip, + PacketReplicationEngine(), + ep, + BufferingQueueingEngine()) main; diff --git a/testdata/p4_16_samples/psa-dpdk-gauntlet_function_return_cast.p4 b/testdata/p4_16_samples/psa-dpdk-gauntlet_function_return_cast.p4 new file mode 100644 index 00000000000..a4d7b6f6823 --- /dev/null +++ b/testdata/p4_16_samples/psa-dpdk-gauntlet_function_return_cast.p4 @@ -0,0 +1,98 @@ +#include +#include + +header EMPTY_H {}; +struct EMPTY_RESUB {}; +struct EMPTY_CLONE {}; +struct EMPTY_BRIDGE {}; +struct EMPTY_RECIRC {}; + +header ethernet_t { + bit<48> dst_addr; + bit<48> src_addr; + bit<16> eth_type; +} + +struct Headers { + ethernet_t eth_hdr; +} + +struct Meta { +} + +bit<8> do_function() { + return -1; +} + +parser p(packet_in pkt, out Headers hdr, inout Meta m, in psa_ingress_parser_input_metadata_t x, + in EMPTY_RESUB resub_meta, + in EMPTY_RECIRC recirc_meta) { + state start { + transition parse_hdrs; + } + state parse_hdrs { + pkt.extract(hdr.eth_hdr); + transition accept; + } +} + +parser egressParserImpl( + packet_in buffer, + out EMPTY_H a, + inout Meta b, + in psa_egress_parser_input_metadata_t c, + in EMPTY_BRIDGE d, + in EMPTY_CLONE e, + in EMPTY_CLONE f) { + state start { + transition accept; + } +} + +control ingress(inout Headers h, inout Meta m, in psa_ingress_input_metadata_t istd, + inout psa_ingress_output_metadata_t ostd) { + + apply { + h.eth_hdr.eth_type = (bit<16>)do_function(); + } +} + +control egressControlImpl( + inout EMPTY_H hdr, + inout Meta meta, + in psa_egress_input_metadata_t x, + inout psa_egress_output_metadata_t ostd) +{ + apply { } +} + +control deparser(packet_out pkt, out EMPTY_CLONE clone_i2e_meta, + out EMPTY_RESUB resubmit_meta, + out EMPTY_BRIDGE normal_meta, + inout Headers h, + in Meta local_metadata, + in psa_ingress_output_metadata_t istd) { + apply { + pkt.emit(h); + } +} + +control egressDeparserImpl( + packet_out buffer, + out EMPTY_CLONE a, + out EMPTY_RECIRC b, + inout EMPTY_H c, + in Meta d, + in psa_egress_output_metadata_t e, + in psa_egress_deparser_input_metadata_t f) { + apply { } +} + +IngressPipeline(p(), ingress(), deparser()) ip; +EgressPipeline(egressParserImpl(), egressControlImpl(), egressDeparserImpl()) ep; + +PSA_Switch( + ip, + PacketReplicationEngine(), + ep, + BufferingQueueingEngine()) main; diff --git a/testdata/p4_16_samples/psa-dpdk-gauntlet_short_circuit.p4 b/testdata/p4_16_samples/psa-dpdk-gauntlet_short_circuit.p4 new file mode 100644 index 00000000000..20f51b9d39f --- /dev/null +++ b/testdata/p4_16_samples/psa-dpdk-gauntlet_short_circuit.p4 @@ -0,0 +1,115 @@ +#include +#include + +header EMPTY_H {}; +struct EMPTY_RESUB {}; +struct EMPTY_CLONE {}; +struct EMPTY_BRIDGE {}; +struct EMPTY_RECIRC {}; + +header ethernet_t { + bit<48> dst_addr; + bit<48> src_addr; + bit<16> eth_type; +} + +header H { + bit<8> a; + bit<8> b; + bit<8> c; + bit<8> d; +} + +header B { + bit<8> a; + bit<8> b; +} + +bit<8> do_function(out bit<8> val) { + return val; +} + +struct Headers { + ethernet_t eth_hdr; + H h; + B b; +} + +struct Meta {} + +bool bool_with_side_effect(inout bit<8> val) { + val = 1; + return true; +} + +parser p(packet_in pkt, out Headers hdr, inout Meta m, in psa_ingress_parser_input_metadata_t x, + in EMPTY_RESUB resub_meta, + in EMPTY_RECIRC recirc_meta) { + state start { + pkt.extract(hdr.eth_hdr); + pkt.extract(hdr.h); + pkt.extract(hdr.b); + transition accept; + } +} + +parser egressParserImpl( + packet_in buffer, + out EMPTY_H a, + inout Meta b, + in psa_egress_parser_input_metadata_t c, + in EMPTY_BRIDGE d, + in EMPTY_CLONE e, + in EMPTY_CLONE f) { + state start { + transition accept; + } +} + +control ingress(inout Headers h, inout Meta m, in psa_ingress_input_metadata_t istd, + inout psa_ingress_output_metadata_t ostd) { + apply { + bool dummy_bool; + dummy_bool = true || bool_with_side_effect(h.h.a); + dummy_bool = (false || true) || bool_with_side_effect(h.h.b); + dummy_bool = false && bool_with_side_effect(h.h.c); + dummy_bool = (true && false) && bool_with_side_effect(h.h.d); + h.b.a = (8w1 != do_function(h.b.b) || false) ? 8w1 : 8w2; + } +} + +control egressControlImpl( + inout EMPTY_H hdr, + inout Meta meta, + in psa_egress_input_metadata_t x, + inout psa_egress_output_metadata_t ostd) +{ + apply { } +} + +control deparser(packet_out b,out EMPTY_CLONE clone_i2e_meta, + out EMPTY_RESUB resubmit_meta, + out EMPTY_BRIDGE normal_meta, + inout Headers h, + in Meta local_metadata, + in psa_ingress_output_metadata_t istd) { apply {b.emit(h);} } + +control egressDeparserImpl( + packet_out buffer, + out EMPTY_CLONE a, + out EMPTY_RECIRC b, + inout EMPTY_H c, + in Meta d, + in psa_egress_output_metadata_t e, + in psa_egress_deparser_input_metadata_t f) { + apply { } +} + +IngressPipeline(p(), ingress(), deparser()) ip; +EgressPipeline(egressParserImpl(), egressControlImpl(), egressDeparserImpl()) ep; + +PSA_Switch( + ip, + PacketReplicationEngine(), + ep, + BufferingQueueingEngine()) main; diff --git a/testdata/p4_16_samples/psa-dpdk-gauntlet_side_effect_order_4.p4 b/testdata/p4_16_samples/psa-dpdk-gauntlet_side_effect_order_4.p4 new file mode 100644 index 00000000000..2a4cfda06fd --- /dev/null +++ b/testdata/p4_16_samples/psa-dpdk-gauntlet_side_effect_order_4.p4 @@ -0,0 +1,99 @@ +#include +#include + +header EMPTY_H {}; +struct EMPTY_RESUB {}; +struct EMPTY_CLONE {}; +struct EMPTY_BRIDGE {}; +struct EMPTY_RECIRC {}; + + +header ethernet_t { + bit<48> dst_addr; + bit<48> src_addr; + bit<16> eth_type; +} + +struct Headers { + ethernet_t eth_hdr; +} + +struct Meta {} + +bit<16> do_thing(inout bit<16> val_0) { + val_0 = val_0 < 6 ? 16w0 : 16w3; + return 16w2; +} + + +parser p(packet_in pkt, out Headers hdr, inout Meta m,in psa_ingress_parser_input_metadata_t x, + in EMPTY_RESUB resub_meta, + in EMPTY_RECIRC recirc_meta) { + state start { + transition parse_hdrs; + } + state parse_hdrs { + pkt.extract(hdr.eth_hdr); + transition accept; + } +} +parser egressParserImpl( + packet_in buffer, + out EMPTY_H a, + inout Meta b, + in psa_egress_parser_input_metadata_t c, + in EMPTY_BRIDGE d, + in EMPTY_CLONE e, + in EMPTY_CLONE f) { + state start { + transition accept; + } +} + + +control ingress(inout Headers h, inout Meta m, in psa_ingress_input_metadata_t istd, + inout psa_ingress_output_metadata_t ostd) { + apply { + do_thing(h.eth_hdr.eth_type); + } +} + +control egressControlImpl( + inout EMPTY_H hdr, + inout Meta meta, + in psa_egress_input_metadata_t x, + inout psa_egress_output_metadata_t ostd) +{ + apply { } +} + +control deparser(packet_out pkt,out EMPTY_CLONE clone_i2e_meta, + out EMPTY_RESUB resubmit_meta, + out EMPTY_BRIDGE normal_meta, + inout Headers hdr, + in Meta local_metadata, + in psa_ingress_output_metadata_t istd) { + apply { + pkt.emit(hdr); + } +} + +control egressDeparserImpl( + packet_out buffer, + out EMPTY_CLONE a, + out EMPTY_RECIRC b, + inout EMPTY_H c, + in Meta d, + in psa_egress_output_metadata_t e, + in psa_egress_deparser_input_metadata_t f) { + apply { } +} + +IngressPipeline(p(), ingress(), deparser()) ip; +EgressPipeline(egressParserImpl(), egressControlImpl(), egressDeparserImpl()) ep; + +PSA_Switch( + ip, + PacketReplicationEngine(), + ep, + BufferingQueueingEngine()) main; diff --git a/testdata/p4_16_samples/psa-dpdk-gauntlet_variable_shadowing.p4 b/testdata/p4_16_samples/psa-dpdk-gauntlet_variable_shadowing.p4 new file mode 100644 index 00000000000..e646282f174 --- /dev/null +++ b/testdata/p4_16_samples/psa-dpdk-gauntlet_variable_shadowing.p4 @@ -0,0 +1,128 @@ +#include +#include + +header EMPTY_H {}; +struct EMPTY_RESUB {}; +struct EMPTY_CLONE {}; +struct EMPTY_BRIDGE {}; +struct EMPTY_RECIRC {}; + + + +header ethernet_t { + bit<48> dst_addr; + bit<48> src_addr; + bit<16> eth_type; +} + +header H { + bit<32> a; + bit<32> b; + bit<8> c; +} + +struct Headers { + ethernet_t eth_hdr; + H h; +} + +struct Meta { + bit<8> test; +} + +control compute(inout H h) { + @name("a") action a_0() { + h.b = h.a; + } + @name("t") table t_0 { + key = { + h.a + h.a: exact @name("e") ; + } + actions = { + a_0(); + NoAction(); + } + default_action = NoAction(); + } + apply { + bit<8> tmp = 0; + Meta m = {0}; + t_0.apply(); + tmp = 0; + } +} + + +parser p(packet_in pkt, out Headers h, inout Meta m, in psa_ingress_parser_input_metadata_t x, + in EMPTY_RESUB resub_meta, + in EMPTY_RECIRC recirc_meta) { + state start { + pkt.extract(h.eth_hdr); + pkt.extract(h.h); + transition accept; + } +} + +parser egressParserImpl( + packet_in buffer, + out EMPTY_H a, + inout Meta b, + in psa_egress_parser_input_metadata_t c, + in EMPTY_BRIDGE d, + in EMPTY_CLONE e, + in EMPTY_CLONE f) { + state start { + transition accept; + } +} + +control ingress(inout Headers h, inout Meta m, in psa_ingress_input_metadata_t istd, + inout psa_ingress_output_metadata_t ostd) { + @name("c") compute() c_0; + apply { + m.test = 1; + bit<8> tmp = 1; + c_0.apply(h.h); + h.h.c = tmp; + } +} + +control egressControlImpl( + inout EMPTY_H hdr, + inout Meta meta, + in psa_egress_input_metadata_t x, + inout psa_egress_output_metadata_t ostd) +{ + apply { } +} + +control deparser(packet_out pkt,out EMPTY_CLONE clone_i2e_meta, + out EMPTY_RESUB resubmit_meta, + out EMPTY_BRIDGE normal_meta, + inout Headers h, + in Meta local_metadata, + in psa_ingress_output_metadata_t istd) { + apply { + pkt.emit(h); + } +} + +control egressDeparserImpl( + packet_out buffer, + out EMPTY_CLONE a, + out EMPTY_RECIRC b, + inout EMPTY_H c, + in Meta d, + in psa_egress_output_metadata_t e, + in psa_egress_deparser_input_metadata_t f) { + apply { } +} + +IngressPipeline(p(), ingress(), deparser()) ip; +EgressPipeline(egressParserImpl(), egressControlImpl(), egressDeparserImpl()) ep; + +PSA_Switch( + ip, + PacketReplicationEngine(), + ep, + BufferingQueueingEngine()) main; diff --git a/testdata/p4_16_samples/psa-dpdk-hash.p4 b/testdata/p4_16_samples/psa-dpdk-hash.p4 new file mode 100644 index 00000000000..384374c762d --- /dev/null +++ b/testdata/p4_16_samples/psa-dpdk-hash.p4 @@ -0,0 +1,120 @@ +/* +Copyright 2016 VMware, Inc. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +#include +#include + +header EMPTY_H {}; +struct EMPTY_RESUB {}; +struct EMPTY_CLONE {}; +struct EMPTY_BRIDGE {}; +struct EMPTY_RECIRC {}; + + + +header hash_t { + bit<32> hash; +} + +header ipv4_t { + bit<32> lkp_ipv4_sa; +} + +struct M { + hash_t hash; + ipv4_t ipv4; +} + +struct H { } + + +parser ParserI(packet_in pk, out H hdr, inout M meta, in psa_ingress_parser_input_metadata_t x, + in EMPTY_RESUB resub_meta, + in EMPTY_RECIRC recirc_meta) { + state start { + transition accept; + } +} + +parser egressParserImpl( + packet_in buffer, + out EMPTY_H a, + inout M b, + in psa_egress_parser_input_metadata_t c, + in EMPTY_BRIDGE d, + in EMPTY_CLONE e, + in EMPTY_CLONE f) { + state start { + transition accept; + } +} + +control IngressI(inout H hdr, inout M meta,in psa_ingress_input_metadata_t istd, + inout psa_ingress_output_metadata_t ostd) { + Hash>(PSA_HashAlgorithm_t.CRC16) h; + + action a() { + meta.hash.hash = h.get_hash((bit<32>)0, + { meta.ipv4.lkp_ipv4_sa }, + (bit<32>)65536); + } + + apply { + a(); + } +} + + +control egressControlImpl( + inout EMPTY_H hdr, + inout M meta, + in psa_egress_input_metadata_t x, + inout psa_egress_output_metadata_t ostd) +{ + apply { } +} + + +control DeparserI(packet_out packet, out EMPTY_CLONE clone_i2e_meta, + out EMPTY_RESUB resubmit_meta, + out EMPTY_BRIDGE normal_meta, + inout H hdr, + in M local_metadata, + in psa_ingress_output_metadata_t istd ) { + apply { } +} + + +control egressDeparserImpl( + packet_out buffer, + out EMPTY_CLONE a, + out EMPTY_RECIRC b, + inout EMPTY_H c, + in M d, + in psa_egress_output_metadata_t e, + in psa_egress_deparser_input_metadata_t f) { + apply { } +} + + +IngressPipeline(ParserI(), IngressI(), DeparserI()) ip; +EgressPipeline(egressParserImpl(), egressControlImpl(), egressDeparserImpl()) ep; + +PSA_Switch( + ip, + PacketReplicationEngine(), + ep, + BufferingQueueingEngine()) main; diff --git a/testdata/p4_16_samples/psa-dpdk-inline-stack.p4 b/testdata/p4_16_samples/psa-dpdk-inline-stack.p4 new file mode 100644 index 00000000000..c919fe7885d --- /dev/null +++ b/testdata/p4_16_samples/psa-dpdk-inline-stack.p4 @@ -0,0 +1,102 @@ +/* +Copyright 2016 VMware, Inc. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +#include +#include + +header EMPTY_H {}; +struct EMPTY_RESUB {}; +struct EMPTY_CLONE {}; +struct EMPTY_BRIDGE {}; +struct EMPTY_RECIRC {}; + + +header h_t { + bit<8> f; +} +struct H { h_t[1] stack; } +struct M {} + +parser ParserI(packet_in pk, out H hdr, inout M meta, in psa_ingress_parser_input_metadata_t x, + in EMPTY_RESUB resub_meta, + in EMPTY_RECIRC recirc_meta) { + state start { + transition accept; + } +} + +parser egressParserImpl( + packet_in buffer, + out EMPTY_H a, + inout M b, + in psa_egress_parser_input_metadata_t c, + in EMPTY_BRIDGE d, + in EMPTY_CLONE e, + in EMPTY_CLONE f) { + state start { + transition accept; + } +} + +control Aux(inout H hdr) { apply{} } + +control IngressI(inout H hdr, inout M meta,in psa_ingress_input_metadata_t istd, + inout psa_ingress_output_metadata_t ostd) { + Aux() aux; + apply { + aux.apply(hdr); + aux.apply(hdr); + } +} + + +control egressControlImpl( + inout EMPTY_H hdr, + inout M meta, + in psa_egress_input_metadata_t x, + inout psa_egress_output_metadata_t ostd) +{ + apply { } +} + + +control DeparserI(packet_out b, out EMPTY_CLONE clone_i2e_meta, + out EMPTY_RESUB resubmit_meta, + out EMPTY_BRIDGE normal_meta, + inout H h, + in M local_metadata, + in psa_ingress_output_metadata_t istd) { + apply { } +} + +control egressDeparserImpl( + packet_out buffer, + out EMPTY_CLONE a, + out EMPTY_RECIRC b, + inout EMPTY_H c, + in M d, + in psa_egress_output_metadata_t e, + in psa_egress_deparser_input_metadata_t f) { + apply { } +} +IngressPipeline(ParserI(), IngressI(), DeparserI()) ip; +EgressPipeline(egressParserImpl(), egressControlImpl(), egressDeparserImpl()) ep; + +PSA_Switch( + ip, + PacketReplicationEngine(), + ep, + BufferingQueueingEngine()) main; diff --git a/testdata/p4_16_samples/psa-dpdk-issue1630.p4 b/testdata/p4_16_samples/psa-dpdk-issue1630.p4 new file mode 100644 index 00000000000..ecd2a308ed6 --- /dev/null +++ b/testdata/p4_16_samples/psa-dpdk-issue1630.p4 @@ -0,0 +1,237 @@ +/* -*- P4_16 -*- */ +#include +#include +//#include "debug.p4" + +header EMPTY_H {}; +struct EMPTY_RESUB {}; +struct EMPTY_CLONE {}; +struct EMPTY_BRIDGE {}; +struct EMPTY_RECIRC {}; + +const bit<16> TYPE_IPV4 = 0x800; + +/************************************************************************* +*********************** H E A D E R S *********************************** +*************************************************************************/ + +typedef bit<9> egressSpec_t; +typedef bit<48> macAddr_t; +typedef bit<32> ip4Addr_t; + +header ethernet_t { + macAddr_t dstAddr; + macAddr_t srcAddr; + bit<16> etherType; +} + +header ipv4_t { + bit<4> version; + bit<4> ihl; + bit<8> diffserv; + bit<16> totalLen; + bit<16> identification; + bit<3> flags; + bit<13> fragOffset; + bit<8> ttl; + bit<8> protocol; + bit<16> hdrChecksum; + ip4Addr_t srcAddr; + ip4Addr_t dstAddr; +} + +struct metadata { + /* empty */ +} + +struct headers { + ethernet_t ethernet; + ipv4_t ipv4; +} + +/************************************************************************* +*********************** P A R S E R *********************************** +*************************************************************************/ + +parser MyParser(packet_in packet, + out headers hdr, + inout metadata meta, + in psa_ingress_parser_input_metadata_t x, + in EMPTY_RESUB resub_meta, + in EMPTY_RECIRC recirc_meta) { + + state start { + + packet.extract(hdr.ethernet); + transition select(hdr.ethernet.etherType){ + + TYPE_IPV4: ipv4; + default: accept; + + } + + } + + state ipv4 { + + packet.extract(hdr.ipv4); + transition accept; + } + +} + +parser egressParserImpl( + packet_in buffer, + out EMPTY_H a, + inout metadata b, + in psa_egress_parser_input_metadata_t c, + in EMPTY_BRIDGE d, + in EMPTY_CLONE e, + in EMPTY_CLONE f) { + state start { + transition accept; + } +} + + +/************************************************************************* +************** I N G R E S S P R O C E S S I N G ******************* +*************************************************************************/ + +control MyIngress(inout headers hdr, + inout metadata meta, + in psa_ingress_input_metadata_t istd, + inout psa_ingress_output_metadata_t ostd) { + + action drop() { + ingress_drop(ostd); + } + + //debug_std_meta() debug; + + action ipv4_forward(macAddr_t dstAddr, PortIdUint_t port) { + + //set the src mac address as the previous dst, this is not correct right? + hdr.ethernet.srcAddr = hdr.ethernet.dstAddr; + + //set the destination mac address that we got from the match in the table + hdr.ethernet.dstAddr = dstAddr; + + //set the output port that we also get from the table + ostd.egress_port = (PortId_t)(PortIdUint_t)port; + + //decrease ttl by 1 + hdr.ipv4.ttl = hdr.ipv4.ttl -1; + hdr.ipv4.hdrChecksum = 1; + + } + + table ipv4_lpm { + key = { + hdr.ipv4.dstAddr: lpm; + } + actions = { + ipv4_forward; + drop; + NoAction; + } + size = 1024; + default_action = NoAction(); + } + + apply { + + //only if IPV4 the rule is applied. Therefore other packets will not be forwarded. + if (hdr.ipv4.isValid()){ + ipv4_lpm.apply(); + //debug.apply(standard_metadata); + + } + } +} + +/************************************************************************* +**************** E G R E S S P R O C E S S I N G ******************* +*************************************************************************/ + +control egressControlImpl( + inout EMPTY_H hdr, + inout metadata meta, + in psa_egress_input_metadata_t x, + inout psa_egress_output_metadata_t ostd) +{ + apply { } +} + + +/************************************************************************* +*********************** D E P A R S E R ******************************* +*************************************************************************/ + +control MyDeparser(packet_out packet, out EMPTY_CLONE clone_i2e_meta, + out EMPTY_RESUB resubmit_meta, + out EMPTY_BRIDGE normal_meta, + inout headers hdr, + in metadata local_metadata, + in psa_ingress_output_metadata_t istd ) { + InternetChecksum() ck; + apply { + ck.clear(); + ck.add({ + /* 16-bit word 0 */ hdr.ipv4.version, hdr.ipv4.ihl, hdr.ipv4.diffserv, + /* 16-bit word 1 */ hdr.ipv4.totalLen, + /* 16-bit word 2 */ hdr.ipv4.identification, + /* 16-bit word 3 */ hdr.ipv4.flags, hdr.ipv4.fragOffset, + /* 16-bit word 4 */ hdr.ipv4.ttl, hdr.ipv4.protocol, + /* 16-bit word 5 skip hdr.ipv4.hdrChecksum, */ + /* 16-bit words 6-7 */ hdr.ipv4.srcAddr, + /* 16-bit words 8-9 */ hdr.ipv4.dstAddr + }); + hdr.ipv4.hdrChecksum = ck.get(); + // Update TCP checksum + // This clear() call is necessary for correct behavior, since + // the same instance 'ck' is reused from above for the same + // packet. If a second InternetChecksum instance other than + // 'ck' were used below instead, this clear() call would be + // unnecessary. + ck.clear(); + // Subtract the original TCP checksum + //ck.subtract({hdr.tcp.checksum}); + // Subtract the effect of the original IPv4 source address, + // which is part of the TCP 'pseudo-header' for the purposes + // of TCP checksum calculation (see RFC 793), then add the + // effect of the new IPv4 source address. + //ck.subtract({local_metadata.fwd_metadata.old_srcAddr}); + ck.add({hdr.ipv4.srcAddr}); + //hdr.tcp.checksum = ck.get(); + + + //parsed headers have to be added again into the packet. + packet.emit(hdr.ethernet); + packet.emit(hdr.ipv4); + + } +} + +control egressDeparserImpl( + packet_out buffer, + out EMPTY_CLONE a, + out EMPTY_RECIRC b, + inout EMPTY_H c, + in metadata d, + in psa_egress_output_metadata_t e, + in psa_egress_deparser_input_metadata_t f) { + apply { } +} +/************************************************************************* +*********************** S W I T C H ******************************* +*************************************************************************/ + +IngressPipeline(MyParser(), MyIngress(), MyDeparser()) ip; +EgressPipeline(egressParserImpl(), egressControlImpl(), egressDeparserImpl()) ep; + +PSA_Switch( + ip, + PacketReplicationEngine(), + ep, + BufferingQueueingEngine()) main; diff --git a/testdata/p4_16_samples/psa-dpdk-issue1653-complex.p4 b/testdata/p4_16_samples/psa-dpdk-issue1653-complex.p4 new file mode 100644 index 00000000000..dfb05135c48 --- /dev/null +++ b/testdata/p4_16_samples/psa-dpdk-issue1653-complex.p4 @@ -0,0 +1,166 @@ +/* +Copyright 2019 MNK Consulting, LLC. +http://mnkcg.com + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at +http://www.apache.org/licenses/LICENSE-2.0 +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +#include +#include + +header EMPTY_H {}; +struct EMPTY_RESUB {}; +struct EMPTY_CLONE {}; +struct EMPTY_BRIDGE {}; +struct EMPTY_RECIRC {}; + + +enum bit<16> EthTypes { + IPv4 = 0x0800, + ARP = 0x0806, + RARP = 0x8035, + EtherTalk = 0x809B, + VLAN = 0x8100, + IPX = 0x8137, + IPv6 = 0x86DD +} + +struct alt_t { + bit<1> valid; + bit<7> port; + int<8> hashRes; + bool useHash; + EthTypes type; + bit<7> pad; +}; + +struct row_t { + alt_t alt0; + alt_t alt1; +}; + +header bitvec_hdr { + row_t row; +} + +struct local_metadata_t { + @field_list(0) + row_t row0; + row_t row1; + bitvec_hdr bvh0; + bitvec_hdr bvh1; +}; + +struct parsed_packet_t { + bitvec_hdr bvh0; + bitvec_hdr bvh1; +}; + +parser parse(packet_in pk, out parsed_packet_t h, + inout local_metadata_t local_metadata, + in psa_ingress_parser_input_metadata_t x, + in EMPTY_RESUB resub_meta, + in EMPTY_RECIRC recirc_meta) { + state start { + pk.extract(h.bvh0); + pk.extract(h.bvh1); + transition accept; + } +} + +parser egressParserImpl( + packet_in buffer, + out EMPTY_H a, + inout local_metadata_t b, + in psa_egress_parser_input_metadata_t c, + in EMPTY_BRIDGE d, + in EMPTY_CLONE e, + in EMPTY_CLONE f) { + state start { + transition accept; + } +} + +control ingress(inout parsed_packet_t h, + inout local_metadata_t local_metadata, + in psa_ingress_input_metadata_t istd, + inout psa_ingress_output_metadata_t ostd) { + bitvec_hdr bh; + + action do_act() { + h.bvh1.row.alt1.valid = 0; + local_metadata.row0.alt0.valid = 0; + } + + table tns { + key = { + h.bvh1.row.alt1.valid : exact; + local_metadata.row0.alt0.valid : exact; + } + actions = { + do_act; + } + } + + apply { + + tns.apply(); + + // Copy another header's data to local variable. + bh.row.alt0.useHash = h.bvh0.row.alt0.useHash; + bh.row.alt1.type = EthTypes.IPv4; + h.bvh0.row.alt1.type = bh.row.alt1.type; + + local_metadata.row0.alt0.useHash = true; + psa_clone_i2e(ostd); + } +} + +control egressControlImpl( + inout EMPTY_H hdr, + inout local_metadata_t meta, + in psa_egress_input_metadata_t x, + inout psa_egress_output_metadata_t ostd) +{ + apply { } +} + + +control deparser(packet_out b, out EMPTY_CLONE clone_i2e_meta, + out EMPTY_RESUB resubmit_meta, + out EMPTY_BRIDGE normal_meta, + inout parsed_packet_t h, + in local_metadata_t local_metadata, + in psa_ingress_output_metadata_t istd) { + apply { + b.emit(h.bvh0); + b.emit(h.bvh1); + } +} + +control egressDeparserImpl( + packet_out buffer, + out EMPTY_CLONE a, + out EMPTY_RECIRC b, + inout EMPTY_H c, + in local_metadata_t d, + in psa_egress_output_metadata_t e, + in psa_egress_deparser_input_metadata_t f) { + apply { } +} +IngressPipeline(parse(), ingress(), deparser()) ip; +EgressPipeline(egressParserImpl(), egressControlImpl(), egressDeparserImpl()) ep; + +PSA_Switch( + ip, + PacketReplicationEngine(), + ep, + BufferingQueueingEngine()) main; diff --git a/testdata/p4_16_samples/psa-dpdk-issue1660.p4 b/testdata/p4_16_samples/psa-dpdk-issue1660.p4 new file mode 100644 index 00000000000..bbbea8f87fd --- /dev/null +++ b/testdata/p4_16_samples/psa-dpdk-issue1660.p4 @@ -0,0 +1,89 @@ +#include +#include + +header EMPTY_H {}; +struct EMPTY_RESUB {}; +struct EMPTY_CLONE {}; +struct EMPTY_BRIDGE {}; +struct EMPTY_RECIRC {}; + + +struct HasBool { + @field_list(0) + bool x; +} + +struct parsed_packet_t {} +struct local_metadata_t {} + +parser parse(packet_in pk, out parsed_packet_t h, inout local_metadata_t local_metadata, + in psa_ingress_parser_input_metadata_t x, + in EMPTY_RESUB resub_meta, + in EMPTY_RECIRC recirc_meta) { + state start { + transition accept; + } +} + +parser egressParserImpl( + packet_in buffer, + out EMPTY_H a, + inout local_metadata_t b, + in psa_egress_parser_input_metadata_t c, + in EMPTY_BRIDGE d, + in EMPTY_CLONE e, + in EMPTY_CLONE f) { + state start { + transition accept; + } +} +control ingress(inout parsed_packet_t h, inout local_metadata_t local_metadata, + in psa_ingress_input_metadata_t istd, + inout psa_ingress_output_metadata_t ostd) { + apply { + HasBool b; + b.x = true; + psa_clone_i2e(ostd); + } +} + +control egressControlImpl( + inout EMPTY_H hdr, + inout local_metadata_t meta, + in psa_egress_input_metadata_t x, + inout psa_egress_output_metadata_t ostd) +{ + apply { } +} + + +control deparser(packet_out b,out EMPTY_CLONE clone_i2e_meta, + out EMPTY_RESUB resubmit_meta, + out EMPTY_BRIDGE normal_meta, + inout parsed_packet_t hdr, + in local_metadata_t local_metadata, + in psa_ingress_output_metadata_t istd) { + apply { } +} + + +control egressDeparserImpl( + packet_out buffer, + out EMPTY_CLONE a, + out EMPTY_RECIRC b, + inout EMPTY_H c, + in local_metadata_t d, + in psa_egress_output_metadata_t e, + in psa_egress_deparser_input_metadata_t f) { + apply { } +} + + +IngressPipeline(parse(), ingress(), deparser()) ip; +EgressPipeline(egressParserImpl(), egressControlImpl(), egressDeparserImpl()) ep; + +PSA_Switch( + ip, + PacketReplicationEngine(), + ep, + BufferingQueueingEngine()) main; diff --git a/testdata/p4_16_samples/psa-dpdk-issue1781.p4 b/testdata/p4_16_samples/psa-dpdk-issue1781.p4 new file mode 100644 index 00000000000..701b1310a0a --- /dev/null +++ b/testdata/p4_16_samples/psa-dpdk-issue1781.p4 @@ -0,0 +1,94 @@ +/* -*- P4_16 -*- */ +#include +#include + +header EMPTY_H {}; +struct EMPTY_RESUB {}; +struct EMPTY_CLONE {}; +struct EMPTY_BRIDGE {}; +struct EMPTY_RECIRC {}; + + +struct headers { } +struct metadata { } + + +parser ParserImpl(packet_in packet, out headers hdr, inout metadata meta, in psa_ingress_parser_input_metadata_t x, + in EMPTY_RESUB resub_meta, + in EMPTY_RECIRC recirc_meta) { + state start { + transition accept; + } +} + +parser egressParserImpl( + packet_in buffer, + out EMPTY_H a, + inout metadata b, + in psa_egress_parser_input_metadata_t c, + in EMPTY_BRIDGE d, + in EMPTY_CLONE e, + in EMPTY_CLONE f) { + state start { + transition accept; + } +} + +bit<32> test_func() { + return 1; +} + + +control IngressImpl(inout headers hdr, inout metadata meta, in psa_ingress_input_metadata_t istd, + inout psa_ingress_output_metadata_t ostd) { + action update_value(out bit<32> value) { + value = test_func(); + } + + apply { + bit<32> value; + value = test_func(); + update_value(value); + } +} + + +control egressControlImpl( + inout EMPTY_H hdr, + inout metadata meta, + in psa_egress_input_metadata_t x, + inout psa_egress_output_metadata_t ostd) +{ + apply { } +} + + +control DeparserImpl(packet_out packet, out EMPTY_CLONE clone_i2e_meta, + out EMPTY_RESUB resubmit_meta, + out EMPTY_BRIDGE normal_meta, + inout headers hdr, + in metadata local_metadata, + in psa_ingress_output_metadata_t istd) { + apply { } +} + + +control egressDeparserImpl( + packet_out buffer, + out EMPTY_CLONE a, + out EMPTY_RECIRC b, + inout EMPTY_H c, + in metadata d, + in psa_egress_output_metadata_t e, + in psa_egress_deparser_input_metadata_t f) { + apply { } +} + +IngressPipeline(ParserImpl(), IngressImpl(), DeparserImpl()) ip; +EgressPipeline(egressParserImpl(), egressControlImpl(), egressDeparserImpl()) ep; + +PSA_Switch( + ip, + PacketReplicationEngine(), + ep, + BufferingQueueingEngine()) main; diff --git a/testdata/p4_16_samples/psa-dpdk-issue2314.p4 b/testdata/p4_16_samples/psa-dpdk-issue2314.p4 new file mode 100644 index 00000000000..1937e15c41a --- /dev/null +++ b/testdata/p4_16_samples/psa-dpdk-issue2314.p4 @@ -0,0 +1,138 @@ +/* +Copyright 2017 VMware, Inc. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +#include +#include + +header EMPTY_H {}; +struct EMPTY_RESUB {}; +struct EMPTY_CLONE {}; +struct EMPTY_BRIDGE {}; +struct EMPTY_RECIRC {}; + +header ethernet_t { + bit<48> dstAddr; + bit<48> srcAddr; + bit<16> etherType; +} + +header H { + bit<8> a; +} + +header I { + bit<16> etherType; +} + +struct h { + ethernet_t ether; + H h; + I i; +} + +struct m { } + + + +parser L3(packet_in b, inout h hdr) { + bit<16> etherType = hdr.ether.etherType; + + state start { + transition select(etherType) { + 0x0800: h0; + 0x8100: i; + default : accept; + } + } + state h0 { + b.extract(hdr.h); + transition accept; + } + state i { + b.extract(hdr.i); + etherType = hdr.i.etherType; + transition start; + } +} + + +parser MyParser(packet_in b, out h hdr, inout m meta, in psa_ingress_parser_input_metadata_t x, + in EMPTY_RESUB resub_meta, + in EMPTY_RECIRC recirc_meta) { + L3() l3; + + state start { + b.extract(hdr.ether); + l3.apply(b, hdr); + transition accept; + } +} + +parser egressParserImpl( + packet_in buffer, + out EMPTY_H a, + inout m b, + in psa_egress_parser_input_metadata_t c, + in EMPTY_BRIDGE d, + in EMPTY_CLONE e, + in EMPTY_CLONE f) { + state start { + transition accept; + } +} +control MyIngress(inout h hdr, inout m meta, in psa_ingress_input_metadata_t istd, + inout psa_ingress_output_metadata_t ostd) { + apply { } +} + +control egressControlImpl( + inout EMPTY_H hdr, + inout m meta, + in psa_egress_input_metadata_t x, + inout psa_egress_output_metadata_t ostd) +{ + apply { } +} + +control MyDeparser(packet_out b, out EMPTY_CLONE clone_i2e_meta, + out EMPTY_RESUB resubmit_meta, + out EMPTY_BRIDGE normal_meta, + inout h hdr, + in m local_metadata, + in psa_ingress_output_metadata_t istd) { + apply {b.emit(hdr);} +} + +control egressDeparserImpl( + packet_out buffer, + out EMPTY_CLONE a, + out EMPTY_RECIRC b, + inout EMPTY_H c, + in m d, + in psa_egress_output_metadata_t e, + in psa_egress_deparser_input_metadata_t f) { + apply { } +} + + +IngressPipeline(MyParser(), MyIngress(), MyDeparser()) ip; +EgressPipeline(egressParserImpl(), egressControlImpl(), egressDeparserImpl()) ep; + +PSA_Switch( + ip, + PacketReplicationEngine(), + ep, + BufferingQueueingEngine()) main; diff --git a/testdata/p4_16_samples/psa-dpdk-issue232.p4 b/testdata/p4_16_samples/psa-dpdk-issue232.p4 new file mode 100644 index 00000000000..f807af08f48 --- /dev/null +++ b/testdata/p4_16_samples/psa-dpdk-issue232.p4 @@ -0,0 +1,114 @@ +/* +Copyright 2017 VMware, Inc. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + + +#include +#include + +header EMPTY_H {}; +struct EMPTY_RESUB {}; +struct EMPTY_CLONE {}; +struct EMPTY_BRIDGE {}; +struct EMPTY_RECIRC {}; + + +typedef bit<48> EthernetAddress; +typedef bit<32> IPv4Address; + +struct Headers { +} + +struct Key { + bit<32> field1; +} + +struct Value { + bit<32> field1; +} + +struct Metadata { +} + +parser P(packet_in b, + out Headers p, + inout Metadata meta, + in psa_ingress_parser_input_metadata_t x, + in EMPTY_RESUB resub_meta, + in EMPTY_RECIRC recirc_meta) { + state start { + transition accept; + } +} + +parser egressParserImpl( + packet_in buffer, + out EMPTY_H a, + inout Metadata b, + in psa_egress_parser_input_metadata_t c, + in EMPTY_BRIDGE d, + in EMPTY_CLONE e, + in EMPTY_CLONE f) { + state start { + transition accept; + } +} + + +control Ing(inout Headers headers, + inout Metadata meta, + in psa_ingress_input_metadata_t istd, + inout psa_ingress_output_metadata_t ostd) { + + apply {} +} + +control egressControlImpl( + inout EMPTY_H hdr, + inout Metadata meta, + in psa_egress_input_metadata_t x, + inout psa_egress_output_metadata_t ostd) +{ + apply { } +} + +control DP(packet_out b,out EMPTY_CLONE clone_i2e_meta, + out EMPTY_RESUB resubmit_meta, + out EMPTY_BRIDGE normal_meta, + inout Headers h, + in Metadata local_metadata, + in psa_ingress_output_metadata_t istd) { + apply {} +} + +control egressDeparserImpl( + packet_out buffer, + out EMPTY_CLONE a, + out EMPTY_RECIRC b, + inout EMPTY_H c, + in Metadata d, + in psa_egress_output_metadata_t e, + in psa_egress_deparser_input_metadata_t f) { + apply { } +} + +IngressPipeline(P(), Ing(), DP()) ip; +EgressPipeline(egressParserImpl(), egressControlImpl(), egressDeparserImpl()) ep; + +PSA_Switch( + ip, + PacketReplicationEngine(), + ep, + BufferingQueueingEngine()) main; diff --git a/testdata/p4_16_samples/psa-dpdk-issue2330-1.p4 b/testdata/p4_16_samples/psa-dpdk-issue2330-1.p4 new file mode 100644 index 00000000000..db537dc2e1d --- /dev/null +++ b/testdata/p4_16_samples/psa-dpdk-issue2330-1.p4 @@ -0,0 +1,111 @@ +#include +#include + + +header EMPTY_H {}; +struct EMPTY_RESUB {}; +struct EMPTY_CLONE {}; +struct EMPTY_BRIDGE {}; +struct EMPTY_RECIRC {}; +#define MAX_LAYERS 2 +typedef bit<48> EthernetAddress; + + +header ethernet_t { + bit<48> dst_addr; + bit<48> src_addr; + bit<16> eth_type; +} + +struct Headers { + ethernet_t eth_hdr; +} + +struct Meta { +} + +void do_function(inout bit<16> val1, inout bit<48> val2) { +} + +parser p(packet_in pkt, out Headers hdr, inout Meta m, in psa_ingress_parser_input_metadata_t x, + in EMPTY_RESUB resub_meta, + in EMPTY_RECIRC recirc_meta) { + state start { + transition parse_hdrs; + } + state parse_hdrs { + pkt.extract(hdr.eth_hdr); + transition accept; + } +} + +parser egressParserImpl( + packet_in buffer, + out EMPTY_H a, + inout Meta b, + in psa_egress_parser_input_metadata_t c, + in EMPTY_BRIDGE d, + in EMPTY_CLONE e, + in EMPTY_CLONE f) { + state start { + transition accept; + } +} + +control ingress(inout Headers h, inout Meta m, in psa_ingress_input_metadata_t istd, + inout psa_ingress_output_metadata_t ostd) { + action do_action() { + + bool pointless_bool = true; + if (h.eth_hdr.dst_addr != 48w0) { + } else { + return; + } + do_function(h.eth_hdr.eth_type, h.eth_hdr.src_addr); + h.eth_hdr.src_addr = pointless_bool ? 48w1 : 48w2; + } + + apply { + do_action(); + } +} + + +control egressControlImpl( + inout EMPTY_H hdr, + inout Meta meta, + in psa_egress_input_metadata_t x, + inout psa_egress_output_metadata_t ostd) +{ + apply { } +} +control deparser(packet_out pkt, out EMPTY_CLONE clone_i2e_meta, + out EMPTY_RESUB resubmit_meta, + out EMPTY_BRIDGE normal_meta, + inout Headers h, + in Meta local_metadata, + in psa_ingress_output_metadata_t istd ) { + apply { + pkt.emit(h); + } +} + +control egressDeparserImpl( + packet_out buffer, + out EMPTY_CLONE a, + out EMPTY_RECIRC b, + inout EMPTY_H c, + in Meta d, + in psa_egress_output_metadata_t e, + in psa_egress_deparser_input_metadata_t f) { + apply { } +} + +IngressPipeline(p(), ingress(), deparser()) ip; +EgressPipeline(egressParserImpl(), egressControlImpl(), egressDeparserImpl()) ep; + +PSA_Switch( + ip, + PacketReplicationEngine(), + ep, + BufferingQueueingEngine()) main; diff --git a/testdata/p4_16_samples/psa-dpdk-issue242.p4 b/testdata/p4_16_samples/psa-dpdk-issue242.p4 new file mode 100644 index 00000000000..7ddfd0434dc --- /dev/null +++ b/testdata/p4_16_samples/psa-dpdk-issue242.p4 @@ -0,0 +1,142 @@ +#include +#include + +header EMPTY_H {}; +struct EMPTY_RESUB {}; +struct EMPTY_CLONE {}; +struct EMPTY_BRIDGE {}; +struct EMPTY_RECIRC {}; + + +// This program processes packets composed of an Ethernet and +// an IPv4 header, performing forwarding based on the +// destination IP address + +typedef bit<48> EthernetAddress; +typedef bit<32> IPv4Address; + +// standard Ethernet header +header ethernet_t { + EthernetAddress dstAddr; + EthernetAddress srcAddr; + bit<16> etherType; +} + +// IPv4 header without options +header ipv4_t { + bit<4> version; + bit<4> ihl; + bit<8> diffserv; + bit<16> packet_length; + bit<16> identification; + bit<3> flags; + bit<13> fragOffset; + bit<8> ttl; + bit<8> protocol; + bit<16> hdrChecksum; + IPv4Address srcAddr; + IPv4Address dstAddr; +} + +// Parser section + +// List of all recognized headers +struct Headers { + ethernet_t ethernet; + ipv4_t ip; +} + +struct Value { + bit<32> field1; +} + + +struct Metadata {} + +parser P(packet_in b, + out Headers p, + inout Metadata meta, + in psa_ingress_parser_input_metadata_t x, + in EMPTY_RESUB resub_meta, + in EMPTY_RECIRC recirc_meta) { + state start { + b.extract(p.ethernet); + transition select(p.ethernet.etherType) { + 0x0800 : parse_ipv4; + // no default rule: all other packets rejected + } + } + + state parse_ipv4 { + b.extract(p.ip); + transition accept; + } +} + +parser egressParserImpl( + packet_in buffer, + out EMPTY_H a, + inout Metadata b, + in psa_egress_parser_input_metadata_t c, + in EMPTY_BRIDGE d, + in EMPTY_CLONE e, + in EMPTY_CLONE f) { + state start { + transition accept; + } +} + + +// match-action pipeline section + +control Ing(inout Headers headers, + inout Metadata meta, + in psa_ingress_input_metadata_t istd, + inout psa_ingress_output_metadata_t ostd) { + apply { + ostd.egress_port =(PortId_t)(PortIdUint_t) 0; + } +} + +control egressControlImpl( + inout EMPTY_H hdr, + inout Metadata meta, + in psa_egress_input_metadata_t x, + inout psa_egress_output_metadata_t ostd) +{ + apply { } +} + +// deparser section +control DP(packet_out b, out EMPTY_CLONE clone_i2e_meta, + out EMPTY_RESUB resubmit_meta, + out EMPTY_BRIDGE normal_meta, + inout Headers p, + in Metadata local_metadata, + in psa_ingress_output_metadata_t istd) { + apply { + b.emit(p.ethernet); + b.emit(p.ip); + } +} + +control egressDeparserImpl( + packet_out buffer, + out EMPTY_CLONE a, + out EMPTY_RECIRC b, + inout EMPTY_H c, + in Metadata d, + in psa_egress_output_metadata_t e, + in psa_egress_deparser_input_metadata_t f) { + apply { } +} + + +IngressPipeline(P(), Ing(), DP()) ip; +EgressPipeline(egressParserImpl(), egressControlImpl(), egressDeparserImpl()) ep; + +PSA_Switch( + ip, + PacketReplicationEngine(), + ep, + BufferingQueueingEngine()) main; diff --git a/testdata/p4_16_samples/psa-dpdk-issue2488.p4 b/testdata/p4_16_samples/psa-dpdk-issue2488.p4 new file mode 100644 index 00000000000..c6ce06a4eb0 --- /dev/null +++ b/testdata/p4_16_samples/psa-dpdk-issue2488.p4 @@ -0,0 +1,100 @@ +#include +#include + +header EMPTY_H {}; +struct EMPTY_RESUB {}; +struct EMPTY_CLONE {}; +struct EMPTY_BRIDGE {}; +struct EMPTY_RECIRC {}; + +header ethernet_t { + bit<48> dst_addr; + bit<48> src_addr; + bit<16> eth_type; +} + + +header H { + bit<16> a; +} + +struct Headers { + ethernet_t eth_hdr; +} + +struct Meta { +} + +parser p(packet_in pkt, out Headers hdr, inout Meta m, in psa_ingress_parser_input_metadata_t x, + in EMPTY_RESUB resub_meta, + in EMPTY_RECIRC recirc_meta) { + state start { + transition parse_hdrs; + } + state parse_hdrs { + pkt.extract(hdr.eth_hdr); + transition accept; + } +} + +parser egressParserImpl( + packet_in buffer, + out EMPTY_H a, + inout Meta b, + in psa_egress_parser_input_metadata_t c, + in EMPTY_BRIDGE d, + in EMPTY_CLONE e, + in EMPTY_CLONE f) { + state start { + transition accept; + } +} +bit<48> set(inout bit<48> s) { + s = 1; + return 48w2; +} +control ingress(inout Headers h, inout Meta m, in psa_ingress_input_metadata_t istd, + inout psa_ingress_output_metadata_t ostd) { + Headers tmp = { { h.eth_hdr.dst_addr, set(h.eth_hdr.dst_addr), 1 } }; + tuple, bit<48>> t = { h.eth_hdr.dst_addr, set(h.eth_hdr.dst_addr) }; + apply { + h = tmp; + } +} + +control egressControlImpl( + inout EMPTY_H hdr, + inout Meta meta, + in psa_egress_input_metadata_t x, + inout psa_egress_output_metadata_t ostd) +{ + apply { } +} + + +control deparser(packet_out b,out EMPTY_CLONE clone_i2e_meta, + out EMPTY_RESUB resubmit_meta, + out EMPTY_BRIDGE normal_meta, + inout Headers h, + in Meta local_metadata, + in psa_ingress_output_metadata_t istd) { apply {b.emit(h);} } + +control egressDeparserImpl( + packet_out buffer, + out EMPTY_CLONE a, + out EMPTY_RECIRC b, + inout EMPTY_H c, + in Meta d, + in psa_egress_output_metadata_t e, + in psa_egress_deparser_input_metadata_t f) { + apply { } +} + +IngressPipeline(p(), ingress(), deparser()) ip; +EgressPipeline(egressParserImpl(), egressControlImpl(), egressDeparserImpl()) ep; + +PSA_Switch( + ip, + PacketReplicationEngine(), + ep, + BufferingQueueingEngine()) main; diff --git a/testdata/p4_16_samples/psa-dpdk-issue2614.p4 b/testdata/p4_16_samples/psa-dpdk-issue2614.p4 new file mode 100644 index 00000000000..902d10c6c17 --- /dev/null +++ b/testdata/p4_16_samples/psa-dpdk-issue2614.p4 @@ -0,0 +1,99 @@ +#include +#include + +header EMPTY_H {}; +struct EMPTY_RESUB {}; +struct EMPTY_CLONE {}; +struct EMPTY_BRIDGE {}; +struct EMPTY_RECIRC {}; + +header ethernet_t { + bit<48> dst_addr; + bit<48> src_addr; + bit<16> eth_type; +} + +header H { + bit<8> a; +} + +struct Headers { + ethernet_t eth_hdr; + H h; +} + +struct Meta { +} + +parser p(packet_in pkt, out Headers hdr, inout Meta m,in psa_ingress_parser_input_metadata_t x, + in EMPTY_RESUB resub_meta, + in EMPTY_RECIRC recirc_meta) { + state start { + transition parse_hdrs; + } + state parse_hdrs { + pkt.extract(hdr.eth_hdr); + pkt.extract(hdr.h); + transition accept; + } +} + +parser egressParserImpl( + packet_in buffer, + out EMPTY_H a, + inout Meta b, + in psa_egress_parser_input_metadata_t c, + in EMPTY_BRIDGE d, + in EMPTY_CLONE e, + in EMPTY_CLONE f) { + state start { + transition accept; + } +} + + +control ingress(inout Headers h, inout Meta m, in psa_ingress_input_metadata_t istd, + inout psa_ingress_output_metadata_t ostd) { + bit<8> tmp1 = 8w1; + apply { + h.h.a = ((bit<9>)tmp1 << 8w8)[8:1]; + } +} + +control egressControlImpl( + inout EMPTY_H hdr, + inout Meta meta, + in psa_egress_input_metadata_t x, + inout psa_egress_output_metadata_t ostd) +{ + apply { } +} + + +control deparser(packet_out b,out EMPTY_CLONE clone_i2e_meta, + out EMPTY_RESUB resubmit_meta, + out EMPTY_BRIDGE normal_meta, + inout Headers hdr, + in Meta local_metadata, + in psa_ingress_output_metadata_t istd) { apply {b.emit(hdr);} } + + +control egressDeparserImpl( + packet_out buffer, + out EMPTY_CLONE a, + out EMPTY_RECIRC b, + inout EMPTY_H c, + in Meta d, + in psa_egress_output_metadata_t e, + in psa_egress_deparser_input_metadata_t f) { + apply { } +} + +IngressPipeline(p(), ingress(), deparser()) ip; +EgressPipeline(egressParserImpl(), egressControlImpl(), egressDeparserImpl()) ep; + +PSA_Switch( + ip, + PacketReplicationEngine(), + ep, + BufferingQueueingEngine()) main; \ No newline at end of file diff --git a/testdata/p4_16_samples/psa-dpdk-issue272-1.p4 b/testdata/p4_16_samples/psa-dpdk-issue272-1.p4 new file mode 100644 index 00000000000..008463040a1 --- /dev/null +++ b/testdata/p4_16_samples/psa-dpdk-issue272-1.p4 @@ -0,0 +1,99 @@ +/* +Copyright 2017 VMware, Inc. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +#include +#include + +header EMPTY_H {}; +struct EMPTY_RESUB {}; +struct EMPTY_CLONE {}; +struct EMPTY_BRIDGE {}; +struct EMPTY_RECIRC {}; + + +struct some_meta_t { bool flag; } + +struct H { } + +struct M { some_meta_t some_meta; } + + +parser ParserI(packet_in pk, out H hdr, inout M meta, in psa_ingress_parser_input_metadata_t x, + in EMPTY_RESUB resub_meta, + in EMPTY_RECIRC recirc_meta) { + state start { transition accept; } +} + +parser egressParserImpl( + packet_in buffer, + out EMPTY_H a, + inout M b, + in psa_egress_parser_input_metadata_t c, + in EMPTY_BRIDGE d, + in EMPTY_CLONE e, + in EMPTY_CLONE f) { + state start { + transition accept; + } +} + +control IngressI(inout H hdr, inout M meta, in psa_ingress_input_metadata_t istd, + inout psa_ingress_output_metadata_t ostd) { + apply { + meta.some_meta.flag = true; + } +} + + +control egressControlImpl( + inout EMPTY_H hdr, + inout M meta, + in psa_egress_input_metadata_t x, + inout psa_egress_output_metadata_t ostd) +{ + apply { } +} + +control DeparserI(packet_out packet, out EMPTY_CLONE clone_i2e_meta, + out EMPTY_RESUB resubmit_meta, + out EMPTY_BRIDGE normal_meta, + inout H hdr, + in M local_metadata, + in psa_ingress_output_metadata_t istd ) { + apply { } +} + + +control egressDeparserImpl( + packet_out buffer, + out EMPTY_CLONE a, + out EMPTY_RECIRC b, + inout EMPTY_H c, + in M d, + in psa_egress_output_metadata_t e, + in psa_egress_deparser_input_metadata_t f) { + apply { } +} + + +IngressPipeline(ParserI(), IngressI(), DeparserI()) ip; +EgressPipeline(egressParserImpl(), egressControlImpl(), egressDeparserImpl()) ep; + +PSA_Switch( + ip, + PacketReplicationEngine(), + ep, + BufferingQueueingEngine()) main; diff --git a/testdata/p4_16_samples/psa-dpdk-issue3329.p4 b/testdata/p4_16_samples/psa-dpdk-issue3329.p4 new file mode 100644 index 00000000000..91340790952 --- /dev/null +++ b/testdata/p4_16_samples/psa-dpdk-issue3329.p4 @@ -0,0 +1,114 @@ +/* +Copyright 2019 Cisco Systems, Inc. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +#include +#include + +header EMPTY_H {}; +struct EMPTY_RESUB {}; +struct EMPTY_CLONE {}; +struct EMPTY_BRIDGE {}; +struct EMPTY_RECIRC {}; + + +struct s { + bit<32> b; +} + +@controller_header("packet_out") +header packet_out_header_t { + s b; +} + +struct headers_t { + packet_out_header_t packet_out; +} + +struct metadata_t { +} + +parser ParserImpl(packet_in packet, + out headers_t hdr, + inout metadata_t meta, + in psa_ingress_parser_input_metadata_t x, + in EMPTY_RESUB resub_meta, + in EMPTY_RECIRC recirc_meta) +{ + state start { + transition accept; + } +} + +parser egressParserImpl( + packet_in buffer, + out EMPTY_H a, + inout metadata_t b, + in psa_egress_parser_input_metadata_t c, + in EMPTY_BRIDGE d, + in EMPTY_CLONE e, + in EMPTY_CLONE f) { + state start { + transition accept; + } +} + +control ingress(inout headers_t hdr, + inout metadata_t meta, + in psa_ingress_input_metadata_t istd, + inout psa_ingress_output_metadata_t ostd) +{ + apply { + } +} + +control egressControlImpl( + inout EMPTY_H hdr, + inout metadata_t meta, + in psa_egress_input_metadata_t x, + inout psa_egress_output_metadata_t ostd) +{ + apply { } +} + +control DeparserImpl(packet_out packet, out EMPTY_CLONE clone_i2e_meta, + out EMPTY_RESUB resubmit_meta, + out EMPTY_BRIDGE normal_meta, + inout headers_t h, + in metadata_t local_metadata, + in psa_ingress_output_metadata_t istd) { + apply { + } +} + +control egressDeparserImpl( + packet_out buffer, + out EMPTY_CLONE a, + out EMPTY_RECIRC b, + inout EMPTY_H c, + in metadata_t d, + in psa_egress_output_metadata_t e, + in psa_egress_deparser_input_metadata_t f) { + apply { } +} + +IngressPipeline(ParserImpl(), ingress(), DeparserImpl()) ip; +EgressPipeline(egressParserImpl(), egressControlImpl(), egressDeparserImpl()) ep; + +PSA_Switch( + ip, + PacketReplicationEngine(), + ep, + BufferingQueueingEngine()) main; diff --git a/testdata/p4_16_samples/psa-dpdk-issue3374.p4 b/testdata/p4_16_samples/psa-dpdk-issue3374.p4 new file mode 100644 index 00000000000..8e1a08d78d1 --- /dev/null +++ b/testdata/p4_16_samples/psa-dpdk-issue3374.p4 @@ -0,0 +1,192 @@ +/* +Copyright 2022 Intel Corporation + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ +#include +#include + +header EMPTY_H {}; +struct EMPTY_RESUB {}; +struct EMPTY_CLONE {}; +struct EMPTY_BRIDGE {}; +struct EMPTY_RECIRC {}; +#define MAX_LAYERS 2 +typedef bit<48> EthernetAddress; + +enum bit<16> ether_type_t { + TPID = 0x8100, + IPV4 = 0x0800, + IPV6 = 0x86DD +} + +header ethernet_t { + EthernetAddress dstAddr; + EthernetAddress srcAddr; + bit<16> etherType; +} + +header vlan_tag_h { + bit<3> pcp; + bit<1> cfi; + bit<12> vid; + ether_type_t ether_type; +} + +struct headers_t { + ethernet_t ethernet; + vlan_tag_h[MAX_LAYERS] vlan_tag; +} + +struct main_metadata_t { + bit<2> depth; + bit<16> ethType; +} + +parser ingressParserImpl( + packet_in pkt, + out headers_t hdrs, + inout main_metadata_t meta, + in psa_ingress_parser_input_metadata_t x, + in EMPTY_RESUB resub_meta, + in EMPTY_RECIRC recirc_meta) +{ + state start { + meta.depth = MAX_LAYERS - 1; + pkt.extract(hdrs.ethernet); + transition select(hdrs.ethernet.etherType) { + ether_type_t.TPID : parse_vlan_tag; + default: accept; + } + } + state parse_vlan_tag { + pkt.extract(hdrs.vlan_tag.next); + meta.depth = meta.depth - 1; + transition select(hdrs.vlan_tag.last.ether_type) { + ether_type_t.TPID : parse_vlan_tag; + default: accept; + } + } +} + +parser egressParserImpl( + packet_in buffer, + out EMPTY_H a, + inout main_metadata_t b, + in psa_egress_parser_input_metadata_t c, + in EMPTY_BRIDGE d, + in EMPTY_CLONE e, + in EMPTY_CLONE f) { + state start { + transition accept; + } +} + + +control ingressControlImpl( + inout headers_t hdrs, + inout main_metadata_t meta, + in psa_ingress_input_metadata_t istd, + inout psa_ingress_output_metadata_t ostd) +{ + action drop_packet() { + ingress_drop(ostd); + } + action execute() { + meta.ethType = hdrs.vlan_tag[meta.depth - 1].ether_type; + hdrs.vlan_tag[meta.depth - 1].ether_type = (ether_type_t)16w2; + hdrs.vlan_tag[meta.depth].vid = (bit<12>)hdrs.vlan_tag[meta.depth].cfi; + hdrs.vlan_tag[meta.depth].vid = hdrs.vlan_tag[meta.depth-1].vid; + // hdrs.vlan_tag[meta.depth].vid = hdrs.vlan_tag[1].vid; + } + action execute_1() { + drop_packet(); + } + + table stub { + key = { + hdrs.vlan_tag[meta.depth].vid : exact; + } + + actions = { + execute; + } + const default_action = execute; + size=1000000; + } + + table stub1 { + key = { + hdrs.ethernet.etherType : exact; + } + + actions = { + execute_1; + } + const default_action = execute_1; + size=1000000; + } + apply { + switch (hdrs.vlan_tag[meta.depth].vid) { +// switch (hdrs.vlan_tag[0].vid) { + 12w1: { stub.apply();} + 12w2: { + if (hdrs.vlan_tag[meta.depth].ether_type == hdrs.ethernet.etherType) + stub1.apply(); + } + } + } +} + +control egressControlImpl( + inout EMPTY_H hdr, + inout main_metadata_t meta, + in psa_egress_input_metadata_t x, + inout psa_egress_output_metadata_t ostd) +{ + apply { } +} + +control ingressDeparserImpl( + packet_out pkt, + out EMPTY_CLONE clone_i2e_meta, + out EMPTY_RESUB resubmit_meta, + out EMPTY_BRIDGE normal_meta, + inout headers_t hdr, + in main_metadata_t local_metadata, + in psa_ingress_output_metadata_t istd ) +{ + apply { + pkt.emit(hdr.ethernet); + } +} + +control egressDeparserImpl( + packet_out buffer, + out EMPTY_CLONE a, + out EMPTY_RECIRC b, + inout EMPTY_H c, + in main_metadata_t d, + in psa_egress_output_metadata_t e, + in psa_egress_deparser_input_metadata_t f) { + apply { } +} + +IngressPipeline(ingressParserImpl(), ingressControlImpl(), ingressDeparserImpl()) ip; +EgressPipeline(egressParserImpl(), egressControlImpl(), egressDeparserImpl()) ep; + +PSA_Switch( + ip, + PacketReplicationEngine(), + ep, + BufferingQueueingEngine()) main; diff --git a/testdata/p4_16_samples/psa-dpdk-issue361.p4 b/testdata/p4_16_samples/psa-dpdk-issue361.p4 new file mode 100644 index 00000000000..302fc98948e --- /dev/null +++ b/testdata/p4_16_samples/psa-dpdk-issue361.p4 @@ -0,0 +1,112 @@ +/* +Copyright 2017 VMware, Inc. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ +#include +#include + +header EMPTY_H {}; +struct EMPTY_RESUB {}; +struct EMPTY_CLONE {}; +struct EMPTY_BRIDGE {}; +struct EMPTY_RECIRC {}; + +header H { bit<32> f; } + +struct my_packet { + H h; +} + +struct my_metadata { +} + +parser MyParser(packet_in b, out my_packet p, inout my_metadata m, in psa_ingress_parser_input_metadata_t x, + in EMPTY_RESUB resub_meta, + in EMPTY_RECIRC recirc_meta) { + bool bv = true; + state start { + transition select(bv) { + false: next; + true: accept; + } + } + + state next { + b.extract(p.h); + transition accept; + } +} + + +parser egressParserImpl( + packet_in buffer, + out EMPTY_H a, + inout my_metadata b, + in psa_egress_parser_input_metadata_t c, + in EMPTY_BRIDGE d, + in EMPTY_CLONE e, + in EMPTY_CLONE f) { + state start { + transition accept; + } +} + + +control C() { + apply {} +} + +control MyIngress(inout my_packet p, inout my_metadata m,in psa_ingress_input_metadata_t istd, + inout psa_ingress_output_metadata_t ostd) { + apply { } +} + +control egressControlImpl( + inout EMPTY_H hdr, + inout my_metadata meta, + in psa_egress_input_metadata_t x, + inout psa_egress_output_metadata_t ostd) +{ + apply { } +} + +control MyDeparser(packet_out b,out EMPTY_CLONE clone_i2e_meta, + out EMPTY_RESUB resubmit_meta, + out EMPTY_BRIDGE normal_meta, + inout my_packet hdr, + in my_metadata local_metadata, + in psa_ingress_output_metadata_t istd) { + apply { } +} + +control egressDeparserImpl( + packet_out buffer, + out EMPTY_CLONE a, + out EMPTY_RECIRC b, + inout EMPTY_H c, + in my_metadata d, + in psa_egress_output_metadata_t e, + in psa_egress_deparser_input_metadata_t f) { + apply { } +} + + +IngressPipeline(MyParser(), MyIngress(), MyDeparser()) ip; +EgressPipeline(egressParserImpl(), egressControlImpl(), egressDeparserImpl()) ep; + +PSA_Switch( + ip, + PacketReplicationEngine(), + ep, + BufferingQueueingEngine()) main; diff --git a/testdata/p4_16_samples/psa-dpdk-issue447-3.p4 b/testdata/p4_16_samples/psa-dpdk-issue447-3.p4 new file mode 100644 index 00000000000..3055ed5304b --- /dev/null +++ b/testdata/p4_16_samples/psa-dpdk-issue447-3.p4 @@ -0,0 +1,100 @@ +#include +#include + +header EMPTY_H {}; +struct EMPTY_RESUB {}; +struct EMPTY_CLONE {}; +struct EMPTY_BRIDGE {}; +struct EMPTY_RECIRC {}; + +header S { + bit<32> size; +} + +header H { + varbit<32> var; +} + +struct Parsed_packet { + S s1; + H h; + S s2; +} + +struct Metadata { +} + +parser parserI(packet_in pkt, out Parsed_packet hdr, inout Metadata meta, in psa_ingress_parser_input_metadata_t x, + in EMPTY_RESUB resub_meta, + in EMPTY_RECIRC recirc_meta) { + state start { + pkt.extract(hdr.s1); + bit<32> size = hdr.s1.size; + pkt.extract(hdr.h, size); + pkt.extract(hdr.s2); + transition accept; + } +} + +parser egressParserImpl( + packet_in buffer, + out EMPTY_H a, + inout Metadata b, + in psa_egress_parser_input_metadata_t c, + in EMPTY_BRIDGE d, + in EMPTY_CLONE e, + in EMPTY_CLONE f) { + state start { + transition accept; + } +} + + + +control ingress(inout Parsed_packet hdr, inout Metadata meta, in psa_ingress_input_metadata_t istd, + inout psa_ingress_output_metadata_t ostd) { + apply { + } +} + +control egressControlImpl( + inout EMPTY_H hdr, + inout Metadata meta, + in psa_egress_input_metadata_t x, + inout psa_egress_output_metadata_t ostd) +{ + apply { } +} + +control DeparserI(packet_out packet, out EMPTY_CLONE clone_i2e_meta, + out EMPTY_RESUB resubmit_meta, + out EMPTY_BRIDGE normal_meta, + inout Parsed_packet hdr, + in Metadata local_metadata, + in psa_ingress_output_metadata_t istd) { + apply { + packet.emit(hdr.s2); + } +} + + +control egressDeparserImpl( + packet_out buffer, + out EMPTY_CLONE a, + out EMPTY_RECIRC b, + inout EMPTY_H c, + in Metadata d, + in psa_egress_output_metadata_t e, + in psa_egress_deparser_input_metadata_t f) { + apply { } +} + + +IngressPipeline(parserI(), ingress(), DeparserI()) ip; +EgressPipeline(egressParserImpl(), egressControlImpl(), egressDeparserImpl()) ep; + +PSA_Switch( + ip, + PacketReplicationEngine(), + ep, + BufferingQueueingEngine()) main; diff --git a/testdata/p4_16_samples/psa-dpdk-issue447-5.p4 b/testdata/p4_16_samples/psa-dpdk-issue447-5.p4 new file mode 100644 index 00000000000..b1493c82d0d --- /dev/null +++ b/testdata/p4_16_samples/psa-dpdk-issue447-5.p4 @@ -0,0 +1,108 @@ +#include +#include + +// Define additional error values, one of them for packets with +// incorrect IPv4 header checksums. +error { + UnhandledIPv4Options, + BadIPv4HeaderChecksum +} + +header EMPTY_H {}; +struct EMPTY_RESUB {}; +struct EMPTY_CLONE {}; +struct EMPTY_BRIDGE {}; +struct EMPTY_RECIRC {}; + +header S { + bit<32> size; +} + +header H { + varbit<32> var; +} + +struct Parsed_packet { + S s1; + H h1; + H h2; +} + +struct Metadata { +} + +parser parserI(packet_in pkt, out Parsed_packet hdr, inout Metadata meta, in psa_ingress_parser_input_metadata_t x, + in EMPTY_RESUB resub_meta, + in EMPTY_RECIRC recirc_meta) { + state start { + pkt.extract(hdr.s1); + pkt.extract(hdr.h1, hdr.s1.size); + pkt.extract(hdr.h2, hdr.s1.size); + transition accept; + } +} + +parser egressParserImpl( + packet_in buffer, + out EMPTY_H a, + inout Metadata b, + in psa_egress_parser_input_metadata_t c, + in EMPTY_BRIDGE d, + in EMPTY_CLONE e, + in EMPTY_CLONE f) { + state start { + transition accept; + } +} + +control DeparserI(packet_out packet, out EMPTY_CLONE clone_i2e_meta, + out EMPTY_RESUB resubmit_meta, + out EMPTY_BRIDGE normal_meta, + inout Parsed_packet hdr, + in Metadata local_metadata, + in psa_ingress_output_metadata_t istd) { + apply { + packet.emit(hdr.h1); + packet.emit(hdr.h2); + } +} + +control ingress(inout Parsed_packet hdr, inout Metadata meta, in psa_ingress_input_metadata_t istd, + inout psa_ingress_output_metadata_t ostd) { + varbit<32> s; + apply { + // swap + s = hdr.h1.var; + hdr.h1.var = hdr.h2.var; + hdr.h2.var = s; + } +} + +control egressControlImpl( + inout EMPTY_H hdr, + inout Metadata meta, + in psa_egress_input_metadata_t x, + inout psa_egress_output_metadata_t ostd) +{ + apply { } +} + +control egressDeparserImpl( + packet_out buffer, + out EMPTY_CLONE a, + out EMPTY_RECIRC b, + inout EMPTY_H c, + in Metadata d, + in psa_egress_output_metadata_t e, + in psa_egress_deparser_input_metadata_t f) { + apply { } +} + +IngressPipeline(parserI(), ingress(), DeparserI()) ip; +EgressPipeline(egressParserImpl(), egressControlImpl(), egressDeparserImpl()) ep; + +PSA_Switch( + ip, + PacketReplicationEngine(), + ep, + BufferingQueueingEngine()) main; diff --git a/testdata/p4_16_samples/psa-dpdk-issue496.p4 b/testdata/p4_16_samples/psa-dpdk-issue496.p4 new file mode 100644 index 00000000000..62d65e29652 --- /dev/null +++ b/testdata/p4_16_samples/psa-dpdk-issue496.p4 @@ -0,0 +1,102 @@ + +#include +#include + +header EMPTY_H {}; +struct EMPTY_RESUB {}; +struct EMPTY_CLONE {}; +struct EMPTY_BRIDGE {}; +struct EMPTY_RECIRC {}; + +header h_t { + bit<8> f; +} + +struct my_packet { + h_t h; +} + +struct my_metadata { } + +parser MyParser(packet_in b, out my_packet p, inout my_metadata m, in psa_ingress_parser_input_metadata_t x, + in EMPTY_RESUB resub_meta, + in EMPTY_RECIRC recirc_meta) { + state start { + transition accept; + } +} + +parser egressParserImpl( + packet_in buffer, + out EMPTY_H a, + inout my_metadata b, + in psa_egress_parser_input_metadata_t c, + in EMPTY_BRIDGE d, + in EMPTY_CLONE e, + in EMPTY_CLONE f) { + state start { + transition accept; + } +} + +control E(); + +control D() { + apply { } +} + +control C()(E d) { + apply { + d.apply(); + } +} + +control MyIngress(inout my_packet p, inout my_metadata m, + in psa_ingress_input_metadata_t istd, + inout psa_ingress_output_metadata_t ostd) { + D() d; + C(d) c; + apply { c.apply(); } +} + + +control egressControlImpl( + inout EMPTY_H hdr, + inout my_metadata meta, + in psa_egress_input_metadata_t x, + inout psa_egress_output_metadata_t ostd) +{ + apply { } +} + + + +control MyDeparser(packet_out b, out EMPTY_CLONE clone_i2e_meta, + out EMPTY_RESUB resubmit_meta, + out EMPTY_BRIDGE normal_meta, + inout my_packet hdr, + in my_metadata local_metadata, + in psa_ingress_output_metadata_t istd ) { + apply { } +} + +control egressDeparserImpl( + packet_out buffer, + out EMPTY_CLONE a, + out EMPTY_RECIRC b, + inout EMPTY_H c, + in my_metadata d, + in psa_egress_output_metadata_t e, + in psa_egress_deparser_input_metadata_t f) { + apply { } +} + + +IngressPipeline(MyParser(), MyIngress(), MyDeparser()) ip; +EgressPipeline(egressParserImpl(), egressControlImpl(), egressDeparserImpl()) ep; + +PSA_Switch( + ip, + PacketReplicationEngine(), + ep, + BufferingQueueingEngine()) main; diff --git a/testdata/p4_16_samples/psa-dpdk-issue949.p4 b/testdata/p4_16_samples/psa-dpdk-issue949.p4 new file mode 100644 index 00000000000..b5ba6c7dd11 --- /dev/null +++ b/testdata/p4_16_samples/psa-dpdk-issue949.p4 @@ -0,0 +1,133 @@ +#define DCE_BUG 1 + + +#include +#include + +header EMPTY_H {}; +struct EMPTY_RESUB {}; +struct EMPTY_CLONE {}; +struct EMPTY_BRIDGE {}; +struct EMPTY_RECIRC {}; + + +struct routing_metadata_t { + bit<32> nhop_ipv4; +} + +header ethernet_t { + bit<48> dstAddr; + bit<48> srcAddr; + bit<16> etherType; +} + +header ipv4_t { + bit<4> version; + bit<4> ihl; + bit<8> diffserv; + // ... +} + +struct metadata { + routing_metadata_t routing_metadata; +} + +struct headers { + ethernet_t ethernet; + ipv4_t ipv4; +} + +parser ParserImpl(packet_in packet, out headers hdr, inout metadata meta, in psa_ingress_parser_input_metadata_t x, + in EMPTY_RESUB resub_meta, + in EMPTY_RECIRC recirc_meta) { + state start { + packet.extract(hdr.ethernet); + transition select(hdr.ethernet.etherType) { + 16w0x800: parse_ipv4; + default: accept; + } + } + state parse_ipv4 { + packet.extract(hdr.ipv4); + transition accept; + } +} + +parser egressParserImpl( + packet_in buffer, + out EMPTY_H a, + inout metadata b, + in psa_egress_parser_input_metadata_t c, + in EMPTY_BRIDGE d, + in EMPTY_CLONE e, + in EMPTY_CLONE f) { + state start { + transition accept; + } +} + +control ingress(inout headers hdr, inout metadata meta, in psa_ingress_input_metadata_t istd, + inout psa_ingress_output_metadata_t ostd) { + action setDest() { + hdr.ethernet.dstAddr = 48w0x_6A_F3_40_04_26_D3; + } + table someTable { + key = { + hdr.ethernet.srcAddr : exact; + } + actions = { + setDest; + } + } + apply { +#if DCE_BUG + bool didHit = someTable.apply().hit; +#else + someTable.apply(); +#endif + } +} + + +control egressControlImpl( + inout EMPTY_H hdr, + inout metadata meta, + in psa_egress_input_metadata_t x, + inout psa_egress_output_metadata_t ostd) +{ + apply { } +} + +control DeparserImpl(packet_out packet, out EMPTY_CLONE clone_i2e_meta, + out EMPTY_RESUB resubmit_meta, + out EMPTY_BRIDGE normal_meta, + inout headers hdr, + in metadata local_metadata, + in psa_ingress_output_metadata_t istd) { + apply { + packet.emit(hdr.ethernet); + packet.emit(hdr.ipv4); + } +} + + +control egressDeparserImpl( + packet_out buffer, + out EMPTY_CLONE a, + out EMPTY_RECIRC b, + inout EMPTY_H c, + in metadata d, + in psa_egress_output_metadata_t e, + in psa_egress_deparser_input_metadata_t f) { + apply { } +} + + +IngressPipeline(ParserImpl(), ingress(), DeparserImpl()) ip; +EgressPipeline(egressParserImpl(), egressControlImpl(), egressDeparserImpl()) ep; + +PSA_Switch( + ip, + PacketReplicationEngine(), + ep, + BufferingQueueingEngine()) main; diff --git a/testdata/p4_16_samples/psa-dpdk-issue955.p4 b/testdata/p4_16_samples/psa-dpdk-issue955.p4 new file mode 100644 index 00000000000..65862870f62 --- /dev/null +++ b/testdata/p4_16_samples/psa-dpdk-issue955.p4 @@ -0,0 +1,98 @@ +/* +Copyright 2013-present Barefoot Networks, Inc. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +#include +#include + +header EMPTY_H {}; +struct EMPTY_RESUB {}; +struct EMPTY_CLONE {}; +struct EMPTY_BRIDGE {}; +struct EMPTY_RECIRC {}; + + +header Header { bit<32> data; } +struct H { Header h; }; +struct M { + bit<32> hash1; +} + +parser ParserI(packet_in pk, out H hdr, inout M meta, in psa_ingress_parser_input_metadata_t x, + in EMPTY_RESUB resub_meta, + in EMPTY_RECIRC recirc_meta) { + state start { transition accept; } +} + +action empty() { } + +parser egressParserImpl( + packet_in buffer, + out EMPTY_H a, + inout M b, + in psa_egress_parser_input_metadata_t c, + in EMPTY_BRIDGE d, + in EMPTY_CLONE e, + in EMPTY_CLONE f) { + state start { + transition accept; + } +} + +control IngressI(inout H hdr, inout M meta, in psa_ingress_input_metadata_t istd, + inout psa_ingress_output_metadata_t ostd) { + apply { bool b = hdr.h.isValid(); } +}; + +control egressControlImpl( + inout EMPTY_H hdr, + inout M meta, + in psa_egress_input_metadata_t x, + inout psa_egress_output_metadata_t ostd) +{ + apply { } +} + +control DeparserI(packet_out pk, out EMPTY_CLONE clone_i2e_meta, + out EMPTY_RESUB resubmit_meta, + out EMPTY_BRIDGE normal_meta, + inout H hdr, + in M local_metadata, + in psa_ingress_output_metadata_t istd ) { + apply { } +} + + + +control egressDeparserImpl( + packet_out buffer, + out EMPTY_CLONE a, + out EMPTY_RECIRC b, + inout EMPTY_H c, + in M d, + in psa_egress_output_metadata_t e, + in psa_egress_deparser_input_metadata_t f) { + apply { } +} + + +IngressPipeline(ParserI(), IngressI(), DeparserI()) ip; +EgressPipeline(egressParserImpl(), egressControlImpl(), egressDeparserImpl()) ep; + +PSA_Switch( + ip, + PacketReplicationEngine(), + ep, + BufferingQueueingEngine()) main; diff --git a/testdata/p4_16_samples/psa-dpdk-issue983.p b/testdata/p4_16_samples/psa-dpdk-issue983.p new file mode 100644 index 00000000000..be6be02ac73 --- /dev/null +++ b/testdata/p4_16_samples/psa-dpdk-issue983.p @@ -0,0 +1,187 @@ +/* +Copyright 2017 Cisco Systems, Inc. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +#include +#include + +header EMPTY_H {}; +struct EMPTY_RESUB {}; +struct EMPTY_CLONE {}; +struct EMPTY_BRIDGE {}; +struct EMPTY_RECIRC {}; + + +typedef bit<48> EthernetAddress; + +header ethernet_t { + EthernetAddress dstAddr; + EthernetAddress srcAddr; + bit<16> etherType; +} + +struct fwd_meta_t { + bit<16> tmp; + bit<32> x1; + bit<16> x2; + bit<32> x3; + bit<32> x4; + bit<16> exp_etherType; + bit<32> exp_x1; + bit<16> exp_x2; + bit<32> exp_x3; + bit<32> exp_x4; +} + +struct metadata { + fwd_meta_t fwd_meta; +} + +struct headers { + ethernet_t ethernet; +} + + +parser IngressParserImpl(packet_in buffer, + out headers hdr, + inout metadata user_meta, + in psa_ingress_parser_input_metadata_t x, + in EMPTY_RESUB resub_meta, + in EMPTY_RECIRC recirc_meta) +{ + state start { + buffer.extract(hdr.ethernet); + transition accept; + } +} + +parser egressParserImpl( + packet_in buffer, + out EMPTY_H a, + inout metadata b, + in psa_egress_parser_input_metadata_t c, + in EMPTY_BRIDGE d, + in EMPTY_CLONE e, + in EMPTY_CLONE f) { + state start { + transition accept; + } +} + +control ingress(inout headers hdr, + inout metadata user_meta, + in psa_ingress_input_metadata_t istd, + inout psa_ingress_output_metadata_t ostd) { + table debug_table_cksum1 { + key = { + hdr.ethernet.srcAddr : exact; + hdr.ethernet.dstAddr : exact; + hdr.ethernet.etherType : exact; + user_meta.fwd_meta.exp_etherType : exact; + user_meta.fwd_meta.tmp : exact; + user_meta.fwd_meta.exp_x1 : exact; + user_meta.fwd_meta.x1 : exact; + user_meta.fwd_meta.exp_x2 : exact; + user_meta.fwd_meta.x2 : exact; + user_meta.fwd_meta.exp_x3 : exact; + user_meta.fwd_meta.x3 : exact; + user_meta.fwd_meta.exp_x4 : exact; + user_meta.fwd_meta.x4 : exact; + } + actions = { NoAction; } + } + bit<16> tmp; + bit<32> x1; + bit<16> x2; + apply { + tmp = ~hdr.ethernet.etherType; + + x1 = (bit<32>) tmp; + x2 = x1[31:16] + x1[15:0]; + + user_meta.fwd_meta.tmp = tmp; + user_meta.fwd_meta.x1 = x1; + user_meta.fwd_meta.x2 = x2; + user_meta.fwd_meta.x3 = (bit<32>) ~hdr.ethernet.etherType; + user_meta.fwd_meta.x4 = ~((bit<32>) hdr.ethernet.etherType); + + user_meta.fwd_meta.exp_etherType = 0x0800; + user_meta.fwd_meta.exp_x1 = (bit<32>) (~16w0x0800); + user_meta.fwd_meta.exp_x2 = (~16w0x0800); + user_meta.fwd_meta.exp_x3 = (bit<32>) (~16w0x0800); + user_meta.fwd_meta.exp_x4 = (~32w0x0800); + + // Use dstAddr field of Ethernet header to store 'error + // codes', so they are easily checkable in output packet. + hdr.ethernet.dstAddr = 0; + if (hdr.ethernet.etherType != user_meta.fwd_meta.exp_etherType) { + hdr.ethernet.dstAddr[47:40] = 1; + } + if (user_meta.fwd_meta.x1 != user_meta.fwd_meta.exp_x1) { + hdr.ethernet.dstAddr[39:32] = 1; + } + if (user_meta.fwd_meta.x2 != user_meta.fwd_meta.exp_x2) { + hdr.ethernet.dstAddr[31:24] = 1; + } + if (user_meta.fwd_meta.x3 != user_meta.fwd_meta.exp_x3) { + hdr.ethernet.dstAddr[23:16] = 1; + } + if (user_meta.fwd_meta.x4 != user_meta.fwd_meta.exp_x4) { + hdr.ethernet.dstAddr[15:8] = 1; + } + debug_table_cksum1.apply(); + } +} + +control egressControlImpl( + inout EMPTY_H hdr, + inout metadata meta, + in psa_egress_input_metadata_t x, + inout psa_egress_output_metadata_t ostd) +{ + apply { } +} + +control DeparserImpl(packet_out packet, out EMPTY_CLONE clone_i2e_meta, + out EMPTY_RESUB resubmit_meta, + out EMPTY_BRIDGE normal_meta, + inout headers hdr, + in metadata local_metadata, + in psa_ingress_output_metadata_t istd) { + apply { + packet.emit(hdr.ethernet); + } +} + +control egressDeparserImpl( + packet_out buffer, + out EMPTY_CLONE a, + out EMPTY_RECIRC b, + inout EMPTY_H c, + in metadata d, + in psa_egress_output_metadata_t e, + in psa_egress_deparser_input_metadata_t f) { + apply { } +} + +IngressPipeline(IngressParserImpl(), ingress(), DeparserImpl()) ip; +EgressPipeline(egressParserImpl(), egressControlImpl(), egressDeparserImpl()) ep; + +PSA_Switch( + ip, + PacketReplicationEngine(), + ep, + BufferingQueueingEngine()) main; + diff --git a/testdata/p4_16_samples/psa-dpdk-issue995.p4 b/testdata/p4_16_samples/psa-dpdk-issue995.p4 new file mode 100644 index 00000000000..6aa425a7416 --- /dev/null +++ b/testdata/p4_16_samples/psa-dpdk-issue995.p4 @@ -0,0 +1,136 @@ +/* +Copyright 2017 Cisco Systems, Inc. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ +#include +#include + +header EMPTY_H {}; +struct EMPTY_RESUB {}; +struct EMPTY_CLONE {}; +struct EMPTY_BRIDGE {}; +struct EMPTY_RECIRC {}; + +header ethernet_t { + bit<48> dstAddr; + bit<48> srcAddr; + bit<16> etherType; +} + +struct metadata { + bit<16> transition_taken; +} + +struct headers { + ethernet_t ethernet; +} + +parser ParserImpl(packet_in packet, out headers hdr, inout metadata meta, in psa_ingress_parser_input_metadata_t x, + in EMPTY_RESUB resub_meta, + in EMPTY_RECIRC recirc_meta) { + state start { + transition parse_ethernet; + } + state parse_ethernet { + packet.extract(hdr.ethernet); + transition select(hdr.ethernet.srcAddr, hdr.ethernet.dstAddr) { + (0x12f_0000 , 0x456 ): a1; + (0x12f_0000 &&& 0xffff_0000, 0x456 ): a2; + (0x12f_0000 , 0x456 &&& 0xfff ): a3; + (0x12f_0000 &&& 0xffff_0000, 0x456 &&& 0xfff ): a4; + default: a5; + } + } + state a1 { + meta.transition_taken = 1; + transition accept; + } + state a2 { + meta.transition_taken = 2; + transition accept; + } + state a3 { + meta.transition_taken = 3; + transition accept; + } + state a4 { + meta.transition_taken = 4; + transition accept; + } + state a5 { + meta.transition_taken = 5; + transition accept; + } +} +parser egressParserImpl( + packet_in buffer, + out EMPTY_H a, + inout metadata b, + in psa_egress_parser_input_metadata_t c, + in EMPTY_BRIDGE d, + in EMPTY_CLONE e, + in EMPTY_CLONE f) { + state start { + transition accept; + } +} + +control ingress(inout headers hdr, inout metadata meta, in psa_ingress_input_metadata_t istd, + inout psa_ingress_output_metadata_t ostd) { + apply { + hdr.ethernet.etherType = meta.transition_taken; + } +} + + +control egressControlImpl( + inout EMPTY_H hdr, + inout metadata meta, + in psa_egress_input_metadata_t x, + inout psa_egress_output_metadata_t ostd) +{ + apply { } +} + +control DeparserImpl(packet_out packet, out EMPTY_CLONE clone_i2e_meta, + out EMPTY_RESUB resubmit_meta, + out EMPTY_BRIDGE normal_meta, + inout headers hdr, + in metadata local_metadata, + in psa_ingress_output_metadata_t istd) { + apply { + packet.emit(hdr.ethernet); + } +} + + +control egressDeparserImpl( + packet_out buffer, + out EMPTY_CLONE a, + out EMPTY_RECIRC b, + inout EMPTY_H c, + in metadata d, + in psa_egress_output_metadata_t e, + in psa_egress_deparser_input_metadata_t f) { + apply { } +} + +IngressPipeline(ParserImpl(), ingress(), DeparserImpl()) ip; +EgressPipeline(egressParserImpl(), egressControlImpl(), egressDeparserImpl()) ep; + +PSA_Switch( + ip, + PacketReplicationEngine(), + ep, + BufferingQueueingEngine()) main; diff --git a/testdata/p4_16_samples/psa-dpdk-parser-locals2.p4 b/testdata/p4_16_samples/psa-dpdk-parser-locals2.p4 new file mode 100644 index 00000000000..bf2a165dab5 --- /dev/null +++ b/testdata/p4_16_samples/psa-dpdk-parser-locals2.p4 @@ -0,0 +1,160 @@ +/* +Copyright 2017 Cisco Systems, Inc. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +#include +#include + +header EMPTY_H {}; +struct EMPTY_RESUB {}; +struct EMPTY_CLONE {}; +struct EMPTY_BRIDGE {}; +struct EMPTY_RECIRC {}; + +typedef bit<48> EthernetAddress; + +header Ethernet_h { + EthernetAddress dstAddr; + EthernetAddress srcAddr; + bit<16> etherType; +} + +header ipv4_t { + bit<4> version; + bit<4> ihl; + bit<6> dscp; + bit<2> ecn; + bit<16> totalLen; + bit<16> identification; + bit<1> flag_rsvd; + bit<1> flag_noFrag; + bit<1> flag_more; + bit<13> fragOffset; + bit<8> ttl; + bit<8> protocol; + bit<16> hdrChecksum; + bit<32> srcAddr; + bit<32> dstAddr; +} + +struct Parsed_packet { + Ethernet_h ethernet; + ipv4_t ipv4; +} + +struct mystruct1 { + bit<4> a; + bit<4> b; +} + + + +parser parserI(packet_in pkt, + out Parsed_packet hdr, + inout mystruct1 meta, + in psa_ingress_parser_input_metadata_t x, + in EMPTY_RESUB resub_meta, + in EMPTY_RECIRC recirc_meta) { + state start { + bit<8> my_local = 1; + pkt.extract(hdr.ethernet); + transition select(hdr.ethernet.etherType) { + 16w0x0800: parse_ipv4; + default: accept; + } + } + state parse_ipv4 { + bit<16> my_local = 2; + pkt.extract(hdr.ipv4); + transition select(hdr.ipv4.version, hdr.ipv4.protocol) { + (4w0x4, 8w0x06): accept; + (4w0x4, 8w0x17): accept; + default: accept; + } + } +} + +parser egressParserImpl( + packet_in buffer, + out EMPTY_H a, + inout mystruct1 b, + in psa_egress_parser_input_metadata_t c, + in EMPTY_BRIDGE d, + in EMPTY_CLONE e, + in EMPTY_CLONE f) { + state start { + transition accept; + } +} + + +control cIngress(inout Parsed_packet hdr, + inout mystruct1 meta, + in psa_ingress_input_metadata_t istd, + inout psa_ingress_output_metadata_t ostd) { + action foo() { + meta.b = meta.b + 5; + } + table guh { + key = { hdr.ethernet.srcAddr : exact; } + actions = { foo; } + default_action = foo; + } + + apply { + guh.apply(); + } +} + +control egressControlImpl( + inout EMPTY_H hdr, + inout mystruct1 meta, + in psa_egress_input_metadata_t x, + inout psa_egress_output_metadata_t ostd) +{ + apply { } +} + + +control DeparserI(packet_out packet, + out EMPTY_CLONE clone_i2e_meta, + out EMPTY_RESUB resubmit_meta, + out EMPTY_BRIDGE normal_meta, + inout Parsed_packet hdr, + in mystruct1 local_metadata, + in psa_ingress_output_metadata_t istd) { + apply { packet.emit(hdr.ethernet); } +} + +control egressDeparserImpl( + packet_out buffer, + out EMPTY_CLONE a, + out EMPTY_RECIRC b, + inout EMPTY_H c, + in mystruct1 d, + in psa_egress_output_metadata_t e, + in psa_egress_deparser_input_metadata_t f) { + apply { } +} + + +IngressPipeline(parserI(), cIngress(), DeparserI()) ip; +EgressPipeline(egressParserImpl(), egressControlImpl(), egressDeparserImpl()) ep; + +PSA_Switch( + ip, + PacketReplicationEngine(), + ep, + BufferingQueueingEngine()) main; diff --git a/testdata/p4_16_samples/psa-dpdk-parser-unroll-test6.p4 b/testdata/p4_16_samples/psa-dpdk-parser-unroll-test6.p4 new file mode 100644 index 00000000000..d7526b05416 --- /dev/null +++ b/testdata/p4_16_samples/psa-dpdk-parser-unroll-test6.p4 @@ -0,0 +1,103 @@ +/* -*- Mode:C; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ +#include +#include + +header EMPTY_H {}; +struct EMPTY_RESUB {}; +struct EMPTY_CLONE {}; +struct EMPTY_BRIDGE {}; +struct EMPTY_RECIRC {}; + +header test_header_t { + bit<8> value; +}; + +struct headers_t { + test_header_t[2] test; +}; + +struct metadata_t { +}; + +parser TestParser(packet_in b, out headers_t headers, inout metadata_t meta, + in psa_ingress_parser_input_metadata_t x, + in EMPTY_RESUB resub_meta, + in EMPTY_RECIRC recirc_meta) +{ + state start { + b.extract(headers.test.next); + bit<32> test_f = 2 * headers.test.lastIndex; + + transition select (test_f - 1) { + 0: f; + _: a; + } + } + + state a { + transition accept; + } + + state f { + } +} + +parser egressParserImpl( + packet_in buffer, + out EMPTY_H a, + inout metadata_t b, + in psa_egress_parser_input_metadata_t c, + in EMPTY_BRIDGE d, + in EMPTY_CLONE e, + in EMPTY_CLONE f) { + state start { + transition accept; + } +} + +control TestIngress(inout headers_t headers, inout metadata_t meta, + in psa_ingress_input_metadata_t istd, + inout psa_ingress_output_metadata_t ostd) +{ + apply {} +} + +control egressControlImpl( + inout EMPTY_H hdr, + inout metadata_t meta, + in psa_egress_input_metadata_t x, + inout psa_egress_output_metadata_t ostd) +{ + apply { } +} + + +control DeparserI(packet_out packet, out EMPTY_CLONE clone_i2e_meta, + out EMPTY_RESUB resubmit_meta, + out EMPTY_BRIDGE normal_meta, + inout headers_t hdr, + in metadata_t local_metadata, + in psa_ingress_output_metadata_t istd ) { + apply { } +} + +control egressDeparserImpl( + packet_out buffer, + out EMPTY_CLONE a, + out EMPTY_RECIRC b, + inout EMPTY_H c, + in metadata_t d, + in psa_egress_output_metadata_t e, + in psa_egress_deparser_input_metadata_t f) { + apply { } +} + + +IngressPipeline(TestParser(), TestIngress(), DeparserI()) ip; +EgressPipeline(egressParserImpl(), egressControlImpl(), egressDeparserImpl()) ep; + +PSA_Switch( + ip, + PacketReplicationEngine(), + ep, + BufferingQueueingEngine()) main; \ No newline at end of file diff --git a/testdata/p4_16_samples/psa-dpdk-pred.p4 b/testdata/p4_16_samples/psa-dpdk-pred.p4 new file mode 100644 index 00000000000..7ef69a97d6b --- /dev/null +++ b/testdata/p4_16_samples/psa-dpdk-pred.p4 @@ -0,0 +1,47 @@ +/* +Copyright 2016 VMware, Inc. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +#include +#include + +header EMPTY_H {}; +struct EMPTY_RESUB {}; +struct EMPTY_CLONE {}; +struct EMPTY_BRIDGE {}; +struct EMPTY_RECIRC {}; + + +control empty(); +package top(empty e); + +control Ing() { + bool b; + bit<32> a; + + action cond() { + b = true; + if (b) + a = 5; + else + a = 10; + } + + apply { + cond(); + } +} + +top(Ing()) main; diff --git a/testdata/p4_16_samples/psa-dpdk-same_name_for_table_and_action.p4 b/testdata/p4_16_samples/psa-dpdk-same_name_for_table_and_action.p4 new file mode 100644 index 00000000000..adecb93f4bf --- /dev/null +++ b/testdata/p4_16_samples/psa-dpdk-same_name_for_table_and_action.p4 @@ -0,0 +1,96 @@ +#include +#include + +header EMPTY_H {}; +struct EMPTY_RESUB {}; +struct EMPTY_CLONE {}; +struct EMPTY_BRIDGE {}; +struct EMPTY_RECIRC {}; + +struct H { }; +struct M { + bit<32> hash1; +} + +parser ParserI(packet_in pk, out H hdr, inout M meta, in psa_ingress_parser_input_metadata_t x, + in EMPTY_RESUB resub_meta, + in EMPTY_RECIRC recirc_meta) { + state start { transition accept; } +} + +parser egressParserImpl( + packet_in buffer, + out EMPTY_H a, + inout M b, + in psa_egress_parser_input_metadata_t c, + in EMPTY_BRIDGE d, + in EMPTY_CLONE e, + in EMPTY_CLONE f) { + state start { + transition accept; + } +} + +action empty() { } + +control IngressI(inout H hdr, inout M meta, in psa_ingress_input_metadata_t istd, + inout psa_ingress_output_metadata_t ostd) { + // This is typical of a valid P4_14 program translated into a v1model P4_16 + // program. Having a table and an action with the same name is valid in + // P4_14. During the translation the compiler ensures that the 2 have + // different fully-qualified names but preserves the original name for each + // through a @name annotation. + + @name("do_something") + action do_something_0() { ingress_drop(ostd); } + + @name("do_something") + table do_something { + key = { istd.ingress_port : exact; } + actions = { do_something_0; NoAction; } + const default_action = NoAction(); + } + apply { + do_something.apply(); + } +}; +control egressControlImpl( + inout EMPTY_H hdr, + inout M meta, + in psa_egress_input_metadata_t x, + inout psa_egress_output_metadata_t ostd) +{ + apply { } +} + + +control DeparserI(packet_out pk,out EMPTY_CLONE clone_i2e_meta, + out EMPTY_RESUB resubmit_meta, + out EMPTY_BRIDGE normal_meta, + inout H hdr, + in M local_metadata, + in psa_ingress_output_metadata_t istd) { + apply { } +} + + +control egressDeparserImpl( + packet_out buffer, + out EMPTY_CLONE a, + out EMPTY_RECIRC b, + inout EMPTY_H c, + in M d, + in psa_egress_output_metadata_t e, + in psa_egress_deparser_input_metadata_t f) { + apply { } +} + + +IngressPipeline(ParserI(), IngressI(), DeparserI()) ip; +EgressPipeline(egressParserImpl(), egressControlImpl(), egressDeparserImpl()) ep; + +PSA_Switch( + ip, + PacketReplicationEngine(), + ep, + BufferingQueueingEngine()) main; diff --git a/testdata/p4_16_samples/psa-dpdk-table-entries-exact-ternary.p4 b/testdata/p4_16_samples/psa-dpdk-table-entries-exact-ternary.p4 new file mode 100644 index 00000000000..3e25082568d --- /dev/null +++ b/testdata/p4_16_samples/psa-dpdk-table-entries-exact-ternary.p4 @@ -0,0 +1,130 @@ +/* +Copyright 2013-present Barefoot Networks, Inc. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +#include +#include + +header EMPTY_H {}; +struct EMPTY_RESUB {}; +struct EMPTY_CLONE {}; +struct EMPTY_BRIDGE {}; +struct EMPTY_RECIRC {}; + +header hdr { + bit<8> e; + bit<16> t; + bit<8> l; + bit<8> r; + bit<8> v; +} + +struct Header_t { + hdr h; +} +struct Meta_t {} + +parser p(packet_in b, out Header_t h, inout Meta_t m, in psa_ingress_parser_input_metadata_t x, + in EMPTY_RESUB resub_meta, + in EMPTY_RECIRC recirc_meta) { + state start { + b.extract(h.h); + transition accept; + } +} +parser egressParserImpl( + packet_in buffer, + out EMPTY_H a, + inout Meta_t b, + in psa_egress_parser_input_metadata_t c, + in EMPTY_BRIDGE d, + in EMPTY_CLONE e, + in EMPTY_CLONE f) { + state start { + transition accept; + } +} + + +control ingress(inout Header_t h, inout Meta_t m, in psa_ingress_input_metadata_t istd, + inout psa_ingress_output_metadata_t ostd) { + + action a() { ostd.egress_port = (PortId_t)(PortIdUint_t)0; } + action a_with_control_params(bit<9> x) { ostd.egress_port = (PortId_t)(PortIdUint_t)x; } + + table t_exact_ternary { + + key = { + h.h.e : exact; + h.h.t : ternary; + } + + actions = { + a; + a_with_control_params; + } + + default_action = a; + + const entries = { + (0x01, 0x1111 &&& 0xF ) : a_with_control_params(1); + (0x02, 0x1181 ) : a_with_control_params(2); + (0x03, 0x1111 &&& 0xF000) : a_with_control_params(3); + // test default entries + (0x04, _ ) : a_with_control_params(4); + } + } + + apply { + t_exact_ternary.apply(); + } +} + +control egressControlImpl( + inout EMPTY_H h, + inout Meta_t meta, + in psa_egress_input_metadata_t x, + inout psa_egress_output_metadata_t ostd) +{ + apply { } +} + +control deparser(packet_out b, out EMPTY_CLONE clone_i2e_meta, + out EMPTY_RESUB resubmit_meta, + out EMPTY_BRIDGE normal_meta, + inout Header_t h, + in Meta_t local_metadata, + in psa_ingress_output_metadata_t istd) { apply { b.emit(h.h); } } + +control egressDeparserImpl( + packet_out buffer, + out EMPTY_CLONE a, + out EMPTY_RECIRC b, + inout EMPTY_H c, + in Meta_t d, + in psa_egress_output_metadata_t e, + in psa_egress_deparser_input_metadata_t f) { + apply { } +} + + +IngressPipeline(p(), ingress(), deparser()) ip; +EgressPipeline(egressParserImpl(), egressControlImpl(), egressDeparserImpl()) ep; + +PSA_Switch( + ip, + PacketReplicationEngine(), + ep, + BufferingQueueingEngine()) main; diff --git a/testdata/p4_16_samples/psa-dpdk-table-entries-valid.p4 b/testdata/p4_16_samples/psa-dpdk-table-entries-valid.p4 new file mode 100644 index 00000000000..292d6d3735a --- /dev/null +++ b/testdata/p4_16_samples/psa-dpdk-table-entries-valid.p4 @@ -0,0 +1,127 @@ +/* +Copyright 2013-present Barefoot Networks, Inc. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +#include +#include + +header EMPTY_H {}; +struct EMPTY_RESUB {}; +struct EMPTY_CLONE {}; +struct EMPTY_BRIDGE {}; +struct EMPTY_RECIRC {}; + +header hdr { + bit<8> e; + bit<16> t; + bit<8> l; + bit<8> r; + bit<8> v; +} + +struct Header_t { + hdr h; +} +struct Meta_t {} + +parser p(packet_in b, out Header_t h, inout Meta_t m, in psa_ingress_parser_input_metadata_t x, + in EMPTY_RESUB resub_meta, + in EMPTY_RECIRC recirc_meta) { + state start { + b.extract(h.h); + transition accept; + } +} + +parser egressParserImpl( + packet_in buffer, + out EMPTY_H a, + inout Meta_t b, + in psa_egress_parser_input_metadata_t c, + in EMPTY_BRIDGE d, + in EMPTY_CLONE e, + in EMPTY_CLONE f) { + state start { + transition accept; + } +} + + +control ingress(inout Header_t h, inout Meta_t m, in psa_ingress_input_metadata_t istd, + inout psa_ingress_output_metadata_t ostd) { + + action a() { ostd.egress_port = (PortId_t)(PortIdUint_t)0; } + action a_with_control_params(bit<9> x) { ostd.egress_port = (PortId_t)(PortIdUint_t)x; } + + table t_valid { + + key = { + h.h.isValid() : exact; + h.h.e : exact; + } + + actions = { + a; + a_with_control_params; + } + + default_action = a; + + const entries = { + (true, 0x01) : a_with_control_params(1); + (false, 0x02) : a_with_control_params(2); + } + } + + apply { + t_valid.apply(); + } +} + +control egressControlImpl( + inout EMPTY_H h, + inout Meta_t meta, + in psa_egress_input_metadata_t x, + inout psa_egress_output_metadata_t ostd) +{ + apply { } +} + +control deparser(packet_out b, out EMPTY_CLONE clone_i2e_meta, + out EMPTY_RESUB resubmit_meta, + out EMPTY_BRIDGE normal_meta, + inout Header_t h, + in Meta_t local_metadata, + in psa_ingress_output_metadata_t istd) { apply { b.emit(h.h); } } + +control egressDeparserImpl( + packet_out buffer, + out EMPTY_CLONE a, + out EMPTY_RECIRC b, + inout EMPTY_H c, + in Meta_t d, + in psa_egress_output_metadata_t e, + in psa_egress_deparser_input_metadata_t f) { + apply { } +} + +IngressPipeline(p(), ingress(), deparser()) ip; +EgressPipeline(egressParserImpl(), egressControlImpl(), egressDeparserImpl()) ep; + +PSA_Switch( + ip, + PacketReplicationEngine(), + ep, + BufferingQueueingEngine()) main; diff --git a/testdata/p4_16_samples/psa-dpdk-union4.p4 b/testdata/p4_16_samples/psa-dpdk-union4.p4 new file mode 100644 index 00000000000..8ccd2f6b9b7 --- /dev/null +++ b/testdata/p4_16_samples/psa-dpdk-union4.p4 @@ -0,0 +1,137 @@ +/* +Copyright 2017 VMware, Inc. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +#include +#include + +header EMPTY_H {}; +struct EMPTY_RESUB {}; +struct EMPTY_CLONE {}; +struct EMPTY_BRIDGE {}; +struct EMPTY_RECIRC {}; + + +header Hdr1 { + bit<8> a; +} + +header Hdr2 { + bit<16> b; +} + +header_union U { + Hdr1 h1; + Hdr2 h2; +} + +struct Headers { + Hdr1 h1; + U u; + Hdr2 h2; +} + +struct Meta {} + +parser p(packet_in b, out Headers h, inout Meta m,in psa_ingress_parser_input_metadata_t x, + in EMPTY_RESUB resub_meta, + in EMPTY_RECIRC recirc_meta) { + state start { + b.extract(h.h1); + transition select(h.h1.a) { + 0: getH1; + default: getH2; + } + } + + state getH1 { + b.extract(h.u.h1); + transition accept; + } + + state getH2 { + b.extract(h.u.h2); + transition accept; + } +} + +parser egressParserImpl( + packet_in buffer, + out EMPTY_H a, + inout Meta b, + in psa_egress_parser_input_metadata_t c, + in EMPTY_BRIDGE d, + in EMPTY_CLONE e, + in EMPTY_CLONE f) { + state start { + transition accept; + } +} + + + +control ingress(inout Headers h, inout Meta m,in psa_ingress_input_metadata_t istd, + inout psa_ingress_output_metadata_t ostd) { + apply { + if (h.u.h2.isValid()) { + h.h2.setValid(); + h.h2.b = h.u.h2.b; + h.u.h1.setValid(); + h.u.h1.a = h.u.h2.b[7:0]; + h.u.h2.setInvalid(); + } + } +} + +control egressControlImpl( + inout EMPTY_H hdr, + inout Meta meta, + in psa_egress_input_metadata_t x, + inout psa_egress_output_metadata_t ostd) +{ + apply { } +} +control deparser(packet_out b, out EMPTY_CLONE clone_i2e_meta, + out EMPTY_RESUB resubmit_meta, + out EMPTY_BRIDGE normal_meta, + inout Headers h, + in Meta local_metadata, + in psa_ingress_output_metadata_t istd ) { + apply { + b.emit(h.h1); + b.emit(h.u); + b.emit(h.h2); + } +} + +control egressDeparserImpl( + packet_out buffer, + out EMPTY_CLONE a, + out EMPTY_RECIRC b, + inout EMPTY_H c, + in Meta d, + in psa_egress_output_metadata_t e, + in psa_egress_deparser_input_metadata_t f) { + apply { } +} + +IngressPipeline(p(), ingress(), deparser()) ip; +EgressPipeline(egressParserImpl(), egressControlImpl(), egressDeparserImpl()) ep; + +PSA_Switch( + ip, + PacketReplicationEngine(), + ep, + BufferingQueueingEngine()) main; diff --git a/testdata/p4_16_samples/psa-dpdk-x.p4 b/testdata/p4_16_samples/psa-dpdk-x.p4 new file mode 100644 index 00000000000..565b62fba50 --- /dev/null +++ b/testdata/p4_16_samples/psa-dpdk-x.p4 @@ -0,0 +1,100 @@ +/* +Copyright 2016 VMware, Inc. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ +#include +#include + +header EMPTY_H {}; +struct EMPTY_RESUB {}; +struct EMPTY_CLONE {}; +struct EMPTY_BRIDGE {}; +struct EMPTY_RECIRC {}; + + +struct S { bit<32> x; } +header T { bit<32> y; } +struct H { T s; } +struct M { S s; } + +parser ParserI(packet_in b, out H parsedHdr, inout M meta, in psa_ingress_parser_input_metadata_t x, + in EMPTY_RESUB resub_meta, + in EMPTY_RECIRC recirc_meta) { + state start { transition accept; } +} + +parser egressParserImpl( + packet_in buffer, + out EMPTY_H a, + inout M b, + in psa_egress_parser_input_metadata_t c, + in EMPTY_BRIDGE d, + in EMPTY_CLONE e, + in EMPTY_CLONE f) { + state start { + transition accept; + } +} + +control ctrl(inout M meta) { + apply { } +} + +control IngressI(inout H hdr, inout M meta, in psa_ingress_input_metadata_t istd, + inout psa_ingress_output_metadata_t ostd) { + ctrl() do_ctrl; + + apply { + do_ctrl.apply(meta); + } +} + +control egressControlImpl( + inout EMPTY_H hdr, + inout M meta, + in psa_egress_input_metadata_t x, + inout psa_egress_output_metadata_t ostd) +{ + apply { } +} + + +control DeparserI(packet_out b, out EMPTY_CLONE clone_i2e_meta, + out EMPTY_RESUB resubmit_meta, + out EMPTY_BRIDGE normal_meta, + inout H h, + in M local_metadata, + in psa_ingress_output_metadata_t istd) { + apply { } +} + +control egressDeparserImpl( + packet_out buffer, + out EMPTY_CLONE a, + out EMPTY_RECIRC b, + inout EMPTY_H c, + in M d, + in psa_egress_output_metadata_t e, + in psa_egress_deparser_input_metadata_t f) { + apply { } +} + +IngressPipeline(ParserI(), IngressI(), DeparserI()) ip; +EgressPipeline(egressParserImpl(), egressControlImpl(), egressDeparserImpl()) ep; + +PSA_Switch( + ip, + PacketReplicationEngine(), + ep, + BufferingQueueingEngine()) main; diff --git a/testdata/p4_16_samples_outputs/arith-inline-skeleton-d-first.p4 b/testdata/p4_16_samples_outputs/arith-inline-skeleton-d-first.p4 new file mode 100644 index 00000000000..e69de29bb2d diff --git a/testdata/p4_16_samples_outputs/arith-inline-skeleton-d-frontend.p4 b/testdata/p4_16_samples_outputs/arith-inline-skeleton-d-frontend.p4 new file mode 100644 index 00000000000..e69de29bb2d diff --git a/testdata/p4_16_samples_outputs/arith-inline-skeleton-d.p4 b/testdata/p4_16_samples_outputs/arith-inline-skeleton-d.p4 new file mode 100644 index 00000000000..e69de29bb2d diff --git a/testdata/p4_16_samples_outputs/arith-inline-skeleton-d.p4-stderr b/testdata/p4_16_samples_outputs/arith-inline-skeleton-d.p4-stderr new file mode 100644 index 00000000000..7e57a518ffd --- /dev/null +++ b/testdata/p4_16_samples_outputs/arith-inline-skeleton-d.p4-stderr @@ -0,0 +1 @@ +[--Wwarn=missing] warning: Program does not contain a `main' module diff --git a/testdata/p4_16_samples_outputs/arith-skeleton-d-first.p4 b/testdata/p4_16_samples_outputs/arith-skeleton-d-first.p4 new file mode 100644 index 00000000000..e69de29bb2d diff --git a/testdata/p4_16_samples_outputs/arith-skeleton-d-frontend.p4 b/testdata/p4_16_samples_outputs/arith-skeleton-d-frontend.p4 new file mode 100644 index 00000000000..e69de29bb2d diff --git a/testdata/p4_16_samples_outputs/arith-skeleton-d.p4 b/testdata/p4_16_samples_outputs/arith-skeleton-d.p4 new file mode 100644 index 00000000000..e69de29bb2d diff --git a/testdata/p4_16_samples_outputs/arith-skeleton-d.p4-stderr b/testdata/p4_16_samples_outputs/arith-skeleton-d.p4-stderr new file mode 100644 index 00000000000..7e57a518ffd --- /dev/null +++ b/testdata/p4_16_samples_outputs/arith-skeleton-d.p4-stderr @@ -0,0 +1 @@ +[--Wwarn=missing] warning: Program does not contain a `main' module diff --git a/testdata/p4_16_samples_outputs/p4-dpdk-multicast-first.p4 b/testdata/p4_16_samples_outputs/p4-dpdk-multicast-first.p4 new file mode 100644 index 00000000000..4d8df3adb9f --- /dev/null +++ b/testdata/p4_16_samples_outputs/p4-dpdk-multicast-first.p4 @@ -0,0 +1,163 @@ +#include +#include + +header EMPTY_H { +} + +struct EMPTY_RESUB { +} + +struct EMPTY_CLONE { +} + +struct EMPTY_BRIDGE { +} + +struct EMPTY_RECIRC { +} + +struct routing_metadata_t { + bit<32> nhop_ipv4; +} + +header ethernet_t { + bit<48> dstAddr; + bit<48> srcAddr; + bit<16> etherType; +} + +header ipv4_t { + bit<4> version; + bit<4> ihl; + bit<8> diffserv; + bit<16> totalLen; + bit<16> identification; + bit<3> flags; + bit<13> fragOffset; + bit<8> ttl; + bit<8> protocol; + bit<16> hdrChecksum; + bit<32> srcAddr; + bit<32> dstAddr; +} + +struct metadata { + @name("routing_metadata") + routing_metadata_t routing_metadata; +} + +struct headers { + @name("ethernet") + ethernet_t ethernet; + @name("ipv4") + ipv4_t ipv4; +} + +parser ParserImpl(packet_in packet, out headers hdr, inout metadata meta, in psa_ingress_parser_input_metadata_t x, in EMPTY_RESUB resub_meta, in EMPTY_RECIRC recirc_meta) { + @name("parse_ethernet") state parse_ethernet { + packet.extract(hdr.ethernet); + transition select(hdr.ethernet.etherType) { + 16w0x800: parse_ipv4; + default: accept; + } + } + @name("parse_ipv4") state parse_ipv4 { + packet.extract(hdr.ipv4); + transition accept; + } + @name("start") state start { + transition parse_ethernet; + } +} + +parser egressParserImpl(packet_in buffer, out EMPTY_H a, inout metadata b, in psa_egress_parser_input_metadata_t c, in EMPTY_BRIDGE d, in EMPTY_CLONE e, in EMPTY_CLONE f) { + state start { + transition accept; + } +} + +control ingress(inout headers hdr, inout metadata meta, in psa_ingress_input_metadata_t istd, inout psa_ingress_output_metadata_t ostd) { + @name(".bcast") action bcast() { + ostd.multicast_group = (MulticastGroup_t)32w1; + } + @name(".set_dmac") action set_dmac(bit<48> dmac) { + hdr.ethernet.dstAddr = dmac; + } + @name("._drop") action _drop() { + ingress_drop(ostd); + } + @name(".set_nhop") action set_nhop(bit<32> nhop_ipv4, bit<9> port) { + meta.routing_metadata.nhop_ipv4 = nhop_ipv4; + ostd.egress_port = (PortId_t)(PortIdUint_t)port; + hdr.ipv4.ttl = hdr.ipv4.ttl + 8w255; + } + @name(".set_nhop_redirect") action set_nhop_redirect(bit<32> nhop_ipv4, bit<9> port) { + meta.routing_metadata.nhop_ipv4 = nhop_ipv4; + ostd.egress_port = (PortId_t)(PortIdUint_t)port; + hdr.ipv4.ttl = hdr.ipv4.ttl + 8w255; + } + @name("broadcast") table broadcast { + actions = { + bcast(); + @defaultonly NoAction(); + } + size = 1; + default_action = NoAction(); + } + @name("forward") table forward { + actions = { + set_dmac(); + _drop(); + @defaultonly NoAction(); + } + key = { + meta.routing_metadata.nhop_ipv4: exact @name("meta.routing_metadata.nhop_ipv4") ; + } + size = 512; + default_action = NoAction(); + } + @name("ipv4_lpm") table ipv4_lpm { + actions = { + set_nhop(); + _drop(); + @defaultonly NoAction(); + } + key = { + hdr.ipv4.dstAddr: lpm @name("hdr.ipv4.dstAddr") ; + } + size = 1024; + default_action = NoAction(); + } + apply { + if (hdr.ipv4.isValid()) { + ipv4_lpm.apply(); + forward.apply(); + } else { + broadcast.apply(); + } + } +} + +control egressControlImpl(inout EMPTY_H hdr, inout metadata meta, in psa_egress_input_metadata_t x, inout psa_egress_output_metadata_t ostd) { + apply { + } +} + +control DeparserImpl(packet_out packet, out EMPTY_CLONE clone_i2e_meta, out EMPTY_RESUB resubmit_meta, out EMPTY_BRIDGE normal_meta, inout headers hdr, in metadata local_metadata, in psa_ingress_output_metadata_t istd) { + apply { + packet.emit(hdr.ethernet); + packet.emit(hdr.ipv4); + } +} + +control egressDeparserImpl(packet_out buffer, out EMPTY_CLONE a, out EMPTY_RECIRC b, inout EMPTY_H c, in metadata d, in psa_egress_output_metadata_t e, in psa_egress_deparser_input_metadata_t f) { + apply { + } +} + +IngressPipeline(ParserImpl(), ingress(), DeparserImpl()) ip; + +EgressPipeline(egressParserImpl(), egressControlImpl(), egressDeparserImpl()) ep; + +PSA_Switch(ip, PacketReplicationEngine(), ep, BufferingQueueingEngine()) main; + diff --git a/testdata/p4_16_samples_outputs/p4-dpdk-multicast-frontend.p4 b/testdata/p4_16_samples_outputs/p4-dpdk-multicast-frontend.p4 new file mode 100644 index 00000000000..29378a786fd --- /dev/null +++ b/testdata/p4_16_samples_outputs/p4-dpdk-multicast-frontend.p4 @@ -0,0 +1,173 @@ +#include +#include + +header EMPTY_H { +} + +struct EMPTY_RESUB { +} + +struct EMPTY_CLONE { +} + +struct EMPTY_BRIDGE { +} + +struct EMPTY_RECIRC { +} + +struct routing_metadata_t { + bit<32> nhop_ipv4; +} + +header ethernet_t { + bit<48> dstAddr; + bit<48> srcAddr; + bit<16> etherType; +} + +header ipv4_t { + bit<4> version; + bit<4> ihl; + bit<8> diffserv; + bit<16> totalLen; + bit<16> identification; + bit<3> flags; + bit<13> fragOffset; + bit<8> ttl; + bit<8> protocol; + bit<16> hdrChecksum; + bit<32> srcAddr; + bit<32> dstAddr; +} + +struct metadata { + @name("routing_metadata") + routing_metadata_t routing_metadata; +} + +struct headers { + @name("ethernet") + ethernet_t ethernet; + @name("ipv4") + ipv4_t ipv4; +} + +parser ParserImpl(packet_in packet, out headers hdr, inout metadata meta, in psa_ingress_parser_input_metadata_t x, in EMPTY_RESUB resub_meta, in EMPTY_RECIRC recirc_meta) { + @name("ParserImpl.parse_ethernet") state parse_ethernet { + packet.extract(hdr.ethernet); + transition select(hdr.ethernet.etherType) { + 16w0x800: parse_ipv4; + default: accept; + } + } + @name("ParserImpl.parse_ipv4") state parse_ipv4 { + packet.extract(hdr.ipv4); + transition accept; + } + @name("ParserImpl.start") state start { + transition parse_ethernet; + } +} + +parser egressParserImpl(packet_in buffer, out EMPTY_H a, inout metadata b, in psa_egress_parser_input_metadata_t c, in EMPTY_BRIDGE d, in EMPTY_CLONE e, in EMPTY_CLONE f) { + state start { + transition accept; + } +} + +control ingress(inout headers hdr, inout metadata meta, in psa_ingress_input_metadata_t istd, inout psa_ingress_output_metadata_t ostd) { + @name("ingress.meta") psa_ingress_output_metadata_t meta_1; + @name("ingress.meta") psa_ingress_output_metadata_t meta_3; + @noWarn("unused") @name(".NoAction") action NoAction_1() { + } + @noWarn("unused") @name(".NoAction") action NoAction_2() { + } + @noWarn("unused") @name(".NoAction") action NoAction_3() { + } + @name(".bcast") action bcast() { + ostd.multicast_group = (MulticastGroup_t)32w1; + } + @name(".set_dmac") action set_dmac(@name("dmac") bit<48> dmac) { + hdr.ethernet.dstAddr = dmac; + } + @name("._drop") action _drop() { + meta_1 = ostd; + meta_1.drop = true; + ostd = meta_1; + } + @name("._drop") action _drop_1() { + meta_3 = ostd; + meta_3.drop = true; + ostd = meta_3; + } + @name(".set_nhop") action set_nhop(@name("nhop_ipv4") bit<32> nhop_ipv4_1, @name("port") bit<9> port) { + meta.routing_metadata.nhop_ipv4 = nhop_ipv4_1; + ostd.egress_port = (PortId_t)(PortIdUint_t)port; + hdr.ipv4.ttl = hdr.ipv4.ttl + 8w255; + } + @name("ingress.broadcast") table broadcast_0 { + actions = { + bcast(); + @defaultonly NoAction_1(); + } + size = 1; + default_action = NoAction_1(); + } + @name("ingress.forward") table forward_0 { + actions = { + set_dmac(); + _drop(); + @defaultonly NoAction_2(); + } + key = { + meta.routing_metadata.nhop_ipv4: exact @name("meta.routing_metadata.nhop_ipv4") ; + } + size = 512; + default_action = NoAction_2(); + } + @name("ingress.ipv4_lpm") table ipv4_lpm_0 { + actions = { + set_nhop(); + _drop_1(); + @defaultonly NoAction_3(); + } + key = { + hdr.ipv4.dstAddr: lpm @name("hdr.ipv4.dstAddr") ; + } + size = 1024; + default_action = NoAction_3(); + } + apply { + if (hdr.ipv4.isValid()) { + ipv4_lpm_0.apply(); + forward_0.apply(); + } else { + broadcast_0.apply(); + } + } +} + +control egressControlImpl(inout EMPTY_H hdr, inout metadata meta, in psa_egress_input_metadata_t x, inout psa_egress_output_metadata_t ostd) { + apply { + } +} + +control DeparserImpl(packet_out packet, out EMPTY_CLONE clone_i2e_meta, out EMPTY_RESUB resubmit_meta, out EMPTY_BRIDGE normal_meta, inout headers hdr, in metadata local_metadata, in psa_ingress_output_metadata_t istd) { + apply { + packet.emit(hdr.ethernet); + packet.emit(hdr.ipv4); + } +} + +control egressDeparserImpl(packet_out buffer, out EMPTY_CLONE a, out EMPTY_RECIRC b, inout EMPTY_H c, in metadata d, in psa_egress_output_metadata_t e, in psa_egress_deparser_input_metadata_t f) { + apply { + } +} + +IngressPipeline(ParserImpl(), ingress(), DeparserImpl()) ip; + +EgressPipeline(egressParserImpl(), egressControlImpl(), egressDeparserImpl()) ep; + +PSA_Switch(ip, PacketReplicationEngine(), ep, BufferingQueueingEngine()) main; + diff --git a/testdata/p4_16_samples_outputs/p4-dpdk-multicast-midend.p4 b/testdata/p4_16_samples_outputs/p4-dpdk-multicast-midend.p4 new file mode 100644 index 00000000000..acf20fc0037 --- /dev/null +++ b/testdata/p4_16_samples_outputs/p4-dpdk-multicast-midend.p4 @@ -0,0 +1,175 @@ +#include +#include + +header EMPTY_H { +} + +struct EMPTY_RESUB { +} + +struct EMPTY_CLONE { +} + +struct EMPTY_BRIDGE { +} + +struct EMPTY_RECIRC { +} + +struct routing_metadata_t { + bit<32> nhop_ipv4; +} + +header ethernet_t { + bit<48> dstAddr; + bit<48> srcAddr; + bit<16> etherType; +} + +header ipv4_t { + bit<4> version; + bit<4> ihl; + bit<8> diffserv; + bit<16> totalLen; + bit<16> identification; + bit<3> flags; + bit<13> fragOffset; + bit<8> ttl; + bit<8> protocol; + bit<16> hdrChecksum; + bit<32> srcAddr; + bit<32> dstAddr; +} + +struct metadata { + bit<32> _routing_metadata_nhop_ipv40; +} + +struct headers { + @name("ethernet") + ethernet_t ethernet; + @name("ipv4") + ipv4_t ipv4; +} + +parser ParserImpl(packet_in packet, out headers hdr, inout metadata meta, in psa_ingress_parser_input_metadata_t x, in EMPTY_RESUB resub_meta, in EMPTY_RECIRC recirc_meta) { + @name("ParserImpl.parse_ethernet") state parse_ethernet { + packet.extract(hdr.ethernet); + transition select(hdr.ethernet.etherType) { + 16w0x800: parse_ipv4; + default: accept; + } + } + @name("ParserImpl.parse_ipv4") state parse_ipv4 { + packet.extract(hdr.ipv4); + transition accept; + } + @name("ParserImpl.start") state start { + transition parse_ethernet; + } +} + +parser egressParserImpl(packet_in buffer, out EMPTY_H a, inout metadata b, in psa_egress_parser_input_metadata_t c, in EMPTY_BRIDGE d, in EMPTY_CLONE e, in EMPTY_CLONE f) { + state start { + transition accept; + } +} + +control ingress(inout headers hdr, inout metadata meta, in psa_ingress_input_metadata_t istd, inout psa_ingress_output_metadata_t ostd) { + @noWarn("unused") @name(".NoAction") action NoAction_1() { + } + @noWarn("unused") @name(".NoAction") action NoAction_2() { + } + @noWarn("unused") @name(".NoAction") action NoAction_3() { + } + @name(".bcast") action bcast() { + ostd.multicast_group = 32w1; + } + @name(".set_dmac") action set_dmac(@name("dmac") bit<48> dmac) { + hdr.ethernet.dstAddr = dmac; + } + @name("._drop") action _drop() { + ostd.drop = true; + } + @name("._drop") action _drop_1() { + ostd.drop = true; + } + @name(".set_nhop") action set_nhop(@name("nhop_ipv4") bit<32> nhop_ipv4_1, @name("port") bit<9> port) { + meta._routing_metadata_nhop_ipv40 = nhop_ipv4_1; + ostd.egress_port = (PortIdUint_t)port; + hdr.ipv4.ttl = hdr.ipv4.ttl + 8w255; + } + @name("ingress.broadcast") table broadcast_0 { + actions = { + bcast(); + @defaultonly NoAction_1(); + } + size = 1; + default_action = NoAction_1(); + } + @name("ingress.forward") table forward_0 { + actions = { + set_dmac(); + _drop(); + @defaultonly NoAction_2(); + } + key = { + meta._routing_metadata_nhop_ipv40: exact @name("meta.routing_metadata.nhop_ipv4") ; + } + size = 512; + default_action = NoAction_2(); + } + @name("ingress.ipv4_lpm") table ipv4_lpm_0 { + actions = { + set_nhop(); + _drop_1(); + @defaultonly NoAction_3(); + } + key = { + hdr.ipv4.dstAddr: lpm @name("hdr.ipv4.dstAddr") ; + } + size = 1024; + default_action = NoAction_3(); + } + apply { + if (hdr.ipv4.isValid()) { + ipv4_lpm_0.apply(); + forward_0.apply(); + } else { + broadcast_0.apply(); + } + } +} + +control egressControlImpl(inout EMPTY_H hdr, inout metadata meta, in psa_egress_input_metadata_t x, inout psa_egress_output_metadata_t ostd) { + apply { + } +} + +control DeparserImpl(packet_out packet, out EMPTY_CLONE clone_i2e_meta, out EMPTY_RESUB resubmit_meta, out EMPTY_BRIDGE normal_meta, inout headers hdr, in metadata local_metadata, in psa_ingress_output_metadata_t istd) { + @hidden action p4dpdkmulticast156() { + packet.emit(hdr.ethernet); + packet.emit(hdr.ipv4); + } + @hidden table tbl_p4dpdkmulticast156 { + actions = { + p4dpdkmulticast156(); + } + const default_action = p4dpdkmulticast156(); + } + apply { + tbl_p4dpdkmulticast156.apply(); + } +} + +control egressDeparserImpl(packet_out buffer, out EMPTY_CLONE a, out EMPTY_RECIRC b, inout EMPTY_H c, in metadata d, in psa_egress_output_metadata_t e, in psa_egress_deparser_input_metadata_t f) { + apply { + } +} + +IngressPipeline(ParserImpl(), ingress(), DeparserImpl()) ip; + +EgressPipeline(egressParserImpl(), egressControlImpl(), egressDeparserImpl()) ep; + +PSA_Switch(ip, PacketReplicationEngine(), ep, BufferingQueueingEngine()) main; + diff --git a/testdata/p4_16_samples_outputs/p4-dpdk-multicast.p4 b/testdata/p4_16_samples_outputs/p4-dpdk-multicast.p4 new file mode 100644 index 00000000000..baf02a2268b --- /dev/null +++ b/testdata/p4_16_samples_outputs/p4-dpdk-multicast.p4 @@ -0,0 +1,157 @@ +#include +#include + +header EMPTY_H { +} + +struct EMPTY_RESUB { +} + +struct EMPTY_CLONE { +} + +struct EMPTY_BRIDGE { +} + +struct EMPTY_RECIRC { +} + +struct routing_metadata_t { + bit<32> nhop_ipv4; +} + +header ethernet_t { + bit<48> dstAddr; + bit<48> srcAddr; + bit<16> etherType; +} + +header ipv4_t { + bit<4> version; + bit<4> ihl; + bit<8> diffserv; + bit<16> totalLen; + bit<16> identification; + bit<3> flags; + bit<13> fragOffset; + bit<8> ttl; + bit<8> protocol; + bit<16> hdrChecksum; + bit<32> srcAddr; + bit<32> dstAddr; +} + +struct metadata { + @name("routing_metadata") + routing_metadata_t routing_metadata; +} + +struct headers { + @name("ethernet") + ethernet_t ethernet; + @name("ipv4") + ipv4_t ipv4; +} + +parser ParserImpl(packet_in packet, out headers hdr, inout metadata meta, in psa_ingress_parser_input_metadata_t x, in EMPTY_RESUB resub_meta, in EMPTY_RECIRC recirc_meta) { + @name("parse_ethernet") state parse_ethernet { + packet.extract(hdr.ethernet); + transition select(hdr.ethernet.etherType) { + 16w0x800: parse_ipv4; + default: accept; + } + } + @name("parse_ipv4") state parse_ipv4 { + packet.extract(hdr.ipv4); + transition accept; + } + @name("start") state start { + transition parse_ethernet; + } +} + +parser egressParserImpl(packet_in buffer, out EMPTY_H a, inout metadata b, in psa_egress_parser_input_metadata_t c, in EMPTY_BRIDGE d, in EMPTY_CLONE e, in EMPTY_CLONE f) { + state start { + transition accept; + } +} + +control ingress(inout headers hdr, inout metadata meta, in psa_ingress_input_metadata_t istd, inout psa_ingress_output_metadata_t ostd) { + @name(".bcast") action bcast() { + ostd.multicast_group = (MulticastGroup_t)(MulticastGroupUint_t)1; + } + @name(".set_dmac") action set_dmac(bit<48> dmac) { + hdr.ethernet.dstAddr = dmac; + } + @name("._drop") action _drop() { + ingress_drop(ostd); + } + @name(".set_nhop") action set_nhop(bit<32> nhop_ipv4, bit<9> port) { + meta.routing_metadata.nhop_ipv4 = nhop_ipv4; + ostd.egress_port = (PortId_t)(PortIdUint_t)port; + hdr.ipv4.ttl = hdr.ipv4.ttl + 8w255; + } + @name(".set_nhop_redirect") action set_nhop_redirect(bit<32> nhop_ipv4, bit<9> port) { + meta.routing_metadata.nhop_ipv4 = nhop_ipv4; + ostd.egress_port = (PortId_t)(PortIdUint_t)port; + hdr.ipv4.ttl = hdr.ipv4.ttl + 8w255; + } + @name("broadcast") table broadcast { + actions = { + bcast; + } + size = 1; + } + @name("forward") table forward { + actions = { + set_dmac; + _drop; + } + key = { + meta.routing_metadata.nhop_ipv4: exact; + } + size = 512; + } + @name("ipv4_lpm") table ipv4_lpm { + actions = { + set_nhop; + _drop; + } + key = { + hdr.ipv4.dstAddr: lpm; + } + size = 1024; + } + apply { + if (hdr.ipv4.isValid()) { + ipv4_lpm.apply(); + forward.apply(); + } else { + broadcast.apply(); + } + } +} + +control egressControlImpl(inout EMPTY_H hdr, inout metadata meta, in psa_egress_input_metadata_t x, inout psa_egress_output_metadata_t ostd) { + apply { + } +} + +control DeparserImpl(packet_out packet, out EMPTY_CLONE clone_i2e_meta, out EMPTY_RESUB resubmit_meta, out EMPTY_BRIDGE normal_meta, inout headers hdr, in metadata local_metadata, in psa_ingress_output_metadata_t istd) { + apply { + packet.emit(hdr.ethernet); + packet.emit(hdr.ipv4); + } +} + +control egressDeparserImpl(packet_out buffer, out EMPTY_CLONE a, out EMPTY_RECIRC b, inout EMPTY_H c, in metadata d, in psa_egress_output_metadata_t e, in psa_egress_deparser_input_metadata_t f) { + apply { + } +} + +IngressPipeline(ParserImpl(), ingress(), DeparserImpl()) ip; + +EgressPipeline(egressParserImpl(), egressControlImpl(), egressDeparserImpl()) ep; + +PSA_Switch(ip, PacketReplicationEngine(), ep, BufferingQueueingEngine()) main; + diff --git a/testdata/p4_16_samples_outputs/p4-dpdk-multicast.p4-stderr b/testdata/p4_16_samples_outputs/p4-dpdk-multicast.p4-stderr new file mode 100644 index 00000000000..e69de29bb2d diff --git a/testdata/p4_16_samples_outputs/p4-dpdk-multicast.p4.entries.txt b/testdata/p4_16_samples_outputs/p4-dpdk-multicast.p4.entries.txt new file mode 100644 index 00000000000..e69de29bb2d diff --git a/testdata/p4_16_samples_outputs/p4-dpdk-multicast.p4.p4info.txt b/testdata/p4_16_samples_outputs/p4-dpdk-multicast.p4.p4info.txt new file mode 100644 index 00000000000..279092a56f9 --- /dev/null +++ b/testdata/p4_16_samples_outputs/p4-dpdk-multicast.p4.p4info.txt @@ -0,0 +1,122 @@ +pkg_info { + arch: "psa" +} +tables { + preamble { + id: 50277452 + name: "ingress.broadcast" + alias: "broadcast" + } + action_refs { + id: 18431090 + } + action_refs { + id: 21257015 + annotations: "@defaultonly" + scope: DEFAULT_ONLY + } + size: 1 +} +tables { + preamble { + id: 43289378 + name: "ingress.forward" + alias: "forward" + } + match_fields { + id: 1 + name: "meta.routing_metadata.nhop_ipv4" + bitwidth: 32 + match_type: EXACT + } + action_refs { + id: 25234447 + } + action_refs { + id: 19143480 + } + action_refs { + id: 21257015 + annotations: "@defaultonly" + scope: DEFAULT_ONLY + } + size: 512 +} +tables { + preamble { + id: 43030458 + name: "ingress.ipv4_lpm" + alias: "ipv4_lpm" + } + match_fields { + id: 1 + name: "hdr.ipv4.dstAddr" + bitwidth: 32 + match_type: LPM + } + action_refs { + id: 23300268 + } + action_refs { + id: 19143480 + } + action_refs { + id: 21257015 + annotations: "@defaultonly" + scope: DEFAULT_ONLY + } + size: 1024 +} +actions { + preamble { + id: 21257015 + name: "NoAction" + alias: "NoAction" + annotations: "@noWarn(\"unused\")" + } +} +actions { + preamble { + id: 18431090 + name: "bcast" + alias: "bcast" + } +} +actions { + preamble { + id: 25234447 + name: "set_dmac" + alias: "set_dmac" + } + params { + id: 1 + name: "dmac" + bitwidth: 48 + } +} +actions { + preamble { + id: 19143480 + name: "_drop" + alias: "_drop" + } +} +actions { + preamble { + id: 23300268 + name: "set_nhop" + alias: "set_nhop" + } + params { + id: 1 + name: "nhop_ipv4" + bitwidth: 32 + } + params { + id: 2 + name: "port" + bitwidth: 9 + } +} +type_info { +} diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-arith-bmv2.p4-error b/testdata/p4_16_samples_outputs/psa-dpdk-arith-bmv2.p4-error new file mode 100644 index 00000000000..e69de29bb2d diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-arith-bmv2.p4.bfrt.json b/testdata/p4_16_samples_outputs/psa-dpdk-arith-bmv2.p4.bfrt.json new file mode 100644 index 00000000000..179e9e54bf0 --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-arith-bmv2.p4.bfrt.json @@ -0,0 +1,28 @@ +{ + "schema_version" : "1.0.0", + "tables" : [ + { + "name" : "ip.ingress.t", + "id" : 34728461, + "table_type" : "MatchAction_Direct", + "size" : 1024, + "annotations" : [], + "depends_on" : [], + "has_const_default_action" : true, + "key" : [], + "action_specs" : [ + { + "id" : 20728178, + "name" : "ingress.add", + "action_scope" : "TableAndDefault", + "annotations" : [], + "data" : [] + } + ], + "data" : [], + "supported_operations" : [], + "attributes" : ["EntryScope"] + } + ], + "learn_filters" : [] +} \ No newline at end of file diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-arith-bmv2.p4.spec b/testdata/p4_16_samples_outputs/psa-dpdk-arith-bmv2.p4.spec new file mode 100644 index 00000000000..326c8215053 --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-arith-bmv2.p4.spec @@ -0,0 +1,66 @@ + +struct hdr { + bit<32> a + bit<32> b + bit<64> c +} + +struct psa_ingress_output_metadata_t { + bit<8> class_of_service + bit<8> clone + bit<16> clone_session_id + bit<8> drop + bit<8> resubmit + bit<32> multicast_group + bit<32> egress_port +} + +struct psa_egress_output_metadata_t { + bit<8> clone + bit<16> clone_session_id + bit<8> drop +} + +struct psa_egress_deparser_input_metadata_t { + bit<32> egress_port +} + +header h instanceof hdr + +struct Meta { + bit<32> psa_ingress_input_metadata_ingress_port + bit<8> psa_ingress_output_metadata_drop + bit<32> psa_ingress_output_metadata_egress_port + bit<32> Ingress_tmp +} +metadata instanceof Meta + +action add_1 args none { + mov m.Ingress_tmp h.h.a + add m.Ingress_tmp h.h.b + mov h.h.c m.Ingress_tmp + mov m.psa_ingress_output_metadata_egress_port 0x0 + return +} + +table t { + actions { + add_1 + } + default_action add_1 args none const + size 0x10000 +} + + +apply { + rx m.psa_ingress_input_metadata_ingress_port + mov m.psa_ingress_output_metadata_drop 0x0 + extract h.h + table t + jmpneq LABEL_DROP m.psa_ingress_output_metadata_drop 0x0 + emit h.h + tx m.psa_ingress_output_metadata_egress_port + LABEL_DROP : drop +} + + diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-arith-first.p4 b/testdata/p4_16_samples_outputs/psa-dpdk-arith-first.p4 new file mode 100644 index 00000000000..dbd1d86581c --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-arith-first.p4 @@ -0,0 +1,82 @@ +#include +#include + +header EMPTY_H { +} + +struct EMPTY_RESUB { +} + +struct EMPTY_CLONE { +} + +struct EMPTY_BRIDGE { +} + +struct EMPTY_RECIRC { +} + +header hdr { + bit<32> a; + bit<32> b; + bit<64> c; +} + +struct Headers { + hdr h; +} + +struct Meta { +} + +parser p(packet_in b, out Headers h, inout Meta m, in psa_ingress_parser_input_metadata_t x, in EMPTY_RESUB resub_meta, in EMPTY_RECIRC recirc_meta) { + state start { + b.extract(h.h); + transition accept; + } +} + +parser egressParserImpl(packet_in buffer, out EMPTY_H a, inout Meta b, in psa_egress_parser_input_metadata_t c, in EMPTY_BRIDGE d, in EMPTY_CLONE e, in EMPTY_CLONE f) { + state start { + transition accept; + } +} + +control deparser(packet_out b, out EMPTY_CLONE clone_i2e_meta, out EMPTY_RESUB resubmit_meta, out EMPTY_BRIDGE normal_meta, inout Headers h, in Meta local_metadata, in psa_ingress_output_metadata_t istd) { + apply { + b.emit(h.h); + } +} + +control egressDeparserImpl(packet_out buffer, out EMPTY_CLONE a, out EMPTY_RECIRC b, inout EMPTY_H c, in Meta d, in psa_egress_output_metadata_t e, in psa_egress_deparser_input_metadata_t f) { + apply { + } +} + +control ingress(inout Headers h, inout Meta m, in psa_ingress_input_metadata_t istd, inout psa_ingress_output_metadata_t ostd) { + action add() { + h.h.c = (bit<64>)(h.h.a + h.h.b); + ostd.egress_port = (PortId_t)32w0; + } + table t { + actions = { + add(); + } + const default_action = add(); + } + apply { + t.apply(); + } +} + +control egressControlImpl(inout EMPTY_H h, inout Meta meta, in psa_egress_input_metadata_t x, inout psa_egress_output_metadata_t ostd) { + apply { + } +} + +IngressPipeline(p(), ingress(), deparser()) ip; + +EgressPipeline(egressParserImpl(), egressControlImpl(), egressDeparserImpl()) ep; + +PSA_Switch(ip, PacketReplicationEngine(), ep, BufferingQueueingEngine()) main; + diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-arith-frontend.p4 b/testdata/p4_16_samples_outputs/psa-dpdk-arith-frontend.p4 new file mode 100644 index 00000000000..766d47833e9 --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-arith-frontend.p4 @@ -0,0 +1,82 @@ +#include +#include + +header EMPTY_H { +} + +struct EMPTY_RESUB { +} + +struct EMPTY_CLONE { +} + +struct EMPTY_BRIDGE { +} + +struct EMPTY_RECIRC { +} + +header hdr { + bit<32> a; + bit<32> b; + bit<64> c; +} + +struct Headers { + hdr h; +} + +struct Meta { +} + +parser p(packet_in b, out Headers h, inout Meta m, in psa_ingress_parser_input_metadata_t x, in EMPTY_RESUB resub_meta, in EMPTY_RECIRC recirc_meta) { + state start { + b.extract(h.h); + transition accept; + } +} + +parser egressParserImpl(packet_in buffer, out EMPTY_H a, inout Meta b, in psa_egress_parser_input_metadata_t c, in EMPTY_BRIDGE d, in EMPTY_CLONE e, in EMPTY_CLONE f) { + state start { + transition accept; + } +} + +control deparser(packet_out b, out EMPTY_CLONE clone_i2e_meta, out EMPTY_RESUB resubmit_meta, out EMPTY_BRIDGE normal_meta, inout Headers h, in Meta local_metadata, in psa_ingress_output_metadata_t istd) { + apply { + b.emit(h.h); + } +} + +control egressDeparserImpl(packet_out buffer, out EMPTY_CLONE a, out EMPTY_RECIRC b, inout EMPTY_H c, in Meta d, in psa_egress_output_metadata_t e, in psa_egress_deparser_input_metadata_t f) { + apply { + } +} + +control ingress(inout Headers h, inout Meta m, in psa_ingress_input_metadata_t istd, inout psa_ingress_output_metadata_t ostd) { + @name("ingress.add") action add_1() { + h.h.c = (bit<64>)(h.h.a + h.h.b); + ostd.egress_port = (PortId_t)32w0; + } + @name("ingress.t") table t_0 { + actions = { + add_1(); + } + const default_action = add_1(); + } + apply { + t_0.apply(); + } +} + +control egressControlImpl(inout EMPTY_H h, inout Meta meta, in psa_egress_input_metadata_t x, inout psa_egress_output_metadata_t ostd) { + apply { + } +} + +IngressPipeline(p(), ingress(), deparser()) ip; + +EgressPipeline(egressParserImpl(), egressControlImpl(), egressDeparserImpl()) ep; + +PSA_Switch(ip, PacketReplicationEngine(), ep, BufferingQueueingEngine()) main; + diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-arith-midend.p4 b/testdata/p4_16_samples_outputs/psa-dpdk-arith-midend.p4 new file mode 100644 index 00000000000..7522e909a09 --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-arith-midend.p4 @@ -0,0 +1,91 @@ +#include +#include + +header EMPTY_H { +} + +struct EMPTY_RESUB { +} + +struct EMPTY_CLONE { +} + +struct EMPTY_BRIDGE { +} + +struct EMPTY_RECIRC { +} + +header hdr { + bit<32> a; + bit<32> b; + bit<64> c; +} + +struct Headers { + hdr h; +} + +struct Meta { +} + +parser p(packet_in b, out Headers h, inout Meta m, in psa_ingress_parser_input_metadata_t x, in EMPTY_RESUB resub_meta, in EMPTY_RECIRC recirc_meta) { + state start { + b.extract(h.h); + transition accept; + } +} + +parser egressParserImpl(packet_in buffer, out EMPTY_H a, inout Meta b, in psa_egress_parser_input_metadata_t c, in EMPTY_BRIDGE d, in EMPTY_CLONE e, in EMPTY_CLONE f) { + state start { + transition accept; + } +} + +control deparser(packet_out b, out EMPTY_CLONE clone_i2e_meta, out EMPTY_RESUB resubmit_meta, out EMPTY_BRIDGE normal_meta, inout Headers h, in Meta local_metadata, in psa_ingress_output_metadata_t istd) { + @hidden action arithskeletond56() { + b.emit(h.h); + } + @hidden table tbl_arithskeletond56 { + actions = { + arithskeletond56(); + } + const default_action = arithskeletond56(); + } + apply { + tbl_arithskeletond56.apply(); + } +} + +control egressDeparserImpl(packet_out buffer, out EMPTY_CLONE a, out EMPTY_RECIRC b, inout EMPTY_H c, in Meta d, in psa_egress_output_metadata_t e, in psa_egress_deparser_input_metadata_t f) { + apply { + } +} + +control ingress(inout Headers h, inout Meta m, in psa_ingress_input_metadata_t istd, inout psa_ingress_output_metadata_t ostd) { + @name("ingress.add") action add_1() { + h.h.c = (bit<64>)(h.h.a + h.h.b); + ostd.egress_port = 32w0; + } + @name("ingress.t") table t_0 { + actions = { + add_1(); + } + const default_action = add_1(); + } + apply { + t_0.apply(); + } +} + +control egressControlImpl(inout EMPTY_H h, inout Meta meta, in psa_egress_input_metadata_t x, inout psa_egress_output_metadata_t ostd) { + apply { + } +} + +IngressPipeline(p(), ingress(), deparser()) ip; + +EgressPipeline(egressParserImpl(), egressControlImpl(), egressDeparserImpl()) ep; + +PSA_Switch(ip, PacketReplicationEngine(), ep, BufferingQueueingEngine()) main; + diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-arith.p4 b/testdata/p4_16_samples_outputs/psa-dpdk-arith.p4 new file mode 100644 index 00000000000..3f07bb6b24e --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-arith.p4 @@ -0,0 +1,82 @@ +#include +#include + +header EMPTY_H { +} + +struct EMPTY_RESUB { +} + +struct EMPTY_CLONE { +} + +struct EMPTY_BRIDGE { +} + +struct EMPTY_RECIRC { +} + +header hdr { + bit<32> a; + bit<32> b; + bit<64> c; +} + +struct Headers { + hdr h; +} + +struct Meta { +} + +parser p(packet_in b, out Headers h, inout Meta m, in psa_ingress_parser_input_metadata_t x, in EMPTY_RESUB resub_meta, in EMPTY_RECIRC recirc_meta) { + state start { + b.extract(h.h); + transition accept; + } +} + +parser egressParserImpl(packet_in buffer, out EMPTY_H a, inout Meta b, in psa_egress_parser_input_metadata_t c, in EMPTY_BRIDGE d, in EMPTY_CLONE e, in EMPTY_CLONE f) { + state start { + transition accept; + } +} + +control deparser(packet_out b, out EMPTY_CLONE clone_i2e_meta, out EMPTY_RESUB resubmit_meta, out EMPTY_BRIDGE normal_meta, inout Headers h, in Meta local_metadata, in psa_ingress_output_metadata_t istd) { + apply { + b.emit(h.h); + } +} + +control egressDeparserImpl(packet_out buffer, out EMPTY_CLONE a, out EMPTY_RECIRC b, inout EMPTY_H c, in Meta d, in psa_egress_output_metadata_t e, in psa_egress_deparser_input_metadata_t f) { + apply { + } +} + +control ingress(inout Headers h, inout Meta m, in psa_ingress_input_metadata_t istd, inout psa_ingress_output_metadata_t ostd) { + action add() { + h.h.c = (bit<64>)(h.h.a + h.h.b); + ostd.egress_port = (PortId_t)(PortIdUint_t)0; + } + table t { + actions = { + add; + } + const default_action = add; + } + apply { + t.apply(); + } +} + +control egressControlImpl(inout EMPTY_H h, inout Meta meta, in psa_egress_input_metadata_t x, inout psa_egress_output_metadata_t ostd) { + apply { + } +} + +IngressPipeline(p(), ingress(), deparser()) ip; + +EgressPipeline(egressParserImpl(), egressControlImpl(), egressDeparserImpl()) ep; + +PSA_Switch(ip, PacketReplicationEngine(), ep, BufferingQueueingEngine()) main; + diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-arith.p4-error b/testdata/p4_16_samples_outputs/psa-dpdk-arith.p4-error new file mode 100644 index 00000000000..e69de29bb2d diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-arith.p4-stderr b/testdata/p4_16_samples_outputs/psa-dpdk-arith.p4-stderr new file mode 100644 index 00000000000..e69de29bb2d diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-arith.p4.bfrt.json b/testdata/p4_16_samples_outputs/psa-dpdk-arith.p4.bfrt.json new file mode 100644 index 00000000000..179e9e54bf0 --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-arith.p4.bfrt.json @@ -0,0 +1,28 @@ +{ + "schema_version" : "1.0.0", + "tables" : [ + { + "name" : "ip.ingress.t", + "id" : 34728461, + "table_type" : "MatchAction_Direct", + "size" : 1024, + "annotations" : [], + "depends_on" : [], + "has_const_default_action" : true, + "key" : [], + "action_specs" : [ + { + "id" : 20728178, + "name" : "ingress.add", + "action_scope" : "TableAndDefault", + "annotations" : [], + "data" : [] + } + ], + "data" : [], + "supported_operations" : [], + "attributes" : ["EntryScope"] + } + ], + "learn_filters" : [] +} \ No newline at end of file diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-arith.p4.entries.txt b/testdata/p4_16_samples_outputs/psa-dpdk-arith.p4.entries.txt new file mode 100644 index 00000000000..e69de29bb2d diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-arith.p4.p4info.txt b/testdata/p4_16_samples_outputs/psa-dpdk-arith.p4.p4info.txt new file mode 100644 index 00000000000..e46856568fe --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-arith.p4.p4info.txt @@ -0,0 +1,24 @@ +pkg_info { + arch: "psa" +} +tables { + preamble { + id: 34728461 + name: "ingress.t" + alias: "t" + } + action_refs { + id: 20728178 + } + const_default_action_id: 20728178 + size: 1024 +} +actions { + preamble { + id: 20728178 + name: "ingress.add" + alias: "add" + } +} +type_info { +} diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-arith.p4.spec b/testdata/p4_16_samples_outputs/psa-dpdk-arith.p4.spec new file mode 100644 index 00000000000..326c8215053 --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-arith.p4.spec @@ -0,0 +1,66 @@ + +struct hdr { + bit<32> a + bit<32> b + bit<64> c +} + +struct psa_ingress_output_metadata_t { + bit<8> class_of_service + bit<8> clone + bit<16> clone_session_id + bit<8> drop + bit<8> resubmit + bit<32> multicast_group + bit<32> egress_port +} + +struct psa_egress_output_metadata_t { + bit<8> clone + bit<16> clone_session_id + bit<8> drop +} + +struct psa_egress_deparser_input_metadata_t { + bit<32> egress_port +} + +header h instanceof hdr + +struct Meta { + bit<32> psa_ingress_input_metadata_ingress_port + bit<8> psa_ingress_output_metadata_drop + bit<32> psa_ingress_output_metadata_egress_port + bit<32> Ingress_tmp +} +metadata instanceof Meta + +action add_1 args none { + mov m.Ingress_tmp h.h.a + add m.Ingress_tmp h.h.b + mov h.h.c m.Ingress_tmp + mov m.psa_ingress_output_metadata_egress_port 0x0 + return +} + +table t { + actions { + add_1 + } + default_action add_1 args none const + size 0x10000 +} + + +apply { + rx m.psa_ingress_input_metadata_ingress_port + mov m.psa_ingress_output_metadata_drop 0x0 + extract h.h + table t + jmpneq LABEL_DROP m.psa_ingress_output_metadata_drop 0x0 + emit h.h + tx m.psa_ingress_output_metadata_egress_port + LABEL_DROP : drop +} + + diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-bvec_union-bmv2.p4-error b/testdata/p4_16_samples_outputs/psa-dpdk-bvec_union-bmv2.p4-error new file mode 100644 index 00000000000..e69de29bb2d diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-bvec_union-bmv2.p4.bfrt.json b/testdata/p4_16_samples_outputs/psa-dpdk-bvec_union-bmv2.p4.bfrt.json new file mode 100644 index 00000000000..b6d66a630db --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-bvec_union-bmv2.p4.bfrt.json @@ -0,0 +1,5 @@ +{ + "schema_version" : "1.0.0", + "tables" : [], + "learn_filters" : [] +} \ No newline at end of file diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-bvec_union-bmv2.p4.spec b/testdata/p4_16_samples_outputs/psa-dpdk-bvec_union-bmv2.p4.spec new file mode 100644 index 00000000000..f78b2b43801 --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-bvec_union-bmv2.p4.spec @@ -0,0 +1,70 @@ + +struct Hdr1 { + bit<8> _a0 + ;oldname:_row0_alt0_valid1__row0_alt0_port2 + bit<8> _row0_alt0_valid1__row0_alt0_0 + ;oldname:_row0_alt1_valid3__row0_alt1_port4 + bit<8> _row0_alt1_valid3__row0_alt1_1 + ;oldname:_row1_alt0_valid5__row1_alt0_port6 + bit<8> _row1_alt0_valid5__row1_alt0_2 + ;oldname:_row1_alt1_valid7__row1_alt1_port8 + bit<8> _row1_alt1_valid7__row1_alt1_3 +} + +struct Hdr2 { + bit<16> _b0 + ;oldname:_row_alt0_valid1__row_alt0_port2 + bit<8> _row_alt0_valid1__row_alt0_po4 + ;oldname:_row_alt1_valid3__row_alt1_port4 + bit<8> _row_alt1_valid3__row_alt1_po5 +} + +struct psa_ingress_output_metadata_t { + bit<8> class_of_service + bit<8> clone + bit<16> clone_session_id + bit<8> drop + bit<8> resubmit + bit<32> multicast_group + bit<32> egress_port +} + +struct psa_egress_output_metadata_t { + bit<8> clone + bit<16> clone_session_id + bit<8> drop +} + +struct psa_egress_deparser_input_metadata_t { + bit<32> egress_port +} + +header h1 instanceof Hdr1 +header u instanceof U + +struct Meta { + bit<32> psa_ingress_input_metadata_ingress_port + bit<8> psa_ingress_output_metadata_drop + bit<32> psa_ingress_output_metadata_egress_port +} +metadata instanceof Meta + +apply { + rx m.psa_ingress_input_metadata_ingress_port + mov m.psa_ingress_output_metadata_drop 0x0 + extract h.h1 + jmpeq P_GETH1 h.h1._a0 0x0 + extract h.u.h2 + jmp P_ACCEPT + P_GETH1 : extract h.u.h1 + P_ACCEPT : jmpnv LABEL_END h.u.h2 + invalidate h.u.h2 + LABEL_END : jmpneq LABEL_DROP m.psa_ingress_output_metadata_drop 0x0 + emit h.h1 + emit h.u.h1 + emit h.u.h2 + tx m.psa_ingress_output_metadata_egress_port + LABEL_DROP : drop +} + + diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-bvec_union-first.p4 b/testdata/p4_16_samples_outputs/psa-dpdk-bvec_union-first.p4 new file mode 100644 index 00000000000..8f3c3721395 --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-bvec_union-first.p4 @@ -0,0 +1,107 @@ +#include +#include + +header EMPTY_H { +} + +struct EMPTY_RESUB { +} + +struct EMPTY_CLONE { +} + +struct EMPTY_BRIDGE { +} + +struct EMPTY_RECIRC { +} + +struct alt_t { + bit<1> valid; + bit<7> port; +} + +struct row_t { + alt_t alt0; + alt_t alt1; +} + +header Hdr1 { + bit<8> a; + row_t row0; + row_t row1; +} + +header Hdr2 { + bit<16> b; + row_t row; +} + +header_union U { + Hdr1 h1; + Hdr2 h2; +} + +struct Headers { + Hdr1 h1; + U u; +} + +struct Meta { +} + +parser p(packet_in b, out Headers h, inout Meta m, in psa_ingress_parser_input_metadata_t x, in EMPTY_RESUB resub_meta, in EMPTY_RECIRC recirc_meta) { + state start { + b.extract(h.h1); + transition select(h.h1.a) { + 8w0: getH1; + default: getH2; + } + } + state getH1 { + b.extract(h.u.h1); + transition accept; + } + state getH2 { + b.extract(h.u.h2); + transition accept; + } +} + +parser egressParserImpl(packet_in buffer, out EMPTY_H a, inout Meta b, in psa_egress_parser_input_metadata_t c, in EMPTY_BRIDGE d, in EMPTY_CLONE e, in EMPTY_CLONE f) { + state start { + transition accept; + } +} + +control ingress(inout Headers h, inout Meta m, in psa_ingress_input_metadata_t istd, inout psa_ingress_output_metadata_t ostd) { + apply { + if (h.u.h2.isValid()) { + h.u.h2.setInvalid(); + } + } +} + +control egressControlImpl(inout EMPTY_H hdr, inout Meta meta, in psa_egress_input_metadata_t x, inout psa_egress_output_metadata_t ostd) { + apply { + } +} + +control deparser(packet_out b, out EMPTY_CLONE clone_i2e_meta, out EMPTY_RESUB resubmit_meta, out EMPTY_BRIDGE normal_meta, inout Headers h, in Meta local_metadata, in psa_ingress_output_metadata_t istd) { + apply { + b.emit(h.h1); + b.emit(h.u); + } +} + +control egressDeparserImpl(packet_out buffer, out EMPTY_CLONE a, out EMPTY_RECIRC b, inout EMPTY_H c, in Meta d, in psa_egress_output_metadata_t e, in psa_egress_deparser_input_metadata_t f) { + apply { + } +} + +IngressPipeline(p(), ingress(), deparser()) ip; + +EgressPipeline(egressParserImpl(), egressControlImpl(), egressDeparserImpl()) ep; + +PSA_Switch(ip, PacketReplicationEngine(), ep, BufferingQueueingEngine()) main; + diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-bvec_union-frontend.p4 b/testdata/p4_16_samples_outputs/psa-dpdk-bvec_union-frontend.p4 new file mode 100644 index 00000000000..8f3c3721395 --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-bvec_union-frontend.p4 @@ -0,0 +1,107 @@ +#include +#include + +header EMPTY_H { +} + +struct EMPTY_RESUB { +} + +struct EMPTY_CLONE { +} + +struct EMPTY_BRIDGE { +} + +struct EMPTY_RECIRC { +} + +struct alt_t { + bit<1> valid; + bit<7> port; +} + +struct row_t { + alt_t alt0; + alt_t alt1; +} + +header Hdr1 { + bit<8> a; + row_t row0; + row_t row1; +} + +header Hdr2 { + bit<16> b; + row_t row; +} + +header_union U { + Hdr1 h1; + Hdr2 h2; +} + +struct Headers { + Hdr1 h1; + U u; +} + +struct Meta { +} + +parser p(packet_in b, out Headers h, inout Meta m, in psa_ingress_parser_input_metadata_t x, in EMPTY_RESUB resub_meta, in EMPTY_RECIRC recirc_meta) { + state start { + b.extract(h.h1); + transition select(h.h1.a) { + 8w0: getH1; + default: getH2; + } + } + state getH1 { + b.extract(h.u.h1); + transition accept; + } + state getH2 { + b.extract(h.u.h2); + transition accept; + } +} + +parser egressParserImpl(packet_in buffer, out EMPTY_H a, inout Meta b, in psa_egress_parser_input_metadata_t c, in EMPTY_BRIDGE d, in EMPTY_CLONE e, in EMPTY_CLONE f) { + state start { + transition accept; + } +} + +control ingress(inout Headers h, inout Meta m, in psa_ingress_input_metadata_t istd, inout psa_ingress_output_metadata_t ostd) { + apply { + if (h.u.h2.isValid()) { + h.u.h2.setInvalid(); + } + } +} + +control egressControlImpl(inout EMPTY_H hdr, inout Meta meta, in psa_egress_input_metadata_t x, inout psa_egress_output_metadata_t ostd) { + apply { + } +} + +control deparser(packet_out b, out EMPTY_CLONE clone_i2e_meta, out EMPTY_RESUB resubmit_meta, out EMPTY_BRIDGE normal_meta, inout Headers h, in Meta local_metadata, in psa_ingress_output_metadata_t istd) { + apply { + b.emit(h.h1); + b.emit(h.u); + } +} + +control egressDeparserImpl(packet_out buffer, out EMPTY_CLONE a, out EMPTY_RECIRC b, inout EMPTY_H c, in Meta d, in psa_egress_output_metadata_t e, in psa_egress_deparser_input_metadata_t f) { + apply { + } +} + +IngressPipeline(p(), ingress(), deparser()) ip; + +EgressPipeline(egressParserImpl(), egressControlImpl(), egressDeparserImpl()) ep; + +PSA_Switch(ip, PacketReplicationEngine(), ep, BufferingQueueingEngine()) main; + diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-bvec_union-midend.p4 b/testdata/p4_16_samples_outputs/psa-dpdk-bvec_union-midend.p4 new file mode 100644 index 00000000000..a348a4d154d --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-bvec_union-midend.p4 @@ -0,0 +1,135 @@ +#include +#include + +header EMPTY_H { +} + +struct EMPTY_RESUB { +} + +struct EMPTY_CLONE { +} + +struct EMPTY_BRIDGE { +} + +struct EMPTY_RECIRC { +} + +struct alt_t { + bit<1> valid; + bit<7> port; +} + +struct row_t { + alt_t alt0; + alt_t alt1; +} + +header Hdr1 { + bit<8> _a0; + bit<1> _row0_alt0_valid1; + bit<7> _row0_alt0_port2; + bit<1> _row0_alt1_valid3; + bit<7> _row0_alt1_port4; + bit<1> _row1_alt0_valid5; + bit<7> _row1_alt0_port6; + bit<1> _row1_alt1_valid7; + bit<7> _row1_alt1_port8; +} + +header Hdr2 { + bit<16> _b0; + bit<1> _row_alt0_valid1; + bit<7> _row_alt0_port2; + bit<1> _row_alt1_valid3; + bit<7> _row_alt1_port4; +} + +header_union U { + Hdr1 h1; + Hdr2 h2; +} + +struct Headers { + Hdr1 h1; + U u; +} + +struct Meta { +} + +parser p(packet_in b, out Headers h, inout Meta m, in psa_ingress_parser_input_metadata_t x, in EMPTY_RESUB resub_meta, in EMPTY_RECIRC recirc_meta) { + state start { + b.extract(h.h1); + transition select(h.h1._a0) { + 8w0: getH1; + default: getH2; + } + } + state getH1 { + b.extract(h.u.h1); + transition accept; + } + state getH2 { + b.extract(h.u.h2); + transition accept; + } +} + +parser egressParserImpl(packet_in buffer, out EMPTY_H a, inout Meta b, in psa_egress_parser_input_metadata_t c, in EMPTY_BRIDGE d, in EMPTY_CLONE e, in EMPTY_CLONE f) { + state start { + transition accept; + } +} + +control ingress(inout Headers h, inout Meta m, in psa_ingress_input_metadata_t istd, inout psa_ingress_output_metadata_t ostd) { + @hidden action psadpdkbvec_union101() { + h.u.h2.setInvalid(); + } + @hidden table tbl_psadpdkbvec_union101 { + actions = { + psadpdkbvec_union101(); + } + const default_action = psadpdkbvec_union101(); + } + apply { + if (h.u.h2.isValid()) { + tbl_psadpdkbvec_union101.apply(); + } + } +} + +control egressControlImpl(inout EMPTY_H hdr, inout Meta meta, in psa_egress_input_metadata_t x, inout psa_egress_output_metadata_t ostd) { + apply { + } +} + +control deparser(packet_out b, out EMPTY_CLONE clone_i2e_meta, out EMPTY_RESUB resubmit_meta, out EMPTY_BRIDGE normal_meta, inout Headers h, in Meta local_metadata, in psa_ingress_output_metadata_t istd) { + @hidden action psadpdkbvec_union122() { + b.emit(h.h1); + b.emit(h.u.h1); + b.emit(h.u.h2); + } + @hidden table tbl_psadpdkbvec_union122 { + actions = { + psadpdkbvec_union122(); + } + const default_action = psadpdkbvec_union122(); + } + apply { + tbl_psadpdkbvec_union122.apply(); + } +} + +control egressDeparserImpl(packet_out buffer, out EMPTY_CLONE a, out EMPTY_RECIRC b, inout EMPTY_H c, in Meta d, in psa_egress_output_metadata_t e, in psa_egress_deparser_input_metadata_t f) { + apply { + } +} + +IngressPipeline(p(), ingress(), deparser()) ip; + +EgressPipeline(egressParserImpl(), egressControlImpl(), egressDeparserImpl()) ep; + +PSA_Switch(ip, PacketReplicationEngine(), ep, BufferingQueueingEngine()) main; + diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-bvec_union.p4 b/testdata/p4_16_samples_outputs/psa-dpdk-bvec_union.p4 new file mode 100644 index 00000000000..f3b640002b0 --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-bvec_union.p4 @@ -0,0 +1,107 @@ +#include +#include + +header EMPTY_H { +} + +struct EMPTY_RESUB { +} + +struct EMPTY_CLONE { +} + +struct EMPTY_BRIDGE { +} + +struct EMPTY_RECIRC { +} + +struct alt_t { + bit<1> valid; + bit<7> port; +} + +struct row_t { + alt_t alt0; + alt_t alt1; +} + +header Hdr1 { + bit<8> a; + row_t row0; + row_t row1; +} + +header Hdr2 { + bit<16> b; + row_t row; +} + +header_union U { + Hdr1 h1; + Hdr2 h2; +} + +struct Headers { + Hdr1 h1; + U u; +} + +struct Meta { +} + +parser p(packet_in b, out Headers h, inout Meta m, in psa_ingress_parser_input_metadata_t x, in EMPTY_RESUB resub_meta, in EMPTY_RECIRC recirc_meta) { + state start { + b.extract(h.h1); + transition select(h.h1.a) { + 0: getH1; + default: getH2; + } + } + state getH1 { + b.extract(h.u.h1); + transition accept; + } + state getH2 { + b.extract(h.u.h2); + transition accept; + } +} + +parser egressParserImpl(packet_in buffer, out EMPTY_H a, inout Meta b, in psa_egress_parser_input_metadata_t c, in EMPTY_BRIDGE d, in EMPTY_CLONE e, in EMPTY_CLONE f) { + state start { + transition accept; + } +} + +control ingress(inout Headers h, inout Meta m, in psa_ingress_input_metadata_t istd, inout psa_ingress_output_metadata_t ostd) { + apply { + if (h.u.h2.isValid()) { + h.u.h2.setInvalid(); + } + } +} + +control egressControlImpl(inout EMPTY_H hdr, inout Meta meta, in psa_egress_input_metadata_t x, inout psa_egress_output_metadata_t ostd) { + apply { + } +} + +control deparser(packet_out b, out EMPTY_CLONE clone_i2e_meta, out EMPTY_RESUB resubmit_meta, out EMPTY_BRIDGE normal_meta, inout Headers h, in Meta local_metadata, in psa_ingress_output_metadata_t istd) { + apply { + b.emit(h.h1); + b.emit(h.u); + } +} + +control egressDeparserImpl(packet_out buffer, out EMPTY_CLONE a, out EMPTY_RECIRC b, inout EMPTY_H c, in Meta d, in psa_egress_output_metadata_t e, in psa_egress_deparser_input_metadata_t f) { + apply { + } +} + +IngressPipeline(p(), ingress(), deparser()) ip; + +EgressPipeline(egressParserImpl(), egressControlImpl(), egressDeparserImpl()) ep; + +PSA_Switch(ip, PacketReplicationEngine(), ep, BufferingQueueingEngine()) main; + diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-bvec_union.p4-error b/testdata/p4_16_samples_outputs/psa-dpdk-bvec_union.p4-error new file mode 100644 index 00000000000..e69de29bb2d diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-bvec_union.p4-stderr b/testdata/p4_16_samples_outputs/psa-dpdk-bvec_union.p4-stderr new file mode 100644 index 00000000000..e69de29bb2d diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-bvec_union.p4.bfrt.json b/testdata/p4_16_samples_outputs/psa-dpdk-bvec_union.p4.bfrt.json new file mode 100644 index 00000000000..b6d66a630db --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-bvec_union.p4.bfrt.json @@ -0,0 +1,5 @@ +{ + "schema_version" : "1.0.0", + "tables" : [], + "learn_filters" : [] +} \ No newline at end of file diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-bvec_union.p4.entries.txt b/testdata/p4_16_samples_outputs/psa-dpdk-bvec_union.p4.entries.txt new file mode 100644 index 00000000000..e69de29bb2d diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-bvec_union.p4.p4info.txt b/testdata/p4_16_samples_outputs/psa-dpdk-bvec_union.p4.p4info.txt new file mode 100644 index 00000000000..77612386454 --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-bvec_union.p4.p4info.txt @@ -0,0 +1,3 @@ +pkg_info { + arch: "psa" +} diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-bvec_union.p4.spec b/testdata/p4_16_samples_outputs/psa-dpdk-bvec_union.p4.spec new file mode 100644 index 00000000000..f78b2b43801 --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-bvec_union.p4.spec @@ -0,0 +1,70 @@ + +struct Hdr1 { + bit<8> _a0 + ;oldname:_row0_alt0_valid1__row0_alt0_port2 + bit<8> _row0_alt0_valid1__row0_alt0_0 + ;oldname:_row0_alt1_valid3__row0_alt1_port4 + bit<8> _row0_alt1_valid3__row0_alt1_1 + ;oldname:_row1_alt0_valid5__row1_alt0_port6 + bit<8> _row1_alt0_valid5__row1_alt0_2 + ;oldname:_row1_alt1_valid7__row1_alt1_port8 + bit<8> _row1_alt1_valid7__row1_alt1_3 +} + +struct Hdr2 { + bit<16> _b0 + ;oldname:_row_alt0_valid1__row_alt0_port2 + bit<8> _row_alt0_valid1__row_alt0_po4 + ;oldname:_row_alt1_valid3__row_alt1_port4 + bit<8> _row_alt1_valid3__row_alt1_po5 +} + +struct psa_ingress_output_metadata_t { + bit<8> class_of_service + bit<8> clone + bit<16> clone_session_id + bit<8> drop + bit<8> resubmit + bit<32> multicast_group + bit<32> egress_port +} + +struct psa_egress_output_metadata_t { + bit<8> clone + bit<16> clone_session_id + bit<8> drop +} + +struct psa_egress_deparser_input_metadata_t { + bit<32> egress_port +} + +header h1 instanceof Hdr1 +header u instanceof U + +struct Meta { + bit<32> psa_ingress_input_metadata_ingress_port + bit<8> psa_ingress_output_metadata_drop + bit<32> psa_ingress_output_metadata_egress_port +} +metadata instanceof Meta + +apply { + rx m.psa_ingress_input_metadata_ingress_port + mov m.psa_ingress_output_metadata_drop 0x0 + extract h.h1 + jmpeq P_GETH1 h.h1._a0 0x0 + extract h.u.h2 + jmp P_ACCEPT + P_GETH1 : extract h.u.h1 + P_ACCEPT : jmpnv LABEL_END h.u.h2 + invalidate h.u.h2 + LABEL_END : jmpneq LABEL_DROP m.psa_ingress_output_metadata_drop 0x0 + emit h.h1 + emit h.u.h1 + emit h.u.h2 + tx m.psa_ingress_output_metadata_egress_port + LABEL_DROP : drop +} + + diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-control-hs-index-test2-first.p4 b/testdata/p4_16_samples_outputs/psa-dpdk-control-hs-index-test2-first.p4 new file mode 100644 index 00000000000..1a46a761c21 --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-control-hs-index-test2-first.p4 @@ -0,0 +1,95 @@ +#include +#include + +header EMPTY_H { +} + +struct EMPTY_RESUB { +} + +struct EMPTY_CLONE { +} + +struct EMPTY_BRIDGE { +} + +struct EMPTY_RECIRC { +} + +header ethernet_t { + bit<48> dst_addr; + bit<48> src_addr; + bit<16> eth_type; +} + +header h_index { + bit<32> index; +} + +header h_stack { + bit<32> a; +} + +struct headers { + ethernet_t eth_hdr; + h_stack[3] h; + h_index i; +} + +struct Meta { +} + +parser p(packet_in pkt, out headers hdr, inout Meta m, in psa_ingress_parser_input_metadata_t x, in EMPTY_RESUB resub_meta, in EMPTY_RECIRC recirc_meta) { + state start { + transition parse_hdrs; + } + state parse_hdrs { + pkt.extract(hdr.eth_hdr); + pkt.extract(hdr.h[0]); + pkt.extract(hdr.h[1]); + pkt.extract(hdr.h[2]); + pkt.extract(hdr.i); + transition accept; + } +} + +parser egressParserImpl(packet_in buffer, out EMPTY_H a, inout Meta b, in psa_egress_parser_input_metadata_t c, in EMPTY_BRIDGE d, in EMPTY_CLONE e, in EMPTY_CLONE f) { + state start { + transition accept; + } +} + +control ingress(inout headers h, inout Meta m, in psa_ingress_input_metadata_t istd, inout psa_ingress_output_metadata_t ostd) { + apply { + if (h.h[h.i.index + 32w1].a > 32w10) { + h.h[h.i.index + 32w1].a = 32w1; + } + } +} + +control egressControlImpl(inout EMPTY_H hdr, inout Meta meta, in psa_egress_input_metadata_t x, inout psa_egress_output_metadata_t ostd) { + apply { + } +} + +control deparser(packet_out pkt, out EMPTY_CLONE clone_i2e_meta, out EMPTY_RESUB resubmit_meta, out EMPTY_BRIDGE normal_meta, inout headers h, in Meta local_metadata, in psa_ingress_output_metadata_t istd) { + apply { + pkt.emit(h.eth_hdr); + pkt.emit(h.h[0]); + pkt.emit(h.h[1]); + pkt.emit(h.h[2]); + pkt.emit(h.i); + } +} + +control egressDeparserImpl(packet_out buffer, out EMPTY_CLONE a, out EMPTY_RECIRC b, inout EMPTY_H c, in Meta d, in psa_egress_output_metadata_t e, in psa_egress_deparser_input_metadata_t f) { + apply { + } +} + +IngressPipeline(p(), ingress(), deparser()) ip; + +EgressPipeline(egressParserImpl(), egressControlImpl(), egressDeparserImpl()) ep; + +PSA_Switch(ip, PacketReplicationEngine(), ep, BufferingQueueingEngine()) main; + diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-control-hs-index-test2-frontend.p4 b/testdata/p4_16_samples_outputs/psa-dpdk-control-hs-index-test2-frontend.p4 new file mode 100644 index 00000000000..44079cb32a3 --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-control-hs-index-test2-frontend.p4 @@ -0,0 +1,92 @@ +#include +#include + +header EMPTY_H { +} + +struct EMPTY_RESUB { +} + +struct EMPTY_CLONE { +} + +struct EMPTY_BRIDGE { +} + +struct EMPTY_RECIRC { +} + +header ethernet_t { + bit<48> dst_addr; + bit<48> src_addr; + bit<16> eth_type; +} + +header h_index { + bit<32> index; +} + +header h_stack { + bit<32> a; +} + +struct headers { + ethernet_t eth_hdr; + h_stack[3] h; + h_index i; +} + +struct Meta { +} + +parser p(packet_in pkt, out headers hdr, inout Meta m, in psa_ingress_parser_input_metadata_t x, in EMPTY_RESUB resub_meta, in EMPTY_RECIRC recirc_meta) { + state start { + pkt.extract(hdr.eth_hdr); + pkt.extract(hdr.h[0]); + pkt.extract(hdr.h[1]); + pkt.extract(hdr.h[2]); + pkt.extract(hdr.i); + transition accept; + } +} + +parser egressParserImpl(packet_in buffer, out EMPTY_H a, inout Meta b, in psa_egress_parser_input_metadata_t c, in EMPTY_BRIDGE d, in EMPTY_CLONE e, in EMPTY_CLONE f) { + state start { + transition accept; + } +} + +control ingress(inout headers h, inout Meta m, in psa_ingress_input_metadata_t istd, inout psa_ingress_output_metadata_t ostd) { + apply { + if (h.h[h.i.index + 32w1].a > 32w10) { + h.h[h.i.index + 32w1].a = 32w1; + } + } +} + +control egressControlImpl(inout EMPTY_H hdr, inout Meta meta, in psa_egress_input_metadata_t x, inout psa_egress_output_metadata_t ostd) { + apply { + } +} + +control deparser(packet_out pkt, out EMPTY_CLONE clone_i2e_meta, out EMPTY_RESUB resubmit_meta, out EMPTY_BRIDGE normal_meta, inout headers h, in Meta local_metadata, in psa_ingress_output_metadata_t istd) { + apply { + pkt.emit(h.eth_hdr); + pkt.emit(h.h[0]); + pkt.emit(h.h[1]); + pkt.emit(h.h[2]); + pkt.emit(h.i); + } +} + +control egressDeparserImpl(packet_out buffer, out EMPTY_CLONE a, out EMPTY_RECIRC b, inout EMPTY_H c, in Meta d, in psa_egress_output_metadata_t e, in psa_egress_deparser_input_metadata_t f) { + apply { + } +} + +IngressPipeline(p(), ingress(), deparser()) ip; + +EgressPipeline(egressParserImpl(), egressControlImpl(), egressDeparserImpl()) ep; + +PSA_Switch(ip, PacketReplicationEngine(), ep, BufferingQueueingEngine()) main; + diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-control-hs-index-test2-midend.p4 b/testdata/p4_16_samples_outputs/psa-dpdk-control-hs-index-test2-midend.p4 new file mode 100644 index 00000000000..823e6c5936d --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-control-hs-index-test2-midend.p4 @@ -0,0 +1,143 @@ +#include +#include + +header EMPTY_H { +} + +struct EMPTY_RESUB { +} + +struct EMPTY_CLONE { +} + +struct EMPTY_BRIDGE { +} + +struct EMPTY_RECIRC { +} + +header ethernet_t { + bit<48> dst_addr; + bit<48> src_addr; + bit<16> eth_type; +} + +header h_index { + bit<32> index; +} + +header h_stack { + bit<32> a; +} + +struct headers { + ethernet_t eth_hdr; + h_stack[3] h; + h_index i; +} + +struct Meta { +} + +parser p(packet_in pkt, out headers hdr, inout Meta m, in psa_ingress_parser_input_metadata_t x, in EMPTY_RESUB resub_meta, in EMPTY_RECIRC recirc_meta) { + state start { + pkt.extract(hdr.eth_hdr); + pkt.extract(hdr.h[0]); + pkt.extract(hdr.h[1]); + pkt.extract(hdr.h[2]); + pkt.extract(hdr.i); + transition accept; + } +} + +parser egressParserImpl(packet_in buffer, out EMPTY_H a, inout Meta b, in psa_egress_parser_input_metadata_t c, in EMPTY_BRIDGE d, in EMPTY_CLONE e, in EMPTY_CLONE f) { + state start { + transition accept; + } +} + +control ingress(inout headers h, inout Meta m, in psa_ingress_input_metadata_t istd, inout psa_ingress_output_metadata_t ostd) { + bit<32> hsiVar; + @hidden action psadpdkcontrolhsindextest2l67() { + h.h[32w0].a = 32w1; + } + @hidden action psadpdkcontrolhsindextest2l67_0() { + h.h[32w1].a = 32w1; + } + @hidden action psadpdkcontrolhsindextest2l67_1() { + h.h[32w2].a = 32w1; + } + @hidden action psadpdkcontrolhsindextest2l66() { + hsiVar = h.i.index + 32w1; + } + @hidden table tbl_psadpdkcontrolhsindextest2l66 { + actions = { + psadpdkcontrolhsindextest2l66(); + } + const default_action = psadpdkcontrolhsindextest2l66(); + } + @hidden table tbl_psadpdkcontrolhsindextest2l67 { + actions = { + psadpdkcontrolhsindextest2l67(); + } + const default_action = psadpdkcontrolhsindextest2l67(); + } + @hidden table tbl_psadpdkcontrolhsindextest2l67_0 { + actions = { + psadpdkcontrolhsindextest2l67_0(); + } + const default_action = psadpdkcontrolhsindextest2l67_0(); + } + @hidden table tbl_psadpdkcontrolhsindextest2l67_1 { + actions = { + psadpdkcontrolhsindextest2l67_1(); + } + const default_action = psadpdkcontrolhsindextest2l67_1(); + } + apply { + tbl_psadpdkcontrolhsindextest2l66.apply(); + if (hsiVar == 32w0 && h.h[32w0].a > 32w10) { + tbl_psadpdkcontrolhsindextest2l67.apply(); + } else if (hsiVar == 32w1 && h.h[32w1].a > 32w10) { + tbl_psadpdkcontrolhsindextest2l67_0.apply(); + } else if (hsiVar == 32w2 && h.h[32w2].a > 32w10) { + tbl_psadpdkcontrolhsindextest2l67_1.apply(); + } + } +} + +control egressControlImpl(inout EMPTY_H hdr, inout Meta meta, in psa_egress_input_metadata_t x, inout psa_egress_output_metadata_t ostd) { + apply { + } +} + +control deparser(packet_out pkt, out EMPTY_CLONE clone_i2e_meta, out EMPTY_RESUB resubmit_meta, out EMPTY_BRIDGE normal_meta, inout headers h, in Meta local_metadata, in psa_ingress_output_metadata_t istd) { + @hidden action psadpdkcontrolhsindextest2l91() { + pkt.emit(h.eth_hdr); + pkt.emit(h.h[0]); + pkt.emit(h.h[1]); + pkt.emit(h.h[2]); + pkt.emit(h.i); + } + @hidden table tbl_psadpdkcontrolhsindextest2l91 { + actions = { + psadpdkcontrolhsindextest2l91(); + } + const default_action = psadpdkcontrolhsindextest2l91(); + } + apply { + tbl_psadpdkcontrolhsindextest2l91.apply(); + } +} + +control egressDeparserImpl(packet_out buffer, out EMPTY_CLONE a, out EMPTY_RECIRC b, inout EMPTY_H c, in Meta d, in psa_egress_output_metadata_t e, in psa_egress_deparser_input_metadata_t f) { + apply { + } +} + +IngressPipeline(p(), ingress(), deparser()) ip; + +EgressPipeline(egressParserImpl(), egressControlImpl(), egressDeparserImpl()) ep; + +PSA_Switch(ip, PacketReplicationEngine(), ep, BufferingQueueingEngine()) main; + diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-control-hs-index-test2.p4 b/testdata/p4_16_samples_outputs/psa-dpdk-control-hs-index-test2.p4 new file mode 100644 index 00000000000..6465ef451e6 --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-control-hs-index-test2.p4 @@ -0,0 +1,95 @@ +#include +#include + +header EMPTY_H { +} + +struct EMPTY_RESUB { +} + +struct EMPTY_CLONE { +} + +struct EMPTY_BRIDGE { +} + +struct EMPTY_RECIRC { +} + +header ethernet_t { + bit<48> dst_addr; + bit<48> src_addr; + bit<16> eth_type; +} + +header h_index { + bit<32> index; +} + +header h_stack { + bit<32> a; +} + +struct headers { + ethernet_t eth_hdr; + h_stack[3] h; + h_index i; +} + +struct Meta { +} + +parser p(packet_in pkt, out headers hdr, inout Meta m, in psa_ingress_parser_input_metadata_t x, in EMPTY_RESUB resub_meta, in EMPTY_RECIRC recirc_meta) { + state start { + transition parse_hdrs; + } + state parse_hdrs { + pkt.extract(hdr.eth_hdr); + pkt.extract(hdr.h[0]); + pkt.extract(hdr.h[1]); + pkt.extract(hdr.h[2]); + pkt.extract(hdr.i); + transition accept; + } +} + +parser egressParserImpl(packet_in buffer, out EMPTY_H a, inout Meta b, in psa_egress_parser_input_metadata_t c, in EMPTY_BRIDGE d, in EMPTY_CLONE e, in EMPTY_CLONE f) { + state start { + transition accept; + } +} + +control ingress(inout headers h, inout Meta m, in psa_ingress_input_metadata_t istd, inout psa_ingress_output_metadata_t ostd) { + apply { + if (h.h[h.i.index + 1].a > 10) { + h.h[h.i.index + 1].a = 1; + } + } +} + +control egressControlImpl(inout EMPTY_H hdr, inout Meta meta, in psa_egress_input_metadata_t x, inout psa_egress_output_metadata_t ostd) { + apply { + } +} + +control deparser(packet_out pkt, out EMPTY_CLONE clone_i2e_meta, out EMPTY_RESUB resubmit_meta, out EMPTY_BRIDGE normal_meta, inout headers h, in Meta local_metadata, in psa_ingress_output_metadata_t istd) { + apply { + pkt.emit(h.eth_hdr); + pkt.emit(h.h[0]); + pkt.emit(h.h[1]); + pkt.emit(h.h[2]); + pkt.emit(h.i); + } +} + +control egressDeparserImpl(packet_out buffer, out EMPTY_CLONE a, out EMPTY_RECIRC b, inout EMPTY_H c, in Meta d, in psa_egress_output_metadata_t e, in psa_egress_deparser_input_metadata_t f) { + apply { + } +} + +IngressPipeline(p(), ingress(), deparser()) ip; + +EgressPipeline(egressParserImpl(), egressControlImpl(), egressDeparserImpl()) ep; + +PSA_Switch(ip, PacketReplicationEngine(), ep, BufferingQueueingEngine()) main; + diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-control-hs-index-test2.p4-error b/testdata/p4_16_samples_outputs/psa-dpdk-control-hs-index-test2.p4-error new file mode 100644 index 00000000000..e69de29bb2d diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-control-hs-index-test2.p4-stderr b/testdata/p4_16_samples_outputs/psa-dpdk-control-hs-index-test2.p4-stderr new file mode 100644 index 00000000000..e69de29bb2d diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-control-hs-index-test2.p4.bfrt.json b/testdata/p4_16_samples_outputs/psa-dpdk-control-hs-index-test2.p4.bfrt.json new file mode 100644 index 00000000000..b6d66a630db --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-control-hs-index-test2.p4.bfrt.json @@ -0,0 +1,5 @@ +{ + "schema_version" : "1.0.0", + "tables" : [], + "learn_filters" : [] +} \ No newline at end of file diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-control-hs-index-test2.p4.entries.txt b/testdata/p4_16_samples_outputs/psa-dpdk-control-hs-index-test2.p4.entries.txt new file mode 100644 index 00000000000..e69de29bb2d diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-control-hs-index-test2.p4.p4info.txt b/testdata/p4_16_samples_outputs/psa-dpdk-control-hs-index-test2.p4.p4info.txt new file mode 100644 index 00000000000..77612386454 --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-control-hs-index-test2.p4.p4info.txt @@ -0,0 +1,3 @@ +pkg_info { + arch: "psa" +} diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-control-hs-index-test2.p4.spec b/testdata/p4_16_samples_outputs/psa-dpdk-control-hs-index-test2.p4.spec new file mode 100644 index 00000000000..2b54c72be51 --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-control-hs-index-test2.p4.spec @@ -0,0 +1,85 @@ + +struct ethernet_t { + bit<48> dst_addr + bit<48> src_addr + bit<16> eth_type +} + +struct h_index { + bit<32> index +} + +struct h_stack { + bit<32> a +} + +struct psa_ingress_output_metadata_t { + bit<8> class_of_service + bit<8> clone + bit<16> clone_session_id + bit<8> drop + bit<8> resubmit + bit<32> multicast_group + bit<32> egress_port +} + +struct psa_egress_output_metadata_t { + bit<8> clone + bit<16> clone_session_id + bit<8> drop +} + +struct psa_egress_deparser_input_metadata_t { + bit<32> egress_port +} + +header eth_hdr instanceof ethernet_t +header h_0 instanceof h_stack +header h_1 instanceof h_stack +header h_2 instanceof h_stack + +header i instanceof h_index + +struct Meta { + bit<32> psa_ingress_input_metadata_ingress_port + bit<8> psa_ingress_output_metadata_drop + bit<32> psa_ingress_output_metadata_egress_port + bit<32> Ingress_tmp + bit<32> Ingress_tmp_0 + bit<32> Ingress_tmp_1 +} +metadata instanceof Meta + +apply { + rx m.psa_ingress_input_metadata_ingress_port + mov m.psa_ingress_output_metadata_drop 0x0 + extract h.eth_hdr + extract h.h_0 + extract h.h_1 + extract h.h_2 + extract h.i + mov m.Ingress_tmp_1 h.i.index + add m.Ingress_tmp_1 0x1 + jmpneq LABEL_FALSE m.Ingress_tmp_1 0x0 + mov h.h_0.a 0x1 + jmp LABEL_END + LABEL_FALSE : mov m.Ingress_tmp_0 h.i.index + add m.Ingress_tmp_0 0x1 + jmpneq LABEL_FALSE_0 m.Ingress_tmp_0 0x1 + mov h.h_1.a 0x1 + jmp LABEL_END + LABEL_FALSE_0 : mov m.Ingress_tmp h.i.index + add m.Ingress_tmp 0x1 + jmpneq LABEL_END m.Ingress_tmp 0x2 + mov h.h_2.a 0x1 + LABEL_END : jmpneq LABEL_DROP m.psa_ingress_output_metadata_drop 0x0 + emit h.eth_hdr + emit h.h_0 + emit h.h_1 + emit h.h_2 + emit h.i + tx m.psa_ingress_output_metadata_egress_port + LABEL_DROP : drop +} + + diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-default_action-bmv2.p4-error b/testdata/p4_16_samples_outputs/psa-dpdk-default_action-bmv2.p4-error new file mode 100644 index 00000000000..e69de29bb2d diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-default_action-bmv2.p4.bfrt.json b/testdata/p4_16_samples_outputs/psa-dpdk-default_action-bmv2.p4.bfrt.json new file mode 100644 index 00000000000..479c965de61 --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-default_action-bmv2.p4.bfrt.json @@ -0,0 +1,41 @@ +{ + "schema_version" : "1.0.0", + "tables" : [ + { + "name" : "ip.ingress.c.t", + "id" : 43577110, + "table_type" : "MatchAction_Direct", + "size" : 1024, + "annotations" : [], + "depends_on" : [], + "has_const_default_action" : true, + "key" : [], + "action_specs" : [ + { + "id" : 29022044, + "name" : "ingress.c.add", + "action_scope" : "TableAndDefault", + "annotations" : [], + "data" : [ + { + "id" : 1, + "name" : "data", + "repeated" : false, + "mandatory" : true, + "read_only" : false, + "annotations" : [], + "type" : { + "type" : "bytes", + "width" : 32 + } + } + ] + } + ], + "data" : [], + "supported_operations" : [], + "attributes" : ["EntryScope"] + } + ], + "learn_filters" : [] +} \ No newline at end of file diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-default_action-bmv2.p4.spec b/testdata/p4_16_samples_outputs/psa-dpdk-default_action-bmv2.p4.spec new file mode 100644 index 00000000000..71741172988 --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-default_action-bmv2.p4.spec @@ -0,0 +1,67 @@ + +struct hdr { + bit<32> a + bit<32> b +} + +struct psa_ingress_output_metadata_t { + bit<8> class_of_service + bit<8> clone + bit<16> clone_session_id + bit<8> drop + bit<8> resubmit + bit<32> multicast_group + bit<32> egress_port +} + +struct psa_egress_output_metadata_t { + bit<8> clone + bit<16> clone_session_id + bit<8> drop +} + +struct psa_egress_deparser_input_metadata_t { + bit<32> egress_port +} + +struct c_add_0_arg_t { + bit<32> data +} + +header h instanceof hdr + +struct Meta { + bit<32> psa_ingress_input_metadata_ingress_port + bit<8> psa_ingress_output_metadata_drop + bit<32> psa_ingress_output_metadata_egress_port +} +metadata instanceof Meta + +action c_add_0 args instanceof c_add_0_arg_t { + mov h.h.b h.h.a + add h.h.b t.data + return +} + +table c_t { + actions { + c_add_0 + } + default_action c_add_0 args data 0xa const + size 0x10000 +} + + +apply { + rx m.psa_ingress_input_metadata_ingress_port + mov m.psa_ingress_output_metadata_drop 0x0 + extract h.h + table c_t + mov m.psa_ingress_output_metadata_egress_port 0x0 + jmpneq LABEL_DROP m.psa_ingress_output_metadata_drop 0x0 + emit h.h + tx m.psa_ingress_output_metadata_egress_port + LABEL_DROP : drop +} + + diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-default_action-first.p4 b/testdata/p4_16_samples_outputs/psa-dpdk-default_action-first.p4 new file mode 100644 index 00000000000..d052e7a09e7 --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-default_action-first.p4 @@ -0,0 +1,88 @@ +#include +#include + +header EMPTY_H { +} + +struct EMPTY_RESUB { +} + +struct EMPTY_CLONE { +} + +struct EMPTY_BRIDGE { +} + +struct EMPTY_RECIRC { +} + +header hdr { + bit<32> a; + bit<32> b; +} + +control compute(inout hdr h) { + action add(bit<32> data) { + h.b = h.a + data; + } + table t { + actions = { + add(); + } + const default_action = add(32w10); + } + apply { + t.apply(); + } +} + +struct Headers { + hdr h; +} + +struct Meta { +} + +parser p(packet_in b, out Headers h, inout Meta m, in psa_ingress_parser_input_metadata_t x, in EMPTY_RESUB resub_meta, in EMPTY_RECIRC recirc_meta) { + state start { + b.extract(h.h); + transition accept; + } +} + +parser egressParserImpl(packet_in buffer, out EMPTY_H a, inout Meta b, in psa_egress_parser_input_metadata_t c, in EMPTY_BRIDGE d, in EMPTY_CLONE e, in EMPTY_CLONE f) { + state start { + transition accept; + } +} + +control ingress(inout Headers h, inout Meta m, in psa_ingress_input_metadata_t istd, inout psa_ingress_output_metadata_t ostd) { + compute() c; + apply { + c.apply(h.h); + ostd.egress_port = (PortId_t)32w0; + } +} + +control egressControlImpl(inout EMPTY_H h, inout Meta meta, in psa_egress_input_metadata_t x, inout psa_egress_output_metadata_t ostd) { + apply { + } +} + +control deparser(packet_out b, out EMPTY_CLONE clone_i2e_meta, out EMPTY_RESUB resubmit_meta, out EMPTY_BRIDGE normal_meta, inout Headers h, in Meta local_metadata, in psa_ingress_output_metadata_t istd) { + apply { + b.emit(h.h); + } +} + +control egressDeparserImpl(packet_out buffer, out EMPTY_CLONE a, out EMPTY_RECIRC b, inout EMPTY_H c, in Meta d, in psa_egress_output_metadata_t e, in psa_egress_deparser_input_metadata_t f) { + apply { + } +} + +IngressPipeline(p(), ingress(), deparser()) ip; + +EgressPipeline(egressParserImpl(), egressControlImpl(), egressDeparserImpl()) ep; + +PSA_Switch(ip, PacketReplicationEngine(), ep, BufferingQueueingEngine()) main; + diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-default_action-frontend.p4 b/testdata/p4_16_samples_outputs/psa-dpdk-default_action-frontend.p4 new file mode 100644 index 00000000000..d7fcc840c02 --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-default_action-frontend.p4 @@ -0,0 +1,81 @@ +#include +#include + +header EMPTY_H { +} + +struct EMPTY_RESUB { +} + +struct EMPTY_CLONE { +} + +struct EMPTY_BRIDGE { +} + +struct EMPTY_RECIRC { +} + +header hdr { + bit<32> a; + bit<32> b; +} + +struct Headers { + hdr h; +} + +struct Meta { +} + +parser p(packet_in b, out Headers h, inout Meta m, in psa_ingress_parser_input_metadata_t x, in EMPTY_RESUB resub_meta, in EMPTY_RECIRC recirc_meta) { + state start { + b.extract(h.h); + transition accept; + } +} + +parser egressParserImpl(packet_in buffer, out EMPTY_H a, inout Meta b, in psa_egress_parser_input_metadata_t c, in EMPTY_BRIDGE d, in EMPTY_CLONE e, in EMPTY_CLONE f) { + state start { + transition accept; + } +} + +control ingress(inout Headers h, inout Meta m, in psa_ingress_input_metadata_t istd, inout psa_ingress_output_metadata_t ostd) { + @name("ingress.c.add") action c_add_0(@name("data") bit<32> data_1) { + h.h.b = h.h.a + data_1; + } + @name("ingress.c.t") table c_t { + actions = { + c_add_0(); + } + const default_action = c_add_0(32w10); + } + apply { + c_t.apply(); + ostd.egress_port = (PortId_t)32w0; + } +} + +control egressControlImpl(inout EMPTY_H h, inout Meta meta, in psa_egress_input_metadata_t x, inout psa_egress_output_metadata_t ostd) { + apply { + } +} + +control deparser(packet_out b, out EMPTY_CLONE clone_i2e_meta, out EMPTY_RESUB resubmit_meta, out EMPTY_BRIDGE normal_meta, inout Headers h, in Meta local_metadata, in psa_ingress_output_metadata_t istd) { + apply { + b.emit(h.h); + } +} + +control egressDeparserImpl(packet_out buffer, out EMPTY_CLONE a, out EMPTY_RECIRC b, inout EMPTY_H c, in Meta d, in psa_egress_output_metadata_t e, in psa_egress_deparser_input_metadata_t f) { + apply { + } +} + +IngressPipeline(p(), ingress(), deparser()) ip; + +EgressPipeline(egressParserImpl(), egressControlImpl(), egressDeparserImpl()) ep; + +PSA_Switch(ip, PacketReplicationEngine(), ep, BufferingQueueingEngine()) main; + diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-default_action-midend.p4 b/testdata/p4_16_samples_outputs/psa-dpdk-default_action-midend.p4 new file mode 100644 index 00000000000..f1293414946 --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-default_action-midend.p4 @@ -0,0 +1,99 @@ +#include +#include + +header EMPTY_H { +} + +struct EMPTY_RESUB { +} + +struct EMPTY_CLONE { +} + +struct EMPTY_BRIDGE { +} + +struct EMPTY_RECIRC { +} + +header hdr { + bit<32> a; + bit<32> b; +} + +struct Headers { + hdr h; +} + +struct Meta { +} + +parser p(packet_in b, out Headers h, inout Meta m, in psa_ingress_parser_input_metadata_t x, in EMPTY_RESUB resub_meta, in EMPTY_RECIRC recirc_meta) { + state start { + b.extract(h.h); + transition accept; + } +} + +parser egressParserImpl(packet_in buffer, out EMPTY_H a, inout Meta b, in psa_egress_parser_input_metadata_t c, in EMPTY_BRIDGE d, in EMPTY_CLONE e, in EMPTY_CLONE f) { + state start { + transition accept; + } +} + +control ingress(inout Headers h, inout Meta m, in psa_ingress_input_metadata_t istd, inout psa_ingress_output_metadata_t ostd) { + @name("ingress.c.add") action c_add_0(@name("data") bit<32> data_1) { + h.h.b = h.h.a + data_1; + } + @name("ingress.c.t") table c_t { + actions = { + c_add_0(); + } + const default_action = c_add_0(32w10); + } + @hidden action arithinlineskeletond58() { + ostd.egress_port = 32w0; + } + @hidden table tbl_arithinlineskeletond58 { + actions = { + arithinlineskeletond58(); + } + const default_action = arithinlineskeletond58(); + } + apply { + c_t.apply(); + tbl_arithinlineskeletond58.apply(); + } +} + +control egressControlImpl(inout EMPTY_H h, inout Meta meta, in psa_egress_input_metadata_t x, inout psa_egress_output_metadata_t ostd) { + apply { + } +} + +control deparser(packet_out b, out EMPTY_CLONE clone_i2e_meta, out EMPTY_RESUB resubmit_meta, out EMPTY_BRIDGE normal_meta, inout Headers h, in Meta local_metadata, in psa_ingress_output_metadata_t istd) { + @hidden action arithinlineskeletond77() { + b.emit(h.h); + } + @hidden table tbl_arithinlineskeletond77 { + actions = { + arithinlineskeletond77(); + } + const default_action = arithinlineskeletond77(); + } + apply { + tbl_arithinlineskeletond77.apply(); + } +} + +control egressDeparserImpl(packet_out buffer, out EMPTY_CLONE a, out EMPTY_RECIRC b, inout EMPTY_H c, in Meta d, in psa_egress_output_metadata_t e, in psa_egress_deparser_input_metadata_t f) { + apply { + } +} + +IngressPipeline(p(), ingress(), deparser()) ip; + +EgressPipeline(egressParserImpl(), egressControlImpl(), egressDeparserImpl()) ep; + +PSA_Switch(ip, PacketReplicationEngine(), ep, BufferingQueueingEngine()) main; + diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-default_action.p4 b/testdata/p4_16_samples_outputs/psa-dpdk-default_action.p4 new file mode 100644 index 00000000000..b1bb4f0f087 --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-default_action.p4 @@ -0,0 +1,88 @@ +#include +#include + +header EMPTY_H { +} + +struct EMPTY_RESUB { +} + +struct EMPTY_CLONE { +} + +struct EMPTY_BRIDGE { +} + +struct EMPTY_RECIRC { +} + +header hdr { + bit<32> a; + bit<32> b; +} + +control compute(inout hdr h) { + action add(bit<32> data) { + h.b = h.a + data; + } + table t { + actions = { + add; + } + const default_action = add(10); + } + apply { + t.apply(); + } +} + +struct Headers { + hdr h; +} + +struct Meta { +} + +parser p(packet_in b, out Headers h, inout Meta m, in psa_ingress_parser_input_metadata_t x, in EMPTY_RESUB resub_meta, in EMPTY_RECIRC recirc_meta) { + state start { + b.extract(h.h); + transition accept; + } +} + +parser egressParserImpl(packet_in buffer, out EMPTY_H a, inout Meta b, in psa_egress_parser_input_metadata_t c, in EMPTY_BRIDGE d, in EMPTY_CLONE e, in EMPTY_CLONE f) { + state start { + transition accept; + } +} + +control ingress(inout Headers h, inout Meta m, in psa_ingress_input_metadata_t istd, inout psa_ingress_output_metadata_t ostd) { + compute() c; + apply { + c.apply(h.h); + ostd.egress_port = (PortId_t)(PortIdUint_t)0; + } +} + +control egressControlImpl(inout EMPTY_H h, inout Meta meta, in psa_egress_input_metadata_t x, inout psa_egress_output_metadata_t ostd) { + apply { + } +} + +control deparser(packet_out b, out EMPTY_CLONE clone_i2e_meta, out EMPTY_RESUB resubmit_meta, out EMPTY_BRIDGE normal_meta, inout Headers h, in Meta local_metadata, in psa_ingress_output_metadata_t istd) { + apply { + b.emit(h.h); + } +} + +control egressDeparserImpl(packet_out buffer, out EMPTY_CLONE a, out EMPTY_RECIRC b, inout EMPTY_H c, in Meta d, in psa_egress_output_metadata_t e, in psa_egress_deparser_input_metadata_t f) { + apply { + } +} + +IngressPipeline(p(), ingress(), deparser()) ip; + +EgressPipeline(egressParserImpl(), egressControlImpl(), egressDeparserImpl()) ep; + +PSA_Switch(ip, PacketReplicationEngine(), ep, BufferingQueueingEngine()) main; + diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-default_action.p4-error b/testdata/p4_16_samples_outputs/psa-dpdk-default_action.p4-error new file mode 100644 index 00000000000..e69de29bb2d diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-default_action.p4-stderr b/testdata/p4_16_samples_outputs/psa-dpdk-default_action.p4-stderr new file mode 100644 index 00000000000..e69de29bb2d diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-default_action.p4.bfrt.json b/testdata/p4_16_samples_outputs/psa-dpdk-default_action.p4.bfrt.json new file mode 100644 index 00000000000..479c965de61 --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-default_action.p4.bfrt.json @@ -0,0 +1,41 @@ +{ + "schema_version" : "1.0.0", + "tables" : [ + { + "name" : "ip.ingress.c.t", + "id" : 43577110, + "table_type" : "MatchAction_Direct", + "size" : 1024, + "annotations" : [], + "depends_on" : [], + "has_const_default_action" : true, + "key" : [], + "action_specs" : [ + { + "id" : 29022044, + "name" : "ingress.c.add", + "action_scope" : "TableAndDefault", + "annotations" : [], + "data" : [ + { + "id" : 1, + "name" : "data", + "repeated" : false, + "mandatory" : true, + "read_only" : false, + "annotations" : [], + "type" : { + "type" : "bytes", + "width" : 32 + } + } + ] + } + ], + "data" : [], + "supported_operations" : [], + "attributes" : ["EntryScope"] + } + ], + "learn_filters" : [] +} \ No newline at end of file diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-default_action.p4.entries.txt b/testdata/p4_16_samples_outputs/psa-dpdk-default_action.p4.entries.txt new file mode 100644 index 00000000000..e69de29bb2d diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-default_action.p4.p4info.txt b/testdata/p4_16_samples_outputs/psa-dpdk-default_action.p4.p4info.txt new file mode 100644 index 00000000000..61a628b1199 --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-default_action.p4.p4info.txt @@ -0,0 +1,29 @@ +pkg_info { + arch: "psa" +} +tables { + preamble { + id: 43577110 + name: "ingress.c.t" + alias: "t" + } + action_refs { + id: 29022044 + } + const_default_action_id: 29022044 + size: 1024 +} +actions { + preamble { + id: 29022044 + name: "ingress.c.add" + alias: "add" + } + params { + id: 1 + name: "data" + bitwidth: 32 + } +} +type_info { +} diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-default_action.p4.spec b/testdata/p4_16_samples_outputs/psa-dpdk-default_action.p4.spec new file mode 100644 index 00000000000..71741172988 --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-default_action.p4.spec @@ -0,0 +1,67 @@ + +struct hdr { + bit<32> a + bit<32> b +} + +struct psa_ingress_output_metadata_t { + bit<8> class_of_service + bit<8> clone + bit<16> clone_session_id + bit<8> drop + bit<8> resubmit + bit<32> multicast_group + bit<32> egress_port +} + +struct psa_egress_output_metadata_t { + bit<8> clone + bit<16> clone_session_id + bit<8> drop +} + +struct psa_egress_deparser_input_metadata_t { + bit<32> egress_port +} + +struct c_add_0_arg_t { + bit<32> data +} + +header h instanceof hdr + +struct Meta { + bit<32> psa_ingress_input_metadata_ingress_port + bit<8> psa_ingress_output_metadata_drop + bit<32> psa_ingress_output_metadata_egress_port +} +metadata instanceof Meta + +action c_add_0 args instanceof c_add_0_arg_t { + mov h.h.b h.h.a + add h.h.b t.data + return +} + +table c_t { + actions { + c_add_0 + } + default_action c_add_0 args data 0xa const + size 0x10000 +} + + +apply { + rx m.psa_ingress_input_metadata_ingress_port + mov m.psa_ingress_output_metadata_drop 0x0 + extract h.h + table c_t + mov m.psa_ingress_output_metadata_egress_port 0x0 + jmpneq LABEL_DROP m.psa_ingress_output_metadata_drop 0x0 + emit h.h + tx m.psa_ingress_output_metadata_egress_port + LABEL_DROP : drop +} + + diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-free-form-annotation-first.p4 b/testdata/p4_16_samples_outputs/psa-dpdk-free-form-annotation-first.p4 new file mode 100644 index 00000000000..7034a60c4fd --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-free-form-annotation-first.p4 @@ -0,0 +1,72 @@ +#include +#include + +header EMPTY_H { +} + +struct EMPTY_RESUB { +} + +struct EMPTY_CLONE { +} + +struct EMPTY_BRIDGE { +} + +struct EMPTY_RECIRC { +} + +@scrabble(- What do you get if you multiply six by nine ? - Six by nine . Forty two . - That ' s it . That ' s all there is . - I always thought there was something fundamentally wrong with the universe . 0xdeadbeef) header hdr { + bit<112> field; +} + +struct Header_t { + hdr h; +} + +struct Meta_t { +} + +parser p(packet_in b, out Header_t h, inout Meta_t m, in psa_ingress_parser_input_metadata_t x, in EMPTY_RESUB resub_meta, in EMPTY_RECIRC recirc_meta) { + state start { + transition accept; + } +} + +parser egressParserImpl(packet_in buffer, out EMPTY_H a, inout Meta_t b, in psa_egress_parser_input_metadata_t c, in EMPTY_BRIDGE d, in EMPTY_CLONE e, in EMPTY_CLONE f) { + state start { + transition accept; + } +} + +control c(inout Header_t h, inout Meta_t m) { + apply { + } +} + +control ingress(inout Header_t h, inout Meta_t m, in psa_ingress_input_metadata_t istd, inout psa_ingress_output_metadata_t ostd) { + apply { + } +} + +control egressControlImpl(inout EMPTY_H h, inout Meta_t meta, in psa_egress_input_metadata_t x, inout psa_egress_output_metadata_t ostd) { + apply { + } +} + +control deparser(packet_out b, out EMPTY_CLONE clone_i2e_meta, out EMPTY_RESUB resubmit_meta, out EMPTY_BRIDGE normal_meta, inout Header_t h, in Meta_t local_metadata, in psa_ingress_output_metadata_t istd) { + apply { + } +} + +control egressDeparserImpl(packet_out buffer, out EMPTY_CLONE a, out EMPTY_RECIRC b, inout EMPTY_H c1, in Meta_t d, in psa_egress_output_metadata_t e, in psa_egress_deparser_input_metadata_t f) { + apply { + } +} + +IngressPipeline(p(), ingress(), deparser()) ip; + +EgressPipeline(egressParserImpl(), egressControlImpl(), egressDeparserImpl()) ep; + +PSA_Switch(ip, PacketReplicationEngine(), ep, BufferingQueueingEngine()) main; + diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-free-form-annotation-frontend.p4 b/testdata/p4_16_samples_outputs/psa-dpdk-free-form-annotation-frontend.p4 new file mode 100644 index 00000000000..a9753ca688b --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-free-form-annotation-frontend.p4 @@ -0,0 +1,67 @@ +#include +#include + +header EMPTY_H { +} + +struct EMPTY_RESUB { +} + +struct EMPTY_CLONE { +} + +struct EMPTY_BRIDGE { +} + +struct EMPTY_RECIRC { +} + +@scrabble(- What do you get if you multiply six by nine ? - Six by nine . Forty two . - That ' s it . That ' s all there is . - I always thought there was something fundamentally wrong with the universe . 0xdeadbeef) header hdr { + bit<112> field; +} + +struct Header_t { + hdr h; +} + +struct Meta_t { +} + +parser p(packet_in b, out Header_t h, inout Meta_t m, in psa_ingress_parser_input_metadata_t x, in EMPTY_RESUB resub_meta, in EMPTY_RECIRC recirc_meta) { + state start { + transition accept; + } +} + +parser egressParserImpl(packet_in buffer, out EMPTY_H a, inout Meta_t b, in psa_egress_parser_input_metadata_t c, in EMPTY_BRIDGE d, in EMPTY_CLONE e, in EMPTY_CLONE f) { + state start { + transition accept; + } +} + +control ingress(inout Header_t h, inout Meta_t m, in psa_ingress_input_metadata_t istd, inout psa_ingress_output_metadata_t ostd) { + apply { + } +} + +control egressControlImpl(inout EMPTY_H h, inout Meta_t meta, in psa_egress_input_metadata_t x, inout psa_egress_output_metadata_t ostd) { + apply { + } +} + +control deparser(packet_out b, out EMPTY_CLONE clone_i2e_meta, out EMPTY_RESUB resubmit_meta, out EMPTY_BRIDGE normal_meta, inout Header_t h, in Meta_t local_metadata, in psa_ingress_output_metadata_t istd) { + apply { + } +} + +control egressDeparserImpl(packet_out buffer, out EMPTY_CLONE a, out EMPTY_RECIRC b, inout EMPTY_H c1, in Meta_t d, in psa_egress_output_metadata_t e, in psa_egress_deparser_input_metadata_t f) { + apply { + } +} + +IngressPipeline(p(), ingress(), deparser()) ip; + +EgressPipeline(egressParserImpl(), egressControlImpl(), egressDeparserImpl()) ep; + +PSA_Switch(ip, PacketReplicationEngine(), ep, BufferingQueueingEngine()) main; + diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-free-form-annotation-midend.p4 b/testdata/p4_16_samples_outputs/psa-dpdk-free-form-annotation-midend.p4 new file mode 100644 index 00000000000..a9753ca688b --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-free-form-annotation-midend.p4 @@ -0,0 +1,67 @@ +#include +#include + +header EMPTY_H { +} + +struct EMPTY_RESUB { +} + +struct EMPTY_CLONE { +} + +struct EMPTY_BRIDGE { +} + +struct EMPTY_RECIRC { +} + +@scrabble(- What do you get if you multiply six by nine ? - Six by nine . Forty two . - That ' s it . That ' s all there is . - I always thought there was something fundamentally wrong with the universe . 0xdeadbeef) header hdr { + bit<112> field; +} + +struct Header_t { + hdr h; +} + +struct Meta_t { +} + +parser p(packet_in b, out Header_t h, inout Meta_t m, in psa_ingress_parser_input_metadata_t x, in EMPTY_RESUB resub_meta, in EMPTY_RECIRC recirc_meta) { + state start { + transition accept; + } +} + +parser egressParserImpl(packet_in buffer, out EMPTY_H a, inout Meta_t b, in psa_egress_parser_input_metadata_t c, in EMPTY_BRIDGE d, in EMPTY_CLONE e, in EMPTY_CLONE f) { + state start { + transition accept; + } +} + +control ingress(inout Header_t h, inout Meta_t m, in psa_ingress_input_metadata_t istd, inout psa_ingress_output_metadata_t ostd) { + apply { + } +} + +control egressControlImpl(inout EMPTY_H h, inout Meta_t meta, in psa_egress_input_metadata_t x, inout psa_egress_output_metadata_t ostd) { + apply { + } +} + +control deparser(packet_out b, out EMPTY_CLONE clone_i2e_meta, out EMPTY_RESUB resubmit_meta, out EMPTY_BRIDGE normal_meta, inout Header_t h, in Meta_t local_metadata, in psa_ingress_output_metadata_t istd) { + apply { + } +} + +control egressDeparserImpl(packet_out buffer, out EMPTY_CLONE a, out EMPTY_RECIRC b, inout EMPTY_H c1, in Meta_t d, in psa_egress_output_metadata_t e, in psa_egress_deparser_input_metadata_t f) { + apply { + } +} + +IngressPipeline(p(), ingress(), deparser()) ip; + +EgressPipeline(egressParserImpl(), egressControlImpl(), egressDeparserImpl()) ep; + +PSA_Switch(ip, PacketReplicationEngine(), ep, BufferingQueueingEngine()) main; + diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-free-form-annotation.p4 b/testdata/p4_16_samples_outputs/psa-dpdk-free-form-annotation.p4 new file mode 100644 index 00000000000..3fe10c22212 --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-free-form-annotation.p4 @@ -0,0 +1,72 @@ +#include +#include + +header EMPTY_H { +} + +struct EMPTY_RESUB { +} + +struct EMPTY_CLONE { +} + +struct EMPTY_BRIDGE { +} + +struct EMPTY_RECIRC { +} + +@scrabble(- What do you get if you multiply six by nine ? - Six by nine . Forty two . - That ' s it . That ' s all there is . - I always thought there was something fundamentally wrong with the universe . 0xdeadbeef) header hdr { + bit<112> field; +} + +struct Header_t { + hdr h; +} + +struct Meta_t { +} + +parser p(packet_in b, out Header_t h, inout Meta_t m, in psa_ingress_parser_input_metadata_t x, in EMPTY_RESUB resub_meta, in EMPTY_RECIRC recirc_meta) { + state start { + transition accept; + } +} + +parser egressParserImpl(packet_in buffer, out EMPTY_H a, inout Meta_t b, in psa_egress_parser_input_metadata_t c, in EMPTY_BRIDGE d, in EMPTY_CLONE e, in EMPTY_CLONE f) { + state start { + transition accept; + } +} + +control c(inout Header_t h, inout Meta_t m) { + apply { + } +} + +control ingress(inout Header_t h, inout Meta_t m, in psa_ingress_input_metadata_t istd, inout psa_ingress_output_metadata_t ostd) { + apply { + } +} + +control egressControlImpl(inout EMPTY_H h, inout Meta_t meta, in psa_egress_input_metadata_t x, inout psa_egress_output_metadata_t ostd) { + apply { + } +} + +control deparser(packet_out b, out EMPTY_CLONE clone_i2e_meta, out EMPTY_RESUB resubmit_meta, out EMPTY_BRIDGE normal_meta, inout Header_t h, in Meta_t local_metadata, in psa_ingress_output_metadata_t istd) { + apply { + } +} + +control egressDeparserImpl(packet_out buffer, out EMPTY_CLONE a, out EMPTY_RECIRC b, inout EMPTY_H c1, in Meta_t d, in psa_egress_output_metadata_t e, in psa_egress_deparser_input_metadata_t f) { + apply { + } +} + +IngressPipeline(p(), ingress(), deparser()) ip; + +EgressPipeline(egressParserImpl(), egressControlImpl(), egressDeparserImpl()) ep; + +PSA_Switch(ip, PacketReplicationEngine(), ep, BufferingQueueingEngine()) main; + diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-free-form-annotation.p4-error b/testdata/p4_16_samples_outputs/psa-dpdk-free-form-annotation.p4-error new file mode 100644 index 00000000000..e69de29bb2d diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-free-form-annotation.p4-stderr b/testdata/p4_16_samples_outputs/psa-dpdk-free-form-annotation.p4-stderr new file mode 100644 index 00000000000..e69de29bb2d diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-free-form-annotation.p4.bfrt.json b/testdata/p4_16_samples_outputs/psa-dpdk-free-form-annotation.p4.bfrt.json new file mode 100644 index 00000000000..b6d66a630db --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-free-form-annotation.p4.bfrt.json @@ -0,0 +1,5 @@ +{ + "schema_version" : "1.0.0", + "tables" : [], + "learn_filters" : [] +} \ No newline at end of file diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-free-form-annotation.p4.entries.txt b/testdata/p4_16_samples_outputs/psa-dpdk-free-form-annotation.p4.entries.txt new file mode 100644 index 00000000000..e69de29bb2d diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-free-form-annotation.p4.p4info.txt b/testdata/p4_16_samples_outputs/psa-dpdk-free-form-annotation.p4.p4info.txt new file mode 100644 index 00000000000..77612386454 --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-free-form-annotation.p4.p4info.txt @@ -0,0 +1,3 @@ +pkg_info { + arch: "psa" +} diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-free-form-annotation.p4.spec b/testdata/p4_16_samples_outputs/psa-dpdk-free-form-annotation.p4.spec new file mode 100644 index 00000000000..06b38e6bcc3 --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-free-form-annotation.p4.spec @@ -0,0 +1,43 @@ + +struct hdr { + bit<112> field +} + +struct psa_ingress_output_metadata_t { + bit<8> class_of_service + bit<8> clone + bit<16> clone_session_id + bit<8> drop + bit<8> resubmit + bit<32> multicast_group + bit<32> egress_port +} + +struct psa_egress_output_metadata_t { + bit<8> clone + bit<16> clone_session_id + bit<8> drop +} + +struct psa_egress_deparser_input_metadata_t { + bit<32> egress_port +} + +header h instanceof hdr + +struct Meta_t { + bit<32> psa_ingress_input_metadata_ingress_port + bit<8> psa_ingress_output_metadata_drop + bit<32> psa_ingress_output_metadata_egress_port +} +metadata instanceof Meta_t + +apply { + rx m.psa_ingress_input_metadata_ingress_port + mov m.psa_ingress_output_metadata_drop 0x0 + jmpneq LABEL_DROP m.psa_ingress_output_metadata_drop 0x0 + tx m.psa_ingress_output_metadata_egress_port + LABEL_DROP : drop +} + + diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_arithref_cast-bmv2.p4-error b/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_arithref_cast-bmv2.p4-error new file mode 100644 index 00000000000..e69de29bb2d diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_arithref_cast-bmv2.p4.bfrt.json b/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_arithref_cast-bmv2.p4.bfrt.json new file mode 100644 index 00000000000..b6d66a630db --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_arithref_cast-bmv2.p4.bfrt.json @@ -0,0 +1,5 @@ +{ + "schema_version" : "1.0.0", + "tables" : [], + "learn_filters" : [] +} \ No newline at end of file diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_arithref_cast-bmv2.p4.spec b/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_arithref_cast-bmv2.p4.spec new file mode 100644 index 00000000000..f749291590a --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_arithref_cast-bmv2.p4.spec @@ -0,0 +1,56 @@ + +struct ethernet_t { + bit<48> dst_addr + bit<48> src_addr + bit<16> eth_type +} + +struct psa_ingress_output_metadata_t { + bit<8> class_of_service + bit<8> clone + bit<16> clone_session_id + bit<8> drop + bit<8> resubmit + bit<32> multicast_group + bit<32> egress_port +} + +struct psa_egress_output_metadata_t { + bit<8> clone + bit<16> clone_session_id + bit<8> drop +} + +struct psa_egress_deparser_input_metadata_t { + bit<32> egress_port +} + +header eth_hdr instanceof ethernet_t + +struct Meta { + bit<32> psa_ingress_input_metadata_ingress_port + bit<8> psa_ingress_output_metadata_drop + bit<32> psa_ingress_output_metadata_egress_port + bit<48> Ingress_tmp + bit<48> Ingress_tmp_0 +} +metadata instanceof Meta + +apply { + rx m.psa_ingress_input_metadata_ingress_port + mov m.psa_ingress_output_metadata_drop 0x0 + extract h.eth_hdr + jmplt LABEL_TRUE h.eth_hdr.src_addr 0xa + jmp LABEL_END + LABEL_TRUE : mov m.Ingress_tmp h.eth_hdr.dst_addr + shl m.Ingress_tmp 0x2 + mov m.Ingress_tmp_0 m.Ingress_tmp + and m.Ingress_tmp_0 0xffff + mov h.eth_hdr.eth_type m.Ingress_tmp_0 + LABEL_END : jmpneq LABEL_DROP m.psa_ingress_output_metadata_drop 0x0 + emit h.eth_hdr + tx m.psa_ingress_output_metadata_egress_port + LABEL_DROP : drop +} + + diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_arithref_cast-first.p4 b/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_arithref_cast-first.p4 new file mode 100644 index 00000000000..9c67f01a5f7 --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_arithref_cast-first.p4 @@ -0,0 +1,77 @@ +#include +#include + +header EMPTY_H { +} + +struct EMPTY_RESUB { +} + +struct EMPTY_CLONE { +} + +struct EMPTY_BRIDGE { +} + +struct EMPTY_RECIRC { +} + +header ethernet_t { + bit<48> dst_addr; + bit<48> src_addr; + bit<16> eth_type; +} + +struct Headers { + ethernet_t eth_hdr; +} + +struct Meta { +} + +bit<8> do_thing() { + return 8w2; +} +parser p(packet_in pkt, out Headers hdr, inout Meta m, in psa_ingress_parser_input_metadata_t x, in EMPTY_RESUB resub_meta, in EMPTY_RECIRC recirc_meta) { + state start { + pkt.extract(hdr.eth_hdr); + transition accept; + } +} + +parser egressParserImpl(packet_in buffer, out EMPTY_H a, inout Meta b, in psa_egress_parser_input_metadata_t c, in EMPTY_BRIDGE d, in EMPTY_CLONE e, in EMPTY_CLONE f) { + state start { + transition accept; + } +} + +control ingress(inout Headers h, inout Meta m, in psa_ingress_input_metadata_t istd, inout psa_ingress_output_metadata_t ostd) { + apply { + if (h.eth_hdr.src_addr < 48w10) { + h.eth_hdr.eth_type = (bit<16>)(h.eth_hdr.dst_addr << do_thing()); + } + } +} + +control egressControlImpl(inout EMPTY_H hdr, inout Meta meta, in psa_egress_input_metadata_t x, inout psa_egress_output_metadata_t ostd) { + apply { + } +} + +control deparser(packet_out pkt, out EMPTY_CLONE clone_i2e_meta, out EMPTY_RESUB resubmit_meta, out EMPTY_BRIDGE normal_meta, inout Headers hdr, in Meta local_metadata, in psa_ingress_output_metadata_t istd) { + apply { + pkt.emit(hdr); + } +} + +control egressDeparserImpl(packet_out buffer, out EMPTY_CLONE a, out EMPTY_RECIRC b, inout EMPTY_H c, in Meta d, in psa_egress_output_metadata_t e, in psa_egress_deparser_input_metadata_t f) { + apply { + } +} + +IngressPipeline(p(), ingress(), deparser()) ip; + +EgressPipeline(egressParserImpl(), egressControlImpl(), egressDeparserImpl()) ep; + +PSA_Switch(ip, PacketReplicationEngine(), ep, BufferingQueueingEngine()) main; + diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_arithref_cast-frontend.p4 b/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_arithref_cast-frontend.p4 new file mode 100644 index 00000000000..531d4c54f9d --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_arithref_cast-frontend.p4 @@ -0,0 +1,85 @@ +#include +#include + +header EMPTY_H { +} + +struct EMPTY_RESUB { +} + +struct EMPTY_CLONE { +} + +struct EMPTY_BRIDGE { +} + +struct EMPTY_RECIRC { +} + +header ethernet_t { + bit<48> dst_addr; + bit<48> src_addr; + bit<16> eth_type; +} + +struct Headers { + ethernet_t eth_hdr; +} + +struct Meta { +} + +parser p(packet_in pkt, out Headers hdr, inout Meta m, in psa_ingress_parser_input_metadata_t x, in EMPTY_RESUB resub_meta, in EMPTY_RECIRC recirc_meta) { + state start { + pkt.extract(hdr.eth_hdr); + transition accept; + } +} + +parser egressParserImpl(packet_in buffer, out EMPTY_H a, inout Meta b, in psa_egress_parser_input_metadata_t c, in EMPTY_BRIDGE d, in EMPTY_CLONE e, in EMPTY_CLONE f) { + state start { + transition accept; + } +} + +control ingress(inout Headers h, inout Meta m, in psa_ingress_input_metadata_t istd, inout psa_ingress_output_metadata_t ostd) { + @name("ingress.tmp") bit<48> tmp; + @name("ingress.tmp_0") bit<8> tmp_0; + @name("ingress.tmp_1") bit<48> tmp_1; + @name("ingress.hasReturned") bool hasReturned; + @name("ingress.retval") bit<8> retval; + apply { + if (h.eth_hdr.src_addr < 48w10) { + tmp = h.eth_hdr.dst_addr; + hasReturned = false; + hasReturned = true; + retval = 8w2; + tmp_0 = retval; + tmp_1 = tmp << tmp_0; + h.eth_hdr.eth_type = (bit<16>)tmp_1; + } + } +} + +control egressControlImpl(inout EMPTY_H hdr, inout Meta meta, in psa_egress_input_metadata_t x, inout psa_egress_output_metadata_t ostd) { + apply { + } +} + +control deparser(packet_out pkt, out EMPTY_CLONE clone_i2e_meta, out EMPTY_RESUB resubmit_meta, out EMPTY_BRIDGE normal_meta, inout Headers hdr, in Meta local_metadata, in psa_ingress_output_metadata_t istd) { + apply { + pkt.emit(hdr); + } +} + +control egressDeparserImpl(packet_out buffer, out EMPTY_CLONE a, out EMPTY_RECIRC b, inout EMPTY_H c, in Meta d, in psa_egress_output_metadata_t e, in psa_egress_deparser_input_metadata_t f) { + apply { + } +} + +IngressPipeline(p(), ingress(), deparser()) ip; + +EgressPipeline(egressParserImpl(), egressControlImpl(), egressDeparserImpl()) ep; + +PSA_Switch(ip, PacketReplicationEngine(), ep, BufferingQueueingEngine()) main; + diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_arithref_cast-midend.p4 b/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_arithref_cast-midend.p4 new file mode 100644 index 00000000000..aa74a59c947 --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_arithref_cast-midend.p4 @@ -0,0 +1,92 @@ +#include +#include + +header EMPTY_H { +} + +struct EMPTY_RESUB { +} + +struct EMPTY_CLONE { +} + +struct EMPTY_BRIDGE { +} + +struct EMPTY_RECIRC { +} + +header ethernet_t { + bit<48> dst_addr; + bit<48> src_addr; + bit<16> eth_type; +} + +struct Headers { + ethernet_t eth_hdr; +} + +struct Meta { +} + +parser p(packet_in pkt, out Headers hdr, inout Meta m, in psa_ingress_parser_input_metadata_t x, in EMPTY_RESUB resub_meta, in EMPTY_RECIRC recirc_meta) { + state start { + pkt.extract(hdr.eth_hdr); + transition accept; + } +} + +parser egressParserImpl(packet_in buffer, out EMPTY_H a, inout Meta b, in psa_egress_parser_input_metadata_t c, in EMPTY_BRIDGE d, in EMPTY_CLONE e, in EMPTY_CLONE f) { + state start { + transition accept; + } +} + +control ingress(inout Headers h, inout Meta m, in psa_ingress_input_metadata_t istd, inout psa_ingress_output_metadata_t ostd) { + @hidden action psadpdkgauntlet_arithref_cast52() { + h.eth_hdr.eth_type = (bit<16>)(h.eth_hdr.dst_addr << 8w2); + } + @hidden table tbl_psadpdkgauntlet_arithref_cast52 { + actions = { + psadpdkgauntlet_arithref_cast52(); + } + const default_action = psadpdkgauntlet_arithref_cast52(); + } + apply { + if (h.eth_hdr.src_addr < 48w10) { + tbl_psadpdkgauntlet_arithref_cast52.apply(); + } + } +} + +control egressControlImpl(inout EMPTY_H hdr, inout Meta meta, in psa_egress_input_metadata_t x, inout psa_egress_output_metadata_t ostd) { + apply { + } +} + +control deparser(packet_out pkt, out EMPTY_CLONE clone_i2e_meta, out EMPTY_RESUB resubmit_meta, out EMPTY_BRIDGE normal_meta, inout Headers hdr, in Meta local_metadata, in psa_ingress_output_metadata_t istd) { + @hidden action psadpdkgauntlet_arithref_cast75() { + pkt.emit(hdr.eth_hdr); + } + @hidden table tbl_psadpdkgauntlet_arithref_cast75 { + actions = { + psadpdkgauntlet_arithref_cast75(); + } + const default_action = psadpdkgauntlet_arithref_cast75(); + } + apply { + tbl_psadpdkgauntlet_arithref_cast75.apply(); + } +} + +control egressDeparserImpl(packet_out buffer, out EMPTY_CLONE a, out EMPTY_RECIRC b, inout EMPTY_H c, in Meta d, in psa_egress_output_metadata_t e, in psa_egress_deparser_input_metadata_t f) { + apply { + } +} + +IngressPipeline(p(), ingress(), deparser()) ip; + +EgressPipeline(egressParserImpl(), egressControlImpl(), egressDeparserImpl()) ep; + +PSA_Switch(ip, PacketReplicationEngine(), ep, BufferingQueueingEngine()) main; + diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_arithref_cast.p4 b/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_arithref_cast.p4 new file mode 100644 index 00000000000..61d880c653a --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_arithref_cast.p4 @@ -0,0 +1,77 @@ +#include +#include + +header EMPTY_H { +} + +struct EMPTY_RESUB { +} + +struct EMPTY_CLONE { +} + +struct EMPTY_BRIDGE { +} + +struct EMPTY_RECIRC { +} + +header ethernet_t { + bit<48> dst_addr; + bit<48> src_addr; + bit<16> eth_type; +} + +struct Headers { + ethernet_t eth_hdr; +} + +struct Meta { +} + +bit<8> do_thing() { + return 8w2; +} +parser p(packet_in pkt, out Headers hdr, inout Meta m, in psa_ingress_parser_input_metadata_t x, in EMPTY_RESUB resub_meta, in EMPTY_RECIRC recirc_meta) { + state start { + pkt.extract(hdr.eth_hdr); + transition accept; + } +} + +parser egressParserImpl(packet_in buffer, out EMPTY_H a, inout Meta b, in psa_egress_parser_input_metadata_t c, in EMPTY_BRIDGE d, in EMPTY_CLONE e, in EMPTY_CLONE f) { + state start { + transition accept; + } +} + +control ingress(inout Headers h, inout Meta m, in psa_ingress_input_metadata_t istd, inout psa_ingress_output_metadata_t ostd) { + apply { + if (h.eth_hdr.src_addr < 10) { + h.eth_hdr.eth_type = (bit<16>)(h.eth_hdr.dst_addr << do_thing()); + } + } +} + +control egressControlImpl(inout EMPTY_H hdr, inout Meta meta, in psa_egress_input_metadata_t x, inout psa_egress_output_metadata_t ostd) { + apply { + } +} + +control deparser(packet_out pkt, out EMPTY_CLONE clone_i2e_meta, out EMPTY_RESUB resubmit_meta, out EMPTY_BRIDGE normal_meta, inout Headers hdr, in Meta local_metadata, in psa_ingress_output_metadata_t istd) { + apply { + pkt.emit(hdr); + } +} + +control egressDeparserImpl(packet_out buffer, out EMPTY_CLONE a, out EMPTY_RECIRC b, inout EMPTY_H c, in Meta d, in psa_egress_output_metadata_t e, in psa_egress_deparser_input_metadata_t f) { + apply { + } +} + +IngressPipeline(p(), ingress(), deparser()) ip; + +EgressPipeline(egressParserImpl(), egressControlImpl(), egressDeparserImpl()) ep; + +PSA_Switch(ip, PacketReplicationEngine(), ep, BufferingQueueingEngine()) main; + diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_arithref_cast.p4-error b/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_arithref_cast.p4-error new file mode 100644 index 00000000000..e69de29bb2d diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_arithref_cast.p4-stderr b/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_arithref_cast.p4-stderr new file mode 100644 index 00000000000..e69de29bb2d diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_arithref_cast.p4.bfrt.json b/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_arithref_cast.p4.bfrt.json new file mode 100644 index 00000000000..b6d66a630db --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_arithref_cast.p4.bfrt.json @@ -0,0 +1,5 @@ +{ + "schema_version" : "1.0.0", + "tables" : [], + "learn_filters" : [] +} \ No newline at end of file diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_arithref_cast.p4.entries.txt b/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_arithref_cast.p4.entries.txt new file mode 100644 index 00000000000..e69de29bb2d diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_arithref_cast.p4.p4info.txt b/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_arithref_cast.p4.p4info.txt new file mode 100644 index 00000000000..77612386454 --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_arithref_cast.p4.p4info.txt @@ -0,0 +1,3 @@ +pkg_info { + arch: "psa" +} diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_arithref_cast.p4.spec b/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_arithref_cast.p4.spec new file mode 100644 index 00000000000..f749291590a --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_arithref_cast.p4.spec @@ -0,0 +1,56 @@ + +struct ethernet_t { + bit<48> dst_addr + bit<48> src_addr + bit<16> eth_type +} + +struct psa_ingress_output_metadata_t { + bit<8> class_of_service + bit<8> clone + bit<16> clone_session_id + bit<8> drop + bit<8> resubmit + bit<32> multicast_group + bit<32> egress_port +} + +struct psa_egress_output_metadata_t { + bit<8> clone + bit<16> clone_session_id + bit<8> drop +} + +struct psa_egress_deparser_input_metadata_t { + bit<32> egress_port +} + +header eth_hdr instanceof ethernet_t + +struct Meta { + bit<32> psa_ingress_input_metadata_ingress_port + bit<8> psa_ingress_output_metadata_drop + bit<32> psa_ingress_output_metadata_egress_port + bit<48> Ingress_tmp + bit<48> Ingress_tmp_0 +} +metadata instanceof Meta + +apply { + rx m.psa_ingress_input_metadata_ingress_port + mov m.psa_ingress_output_metadata_drop 0x0 + extract h.eth_hdr + jmplt LABEL_TRUE h.eth_hdr.src_addr 0xa + jmp LABEL_END + LABEL_TRUE : mov m.Ingress_tmp h.eth_hdr.dst_addr + shl m.Ingress_tmp 0x2 + mov m.Ingress_tmp_0 m.Ingress_tmp + and m.Ingress_tmp_0 0xffff + mov h.eth_hdr.eth_type m.Ingress_tmp_0 + LABEL_END : jmpneq LABEL_DROP m.psa_ingress_output_metadata_drop 0x0 + emit h.eth_hdr + tx m.psa_ingress_output_metadata_egress_port + LABEL_DROP : drop +} + + diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_exit_combination_11-bmv2.p4-error b/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_exit_combination_11-bmv2.p4-error new file mode 100644 index 00000000000..3a05896af31 --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_exit_combination_11-bmv2.p4-error @@ -0,0 +1,6 @@ +psa-dpdk-gauntlet_exit_combination_11-bmv2.p4(60): [--Wwarn=ignore-prop] warning: KeyElement: constant key element + 64w1: exact @name("key") ; + ^^^^ +psa-dpdk-gauntlet_exit_combination_11-bmv2.p4(60): [--Wwarn=mismatch] warning: 64w1: Constant key field + 64w1: exact @name("key") ; + ^^^^ diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_exit_combination_11-bmv2.p4.bfrt.json b/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_exit_combination_11-bmv2.p4.bfrt.json new file mode 100644 index 00000000000..b800f6aa38e --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_exit_combination_11-bmv2.p4.bfrt.json @@ -0,0 +1,52 @@ +{ + "schema_version" : "1.0.0", + "tables" : [ + { + "name" : "ip.ingress.simple_table", + "id" : 39789425, + "table_type" : "MatchAction_Direct", + "size" : 1024, + "annotations" : [], + "depends_on" : [], + "has_const_default_action" : false, + "key" : [ + { + "id" : 1, + "name" : "key", + "repeated" : false, + "annotations" : [], + "mandatory" : false, + "match_type" : "Exact", + "type" : { + "type" : "bytes", + "width" : 64 + } + } + ], + "action_specs" : [ + { + "id" : 25524983, + "name" : "ingress.simple_action", + "action_scope" : "TableAndDefault", + "annotations" : [], + "data" : [] + }, + { + "id" : 21257015, + "name" : "NoAction", + "action_scope" : "DefaultOnly", + "annotations" : [ + { + "name" : "@defaultonly" + } + ], + "data" : [] + } + ], + "data" : [], + "supported_operations" : [], + "attributes" : ["EntryScope"] + } + ], + "learn_filters" : [] +} \ No newline at end of file diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_exit_combination_11-bmv2.p4.spec b/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_exit_combination_11-bmv2.p4.spec new file mode 100644 index 00000000000..a8b51d20e00 --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_exit_combination_11-bmv2.p4.spec @@ -0,0 +1,82 @@ + +struct ethernet_t { + bit<48> dst_addr + bit<48> src_addr + bit<16> eth_type +} + +struct psa_ingress_output_metadata_t { + bit<8> class_of_service + bit<8> clone + bit<16> clone_session_id + bit<8> drop + bit<8> resubmit + bit<32> multicast_group + bit<32> egress_port +} + +struct psa_egress_output_metadata_t { + bit<8> clone + bit<16> clone_session_id + bit<8> drop +} + +struct psa_egress_deparser_input_metadata_t { + bit<32> egress_port +} + +header eth_hdr instanceof ethernet_t + +struct Meta { + bit<32> psa_ingress_input_metadata_ingress_port + bit<8> psa_ingress_output_metadata_drop + bit<32> psa_ingress_output_metadata_egress_port + bit<8> Ingress_hasExited + bit<64> Ingress_key +} +metadata instanceof Meta + +action NoAction args none { + return +} + +action simple_action args none { + mov m.Ingress_hasExited 1 + return +} + +table simple_table { + key { + m.Ingress_key exact + } + actions { + simple_action + NoAction + } + default_action NoAction args none + size 0x10000 +} + + +apply { + rx m.psa_ingress_input_metadata_ingress_port + mov m.psa_ingress_output_metadata_drop 0x0 + extract h.eth_hdr + mov m.Ingress_hasExited 0 + mov m.Ingress_key 0x1 + table simple_table + jmpa LABEL_SWITCH simple_action + jmp LABEL_ENDSWITCH + LABEL_SWITCH : jmpneq LABEL_FALSE m.Ingress_hasExited 0x1 + jmp LABEL_ENDSWITCH + LABEL_FALSE : mov h.eth_hdr.eth_type 0x1 + LABEL_ENDSWITCH : jmpneq LABEL_FALSE_0 m.Ingress_hasExited 0x1 + jmp LABEL_END_0 + LABEL_FALSE_0 : mov m.Ingress_hasExited 1 + LABEL_END_0 : jmpneq LABEL_DROP m.psa_ingress_output_metadata_drop 0x0 + emit h.eth_hdr + tx m.psa_ingress_output_metadata_egress_port + LABEL_DROP : drop +} + + diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_exit_combination_11-first.p4 b/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_exit_combination_11-first.p4 new file mode 100644 index 00000000000..29ddcae36c8 --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_exit_combination_11-first.p4 @@ -0,0 +1,95 @@ +#include +#include + +header EMPTY_H { +} + +struct EMPTY_RESUB { +} + +struct EMPTY_CLONE { +} + +struct EMPTY_BRIDGE { +} + +struct EMPTY_RECIRC { +} + +header ethernet_t { + bit<48> dst_addr; + bit<48> src_addr; + bit<16> eth_type; +} + +struct Headers { + ethernet_t eth_hdr; +} + +struct Meta { +} + +parser p(packet_in pkt, out Headers hdr, inout Meta m, in psa_ingress_parser_input_metadata_t x, in EMPTY_RESUB resub_meta, in EMPTY_RECIRC recirc_meta) { + state start { + transition parse_hdrs; + } + state parse_hdrs { + pkt.extract(hdr.eth_hdr); + transition accept; + } +} + +parser egressParserImpl(packet_in buffer, out EMPTY_H a, inout Meta b, in psa_egress_parser_input_metadata_t c, in EMPTY_BRIDGE d, in EMPTY_CLONE e, in EMPTY_CLONE f) { + state start { + transition accept; + } +} + +control ingress(inout Headers h, inout Meta m, in psa_ingress_input_metadata_t istd, inout psa_ingress_output_metadata_t ostd) { + action simple_action() { + exit; + } + table simple_table { + key = { + 64w1: exact @name("key") ; + } + actions = { + simple_action(); + @defaultonly NoAction(); + } + default_action = NoAction(); + } + apply { + switch (simple_table.apply().action_run) { + simple_action: { + h.eth_hdr.eth_type = 16w1; + } + default: { + } + } + exit; + } +} + +control egressControlImpl(inout EMPTY_H hdr, inout Meta meta, in psa_egress_input_metadata_t x, inout psa_egress_output_metadata_t ostd) { + apply { + } +} + +control deparser(packet_out pkt, out EMPTY_CLONE clone_i2e_meta, out EMPTY_RESUB resubmit_meta, out EMPTY_BRIDGE normal_meta, inout Headers h, in Meta local_metadata, in psa_ingress_output_metadata_t istd) { + apply { + pkt.emit(h); + } +} + +control egressDeparserImpl(packet_out buffer, out EMPTY_CLONE a, out EMPTY_RECIRC b, inout EMPTY_H c, in Meta d, in psa_egress_output_metadata_t e, in psa_egress_deparser_input_metadata_t f) { + apply { + } +} + +IngressPipeline(p(), ingress(), deparser()) ip; + +EgressPipeline(egressParserImpl(), egressControlImpl(), egressDeparserImpl()) ep; + +PSA_Switch(ip, PacketReplicationEngine(), ep, BufferingQueueingEngine()) main; + diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_exit_combination_11-frontend.p4 b/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_exit_combination_11-frontend.p4 new file mode 100644 index 00000000000..c43f700f553 --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_exit_combination_11-frontend.p4 @@ -0,0 +1,94 @@ +#include +#include + +header EMPTY_H { +} + +struct EMPTY_RESUB { +} + +struct EMPTY_CLONE { +} + +struct EMPTY_BRIDGE { +} + +struct EMPTY_RECIRC { +} + +header ethernet_t { + bit<48> dst_addr; + bit<48> src_addr; + bit<16> eth_type; +} + +struct Headers { + ethernet_t eth_hdr; +} + +struct Meta { +} + +parser p(packet_in pkt, out Headers hdr, inout Meta m, in psa_ingress_parser_input_metadata_t x, in EMPTY_RESUB resub_meta, in EMPTY_RECIRC recirc_meta) { + state start { + pkt.extract(hdr.eth_hdr); + transition accept; + } +} + +parser egressParserImpl(packet_in buffer, out EMPTY_H a, inout Meta b, in psa_egress_parser_input_metadata_t c, in EMPTY_BRIDGE d, in EMPTY_CLONE e, in EMPTY_CLONE f) { + state start { + transition accept; + } +} + +control ingress(inout Headers h, inout Meta m, in psa_ingress_input_metadata_t istd, inout psa_ingress_output_metadata_t ostd) { + @noWarn("unused") @name(".NoAction") action NoAction_1() { + } + @name("ingress.simple_action") action simple_action() { + exit; + } + @name("ingress.simple_table") table simple_table_0 { + key = { + 64w1: exact @name("key") ; + } + actions = { + simple_action(); + @defaultonly NoAction_1(); + } + default_action = NoAction_1(); + } + apply { + switch (simple_table_0.apply().action_run) { + simple_action: { + h.eth_hdr.eth_type = 16w1; + } + default: { + } + } + exit; + } +} + +control egressControlImpl(inout EMPTY_H hdr, inout Meta meta, in psa_egress_input_metadata_t x, inout psa_egress_output_metadata_t ostd) { + apply { + } +} + +control deparser(packet_out pkt, out EMPTY_CLONE clone_i2e_meta, out EMPTY_RESUB resubmit_meta, out EMPTY_BRIDGE normal_meta, inout Headers h, in Meta local_metadata, in psa_ingress_output_metadata_t istd) { + apply { + pkt.emit(h); + } +} + +control egressDeparserImpl(packet_out buffer, out EMPTY_CLONE a, out EMPTY_RECIRC b, inout EMPTY_H c, in Meta d, in psa_egress_output_metadata_t e, in psa_egress_deparser_input_metadata_t f) { + apply { + } +} + +IngressPipeline(p(), ingress(), deparser()) ip; + +EgressPipeline(egressParserImpl(), egressControlImpl(), egressDeparserImpl()) ep; + +PSA_Switch(ip, PacketReplicationEngine(), ep, BufferingQueueingEngine()) main; + diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_exit_combination_11-midend.p4 b/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_exit_combination_11-midend.p4 new file mode 100644 index 00000000000..8fd01b7294f --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_exit_combination_11-midend.p4 @@ -0,0 +1,142 @@ +#include +#include + +header EMPTY_H { +} + +struct EMPTY_RESUB { +} + +struct EMPTY_CLONE { +} + +struct EMPTY_BRIDGE { +} + +struct EMPTY_RECIRC { +} + +header ethernet_t { + bit<48> dst_addr; + bit<48> src_addr; + bit<16> eth_type; +} + +struct Headers { + ethernet_t eth_hdr; +} + +struct Meta { +} + +parser p(packet_in pkt, out Headers hdr, inout Meta m, in psa_ingress_parser_input_metadata_t x, in EMPTY_RESUB resub_meta, in EMPTY_RECIRC recirc_meta) { + state start { + pkt.extract(hdr.eth_hdr); + transition accept; + } +} + +parser egressParserImpl(packet_in buffer, out EMPTY_H a, inout Meta b, in psa_egress_parser_input_metadata_t c, in EMPTY_BRIDGE d, in EMPTY_CLONE e, in EMPTY_CLONE f) { + state start { + transition accept; + } +} + +control ingress(inout Headers h, inout Meta m, in psa_ingress_input_metadata_t istd, inout psa_ingress_output_metadata_t ostd) { + bool hasExited; + bit<64> key_0; + @noWarn("unused") @name(".NoAction") action NoAction_1() { + } + @name("ingress.simple_action") action simple_action() { + hasExited = true; + } + @name("ingress.simple_table") table simple_table_0 { + key = { + key_0: exact @name("key") ; + } + actions = { + simple_action(); + @defaultonly NoAction_1(); + } + default_action = NoAction_1(); + } + @hidden action psadpdkgauntlet_exit_combination_11l69() { + h.eth_hdr.eth_type = 16w1; + } + @hidden action psadpdkgauntlet_exit_combination_11l60() { + hasExited = false; + key_0 = 64w1; + } + @hidden action psadpdkgauntlet_exit_combination_11l74() { + hasExited = true; + } + @hidden table tbl_psadpdkgauntlet_exit_combination_11l60 { + actions = { + psadpdkgauntlet_exit_combination_11l60(); + } + const default_action = psadpdkgauntlet_exit_combination_11l60(); + } + @hidden table tbl_psadpdkgauntlet_exit_combination_11l69 { + actions = { + psadpdkgauntlet_exit_combination_11l69(); + } + const default_action = psadpdkgauntlet_exit_combination_11l69(); + } + @hidden table tbl_psadpdkgauntlet_exit_combination_11l74 { + actions = { + psadpdkgauntlet_exit_combination_11l74(); + } + const default_action = psadpdkgauntlet_exit_combination_11l74(); + } + apply { + tbl_psadpdkgauntlet_exit_combination_11l60.apply(); + switch (simple_table_0.apply().action_run) { + simple_action: { + if (hasExited) { + ; + } else { + tbl_psadpdkgauntlet_exit_combination_11l69.apply(); + } + } + default: { + } + } + if (hasExited) { + ; + } else { + tbl_psadpdkgauntlet_exit_combination_11l74.apply(); + } + } +} + +control egressControlImpl(inout EMPTY_H hdr, inout Meta meta, in psa_egress_input_metadata_t x, inout psa_egress_output_metadata_t ostd) { + apply { + } +} + +control deparser(packet_out pkt, out EMPTY_CLONE clone_i2e_meta, out EMPTY_RESUB resubmit_meta, out EMPTY_BRIDGE normal_meta, inout Headers h, in Meta local_metadata, in psa_ingress_output_metadata_t istd) { + @hidden action psadpdkgauntlet_exit_combination_11l95() { + pkt.emit(h.eth_hdr); + } + @hidden table tbl_psadpdkgauntlet_exit_combination_11l95 { + actions = { + psadpdkgauntlet_exit_combination_11l95(); + } + const default_action = psadpdkgauntlet_exit_combination_11l95(); + } + apply { + tbl_psadpdkgauntlet_exit_combination_11l95.apply(); + } +} + +control egressDeparserImpl(packet_out buffer, out EMPTY_CLONE a, out EMPTY_RECIRC b, inout EMPTY_H c, in Meta d, in psa_egress_output_metadata_t e, in psa_egress_deparser_input_metadata_t f) { + apply { + } +} + +IngressPipeline(p(), ingress(), deparser()) ip; + +EgressPipeline(egressParserImpl(), egressControlImpl(), egressDeparserImpl()) ep; + +PSA_Switch(ip, PacketReplicationEngine(), ep, BufferingQueueingEngine()) main; + diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_exit_combination_11.p4 b/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_exit_combination_11.p4 new file mode 100644 index 00000000000..831d4f6f38e --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_exit_combination_11.p4 @@ -0,0 +1,95 @@ +#include +#include + +header EMPTY_H { +} + +struct EMPTY_RESUB { +} + +struct EMPTY_CLONE { +} + +struct EMPTY_BRIDGE { +} + +struct EMPTY_RECIRC { +} + +header ethernet_t { + bit<48> dst_addr; + bit<48> src_addr; + bit<16> eth_type; +} + +struct Headers { + ethernet_t eth_hdr; +} + +struct Meta { +} + +parser p(packet_in pkt, out Headers hdr, inout Meta m, in psa_ingress_parser_input_metadata_t x, in EMPTY_RESUB resub_meta, in EMPTY_RECIRC recirc_meta) { + state start { + transition parse_hdrs; + } + state parse_hdrs { + pkt.extract(hdr.eth_hdr); + transition accept; + } +} + +parser egressParserImpl(packet_in buffer, out EMPTY_H a, inout Meta b, in psa_egress_parser_input_metadata_t c, in EMPTY_BRIDGE d, in EMPTY_CLONE e, in EMPTY_CLONE f) { + state start { + transition accept; + } +} + +control ingress(inout Headers h, inout Meta m, in psa_ingress_input_metadata_t istd, inout psa_ingress_output_metadata_t ostd) { + action simple_action() { + if (false) { + return; + } else { + exit; + } + } + table simple_table { + key = { + 64w1: exact @name("key") ; + } + actions = { + simple_action(); + } + } + apply { + switch (simple_table.apply().action_run) { + simple_action: { + h.eth_hdr.eth_type = 16w1; + } + } + exit; + } +} + +control egressControlImpl(inout EMPTY_H hdr, inout Meta meta, in psa_egress_input_metadata_t x, inout psa_egress_output_metadata_t ostd) { + apply { + } +} + +control deparser(packet_out pkt, out EMPTY_CLONE clone_i2e_meta, out EMPTY_RESUB resubmit_meta, out EMPTY_BRIDGE normal_meta, inout Headers h, in Meta local_metadata, in psa_ingress_output_metadata_t istd) { + apply { + pkt.emit(h); + } +} + +control egressDeparserImpl(packet_out buffer, out EMPTY_CLONE a, out EMPTY_RECIRC b, inout EMPTY_H c, in Meta d, in psa_egress_output_metadata_t e, in psa_egress_deparser_input_metadata_t f) { + apply { + } +} + +IngressPipeline(p(), ingress(), deparser()) ip; + +EgressPipeline(egressParserImpl(), egressControlImpl(), egressDeparserImpl()) ep; + +PSA_Switch(ip, PacketReplicationEngine(), ep, BufferingQueueingEngine()) main; + diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_exit_combination_11.p4-error b/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_exit_combination_11.p4-error new file mode 100644 index 00000000000..a463dfe514f --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_exit_combination_11.p4-error @@ -0,0 +1,6 @@ +psa-dpdk-gauntlet_exit_combination_11.p4(60): [--Wwarn=ignore-prop] warning: KeyElement: constant key element + 64w1: exact @name("key") ; + ^^^^ +psa-dpdk-gauntlet_exit_combination_11.p4(60): [--Wwarn=mismatch] warning: 64w1: Constant key field + 64w1: exact @name("key") ; + ^^^^ diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_exit_combination_11.p4-stderr b/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_exit_combination_11.p4-stderr new file mode 100644 index 00000000000..a463dfe514f --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_exit_combination_11.p4-stderr @@ -0,0 +1,6 @@ +psa-dpdk-gauntlet_exit_combination_11.p4(60): [--Wwarn=ignore-prop] warning: KeyElement: constant key element + 64w1: exact @name("key") ; + ^^^^ +psa-dpdk-gauntlet_exit_combination_11.p4(60): [--Wwarn=mismatch] warning: 64w1: Constant key field + 64w1: exact @name("key") ; + ^^^^ diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_exit_combination_11.p4.bfrt.json b/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_exit_combination_11.p4.bfrt.json new file mode 100644 index 00000000000..b800f6aa38e --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_exit_combination_11.p4.bfrt.json @@ -0,0 +1,52 @@ +{ + "schema_version" : "1.0.0", + "tables" : [ + { + "name" : "ip.ingress.simple_table", + "id" : 39789425, + "table_type" : "MatchAction_Direct", + "size" : 1024, + "annotations" : [], + "depends_on" : [], + "has_const_default_action" : false, + "key" : [ + { + "id" : 1, + "name" : "key", + "repeated" : false, + "annotations" : [], + "mandatory" : false, + "match_type" : "Exact", + "type" : { + "type" : "bytes", + "width" : 64 + } + } + ], + "action_specs" : [ + { + "id" : 25524983, + "name" : "ingress.simple_action", + "action_scope" : "TableAndDefault", + "annotations" : [], + "data" : [] + }, + { + "id" : 21257015, + "name" : "NoAction", + "action_scope" : "DefaultOnly", + "annotations" : [ + { + "name" : "@defaultonly" + } + ], + "data" : [] + } + ], + "data" : [], + "supported_operations" : [], + "attributes" : ["EntryScope"] + } + ], + "learn_filters" : [] +} \ No newline at end of file diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_exit_combination_11.p4.entries.txt b/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_exit_combination_11.p4.entries.txt new file mode 100644 index 00000000000..e69de29bb2d diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_exit_combination_11.p4.p4info.txt b/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_exit_combination_11.p4.p4info.txt new file mode 100644 index 00000000000..4114b94dc17 --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_exit_combination_11.p4.p4info.txt @@ -0,0 +1,42 @@ +pkg_info { + arch: "psa" +} +tables { + preamble { + id: 39789425 + name: "ingress.simple_table" + alias: "simple_table" + } + match_fields { + id: 1 + name: "key" + bitwidth: 64 + match_type: EXACT + } + action_refs { + id: 25524983 + } + action_refs { + id: 21257015 + annotations: "@defaultonly" + scope: DEFAULT_ONLY + } + size: 1024 +} +actions { + preamble { + id: 21257015 + name: "NoAction" + alias: "NoAction" + annotations: "@noWarn(\"unused\")" + } +} +actions { + preamble { + id: 25524983 + name: "ingress.simple_action" + alias: "simple_action" + } +} +type_info { +} diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_exit_combination_11.p4.spec b/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_exit_combination_11.p4.spec new file mode 100644 index 00000000000..a8b51d20e00 --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_exit_combination_11.p4.spec @@ -0,0 +1,82 @@ + +struct ethernet_t { + bit<48> dst_addr + bit<48> src_addr + bit<16> eth_type +} + +struct psa_ingress_output_metadata_t { + bit<8> class_of_service + bit<8> clone + bit<16> clone_session_id + bit<8> drop + bit<8> resubmit + bit<32> multicast_group + bit<32> egress_port +} + +struct psa_egress_output_metadata_t { + bit<8> clone + bit<16> clone_session_id + bit<8> drop +} + +struct psa_egress_deparser_input_metadata_t { + bit<32> egress_port +} + +header eth_hdr instanceof ethernet_t + +struct Meta { + bit<32> psa_ingress_input_metadata_ingress_port + bit<8> psa_ingress_output_metadata_drop + bit<32> psa_ingress_output_metadata_egress_port + bit<8> Ingress_hasExited + bit<64> Ingress_key +} +metadata instanceof Meta + +action NoAction args none { + return +} + +action simple_action args none { + mov m.Ingress_hasExited 1 + return +} + +table simple_table { + key { + m.Ingress_key exact + } + actions { + simple_action + NoAction + } + default_action NoAction args none + size 0x10000 +} + + +apply { + rx m.psa_ingress_input_metadata_ingress_port + mov m.psa_ingress_output_metadata_drop 0x0 + extract h.eth_hdr + mov m.Ingress_hasExited 0 + mov m.Ingress_key 0x1 + table simple_table + jmpa LABEL_SWITCH simple_action + jmp LABEL_ENDSWITCH + LABEL_SWITCH : jmpneq LABEL_FALSE m.Ingress_hasExited 0x1 + jmp LABEL_ENDSWITCH + LABEL_FALSE : mov h.eth_hdr.eth_type 0x1 + LABEL_ENDSWITCH : jmpneq LABEL_FALSE_0 m.Ingress_hasExited 0x1 + jmp LABEL_END_0 + LABEL_FALSE_0 : mov m.Ingress_hasExited 1 + LABEL_END_0 : jmpneq LABEL_DROP m.psa_ingress_output_metadata_drop 0x0 + emit h.eth_hdr + tx m.psa_ingress_output_metadata_egress_port + LABEL_DROP : drop +} + + diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_exit_combination_15-bmv2.p4-error b/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_exit_combination_15-bmv2.p4-error new file mode 100644 index 00000000000..33c20ba6914 --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_exit_combination_15-bmv2.p4-error @@ -0,0 +1,6 @@ +psa-dpdk-gauntlet_exit_combination_15-bmv2.p4(54): [--Wwarn=ignore-prop] warning: KeyElement: constant key element + 48w1: exact @name("Vmhbwk") ; + ^^^^ +psa-dpdk-gauntlet_exit_combination_15-bmv2.p4(54): [--Wwarn=mismatch] warning: 48w1: Constant key field + 48w1: exact @name("Vmhbwk") ; + ^^^^ diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_exit_combination_15-bmv2.p4.bfrt.json b/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_exit_combination_15-bmv2.p4.bfrt.json new file mode 100644 index 00000000000..beabb07c48e --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_exit_combination_15-bmv2.p4.bfrt.json @@ -0,0 +1,48 @@ +{ + "schema_version" : "1.0.0", + "tables" : [ + { + "name" : "ip.ingress.simple_table", + "id" : 39789425, + "table_type" : "MatchAction_Direct", + "size" : 1024, + "annotations" : [], + "depends_on" : [], + "has_const_default_action" : false, + "key" : [ + { + "id" : 1, + "name" : "Vmhbwk", + "repeated" : false, + "annotations" : [], + "mandatory" : false, + "match_type" : "Exact", + "type" : { + "type" : "bytes", + "width" : 48 + } + } + ], + "action_specs" : [ + { + "id" : 25524983, + "name" : "ingress.simple_action", + "action_scope" : "TableAndDefault", + "annotations" : [], + "data" : [] + }, + { + "id" : 21257015, + "name" : "NoAction", + "action_scope" : "TableAndDefault", + "annotations" : [], + "data" : [] + } + ], + "data" : [], + "supported_operations" : [], + "attributes" : ["EntryScope"] + } + ], + "learn_filters" : [] +} \ No newline at end of file diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_exit_combination_15-bmv2.p4.spec b/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_exit_combination_15-bmv2.p4.spec new file mode 100644 index 00000000000..51b6696f6d7 --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_exit_combination_15-bmv2.p4.spec @@ -0,0 +1,89 @@ + +struct ethernet_t { + bit<48> dst_addr + bit<48> src_addr + bit<16> eth_type +} + +struct psa_ingress_output_metadata_t { + bit<8> class_of_service + bit<8> clone + bit<16> clone_session_id + bit<8> drop + bit<8> resubmit + bit<32> multicast_group + bit<32> egress_port +} + +struct psa_egress_output_metadata_t { + bit<8> clone + bit<16> clone_session_id + bit<8> drop +} + +struct psa_egress_deparser_input_metadata_t { + bit<32> egress_port +} + +header eth_hdr instanceof ethernet_t + +struct Meta { + bit<32> psa_ingress_input_metadata_ingress_port + bit<8> psa_ingress_output_metadata_drop + bit<32> psa_ingress_output_metadata_egress_port + bit<8> Ingress_hasExited + bit<48> Ingress_key +} +metadata instanceof Meta + +action NoAction args none { + return +} + +action simple_action args none { + mov h.eth_hdr.src_addr 0x1 + return +} + +table simple_table { + key { + m.Ingress_key exact + } + actions { + simple_action + NoAction + } + default_action NoAction args none + size 0x10000 +} + + +apply { + rx m.psa_ingress_input_metadata_ingress_port + mov m.psa_ingress_output_metadata_drop 0x0 + extract h.eth_hdr + mov m.Ingress_hasExited 0 + mov m.Ingress_key 0x1 + table simple_table + jmpa LABEL_SWITCH simple_action + jmpa LABEL_SWITCH_0 NoAction_1 + jmp LABEL_DEFAULT + LABEL_SWITCH : mov h.eth_hdr.eth_type 0x1 + mov m.Ingress_hasExited 1 + jmp LABEL_ENDSWITCH + LABEL_SWITCH_0 : mov h.eth_hdr.eth_type 0x2 + mov m.Ingress_hasExited 1 + jmp LABEL_ENDSWITCH + LABEL_DEFAULT : mov h.eth_hdr.eth_type 0x3 + mov m.Ingress_hasExited 1 + LABEL_ENDSWITCH : jmpneq LABEL_FALSE m.Ingress_hasExited 0x1 + jmp LABEL_END + LABEL_FALSE : mov h.eth_hdr.eth_type 0x4 + mov m.Ingress_hasExited 1 + LABEL_END : jmpneq LABEL_DROP m.psa_ingress_output_metadata_drop 0x0 + emit h.eth_hdr + tx m.psa_ingress_output_metadata_egress_port + LABEL_DROP : drop +} + + diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_exit_combination_15-first.p4 b/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_exit_combination_15-first.p4 new file mode 100644 index 00000000000..ba4dc1c6615 --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_exit_combination_15-first.p4 @@ -0,0 +1,103 @@ +#include +#include + +header EMPTY_H { +} + +struct EMPTY_RESUB { +} + +struct EMPTY_CLONE { +} + +struct EMPTY_BRIDGE { +} + +struct EMPTY_RECIRC { +} + +header ethernet_t { + bit<48> dst_addr; + bit<48> src_addr; + bit<16> eth_type; +} + +struct Headers { + ethernet_t eth_hdr; +} + +struct Meta { +} + +parser p(packet_in pkt, out Headers hdr, inout Meta m, in psa_ingress_parser_input_metadata_t x, in EMPTY_RESUB resub_meta, in EMPTY_RECIRC recirc_meta) { + state start { + transition parse_hdrs; + } + state parse_hdrs { + pkt.extract(hdr.eth_hdr); + transition accept; + } +} + +parser egressParserImpl(packet_in buffer, out EMPTY_H a, inout Meta b, in psa_egress_parser_input_metadata_t c, in EMPTY_BRIDGE d, in EMPTY_CLONE e, in EMPTY_CLONE f) { + state start { + transition accept; + } +} + +control ingress(inout Headers h, inout Meta m, in psa_ingress_input_metadata_t istd, inout psa_ingress_output_metadata_t ostd) { + action simple_action() { + h.eth_hdr.src_addr = 48w1; + } + table simple_table { + key = { + 48w1: exact @name("Vmhbwk") ; + } + actions = { + simple_action(); + NoAction(); + } + default_action = NoAction(); + } + apply { + switch (simple_table.apply().action_run) { + simple_action: { + h.eth_hdr.eth_type = 16w1; + exit; + } + NoAction: { + h.eth_hdr.eth_type = 16w2; + exit; + } + default: { + h.eth_hdr.eth_type = 16w3; + exit; + } + } + h.eth_hdr.eth_type = 16w4; + exit; + } +} + +control egressControlImpl(inout EMPTY_H hdr, inout Meta meta, in psa_egress_input_metadata_t x, inout psa_egress_output_metadata_t ostd) { + apply { + } +} + +control deparser(packet_out pkt, out EMPTY_CLONE clone_i2e_meta, out EMPTY_RESUB resubmit_meta, out EMPTY_BRIDGE normal_meta, inout Headers h, in Meta local_metadata, in psa_ingress_output_metadata_t istd) { + apply { + pkt.emit(h); + } +} + +control egressDeparserImpl(packet_out buffer, out EMPTY_CLONE a, out EMPTY_RECIRC b, inout EMPTY_H c, in Meta d, in psa_egress_output_metadata_t e, in psa_egress_deparser_input_metadata_t f) { + apply { + } +} + +IngressPipeline(p(), ingress(), deparser()) ip; + +EgressPipeline(egressParserImpl(), egressControlImpl(), egressDeparserImpl()) ep; + +PSA_Switch(ip, PacketReplicationEngine(), ep, BufferingQueueingEngine()) main; + diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_exit_combination_15-frontend.p4 b/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_exit_combination_15-frontend.p4 new file mode 100644 index 00000000000..52c5c0534a0 --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_exit_combination_15-frontend.p4 @@ -0,0 +1,102 @@ +#include +#include + +header EMPTY_H { +} + +struct EMPTY_RESUB { +} + +struct EMPTY_CLONE { +} + +struct EMPTY_BRIDGE { +} + +struct EMPTY_RECIRC { +} + +header ethernet_t { + bit<48> dst_addr; + bit<48> src_addr; + bit<16> eth_type; +} + +struct Headers { + ethernet_t eth_hdr; +} + +struct Meta { +} + +parser p(packet_in pkt, out Headers hdr, inout Meta m, in psa_ingress_parser_input_metadata_t x, in EMPTY_RESUB resub_meta, in EMPTY_RECIRC recirc_meta) { + state start { + pkt.extract(hdr.eth_hdr); + transition accept; + } +} + +parser egressParserImpl(packet_in buffer, out EMPTY_H a, inout Meta b, in psa_egress_parser_input_metadata_t c, in EMPTY_BRIDGE d, in EMPTY_CLONE e, in EMPTY_CLONE f) { + state start { + transition accept; + } +} + +control ingress(inout Headers h, inout Meta m, in psa_ingress_input_metadata_t istd, inout psa_ingress_output_metadata_t ostd) { + @noWarn("unused") @name(".NoAction") action NoAction_1() { + } + @name("ingress.simple_action") action simple_action() { + h.eth_hdr.src_addr = 48w1; + } + @name("ingress.simple_table") table simple_table_0 { + key = { + 48w1: exact @name("Vmhbwk") ; + } + actions = { + simple_action(); + NoAction_1(); + } + default_action = NoAction_1(); + } + apply { + switch (simple_table_0.apply().action_run) { + simple_action: { + h.eth_hdr.eth_type = 16w1; + exit; + } + NoAction_1: { + h.eth_hdr.eth_type = 16w2; + exit; + } + default: { + h.eth_hdr.eth_type = 16w3; + exit; + } + } + h.eth_hdr.eth_type = 16w4; + exit; + } +} + +control egressControlImpl(inout EMPTY_H hdr, inout Meta meta, in psa_egress_input_metadata_t x, inout psa_egress_output_metadata_t ostd) { + apply { + } +} + +control deparser(packet_out pkt, out EMPTY_CLONE clone_i2e_meta, out EMPTY_RESUB resubmit_meta, out EMPTY_BRIDGE normal_meta, inout Headers h, in Meta local_metadata, in psa_ingress_output_metadata_t istd) { + apply { + pkt.emit(h); + } +} + +control egressDeparserImpl(packet_out buffer, out EMPTY_CLONE a, out EMPTY_RECIRC b, inout EMPTY_H c, in Meta d, in psa_egress_output_metadata_t e, in psa_egress_deparser_input_metadata_t f) { + apply { + } +} + +IngressPipeline(p(), ingress(), deparser()) ip; + +EgressPipeline(egressParserImpl(), egressControlImpl(), egressDeparserImpl()) ep; + +PSA_Switch(ip, PacketReplicationEngine(), ep, BufferingQueueingEngine()) main; + diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_exit_combination_15-midend.p4 b/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_exit_combination_15-midend.p4 new file mode 100644 index 00000000000..03def86938a --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_exit_combination_15-midend.p4 @@ -0,0 +1,164 @@ +#include +#include + +header EMPTY_H { +} + +struct EMPTY_RESUB { +} + +struct EMPTY_CLONE { +} + +struct EMPTY_BRIDGE { +} + +struct EMPTY_RECIRC { +} + +header ethernet_t { + bit<48> dst_addr; + bit<48> src_addr; + bit<16> eth_type; +} + +struct Headers { + ethernet_t eth_hdr; +} + +struct Meta { +} + +parser p(packet_in pkt, out Headers hdr, inout Meta m, in psa_ingress_parser_input_metadata_t x, in EMPTY_RESUB resub_meta, in EMPTY_RECIRC recirc_meta) { + state start { + pkt.extract(hdr.eth_hdr); + transition accept; + } +} + +parser egressParserImpl(packet_in buffer, out EMPTY_H a, inout Meta b, in psa_egress_parser_input_metadata_t c, in EMPTY_BRIDGE d, in EMPTY_CLONE e, in EMPTY_CLONE f) { + state start { + transition accept; + } +} + +control ingress(inout Headers h, inout Meta m, in psa_ingress_input_metadata_t istd, inout psa_ingress_output_metadata_t ostd) { + bool hasExited; + bit<48> key_0; + @noWarn("unused") @name(".NoAction") action NoAction_1() { + } + @name("ingress.simple_action") action simple_action() { + h.eth_hdr.src_addr = 48w1; + } + @name("ingress.simple_table") table simple_table_0 { + key = { + key_0: exact @name("Vmhbwk") ; + } + actions = { + simple_action(); + NoAction_1(); + } + default_action = NoAction_1(); + } + @hidden action psadpdkgauntlet_exit_combination_15l64() { + h.eth_hdr.eth_type = 16w1; + hasExited = true; + } + @hidden action psadpdkgauntlet_exit_combination_15l68() { + h.eth_hdr.eth_type = 16w2; + hasExited = true; + } + @hidden action psadpdkgauntlet_exit_combination_15l72() { + h.eth_hdr.eth_type = 16w3; + hasExited = true; + } + @hidden action psadpdkgauntlet_exit_combination_15l54() { + hasExited = false; + key_0 = 48w1; + } + @hidden action psadpdkgauntlet_exit_combination_15l76() { + h.eth_hdr.eth_type = 16w4; + hasExited = true; + } + @hidden table tbl_psadpdkgauntlet_exit_combination_15l54 { + actions = { + psadpdkgauntlet_exit_combination_15l54(); + } + const default_action = psadpdkgauntlet_exit_combination_15l54(); + } + @hidden table tbl_psadpdkgauntlet_exit_combination_15l64 { + actions = { + psadpdkgauntlet_exit_combination_15l64(); + } + const default_action = psadpdkgauntlet_exit_combination_15l64(); + } + @hidden table tbl_psadpdkgauntlet_exit_combination_15l68 { + actions = { + psadpdkgauntlet_exit_combination_15l68(); + } + const default_action = psadpdkgauntlet_exit_combination_15l68(); + } + @hidden table tbl_psadpdkgauntlet_exit_combination_15l72 { + actions = { + psadpdkgauntlet_exit_combination_15l72(); + } + const default_action = psadpdkgauntlet_exit_combination_15l72(); + } + @hidden table tbl_psadpdkgauntlet_exit_combination_15l76 { + actions = { + psadpdkgauntlet_exit_combination_15l76(); + } + const default_action = psadpdkgauntlet_exit_combination_15l76(); + } + apply { + tbl_psadpdkgauntlet_exit_combination_15l54.apply(); + switch (simple_table_0.apply().action_run) { + simple_action: { + tbl_psadpdkgauntlet_exit_combination_15l64.apply(); + } + NoAction_1: { + tbl_psadpdkgauntlet_exit_combination_15l68.apply(); + } + default: { + tbl_psadpdkgauntlet_exit_combination_15l72.apply(); + } + } + if (hasExited) { + ; + } else { + tbl_psadpdkgauntlet_exit_combination_15l76.apply(); + } + } +} + +control egressControlImpl(inout EMPTY_H hdr, inout Meta meta, in psa_egress_input_metadata_t x, inout psa_egress_output_metadata_t ostd) { + apply { + } +} + +control deparser(packet_out pkt, out EMPTY_CLONE clone_i2e_meta, out EMPTY_RESUB resubmit_meta, out EMPTY_BRIDGE normal_meta, inout Headers h, in Meta local_metadata, in psa_ingress_output_metadata_t istd) { + @hidden action psadpdkgauntlet_exit_combination_15l97() { + pkt.emit(h.eth_hdr); + } + @hidden table tbl_psadpdkgauntlet_exit_combination_15l97 { + actions = { + psadpdkgauntlet_exit_combination_15l97(); + } + const default_action = psadpdkgauntlet_exit_combination_15l97(); + } + apply { + tbl_psadpdkgauntlet_exit_combination_15l97.apply(); + } +} + +control egressDeparserImpl(packet_out buffer, out EMPTY_CLONE a, out EMPTY_RECIRC b, inout EMPTY_H c, in Meta d, in psa_egress_output_metadata_t e, in psa_egress_deparser_input_metadata_t f) { + apply { + } +} + +IngressPipeline(p(), ingress(), deparser()) ip; + +EgressPipeline(egressParserImpl(), egressControlImpl(), egressDeparserImpl()) ep; + +PSA_Switch(ip, PacketReplicationEngine(), ep, BufferingQueueingEngine()) main; + diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_exit_combination_15.p4 b/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_exit_combination_15.p4 new file mode 100644 index 00000000000..efd185a5f1b --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_exit_combination_15.p4 @@ -0,0 +1,102 @@ +#include +#include + +header EMPTY_H { +} + +struct EMPTY_RESUB { +} + +struct EMPTY_CLONE { +} + +struct EMPTY_BRIDGE { +} + +struct EMPTY_RECIRC { +} + +header ethernet_t { + bit<48> dst_addr; + bit<48> src_addr; + bit<16> eth_type; +} + +struct Headers { + ethernet_t eth_hdr; +} + +struct Meta { +} + +parser p(packet_in pkt, out Headers hdr, inout Meta m, in psa_ingress_parser_input_metadata_t x, in EMPTY_RESUB resub_meta, in EMPTY_RECIRC recirc_meta) { + state start { + transition parse_hdrs; + } + state parse_hdrs { + pkt.extract(hdr.eth_hdr); + transition accept; + } +} + +parser egressParserImpl(packet_in buffer, out EMPTY_H a, inout Meta b, in psa_egress_parser_input_metadata_t c, in EMPTY_BRIDGE d, in EMPTY_CLONE e, in EMPTY_CLONE f) { + state start { + transition accept; + } +} + +control ingress(inout Headers h, inout Meta m, in psa_ingress_input_metadata_t istd, inout psa_ingress_output_metadata_t ostd) { + action simple_action() { + h.eth_hdr.src_addr = 1; + } + table simple_table { + key = { + 48w1: exact @name("Vmhbwk") ; + } + actions = { + simple_action(); + NoAction(); + } + } + apply { + switch (simple_table.apply().action_run) { + simple_action: { + h.eth_hdr.eth_type = 16w1; + exit; + } + NoAction: { + h.eth_hdr.eth_type = 16w2; + exit; + } + default: { + h.eth_hdr.eth_type = 16w3; + exit; + } + } + h.eth_hdr.eth_type = 16w4; + exit; + } +} + +control egressControlImpl(inout EMPTY_H hdr, inout Meta meta, in psa_egress_input_metadata_t x, inout psa_egress_output_metadata_t ostd) { + apply { + } +} + +control deparser(packet_out pkt, out EMPTY_CLONE clone_i2e_meta, out EMPTY_RESUB resubmit_meta, out EMPTY_BRIDGE normal_meta, inout Headers h, in Meta local_metadata, in psa_ingress_output_metadata_t istd) { + apply { + pkt.emit(h); + } +} + +control egressDeparserImpl(packet_out buffer, out EMPTY_CLONE a, out EMPTY_RECIRC b, inout EMPTY_H c, in Meta d, in psa_egress_output_metadata_t e, in psa_egress_deparser_input_metadata_t f) { + apply { + } +} + +IngressPipeline(p(), ingress(), deparser()) ip; + +EgressPipeline(egressParserImpl(), egressControlImpl(), egressDeparserImpl()) ep; + +PSA_Switch(ip, PacketReplicationEngine(), ep, BufferingQueueingEngine()) main; + diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_exit_combination_15.p4-error b/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_exit_combination_15.p4-error new file mode 100644 index 00000000000..ebd49507d52 --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_exit_combination_15.p4-error @@ -0,0 +1,6 @@ +psa-dpdk-gauntlet_exit_combination_15.p4(54): [--Wwarn=ignore-prop] warning: KeyElement: constant key element + 48w1: exact @name("Vmhbwk") ; + ^^^^ +psa-dpdk-gauntlet_exit_combination_15.p4(54): [--Wwarn=mismatch] warning: 48w1: Constant key field + 48w1: exact @name("Vmhbwk") ; + ^^^^ diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_exit_combination_15.p4-stderr b/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_exit_combination_15.p4-stderr new file mode 100644 index 00000000000..ebd49507d52 --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_exit_combination_15.p4-stderr @@ -0,0 +1,6 @@ +psa-dpdk-gauntlet_exit_combination_15.p4(54): [--Wwarn=ignore-prop] warning: KeyElement: constant key element + 48w1: exact @name("Vmhbwk") ; + ^^^^ +psa-dpdk-gauntlet_exit_combination_15.p4(54): [--Wwarn=mismatch] warning: 48w1: Constant key field + 48w1: exact @name("Vmhbwk") ; + ^^^^ diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_exit_combination_15.p4.bfrt.json b/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_exit_combination_15.p4.bfrt.json new file mode 100644 index 00000000000..beabb07c48e --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_exit_combination_15.p4.bfrt.json @@ -0,0 +1,48 @@ +{ + "schema_version" : "1.0.0", + "tables" : [ + { + "name" : "ip.ingress.simple_table", + "id" : 39789425, + "table_type" : "MatchAction_Direct", + "size" : 1024, + "annotations" : [], + "depends_on" : [], + "has_const_default_action" : false, + "key" : [ + { + "id" : 1, + "name" : "Vmhbwk", + "repeated" : false, + "annotations" : [], + "mandatory" : false, + "match_type" : "Exact", + "type" : { + "type" : "bytes", + "width" : 48 + } + } + ], + "action_specs" : [ + { + "id" : 25524983, + "name" : "ingress.simple_action", + "action_scope" : "TableAndDefault", + "annotations" : [], + "data" : [] + }, + { + "id" : 21257015, + "name" : "NoAction", + "action_scope" : "TableAndDefault", + "annotations" : [], + "data" : [] + } + ], + "data" : [], + "supported_operations" : [], + "attributes" : ["EntryScope"] + } + ], + "learn_filters" : [] +} \ No newline at end of file diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_exit_combination_15.p4.entries.txt b/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_exit_combination_15.p4.entries.txt new file mode 100644 index 00000000000..e69de29bb2d diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_exit_combination_15.p4.p4info.txt b/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_exit_combination_15.p4.p4info.txt new file mode 100644 index 00000000000..05607061a88 --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_exit_combination_15.p4.p4info.txt @@ -0,0 +1,40 @@ +pkg_info { + arch: "psa" +} +tables { + preamble { + id: 39789425 + name: "ingress.simple_table" + alias: "simple_table" + } + match_fields { + id: 1 + name: "Vmhbwk" + bitwidth: 48 + match_type: EXACT + } + action_refs { + id: 25524983 + } + action_refs { + id: 21257015 + } + size: 1024 +} +actions { + preamble { + id: 21257015 + name: "NoAction" + alias: "NoAction" + annotations: "@noWarn(\"unused\")" + } +} +actions { + preamble { + id: 25524983 + name: "ingress.simple_action" + alias: "simple_action" + } +} +type_info { +} diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_exit_combination_15.p4.spec b/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_exit_combination_15.p4.spec new file mode 100644 index 00000000000..51b6696f6d7 --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_exit_combination_15.p4.spec @@ -0,0 +1,89 @@ + +struct ethernet_t { + bit<48> dst_addr + bit<48> src_addr + bit<16> eth_type +} + +struct psa_ingress_output_metadata_t { + bit<8> class_of_service + bit<8> clone + bit<16> clone_session_id + bit<8> drop + bit<8> resubmit + bit<32> multicast_group + bit<32> egress_port +} + +struct psa_egress_output_metadata_t { + bit<8> clone + bit<16> clone_session_id + bit<8> drop +} + +struct psa_egress_deparser_input_metadata_t { + bit<32> egress_port +} + +header eth_hdr instanceof ethernet_t + +struct Meta { + bit<32> psa_ingress_input_metadata_ingress_port + bit<8> psa_ingress_output_metadata_drop + bit<32> psa_ingress_output_metadata_egress_port + bit<8> Ingress_hasExited + bit<48> Ingress_key +} +metadata instanceof Meta + +action NoAction args none { + return +} + +action simple_action args none { + mov h.eth_hdr.src_addr 0x1 + return +} + +table simple_table { + key { + m.Ingress_key exact + } + actions { + simple_action + NoAction + } + default_action NoAction args none + size 0x10000 +} + + +apply { + rx m.psa_ingress_input_metadata_ingress_port + mov m.psa_ingress_output_metadata_drop 0x0 + extract h.eth_hdr + mov m.Ingress_hasExited 0 + mov m.Ingress_key 0x1 + table simple_table + jmpa LABEL_SWITCH simple_action + jmpa LABEL_SWITCH_0 NoAction_1 + jmp LABEL_DEFAULT + LABEL_SWITCH : mov h.eth_hdr.eth_type 0x1 + mov m.Ingress_hasExited 1 + jmp LABEL_ENDSWITCH + LABEL_SWITCH_0 : mov h.eth_hdr.eth_type 0x2 + mov m.Ingress_hasExited 1 + jmp LABEL_ENDSWITCH + LABEL_DEFAULT : mov h.eth_hdr.eth_type 0x3 + mov m.Ingress_hasExited 1 + LABEL_ENDSWITCH : jmpneq LABEL_FALSE m.Ingress_hasExited 0x1 + jmp LABEL_END + LABEL_FALSE : mov h.eth_hdr.eth_type 0x4 + mov m.Ingress_hasExited 1 + LABEL_END : jmpneq LABEL_DROP m.psa_ingress_output_metadata_drop 0x0 + emit h.eth_hdr + tx m.psa_ingress_output_metadata_egress_port + LABEL_DROP : drop +} + + diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_exit_combination_17-bmv2.p4-error b/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_exit_combination_17-bmv2.p4-error new file mode 100644 index 00000000000..a6bacc2dd04 --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_exit_combination_17-bmv2.p4-error @@ -0,0 +1,12 @@ +psa-dpdk-gauntlet_exit_combination_17-bmv2.p4(53): [--Wwarn=ignore-prop] warning: KeyElement: constant key element + 48w1 : exact @name("key") ; + ^^^^ +psa-dpdk-gauntlet_exit_combination_17-bmv2.p4(61): [--Wwarn=ignore-prop] warning: KeyElement: constant key element + 48w1 : exact @name("key") ; + ^^^^ +psa-dpdk-gauntlet_exit_combination_17-bmv2.p4(53): [--Wwarn=mismatch] warning: 48w1: Constant key field + 48w1 : exact @name("key") ; + ^^^^ +psa-dpdk-gauntlet_exit_combination_17-bmv2.p4(61): [--Wwarn=mismatch] warning: 48w1: Constant key field + 48w1 : exact @name("key") ; + ^^^^ diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_exit_combination_17-bmv2.p4.bfrt.json b/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_exit_combination_17-bmv2.p4.bfrt.json new file mode 100644 index 00000000000..4d89de724ce --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_exit_combination_17-bmv2.p4.bfrt.json @@ -0,0 +1,98 @@ +{ + "schema_version" : "1.0.0", + "tables" : [ + { + "name" : "ip.ingress.simple_table_1", + "id" : 36787877, + "table_type" : "MatchAction_Direct", + "size" : 1024, + "annotations" : [], + "depends_on" : [], + "has_const_default_action" : false, + "key" : [ + { + "id" : 1, + "name" : "key", + "repeated" : false, + "annotations" : [], + "mandatory" : false, + "match_type" : "Exact", + "type" : { + "type" : "bytes", + "width" : 48 + } + } + ], + "action_specs" : [ + { + "id" : 27880877, + "name" : "ingress.dummy_action", + "action_scope" : "TableAndDefault", + "annotations" : [], + "data" : [] + }, + { + "id" : 21257015, + "name" : "NoAction", + "action_scope" : "DefaultOnly", + "annotations" : [ + { + "name" : "@defaultonly" + } + ], + "data" : [] + } + ], + "data" : [], + "supported_operations" : [], + "attributes" : ["EntryScope"] + }, + { + "name" : "ip.ingress.simple_table_2", + "id" : 48738834, + "table_type" : "MatchAction_Direct", + "size" : 1024, + "annotations" : [], + "depends_on" : [], + "has_const_default_action" : false, + "key" : [ + { + "id" : 1, + "name" : "key", + "repeated" : false, + "annotations" : [], + "mandatory" : false, + "match_type" : "Exact", + "type" : { + "type" : "bytes", + "width" : 48 + } + } + ], + "action_specs" : [ + { + "id" : 27880877, + "name" : "ingress.dummy_action", + "action_scope" : "TableAndDefault", + "annotations" : [], + "data" : [] + }, + { + "id" : 21257015, + "name" : "NoAction", + "action_scope" : "DefaultOnly", + "annotations" : [ + { + "name" : "@defaultonly" + } + ], + "data" : [] + } + ], + "data" : [], + "supported_operations" : [], + "attributes" : ["EntryScope"] + } + ], + "learn_filters" : [] +} \ No newline at end of file diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_exit_combination_17-bmv2.p4.spec b/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_exit_combination_17-bmv2.p4.spec new file mode 100644 index 00000000000..288f042c7d1 --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_exit_combination_17-bmv2.p4.spec @@ -0,0 +1,99 @@ + +struct ethernet_t { + bit<48> dst_addr + bit<48> src_addr + bit<16> eth_type +} + +struct psa_ingress_output_metadata_t { + bit<8> class_of_service + bit<8> clone + bit<16> clone_session_id + bit<8> drop + bit<8> resubmit + bit<32> multicast_group + bit<32> egress_port +} + +struct psa_egress_output_metadata_t { + bit<8> clone + bit<16> clone_session_id + bit<8> drop +} + +struct psa_egress_deparser_input_metadata_t { + bit<32> egress_port +} + +header eth_hdr instanceof ethernet_t + +struct Meta { + bit<32> psa_ingress_input_metadata_ingress_port + bit<8> psa_ingress_output_metadata_drop + bit<32> psa_ingress_output_metadata_egress_port + bit<8> Ingress_hasReturned + bit<48> Ingress_key + bit<48> Ingress_key_0 +} +metadata instanceof Meta + +action NoAction args none { + return +} + +action dummy_action args none { + return +} + +action dummy_action_1 args none { + return +} + +table simple_table_1 { + key { + m.Ingress_key exact + } + actions { + dummy_action + NoAction + } + default_action NoAction args none + size 0x10000 +} + + +table simple_table_2 { + key { + m.Ingress_key_0 exact + } + actions { + dummy_action_1 + NoAction + } + default_action NoAction args none + size 0x10000 +} + + +apply { + rx m.psa_ingress_input_metadata_ingress_port + mov m.psa_ingress_output_metadata_drop 0x0 + extract h.eth_hdr + mov m.Ingress_hasReturned 0 + mov m.Ingress_key 0x1 + table simple_table_1 + jmpa LABEL_SWITCH dummy_action + jmp LABEL_ENDSWITCH + LABEL_SWITCH : mov m.Ingress_key_0 0x1 + table simple_table_2 + jmpa LABEL_SWITCH_0 dummy_action_1 + jmp LABEL_ENDSWITCH + LABEL_SWITCH_0 : mov h.eth_hdr.src_addr 0x4 + mov m.Ingress_hasReturned 1 + LABEL_ENDSWITCH : jmpneq LABEL_DROP m.psa_ingress_output_metadata_drop 0x0 + emit h.eth_hdr + tx m.psa_ingress_output_metadata_egress_port + LABEL_DROP : drop +} + + diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_exit_combination_17-first.p4 b/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_exit_combination_17-first.p4 new file mode 100644 index 00000000000..ffca95f93e6 --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_exit_combination_17-first.p4 @@ -0,0 +1,111 @@ +#include +#include + +header EMPTY_H { +} + +struct EMPTY_RESUB { +} + +struct EMPTY_CLONE { +} + +struct EMPTY_BRIDGE { +} + +struct EMPTY_RECIRC { +} + +header ethernet_t { + bit<48> dst_addr; + bit<48> src_addr; + bit<16> eth_type; +} + +struct Headers { + ethernet_t eth_hdr; +} + +struct Meta { +} + +parser p(packet_in pkt, out Headers hdr, inout Meta m, in psa_ingress_parser_input_metadata_t x, in EMPTY_RESUB resub_meta, in EMPTY_RECIRC recirc_meta) { + state start { + transition parse_hdrs; + } + state parse_hdrs { + pkt.extract(hdr.eth_hdr); + transition accept; + } +} + +parser egressParserImpl(packet_in buffer, out EMPTY_H a, inout Meta b, in psa_egress_parser_input_metadata_t c, in EMPTY_BRIDGE d, in EMPTY_CLONE e, in EMPTY_CLONE f) { + state start { + transition accept; + } +} + +control ingress(inout Headers h, inout Meta m, in psa_ingress_input_metadata_t istd, inout psa_ingress_output_metadata_t ostd) { + action dummy_action() { + } + table simple_table_1 { + key = { + 48w1: exact @name("key") ; + } + actions = { + dummy_action(); + @defaultonly NoAction(); + } + default_action = NoAction(); + } + table simple_table_2 { + key = { + 48w1: exact @name("key") ; + } + actions = { + dummy_action(); + @defaultonly NoAction(); + } + default_action = NoAction(); + } + apply { + switch (simple_table_1.apply().action_run) { + dummy_action: { + switch (simple_table_2.apply().action_run) { + dummy_action: { + h.eth_hdr.src_addr = 48w4; + return; + } + default: { + } + } + } + default: { + } + } + exit; + } +} + +control egressControlImpl(inout EMPTY_H hdr, inout Meta meta, in psa_egress_input_metadata_t x, inout psa_egress_output_metadata_t ostd) { + apply { + } +} + +control deparser(packet_out pkt, out EMPTY_CLONE clone_i2e_meta, out EMPTY_RESUB resubmit_meta, out EMPTY_BRIDGE normal_meta, inout Headers hdr, in Meta local_metadata, in psa_ingress_output_metadata_t istd) { + apply { + pkt.emit(hdr); + } +} + +control egressDeparserImpl(packet_out buffer, out EMPTY_CLONE a, out EMPTY_RECIRC b, inout EMPTY_H c, in Meta d, in psa_egress_output_metadata_t e, in psa_egress_deparser_input_metadata_t f) { + apply { + } +} + +IngressPipeline(p(), ingress(), deparser()) ip; + +EgressPipeline(egressParserImpl(), egressControlImpl(), egressDeparserImpl()) ep; + +PSA_Switch(ip, PacketReplicationEngine(), ep, BufferingQueueingEngine()) main; + diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_exit_combination_17-frontend.p4 b/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_exit_combination_17-frontend.p4 new file mode 100644 index 00000000000..08f8440c167 --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_exit_combination_17-frontend.p4 @@ -0,0 +1,120 @@ +#include +#include + +header EMPTY_H { +} + +struct EMPTY_RESUB { +} + +struct EMPTY_CLONE { +} + +struct EMPTY_BRIDGE { +} + +struct EMPTY_RECIRC { +} + +header ethernet_t { + bit<48> dst_addr; + bit<48> src_addr; + bit<16> eth_type; +} + +struct Headers { + ethernet_t eth_hdr; +} + +struct Meta { +} + +parser p(packet_in pkt, out Headers hdr, inout Meta m, in psa_ingress_parser_input_metadata_t x, in EMPTY_RESUB resub_meta, in EMPTY_RECIRC recirc_meta) { + state start { + pkt.extract(hdr.eth_hdr); + transition accept; + } +} + +parser egressParserImpl(packet_in buffer, out EMPTY_H a, inout Meta b, in psa_egress_parser_input_metadata_t c, in EMPTY_BRIDGE d, in EMPTY_CLONE e, in EMPTY_CLONE f) { + state start { + transition accept; + } +} + +control ingress(inout Headers h, inout Meta m, in psa_ingress_input_metadata_t istd, inout psa_ingress_output_metadata_t ostd) { + @name("ingress.hasReturned") bool hasReturned; + @noWarn("unused") @name(".NoAction") action NoAction_1() { + } + @noWarn("unused") @name(".NoAction") action NoAction_2() { + } + @name("ingress.dummy_action") action dummy_action() { + } + @name("ingress.dummy_action") action dummy_action_1() { + } + @name("ingress.simple_table_1") table simple_table { + key = { + 48w1: exact @name("key") ; + } + actions = { + dummy_action(); + @defaultonly NoAction_1(); + } + default_action = NoAction_1(); + } + @name("ingress.simple_table_2") table simple_table_0 { + key = { + 48w1: exact @name("key") ; + } + actions = { + dummy_action_1(); + @defaultonly NoAction_2(); + } + default_action = NoAction_2(); + } + apply { + hasReturned = false; + switch (simple_table.apply().action_run) { + dummy_action: { + switch (simple_table_0.apply().action_run) { + dummy_action_1: { + h.eth_hdr.src_addr = 48w4; + hasReturned = true; + } + default: { + } + } + } + default: { + } + } + if (hasReturned) { + ; + } else { + exit; + } + } +} + +control egressControlImpl(inout EMPTY_H hdr, inout Meta meta, in psa_egress_input_metadata_t x, inout psa_egress_output_metadata_t ostd) { + apply { + } +} + +control deparser(packet_out pkt, out EMPTY_CLONE clone_i2e_meta, out EMPTY_RESUB resubmit_meta, out EMPTY_BRIDGE normal_meta, inout Headers hdr, in Meta local_metadata, in psa_ingress_output_metadata_t istd) { + apply { + pkt.emit(hdr); + } +} + +control egressDeparserImpl(packet_out buffer, out EMPTY_CLONE a, out EMPTY_RECIRC b, inout EMPTY_H c, in Meta d, in psa_egress_output_metadata_t e, in psa_egress_deparser_input_metadata_t f) { + apply { + } +} + +IngressPipeline(p(), ingress(), deparser()) ip; + +EgressPipeline(egressParserImpl(), egressControlImpl(), egressDeparserImpl()) ep; + +PSA_Switch(ip, PacketReplicationEngine(), ep, BufferingQueueingEngine()) main; + diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_exit_combination_17-midend.p4 b/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_exit_combination_17-midend.p4 new file mode 100644 index 00000000000..11e7cd46508 --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_exit_combination_17-midend.p4 @@ -0,0 +1,171 @@ +#include +#include + +header EMPTY_H { +} + +struct EMPTY_RESUB { +} + +struct EMPTY_CLONE { +} + +struct EMPTY_BRIDGE { +} + +struct EMPTY_RECIRC { +} + +header ethernet_t { + bit<48> dst_addr; + bit<48> src_addr; + bit<16> eth_type; +} + +struct Headers { + ethernet_t eth_hdr; +} + +struct Meta { +} + +parser p(packet_in pkt, out Headers hdr, inout Meta m, in psa_ingress_parser_input_metadata_t x, in EMPTY_RESUB resub_meta, in EMPTY_RECIRC recirc_meta) { + state start { + pkt.extract(hdr.eth_hdr); + transition accept; + } +} + +parser egressParserImpl(packet_in buffer, out EMPTY_H a, inout Meta b, in psa_egress_parser_input_metadata_t c, in EMPTY_BRIDGE d, in EMPTY_CLONE e, in EMPTY_CLONE f) { + state start { + transition accept; + } +} + +control ingress(inout Headers h, inout Meta m, in psa_ingress_input_metadata_t istd, inout psa_ingress_output_metadata_t ostd) { + bool hasExited; + @name("ingress.hasReturned") bool hasReturned; + bit<48> key_0; + bit<48> key_1; + @noWarn("unused") @name(".NoAction") action NoAction_1() { + } + @noWarn("unused") @name(".NoAction") action NoAction_2() { + } + @name("ingress.dummy_action") action dummy_action() { + } + @name("ingress.dummy_action") action dummy_action_1() { + } + @name("ingress.simple_table_1") table simple_table { + key = { + key_0: exact @name("key") ; + } + actions = { + dummy_action(); + @defaultonly NoAction_1(); + } + default_action = NoAction_1(); + } + @name("ingress.simple_table_2") table simple_table_0 { + key = { + key_1: exact @name("key") ; + } + actions = { + dummy_action_1(); + @defaultonly NoAction_2(); + } + default_action = NoAction_2(); + } + @hidden action psadpdkgauntlet_exit_combination_17l72() { + h.eth_hdr.src_addr = 48w4; + hasReturned = true; + } + @hidden action psadpdkgauntlet_exit_combination_17l61() { + key_1 = 48w1; + } + @hidden action psadpdkgauntlet_exit_combination_17l53() { + hasExited = false; + hasReturned = false; + key_0 = 48w1; + } + @hidden action psadpdkgauntlet_exit_combination_17l78() { + hasExited = true; + } + @hidden table tbl_psadpdkgauntlet_exit_combination_17l53 { + actions = { + psadpdkgauntlet_exit_combination_17l53(); + } + const default_action = psadpdkgauntlet_exit_combination_17l53(); + } + @hidden table tbl_psadpdkgauntlet_exit_combination_17l61 { + actions = { + psadpdkgauntlet_exit_combination_17l61(); + } + const default_action = psadpdkgauntlet_exit_combination_17l61(); + } + @hidden table tbl_psadpdkgauntlet_exit_combination_17l72 { + actions = { + psadpdkgauntlet_exit_combination_17l72(); + } + const default_action = psadpdkgauntlet_exit_combination_17l72(); + } + @hidden table tbl_psadpdkgauntlet_exit_combination_17l78 { + actions = { + psadpdkgauntlet_exit_combination_17l78(); + } + const default_action = psadpdkgauntlet_exit_combination_17l78(); + } + apply { + tbl_psadpdkgauntlet_exit_combination_17l53.apply(); + switch (simple_table.apply().action_run) { + dummy_action: { + tbl_psadpdkgauntlet_exit_combination_17l61.apply(); + switch (simple_table_0.apply().action_run) { + dummy_action_1: { + tbl_psadpdkgauntlet_exit_combination_17l72.apply(); + } + default: { + } + } + } + default: { + } + } + if (hasReturned) { + ; + } else { + tbl_psadpdkgauntlet_exit_combination_17l78.apply(); + } + } +} + +control egressControlImpl(inout EMPTY_H hdr, inout Meta meta, in psa_egress_input_metadata_t x, inout psa_egress_output_metadata_t ostd) { + apply { + } +} + +control deparser(packet_out pkt, out EMPTY_CLONE clone_i2e_meta, out EMPTY_RESUB resubmit_meta, out EMPTY_BRIDGE normal_meta, inout Headers hdr, in Meta local_metadata, in psa_ingress_output_metadata_t istd) { + @hidden action psadpdkgauntlet_exit_combination_17l101() { + pkt.emit(hdr.eth_hdr); + } + @hidden table tbl_psadpdkgauntlet_exit_combination_17l101 { + actions = { + psadpdkgauntlet_exit_combination_17l101(); + } + const default_action = psadpdkgauntlet_exit_combination_17l101(); + } + apply { + tbl_psadpdkgauntlet_exit_combination_17l101.apply(); + } +} + +control egressDeparserImpl(packet_out buffer, out EMPTY_CLONE a, out EMPTY_RECIRC b, inout EMPTY_H c, in Meta d, in psa_egress_output_metadata_t e, in psa_egress_deparser_input_metadata_t f) { + apply { + } +} + +IngressPipeline(p(), ingress(), deparser()) ip; + +EgressPipeline(egressParserImpl(), egressControlImpl(), egressDeparserImpl()) ep; + +PSA_Switch(ip, PacketReplicationEngine(), ep, BufferingQueueingEngine()) main; + diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_exit_combination_17.p4 b/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_exit_combination_17.p4 new file mode 100644 index 00000000000..1541173b5aa --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_exit_combination_17.p4 @@ -0,0 +1,103 @@ +#include +#include + +header EMPTY_H { +} + +struct EMPTY_RESUB { +} + +struct EMPTY_CLONE { +} + +struct EMPTY_BRIDGE { +} + +struct EMPTY_RECIRC { +} + +header ethernet_t { + bit<48> dst_addr; + bit<48> src_addr; + bit<16> eth_type; +} + +struct Headers { + ethernet_t eth_hdr; +} + +struct Meta { +} + +parser p(packet_in pkt, out Headers hdr, inout Meta m, in psa_ingress_parser_input_metadata_t x, in EMPTY_RESUB resub_meta, in EMPTY_RECIRC recirc_meta) { + state start { + transition parse_hdrs; + } + state parse_hdrs { + pkt.extract(hdr.eth_hdr); + transition accept; + } +} + +parser egressParserImpl(packet_in buffer, out EMPTY_H a, inout Meta b, in psa_egress_parser_input_metadata_t c, in EMPTY_BRIDGE d, in EMPTY_CLONE e, in EMPTY_CLONE f) { + state start { + transition accept; + } +} + +control ingress(inout Headers h, inout Meta m, in psa_ingress_input_metadata_t istd, inout psa_ingress_output_metadata_t ostd) { + action dummy_action() { + } + table simple_table_1 { + key = { + 48w1: exact @name("key") ; + } + actions = { + dummy_action(); + } + } + table simple_table_2 { + key = { + 48w1: exact @name("key") ; + } + actions = { + dummy_action(); + } + } + apply { + switch (simple_table_1.apply().action_run) { + dummy_action: { + switch (simple_table_2.apply().action_run) { + dummy_action: { + h.eth_hdr.src_addr = 4; + return; + } + } + } + } + exit; + } +} + +control egressControlImpl(inout EMPTY_H hdr, inout Meta meta, in psa_egress_input_metadata_t x, inout psa_egress_output_metadata_t ostd) { + apply { + } +} + +control deparser(packet_out pkt, out EMPTY_CLONE clone_i2e_meta, out EMPTY_RESUB resubmit_meta, out EMPTY_BRIDGE normal_meta, inout Headers hdr, in Meta local_metadata, in psa_ingress_output_metadata_t istd) { + apply { + pkt.emit(hdr); + } +} + +control egressDeparserImpl(packet_out buffer, out EMPTY_CLONE a, out EMPTY_RECIRC b, inout EMPTY_H c, in Meta d, in psa_egress_output_metadata_t e, in psa_egress_deparser_input_metadata_t f) { + apply { + } +} + +IngressPipeline(p(), ingress(), deparser()) ip; + +EgressPipeline(egressParserImpl(), egressControlImpl(), egressDeparserImpl()) ep; + +PSA_Switch(ip, PacketReplicationEngine(), ep, BufferingQueueingEngine()) main; + diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_exit_combination_17.p4-error b/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_exit_combination_17.p4-error new file mode 100644 index 00000000000..184031f7b3e --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_exit_combination_17.p4-error @@ -0,0 +1,12 @@ +psa-dpdk-gauntlet_exit_combination_17.p4(53): [--Wwarn=ignore-prop] warning: KeyElement: constant key element + 48w1 : exact @name("key") ; + ^^^^ +psa-dpdk-gauntlet_exit_combination_17.p4(61): [--Wwarn=ignore-prop] warning: KeyElement: constant key element + 48w1 : exact @name("key") ; + ^^^^ +psa-dpdk-gauntlet_exit_combination_17.p4(53): [--Wwarn=mismatch] warning: 48w1: Constant key field + 48w1 : exact @name("key") ; + ^^^^ +psa-dpdk-gauntlet_exit_combination_17.p4(61): [--Wwarn=mismatch] warning: 48w1: Constant key field + 48w1 : exact @name("key") ; + ^^^^ diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_exit_combination_17.p4-stderr b/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_exit_combination_17.p4-stderr new file mode 100644 index 00000000000..184031f7b3e --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_exit_combination_17.p4-stderr @@ -0,0 +1,12 @@ +psa-dpdk-gauntlet_exit_combination_17.p4(53): [--Wwarn=ignore-prop] warning: KeyElement: constant key element + 48w1 : exact @name("key") ; + ^^^^ +psa-dpdk-gauntlet_exit_combination_17.p4(61): [--Wwarn=ignore-prop] warning: KeyElement: constant key element + 48w1 : exact @name("key") ; + ^^^^ +psa-dpdk-gauntlet_exit_combination_17.p4(53): [--Wwarn=mismatch] warning: 48w1: Constant key field + 48w1 : exact @name("key") ; + ^^^^ +psa-dpdk-gauntlet_exit_combination_17.p4(61): [--Wwarn=mismatch] warning: 48w1: Constant key field + 48w1 : exact @name("key") ; + ^^^^ diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_exit_combination_17.p4.bfrt.json b/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_exit_combination_17.p4.bfrt.json new file mode 100644 index 00000000000..4d89de724ce --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_exit_combination_17.p4.bfrt.json @@ -0,0 +1,98 @@ +{ + "schema_version" : "1.0.0", + "tables" : [ + { + "name" : "ip.ingress.simple_table_1", + "id" : 36787877, + "table_type" : "MatchAction_Direct", + "size" : 1024, + "annotations" : [], + "depends_on" : [], + "has_const_default_action" : false, + "key" : [ + { + "id" : 1, + "name" : "key", + "repeated" : false, + "annotations" : [], + "mandatory" : false, + "match_type" : "Exact", + "type" : { + "type" : "bytes", + "width" : 48 + } + } + ], + "action_specs" : [ + { + "id" : 27880877, + "name" : "ingress.dummy_action", + "action_scope" : "TableAndDefault", + "annotations" : [], + "data" : [] + }, + { + "id" : 21257015, + "name" : "NoAction", + "action_scope" : "DefaultOnly", + "annotations" : [ + { + "name" : "@defaultonly" + } + ], + "data" : [] + } + ], + "data" : [], + "supported_operations" : [], + "attributes" : ["EntryScope"] + }, + { + "name" : "ip.ingress.simple_table_2", + "id" : 48738834, + "table_type" : "MatchAction_Direct", + "size" : 1024, + "annotations" : [], + "depends_on" : [], + "has_const_default_action" : false, + "key" : [ + { + "id" : 1, + "name" : "key", + "repeated" : false, + "annotations" : [], + "mandatory" : false, + "match_type" : "Exact", + "type" : { + "type" : "bytes", + "width" : 48 + } + } + ], + "action_specs" : [ + { + "id" : 27880877, + "name" : "ingress.dummy_action", + "action_scope" : "TableAndDefault", + "annotations" : [], + "data" : [] + }, + { + "id" : 21257015, + "name" : "NoAction", + "action_scope" : "DefaultOnly", + "annotations" : [ + { + "name" : "@defaultonly" + } + ], + "data" : [] + } + ], + "data" : [], + "supported_operations" : [], + "attributes" : ["EntryScope"] + } + ], + "learn_filters" : [] +} \ No newline at end of file diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_exit_combination_17.p4.entries.txt b/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_exit_combination_17.p4.entries.txt new file mode 100644 index 00000000000..e69de29bb2d diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_exit_combination_17.p4.p4info.txt b/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_exit_combination_17.p4.p4info.txt new file mode 100644 index 00000000000..c8e79a63ae8 --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_exit_combination_17.p4.p4info.txt @@ -0,0 +1,64 @@ +pkg_info { + arch: "psa" +} +tables { + preamble { + id: 36787877 + name: "ingress.simple_table_1" + alias: "simple_table_1" + } + match_fields { + id: 1 + name: "key" + bitwidth: 48 + match_type: EXACT + } + action_refs { + id: 27880877 + } + action_refs { + id: 21257015 + annotations: "@defaultonly" + scope: DEFAULT_ONLY + } + size: 1024 +} +tables { + preamble { + id: 48738834 + name: "ingress.simple_table_2" + alias: "simple_table_2" + } + match_fields { + id: 1 + name: "key" + bitwidth: 48 + match_type: EXACT + } + action_refs { + id: 27880877 + } + action_refs { + id: 21257015 + annotations: "@defaultonly" + scope: DEFAULT_ONLY + } + size: 1024 +} +actions { + preamble { + id: 21257015 + name: "NoAction" + alias: "NoAction" + annotations: "@noWarn(\"unused\")" + } +} +actions { + preamble { + id: 27880877 + name: "ingress.dummy_action" + alias: "dummy_action" + } +} +type_info { +} diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_exit_combination_17.p4.spec b/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_exit_combination_17.p4.spec new file mode 100644 index 00000000000..288f042c7d1 --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_exit_combination_17.p4.spec @@ -0,0 +1,99 @@ + +struct ethernet_t { + bit<48> dst_addr + bit<48> src_addr + bit<16> eth_type +} + +struct psa_ingress_output_metadata_t { + bit<8> class_of_service + bit<8> clone + bit<16> clone_session_id + bit<8> drop + bit<8> resubmit + bit<32> multicast_group + bit<32> egress_port +} + +struct psa_egress_output_metadata_t { + bit<8> clone + bit<16> clone_session_id + bit<8> drop +} + +struct psa_egress_deparser_input_metadata_t { + bit<32> egress_port +} + +header eth_hdr instanceof ethernet_t + +struct Meta { + bit<32> psa_ingress_input_metadata_ingress_port + bit<8> psa_ingress_output_metadata_drop + bit<32> psa_ingress_output_metadata_egress_port + bit<8> Ingress_hasReturned + bit<48> Ingress_key + bit<48> Ingress_key_0 +} +metadata instanceof Meta + +action NoAction args none { + return +} + +action dummy_action args none { + return +} + +action dummy_action_1 args none { + return +} + +table simple_table_1 { + key { + m.Ingress_key exact + } + actions { + dummy_action + NoAction + } + default_action NoAction args none + size 0x10000 +} + + +table simple_table_2 { + key { + m.Ingress_key_0 exact + } + actions { + dummy_action_1 + NoAction + } + default_action NoAction args none + size 0x10000 +} + + +apply { + rx m.psa_ingress_input_metadata_ingress_port + mov m.psa_ingress_output_metadata_drop 0x0 + extract h.eth_hdr + mov m.Ingress_hasReturned 0 + mov m.Ingress_key 0x1 + table simple_table_1 + jmpa LABEL_SWITCH dummy_action + jmp LABEL_ENDSWITCH + LABEL_SWITCH : mov m.Ingress_key_0 0x1 + table simple_table_2 + jmpa LABEL_SWITCH_0 dummy_action_1 + jmp LABEL_ENDSWITCH + LABEL_SWITCH_0 : mov h.eth_hdr.src_addr 0x4 + mov m.Ingress_hasReturned 1 + LABEL_ENDSWITCH : jmpneq LABEL_DROP m.psa_ingress_output_metadata_drop 0x0 + emit h.eth_hdr + tx m.psa_ingress_output_metadata_egress_port + LABEL_DROP : drop +} + + diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_exit_combination_20-bmv2.p4-error b/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_exit_combination_20-bmv2.p4-error new file mode 100644 index 00000000000..e69de29bb2d diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_exit_combination_20-bmv2.p4.bfrt.json b/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_exit_combination_20-bmv2.p4.bfrt.json new file mode 100644 index 00000000000..b6d66a630db --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_exit_combination_20-bmv2.p4.bfrt.json @@ -0,0 +1,5 @@ +{ + "schema_version" : "1.0.0", + "tables" : [], + "learn_filters" : [] +} \ No newline at end of file diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_exit_combination_20-bmv2.p4.spec b/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_exit_combination_20-bmv2.p4.spec new file mode 100644 index 00000000000..5d5608a08b5 --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_exit_combination_20-bmv2.p4.spec @@ -0,0 +1,48 @@ + +struct ethernet_t { + bit<48> dst_addr + bit<48> src_addr + bit<16> eth_type +} + +struct psa_ingress_output_metadata_t { + bit<8> class_of_service + bit<8> clone + bit<16> clone_session_id + bit<8> drop + bit<8> resubmit + bit<32> multicast_group + bit<32> egress_port +} + +struct psa_egress_output_metadata_t { + bit<8> clone + bit<16> clone_session_id + bit<8> drop +} + +struct psa_egress_deparser_input_metadata_t { + bit<32> egress_port +} + +header eth_hdr instanceof ethernet_t + +struct Meta { + bit<32> psa_ingress_input_metadata_ingress_port + bit<8> psa_ingress_output_metadata_drop + bit<32> psa_ingress_output_metadata_egress_port +} +metadata instanceof Meta + +apply { + rx m.psa_ingress_input_metadata_ingress_port + mov m.psa_ingress_output_metadata_drop 0x0 + extract h.eth_hdr + mov h.eth_hdr.eth_type 0x2 + jmpneq LABEL_DROP m.psa_ingress_output_metadata_drop 0x0 + emit h.eth_hdr + tx m.psa_ingress_output_metadata_egress_port + LABEL_DROP : drop +} + + diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_exit_combination_20-first.p4 b/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_exit_combination_20-first.p4 new file mode 100644 index 00000000000..0e8a296438e --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_exit_combination_20-first.p4 @@ -0,0 +1,81 @@ +#include +#include + +header EMPTY_H { +} + +struct EMPTY_RESUB { +} + +struct EMPTY_CLONE { +} + +struct EMPTY_BRIDGE { +} + +struct EMPTY_RECIRC { +} + +header ethernet_t { + bit<48> dst_addr; + bit<48> src_addr; + bit<16> eth_type; +} + +struct Headers { + ethernet_t eth_hdr; +} + +struct Meta { +} + +parser p(packet_in pkt, out Headers hdr, inout Meta m, in psa_ingress_parser_input_metadata_t x, in EMPTY_RESUB resub_meta, in EMPTY_RECIRC recirc_meta) { + state start { + transition parse_hdrs; + } + state parse_hdrs { + pkt.extract(hdr.eth_hdr); + transition accept; + } +} + +parser egressParserImpl(packet_in buffer, out EMPTY_H a, inout Meta b, in psa_egress_parser_input_metadata_t c, in EMPTY_BRIDGE d, in EMPTY_CLONE e, in EMPTY_CLONE f) { + state start { + transition accept; + } +} + +control ingress(inout Headers h, inout Meta m, in psa_ingress_input_metadata_t istd, inout psa_ingress_output_metadata_t ostd) { + action simple_action() { + return; + h.eth_hdr.eth_type = 16w1; + exit; + } + apply { + simple_action(); + h.eth_hdr.eth_type = 16w2; + } +} + +control egressControlImpl(inout EMPTY_H hdr, inout Meta meta, in psa_egress_input_metadata_t x, inout psa_egress_output_metadata_t ostd) { + apply { + } +} + +control deparser(packet_out pkt, out EMPTY_CLONE clone_i2e_meta, out EMPTY_RESUB resubmit_meta, out EMPTY_BRIDGE normal_meta, inout Headers hdr, in Meta local_metadata, in psa_ingress_output_metadata_t istd) { + apply { + pkt.emit(hdr); + } +} + +control egressDeparserImpl(packet_out buffer, out EMPTY_CLONE a, out EMPTY_RECIRC b, inout EMPTY_H c, in Meta d, in psa_egress_output_metadata_t e, in psa_egress_deparser_input_metadata_t f) { + apply { + } +} + +IngressPipeline(p(), ingress(), deparser()) ip; + +EgressPipeline(egressParserImpl(), egressControlImpl(), egressDeparserImpl()) ep; + +PSA_Switch(ip, PacketReplicationEngine(), ep, BufferingQueueingEngine()) main; + diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_exit_combination_20-frontend.p4 b/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_exit_combination_20-frontend.p4 new file mode 100644 index 00000000000..cc6fc056387 --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_exit_combination_20-frontend.p4 @@ -0,0 +1,78 @@ +#include +#include + +header EMPTY_H { +} + +struct EMPTY_RESUB { +} + +struct EMPTY_CLONE { +} + +struct EMPTY_BRIDGE { +} + +struct EMPTY_RECIRC { +} + +header ethernet_t { + bit<48> dst_addr; + bit<48> src_addr; + bit<16> eth_type; +} + +struct Headers { + ethernet_t eth_hdr; +} + +struct Meta { +} + +parser p(packet_in pkt, out Headers hdr, inout Meta m, in psa_ingress_parser_input_metadata_t x, in EMPTY_RESUB resub_meta, in EMPTY_RECIRC recirc_meta) { + state start { + pkt.extract(hdr.eth_hdr); + transition accept; + } +} + +parser egressParserImpl(packet_in buffer, out EMPTY_H a, inout Meta b, in psa_egress_parser_input_metadata_t c, in EMPTY_BRIDGE d, in EMPTY_CLONE e, in EMPTY_CLONE f) { + state start { + transition accept; + } +} + +control ingress(inout Headers h, inout Meta m, in psa_ingress_input_metadata_t istd, inout psa_ingress_output_metadata_t ostd) { + @name("ingress.hasReturned") bool hasReturned; + @name("ingress.simple_action") action simple_action() { + hasReturned = false; + hasReturned = true; + } + apply { + simple_action(); + h.eth_hdr.eth_type = 16w2; + } +} + +control egressControlImpl(inout EMPTY_H hdr, inout Meta meta, in psa_egress_input_metadata_t x, inout psa_egress_output_metadata_t ostd) { + apply { + } +} + +control deparser(packet_out pkt, out EMPTY_CLONE clone_i2e_meta, out EMPTY_RESUB resubmit_meta, out EMPTY_BRIDGE normal_meta, inout Headers hdr, in Meta local_metadata, in psa_ingress_output_metadata_t istd) { + apply { + pkt.emit(hdr); + } +} + +control egressDeparserImpl(packet_out buffer, out EMPTY_CLONE a, out EMPTY_RECIRC b, inout EMPTY_H c, in Meta d, in psa_egress_output_metadata_t e, in psa_egress_deparser_input_metadata_t f) { + apply { + } +} + +IngressPipeline(p(), ingress(), deparser()) ip; + +EgressPipeline(egressParserImpl(), egressControlImpl(), egressDeparserImpl()) ep; + +PSA_Switch(ip, PacketReplicationEngine(), ep, BufferingQueueingEngine()) main; + diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_exit_combination_20-midend.p4 b/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_exit_combination_20-midend.p4 new file mode 100644 index 00000000000..6864d87f133 --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_exit_combination_20-midend.p4 @@ -0,0 +1,99 @@ +#include +#include + +header EMPTY_H { +} + +struct EMPTY_RESUB { +} + +struct EMPTY_CLONE { +} + +struct EMPTY_BRIDGE { +} + +struct EMPTY_RECIRC { +} + +header ethernet_t { + bit<48> dst_addr; + bit<48> src_addr; + bit<16> eth_type; +} + +struct Headers { + ethernet_t eth_hdr; +} + +struct Meta { +} + +parser p(packet_in pkt, out Headers hdr, inout Meta m, in psa_ingress_parser_input_metadata_t x, in EMPTY_RESUB resub_meta, in EMPTY_RECIRC recirc_meta) { + state start { + pkt.extract(hdr.eth_hdr); + transition accept; + } +} + +parser egressParserImpl(packet_in buffer, out EMPTY_H a, inout Meta b, in psa_egress_parser_input_metadata_t c, in EMPTY_BRIDGE d, in EMPTY_CLONE e, in EMPTY_CLONE f) { + state start { + transition accept; + } +} + +control ingress(inout Headers h, inout Meta m, in psa_ingress_input_metadata_t istd, inout psa_ingress_output_metadata_t ostd) { + @name("ingress.simple_action") action simple_action() { + } + @hidden action psadpdkgauntlet_exit_combination_20l62() { + h.eth_hdr.eth_type = 16w2; + } + @hidden table tbl_simple_action { + actions = { + simple_action(); + } + const default_action = simple_action(); + } + @hidden table tbl_psadpdkgauntlet_exit_combination_20l62 { + actions = { + psadpdkgauntlet_exit_combination_20l62(); + } + const default_action = psadpdkgauntlet_exit_combination_20l62(); + } + apply { + tbl_simple_action.apply(); + tbl_psadpdkgauntlet_exit_combination_20l62.apply(); + } +} + +control egressControlImpl(inout EMPTY_H hdr, inout Meta meta, in psa_egress_input_metadata_t x, inout psa_egress_output_metadata_t ostd) { + apply { + } +} + +control deparser(packet_out pkt, out EMPTY_CLONE clone_i2e_meta, out EMPTY_RESUB resubmit_meta, out EMPTY_BRIDGE normal_meta, inout Headers hdr, in Meta local_metadata, in psa_ingress_output_metadata_t istd) { + @hidden action psadpdkgauntlet_exit_combination_20l83() { + pkt.emit(hdr.eth_hdr); + } + @hidden table tbl_psadpdkgauntlet_exit_combination_20l83 { + actions = { + psadpdkgauntlet_exit_combination_20l83(); + } + const default_action = psadpdkgauntlet_exit_combination_20l83(); + } + apply { + tbl_psadpdkgauntlet_exit_combination_20l83.apply(); + } +} + +control egressDeparserImpl(packet_out buffer, out EMPTY_CLONE a, out EMPTY_RECIRC b, inout EMPTY_H c, in Meta d, in psa_egress_output_metadata_t e, in psa_egress_deparser_input_metadata_t f) { + apply { + } +} + +IngressPipeline(p(), ingress(), deparser()) ip; + +EgressPipeline(egressParserImpl(), egressControlImpl(), egressDeparserImpl()) ep; + +PSA_Switch(ip, PacketReplicationEngine(), ep, BufferingQueueingEngine()) main; + diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_exit_combination_20.p4 b/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_exit_combination_20.p4 new file mode 100644 index 00000000000..5fe1ae48de3 --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_exit_combination_20.p4 @@ -0,0 +1,84 @@ +#include +#include + +header EMPTY_H { +} + +struct EMPTY_RESUB { +} + +struct EMPTY_CLONE { +} + +struct EMPTY_BRIDGE { +} + +struct EMPTY_RECIRC { +} + +header ethernet_t { + bit<48> dst_addr; + bit<48> src_addr; + bit<16> eth_type; +} + +struct Headers { + ethernet_t eth_hdr; +} + +struct Meta { +} + +parser p(packet_in pkt, out Headers hdr, inout Meta m, in psa_ingress_parser_input_metadata_t x, in EMPTY_RESUB resub_meta, in EMPTY_RECIRC recirc_meta) { + state start { + transition parse_hdrs; + } + state parse_hdrs { + pkt.extract(hdr.eth_hdr); + transition accept; + } +} + +parser egressParserImpl(packet_in buffer, out EMPTY_H a, inout Meta b, in psa_egress_parser_input_metadata_t c, in EMPTY_BRIDGE d, in EMPTY_CLONE e, in EMPTY_CLONE f) { + state start { + transition accept; + } +} + +control ingress(inout Headers h, inout Meta m, in psa_ingress_input_metadata_t istd, inout psa_ingress_output_metadata_t ostd) { + action simple_action() { + if (!true) { + } else { + return; + } + h.eth_hdr.eth_type = 16w1; + exit; + } + apply { + simple_action(); + h.eth_hdr.eth_type = 16w2; + } +} + +control egressControlImpl(inout EMPTY_H hdr, inout Meta meta, in psa_egress_input_metadata_t x, inout psa_egress_output_metadata_t ostd) { + apply { + } +} + +control deparser(packet_out pkt, out EMPTY_CLONE clone_i2e_meta, out EMPTY_RESUB resubmit_meta, out EMPTY_BRIDGE normal_meta, inout Headers hdr, in Meta local_metadata, in psa_ingress_output_metadata_t istd) { + apply { + pkt.emit(hdr); + } +} + +control egressDeparserImpl(packet_out buffer, out EMPTY_CLONE a, out EMPTY_RECIRC b, inout EMPTY_H c, in Meta d, in psa_egress_output_metadata_t e, in psa_egress_deparser_input_metadata_t f) { + apply { + } +} + +IngressPipeline(p(), ingress(), deparser()) ip; + +EgressPipeline(egressParserImpl(), egressControlImpl(), egressDeparserImpl()) ep; + +PSA_Switch(ip, PacketReplicationEngine(), ep, BufferingQueueingEngine()) main; + diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_exit_combination_20.p4-error b/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_exit_combination_20.p4-error new file mode 100644 index 00000000000..e69de29bb2d diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_exit_combination_20.p4-stderr b/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_exit_combination_20.p4-stderr new file mode 100644 index 00000000000..e69de29bb2d diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_exit_combination_20.p4.bfrt.json b/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_exit_combination_20.p4.bfrt.json new file mode 100644 index 00000000000..b6d66a630db --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_exit_combination_20.p4.bfrt.json @@ -0,0 +1,5 @@ +{ + "schema_version" : "1.0.0", + "tables" : [], + "learn_filters" : [] +} \ No newline at end of file diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_exit_combination_20.p4.entries.txt b/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_exit_combination_20.p4.entries.txt new file mode 100644 index 00000000000..e69de29bb2d diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_exit_combination_20.p4.p4info.txt b/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_exit_combination_20.p4.p4info.txt new file mode 100644 index 00000000000..d0918ae175f --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_exit_combination_20.p4.p4info.txt @@ -0,0 +1,10 @@ +pkg_info { + arch: "psa" +} +actions { + preamble { + id: 25524983 + name: "ingress.simple_action" + alias: "simple_action" + } +} diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_exit_combination_20.p4.spec b/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_exit_combination_20.p4.spec new file mode 100644 index 00000000000..5d5608a08b5 --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_exit_combination_20.p4.spec @@ -0,0 +1,48 @@ + +struct ethernet_t { + bit<48> dst_addr + bit<48> src_addr + bit<16> eth_type +} + +struct psa_ingress_output_metadata_t { + bit<8> class_of_service + bit<8> clone + bit<16> clone_session_id + bit<8> drop + bit<8> resubmit + bit<32> multicast_group + bit<32> egress_port +} + +struct psa_egress_output_metadata_t { + bit<8> clone + bit<16> clone_session_id + bit<8> drop +} + +struct psa_egress_deparser_input_metadata_t { + bit<32> egress_port +} + +header eth_hdr instanceof ethernet_t + +struct Meta { + bit<32> psa_ingress_input_metadata_ingress_port + bit<8> psa_ingress_output_metadata_drop + bit<32> psa_ingress_output_metadata_egress_port +} +metadata instanceof Meta + +apply { + rx m.psa_ingress_input_metadata_ingress_port + mov m.psa_ingress_output_metadata_drop 0x0 + extract h.eth_hdr + mov h.eth_hdr.eth_type 0x2 + jmpneq LABEL_DROP m.psa_ingress_output_metadata_drop 0x0 + emit h.eth_hdr + tx m.psa_ingress_output_metadata_egress_port + LABEL_DROP : drop +} + + diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_exit_combination_23-bmv2.p4-error b/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_exit_combination_23-bmv2.p4-error new file mode 100644 index 00000000000..e69de29bb2d diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_exit_combination_23-bmv2.p4.bfrt.json b/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_exit_combination_23-bmv2.p4.bfrt.json new file mode 100644 index 00000000000..23d6b1c04f6 --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_exit_combination_23-bmv2.p4.bfrt.json @@ -0,0 +1,52 @@ +{ + "schema_version" : "1.0.0", + "tables" : [ + { + "name" : "ip.ingress.simple_table", + "id" : 39789425, + "table_type" : "MatchAction_Direct", + "size" : 1024, + "annotations" : [], + "depends_on" : [], + "has_const_default_action" : false, + "key" : [ + { + "id" : 1, + "name" : "key", + "repeated" : false, + "annotations" : [], + "mandatory" : false, + "match_type" : "Exact", + "type" : { + "type" : "bytes", + "width" : 16 + } + } + ], + "action_specs" : [ + { + "id" : 25524983, + "name" : "ingress.simple_action", + "action_scope" : "TableAndDefault", + "annotations" : [], + "data" : [] + }, + { + "id" : 21257015, + "name" : "NoAction", + "action_scope" : "DefaultOnly", + "annotations" : [ + { + "name" : "@defaultonly" + } + ], + "data" : [] + } + ], + "data" : [], + "supported_operations" : [], + "attributes" : ["EntryScope"] + } + ], + "learn_filters" : [] +} \ No newline at end of file diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_exit_combination_23-bmv2.p4.spec b/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_exit_combination_23-bmv2.p4.spec new file mode 100644 index 00000000000..27301abad1d --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_exit_combination_23-bmv2.p4.spec @@ -0,0 +1,84 @@ + +struct ethernet_t { + bit<48> dst_addr + bit<48> src_addr + bit<16> eth_type +} + +struct psa_ingress_output_metadata_t { + bit<8> class_of_service + bit<8> clone + bit<16> clone_session_id + bit<8> drop + bit<8> resubmit + bit<32> multicast_group + bit<32> egress_port +} + +struct psa_egress_output_metadata_t { + bit<8> clone + bit<16> clone_session_id + bit<8> drop +} + +struct psa_egress_deparser_input_metadata_t { + bit<32> egress_port +} + +header eth_hdr instanceof ethernet_t + +struct Meta { + bit<32> psa_ingress_input_metadata_ingress_port + bit<8> psa_ingress_output_metadata_drop + bit<32> psa_ingress_output_metadata_egress_port + bit<48> Ingress_tmp + bit<8> Ingress_hasExited +} +metadata instanceof Meta + +action NoAction args none { + return +} + +action simple_action args none { + mov h.eth_hdr.dst_addr 0x1 + mov m.Ingress_hasExited 1 + return +} + +table simple_table { + key { + h.eth_hdr.eth_type exact + } + actions { + simple_action + NoAction + } + default_action NoAction args none + size 0x10000 +} + + +apply { + rx m.psa_ingress_input_metadata_ingress_port + mov m.psa_ingress_output_metadata_drop 0x0 + extract h.eth_hdr + mov m.Ingress_hasExited 0 + table simple_table + jmpa LABEL_SWITCH simple_action + jmp LABEL_ENDSWITCH + LABEL_SWITCH : jmpneq LABEL_FALSE m.Ingress_hasExited 0x1 + jmp LABEL_ENDSWITCH + LABEL_FALSE : mov m.Ingress_hasExited 1 + LABEL_ENDSWITCH : jmpneq LABEL_FALSE_0 m.Ingress_hasExited 0x1 + jmp LABEL_END_0 + LABEL_FALSE_0 : mov m.Ingress_tmp h.eth_hdr.src_addr + add m.Ingress_tmp h.eth_hdr.dst_addr + mov h.eth_hdr.dst_addr m.Ingress_tmp + LABEL_END_0 : jmpneq LABEL_DROP m.psa_ingress_output_metadata_drop 0x0 + emit h.eth_hdr + tx m.psa_ingress_output_metadata_egress_port + LABEL_DROP : drop +} + + diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_exit_combination_23-first.p4 b/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_exit_combination_23-first.p4 new file mode 100644 index 00000000000..1e318627a39 --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_exit_combination_23-first.p4 @@ -0,0 +1,96 @@ +#include +#include + +header EMPTY_H { +} + +struct EMPTY_RESUB { +} + +struct EMPTY_CLONE { +} + +struct EMPTY_BRIDGE { +} + +struct EMPTY_RECIRC { +} + +header ethernet_t { + bit<48> dst_addr; + bit<48> src_addr; + bit<16> eth_type; +} + +struct Headers { + ethernet_t eth_hdr; +} + +struct Meta { +} + +parser p(packet_in pkt, out Headers hdr, inout Meta m, in psa_ingress_parser_input_metadata_t x, in EMPTY_RESUB resub_meta, in EMPTY_RECIRC recirc_meta) { + state start { + transition parse_hdrs; + } + state parse_hdrs { + pkt.extract(hdr.eth_hdr); + transition accept; + } +} + +parser egressParserImpl(packet_in buffer, out EMPTY_H a, inout Meta b, in psa_egress_parser_input_metadata_t c, in EMPTY_BRIDGE d, in EMPTY_CLONE e, in EMPTY_CLONE f) { + state start { + transition accept; + } +} + +control ingress(inout Headers h, inout Meta m, in psa_ingress_input_metadata_t istd, inout psa_ingress_output_metadata_t ostd) { + action simple_action() { + h.eth_hdr.dst_addr = 48w1; + exit; + } + table simple_table { + key = { + h.eth_hdr.eth_type: exact @name("key") ; + } + actions = { + simple_action(); + @defaultonly NoAction(); + } + default_action = NoAction(); + } + apply { + switch (simple_table.apply().action_run) { + simple_action: { + exit; + } + default: { + } + } + h.eth_hdr.dst_addr = h.eth_hdr.src_addr + h.eth_hdr.dst_addr; + } +} + +control egressControlImpl(inout EMPTY_H hdr, inout Meta meta, in psa_egress_input_metadata_t x, inout psa_egress_output_metadata_t ostd) { + apply { + } +} + +control deparser(packet_out pkt, out EMPTY_CLONE clone_i2e_meta, out EMPTY_RESUB resubmit_meta, out EMPTY_BRIDGE normal_meta, inout Headers hdr, in Meta local_metadata, in psa_ingress_output_metadata_t istd) { + apply { + pkt.emit(hdr); + } +} + +control egressDeparserImpl(packet_out buffer, out EMPTY_CLONE a, out EMPTY_RECIRC b, inout EMPTY_H c, in Meta d, in psa_egress_output_metadata_t e, in psa_egress_deparser_input_metadata_t f) { + apply { + } +} + +IngressPipeline(p(), ingress(), deparser()) ip; + +EgressPipeline(egressParserImpl(), egressControlImpl(), egressDeparserImpl()) ep; + +PSA_Switch(ip, PacketReplicationEngine(), ep, BufferingQueueingEngine()) main; + diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_exit_combination_23-frontend.p4 b/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_exit_combination_23-frontend.p4 new file mode 100644 index 00000000000..04ea2f824cb --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_exit_combination_23-frontend.p4 @@ -0,0 +1,95 @@ +#include +#include + +header EMPTY_H { +} + +struct EMPTY_RESUB { +} + +struct EMPTY_CLONE { +} + +struct EMPTY_BRIDGE { +} + +struct EMPTY_RECIRC { +} + +header ethernet_t { + bit<48> dst_addr; + bit<48> src_addr; + bit<16> eth_type; +} + +struct Headers { + ethernet_t eth_hdr; +} + +struct Meta { +} + +parser p(packet_in pkt, out Headers hdr, inout Meta m, in psa_ingress_parser_input_metadata_t x, in EMPTY_RESUB resub_meta, in EMPTY_RECIRC recirc_meta) { + state start { + pkt.extract(hdr.eth_hdr); + transition accept; + } +} + +parser egressParserImpl(packet_in buffer, out EMPTY_H a, inout Meta b, in psa_egress_parser_input_metadata_t c, in EMPTY_BRIDGE d, in EMPTY_CLONE e, in EMPTY_CLONE f) { + state start { + transition accept; + } +} + +control ingress(inout Headers h, inout Meta m, in psa_ingress_input_metadata_t istd, inout psa_ingress_output_metadata_t ostd) { + @noWarn("unused") @name(".NoAction") action NoAction_1() { + } + @name("ingress.simple_action") action simple_action() { + h.eth_hdr.dst_addr = 48w1; + exit; + } + @name("ingress.simple_table") table simple_table_0 { + key = { + h.eth_hdr.eth_type: exact @name("key") ; + } + actions = { + simple_action(); + @defaultonly NoAction_1(); + } + default_action = NoAction_1(); + } + apply { + switch (simple_table_0.apply().action_run) { + simple_action: { + exit; + } + default: { + } + } + h.eth_hdr.dst_addr = h.eth_hdr.src_addr + h.eth_hdr.dst_addr; + } +} + +control egressControlImpl(inout EMPTY_H hdr, inout Meta meta, in psa_egress_input_metadata_t x, inout psa_egress_output_metadata_t ostd) { + apply { + } +} + +control deparser(packet_out pkt, out EMPTY_CLONE clone_i2e_meta, out EMPTY_RESUB resubmit_meta, out EMPTY_BRIDGE normal_meta, inout Headers hdr, in Meta local_metadata, in psa_ingress_output_metadata_t istd) { + apply { + pkt.emit(hdr); + } +} + +control egressDeparserImpl(packet_out buffer, out EMPTY_CLONE a, out EMPTY_RECIRC b, inout EMPTY_H c, in Meta d, in psa_egress_output_metadata_t e, in psa_egress_deparser_input_metadata_t f) { + apply { + } +} + +IngressPipeline(p(), ingress(), deparser()) ip; + +EgressPipeline(egressParserImpl(), egressControlImpl(), egressDeparserImpl()) ep; + +PSA_Switch(ip, PacketReplicationEngine(), ep, BufferingQueueingEngine()) main; + diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_exit_combination_23-midend.p4 b/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_exit_combination_23-midend.p4 new file mode 100644 index 00000000000..11bc03232a2 --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_exit_combination_23-midend.p4 @@ -0,0 +1,141 @@ +#include +#include + +header EMPTY_H { +} + +struct EMPTY_RESUB { +} + +struct EMPTY_CLONE { +} + +struct EMPTY_BRIDGE { +} + +struct EMPTY_RECIRC { +} + +header ethernet_t { + bit<48> dst_addr; + bit<48> src_addr; + bit<16> eth_type; +} + +struct Headers { + ethernet_t eth_hdr; +} + +struct Meta { +} + +parser p(packet_in pkt, out Headers hdr, inout Meta m, in psa_ingress_parser_input_metadata_t x, in EMPTY_RESUB resub_meta, in EMPTY_RECIRC recirc_meta) { + state start { + pkt.extract(hdr.eth_hdr); + transition accept; + } +} + +parser egressParserImpl(packet_in buffer, out EMPTY_H a, inout Meta b, in psa_egress_parser_input_metadata_t c, in EMPTY_BRIDGE d, in EMPTY_CLONE e, in EMPTY_CLONE f) { + state start { + transition accept; + } +} + +control ingress(inout Headers h, inout Meta m, in psa_ingress_input_metadata_t istd, inout psa_ingress_output_metadata_t ostd) { + bool hasExited; + @noWarn("unused") @name(".NoAction") action NoAction_1() { + } + @name("ingress.simple_action") action simple_action() { + h.eth_hdr.dst_addr = 48w1; + hasExited = true; + } + @name("ingress.simple_table") table simple_table_0 { + key = { + h.eth_hdr.eth_type: exact @name("key") ; + } + actions = { + simple_action(); + @defaultonly NoAction_1(); + } + default_action = NoAction_1(); + } + @hidden action psadpdkgauntlet_exit_combination_23l66() { + hasExited = true; + } + @hidden action act() { + hasExited = false; + } + @hidden action psadpdkgauntlet_exit_combination_23l69() { + h.eth_hdr.dst_addr = h.eth_hdr.src_addr + h.eth_hdr.dst_addr; + } + @hidden table tbl_act { + actions = { + act(); + } + const default_action = act(); + } + @hidden table tbl_psadpdkgauntlet_exit_combination_23l66 { + actions = { + psadpdkgauntlet_exit_combination_23l66(); + } + const default_action = psadpdkgauntlet_exit_combination_23l66(); + } + @hidden table tbl_psadpdkgauntlet_exit_combination_23l69 { + actions = { + psadpdkgauntlet_exit_combination_23l69(); + } + const default_action = psadpdkgauntlet_exit_combination_23l69(); + } + apply { + tbl_act.apply(); + switch (simple_table_0.apply().action_run) { + simple_action: { + if (hasExited) { + ; + } else { + tbl_psadpdkgauntlet_exit_combination_23l66.apply(); + } + } + default: { + } + } + if (hasExited) { + ; + } else { + tbl_psadpdkgauntlet_exit_combination_23l69.apply(); + } + } +} + +control egressControlImpl(inout EMPTY_H hdr, inout Meta meta, in psa_egress_input_metadata_t x, inout psa_egress_output_metadata_t ostd) { + apply { + } +} + +control deparser(packet_out pkt, out EMPTY_CLONE clone_i2e_meta, out EMPTY_RESUB resubmit_meta, out EMPTY_BRIDGE normal_meta, inout Headers hdr, in Meta local_metadata, in psa_ingress_output_metadata_t istd) { + @hidden action psadpdkgauntlet_exit_combination_23l89() { + pkt.emit(hdr.eth_hdr); + } + @hidden table tbl_psadpdkgauntlet_exit_combination_23l89 { + actions = { + psadpdkgauntlet_exit_combination_23l89(); + } + const default_action = psadpdkgauntlet_exit_combination_23l89(); + } + apply { + tbl_psadpdkgauntlet_exit_combination_23l89.apply(); + } +} + +control egressDeparserImpl(packet_out buffer, out EMPTY_CLONE a, out EMPTY_RECIRC b, inout EMPTY_H c, in Meta d, in psa_egress_output_metadata_t e, in psa_egress_deparser_input_metadata_t f) { + apply { + } +} + +IngressPipeline(p(), ingress(), deparser()) ip; + +EgressPipeline(egressParserImpl(), egressControlImpl(), egressDeparserImpl()) ep; + +PSA_Switch(ip, PacketReplicationEngine(), ep, BufferingQueueingEngine()) main; + diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_exit_combination_23.p4 b/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_exit_combination_23.p4 new file mode 100644 index 00000000000..445a31dcbfb --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_exit_combination_23.p4 @@ -0,0 +1,92 @@ +#include +#include + +header EMPTY_H { +} + +struct EMPTY_RESUB { +} + +struct EMPTY_CLONE { +} + +struct EMPTY_BRIDGE { +} + +struct EMPTY_RECIRC { +} + +header ethernet_t { + bit<48> dst_addr; + bit<48> src_addr; + bit<16> eth_type; +} + +struct Headers { + ethernet_t eth_hdr; +} + +struct Meta { +} + +parser p(packet_in pkt, out Headers hdr, inout Meta m, in psa_ingress_parser_input_metadata_t x, in EMPTY_RESUB resub_meta, in EMPTY_RECIRC recirc_meta) { + state start { + transition parse_hdrs; + } + state parse_hdrs { + pkt.extract(hdr.eth_hdr); + transition accept; + } +} + +parser egressParserImpl(packet_in buffer, out EMPTY_H a, inout Meta b, in psa_egress_parser_input_metadata_t c, in EMPTY_BRIDGE d, in EMPTY_CLONE e, in EMPTY_CLONE f) { + state start { + transition accept; + } +} + +control ingress(inout Headers h, inout Meta m, in psa_ingress_input_metadata_t istd, inout psa_ingress_output_metadata_t ostd) { + action simple_action() { + h.eth_hdr.dst_addr = 1; + exit; + } + table simple_table { + key = { + h.eth_hdr.eth_type: exact @name("key") ; + } + actions = { + simple_action(); + } + } + apply { + switch (simple_table.apply().action_run) { + simple_action: { + exit; + } + } + h.eth_hdr.dst_addr = h.eth_hdr.src_addr + h.eth_hdr.dst_addr; + } +} + +control egressControlImpl(inout EMPTY_H hdr, inout Meta meta, in psa_egress_input_metadata_t x, inout psa_egress_output_metadata_t ostd) { + apply { + } +} + +control deparser(packet_out pkt, out EMPTY_CLONE clone_i2e_meta, out EMPTY_RESUB resubmit_meta, out EMPTY_BRIDGE normal_meta, inout Headers hdr, in Meta local_metadata, in psa_ingress_output_metadata_t istd) { + apply { + pkt.emit(hdr); + } +} + +control egressDeparserImpl(packet_out buffer, out EMPTY_CLONE a, out EMPTY_RECIRC b, inout EMPTY_H c, in Meta d, in psa_egress_output_metadata_t e, in psa_egress_deparser_input_metadata_t f) { + apply { + } +} + +IngressPipeline(p(), ingress(), deparser()) ip; + +EgressPipeline(egressParserImpl(), egressControlImpl(), egressDeparserImpl()) ep; + +PSA_Switch(ip, PacketReplicationEngine(), ep, BufferingQueueingEngine()) main; + diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_exit_combination_23.p4-error b/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_exit_combination_23.p4-error new file mode 100644 index 00000000000..e69de29bb2d diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_exit_combination_23.p4-stderr b/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_exit_combination_23.p4-stderr new file mode 100644 index 00000000000..e69de29bb2d diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_exit_combination_23.p4.bfrt.json b/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_exit_combination_23.p4.bfrt.json new file mode 100644 index 00000000000..23d6b1c04f6 --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_exit_combination_23.p4.bfrt.json @@ -0,0 +1,52 @@ +{ + "schema_version" : "1.0.0", + "tables" : [ + { + "name" : "ip.ingress.simple_table", + "id" : 39789425, + "table_type" : "MatchAction_Direct", + "size" : 1024, + "annotations" : [], + "depends_on" : [], + "has_const_default_action" : false, + "key" : [ + { + "id" : 1, + "name" : "key", + "repeated" : false, + "annotations" : [], + "mandatory" : false, + "match_type" : "Exact", + "type" : { + "type" : "bytes", + "width" : 16 + } + } + ], + "action_specs" : [ + { + "id" : 25524983, + "name" : "ingress.simple_action", + "action_scope" : "TableAndDefault", + "annotations" : [], + "data" : [] + }, + { + "id" : 21257015, + "name" : "NoAction", + "action_scope" : "DefaultOnly", + "annotations" : [ + { + "name" : "@defaultonly" + } + ], + "data" : [] + } + ], + "data" : [], + "supported_operations" : [], + "attributes" : ["EntryScope"] + } + ], + "learn_filters" : [] +} \ No newline at end of file diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_exit_combination_23.p4.entries.txt b/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_exit_combination_23.p4.entries.txt new file mode 100644 index 00000000000..e69de29bb2d diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_exit_combination_23.p4.p4info.txt b/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_exit_combination_23.p4.p4info.txt new file mode 100644 index 00000000000..b0c70246c5c --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_exit_combination_23.p4.p4info.txt @@ -0,0 +1,42 @@ +pkg_info { + arch: "psa" +} +tables { + preamble { + id: 39789425 + name: "ingress.simple_table" + alias: "simple_table" + } + match_fields { + id: 1 + name: "key" + bitwidth: 16 + match_type: EXACT + } + action_refs { + id: 25524983 + } + action_refs { + id: 21257015 + annotations: "@defaultonly" + scope: DEFAULT_ONLY + } + size: 1024 +} +actions { + preamble { + id: 21257015 + name: "NoAction" + alias: "NoAction" + annotations: "@noWarn(\"unused\")" + } +} +actions { + preamble { + id: 25524983 + name: "ingress.simple_action" + alias: "simple_action" + } +} +type_info { +} diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_exit_combination_23.p4.spec b/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_exit_combination_23.p4.spec new file mode 100644 index 00000000000..27301abad1d --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_exit_combination_23.p4.spec @@ -0,0 +1,84 @@ + +struct ethernet_t { + bit<48> dst_addr + bit<48> src_addr + bit<16> eth_type +} + +struct psa_ingress_output_metadata_t { + bit<8> class_of_service + bit<8> clone + bit<16> clone_session_id + bit<8> drop + bit<8> resubmit + bit<32> multicast_group + bit<32> egress_port +} + +struct psa_egress_output_metadata_t { + bit<8> clone + bit<16> clone_session_id + bit<8> drop +} + +struct psa_egress_deparser_input_metadata_t { + bit<32> egress_port +} + +header eth_hdr instanceof ethernet_t + +struct Meta { + bit<32> psa_ingress_input_metadata_ingress_port + bit<8> psa_ingress_output_metadata_drop + bit<32> psa_ingress_output_metadata_egress_port + bit<48> Ingress_tmp + bit<8> Ingress_hasExited +} +metadata instanceof Meta + +action NoAction args none { + return +} + +action simple_action args none { + mov h.eth_hdr.dst_addr 0x1 + mov m.Ingress_hasExited 1 + return +} + +table simple_table { + key { + h.eth_hdr.eth_type exact + } + actions { + simple_action + NoAction + } + default_action NoAction args none + size 0x10000 +} + + +apply { + rx m.psa_ingress_input_metadata_ingress_port + mov m.psa_ingress_output_metadata_drop 0x0 + extract h.eth_hdr + mov m.Ingress_hasExited 0 + table simple_table + jmpa LABEL_SWITCH simple_action + jmp LABEL_ENDSWITCH + LABEL_SWITCH : jmpneq LABEL_FALSE m.Ingress_hasExited 0x1 + jmp LABEL_ENDSWITCH + LABEL_FALSE : mov m.Ingress_hasExited 1 + LABEL_ENDSWITCH : jmpneq LABEL_FALSE_0 m.Ingress_hasExited 0x1 + jmp LABEL_END_0 + LABEL_FALSE_0 : mov m.Ingress_tmp h.eth_hdr.src_addr + add m.Ingress_tmp h.eth_hdr.dst_addr + mov h.eth_hdr.dst_addr m.Ingress_tmp + LABEL_END_0 : jmpneq LABEL_DROP m.psa_ingress_output_metadata_drop 0x0 + emit h.eth_hdr + tx m.psa_ingress_output_metadata_egress_port + LABEL_DROP : drop +} + + diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_exit_combination_9-bmv2.p4-error b/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_exit_combination_9-bmv2.p4-error new file mode 100644 index 00000000000..f0e0940c32f --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_exit_combination_9-bmv2.p4-error @@ -0,0 +1,6 @@ +psa-dpdk-gauntlet_exit_combination_9-bmv2.p4(58): [--Wwarn=ignore-prop] warning: KeyElement: constant key element + 48w1: exact @name("Vmhbwk") ; + ^^^^ +psa-dpdk-gauntlet_exit_combination_9-bmv2.p4(58): [--Wwarn=mismatch] warning: 48w1: Constant key field + 48w1: exact @name("Vmhbwk") ; + ^^^^ diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_exit_combination_9-bmv2.p4.bfrt.json b/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_exit_combination_9-bmv2.p4.bfrt.json new file mode 100644 index 00000000000..090fa787cf7 --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_exit_combination_9-bmv2.p4.bfrt.json @@ -0,0 +1,52 @@ +{ + "schema_version" : "1.0.0", + "tables" : [ + { + "name" : "ip.ingress.simple_table", + "id" : 39789425, + "table_type" : "MatchAction_Direct", + "size" : 1024, + "annotations" : [], + "depends_on" : [], + "has_const_default_action" : false, + "key" : [ + { + "id" : 1, + "name" : "Vmhbwk", + "repeated" : false, + "annotations" : [], + "mandatory" : false, + "match_type" : "Exact", + "type" : { + "type" : "bytes", + "width" : 48 + } + } + ], + "action_specs" : [ + { + "id" : 25524983, + "name" : "ingress.simple_action", + "action_scope" : "TableAndDefault", + "annotations" : [], + "data" : [] + }, + { + "id" : 21257015, + "name" : "NoAction", + "action_scope" : "DefaultOnly", + "annotations" : [ + { + "name" : "@defaultonly" + } + ], + "data" : [] + } + ], + "data" : [], + "supported_operations" : [], + "attributes" : ["EntryScope"] + } + ], + "learn_filters" : [] +} \ No newline at end of file diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_exit_combination_9-bmv2.p4.spec b/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_exit_combination_9-bmv2.p4.spec new file mode 100644 index 00000000000..b4f21e54157 --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_exit_combination_9-bmv2.p4.spec @@ -0,0 +1,80 @@ + +struct ethernet_t { + bit<48> dst_addr + bit<48> src_addr + bit<16> eth_type +} + +struct psa_ingress_output_metadata_t { + bit<8> class_of_service + bit<8> clone + bit<16> clone_session_id + bit<8> drop + bit<8> resubmit + bit<32> multicast_group + bit<32> egress_port +} + +struct psa_egress_output_metadata_t { + bit<8> clone + bit<16> clone_session_id + bit<8> drop +} + +struct psa_egress_deparser_input_metadata_t { + bit<32> egress_port +} + +header eth_hdr instanceof ethernet_t + +struct Meta { + bit<32> psa_ingress_input_metadata_ingress_port + bit<8> psa_ingress_output_metadata_drop + bit<32> psa_ingress_output_metadata_egress_port + bit<8> Ingress_hasReturned + bit<48> Ingress_key +} +metadata instanceof Meta + +action NoAction args none { + return +} + +action simple_action args none { + mov h.eth_hdr.src_addr 0x1 + return +} + +table simple_table { + key { + m.Ingress_key exact + } + actions { + simple_action + NoAction + } + default_action NoAction args none + size 0x10000 +} + + +apply { + rx m.psa_ingress_input_metadata_ingress_port + mov m.psa_ingress_output_metadata_drop 0x0 + extract h.eth_hdr + mov m.Ingress_hasReturned 0 + mov m.Ingress_key 0x1 + table simple_table + jmpa LABEL_SWITCH simple_action + jmp LABEL_ENDSWITCH + LABEL_SWITCH : mov m.Ingress_hasReturned 1 + LABEL_ENDSWITCH : jmpneq LABEL_FALSE m.Ingress_hasReturned 0x1 + jmp LABEL_END + LABEL_FALSE : mov h.eth_hdr.eth_type 0x2 + LABEL_END : jmpneq LABEL_DROP m.psa_ingress_output_metadata_drop 0x0 + emit h.eth_hdr + tx m.psa_ingress_output_metadata_egress_port + LABEL_DROP : drop +} + + diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_exit_combination_9-first.p4 b/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_exit_combination_9-first.p4 new file mode 100644 index 00000000000..78ce2daa6e7 --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_exit_combination_9-first.p4 @@ -0,0 +1,96 @@ +#include +#include + +header EMPTY_H { +} + +struct EMPTY_RESUB { +} + +struct EMPTY_CLONE { +} + +struct EMPTY_BRIDGE { +} + +struct EMPTY_RECIRC { +} + +header ethernet_t { + bit<48> dst_addr; + bit<48> src_addr; + bit<16> eth_type; +} + +struct Headers { + ethernet_t eth_hdr; +} + +struct Meta { +} + +parser p(packet_in pkt, out Headers hdr, inout Meta m, in psa_ingress_parser_input_metadata_t x, in EMPTY_RESUB resub_meta, in EMPTY_RECIRC recirc_meta) { + state start { + transition parse_hdrs; + } + state parse_hdrs { + pkt.extract(hdr.eth_hdr); + transition accept; + } +} + +parser egressParserImpl(packet_in buffer, out EMPTY_H a, inout Meta b, in psa_egress_parser_input_metadata_t c, in EMPTY_BRIDGE d, in EMPTY_CLONE e, in EMPTY_CLONE f) { + state start { + transition accept; + } +} + +control ingress(inout Headers h, inout Meta m, in psa_ingress_input_metadata_t istd, inout psa_ingress_output_metadata_t ostd) { + action simple_action() { + h.eth_hdr.src_addr = 48w1; + } + table simple_table { + key = { + 48w1: exact @name("Vmhbwk") ; + } + actions = { + simple_action(); + @defaultonly NoAction(); + } + default_action = NoAction(); + } + apply { + switch (simple_table.apply().action_run) { + simple_action: { + return; + } + default: { + } + } + h.eth_hdr.eth_type = 16w2; + exit; + } +} + +control egressControlImpl(inout EMPTY_H hdr, inout Meta meta, in psa_egress_input_metadata_t x, inout psa_egress_output_metadata_t ostd) { + apply { + } +} + +control deparser(packet_out pkt, out EMPTY_CLONE clone_i2e_meta, out EMPTY_RESUB resubmit_meta, out EMPTY_BRIDGE normal_meta, inout Headers h, in Meta local_metadata, in psa_ingress_output_metadata_t istd) { + apply { + pkt.emit(h); + } +} + +control egressDeparserImpl(packet_out buffer, out EMPTY_CLONE a, out EMPTY_RECIRC b, inout EMPTY_H c, in Meta d, in psa_egress_output_metadata_t e, in psa_egress_deparser_input_metadata_t f) { + apply { + } +} + +IngressPipeline(p(), ingress(), deparser()) ip; + +EgressPipeline(egressParserImpl(), egressControlImpl(), egressDeparserImpl()) ep; + +PSA_Switch(ip, PacketReplicationEngine(), ep, BufferingQueueingEngine()) main; + diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_exit_combination_9-frontend.p4 b/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_exit_combination_9-frontend.p4 new file mode 100644 index 00000000000..7a45435da14 --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_exit_combination_9-frontend.p4 @@ -0,0 +1,101 @@ +#include +#include + +header EMPTY_H { +} + +struct EMPTY_RESUB { +} + +struct EMPTY_CLONE { +} + +struct EMPTY_BRIDGE { +} + +struct EMPTY_RECIRC { +} + +header ethernet_t { + bit<48> dst_addr; + bit<48> src_addr; + bit<16> eth_type; +} + +struct Headers { + ethernet_t eth_hdr; +} + +struct Meta { +} + +parser p(packet_in pkt, out Headers hdr, inout Meta m, in psa_ingress_parser_input_metadata_t x, in EMPTY_RESUB resub_meta, in EMPTY_RECIRC recirc_meta) { + state start { + pkt.extract(hdr.eth_hdr); + transition accept; + } +} + +parser egressParserImpl(packet_in buffer, out EMPTY_H a, inout Meta b, in psa_egress_parser_input_metadata_t c, in EMPTY_BRIDGE d, in EMPTY_CLONE e, in EMPTY_CLONE f) { + state start { + transition accept; + } +} + +control ingress(inout Headers h, inout Meta m, in psa_ingress_input_metadata_t istd, inout psa_ingress_output_metadata_t ostd) { + @name("ingress.hasReturned") bool hasReturned; + @noWarn("unused") @name(".NoAction") action NoAction_1() { + } + @name("ingress.simple_action") action simple_action() { + h.eth_hdr.src_addr = 48w1; + } + @name("ingress.simple_table") table simple_table_0 { + key = { + 48w1: exact @name("Vmhbwk") ; + } + actions = { + simple_action(); + @defaultonly NoAction_1(); + } + default_action = NoAction_1(); + } + apply { + hasReturned = false; + switch (simple_table_0.apply().action_run) { + simple_action: { + hasReturned = true; + } + default: { + } + } + if (hasReturned) { + ; + } else { + h.eth_hdr.eth_type = 16w2; + exit; + } + } +} + +control egressControlImpl(inout EMPTY_H hdr, inout Meta meta, in psa_egress_input_metadata_t x, inout psa_egress_output_metadata_t ostd) { + apply { + } +} + +control deparser(packet_out pkt, out EMPTY_CLONE clone_i2e_meta, out EMPTY_RESUB resubmit_meta, out EMPTY_BRIDGE normal_meta, inout Headers h, in Meta local_metadata, in psa_ingress_output_metadata_t istd) { + apply { + pkt.emit(h); + } +} + +control egressDeparserImpl(packet_out buffer, out EMPTY_CLONE a, out EMPTY_RECIRC b, inout EMPTY_H c, in Meta d, in psa_egress_output_metadata_t e, in psa_egress_deparser_input_metadata_t f) { + apply { + } +} + +IngressPipeline(p(), ingress(), deparser()) ip; + +EgressPipeline(egressParserImpl(), egressControlImpl(), egressDeparserImpl()) ep; + +PSA_Switch(ip, PacketReplicationEngine(), ep, BufferingQueueingEngine()) main; + diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_exit_combination_9-midend.p4 b/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_exit_combination_9-midend.p4 new file mode 100644 index 00000000000..c21986713bf --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_exit_combination_9-midend.p4 @@ -0,0 +1,141 @@ +#include +#include + +header EMPTY_H { +} + +struct EMPTY_RESUB { +} + +struct EMPTY_CLONE { +} + +struct EMPTY_BRIDGE { +} + +struct EMPTY_RECIRC { +} + +header ethernet_t { + bit<48> dst_addr; + bit<48> src_addr; + bit<16> eth_type; +} + +struct Headers { + ethernet_t eth_hdr; +} + +struct Meta { +} + +parser p(packet_in pkt, out Headers hdr, inout Meta m, in psa_ingress_parser_input_metadata_t x, in EMPTY_RESUB resub_meta, in EMPTY_RECIRC recirc_meta) { + state start { + pkt.extract(hdr.eth_hdr); + transition accept; + } +} + +parser egressParserImpl(packet_in buffer, out EMPTY_H a, inout Meta b, in psa_egress_parser_input_metadata_t c, in EMPTY_BRIDGE d, in EMPTY_CLONE e, in EMPTY_CLONE f) { + state start { + transition accept; + } +} + +control ingress(inout Headers h, inout Meta m, in psa_ingress_input_metadata_t istd, inout psa_ingress_output_metadata_t ostd) { + bool hasExited; + @name("ingress.hasReturned") bool hasReturned; + bit<48> key_0; + @noWarn("unused") @name(".NoAction") action NoAction_1() { + } + @name("ingress.simple_action") action simple_action() { + h.eth_hdr.src_addr = 48w1; + } + @name("ingress.simple_table") table simple_table_0 { + key = { + key_0: exact @name("Vmhbwk") ; + } + actions = { + simple_action(); + @defaultonly NoAction_1(); + } + default_action = NoAction_1(); + } + @hidden action psadpdkgauntlet_exit_combination_9l68() { + hasReturned = true; + } + @hidden action psadpdkgauntlet_exit_combination_9l58() { + hasExited = false; + hasReturned = false; + key_0 = 48w1; + } + @hidden action psadpdkgauntlet_exit_combination_9l74() { + h.eth_hdr.eth_type = 16w2; + hasExited = true; + } + @hidden table tbl_psadpdkgauntlet_exit_combination_9l58 { + actions = { + psadpdkgauntlet_exit_combination_9l58(); + } + const default_action = psadpdkgauntlet_exit_combination_9l58(); + } + @hidden table tbl_psadpdkgauntlet_exit_combination_9l68 { + actions = { + psadpdkgauntlet_exit_combination_9l68(); + } + const default_action = psadpdkgauntlet_exit_combination_9l68(); + } + @hidden table tbl_psadpdkgauntlet_exit_combination_9l74 { + actions = { + psadpdkgauntlet_exit_combination_9l74(); + } + const default_action = psadpdkgauntlet_exit_combination_9l74(); + } + apply { + tbl_psadpdkgauntlet_exit_combination_9l58.apply(); + switch (simple_table_0.apply().action_run) { + simple_action: { + tbl_psadpdkgauntlet_exit_combination_9l68.apply(); + } + default: { + } + } + if (hasReturned) { + ; + } else { + tbl_psadpdkgauntlet_exit_combination_9l74.apply(); + } + } +} + +control egressControlImpl(inout EMPTY_H hdr, inout Meta meta, in psa_egress_input_metadata_t x, inout psa_egress_output_metadata_t ostd) { + apply { + } +} + +control deparser(packet_out pkt, out EMPTY_CLONE clone_i2e_meta, out EMPTY_RESUB resubmit_meta, out EMPTY_BRIDGE normal_meta, inout Headers h, in Meta local_metadata, in psa_ingress_output_metadata_t istd) { + @hidden action psadpdkgauntlet_exit_combination_9l97() { + pkt.emit(h.eth_hdr); + } + @hidden table tbl_psadpdkgauntlet_exit_combination_9l97 { + actions = { + psadpdkgauntlet_exit_combination_9l97(); + } + const default_action = psadpdkgauntlet_exit_combination_9l97(); + } + apply { + tbl_psadpdkgauntlet_exit_combination_9l97.apply(); + } +} + +control egressDeparserImpl(packet_out buffer, out EMPTY_CLONE a, out EMPTY_RECIRC b, inout EMPTY_H c, in Meta d, in psa_egress_output_metadata_t e, in psa_egress_deparser_input_metadata_t f) { + apply { + } +} + +IngressPipeline(p(), ingress(), deparser()) ip; + +EgressPipeline(egressParserImpl(), egressControlImpl(), egressDeparserImpl()) ep; + +PSA_Switch(ip, PacketReplicationEngine(), ep, BufferingQueueingEngine()) main; + diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_exit_combination_9.p4 b/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_exit_combination_9.p4 new file mode 100644 index 00000000000..6881c085df4 --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_exit_combination_9.p4 @@ -0,0 +1,96 @@ +#include +#include + +header EMPTY_H { +} + +struct EMPTY_RESUB { +} + +struct EMPTY_CLONE { +} + +struct EMPTY_BRIDGE { +} + +struct EMPTY_RECIRC { +} + +header ethernet_t { + bit<48> dst_addr; + bit<48> src_addr; + bit<16> eth_type; +} + +struct Headers { + ethernet_t eth_hdr; +} + +struct Meta { +} + +parser p(packet_in pkt, out Headers hdr, inout Meta m, in psa_ingress_parser_input_metadata_t x, in EMPTY_RESUB resub_meta, in EMPTY_RECIRC recirc_meta) { + state start { + transition parse_hdrs; + } + state parse_hdrs { + pkt.extract(hdr.eth_hdr); + transition accept; + } +} + +parser egressParserImpl(packet_in buffer, out EMPTY_H a, inout Meta b, in psa_egress_parser_input_metadata_t c, in EMPTY_BRIDGE d, in EMPTY_CLONE e, in EMPTY_CLONE f) { + state start { + transition accept; + } +} + +control ingress(inout Headers h, inout Meta m, in psa_ingress_input_metadata_t istd, inout psa_ingress_output_metadata_t ostd) { + action simple_action() { + h.eth_hdr.src_addr = 1; + } + table simple_table { + key = { + 48w1: exact @name("Vmhbwk") ; + } + actions = { + simple_action(); + } + } + apply { + switch (simple_table.apply().action_run) { + simple_action: { + if (true) { + return; + } else { + h.eth_hdr.eth_type = 16w1; + } + } + } + h.eth_hdr.eth_type = 16w2; + exit; + } +} + +control egressControlImpl(inout EMPTY_H hdr, inout Meta meta, in psa_egress_input_metadata_t x, inout psa_egress_output_metadata_t ostd) { + apply { + } +} + +control deparser(packet_out pkt, out EMPTY_CLONE clone_i2e_meta, out EMPTY_RESUB resubmit_meta, out EMPTY_BRIDGE normal_meta, inout Headers h, in Meta local_metadata, in psa_ingress_output_metadata_t istd) { + apply { + pkt.emit(h); + } +} + +control egressDeparserImpl(packet_out buffer, out EMPTY_CLONE a, out EMPTY_RECIRC b, inout EMPTY_H c, in Meta d, in psa_egress_output_metadata_t e, in psa_egress_deparser_input_metadata_t f) { + apply { + } +} + +IngressPipeline(p(), ingress(), deparser()) ip; + +EgressPipeline(egressParserImpl(), egressControlImpl(), egressDeparserImpl()) ep; + +PSA_Switch(ip, PacketReplicationEngine(), ep, BufferingQueueingEngine()) main; + diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_exit_combination_9.p4-error b/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_exit_combination_9.p4-error new file mode 100644 index 00000000000..e165ce32d48 --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_exit_combination_9.p4-error @@ -0,0 +1,6 @@ +psa-dpdk-gauntlet_exit_combination_9.p4(58): [--Wwarn=ignore-prop] warning: KeyElement: constant key element + 48w1: exact @name("Vmhbwk") ; + ^^^^ +psa-dpdk-gauntlet_exit_combination_9.p4(58): [--Wwarn=mismatch] warning: 48w1: Constant key field + 48w1: exact @name("Vmhbwk") ; + ^^^^ diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_exit_combination_9.p4-stderr b/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_exit_combination_9.p4-stderr new file mode 100644 index 00000000000..e165ce32d48 --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_exit_combination_9.p4-stderr @@ -0,0 +1,6 @@ +psa-dpdk-gauntlet_exit_combination_9.p4(58): [--Wwarn=ignore-prop] warning: KeyElement: constant key element + 48w1: exact @name("Vmhbwk") ; + ^^^^ +psa-dpdk-gauntlet_exit_combination_9.p4(58): [--Wwarn=mismatch] warning: 48w1: Constant key field + 48w1: exact @name("Vmhbwk") ; + ^^^^ diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_exit_combination_9.p4.bfrt.json b/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_exit_combination_9.p4.bfrt.json new file mode 100644 index 00000000000..090fa787cf7 --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_exit_combination_9.p4.bfrt.json @@ -0,0 +1,52 @@ +{ + "schema_version" : "1.0.0", + "tables" : [ + { + "name" : "ip.ingress.simple_table", + "id" : 39789425, + "table_type" : "MatchAction_Direct", + "size" : 1024, + "annotations" : [], + "depends_on" : [], + "has_const_default_action" : false, + "key" : [ + { + "id" : 1, + "name" : "Vmhbwk", + "repeated" : false, + "annotations" : [], + "mandatory" : false, + "match_type" : "Exact", + "type" : { + "type" : "bytes", + "width" : 48 + } + } + ], + "action_specs" : [ + { + "id" : 25524983, + "name" : "ingress.simple_action", + "action_scope" : "TableAndDefault", + "annotations" : [], + "data" : [] + }, + { + "id" : 21257015, + "name" : "NoAction", + "action_scope" : "DefaultOnly", + "annotations" : [ + { + "name" : "@defaultonly" + } + ], + "data" : [] + } + ], + "data" : [], + "supported_operations" : [], + "attributes" : ["EntryScope"] + } + ], + "learn_filters" : [] +} \ No newline at end of file diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_exit_combination_9.p4.entries.txt b/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_exit_combination_9.p4.entries.txt new file mode 100644 index 00000000000..e69de29bb2d diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_exit_combination_9.p4.p4info.txt b/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_exit_combination_9.p4.p4info.txt new file mode 100644 index 00000000000..8a6d0b06827 --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_exit_combination_9.p4.p4info.txt @@ -0,0 +1,42 @@ +pkg_info { + arch: "psa" +} +tables { + preamble { + id: 39789425 + name: "ingress.simple_table" + alias: "simple_table" + } + match_fields { + id: 1 + name: "Vmhbwk" + bitwidth: 48 + match_type: EXACT + } + action_refs { + id: 25524983 + } + action_refs { + id: 21257015 + annotations: "@defaultonly" + scope: DEFAULT_ONLY + } + size: 1024 +} +actions { + preamble { + id: 21257015 + name: "NoAction" + alias: "NoAction" + annotations: "@noWarn(\"unused\")" + } +} +actions { + preamble { + id: 25524983 + name: "ingress.simple_action" + alias: "simple_action" + } +} +type_info { +} diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_exit_combination_9.p4.spec b/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_exit_combination_9.p4.spec new file mode 100644 index 00000000000..b4f21e54157 --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_exit_combination_9.p4.spec @@ -0,0 +1,80 @@ + +struct ethernet_t { + bit<48> dst_addr + bit<48> src_addr + bit<16> eth_type +} + +struct psa_ingress_output_metadata_t { + bit<8> class_of_service + bit<8> clone + bit<16> clone_session_id + bit<8> drop + bit<8> resubmit + bit<32> multicast_group + bit<32> egress_port +} + +struct psa_egress_output_metadata_t { + bit<8> clone + bit<16> clone_session_id + bit<8> drop +} + +struct psa_egress_deparser_input_metadata_t { + bit<32> egress_port +} + +header eth_hdr instanceof ethernet_t + +struct Meta { + bit<32> psa_ingress_input_metadata_ingress_port + bit<8> psa_ingress_output_metadata_drop + bit<32> psa_ingress_output_metadata_egress_port + bit<8> Ingress_hasReturned + bit<48> Ingress_key +} +metadata instanceof Meta + +action NoAction args none { + return +} + +action simple_action args none { + mov h.eth_hdr.src_addr 0x1 + return +} + +table simple_table { + key { + m.Ingress_key exact + } + actions { + simple_action + NoAction + } + default_action NoAction args none + size 0x10000 +} + + +apply { + rx m.psa_ingress_input_metadata_ingress_port + mov m.psa_ingress_output_metadata_drop 0x0 + extract h.eth_hdr + mov m.Ingress_hasReturned 0 + mov m.Ingress_key 0x1 + table simple_table + jmpa LABEL_SWITCH simple_action + jmp LABEL_ENDSWITCH + LABEL_SWITCH : mov m.Ingress_hasReturned 1 + LABEL_ENDSWITCH : jmpneq LABEL_FALSE m.Ingress_hasReturned 0x1 + jmp LABEL_END + LABEL_FALSE : mov h.eth_hdr.eth_type 0x2 + LABEL_END : jmpneq LABEL_DROP m.psa_ingress_output_metadata_drop 0x0 + emit h.eth_hdr + tx m.psa_ingress_output_metadata_egress_port + LABEL_DROP : drop +} + + diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_function_if_hdr_return-bmv2.p4-error b/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_function_if_hdr_return-bmv2.p4-error new file mode 100644 index 00000000000..e69de29bb2d diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_function_if_hdr_return-bmv2.p4.bfrt.json b/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_function_if_hdr_return-bmv2.p4.bfrt.json new file mode 100644 index 00000000000..b6d66a630db --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_function_if_hdr_return-bmv2.p4.bfrt.json @@ -0,0 +1,5 @@ +{ + "schema_version" : "1.0.0", + "tables" : [], + "learn_filters" : [] +} \ No newline at end of file diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_function_if_hdr_return-bmv2.p4.spec b/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_function_if_hdr_return-bmv2.p4.spec new file mode 100644 index 00000000000..74c3a72510c --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_function_if_hdr_return-bmv2.p4.spec @@ -0,0 +1,52 @@ + +struct ethernet_t { + bit<48> dst_addr + bit<48> src_addr + bit<16> eth_type +} + +struct psa_ingress_output_metadata_t { + bit<8> class_of_service + bit<8> clone + bit<16> clone_session_id + bit<8> drop + bit<8> resubmit + bit<32> multicast_group + bit<32> egress_port +} + +struct psa_egress_output_metadata_t { + bit<8> clone + bit<16> clone_session_id + bit<8> drop +} + +struct psa_egress_deparser_input_metadata_t { + bit<32> egress_port +} + +header eth_hdr instanceof ethernet_t +header Ingress_retval instanceof ethernet_t + +struct Meta { + bit<32> psa_ingress_input_metadata_ingress_port + bit<8> psa_ingress_output_metadata_drop + bit<32> psa_ingress_output_metadata_egress_port +} +metadata instanceof Meta + +apply { + rx m.psa_ingress_input_metadata_ingress_port + mov m.psa_ingress_output_metadata_drop 0x0 + extract h.eth_hdr + validate h.Ingress_retval + mov h.Ingress_retval.dst_addr 0x1 + mov h.Ingress_retval.src_addr 0x1 + mov h.Ingress_retval.eth_type 0x1 + jmpneq LABEL_DROP m.psa_ingress_output_metadata_drop 0x0 + emit h.eth_hdr + tx m.psa_ingress_output_metadata_egress_port + LABEL_DROP : drop +} + + diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_function_if_hdr_return-first.p4 b/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_function_if_hdr_return-first.p4 new file mode 100644 index 00000000000..633948eada5 --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_function_if_hdr_return-first.p4 @@ -0,0 +1,79 @@ +#include +#include + +header EMPTY_H { +} + +struct EMPTY_RESUB { +} + +struct EMPTY_CLONE { +} + +struct EMPTY_BRIDGE { +} + +struct EMPTY_RECIRC { +} + +header ethernet_t { + bit<48> dst_addr; + bit<48> src_addr; + bit<16> eth_type; +} + +struct Headers { + ethernet_t eth_hdr; +} + +struct Meta { +} + +ethernet_t do_function() { + return (ethernet_t){dst_addr = 48w1,src_addr = 48w1,eth_type = 16w1}; + return (ethernet_t){dst_addr = 48w2,src_addr = 48w2,eth_type = 16w2}; +} +parser p(packet_in pkt, out Headers hdr, inout Meta m, in psa_ingress_parser_input_metadata_t x, in EMPTY_RESUB resub_meta, in EMPTY_RECIRC recirc_meta) { + state start { + transition parse_hdrs; + } + state parse_hdrs { + pkt.extract(hdr.eth_hdr); + transition accept; + } +} + +parser egressParserImpl(packet_in buffer, out EMPTY_H a, inout Meta b, in psa_egress_parser_input_metadata_t c, in EMPTY_BRIDGE d, in EMPTY_CLONE e, in EMPTY_CLONE f) { + state start { + transition accept; + } +} + +control ingress(inout Headers h, inout Meta m, in psa_ingress_input_metadata_t istd, inout psa_ingress_output_metadata_t ostd) { + apply { + h.eth_hdr = do_function(); + } +} + +control egressControlImpl(inout EMPTY_H hdr, inout Meta meta, in psa_egress_input_metadata_t x, inout psa_egress_output_metadata_t ostd) { + apply { + } +} + +control deparser(packet_out pkt, out EMPTY_CLONE clone_i2e_meta, out EMPTY_RESUB resubmit_meta, out EMPTY_BRIDGE normal_meta, inout Headers h, in Meta local_metadata, in psa_ingress_output_metadata_t istd) { + apply { + pkt.emit(h); + } +} + +control egressDeparserImpl(packet_out buffer, out EMPTY_CLONE a, out EMPTY_RECIRC b, inout EMPTY_H c, in Meta d, in psa_egress_output_metadata_t e, in psa_egress_deparser_input_metadata_t f) { + apply { + } +} + +IngressPipeline(p(), ingress(), deparser()) ip; + +EgressPipeline(egressParserImpl(), egressControlImpl(), egressDeparserImpl()) ep; + +PSA_Switch(ip, PacketReplicationEngine(), ep, BufferingQueueingEngine()) main; + diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_function_if_hdr_return-frontend.p4 b/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_function_if_hdr_return-frontend.p4 new file mode 100644 index 00000000000..bf92caa044a --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_function_if_hdr_return-frontend.p4 @@ -0,0 +1,78 @@ +#include +#include + +header EMPTY_H { +} + +struct EMPTY_RESUB { +} + +struct EMPTY_CLONE { +} + +struct EMPTY_BRIDGE { +} + +struct EMPTY_RECIRC { +} + +header ethernet_t { + bit<48> dst_addr; + bit<48> src_addr; + bit<16> eth_type; +} + +struct Headers { + ethernet_t eth_hdr; +} + +struct Meta { +} + +parser p(packet_in pkt, out Headers hdr, inout Meta m, in psa_ingress_parser_input_metadata_t x, in EMPTY_RESUB resub_meta, in EMPTY_RECIRC recirc_meta) { + state start { + pkt.extract(hdr.eth_hdr); + transition accept; + } +} + +parser egressParserImpl(packet_in buffer, out EMPTY_H a, inout Meta b, in psa_egress_parser_input_metadata_t c, in EMPTY_BRIDGE d, in EMPTY_CLONE e, in EMPTY_CLONE f) { + state start { + transition accept; + } +} + +control ingress(inout Headers h, inout Meta m, in psa_ingress_input_metadata_t istd, inout psa_ingress_output_metadata_t ostd) { + @name("ingress.hasReturned") bool hasReturned; + @name("ingress.retval") ethernet_t retval; + apply { + hasReturned = false; + hasReturned = true; + retval.setValid(); + retval = (ethernet_t){dst_addr = 48w1,src_addr = 48w1,eth_type = 16w1}; + h.eth_hdr = retval; + } +} + +control egressControlImpl(inout EMPTY_H hdr, inout Meta meta, in psa_egress_input_metadata_t x, inout psa_egress_output_metadata_t ostd) { + apply { + } +} + +control deparser(packet_out pkt, out EMPTY_CLONE clone_i2e_meta, out EMPTY_RESUB resubmit_meta, out EMPTY_BRIDGE normal_meta, inout Headers h, in Meta local_metadata, in psa_ingress_output_metadata_t istd) { + apply { + pkt.emit(h); + } +} + +control egressDeparserImpl(packet_out buffer, out EMPTY_CLONE a, out EMPTY_RECIRC b, inout EMPTY_H c, in Meta d, in psa_egress_output_metadata_t e, in psa_egress_deparser_input_metadata_t f) { + apply { + } +} + +IngressPipeline(p(), ingress(), deparser()) ip; + +EgressPipeline(egressParserImpl(), egressControlImpl(), egressDeparserImpl()) ep; + +PSA_Switch(ip, PacketReplicationEngine(), ep, BufferingQueueingEngine()) main; + diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_function_if_hdr_return-midend.p4 b/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_function_if_hdr_return-midend.p4 new file mode 100644 index 00000000000..9004c257400 --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_function_if_hdr_return-midend.p4 @@ -0,0 +1,95 @@ +#include +#include + +header EMPTY_H { +} + +struct EMPTY_RESUB { +} + +struct EMPTY_CLONE { +} + +struct EMPTY_BRIDGE { +} + +struct EMPTY_RECIRC { +} + +header ethernet_t { + bit<48> dst_addr; + bit<48> src_addr; + bit<16> eth_type; +} + +struct Headers { + ethernet_t eth_hdr; +} + +struct Meta { +} + +parser p(packet_in pkt, out Headers hdr, inout Meta m, in psa_ingress_parser_input_metadata_t x, in EMPTY_RESUB resub_meta, in EMPTY_RECIRC recirc_meta) { + state start { + pkt.extract(hdr.eth_hdr); + transition accept; + } +} + +parser egressParserImpl(packet_in buffer, out EMPTY_H a, inout Meta b, in psa_egress_parser_input_metadata_t c, in EMPTY_BRIDGE d, in EMPTY_CLONE e, in EMPTY_CLONE f) { + state start { + transition accept; + } +} + +control ingress(inout Headers h, inout Meta m, in psa_ingress_input_metadata_t istd, inout psa_ingress_output_metadata_t ostd) { + @name("ingress.retval") ethernet_t retval; + @hidden action psadpdkgauntlet_function_if_hdr_return27() { + retval.setValid(); + retval.dst_addr = 48w1; + retval.src_addr = 48w1; + retval.eth_type = 16w1; + h.eth_hdr = retval; + } + @hidden table tbl_psadpdkgauntlet_function_if_hdr_return27 { + actions = { + psadpdkgauntlet_function_if_hdr_return27(); + } + const default_action = psadpdkgauntlet_function_if_hdr_return27(); + } + apply { + tbl_psadpdkgauntlet_function_if_hdr_return27.apply(); + } +} + +control egressControlImpl(inout EMPTY_H hdr, inout Meta meta, in psa_egress_input_metadata_t x, inout psa_egress_output_metadata_t ostd) { + apply { + } +} + +control deparser(packet_out pkt, out EMPTY_CLONE clone_i2e_meta, out EMPTY_RESUB resubmit_meta, out EMPTY_BRIDGE normal_meta, inout Headers h, in Meta local_metadata, in psa_ingress_output_metadata_t istd) { + @hidden action psadpdkgauntlet_function_if_hdr_return82() { + pkt.emit(h.eth_hdr); + } + @hidden table tbl_psadpdkgauntlet_function_if_hdr_return82 { + actions = { + psadpdkgauntlet_function_if_hdr_return82(); + } + const default_action = psadpdkgauntlet_function_if_hdr_return82(); + } + apply { + tbl_psadpdkgauntlet_function_if_hdr_return82.apply(); + } +} + +control egressDeparserImpl(packet_out buffer, out EMPTY_CLONE a, out EMPTY_RECIRC b, inout EMPTY_H c, in Meta d, in psa_egress_output_metadata_t e, in psa_egress_deparser_input_metadata_t f) { + apply { + } +} + +IngressPipeline(p(), ingress(), deparser()) ip; + +EgressPipeline(egressParserImpl(), egressControlImpl(), egressDeparserImpl()) ep; + +PSA_Switch(ip, PacketReplicationEngine(), ep, BufferingQueueingEngine()) main; + diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_function_if_hdr_return.p4 b/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_function_if_hdr_return.p4 new file mode 100644 index 00000000000..843c5221141 --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_function_if_hdr_return.p4 @@ -0,0 +1,83 @@ +#include +#include + +header EMPTY_H { +} + +struct EMPTY_RESUB { +} + +struct EMPTY_CLONE { +} + +struct EMPTY_BRIDGE { +} + +struct EMPTY_RECIRC { +} + +header ethernet_t { + bit<48> dst_addr; + bit<48> src_addr; + bit<16> eth_type; +} + +struct Headers { + ethernet_t eth_hdr; +} + +struct Meta { +} + +ethernet_t do_function() { + if (true) { + if (true) { + return { 1, 1, 1 }; + } + } + return { 2, 2, 2 }; +} +parser p(packet_in pkt, out Headers hdr, inout Meta m, in psa_ingress_parser_input_metadata_t x, in EMPTY_RESUB resub_meta, in EMPTY_RECIRC recirc_meta) { + state start { + transition parse_hdrs; + } + state parse_hdrs { + pkt.extract(hdr.eth_hdr); + transition accept; + } +} + +parser egressParserImpl(packet_in buffer, out EMPTY_H a, inout Meta b, in psa_egress_parser_input_metadata_t c, in EMPTY_BRIDGE d, in EMPTY_CLONE e, in EMPTY_CLONE f) { + state start { + transition accept; + } +} + +control ingress(inout Headers h, inout Meta m, in psa_ingress_input_metadata_t istd, inout psa_ingress_output_metadata_t ostd) { + apply { + h.eth_hdr = do_function(); + } +} + +control egressControlImpl(inout EMPTY_H hdr, inout Meta meta, in psa_egress_input_metadata_t x, inout psa_egress_output_metadata_t ostd) { + apply { + } +} + +control deparser(packet_out pkt, out EMPTY_CLONE clone_i2e_meta, out EMPTY_RESUB resubmit_meta, out EMPTY_BRIDGE normal_meta, inout Headers h, in Meta local_metadata, in psa_ingress_output_metadata_t istd) { + apply { + pkt.emit(h); + } +} + +control egressDeparserImpl(packet_out buffer, out EMPTY_CLONE a, out EMPTY_RECIRC b, inout EMPTY_H c, in Meta d, in psa_egress_output_metadata_t e, in psa_egress_deparser_input_metadata_t f) { + apply { + } +} + +IngressPipeline(p(), ingress(), deparser()) ip; + +EgressPipeline(egressParserImpl(), egressControlImpl(), egressDeparserImpl()) ep; + +PSA_Switch(ip, PacketReplicationEngine(), ep, BufferingQueueingEngine()) main; + diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_function_if_hdr_return.p4-error b/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_function_if_hdr_return.p4-error new file mode 100644 index 00000000000..e69de29bb2d diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_function_if_hdr_return.p4-stderr b/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_function_if_hdr_return.p4-stderr new file mode 100644 index 00000000000..e69de29bb2d diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_function_if_hdr_return.p4.bfrt.json b/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_function_if_hdr_return.p4.bfrt.json new file mode 100644 index 00000000000..b6d66a630db --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_function_if_hdr_return.p4.bfrt.json @@ -0,0 +1,5 @@ +{ + "schema_version" : "1.0.0", + "tables" : [], + "learn_filters" : [] +} \ No newline at end of file diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_function_if_hdr_return.p4.entries.txt b/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_function_if_hdr_return.p4.entries.txt new file mode 100644 index 00000000000..e69de29bb2d diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_function_if_hdr_return.p4.p4info.txt b/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_function_if_hdr_return.p4.p4info.txt new file mode 100644 index 00000000000..77612386454 --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_function_if_hdr_return.p4.p4info.txt @@ -0,0 +1,3 @@ +pkg_info { + arch: "psa" +} diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_function_if_hdr_return.p4.spec b/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_function_if_hdr_return.p4.spec new file mode 100644 index 00000000000..74c3a72510c --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_function_if_hdr_return.p4.spec @@ -0,0 +1,52 @@ + +struct ethernet_t { + bit<48> dst_addr + bit<48> src_addr + bit<16> eth_type +} + +struct psa_ingress_output_metadata_t { + bit<8> class_of_service + bit<8> clone + bit<16> clone_session_id + bit<8> drop + bit<8> resubmit + bit<32> multicast_group + bit<32> egress_port +} + +struct psa_egress_output_metadata_t { + bit<8> clone + bit<16> clone_session_id + bit<8> drop +} + +struct psa_egress_deparser_input_metadata_t { + bit<32> egress_port +} + +header eth_hdr instanceof ethernet_t +header Ingress_retval instanceof ethernet_t + +struct Meta { + bit<32> psa_ingress_input_metadata_ingress_port + bit<8> psa_ingress_output_metadata_drop + bit<32> psa_ingress_output_metadata_egress_port +} +metadata instanceof Meta + +apply { + rx m.psa_ingress_input_metadata_ingress_port + mov m.psa_ingress_output_metadata_drop 0x0 + extract h.eth_hdr + validate h.Ingress_retval + mov h.Ingress_retval.dst_addr 0x1 + mov h.Ingress_retval.src_addr 0x1 + mov h.Ingress_retval.eth_type 0x1 + jmpneq LABEL_DROP m.psa_ingress_output_metadata_drop 0x0 + emit h.eth_hdr + tx m.psa_ingress_output_metadata_egress_port + LABEL_DROP : drop +} + + diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_function_return_cast-bmv2.p4-error b/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_function_return_cast-bmv2.p4-error new file mode 100644 index 00000000000..1a666f8a1fa --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_function_return_cast-bmv2.p4-error @@ -0,0 +1,3 @@ +psa-dpdk-gauntlet_function_return_cast-bmv2.p4(24): [--Wwarn=mismatch] warning: -8w1: negative value with unsigned type + return -1; + ^ diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_function_return_cast-bmv2.p4.bfrt.json b/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_function_return_cast-bmv2.p4.bfrt.json new file mode 100644 index 00000000000..b6d66a630db --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_function_return_cast-bmv2.p4.bfrt.json @@ -0,0 +1,5 @@ +{ + "schema_version" : "1.0.0", + "tables" : [], + "learn_filters" : [] +} \ No newline at end of file diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_function_return_cast-bmv2.p4.spec b/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_function_return_cast-bmv2.p4.spec new file mode 100644 index 00000000000..25648375d98 --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_function_return_cast-bmv2.p4.spec @@ -0,0 +1,48 @@ + +struct ethernet_t { + bit<48> dst_addr + bit<48> src_addr + bit<16> eth_type +} + +struct psa_ingress_output_metadata_t { + bit<8> class_of_service + bit<8> clone + bit<16> clone_session_id + bit<8> drop + bit<8> resubmit + bit<32> multicast_group + bit<32> egress_port +} + +struct psa_egress_output_metadata_t { + bit<8> clone + bit<16> clone_session_id + bit<8> drop +} + +struct psa_egress_deparser_input_metadata_t { + bit<32> egress_port +} + +header eth_hdr instanceof ethernet_t + +struct Meta { + bit<32> psa_ingress_input_metadata_ingress_port + bit<8> psa_ingress_output_metadata_drop + bit<32> psa_ingress_output_metadata_egress_port +} +metadata instanceof Meta + +apply { + rx m.psa_ingress_input_metadata_ingress_port + mov m.psa_ingress_output_metadata_drop 0x0 + extract h.eth_hdr + mov h.eth_hdr.eth_type 0xff + jmpneq LABEL_DROP m.psa_ingress_output_metadata_drop 0x0 + emit h.eth_hdr + tx m.psa_ingress_output_metadata_egress_port + LABEL_DROP : drop +} + + diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_function_return_cast-first.p4 b/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_function_return_cast-first.p4 new file mode 100644 index 00000000000..6329a4ba561 --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_function_return_cast-first.p4 @@ -0,0 +1,78 @@ +#include +#include + +header EMPTY_H { +} + +struct EMPTY_RESUB { +} + +struct EMPTY_CLONE { +} + +struct EMPTY_BRIDGE { +} + +struct EMPTY_RECIRC { +} + +header ethernet_t { + bit<48> dst_addr; + bit<48> src_addr; + bit<16> eth_type; +} + +struct Headers { + ethernet_t eth_hdr; +} + +struct Meta { +} + +bit<8> do_function() { + return 8w255; +} +parser p(packet_in pkt, out Headers hdr, inout Meta m, in psa_ingress_parser_input_metadata_t x, in EMPTY_RESUB resub_meta, in EMPTY_RECIRC recirc_meta) { + state start { + transition parse_hdrs; + } + state parse_hdrs { + pkt.extract(hdr.eth_hdr); + transition accept; + } +} + +parser egressParserImpl(packet_in buffer, out EMPTY_H a, inout Meta b, in psa_egress_parser_input_metadata_t c, in EMPTY_BRIDGE d, in EMPTY_CLONE e, in EMPTY_CLONE f) { + state start { + transition accept; + } +} + +control ingress(inout Headers h, inout Meta m, in psa_ingress_input_metadata_t istd, inout psa_ingress_output_metadata_t ostd) { + apply { + h.eth_hdr.eth_type = (bit<16>)do_function(); + } +} + +control egressControlImpl(inout EMPTY_H hdr, inout Meta meta, in psa_egress_input_metadata_t x, inout psa_egress_output_metadata_t ostd) { + apply { + } +} + +control deparser(packet_out pkt, out EMPTY_CLONE clone_i2e_meta, out EMPTY_RESUB resubmit_meta, out EMPTY_BRIDGE normal_meta, inout Headers h, in Meta local_metadata, in psa_ingress_output_metadata_t istd) { + apply { + pkt.emit(h); + } +} + +control egressDeparserImpl(packet_out buffer, out EMPTY_CLONE a, out EMPTY_RECIRC b, inout EMPTY_H c, in Meta d, in psa_egress_output_metadata_t e, in psa_egress_deparser_input_metadata_t f) { + apply { + } +} + +IngressPipeline(p(), ingress(), deparser()) ip; + +EgressPipeline(egressParserImpl(), egressControlImpl(), egressDeparserImpl()) ep; + +PSA_Switch(ip, PacketReplicationEngine(), ep, BufferingQueueingEngine()) main; + diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_function_return_cast-frontend.p4 b/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_function_return_cast-frontend.p4 new file mode 100644 index 00000000000..4d7038bf9f7 --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_function_return_cast-frontend.p4 @@ -0,0 +1,79 @@ +#include +#include + +header EMPTY_H { +} + +struct EMPTY_RESUB { +} + +struct EMPTY_CLONE { +} + +struct EMPTY_BRIDGE { +} + +struct EMPTY_RECIRC { +} + +header ethernet_t { + bit<48> dst_addr; + bit<48> src_addr; + bit<16> eth_type; +} + +struct Headers { + ethernet_t eth_hdr; +} + +struct Meta { +} + +parser p(packet_in pkt, out Headers hdr, inout Meta m, in psa_ingress_parser_input_metadata_t x, in EMPTY_RESUB resub_meta, in EMPTY_RECIRC recirc_meta) { + state start { + pkt.extract(hdr.eth_hdr); + transition accept; + } +} + +parser egressParserImpl(packet_in buffer, out EMPTY_H a, inout Meta b, in psa_egress_parser_input_metadata_t c, in EMPTY_BRIDGE d, in EMPTY_CLONE e, in EMPTY_CLONE f) { + state start { + transition accept; + } +} + +control ingress(inout Headers h, inout Meta m, in psa_ingress_input_metadata_t istd, inout psa_ingress_output_metadata_t ostd) { + @name("ingress.tmp") bit<8> tmp; + @name("ingress.hasReturned") bool hasReturned; + @name("ingress.retval") bit<8> retval; + apply { + hasReturned = false; + hasReturned = true; + retval = 8w255; + tmp = retval; + h.eth_hdr.eth_type = (bit<16>)tmp; + } +} + +control egressControlImpl(inout EMPTY_H hdr, inout Meta meta, in psa_egress_input_metadata_t x, inout psa_egress_output_metadata_t ostd) { + apply { + } +} + +control deparser(packet_out pkt, out EMPTY_CLONE clone_i2e_meta, out EMPTY_RESUB resubmit_meta, out EMPTY_BRIDGE normal_meta, inout Headers h, in Meta local_metadata, in psa_ingress_output_metadata_t istd) { + apply { + pkt.emit(h); + } +} + +control egressDeparserImpl(packet_out buffer, out EMPTY_CLONE a, out EMPTY_RECIRC b, inout EMPTY_H c, in Meta d, in psa_egress_output_metadata_t e, in psa_egress_deparser_input_metadata_t f) { + apply { + } +} + +IngressPipeline(p(), ingress(), deparser()) ip; + +EgressPipeline(egressParserImpl(), egressControlImpl(), egressDeparserImpl()) ep; + +PSA_Switch(ip, PacketReplicationEngine(), ep, BufferingQueueingEngine()) main; + diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_function_return_cast-midend.p4 b/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_function_return_cast-midend.p4 new file mode 100644 index 00000000000..ddc3fb9f97c --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_function_return_cast-midend.p4 @@ -0,0 +1,90 @@ +#include +#include + +header EMPTY_H { +} + +struct EMPTY_RESUB { +} + +struct EMPTY_CLONE { +} + +struct EMPTY_BRIDGE { +} + +struct EMPTY_RECIRC { +} + +header ethernet_t { + bit<48> dst_addr; + bit<48> src_addr; + bit<16> eth_type; +} + +struct Headers { + ethernet_t eth_hdr; +} + +struct Meta { +} + +parser p(packet_in pkt, out Headers hdr, inout Meta m, in psa_ingress_parser_input_metadata_t x, in EMPTY_RESUB resub_meta, in EMPTY_RECIRC recirc_meta) { + state start { + pkt.extract(hdr.eth_hdr); + transition accept; + } +} + +parser egressParserImpl(packet_in buffer, out EMPTY_H a, inout Meta b, in psa_egress_parser_input_metadata_t c, in EMPTY_BRIDGE d, in EMPTY_CLONE e, in EMPTY_CLONE f) { + state start { + transition accept; + } +} + +control ingress(inout Headers h, inout Meta m, in psa_ingress_input_metadata_t istd, inout psa_ingress_output_metadata_t ostd) { + @hidden action psadpdkgauntlet_function_return_cast56() { + h.eth_hdr.eth_type = 16w255; + } + @hidden table tbl_psadpdkgauntlet_function_return_cast56 { + actions = { + psadpdkgauntlet_function_return_cast56(); + } + const default_action = psadpdkgauntlet_function_return_cast56(); + } + apply { + tbl_psadpdkgauntlet_function_return_cast56.apply(); + } +} + +control egressControlImpl(inout EMPTY_H hdr, inout Meta meta, in psa_egress_input_metadata_t x, inout psa_egress_output_metadata_t ostd) { + apply { + } +} + +control deparser(packet_out pkt, out EMPTY_CLONE clone_i2e_meta, out EMPTY_RESUB resubmit_meta, out EMPTY_BRIDGE normal_meta, inout Headers h, in Meta local_metadata, in psa_ingress_output_metadata_t istd) { + @hidden action psadpdkgauntlet_function_return_cast76() { + pkt.emit(h.eth_hdr); + } + @hidden table tbl_psadpdkgauntlet_function_return_cast76 { + actions = { + psadpdkgauntlet_function_return_cast76(); + } + const default_action = psadpdkgauntlet_function_return_cast76(); + } + apply { + tbl_psadpdkgauntlet_function_return_cast76.apply(); + } +} + +control egressDeparserImpl(packet_out buffer, out EMPTY_CLONE a, out EMPTY_RECIRC b, inout EMPTY_H c, in Meta d, in psa_egress_output_metadata_t e, in psa_egress_deparser_input_metadata_t f) { + apply { + } +} + +IngressPipeline(p(), ingress(), deparser()) ip; + +EgressPipeline(egressParserImpl(), egressControlImpl(), egressDeparserImpl()) ep; + +PSA_Switch(ip, PacketReplicationEngine(), ep, BufferingQueueingEngine()) main; + diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_function_return_cast.p4 b/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_function_return_cast.p4 new file mode 100644 index 00000000000..7c7b0b5d485 --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_function_return_cast.p4 @@ -0,0 +1,78 @@ +#include +#include + +header EMPTY_H { +} + +struct EMPTY_RESUB { +} + +struct EMPTY_CLONE { +} + +struct EMPTY_BRIDGE { +} + +struct EMPTY_RECIRC { +} + +header ethernet_t { + bit<48> dst_addr; + bit<48> src_addr; + bit<16> eth_type; +} + +struct Headers { + ethernet_t eth_hdr; +} + +struct Meta { +} + +bit<8> do_function() { + return -1; +} +parser p(packet_in pkt, out Headers hdr, inout Meta m, in psa_ingress_parser_input_metadata_t x, in EMPTY_RESUB resub_meta, in EMPTY_RECIRC recirc_meta) { + state start { + transition parse_hdrs; + } + state parse_hdrs { + pkt.extract(hdr.eth_hdr); + transition accept; + } +} + +parser egressParserImpl(packet_in buffer, out EMPTY_H a, inout Meta b, in psa_egress_parser_input_metadata_t c, in EMPTY_BRIDGE d, in EMPTY_CLONE e, in EMPTY_CLONE f) { + state start { + transition accept; + } +} + +control ingress(inout Headers h, inout Meta m, in psa_ingress_input_metadata_t istd, inout psa_ingress_output_metadata_t ostd) { + apply { + h.eth_hdr.eth_type = (bit<16>)do_function(); + } +} + +control egressControlImpl(inout EMPTY_H hdr, inout Meta meta, in psa_egress_input_metadata_t x, inout psa_egress_output_metadata_t ostd) { + apply { + } +} + +control deparser(packet_out pkt, out EMPTY_CLONE clone_i2e_meta, out EMPTY_RESUB resubmit_meta, out EMPTY_BRIDGE normal_meta, inout Headers h, in Meta local_metadata, in psa_ingress_output_metadata_t istd) { + apply { + pkt.emit(h); + } +} + +control egressDeparserImpl(packet_out buffer, out EMPTY_CLONE a, out EMPTY_RECIRC b, inout EMPTY_H c, in Meta d, in psa_egress_output_metadata_t e, in psa_egress_deparser_input_metadata_t f) { + apply { + } +} + +IngressPipeline(p(), ingress(), deparser()) ip; + +EgressPipeline(egressParserImpl(), egressControlImpl(), egressDeparserImpl()) ep; + +PSA_Switch(ip, PacketReplicationEngine(), ep, BufferingQueueingEngine()) main; + diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_function_return_cast.p4-error b/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_function_return_cast.p4-error new file mode 100644 index 00000000000..91e5fdd798f --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_function_return_cast.p4-error @@ -0,0 +1,3 @@ +psa-dpdk-gauntlet_function_return_cast.p4(24): [--Wwarn=mismatch] warning: -8w1: negative value with unsigned type + return -1; + ^ diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_function_return_cast.p4-stderr b/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_function_return_cast.p4-stderr new file mode 100644 index 00000000000..91e5fdd798f --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_function_return_cast.p4-stderr @@ -0,0 +1,3 @@ +psa-dpdk-gauntlet_function_return_cast.p4(24): [--Wwarn=mismatch] warning: -8w1: negative value with unsigned type + return -1; + ^ diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_function_return_cast.p4.bfrt.json b/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_function_return_cast.p4.bfrt.json new file mode 100644 index 00000000000..b6d66a630db --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_function_return_cast.p4.bfrt.json @@ -0,0 +1,5 @@ +{ + "schema_version" : "1.0.0", + "tables" : [], + "learn_filters" : [] +} \ No newline at end of file diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_function_return_cast.p4.entries.txt b/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_function_return_cast.p4.entries.txt new file mode 100644 index 00000000000..e69de29bb2d diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_function_return_cast.p4.p4info.txt b/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_function_return_cast.p4.p4info.txt new file mode 100644 index 00000000000..77612386454 --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_function_return_cast.p4.p4info.txt @@ -0,0 +1,3 @@ +pkg_info { + arch: "psa" +} diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_function_return_cast.p4.spec b/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_function_return_cast.p4.spec new file mode 100644 index 00000000000..25648375d98 --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_function_return_cast.p4.spec @@ -0,0 +1,48 @@ + +struct ethernet_t { + bit<48> dst_addr + bit<48> src_addr + bit<16> eth_type +} + +struct psa_ingress_output_metadata_t { + bit<8> class_of_service + bit<8> clone + bit<16> clone_session_id + bit<8> drop + bit<8> resubmit + bit<32> multicast_group + bit<32> egress_port +} + +struct psa_egress_output_metadata_t { + bit<8> clone + bit<16> clone_session_id + bit<8> drop +} + +struct psa_egress_deparser_input_metadata_t { + bit<32> egress_port +} + +header eth_hdr instanceof ethernet_t + +struct Meta { + bit<32> psa_ingress_input_metadata_ingress_port + bit<8> psa_ingress_output_metadata_drop + bit<32> psa_ingress_output_metadata_egress_port +} +metadata instanceof Meta + +apply { + rx m.psa_ingress_input_metadata_ingress_port + mov m.psa_ingress_output_metadata_drop 0x0 + extract h.eth_hdr + mov h.eth_hdr.eth_type 0xff + jmpneq LABEL_DROP m.psa_ingress_output_metadata_drop 0x0 + emit h.eth_hdr + tx m.psa_ingress_output_metadata_egress_port + LABEL_DROP : drop +} + + diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_short_circuit-bmv2.p4-error b/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_short_circuit-bmv2.p4-error new file mode 100644 index 00000000000..acf433db630 --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_short_circuit-bmv2.p4-error @@ -0,0 +1,9 @@ +psa-dpdk-gauntlet_short_circuit-bmv2.p4(29): [--Wwarn=uninitialized_use] warning: val may be uninitialized + return val; + ^^^ +psa-dpdk-gauntlet_short_circuit-bmv2.p4(28): [--Wwarn=uninitialized_out_param] warning: out parameter 'val' may be uninitialized when 'do_function' terminates +bit<8> do_function(out bit<8> val) { + ^^^ +psa-dpdk-gauntlet_short_circuit-bmv2.p4(28) +bit<8> do_function(out bit<8> val) { + ^^^^^^^^^^^ diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_short_circuit-bmv2.p4.bfrt.json b/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_short_circuit-bmv2.p4.bfrt.json new file mode 100644 index 00000000000..b6d66a630db --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_short_circuit-bmv2.p4.bfrt.json @@ -0,0 +1,5 @@ +{ + "schema_version" : "1.0.0", + "tables" : [], + "learn_filters" : [] +} \ No newline at end of file diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_short_circuit-bmv2.p4.spec b/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_short_circuit-bmv2.p4.spec new file mode 100644 index 00000000000..9077528cf8a --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_short_circuit-bmv2.p4.spec @@ -0,0 +1,73 @@ + +struct ethernet_t { + bit<48> dst_addr + bit<48> src_addr + bit<16> eth_type +} + +struct H { + bit<8> a + bit<8> b + bit<8> c + bit<8> d +} + +struct B { + bit<8> a + bit<8> b +} + +struct psa_ingress_output_metadata_t { + bit<8> class_of_service + bit<8> clone + bit<16> clone_session_id + bit<8> drop + bit<8> resubmit + bit<32> multicast_group + bit<32> egress_port +} + +struct psa_egress_output_metadata_t { + bit<8> clone + bit<16> clone_session_id + bit<8> drop +} + +struct psa_egress_deparser_input_metadata_t { + bit<32> egress_port +} + +header eth_hdr instanceof ethernet_t +header h instanceof H +header b instanceof B + +struct Meta { + bit<32> psa_ingress_input_metadata_ingress_port + bit<8> psa_ingress_output_metadata_drop + bit<32> psa_ingress_output_metadata_egress_port + bit<8> Ingress_tmp + bit<8> Ingress_val +} +metadata instanceof Meta + +apply { + rx m.psa_ingress_input_metadata_ingress_port + mov m.psa_ingress_output_metadata_drop 0x0 + extract h.eth_hdr + extract h.h + extract h.b + mov h.b.b m.Ingress_val + jmpeq LABEL_FALSE 0x1 m.Ingress_val + mov m.Ingress_tmp 0x1 + jmp LABEL_END + LABEL_FALSE : mov m.Ingress_tmp 0x2 + LABEL_END : mov h.b.a m.Ingress_tmp + jmpneq LABEL_DROP m.psa_ingress_output_metadata_drop 0x0 + emit h.eth_hdr + emit h.h + emit h.b + tx m.psa_ingress_output_metadata_egress_port + LABEL_DROP : drop +} + + diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_short_circuit-first.p4 b/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_short_circuit-first.p4 new file mode 100644 index 00000000000..48e391961fe --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_short_circuit-first.p4 @@ -0,0 +1,100 @@ +#include +#include + +header EMPTY_H { +} + +struct EMPTY_RESUB { +} + +struct EMPTY_CLONE { +} + +struct EMPTY_BRIDGE { +} + +struct EMPTY_RECIRC { +} + +header ethernet_t { + bit<48> dst_addr; + bit<48> src_addr; + bit<16> eth_type; +} + +header H { + bit<8> a; + bit<8> b; + bit<8> c; + bit<8> d; +} + +header B { + bit<8> a; + bit<8> b; +} + +bit<8> do_function(out bit<8> val) { + return val; +} +struct Headers { + ethernet_t eth_hdr; + H h; + B b; +} + +struct Meta { +} + +bool bool_with_side_effect(inout bit<8> val) { + val = 8w1; + return true; +} +parser p(packet_in pkt, out Headers hdr, inout Meta m, in psa_ingress_parser_input_metadata_t x, in EMPTY_RESUB resub_meta, in EMPTY_RECIRC recirc_meta) { + state start { + pkt.extract(hdr.eth_hdr); + pkt.extract(hdr.h); + pkt.extract(hdr.b); + transition accept; + } +} + +parser egressParserImpl(packet_in buffer, out EMPTY_H a, inout Meta b, in psa_egress_parser_input_metadata_t c, in EMPTY_BRIDGE d, in EMPTY_CLONE e, in EMPTY_CLONE f) { + state start { + transition accept; + } +} + +control ingress(inout Headers h, inout Meta m, in psa_ingress_input_metadata_t istd, inout psa_ingress_output_metadata_t ostd) { + apply { + bool dummy_bool; + dummy_bool = true; + dummy_bool = true; + dummy_bool = false; + dummy_bool = false; + h.b.a = (8w1 != do_function(h.b.b) ? 8w1 : 8w2); + } +} + +control egressControlImpl(inout EMPTY_H hdr, inout Meta meta, in psa_egress_input_metadata_t x, inout psa_egress_output_metadata_t ostd) { + apply { + } +} + +control deparser(packet_out b, out EMPTY_CLONE clone_i2e_meta, out EMPTY_RESUB resubmit_meta, out EMPTY_BRIDGE normal_meta, inout Headers h, in Meta local_metadata, in psa_ingress_output_metadata_t istd) { + apply { + b.emit(h); + } +} + +control egressDeparserImpl(packet_out buffer, out EMPTY_CLONE a, out EMPTY_RECIRC b, inout EMPTY_H c, in Meta d, in psa_egress_output_metadata_t e, in psa_egress_deparser_input_metadata_t f) { + apply { + } +} + +IngressPipeline(p(), ingress(), deparser()) ip; + +EgressPipeline(egressParserImpl(), egressControlImpl(), egressDeparserImpl()) ep; + +PSA_Switch(ip, PacketReplicationEngine(), ep, BufferingQueueingEngine()) main; + diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_short_circuit-frontend.p4 b/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_short_circuit-frontend.p4 new file mode 100644 index 00000000000..35a0538e462 --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_short_circuit-frontend.p4 @@ -0,0 +1,107 @@ +#include +#include + +header EMPTY_H { +} + +struct EMPTY_RESUB { +} + +struct EMPTY_CLONE { +} + +struct EMPTY_BRIDGE { +} + +struct EMPTY_RECIRC { +} + +header ethernet_t { + bit<48> dst_addr; + bit<48> src_addr; + bit<16> eth_type; +} + +header H { + bit<8> a; + bit<8> b; + bit<8> c; + bit<8> d; +} + +header B { + bit<8> a; + bit<8> b; +} + +struct Headers { + ethernet_t eth_hdr; + H h; + B b; +} + +struct Meta { +} + +parser p(packet_in pkt, out Headers hdr, inout Meta m, in psa_ingress_parser_input_metadata_t x, in EMPTY_RESUB resub_meta, in EMPTY_RECIRC recirc_meta) { + state start { + pkt.extract(hdr.eth_hdr); + pkt.extract(hdr.h); + pkt.extract(hdr.b); + transition accept; + } +} + +parser egressParserImpl(packet_in buffer, out EMPTY_H a, inout Meta b, in psa_egress_parser_input_metadata_t c, in EMPTY_BRIDGE d, in EMPTY_CLONE e, in EMPTY_CLONE f) { + state start { + transition accept; + } +} + +control ingress(inout Headers h, inout Meta m, in psa_ingress_input_metadata_t istd, inout psa_ingress_output_metadata_t ostd) { + @name("ingress.tmp") bit<8> tmp; + @name("ingress.tmp_0") bit<8> tmp_0; + @name("ingress.tmp_1") bool tmp_1; + @name("ingress.tmp_2") bit<8> tmp_2; + @name("ingress.val_0") bit<8> val; + @name("ingress.hasReturned") bool hasReturned; + @name("ingress.retval") bit<8> retval; + apply { + tmp = 8w1; + hasReturned = false; + hasReturned = true; + retval = val; + h.b.b = val; + tmp_0 = retval; + tmp_1 = tmp != tmp_0; + if (tmp_1) { + tmp_2 = 8w1; + } else { + tmp_2 = 8w2; + } + h.b.a = tmp_2; + } +} + +control egressControlImpl(inout EMPTY_H hdr, inout Meta meta, in psa_egress_input_metadata_t x, inout psa_egress_output_metadata_t ostd) { + apply { + } +} + +control deparser(packet_out b, out EMPTY_CLONE clone_i2e_meta, out EMPTY_RESUB resubmit_meta, out EMPTY_BRIDGE normal_meta, inout Headers h, in Meta local_metadata, in psa_ingress_output_metadata_t istd) { + apply { + b.emit(h); + } +} + +control egressDeparserImpl(packet_out buffer, out EMPTY_CLONE a, out EMPTY_RECIRC b, inout EMPTY_H c, in Meta d, in psa_egress_output_metadata_t e, in psa_egress_deparser_input_metadata_t f) { + apply { + } +} + +IngressPipeline(p(), ingress(), deparser()) ip; + +EgressPipeline(egressParserImpl(), egressControlImpl(), egressDeparserImpl()) ep; + +PSA_Switch(ip, PacketReplicationEngine(), ep, BufferingQueueingEngine()) main; + diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_short_circuit-midend.p4 b/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_short_circuit-midend.p4 new file mode 100644 index 00000000000..c048375fd3e --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_short_circuit-midend.p4 @@ -0,0 +1,143 @@ +#include +#include + +header EMPTY_H { +} + +struct EMPTY_RESUB { +} + +struct EMPTY_CLONE { +} + +struct EMPTY_BRIDGE { +} + +struct EMPTY_RECIRC { +} + +header ethernet_t { + bit<48> dst_addr; + bit<48> src_addr; + bit<16> eth_type; +} + +header H { + bit<8> a; + bit<8> b; + bit<8> c; + bit<8> d; +} + +header B { + bit<8> a; + bit<8> b; +} + +struct Headers { + ethernet_t eth_hdr; + H h; + B b; +} + +struct Meta { +} + +parser p(packet_in pkt, out Headers hdr, inout Meta m, in psa_ingress_parser_input_metadata_t x, in EMPTY_RESUB resub_meta, in EMPTY_RECIRC recirc_meta) { + state start { + pkt.extract(hdr.eth_hdr); + pkt.extract(hdr.h); + pkt.extract(hdr.b); + transition accept; + } +} + +parser egressParserImpl(packet_in buffer, out EMPTY_H a, inout Meta b, in psa_egress_parser_input_metadata_t c, in EMPTY_BRIDGE d, in EMPTY_CLONE e, in EMPTY_CLONE f) { + state start { + transition accept; + } +} + +control ingress(inout Headers h, inout Meta m, in psa_ingress_input_metadata_t istd, inout psa_ingress_output_metadata_t ostd) { + @name("ingress.tmp_2") bit<8> tmp_2; + @name("ingress.val_0") bit<8> val; + @hidden action psadpdkgauntlet_short_circuit77() { + tmp_2 = 8w1; + } + @hidden action psadpdkgauntlet_short_circuit77_0() { + tmp_2 = 8w2; + } + @hidden action act() { + h.b.b = val; + } + @hidden action psadpdkgauntlet_short_circuit77_1() { + h.b.a = tmp_2; + } + @hidden table tbl_act { + actions = { + act(); + } + const default_action = act(); + } + @hidden table tbl_psadpdkgauntlet_short_circuit77 { + actions = { + psadpdkgauntlet_short_circuit77(); + } + const default_action = psadpdkgauntlet_short_circuit77(); + } + @hidden table tbl_psadpdkgauntlet_short_circuit77_0 { + actions = { + psadpdkgauntlet_short_circuit77_0(); + } + const default_action = psadpdkgauntlet_short_circuit77_0(); + } + @hidden table tbl_psadpdkgauntlet_short_circuit77_1 { + actions = { + psadpdkgauntlet_short_circuit77_1(); + } + const default_action = psadpdkgauntlet_short_circuit77_1(); + } + apply { + tbl_act.apply(); + if (8w1 != val) { + tbl_psadpdkgauntlet_short_circuit77.apply(); + } else { + tbl_psadpdkgauntlet_short_circuit77_0.apply(); + } + tbl_psadpdkgauntlet_short_circuit77_1.apply(); + } +} + +control egressControlImpl(inout EMPTY_H hdr, inout Meta meta, in psa_egress_input_metadata_t x, inout psa_egress_output_metadata_t ostd) { + apply { + } +} + +control deparser(packet_out b, out EMPTY_CLONE clone_i2e_meta, out EMPTY_RESUB resubmit_meta, out EMPTY_BRIDGE normal_meta, inout Headers h, in Meta local_metadata, in psa_ingress_output_metadata_t istd) { + @hidden action psadpdkgauntlet_short_circuit95() { + b.emit(h.eth_hdr); + b.emit(h.h); + b.emit(h.b); + } + @hidden table tbl_psadpdkgauntlet_short_circuit95 { + actions = { + psadpdkgauntlet_short_circuit95(); + } + const default_action = psadpdkgauntlet_short_circuit95(); + } + apply { + tbl_psadpdkgauntlet_short_circuit95.apply(); + } +} + +control egressDeparserImpl(packet_out buffer, out EMPTY_CLONE a, out EMPTY_RECIRC b, inout EMPTY_H c, in Meta d, in psa_egress_output_metadata_t e, in psa_egress_deparser_input_metadata_t f) { + apply { + } +} + +IngressPipeline(p(), ingress(), deparser()) ip; + +EgressPipeline(egressParserImpl(), egressControlImpl(), egressDeparserImpl()) ep; + +PSA_Switch(ip, PacketReplicationEngine(), ep, BufferingQueueingEngine()) main; + diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_short_circuit.p4 b/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_short_circuit.p4 new file mode 100644 index 00000000000..4ff79c9f7da --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_short_circuit.p4 @@ -0,0 +1,100 @@ +#include +#include + +header EMPTY_H { +} + +struct EMPTY_RESUB { +} + +struct EMPTY_CLONE { +} + +struct EMPTY_BRIDGE { +} + +struct EMPTY_RECIRC { +} + +header ethernet_t { + bit<48> dst_addr; + bit<48> src_addr; + bit<16> eth_type; +} + +header H { + bit<8> a; + bit<8> b; + bit<8> c; + bit<8> d; +} + +header B { + bit<8> a; + bit<8> b; +} + +bit<8> do_function(out bit<8> val) { + return val; +} +struct Headers { + ethernet_t eth_hdr; + H h; + B b; +} + +struct Meta { +} + +bool bool_with_side_effect(inout bit<8> val) { + val = 1; + return true; +} +parser p(packet_in pkt, out Headers hdr, inout Meta m, in psa_ingress_parser_input_metadata_t x, in EMPTY_RESUB resub_meta, in EMPTY_RECIRC recirc_meta) { + state start { + pkt.extract(hdr.eth_hdr); + pkt.extract(hdr.h); + pkt.extract(hdr.b); + transition accept; + } +} + +parser egressParserImpl(packet_in buffer, out EMPTY_H a, inout Meta b, in psa_egress_parser_input_metadata_t c, in EMPTY_BRIDGE d, in EMPTY_CLONE e, in EMPTY_CLONE f) { + state start { + transition accept; + } +} + +control ingress(inout Headers h, inout Meta m, in psa_ingress_input_metadata_t istd, inout psa_ingress_output_metadata_t ostd) { + apply { + bool dummy_bool; + dummy_bool = true || bool_with_side_effect(h.h.a); + dummy_bool = false || true || bool_with_side_effect(h.h.b); + dummy_bool = false && bool_with_side_effect(h.h.c); + dummy_bool = true && false && bool_with_side_effect(h.h.d); + h.b.a = (8w1 != do_function(h.b.b) || false ? 8w1 : 8w2); + } +} + +control egressControlImpl(inout EMPTY_H hdr, inout Meta meta, in psa_egress_input_metadata_t x, inout psa_egress_output_metadata_t ostd) { + apply { + } +} + +control deparser(packet_out b, out EMPTY_CLONE clone_i2e_meta, out EMPTY_RESUB resubmit_meta, out EMPTY_BRIDGE normal_meta, inout Headers h, in Meta local_metadata, in psa_ingress_output_metadata_t istd) { + apply { + b.emit(h); + } +} + +control egressDeparserImpl(packet_out buffer, out EMPTY_CLONE a, out EMPTY_RECIRC b, inout EMPTY_H c, in Meta d, in psa_egress_output_metadata_t e, in psa_egress_deparser_input_metadata_t f) { + apply { + } +} + +IngressPipeline(p(), ingress(), deparser()) ip; + +EgressPipeline(egressParserImpl(), egressControlImpl(), egressDeparserImpl()) ep; + +PSA_Switch(ip, PacketReplicationEngine(), ep, BufferingQueueingEngine()) main; + diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_short_circuit.p4-error b/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_short_circuit.p4-error new file mode 100644 index 00000000000..7d40c4a0b42 --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_short_circuit.p4-error @@ -0,0 +1,9 @@ +psa-dpdk-gauntlet_short_circuit.p4(29): [--Wwarn=uninitialized_use] warning: val may be uninitialized + return val; + ^^^ +psa-dpdk-gauntlet_short_circuit.p4(28): [--Wwarn=uninitialized_out_param] warning: out parameter 'val' may be uninitialized when 'do_function' terminates +bit<8> do_function(out bit<8> val) { + ^^^ +psa-dpdk-gauntlet_short_circuit.p4(28) +bit<8> do_function(out bit<8> val) { + ^^^^^^^^^^^ diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_short_circuit.p4-stderr b/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_short_circuit.p4-stderr new file mode 100644 index 00000000000..7d40c4a0b42 --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_short_circuit.p4-stderr @@ -0,0 +1,9 @@ +psa-dpdk-gauntlet_short_circuit.p4(29): [--Wwarn=uninitialized_use] warning: val may be uninitialized + return val; + ^^^ +psa-dpdk-gauntlet_short_circuit.p4(28): [--Wwarn=uninitialized_out_param] warning: out parameter 'val' may be uninitialized when 'do_function' terminates +bit<8> do_function(out bit<8> val) { + ^^^ +psa-dpdk-gauntlet_short_circuit.p4(28) +bit<8> do_function(out bit<8> val) { + ^^^^^^^^^^^ diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_short_circuit.p4.bfrt.json b/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_short_circuit.p4.bfrt.json new file mode 100644 index 00000000000..b6d66a630db --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_short_circuit.p4.bfrt.json @@ -0,0 +1,5 @@ +{ + "schema_version" : "1.0.0", + "tables" : [], + "learn_filters" : [] +} \ No newline at end of file diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_short_circuit.p4.entries.txt b/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_short_circuit.p4.entries.txt new file mode 100644 index 00000000000..e69de29bb2d diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_short_circuit.p4.p4info.txt b/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_short_circuit.p4.p4info.txt new file mode 100644 index 00000000000..77612386454 --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_short_circuit.p4.p4info.txt @@ -0,0 +1,3 @@ +pkg_info { + arch: "psa" +} diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_short_circuit.p4.spec b/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_short_circuit.p4.spec new file mode 100644 index 00000000000..9077528cf8a --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_short_circuit.p4.spec @@ -0,0 +1,73 @@ + +struct ethernet_t { + bit<48> dst_addr + bit<48> src_addr + bit<16> eth_type +} + +struct H { + bit<8> a + bit<8> b + bit<8> c + bit<8> d +} + +struct B { + bit<8> a + bit<8> b +} + +struct psa_ingress_output_metadata_t { + bit<8> class_of_service + bit<8> clone + bit<16> clone_session_id + bit<8> drop + bit<8> resubmit + bit<32> multicast_group + bit<32> egress_port +} + +struct psa_egress_output_metadata_t { + bit<8> clone + bit<16> clone_session_id + bit<8> drop +} + +struct psa_egress_deparser_input_metadata_t { + bit<32> egress_port +} + +header eth_hdr instanceof ethernet_t +header h instanceof H +header b instanceof B + +struct Meta { + bit<32> psa_ingress_input_metadata_ingress_port + bit<8> psa_ingress_output_metadata_drop + bit<32> psa_ingress_output_metadata_egress_port + bit<8> Ingress_tmp + bit<8> Ingress_val +} +metadata instanceof Meta + +apply { + rx m.psa_ingress_input_metadata_ingress_port + mov m.psa_ingress_output_metadata_drop 0x0 + extract h.eth_hdr + extract h.h + extract h.b + mov h.b.b m.Ingress_val + jmpeq LABEL_FALSE 0x1 m.Ingress_val + mov m.Ingress_tmp 0x1 + jmp LABEL_END + LABEL_FALSE : mov m.Ingress_tmp 0x2 + LABEL_END : mov h.b.a m.Ingress_tmp + jmpneq LABEL_DROP m.psa_ingress_output_metadata_drop 0x0 + emit h.eth_hdr + emit h.h + emit h.b + tx m.psa_ingress_output_metadata_egress_port + LABEL_DROP : drop +} + + diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_side_effect_order_4-bmv2.p4-error b/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_side_effect_order_4-bmv2.p4-error new file mode 100644 index 00000000000..e69de29bb2d diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_side_effect_order_4-bmv2.p4.bfrt.json b/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_side_effect_order_4-bmv2.p4.bfrt.json new file mode 100644 index 00000000000..b6d66a630db --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_side_effect_order_4-bmv2.p4.bfrt.json @@ -0,0 +1,5 @@ +{ + "schema_version" : "1.0.0", + "tables" : [], + "learn_filters" : [] +} \ No newline at end of file diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_side_effect_order_4-bmv2.p4.spec b/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_side_effect_order_4-bmv2.p4.spec new file mode 100644 index 00000000000..f6f95f6f510 --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_side_effect_order_4-bmv2.p4.spec @@ -0,0 +1,53 @@ + +struct ethernet_t { + bit<48> dst_addr + bit<48> src_addr + bit<16> eth_type +} + +struct psa_ingress_output_metadata_t { + bit<8> class_of_service + bit<8> clone + bit<16> clone_session_id + bit<8> drop + bit<8> resubmit + bit<32> multicast_group + bit<32> egress_port +} + +struct psa_egress_output_metadata_t { + bit<8> clone + bit<16> clone_session_id + bit<8> drop +} + +struct psa_egress_deparser_input_metadata_t { + bit<32> egress_port +} + +header eth_hdr instanceof ethernet_t + +struct Meta { + bit<32> psa_ingress_input_metadata_ingress_port + bit<8> psa_ingress_output_metadata_drop + bit<32> psa_ingress_output_metadata_egress_port + bit<16> Ingress_tmp +} +metadata instanceof Meta + +apply { + rx m.psa_ingress_input_metadata_ingress_port + mov m.psa_ingress_output_metadata_drop 0x0 + extract h.eth_hdr + jmplt LABEL_TRUE h.eth_hdr.eth_type 0x6 + mov m.Ingress_tmp 0x3 + jmp LABEL_END + LABEL_TRUE : mov m.Ingress_tmp 0x0 + LABEL_END : mov h.eth_hdr.eth_type m.Ingress_tmp + jmpneq LABEL_DROP m.psa_ingress_output_metadata_drop 0x0 + emit h.eth_hdr + tx m.psa_ingress_output_metadata_egress_port + LABEL_DROP : drop +} + + diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_side_effect_order_4-first.p4 b/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_side_effect_order_4-first.p4 new file mode 100644 index 00000000000..0d0dac636f5 --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_side_effect_order_4-first.p4 @@ -0,0 +1,79 @@ +#include +#include + +header EMPTY_H { +} + +struct EMPTY_RESUB { +} + +struct EMPTY_CLONE { +} + +struct EMPTY_BRIDGE { +} + +struct EMPTY_RECIRC { +} + +header ethernet_t { + bit<48> dst_addr; + bit<48> src_addr; + bit<16> eth_type; +} + +struct Headers { + ethernet_t eth_hdr; +} + +struct Meta { +} + +bit<16> do_thing(inout bit<16> val_0) { + val_0 = (val_0 < 16w6 ? 16w0 : 16w3); + return 16w2; +} +parser p(packet_in pkt, out Headers hdr, inout Meta m, in psa_ingress_parser_input_metadata_t x, in EMPTY_RESUB resub_meta, in EMPTY_RECIRC recirc_meta) { + state start { + transition parse_hdrs; + } + state parse_hdrs { + pkt.extract(hdr.eth_hdr); + transition accept; + } +} + +parser egressParserImpl(packet_in buffer, out EMPTY_H a, inout Meta b, in psa_egress_parser_input_metadata_t c, in EMPTY_BRIDGE d, in EMPTY_CLONE e, in EMPTY_CLONE f) { + state start { + transition accept; + } +} + +control ingress(inout Headers h, inout Meta m, in psa_ingress_input_metadata_t istd, inout psa_ingress_output_metadata_t ostd) { + apply { + do_thing(h.eth_hdr.eth_type); + } +} + +control egressControlImpl(inout EMPTY_H hdr, inout Meta meta, in psa_egress_input_metadata_t x, inout psa_egress_output_metadata_t ostd) { + apply { + } +} + +control deparser(packet_out pkt, out EMPTY_CLONE clone_i2e_meta, out EMPTY_RESUB resubmit_meta, out EMPTY_BRIDGE normal_meta, inout Headers hdr, in Meta local_metadata, in psa_ingress_output_metadata_t istd) { + apply { + pkt.emit(hdr); + } +} + +control egressDeparserImpl(packet_out buffer, out EMPTY_CLONE a, out EMPTY_RECIRC b, inout EMPTY_H c, in Meta d, in psa_egress_output_metadata_t e, in psa_egress_deparser_input_metadata_t f) { + apply { + } +} + +IngressPipeline(p(), ingress(), deparser()) ip; + +EgressPipeline(egressParserImpl(), egressControlImpl(), egressDeparserImpl()) ep; + +PSA_Switch(ip, PacketReplicationEngine(), ep, BufferingQueueingEngine()) main; + diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_side_effect_order_4-frontend.p4 b/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_side_effect_order_4-frontend.p4 new file mode 100644 index 00000000000..0235666615f --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_side_effect_order_4-frontend.p4 @@ -0,0 +1,86 @@ +#include +#include + +header EMPTY_H { +} + +struct EMPTY_RESUB { +} + +struct EMPTY_CLONE { +} + +struct EMPTY_BRIDGE { +} + +struct EMPTY_RECIRC { +} + +header ethernet_t { + bit<48> dst_addr; + bit<48> src_addr; + bit<16> eth_type; +} + +struct Headers { + ethernet_t eth_hdr; +} + +struct Meta { +} + +parser p(packet_in pkt, out Headers hdr, inout Meta m, in psa_ingress_parser_input_metadata_t x, in EMPTY_RESUB resub_meta, in EMPTY_RECIRC recirc_meta) { + state start { + pkt.extract(hdr.eth_hdr); + transition accept; + } +} + +parser egressParserImpl(packet_in buffer, out EMPTY_H a, inout Meta b, in psa_egress_parser_input_metadata_t c, in EMPTY_BRIDGE d, in EMPTY_CLONE e, in EMPTY_CLONE f) { + state start { + transition accept; + } +} + +control ingress(inout Headers h, inout Meta m, in psa_ingress_input_metadata_t istd, inout psa_ingress_output_metadata_t ostd) { + @name("ingress.val") bit<16> val_0; + @name("ingress.hasReturned") bool hasReturned; + @name("ingress.retval") bit<16> retval; + @name("ingress.tmp") bit<16> tmp; + apply { + val_0 = h.eth_hdr.eth_type; + hasReturned = false; + if (val_0 < 16w6) { + tmp = 16w0; + } else { + tmp = 16w3; + } + val_0 = tmp; + hasReturned = true; + retval = 16w2; + h.eth_hdr.eth_type = val_0; + } +} + +control egressControlImpl(inout EMPTY_H hdr, inout Meta meta, in psa_egress_input_metadata_t x, inout psa_egress_output_metadata_t ostd) { + apply { + } +} + +control deparser(packet_out pkt, out EMPTY_CLONE clone_i2e_meta, out EMPTY_RESUB resubmit_meta, out EMPTY_BRIDGE normal_meta, inout Headers hdr, in Meta local_metadata, in psa_ingress_output_metadata_t istd) { + apply { + pkt.emit(hdr); + } +} + +control egressDeparserImpl(packet_out buffer, out EMPTY_CLONE a, out EMPTY_RECIRC b, inout EMPTY_H c, in Meta d, in psa_egress_output_metadata_t e, in psa_egress_deparser_input_metadata_t f) { + apply { + } +} + +IngressPipeline(p(), ingress(), deparser()) ip; + +EgressPipeline(egressParserImpl(), egressControlImpl(), egressDeparserImpl()) ep; + +PSA_Switch(ip, PacketReplicationEngine(), ep, BufferingQueueingEngine()) main; + diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_side_effect_order_4-midend.p4 b/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_side_effect_order_4-midend.p4 new file mode 100644 index 00000000000..429934efe33 --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_side_effect_order_4-midend.p4 @@ -0,0 +1,114 @@ +#include +#include + +header EMPTY_H { +} + +struct EMPTY_RESUB { +} + +struct EMPTY_CLONE { +} + +struct EMPTY_BRIDGE { +} + +struct EMPTY_RECIRC { +} + +header ethernet_t { + bit<48> dst_addr; + bit<48> src_addr; + bit<16> eth_type; +} + +struct Headers { + ethernet_t eth_hdr; +} + +struct Meta { +} + +parser p(packet_in pkt, out Headers hdr, inout Meta m, in psa_ingress_parser_input_metadata_t x, in EMPTY_RESUB resub_meta, in EMPTY_RECIRC recirc_meta) { + state start { + pkt.extract(hdr.eth_hdr); + transition accept; + } +} + +parser egressParserImpl(packet_in buffer, out EMPTY_H a, inout Meta b, in psa_egress_parser_input_metadata_t c, in EMPTY_BRIDGE d, in EMPTY_CLONE e, in EMPTY_CLONE f) { + state start { + transition accept; + } +} + +control ingress(inout Headers h, inout Meta m, in psa_ingress_input_metadata_t istd, inout psa_ingress_output_metadata_t ostd) { + @name("ingress.tmp") bit<16> tmp; + @hidden action psadpdkgauntlet_side_effect_order_4l24() { + tmp = 16w0; + } + @hidden action psadpdkgauntlet_side_effect_order_4l24_0() { + tmp = 16w3; + } + @hidden action act() { + h.eth_hdr.eth_type = tmp; + } + @hidden table tbl_psadpdkgauntlet_side_effect_order_4l24 { + actions = { + psadpdkgauntlet_side_effect_order_4l24(); + } + const default_action = psadpdkgauntlet_side_effect_order_4l24(); + } + @hidden table tbl_psadpdkgauntlet_side_effect_order_4l24_0 { + actions = { + psadpdkgauntlet_side_effect_order_4l24_0(); + } + const default_action = psadpdkgauntlet_side_effect_order_4l24_0(); + } + @hidden table tbl_act { + actions = { + act(); + } + const default_action = act(); + } + apply { + if (h.eth_hdr.eth_type < 16w6) { + tbl_psadpdkgauntlet_side_effect_order_4l24.apply(); + } else { + tbl_psadpdkgauntlet_side_effect_order_4l24_0.apply(); + } + tbl_act.apply(); + } +} + +control egressControlImpl(inout EMPTY_H hdr, inout Meta meta, in psa_egress_input_metadata_t x, inout psa_egress_output_metadata_t ostd) { + apply { + } +} + +control deparser(packet_out pkt, out EMPTY_CLONE clone_i2e_meta, out EMPTY_RESUB resubmit_meta, out EMPTY_BRIDGE normal_meta, inout Headers hdr, in Meta local_metadata, in psa_ingress_output_metadata_t istd) { + @hidden action psadpdkgauntlet_side_effect_order_4l77() { + pkt.emit(hdr.eth_hdr); + } + @hidden table tbl_psadpdkgauntlet_side_effect_order_4l77 { + actions = { + psadpdkgauntlet_side_effect_order_4l77(); + } + const default_action = psadpdkgauntlet_side_effect_order_4l77(); + } + apply { + tbl_psadpdkgauntlet_side_effect_order_4l77.apply(); + } +} + +control egressDeparserImpl(packet_out buffer, out EMPTY_CLONE a, out EMPTY_RECIRC b, inout EMPTY_H c, in Meta d, in psa_egress_output_metadata_t e, in psa_egress_deparser_input_metadata_t f) { + apply { + } +} + +IngressPipeline(p(), ingress(), deparser()) ip; + +EgressPipeline(egressParserImpl(), egressControlImpl(), egressDeparserImpl()) ep; + +PSA_Switch(ip, PacketReplicationEngine(), ep, BufferingQueueingEngine()) main; + diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_side_effect_order_4.p4 b/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_side_effect_order_4.p4 new file mode 100644 index 00000000000..f6a7a79abf4 --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_side_effect_order_4.p4 @@ -0,0 +1,79 @@ +#include +#include + +header EMPTY_H { +} + +struct EMPTY_RESUB { +} + +struct EMPTY_CLONE { +} + +struct EMPTY_BRIDGE { +} + +struct EMPTY_RECIRC { +} + +header ethernet_t { + bit<48> dst_addr; + bit<48> src_addr; + bit<16> eth_type; +} + +struct Headers { + ethernet_t eth_hdr; +} + +struct Meta { +} + +bit<16> do_thing(inout bit<16> val_0) { + val_0 = (val_0 < 6 ? 16w0 : 16w3); + return 16w2; +} +parser p(packet_in pkt, out Headers hdr, inout Meta m, in psa_ingress_parser_input_metadata_t x, in EMPTY_RESUB resub_meta, in EMPTY_RECIRC recirc_meta) { + state start { + transition parse_hdrs; + } + state parse_hdrs { + pkt.extract(hdr.eth_hdr); + transition accept; + } +} + +parser egressParserImpl(packet_in buffer, out EMPTY_H a, inout Meta b, in psa_egress_parser_input_metadata_t c, in EMPTY_BRIDGE d, in EMPTY_CLONE e, in EMPTY_CLONE f) { + state start { + transition accept; + } +} + +control ingress(inout Headers h, inout Meta m, in psa_ingress_input_metadata_t istd, inout psa_ingress_output_metadata_t ostd) { + apply { + do_thing(h.eth_hdr.eth_type); + } +} + +control egressControlImpl(inout EMPTY_H hdr, inout Meta meta, in psa_egress_input_metadata_t x, inout psa_egress_output_metadata_t ostd) { + apply { + } +} + +control deparser(packet_out pkt, out EMPTY_CLONE clone_i2e_meta, out EMPTY_RESUB resubmit_meta, out EMPTY_BRIDGE normal_meta, inout Headers hdr, in Meta local_metadata, in psa_ingress_output_metadata_t istd) { + apply { + pkt.emit(hdr); + } +} + +control egressDeparserImpl(packet_out buffer, out EMPTY_CLONE a, out EMPTY_RECIRC b, inout EMPTY_H c, in Meta d, in psa_egress_output_metadata_t e, in psa_egress_deparser_input_metadata_t f) { + apply { + } +} + +IngressPipeline(p(), ingress(), deparser()) ip; + +EgressPipeline(egressParserImpl(), egressControlImpl(), egressDeparserImpl()) ep; + +PSA_Switch(ip, PacketReplicationEngine(), ep, BufferingQueueingEngine()) main; + diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_side_effect_order_4.p4-error b/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_side_effect_order_4.p4-error new file mode 100644 index 00000000000..e69de29bb2d diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_side_effect_order_4.p4-stderr b/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_side_effect_order_4.p4-stderr new file mode 100644 index 00000000000..e69de29bb2d diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_side_effect_order_4.p4.bfrt.json b/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_side_effect_order_4.p4.bfrt.json new file mode 100644 index 00000000000..b6d66a630db --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_side_effect_order_4.p4.bfrt.json @@ -0,0 +1,5 @@ +{ + "schema_version" : "1.0.0", + "tables" : [], + "learn_filters" : [] +} \ No newline at end of file diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_side_effect_order_4.p4.entries.txt b/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_side_effect_order_4.p4.entries.txt new file mode 100644 index 00000000000..e69de29bb2d diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_side_effect_order_4.p4.p4info.txt b/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_side_effect_order_4.p4.p4info.txt new file mode 100644 index 00000000000..77612386454 --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_side_effect_order_4.p4.p4info.txt @@ -0,0 +1,3 @@ +pkg_info { + arch: "psa" +} diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_side_effect_order_4.p4.spec b/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_side_effect_order_4.p4.spec new file mode 100644 index 00000000000..f6f95f6f510 --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_side_effect_order_4.p4.spec @@ -0,0 +1,53 @@ + +struct ethernet_t { + bit<48> dst_addr + bit<48> src_addr + bit<16> eth_type +} + +struct psa_ingress_output_metadata_t { + bit<8> class_of_service + bit<8> clone + bit<16> clone_session_id + bit<8> drop + bit<8> resubmit + bit<32> multicast_group + bit<32> egress_port +} + +struct psa_egress_output_metadata_t { + bit<8> clone + bit<16> clone_session_id + bit<8> drop +} + +struct psa_egress_deparser_input_metadata_t { + bit<32> egress_port +} + +header eth_hdr instanceof ethernet_t + +struct Meta { + bit<32> psa_ingress_input_metadata_ingress_port + bit<8> psa_ingress_output_metadata_drop + bit<32> psa_ingress_output_metadata_egress_port + bit<16> Ingress_tmp +} +metadata instanceof Meta + +apply { + rx m.psa_ingress_input_metadata_ingress_port + mov m.psa_ingress_output_metadata_drop 0x0 + extract h.eth_hdr + jmplt LABEL_TRUE h.eth_hdr.eth_type 0x6 + mov m.Ingress_tmp 0x3 + jmp LABEL_END + LABEL_TRUE : mov m.Ingress_tmp 0x0 + LABEL_END : mov h.eth_hdr.eth_type m.Ingress_tmp + jmpneq LABEL_DROP m.psa_ingress_output_metadata_drop 0x0 + emit h.eth_hdr + tx m.psa_ingress_output_metadata_egress_port + LABEL_DROP : drop +} + + diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_variable_shadowing-bmv2.p4-error b/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_variable_shadowing-bmv2.p4-error new file mode 100644 index 00000000000..e69de29bb2d diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_variable_shadowing-bmv2.p4.bfrt.json b/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_variable_shadowing-bmv2.p4.bfrt.json new file mode 100644 index 00000000000..9214cdbce1a --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_variable_shadowing-bmv2.p4.bfrt.json @@ -0,0 +1,48 @@ +{ + "schema_version" : "1.0.0", + "tables" : [ + { + "name" : "ip.ingress.c.t", + "id" : 43577110, + "table_type" : "MatchAction_Direct", + "size" : 1024, + "annotations" : [], + "depends_on" : [], + "has_const_default_action" : false, + "key" : [ + { + "id" : 1, + "name" : "e", + "repeated" : false, + "annotations" : [], + "mandatory" : false, + "match_type" : "Exact", + "type" : { + "type" : "bytes", + "width" : 32 + } + } + ], + "action_specs" : [ + { + "id" : 27847715, + "name" : "ingress.c.a", + "action_scope" : "TableAndDefault", + "annotations" : [], + "data" : [] + }, + { + "id" : 21257015, + "name" : "NoAction", + "action_scope" : "TableAndDefault", + "annotations" : [], + "data" : [] + } + ], + "data" : [], + "supported_operations" : [], + "attributes" : ["EntryScope"] + } + ], + "learn_filters" : [] +} \ No newline at end of file diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_variable_shadowing-bmv2.p4.spec b/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_variable_shadowing-bmv2.p4.spec new file mode 100644 index 00000000000..11edf6f84c0 --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_variable_shadowing-bmv2.p4.spec @@ -0,0 +1,85 @@ + +struct ethernet_t { + bit<48> dst_addr + bit<48> src_addr + bit<16> eth_type +} + +struct H { + bit<32> a + bit<32> b + bit<8> c +} + +struct psa_ingress_output_metadata_t { + bit<8> class_of_service + bit<8> clone + bit<16> clone_session_id + bit<8> drop + bit<8> resubmit + bit<32> multicast_group + bit<32> egress_port +} + +struct psa_egress_output_metadata_t { + bit<8> clone + bit<16> clone_session_id + bit<8> drop +} + +struct psa_egress_deparser_input_metadata_t { + bit<32> egress_port +} + +header eth_hdr instanceof ethernet_t +header h instanceof H + +struct Meta { + bit<32> psa_ingress_input_metadata_ingress_port + bit<8> psa_ingress_output_metadata_drop + bit<32> psa_ingress_output_metadata_egress_port + bit<8> local_metadata_test + bit<32> Ingress_key +} +metadata instanceof Meta + +action NoAction args none { + return +} + +action c_a_0 args none { + mov h.h.b h.h.a + return +} + +table c_t { + key { + m.Ingress_key exact + } + actions { + c_a_0 + NoAction + } + default_action NoAction args none + size 0x10000 +} + + +apply { + rx m.psa_ingress_input_metadata_ingress_port + mov m.psa_ingress_output_metadata_drop 0x0 + extract h.eth_hdr + extract h.h + mov m.local_metadata_test 0x1 + mov m.Ingress_key h.h.a + add m.Ingress_key h.h.a + table c_t + mov h.h.c 0x1 + jmpneq LABEL_DROP m.psa_ingress_output_metadata_drop 0x0 + emit h.eth_hdr + emit h.h + tx m.psa_ingress_output_metadata_egress_port + LABEL_DROP : drop +} + + diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_variable_shadowing-first.p4 b/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_variable_shadowing-first.p4 new file mode 100644 index 00000000000..73dfce1999a --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_variable_shadowing-first.p4 @@ -0,0 +1,107 @@ +#include +#include + +header EMPTY_H { +} + +struct EMPTY_RESUB { +} + +struct EMPTY_CLONE { +} + +struct EMPTY_BRIDGE { +} + +struct EMPTY_RECIRC { +} + +header ethernet_t { + bit<48> dst_addr; + bit<48> src_addr; + bit<16> eth_type; +} + +header H { + bit<32> a; + bit<32> b; + bit<8> c; +} + +struct Headers { + ethernet_t eth_hdr; + H h; +} + +struct Meta { + bit<8> test; +} + +control compute(inout H h) { + @name("a") action a_0() { + h.b = h.a; + } + @name("t") table t_0 { + key = { + h.a + h.a: exact @name("e") ; + } + actions = { + a_0(); + NoAction(); + } + default_action = NoAction(); + } + apply { + bit<8> tmp = 8w0; + Meta m = (Meta){test = 8w0}; + t_0.apply(); + tmp = 8w0; + } +} + +parser p(packet_in pkt, out Headers h, inout Meta m, in psa_ingress_parser_input_metadata_t x, in EMPTY_RESUB resub_meta, in EMPTY_RECIRC recirc_meta) { + state start { + pkt.extract(h.eth_hdr); + pkt.extract(h.h); + transition accept; + } +} + +parser egressParserImpl(packet_in buffer, out EMPTY_H a, inout Meta b, in psa_egress_parser_input_metadata_t c, in EMPTY_BRIDGE d, in EMPTY_CLONE e, in EMPTY_CLONE f) { + state start { + transition accept; + } +} + +control ingress(inout Headers h, inout Meta m, in psa_ingress_input_metadata_t istd, inout psa_ingress_output_metadata_t ostd) { + @name("c") compute() c_0; + apply { + m.test = 8w1; + bit<8> tmp = 8w1; + c_0.apply(h.h); + h.h.c = tmp; + } +} + +control egressControlImpl(inout EMPTY_H hdr, inout Meta meta, in psa_egress_input_metadata_t x, inout psa_egress_output_metadata_t ostd) { + apply { + } +} + +control deparser(packet_out pkt, out EMPTY_CLONE clone_i2e_meta, out EMPTY_RESUB resubmit_meta, out EMPTY_BRIDGE normal_meta, inout Headers h, in Meta local_metadata, in psa_ingress_output_metadata_t istd) { + apply { + pkt.emit(h); + } +} + +control egressDeparserImpl(packet_out buffer, out EMPTY_CLONE a, out EMPTY_RECIRC b, inout EMPTY_H c, in Meta d, in psa_egress_output_metadata_t e, in psa_egress_deparser_input_metadata_t f) { + apply { + } +} + +IngressPipeline(p(), ingress(), deparser()) ip; + +EgressPipeline(egressParserImpl(), egressControlImpl(), egressDeparserImpl()) ep; + +PSA_Switch(ip, PacketReplicationEngine(), ep, BufferingQueueingEngine()) main; + diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_variable_shadowing-frontend.p4 b/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_variable_shadowing-frontend.p4 new file mode 100644 index 00000000000..69ede44d6e1 --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_variable_shadowing-frontend.p4 @@ -0,0 +1,100 @@ +#include +#include + +header EMPTY_H { +} + +struct EMPTY_RESUB { +} + +struct EMPTY_CLONE { +} + +struct EMPTY_BRIDGE { +} + +struct EMPTY_RECIRC { +} + +header ethernet_t { + bit<48> dst_addr; + bit<48> src_addr; + bit<16> eth_type; +} + +header H { + bit<32> a; + bit<32> b; + bit<8> c; +} + +struct Headers { + ethernet_t eth_hdr; + H h; +} + +struct Meta { + bit<8> test; +} + +parser p(packet_in pkt, out Headers h, inout Meta m, in psa_ingress_parser_input_metadata_t x, in EMPTY_RESUB resub_meta, in EMPTY_RECIRC recirc_meta) { + state start { + pkt.extract(h.eth_hdr); + pkt.extract(h.h); + transition accept; + } +} + +parser egressParserImpl(packet_in buffer, out EMPTY_H a, inout Meta b, in psa_egress_parser_input_metadata_t c, in EMPTY_BRIDGE d, in EMPTY_CLONE e, in EMPTY_CLONE f) { + state start { + transition accept; + } +} + +control ingress(inout Headers h, inout Meta m, in psa_ingress_input_metadata_t istd, inout psa_ingress_output_metadata_t ostd) { + @name("ingress.tmp") bit<8> tmp_0; + @noWarn("unused") @name(".NoAction") action NoAction_1() { + } + @name("ingress.c.a") action c_a_0() { + h.h.b = h.h.a; + } + @name("ingress.c.t") table c_t { + key = { + h.h.a + h.h.a: exact @name("e") ; + } + actions = { + c_a_0(); + NoAction_1(); + } + default_action = NoAction_1(); + } + apply { + m.test = 8w1; + tmp_0 = 8w1; + c_t.apply(); + h.h.c = tmp_0; + } +} + +control egressControlImpl(inout EMPTY_H hdr, inout Meta meta, in psa_egress_input_metadata_t x, inout psa_egress_output_metadata_t ostd) { + apply { + } +} + +control deparser(packet_out pkt, out EMPTY_CLONE clone_i2e_meta, out EMPTY_RESUB resubmit_meta, out EMPTY_BRIDGE normal_meta, inout Headers h, in Meta local_metadata, in psa_ingress_output_metadata_t istd) { + apply { + pkt.emit(h); + } +} + +control egressDeparserImpl(packet_out buffer, out EMPTY_CLONE a, out EMPTY_RECIRC b, inout EMPTY_H c, in Meta d, in psa_egress_output_metadata_t e, in psa_egress_deparser_input_metadata_t f) { + apply { + } +} + +IngressPipeline(p(), ingress(), deparser()) ip; + +EgressPipeline(egressParserImpl(), egressControlImpl(), egressDeparserImpl()) ep; + +PSA_Switch(ip, PacketReplicationEngine(), ep, BufferingQueueingEngine()) main; + diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_variable_shadowing-midend.p4 b/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_variable_shadowing-midend.p4 new file mode 100644 index 00000000000..07187344b12 --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_variable_shadowing-midend.p4 @@ -0,0 +1,128 @@ +#include +#include + +header EMPTY_H { +} + +struct EMPTY_RESUB { +} + +struct EMPTY_CLONE { +} + +struct EMPTY_BRIDGE { +} + +struct EMPTY_RECIRC { +} + +header ethernet_t { + bit<48> dst_addr; + bit<48> src_addr; + bit<16> eth_type; +} + +header H { + bit<32> a; + bit<32> b; + bit<8> c; +} + +struct Headers { + ethernet_t eth_hdr; + H h; +} + +struct Meta { + bit<8> test; +} + +parser p(packet_in pkt, out Headers h, inout Meta m, in psa_ingress_parser_input_metadata_t x, in EMPTY_RESUB resub_meta, in EMPTY_RECIRC recirc_meta) { + state start { + pkt.extract(h.eth_hdr); + pkt.extract(h.h); + transition accept; + } +} + +parser egressParserImpl(packet_in buffer, out EMPTY_H a, inout Meta b, in psa_egress_parser_input_metadata_t c, in EMPTY_BRIDGE d, in EMPTY_CLONE e, in EMPTY_CLONE f) { + state start { + transition accept; + } +} + +control ingress(inout Headers h, inout Meta m, in psa_ingress_input_metadata_t istd, inout psa_ingress_output_metadata_t ostd) { + bit<32> key_0; + @noWarn("unused") @name(".NoAction") action NoAction_1() { + } + @name("ingress.c.a") action c_a_0() { + h.h.b = h.h.a; + } + @name("ingress.c.t") table c_t { + key = { + key_0: exact @name("e") ; + } + actions = { + c_a_0(); + NoAction_1(); + } + default_action = NoAction_1(); + } + @hidden action psadpdkgauntlet_variable_shadowing39() { + m.test = 8w1; + key_0 = h.h.a + h.h.a; + } + @hidden action psadpdkgauntlet_variable_shadowing86() { + h.h.c = 8w1; + } + @hidden table tbl_psadpdkgauntlet_variable_shadowing39 { + actions = { + psadpdkgauntlet_variable_shadowing39(); + } + const default_action = psadpdkgauntlet_variable_shadowing39(); + } + @hidden table tbl_psadpdkgauntlet_variable_shadowing86 { + actions = { + psadpdkgauntlet_variable_shadowing86(); + } + const default_action = psadpdkgauntlet_variable_shadowing86(); + } + apply { + tbl_psadpdkgauntlet_variable_shadowing39.apply(); + c_t.apply(); + tbl_psadpdkgauntlet_variable_shadowing86.apply(); + } +} + +control egressControlImpl(inout EMPTY_H hdr, inout Meta meta, in psa_egress_input_metadata_t x, inout psa_egress_output_metadata_t ostd) { + apply { + } +} + +control deparser(packet_out pkt, out EMPTY_CLONE clone_i2e_meta, out EMPTY_RESUB resubmit_meta, out EMPTY_BRIDGE normal_meta, inout Headers h, in Meta local_metadata, in psa_ingress_output_metadata_t istd) { + @hidden action psadpdkgauntlet_variable_shadowing106() { + pkt.emit(h.eth_hdr); + pkt.emit(h.h); + } + @hidden table tbl_psadpdkgauntlet_variable_shadowing106 { + actions = { + psadpdkgauntlet_variable_shadowing106(); + } + const default_action = psadpdkgauntlet_variable_shadowing106(); + } + apply { + tbl_psadpdkgauntlet_variable_shadowing106.apply(); + } +} + +control egressDeparserImpl(packet_out buffer, out EMPTY_CLONE a, out EMPTY_RECIRC b, inout EMPTY_H c, in Meta d, in psa_egress_output_metadata_t e, in psa_egress_deparser_input_metadata_t f) { + apply { + } +} + +IngressPipeline(p(), ingress(), deparser()) ip; + +EgressPipeline(egressParserImpl(), egressControlImpl(), egressDeparserImpl()) ep; + +PSA_Switch(ip, PacketReplicationEngine(), ep, BufferingQueueingEngine()) main; + diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_variable_shadowing.p4 b/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_variable_shadowing.p4 new file mode 100644 index 00000000000..9bef867127e --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_variable_shadowing.p4 @@ -0,0 +1,107 @@ +#include +#include + +header EMPTY_H { +} + +struct EMPTY_RESUB { +} + +struct EMPTY_CLONE { +} + +struct EMPTY_BRIDGE { +} + +struct EMPTY_RECIRC { +} + +header ethernet_t { + bit<48> dst_addr; + bit<48> src_addr; + bit<16> eth_type; +} + +header H { + bit<32> a; + bit<32> b; + bit<8> c; +} + +struct Headers { + ethernet_t eth_hdr; + H h; +} + +struct Meta { + bit<8> test; +} + +control compute(inout H h) { + @name("a") action a_0() { + h.b = h.a; + } + @name("t") table t_0 { + key = { + h.a + h.a: exact @name("e") ; + } + actions = { + a_0(); + NoAction(); + } + default_action = NoAction(); + } + apply { + bit<8> tmp = 0; + Meta m = { 0 }; + t_0.apply(); + tmp = 0; + } +} + +parser p(packet_in pkt, out Headers h, inout Meta m, in psa_ingress_parser_input_metadata_t x, in EMPTY_RESUB resub_meta, in EMPTY_RECIRC recirc_meta) { + state start { + pkt.extract(h.eth_hdr); + pkt.extract(h.h); + transition accept; + } +} + +parser egressParserImpl(packet_in buffer, out EMPTY_H a, inout Meta b, in psa_egress_parser_input_metadata_t c, in EMPTY_BRIDGE d, in EMPTY_CLONE e, in EMPTY_CLONE f) { + state start { + transition accept; + } +} + +control ingress(inout Headers h, inout Meta m, in psa_ingress_input_metadata_t istd, inout psa_ingress_output_metadata_t ostd) { + @name("c") compute() c_0; + apply { + m.test = 1; + bit<8> tmp = 1; + c_0.apply(h.h); + h.h.c = tmp; + } +} + +control egressControlImpl(inout EMPTY_H hdr, inout Meta meta, in psa_egress_input_metadata_t x, inout psa_egress_output_metadata_t ostd) { + apply { + } +} + +control deparser(packet_out pkt, out EMPTY_CLONE clone_i2e_meta, out EMPTY_RESUB resubmit_meta, out EMPTY_BRIDGE normal_meta, inout Headers h, in Meta local_metadata, in psa_ingress_output_metadata_t istd) { + apply { + pkt.emit(h); + } +} + +control egressDeparserImpl(packet_out buffer, out EMPTY_CLONE a, out EMPTY_RECIRC b, inout EMPTY_H c, in Meta d, in psa_egress_output_metadata_t e, in psa_egress_deparser_input_metadata_t f) { + apply { + } +} + +IngressPipeline(p(), ingress(), deparser()) ip; + +EgressPipeline(egressParserImpl(), egressControlImpl(), egressDeparserImpl()) ep; + +PSA_Switch(ip, PacketReplicationEngine(), ep, BufferingQueueingEngine()) main; + diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_variable_shadowing.p4-error b/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_variable_shadowing.p4-error new file mode 100644 index 00000000000..e69de29bb2d diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_variable_shadowing.p4-stderr b/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_variable_shadowing.p4-stderr new file mode 100644 index 00000000000..e69de29bb2d diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_variable_shadowing.p4.bfrt.json b/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_variable_shadowing.p4.bfrt.json new file mode 100644 index 00000000000..9214cdbce1a --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_variable_shadowing.p4.bfrt.json @@ -0,0 +1,48 @@ +{ + "schema_version" : "1.0.0", + "tables" : [ + { + "name" : "ip.ingress.c.t", + "id" : 43577110, + "table_type" : "MatchAction_Direct", + "size" : 1024, + "annotations" : [], + "depends_on" : [], + "has_const_default_action" : false, + "key" : [ + { + "id" : 1, + "name" : "e", + "repeated" : false, + "annotations" : [], + "mandatory" : false, + "match_type" : "Exact", + "type" : { + "type" : "bytes", + "width" : 32 + } + } + ], + "action_specs" : [ + { + "id" : 27847715, + "name" : "ingress.c.a", + "action_scope" : "TableAndDefault", + "annotations" : [], + "data" : [] + }, + { + "id" : 21257015, + "name" : "NoAction", + "action_scope" : "TableAndDefault", + "annotations" : [], + "data" : [] + } + ], + "data" : [], + "supported_operations" : [], + "attributes" : ["EntryScope"] + } + ], + "learn_filters" : [] +} \ No newline at end of file diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_variable_shadowing.p4.entries.txt b/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_variable_shadowing.p4.entries.txt new file mode 100644 index 00000000000..e69de29bb2d diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_variable_shadowing.p4.p4info.txt b/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_variable_shadowing.p4.p4info.txt new file mode 100644 index 00000000000..12443341889 --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_variable_shadowing.p4.p4info.txt @@ -0,0 +1,40 @@ +pkg_info { + arch: "psa" +} +tables { + preamble { + id: 43577110 + name: "ingress.c.t" + alias: "t" + } + match_fields { + id: 1 + name: "e" + bitwidth: 32 + match_type: EXACT + } + action_refs { + id: 27847715 + } + action_refs { + id: 21257015 + } + size: 1024 +} +actions { + preamble { + id: 21257015 + name: "NoAction" + alias: "NoAction" + annotations: "@noWarn(\"unused\")" + } +} +actions { + preamble { + id: 27847715 + name: "ingress.c.a" + alias: "a" + } +} +type_info { +} diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_variable_shadowing.p4.spec b/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_variable_shadowing.p4.spec new file mode 100644 index 00000000000..11edf6f84c0 --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-gauntlet_variable_shadowing.p4.spec @@ -0,0 +1,85 @@ + +struct ethernet_t { + bit<48> dst_addr + bit<48> src_addr + bit<16> eth_type +} + +struct H { + bit<32> a + bit<32> b + bit<8> c +} + +struct psa_ingress_output_metadata_t { + bit<8> class_of_service + bit<8> clone + bit<16> clone_session_id + bit<8> drop + bit<8> resubmit + bit<32> multicast_group + bit<32> egress_port +} + +struct psa_egress_output_metadata_t { + bit<8> clone + bit<16> clone_session_id + bit<8> drop +} + +struct psa_egress_deparser_input_metadata_t { + bit<32> egress_port +} + +header eth_hdr instanceof ethernet_t +header h instanceof H + +struct Meta { + bit<32> psa_ingress_input_metadata_ingress_port + bit<8> psa_ingress_output_metadata_drop + bit<32> psa_ingress_output_metadata_egress_port + bit<8> local_metadata_test + bit<32> Ingress_key +} +metadata instanceof Meta + +action NoAction args none { + return +} + +action c_a_0 args none { + mov h.h.b h.h.a + return +} + +table c_t { + key { + m.Ingress_key exact + } + actions { + c_a_0 + NoAction + } + default_action NoAction args none + size 0x10000 +} + + +apply { + rx m.psa_ingress_input_metadata_ingress_port + mov m.psa_ingress_output_metadata_drop 0x0 + extract h.eth_hdr + extract h.h + mov m.local_metadata_test 0x1 + mov m.Ingress_key h.h.a + add m.Ingress_key h.h.a + table c_t + mov h.h.c 0x1 + jmpneq LABEL_DROP m.psa_ingress_output_metadata_drop 0x0 + emit h.eth_hdr + emit h.h + tx m.psa_ingress_output_metadata_egress_port + LABEL_DROP : drop +} + + diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-hash-first.p4 b/testdata/p4_16_samples_outputs/psa-dpdk-hash-first.p4 new file mode 100644 index 00000000000..910ba6b11d7 --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-hash-first.p4 @@ -0,0 +1,77 @@ +#include +#include + +header EMPTY_H { +} + +struct EMPTY_RESUB { +} + +struct EMPTY_CLONE { +} + +struct EMPTY_BRIDGE { +} + +struct EMPTY_RECIRC { +} + +header hash_t { + bit<32> hash; +} + +header ipv4_t { + bit<32> lkp_ipv4_sa; +} + +struct M { + hash_t hash; + ipv4_t ipv4; +} + +struct H { +} + +parser ParserI(packet_in pk, out H hdr, inout M meta, in psa_ingress_parser_input_metadata_t x, in EMPTY_RESUB resub_meta, in EMPTY_RECIRC recirc_meta) { + state start { + transition accept; + } +} + +parser egressParserImpl(packet_in buffer, out EMPTY_H a, inout M b, in psa_egress_parser_input_metadata_t c, in EMPTY_BRIDGE d, in EMPTY_CLONE e, in EMPTY_CLONE f) { + state start { + transition accept; + } +} + +control IngressI(inout H hdr, inout M meta, in psa_ingress_input_metadata_t istd, inout psa_ingress_output_metadata_t ostd) { + Hash>(PSA_HashAlgorithm_t.CRC16) h; + action a() { + meta.hash.hash = h.get_hash, tuple>>(32w0, { meta.ipv4.lkp_ipv4_sa }, 32w65536); + } + apply { + a(); + } +} + +control egressControlImpl(inout EMPTY_H hdr, inout M meta, in psa_egress_input_metadata_t x, inout psa_egress_output_metadata_t ostd) { + apply { + } +} + +control DeparserI(packet_out packet, out EMPTY_CLONE clone_i2e_meta, out EMPTY_RESUB resubmit_meta, out EMPTY_BRIDGE normal_meta, inout H hdr, in M local_metadata, in psa_ingress_output_metadata_t istd) { + apply { + } +} + +control egressDeparserImpl(packet_out buffer, out EMPTY_CLONE a, out EMPTY_RECIRC b, inout EMPTY_H c, in M d, in psa_egress_output_metadata_t e, in psa_egress_deparser_input_metadata_t f) { + apply { + } +} + +IngressPipeline(ParserI(), IngressI(), DeparserI()) ip; + +EgressPipeline(egressParserImpl(), egressControlImpl(), egressDeparserImpl()) ep; + +PSA_Switch(ip, PacketReplicationEngine(), ep, BufferingQueueingEngine()) main; + diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-hash-frontend.p4 b/testdata/p4_16_samples_outputs/psa-dpdk-hash-frontend.p4 new file mode 100644 index 00000000000..cabfcfc7374 --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-hash-frontend.p4 @@ -0,0 +1,77 @@ +#include +#include + +header EMPTY_H { +} + +struct EMPTY_RESUB { +} + +struct EMPTY_CLONE { +} + +struct EMPTY_BRIDGE { +} + +struct EMPTY_RECIRC { +} + +header hash_t { + bit<32> hash; +} + +header ipv4_t { + bit<32> lkp_ipv4_sa; +} + +struct M { + hash_t hash; + ipv4_t ipv4; +} + +struct H { +} + +parser ParserI(packet_in pk, out H hdr, inout M meta, in psa_ingress_parser_input_metadata_t x, in EMPTY_RESUB resub_meta, in EMPTY_RECIRC recirc_meta) { + state start { + transition accept; + } +} + +parser egressParserImpl(packet_in buffer, out EMPTY_H a, inout M b, in psa_egress_parser_input_metadata_t c, in EMPTY_BRIDGE d, in EMPTY_CLONE e, in EMPTY_CLONE f) { + state start { + transition accept; + } +} + +control IngressI(inout H hdr, inout M meta, in psa_ingress_input_metadata_t istd, inout psa_ingress_output_metadata_t ostd) { + @name("IngressI.h") Hash>(PSA_HashAlgorithm_t.CRC16) h_0; + @name("IngressI.a") action a_1() { + meta.hash.hash = h_0.get_hash, tuple>>(32w0, { meta.ipv4.lkp_ipv4_sa }, 32w65536); + } + apply { + a_1(); + } +} + +control egressControlImpl(inout EMPTY_H hdr, inout M meta, in psa_egress_input_metadata_t x, inout psa_egress_output_metadata_t ostd) { + apply { + } +} + +control DeparserI(packet_out packet, out EMPTY_CLONE clone_i2e_meta, out EMPTY_RESUB resubmit_meta, out EMPTY_BRIDGE normal_meta, inout H hdr, in M local_metadata, in psa_ingress_output_metadata_t istd) { + apply { + } +} + +control egressDeparserImpl(packet_out buffer, out EMPTY_CLONE a, out EMPTY_RECIRC b, inout EMPTY_H c, in M d, in psa_egress_output_metadata_t e, in psa_egress_deparser_input_metadata_t f) { + apply { + } +} + +IngressPipeline(ParserI(), IngressI(), DeparserI()) ip; + +EgressPipeline(egressParserImpl(), egressControlImpl(), egressDeparserImpl()) ep; + +PSA_Switch(ip, PacketReplicationEngine(), ep, BufferingQueueingEngine()) main; + diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-hash-midend.p4 b/testdata/p4_16_samples_outputs/psa-dpdk-hash-midend.p4 new file mode 100644 index 00000000000..3708f1ea7b9 --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-hash-midend.p4 @@ -0,0 +1,87 @@ +#include +#include + +header EMPTY_H { +} + +struct EMPTY_RESUB { +} + +struct EMPTY_CLONE { +} + +struct EMPTY_BRIDGE { +} + +struct EMPTY_RECIRC { +} + +header hash_t { + bit<32> hash; +} + +header ipv4_t { + bit<32> lkp_ipv4_sa; +} + +struct M { + hash_t hash; + ipv4_t ipv4; +} + +struct H { +} + +parser ParserI(packet_in pk, out H hdr, inout M meta, in psa_ingress_parser_input_metadata_t x, in EMPTY_RESUB resub_meta, in EMPTY_RECIRC recirc_meta) { + state start { + transition accept; + } +} + +parser egressParserImpl(packet_in buffer, out EMPTY_H a, inout M b, in psa_egress_parser_input_metadata_t c, in EMPTY_BRIDGE d, in EMPTY_CLONE e, in EMPTY_CLONE f) { + state start { + transition accept; + } +} + +struct tuple_0 { + bit<32> f0; +} + +control IngressI(inout H hdr, inout M meta, in psa_ingress_input_metadata_t istd, inout psa_ingress_output_metadata_t ostd) { + @name("IngressI.h") Hash>(PSA_HashAlgorithm_t.CRC16) h_0; + @name("IngressI.a") action a_1() { + meta.hash.hash = h_0.get_hash, tuple_0>(32w0, (tuple_0){f0 = meta.ipv4.lkp_ipv4_sa}, 32w65536); + } + @hidden table tbl_a { + actions = { + a_1(); + } + const default_action = a_1(); + } + apply { + tbl_a.apply(); + } +} + +control egressControlImpl(inout EMPTY_H hdr, inout M meta, in psa_egress_input_metadata_t x, inout psa_egress_output_metadata_t ostd) { + apply { + } +} + +control DeparserI(packet_out packet, out EMPTY_CLONE clone_i2e_meta, out EMPTY_RESUB resubmit_meta, out EMPTY_BRIDGE normal_meta, inout H hdr, in M local_metadata, in psa_ingress_output_metadata_t istd) { + apply { + } +} + +control egressDeparserImpl(packet_out buffer, out EMPTY_CLONE a, out EMPTY_RECIRC b, inout EMPTY_H c, in M d, in psa_egress_output_metadata_t e, in psa_egress_deparser_input_metadata_t f) { + apply { + } +} + +IngressPipeline(ParserI(), IngressI(), DeparserI()) ip; + +EgressPipeline(egressParserImpl(), egressControlImpl(), egressDeparserImpl()) ep; + +PSA_Switch(ip, PacketReplicationEngine(), ep, BufferingQueueingEngine()) main; + diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-hash.p4 b/testdata/p4_16_samples_outputs/psa-dpdk-hash.p4 new file mode 100644 index 00000000000..e9cfe9cb683 --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-hash.p4 @@ -0,0 +1,77 @@ +#include +#include + +header EMPTY_H { +} + +struct EMPTY_RESUB { +} + +struct EMPTY_CLONE { +} + +struct EMPTY_BRIDGE { +} + +struct EMPTY_RECIRC { +} + +header hash_t { + bit<32> hash; +} + +header ipv4_t { + bit<32> lkp_ipv4_sa; +} + +struct M { + hash_t hash; + ipv4_t ipv4; +} + +struct H { +} + +parser ParserI(packet_in pk, out H hdr, inout M meta, in psa_ingress_parser_input_metadata_t x, in EMPTY_RESUB resub_meta, in EMPTY_RECIRC recirc_meta) { + state start { + transition accept; + } +} + +parser egressParserImpl(packet_in buffer, out EMPTY_H a, inout M b, in psa_egress_parser_input_metadata_t c, in EMPTY_BRIDGE d, in EMPTY_CLONE e, in EMPTY_CLONE f) { + state start { + transition accept; + } +} + +control IngressI(inout H hdr, inout M meta, in psa_ingress_input_metadata_t istd, inout psa_ingress_output_metadata_t ostd) { + Hash>(PSA_HashAlgorithm_t.CRC16) h; + action a() { + meta.hash.hash = h.get_hash((bit<32>)0, { meta.ipv4.lkp_ipv4_sa }, (bit<32>)65536); + } + apply { + a(); + } +} + +control egressControlImpl(inout EMPTY_H hdr, inout M meta, in psa_egress_input_metadata_t x, inout psa_egress_output_metadata_t ostd) { + apply { + } +} + +control DeparserI(packet_out packet, out EMPTY_CLONE clone_i2e_meta, out EMPTY_RESUB resubmit_meta, out EMPTY_BRIDGE normal_meta, inout H hdr, in M local_metadata, in psa_ingress_output_metadata_t istd) { + apply { + } +} + +control egressDeparserImpl(packet_out buffer, out EMPTY_CLONE a, out EMPTY_RECIRC b, inout EMPTY_H c, in M d, in psa_egress_output_metadata_t e, in psa_egress_deparser_input_metadata_t f) { + apply { + } +} + +IngressPipeline(ParserI(), IngressI(), DeparserI()) ip; + +EgressPipeline(egressParserImpl(), egressControlImpl(), egressDeparserImpl()) ep; + +PSA_Switch(ip, PacketReplicationEngine(), ep, BufferingQueueingEngine()) main; + diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-hash.p4-stderr b/testdata/p4_16_samples_outputs/psa-dpdk-hash.p4-stderr new file mode 100644 index 00000000000..e69de29bb2d diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-hash.p4.entries.txt b/testdata/p4_16_samples_outputs/psa-dpdk-hash.p4.entries.txt new file mode 100644 index 00000000000..e69de29bb2d diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-hash.p4.p4info.txt b/testdata/p4_16_samples_outputs/psa-dpdk-hash.p4.p4info.txt new file mode 100644 index 00000000000..dd6fae2ff5b --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-hash.p4.p4info.txt @@ -0,0 +1,12 @@ +pkg_info { + arch: "psa" +} +actions { + preamble { + id: 20366104 + name: "IngressI.a" + alias: "a" + } +} +type_info { +} diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-inline-stack-bmv2.p4-error b/testdata/p4_16_samples_outputs/psa-dpdk-inline-stack-bmv2.p4-error new file mode 100644 index 00000000000..e69de29bb2d diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-inline-stack-bmv2.p4.bfrt.json b/testdata/p4_16_samples_outputs/psa-dpdk-inline-stack-bmv2.p4.bfrt.json new file mode 100644 index 00000000000..b6d66a630db --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-inline-stack-bmv2.p4.bfrt.json @@ -0,0 +1,5 @@ +{ + "schema_version" : "1.0.0", + "tables" : [], + "learn_filters" : [] +} \ No newline at end of file diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-inline-stack-bmv2.p4.spec b/testdata/p4_16_samples_outputs/psa-dpdk-inline-stack-bmv2.p4.spec new file mode 100644 index 00000000000..86a4fc7bbf6 --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-inline-stack-bmv2.p4.spec @@ -0,0 +1,44 @@ + +struct h_t { + bit<8> f +} + +struct psa_ingress_output_metadata_t { + bit<8> class_of_service + bit<8> clone + bit<16> clone_session_id + bit<8> drop + bit<8> resubmit + bit<32> multicast_group + bit<32> egress_port +} + +struct psa_egress_output_metadata_t { + bit<8> clone + bit<16> clone_session_id + bit<8> drop +} + +struct psa_egress_deparser_input_metadata_t { + bit<32> egress_port +} + +header stack_0 instanceof h_t + + +struct M { + bit<32> psa_ingress_input_metadata_ingress_port + bit<8> psa_ingress_output_metadata_drop + bit<32> psa_ingress_output_metadata_egress_port +} +metadata instanceof M + +apply { + rx m.psa_ingress_input_metadata_ingress_port + mov m.psa_ingress_output_metadata_drop 0x0 + jmpneq LABEL_DROP m.psa_ingress_output_metadata_drop 0x0 + tx m.psa_ingress_output_metadata_egress_port + LABEL_DROP : drop +} + + diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-inline-stack-first.p4 b/testdata/p4_16_samples_outputs/psa-dpdk-inline-stack-first.p4 new file mode 100644 index 00000000000..bef20554b6d --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-inline-stack-first.p4 @@ -0,0 +1,75 @@ +#include +#include + +header EMPTY_H { +} + +struct EMPTY_RESUB { +} + +struct EMPTY_CLONE { +} + +struct EMPTY_BRIDGE { +} + +struct EMPTY_RECIRC { +} + +header h_t { + bit<8> f; +} + +struct H { + h_t[1] stack; +} + +struct M { +} + +parser ParserI(packet_in pk, out H hdr, inout M meta, in psa_ingress_parser_input_metadata_t x, in EMPTY_RESUB resub_meta, in EMPTY_RECIRC recirc_meta) { + state start { + transition accept; + } +} + +parser egressParserImpl(packet_in buffer, out EMPTY_H a, inout M b, in psa_egress_parser_input_metadata_t c, in EMPTY_BRIDGE d, in EMPTY_CLONE e, in EMPTY_CLONE f) { + state start { + transition accept; + } +} + +control Aux(inout H hdr) { + apply { + } +} + +control IngressI(inout H hdr, inout M meta, in psa_ingress_input_metadata_t istd, inout psa_ingress_output_metadata_t ostd) { + Aux() aux; + apply { + aux.apply(hdr); + aux.apply(hdr); + } +} + +control egressControlImpl(inout EMPTY_H hdr, inout M meta, in psa_egress_input_metadata_t x, inout psa_egress_output_metadata_t ostd) { + apply { + } +} + +control DeparserI(packet_out b, out EMPTY_CLONE clone_i2e_meta, out EMPTY_RESUB resubmit_meta, out EMPTY_BRIDGE normal_meta, inout H h, in M local_metadata, in psa_ingress_output_metadata_t istd) { + apply { + } +} + +control egressDeparserImpl(packet_out buffer, out EMPTY_CLONE a, out EMPTY_RECIRC b, inout EMPTY_H c, in M d, in psa_egress_output_metadata_t e, in psa_egress_deparser_input_metadata_t f) { + apply { + } +} + +IngressPipeline(ParserI(), IngressI(), DeparserI()) ip; + +EgressPipeline(egressParserImpl(), egressControlImpl(), egressDeparserImpl()) ep; + +PSA_Switch(ip, PacketReplicationEngine(), ep, BufferingQueueingEngine()) main; + diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-inline-stack-frontend.p4 b/testdata/p4_16_samples_outputs/psa-dpdk-inline-stack-frontend.p4 new file mode 100644 index 00000000000..c2519dd7396 --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-inline-stack-frontend.p4 @@ -0,0 +1,67 @@ +#include +#include + +header EMPTY_H { +} + +struct EMPTY_RESUB { +} + +struct EMPTY_CLONE { +} + +struct EMPTY_BRIDGE { +} + +struct EMPTY_RECIRC { +} + +header h_t { + bit<8> f; +} + +struct H { + h_t[1] stack; +} + +struct M { +} + +parser ParserI(packet_in pk, out H hdr, inout M meta, in psa_ingress_parser_input_metadata_t x, in EMPTY_RESUB resub_meta, in EMPTY_RECIRC recirc_meta) { + state start { + transition accept; + } +} + +parser egressParserImpl(packet_in buffer, out EMPTY_H a, inout M b, in psa_egress_parser_input_metadata_t c, in EMPTY_BRIDGE d, in EMPTY_CLONE e, in EMPTY_CLONE f) { + state start { + transition accept; + } +} + +control IngressI(inout H hdr, inout M meta, in psa_ingress_input_metadata_t istd, inout psa_ingress_output_metadata_t ostd) { + apply { + } +} + +control egressControlImpl(inout EMPTY_H hdr, inout M meta, in psa_egress_input_metadata_t x, inout psa_egress_output_metadata_t ostd) { + apply { + } +} + +control DeparserI(packet_out b, out EMPTY_CLONE clone_i2e_meta, out EMPTY_RESUB resubmit_meta, out EMPTY_BRIDGE normal_meta, inout H h, in M local_metadata, in psa_ingress_output_metadata_t istd) { + apply { + } +} + +control egressDeparserImpl(packet_out buffer, out EMPTY_CLONE a, out EMPTY_RECIRC b, inout EMPTY_H c, in M d, in psa_egress_output_metadata_t e, in psa_egress_deparser_input_metadata_t f) { + apply { + } +} + +IngressPipeline(ParserI(), IngressI(), DeparserI()) ip; + +EgressPipeline(egressParserImpl(), egressControlImpl(), egressDeparserImpl()) ep; + +PSA_Switch(ip, PacketReplicationEngine(), ep, BufferingQueueingEngine()) main; + diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-inline-stack-midend.p4 b/testdata/p4_16_samples_outputs/psa-dpdk-inline-stack-midend.p4 new file mode 100644 index 00000000000..c2519dd7396 --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-inline-stack-midend.p4 @@ -0,0 +1,67 @@ +#include +#include + +header EMPTY_H { +} + +struct EMPTY_RESUB { +} + +struct EMPTY_CLONE { +} + +struct EMPTY_BRIDGE { +} + +struct EMPTY_RECIRC { +} + +header h_t { + bit<8> f; +} + +struct H { + h_t[1] stack; +} + +struct M { +} + +parser ParserI(packet_in pk, out H hdr, inout M meta, in psa_ingress_parser_input_metadata_t x, in EMPTY_RESUB resub_meta, in EMPTY_RECIRC recirc_meta) { + state start { + transition accept; + } +} + +parser egressParserImpl(packet_in buffer, out EMPTY_H a, inout M b, in psa_egress_parser_input_metadata_t c, in EMPTY_BRIDGE d, in EMPTY_CLONE e, in EMPTY_CLONE f) { + state start { + transition accept; + } +} + +control IngressI(inout H hdr, inout M meta, in psa_ingress_input_metadata_t istd, inout psa_ingress_output_metadata_t ostd) { + apply { + } +} + +control egressControlImpl(inout EMPTY_H hdr, inout M meta, in psa_egress_input_metadata_t x, inout psa_egress_output_metadata_t ostd) { + apply { + } +} + +control DeparserI(packet_out b, out EMPTY_CLONE clone_i2e_meta, out EMPTY_RESUB resubmit_meta, out EMPTY_BRIDGE normal_meta, inout H h, in M local_metadata, in psa_ingress_output_metadata_t istd) { + apply { + } +} + +control egressDeparserImpl(packet_out buffer, out EMPTY_CLONE a, out EMPTY_RECIRC b, inout EMPTY_H c, in M d, in psa_egress_output_metadata_t e, in psa_egress_deparser_input_metadata_t f) { + apply { + } +} + +IngressPipeline(ParserI(), IngressI(), DeparserI()) ip; + +EgressPipeline(egressParserImpl(), egressControlImpl(), egressDeparserImpl()) ep; + +PSA_Switch(ip, PacketReplicationEngine(), ep, BufferingQueueingEngine()) main; + diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-inline-stack.p4 b/testdata/p4_16_samples_outputs/psa-dpdk-inline-stack.p4 new file mode 100644 index 00000000000..3e3549b089a --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-inline-stack.p4 @@ -0,0 +1,75 @@ +#include +#include + +header EMPTY_H { +} + +struct EMPTY_RESUB { +} + +struct EMPTY_CLONE { +} + +struct EMPTY_BRIDGE { +} + +struct EMPTY_RECIRC { +} + +header h_t { + bit<8> f; +} + +struct H { + h_t[1] stack; +} + +struct M { +} + +parser ParserI(packet_in pk, out H hdr, inout M meta, in psa_ingress_parser_input_metadata_t x, in EMPTY_RESUB resub_meta, in EMPTY_RECIRC recirc_meta) { + state start { + transition accept; + } +} + +parser egressParserImpl(packet_in buffer, out EMPTY_H a, inout M b, in psa_egress_parser_input_metadata_t c, in EMPTY_BRIDGE d, in EMPTY_CLONE e, in EMPTY_CLONE f) { + state start { + transition accept; + } +} + +control Aux(inout H hdr) { + apply { + } +} + +control IngressI(inout H hdr, inout M meta, in psa_ingress_input_metadata_t istd, inout psa_ingress_output_metadata_t ostd) { + Aux() aux; + apply { + aux.apply(hdr); + aux.apply(hdr); + } +} + +control egressControlImpl(inout EMPTY_H hdr, inout M meta, in psa_egress_input_metadata_t x, inout psa_egress_output_metadata_t ostd) { + apply { + } +} + +control DeparserI(packet_out b, out EMPTY_CLONE clone_i2e_meta, out EMPTY_RESUB resubmit_meta, out EMPTY_BRIDGE normal_meta, inout H h, in M local_metadata, in psa_ingress_output_metadata_t istd) { + apply { + } +} + +control egressDeparserImpl(packet_out buffer, out EMPTY_CLONE a, out EMPTY_RECIRC b, inout EMPTY_H c, in M d, in psa_egress_output_metadata_t e, in psa_egress_deparser_input_metadata_t f) { + apply { + } +} + +IngressPipeline(ParserI(), IngressI(), DeparserI()) ip; + +EgressPipeline(egressParserImpl(), egressControlImpl(), egressDeparserImpl()) ep; + +PSA_Switch(ip, PacketReplicationEngine(), ep, BufferingQueueingEngine()) main; + diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-inline-stack.p4-error b/testdata/p4_16_samples_outputs/psa-dpdk-inline-stack.p4-error new file mode 100644 index 00000000000..e69de29bb2d diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-inline-stack.p4-stderr b/testdata/p4_16_samples_outputs/psa-dpdk-inline-stack.p4-stderr new file mode 100644 index 00000000000..e69de29bb2d diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-inline-stack.p4.bfrt.json b/testdata/p4_16_samples_outputs/psa-dpdk-inline-stack.p4.bfrt.json new file mode 100644 index 00000000000..b6d66a630db --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-inline-stack.p4.bfrt.json @@ -0,0 +1,5 @@ +{ + "schema_version" : "1.0.0", + "tables" : [], + "learn_filters" : [] +} \ No newline at end of file diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-inline-stack.p4.entries.txt b/testdata/p4_16_samples_outputs/psa-dpdk-inline-stack.p4.entries.txt new file mode 100644 index 00000000000..e69de29bb2d diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-inline-stack.p4.p4info.txt b/testdata/p4_16_samples_outputs/psa-dpdk-inline-stack.p4.p4info.txt new file mode 100644 index 00000000000..77612386454 --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-inline-stack.p4.p4info.txt @@ -0,0 +1,3 @@ +pkg_info { + arch: "psa" +} diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-inline-stack.p4.spec b/testdata/p4_16_samples_outputs/psa-dpdk-inline-stack.p4.spec new file mode 100644 index 00000000000..86a4fc7bbf6 --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-inline-stack.p4.spec @@ -0,0 +1,44 @@ + +struct h_t { + bit<8> f +} + +struct psa_ingress_output_metadata_t { + bit<8> class_of_service + bit<8> clone + bit<16> clone_session_id + bit<8> drop + bit<8> resubmit + bit<32> multicast_group + bit<32> egress_port +} + +struct psa_egress_output_metadata_t { + bit<8> clone + bit<16> clone_session_id + bit<8> drop +} + +struct psa_egress_deparser_input_metadata_t { + bit<32> egress_port +} + +header stack_0 instanceof h_t + + +struct M { + bit<32> psa_ingress_input_metadata_ingress_port + bit<8> psa_ingress_output_metadata_drop + bit<32> psa_ingress_output_metadata_egress_port +} +metadata instanceof M + +apply { + rx m.psa_ingress_input_metadata_ingress_port + mov m.psa_ingress_output_metadata_drop 0x0 + jmpneq LABEL_DROP m.psa_ingress_output_metadata_drop 0x0 + tx m.psa_ingress_output_metadata_egress_port + LABEL_DROP : drop +} + + diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-issue1630-bmv2-first.p4 b/testdata/p4_16_samples_outputs/psa-dpdk-issue1630-bmv2-first.p4 new file mode 100644 index 00000000000..249f48f879e --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-issue1630-bmv2-first.p4 @@ -0,0 +1,130 @@ +#include +#include + +header EMPTY_H { +} + +struct EMPTY_RESUB { +} + +struct EMPTY_CLONE { +} + +struct EMPTY_BRIDGE { +} + +struct EMPTY_RECIRC { +} + +const bit<16> TYPE_IPV4 = 16w0x800; +typedef bit<9> egressSpec_t; +typedef bit<48> macAddr_t; +typedef bit<32> ip4Addr_t; +header ethernet_t { + macAddr_t dstAddr; + macAddr_t srcAddr; + bit<16> etherType; +} + +header ipv4_t { + bit<4> version; + bit<4> ihl; + bit<8> diffserv; + bit<16> totalLen; + bit<16> identification; + bit<3> flags; + bit<13> fragOffset; + bit<8> ttl; + bit<8> protocol; + bit<16> hdrChecksum; + ip4Addr_t srcAddr; + ip4Addr_t dstAddr; +} + +struct metadata { +} + +struct headers { + ethernet_t ethernet; + ipv4_t ipv4; +} + +parser MyParser(packet_in packet, out headers hdr, inout metadata meta, in psa_ingress_parser_input_metadata_t x, in EMPTY_RESUB resub_meta, in EMPTY_RECIRC recirc_meta) { + state start { + packet.extract(hdr.ethernet); + transition select(hdr.ethernet.etherType) { + 16w0x800: ipv4; + default: accept; + } + } + state ipv4 { + packet.extract(hdr.ipv4); + transition accept; + } +} + +parser egressParserImpl(packet_in buffer, out EMPTY_H a, inout metadata b, in psa_egress_parser_input_metadata_t c, in EMPTY_BRIDGE d, in EMPTY_CLONE e, in EMPTY_CLONE f) { + state start { + transition accept; + } +} + +control MyIngress(inout headers hdr, inout metadata meta, in psa_ingress_input_metadata_t istd, inout psa_ingress_output_metadata_t ostd) { + action drop() { + ingress_drop(ostd); + } + action ipv4_forward(macAddr_t dstAddr, PortIdUint_t port) { + hdr.ethernet.srcAddr = hdr.ethernet.dstAddr; + hdr.ethernet.dstAddr = dstAddr; + ostd.egress_port = (PortId_t)port; + hdr.ipv4.ttl = hdr.ipv4.ttl + 8w255; + hdr.ipv4.hdrChecksum = 16w1; + } + table ipv4_lpm { + key = { + hdr.ipv4.dstAddr: lpm @name("hdr.ipv4.dstAddr") ; + } + actions = { + ipv4_forward(); + drop(); + NoAction(); + } + size = 1024; + default_action = NoAction(); + } + apply { + if (hdr.ipv4.isValid()) { + ipv4_lpm.apply(); + } + } +} + +control egressControlImpl(inout EMPTY_H hdr, inout metadata meta, in psa_egress_input_metadata_t x, inout psa_egress_output_metadata_t ostd) { + apply { + } +} + +control MyDeparser(packet_out packet, out EMPTY_CLONE clone_i2e_meta, out EMPTY_RESUB resubmit_meta, out EMPTY_BRIDGE normal_meta, inout headers hdr, in metadata local_metadata, in psa_ingress_output_metadata_t istd) { + InternetChecksum() ck; + apply { + ck.clear(); + ck.add, bit<4>, bit<8>, bit<16>, bit<16>, bit<3>, bit<13>, bit<8>, bit<8>, bit<32>, bit<32>>>({ hdr.ipv4.version, hdr.ipv4.ihl, hdr.ipv4.diffserv, hdr.ipv4.totalLen, hdr.ipv4.identification, hdr.ipv4.flags, hdr.ipv4.fragOffset, hdr.ipv4.ttl, hdr.ipv4.protocol, hdr.ipv4.srcAddr, hdr.ipv4.dstAddr }); + hdr.ipv4.hdrChecksum = ck.get(); + ck.clear(); + ck.add>>({ hdr.ipv4.srcAddr }); + packet.emit(hdr.ethernet); + packet.emit(hdr.ipv4); + } +} + +control egressDeparserImpl(packet_out buffer, out EMPTY_CLONE a, out EMPTY_RECIRC b, inout EMPTY_H c, in metadata d, in psa_egress_output_metadata_t e, in psa_egress_deparser_input_metadata_t f) { + apply { + } +} + +IngressPipeline(MyParser(), MyIngress(), MyDeparser()) ip; + +EgressPipeline(egressParserImpl(), egressControlImpl(), egressDeparserImpl()) ep; + +PSA_Switch(ip, PacketReplicationEngine(), ep, BufferingQueueingEngine()) main; + diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-issue1630-bmv2-frontend.p4 b/testdata/p4_16_samples_outputs/psa-dpdk-issue1630-bmv2-frontend.p4 new file mode 100644 index 00000000000..fe0e12a08aa --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-issue1630-bmv2-frontend.p4 @@ -0,0 +1,133 @@ +#include +#include + +header EMPTY_H { +} + +struct EMPTY_RESUB { +} + +struct EMPTY_CLONE { +} + +struct EMPTY_BRIDGE { +} + +struct EMPTY_RECIRC { +} + +typedef bit<48> macAddr_t; +typedef bit<32> ip4Addr_t; +header ethernet_t { + macAddr_t dstAddr; + macAddr_t srcAddr; + bit<16> etherType; +} + +header ipv4_t { + bit<4> version; + bit<4> ihl; + bit<8> diffserv; + bit<16> totalLen; + bit<16> identification; + bit<3> flags; + bit<13> fragOffset; + bit<8> ttl; + bit<8> protocol; + bit<16> hdrChecksum; + ip4Addr_t srcAddr; + ip4Addr_t dstAddr; +} + +struct metadata { +} + +struct headers { + ethernet_t ethernet; + ipv4_t ipv4; +} + +parser MyParser(packet_in packet, out headers hdr, inout metadata meta, in psa_ingress_parser_input_metadata_t x, in EMPTY_RESUB resub_meta, in EMPTY_RECIRC recirc_meta) { + state start { + packet.extract(hdr.ethernet); + transition select(hdr.ethernet.etherType) { + 16w0x800: ipv4; + default: accept; + } + } + state ipv4 { + packet.extract(hdr.ipv4); + transition accept; + } +} + +parser egressParserImpl(packet_in buffer, out EMPTY_H a, inout metadata b, in psa_egress_parser_input_metadata_t c, in EMPTY_BRIDGE d, in EMPTY_CLONE e, in EMPTY_CLONE f) { + state start { + transition accept; + } +} + +control MyIngress(inout headers hdr, inout metadata meta, in psa_ingress_input_metadata_t istd, inout psa_ingress_output_metadata_t ostd) { + @name("MyIngress.meta") psa_ingress_output_metadata_t meta_1; + @noWarn("unused") @name(".NoAction") action NoAction_1() { + } + @name("MyIngress.drop") action drop_1() { + meta_1 = ostd; + meta_1.drop = true; + ostd = meta_1; + } + @name("MyIngress.ipv4_forward") action ipv4_forward(@name("dstAddr") macAddr_t dstAddr_1, @name("port") PortIdUint_t port) { + hdr.ethernet.srcAddr = hdr.ethernet.dstAddr; + hdr.ethernet.dstAddr = dstAddr_1; + ostd.egress_port = (PortId_t)port; + hdr.ipv4.ttl = hdr.ipv4.ttl + 8w255; + hdr.ipv4.hdrChecksum = 16w1; + } + @name("MyIngress.ipv4_lpm") table ipv4_lpm_0 { + key = { + hdr.ipv4.dstAddr: lpm @name("hdr.ipv4.dstAddr") ; + } + actions = { + ipv4_forward(); + drop_1(); + NoAction_1(); + } + size = 1024; + default_action = NoAction_1(); + } + apply { + if (hdr.ipv4.isValid()) { + ipv4_lpm_0.apply(); + } + } +} + +control egressControlImpl(inout EMPTY_H hdr, inout metadata meta, in psa_egress_input_metadata_t x, inout psa_egress_output_metadata_t ostd) { + apply { + } +} + +control MyDeparser(packet_out packet, out EMPTY_CLONE clone_i2e_meta, out EMPTY_RESUB resubmit_meta, out EMPTY_BRIDGE normal_meta, inout headers hdr, in metadata local_metadata, in psa_ingress_output_metadata_t istd) { + @name("MyDeparser.ck") InternetChecksum() ck_0; + apply { + ck_0.clear(); + ck_0.add, bit<4>, bit<8>, bit<16>, bit<16>, bit<3>, bit<13>, bit<8>, bit<8>, bit<32>, bit<32>>>({ hdr.ipv4.version, hdr.ipv4.ihl, hdr.ipv4.diffserv, hdr.ipv4.totalLen, hdr.ipv4.identification, hdr.ipv4.flags, hdr.ipv4.fragOffset, hdr.ipv4.ttl, hdr.ipv4.protocol, hdr.ipv4.srcAddr, hdr.ipv4.dstAddr }); + hdr.ipv4.hdrChecksum = ck_0.get(); + ck_0.clear(); + ck_0.add>>({ hdr.ipv4.srcAddr }); + packet.emit(hdr.ethernet); + packet.emit(hdr.ipv4); + } +} + +control egressDeparserImpl(packet_out buffer, out EMPTY_CLONE a, out EMPTY_RECIRC b, inout EMPTY_H c, in metadata d, in psa_egress_output_metadata_t e, in psa_egress_deparser_input_metadata_t f) { + apply { + } +} + +IngressPipeline(MyParser(), MyIngress(), MyDeparser()) ip; + +EgressPipeline(egressParserImpl(), egressControlImpl(), egressDeparserImpl()) ep; + +PSA_Switch(ip, PacketReplicationEngine(), ep, BufferingQueueingEngine()) main; + diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-issue1630-bmv2-midend.p4 b/testdata/p4_16_samples_outputs/psa-dpdk-issue1630-bmv2-midend.p4 new file mode 100644 index 00000000000..17e33389b69 --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-issue1630-bmv2-midend.p4 @@ -0,0 +1,157 @@ +#include +#include + +header EMPTY_H { +} + +struct EMPTY_RESUB { +} + +struct EMPTY_CLONE { +} + +struct EMPTY_BRIDGE { +} + +struct EMPTY_RECIRC { +} + +typedef bit<48> macAddr_t; +typedef bit<32> ip4Addr_t; +header ethernet_t { + macAddr_t dstAddr; + macAddr_t srcAddr; + bit<16> etherType; +} + +header ipv4_t { + bit<4> version; + bit<4> ihl; + bit<8> diffserv; + bit<16> totalLen; + bit<16> identification; + bit<3> flags; + bit<13> fragOffset; + bit<8> ttl; + bit<8> protocol; + bit<16> hdrChecksum; + ip4Addr_t srcAddr; + ip4Addr_t dstAddr; +} + +struct metadata { +} + +struct headers { + ethernet_t ethernet; + ipv4_t ipv4; +} + +parser MyParser(packet_in packet, out headers hdr, inout metadata meta, in psa_ingress_parser_input_metadata_t x, in EMPTY_RESUB resub_meta, in EMPTY_RECIRC recirc_meta) { + state start { + packet.extract(hdr.ethernet); + transition select(hdr.ethernet.etherType) { + 16w0x800: ipv4; + default: accept; + } + } + state ipv4 { + packet.extract(hdr.ipv4); + transition accept; + } +} + +parser egressParserImpl(packet_in buffer, out EMPTY_H a, inout metadata b, in psa_egress_parser_input_metadata_t c, in EMPTY_BRIDGE d, in EMPTY_CLONE e, in EMPTY_CLONE f) { + state start { + transition accept; + } +} + +control MyIngress(inout headers hdr, inout metadata meta, in psa_ingress_input_metadata_t istd, inout psa_ingress_output_metadata_t ostd) { + @noWarn("unused") @name(".NoAction") action NoAction_1() { + } + @name("MyIngress.drop") action drop_1() { + ostd.drop = true; + } + @name("MyIngress.ipv4_forward") action ipv4_forward(@name("dstAddr") macAddr_t dstAddr_1, @name("port") PortIdUint_t port) { + hdr.ethernet.srcAddr = hdr.ethernet.dstAddr; + hdr.ethernet.dstAddr = dstAddr_1; + ostd.egress_port = port; + hdr.ipv4.ttl = hdr.ipv4.ttl + 8w255; + hdr.ipv4.hdrChecksum = 16w1; + } + @name("MyIngress.ipv4_lpm") table ipv4_lpm_0 { + key = { + hdr.ipv4.dstAddr: lpm @name("hdr.ipv4.dstAddr") ; + } + actions = { + ipv4_forward(); + drop_1(); + NoAction_1(); + } + size = 1024; + default_action = NoAction_1(); + } + apply { + if (hdr.ipv4.isValid()) { + ipv4_lpm_0.apply(); + } + } +} + +control egressControlImpl(inout EMPTY_H hdr, inout metadata meta, in psa_egress_input_metadata_t x, inout psa_egress_output_metadata_t ostd) { + apply { + } +} + +struct tuple_0 { + bit<4> f0; + bit<4> f1; + bit<8> f2; + bit<16> f3; + bit<16> f4; + bit<3> f5; + bit<13> f6; + bit<8> f7; + bit<8> f8; + bit<32> f9; + bit<32> f10; +} + +struct tuple_1 { + bit<32> f0; +} + +control MyDeparser(packet_out packet, out EMPTY_CLONE clone_i2e_meta, out EMPTY_RESUB resubmit_meta, out EMPTY_BRIDGE normal_meta, inout headers hdr, in metadata local_metadata, in psa_ingress_output_metadata_t istd) { + @name("MyDeparser.ck") InternetChecksum() ck_0; + @hidden action psadpdkissue1630bmv2l179() { + ck_0.clear(); + ck_0.add((tuple_0){f0 = hdr.ipv4.version,f1 = hdr.ipv4.ihl,f2 = hdr.ipv4.diffserv,f3 = hdr.ipv4.totalLen,f4 = hdr.ipv4.identification,f5 = hdr.ipv4.flags,f6 = hdr.ipv4.fragOffset,f7 = hdr.ipv4.ttl,f8 = hdr.ipv4.protocol,f9 = hdr.ipv4.srcAddr,f10 = hdr.ipv4.dstAddr}); + hdr.ipv4.hdrChecksum = ck_0.get(); + ck_0.clear(); + ck_0.add((tuple_1){f0 = hdr.ipv4.srcAddr}); + packet.emit(hdr.ethernet); + packet.emit(hdr.ipv4); + } + @hidden table tbl_psadpdkissue1630bmv2l179 { + actions = { + psadpdkissue1630bmv2l179(); + } + const default_action = psadpdkissue1630bmv2l179(); + } + apply { + tbl_psadpdkissue1630bmv2l179.apply(); + } +} + +control egressDeparserImpl(packet_out buffer, out EMPTY_CLONE a, out EMPTY_RECIRC b, inout EMPTY_H c, in metadata d, in psa_egress_output_metadata_t e, in psa_egress_deparser_input_metadata_t f) { + apply { + } +} + +IngressPipeline(MyParser(), MyIngress(), MyDeparser()) ip; + +EgressPipeline(egressParserImpl(), egressControlImpl(), egressDeparserImpl()) ep; + +PSA_Switch(ip, PacketReplicationEngine(), ep, BufferingQueueingEngine()) main; + diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-issue1630-bmv2.p4 b/testdata/p4_16_samples_outputs/psa-dpdk-issue1630-bmv2.p4 new file mode 100644 index 00000000000..a61aceabbd6 --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-issue1630-bmv2.p4 @@ -0,0 +1,130 @@ +#include +#include + +header EMPTY_H { +} + +struct EMPTY_RESUB { +} + +struct EMPTY_CLONE { +} + +struct EMPTY_BRIDGE { +} + +struct EMPTY_RECIRC { +} + +const bit<16> TYPE_IPV4 = 0x800; +typedef bit<9> egressSpec_t; +typedef bit<48> macAddr_t; +typedef bit<32> ip4Addr_t; +header ethernet_t { + macAddr_t dstAddr; + macAddr_t srcAddr; + bit<16> etherType; +} + +header ipv4_t { + bit<4> version; + bit<4> ihl; + bit<8> diffserv; + bit<16> totalLen; + bit<16> identification; + bit<3> flags; + bit<13> fragOffset; + bit<8> ttl; + bit<8> protocol; + bit<16> hdrChecksum; + ip4Addr_t srcAddr; + ip4Addr_t dstAddr; +} + +struct metadata { +} + +struct headers { + ethernet_t ethernet; + ipv4_t ipv4; +} + +parser MyParser(packet_in packet, out headers hdr, inout metadata meta, in psa_ingress_parser_input_metadata_t x, in EMPTY_RESUB resub_meta, in EMPTY_RECIRC recirc_meta) { + state start { + packet.extract(hdr.ethernet); + transition select(hdr.ethernet.etherType) { + TYPE_IPV4: ipv4; + default: accept; + } + } + state ipv4 { + packet.extract(hdr.ipv4); + transition accept; + } +} + +parser egressParserImpl(packet_in buffer, out EMPTY_H a, inout metadata b, in psa_egress_parser_input_metadata_t c, in EMPTY_BRIDGE d, in EMPTY_CLONE e, in EMPTY_CLONE f) { + state start { + transition accept; + } +} + +control MyIngress(inout headers hdr, inout metadata meta, in psa_ingress_input_metadata_t istd, inout psa_ingress_output_metadata_t ostd) { + action drop() { + ingress_drop(ostd); + } + action ipv4_forward(macAddr_t dstAddr, PortIdUint_t port) { + hdr.ethernet.srcAddr = hdr.ethernet.dstAddr; + hdr.ethernet.dstAddr = dstAddr; + ostd.egress_port = (PortId_t)(PortIdUint_t)port; + hdr.ipv4.ttl = hdr.ipv4.ttl - 1; + hdr.ipv4.hdrChecksum = 1; + } + table ipv4_lpm { + key = { + hdr.ipv4.dstAddr: lpm; + } + actions = { + ipv4_forward; + drop; + NoAction; + } + size = 1024; + default_action = NoAction(); + } + apply { + if (hdr.ipv4.isValid()) { + ipv4_lpm.apply(); + } + } +} + +control egressControlImpl(inout EMPTY_H hdr, inout metadata meta, in psa_egress_input_metadata_t x, inout psa_egress_output_metadata_t ostd) { + apply { + } +} + +control MyDeparser(packet_out packet, out EMPTY_CLONE clone_i2e_meta, out EMPTY_RESUB resubmit_meta, out EMPTY_BRIDGE normal_meta, inout headers hdr, in metadata local_metadata, in psa_ingress_output_metadata_t istd) { + InternetChecksum() ck; + apply { + ck.clear(); + ck.add({ hdr.ipv4.version, hdr.ipv4.ihl, hdr.ipv4.diffserv, hdr.ipv4.totalLen, hdr.ipv4.identification, hdr.ipv4.flags, hdr.ipv4.fragOffset, hdr.ipv4.ttl, hdr.ipv4.protocol, hdr.ipv4.srcAddr, hdr.ipv4.dstAddr }); + hdr.ipv4.hdrChecksum = ck.get(); + ck.clear(); + ck.add({ hdr.ipv4.srcAddr }); + packet.emit(hdr.ethernet); + packet.emit(hdr.ipv4); + } +} + +control egressDeparserImpl(packet_out buffer, out EMPTY_CLONE a, out EMPTY_RECIRC b, inout EMPTY_H c, in metadata d, in psa_egress_output_metadata_t e, in psa_egress_deparser_input_metadata_t f) { + apply { + } +} + +IngressPipeline(MyParser(), MyIngress(), MyDeparser()) ip; + +EgressPipeline(egressParserImpl(), egressControlImpl(), egressDeparserImpl()) ep; + +PSA_Switch(ip, PacketReplicationEngine(), ep, BufferingQueueingEngine()) main; + diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-issue1630-bmv2.p4-stderr b/testdata/p4_16_samples_outputs/psa-dpdk-issue1630-bmv2.p4-stderr new file mode 100644 index 00000000000..e69de29bb2d diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-issue1630-bmv2.p4.entries.txt b/testdata/p4_16_samples_outputs/psa-dpdk-issue1630-bmv2.p4.entries.txt new file mode 100644 index 00000000000..e69de29bb2d diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-issue1630-bmv2.p4.p4info.txt b/testdata/p4_16_samples_outputs/psa-dpdk-issue1630-bmv2.p4.p4info.txt new file mode 100644 index 00000000000..3c2a3884122 --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-issue1630-bmv2.p4.p4info.txt @@ -0,0 +1,60 @@ +pkg_info { + arch: "psa" +} +tables { + preamble { + id: 37375156 + name: "MyIngress.ipv4_lpm" + alias: "ipv4_lpm" + } + match_fields { + id: 1 + name: "hdr.ipv4.dstAddr" + bitwidth: 32 + match_type: LPM + } + action_refs { + id: 28792405 + } + action_refs { + id: 25652968 + } + action_refs { + id: 21257015 + } + size: 1024 +} +actions { + preamble { + id: 21257015 + name: "NoAction" + alias: "NoAction" + annotations: "@noWarn(\"unused\")" + } +} +actions { + preamble { + id: 25652968 + name: "MyIngress.drop" + alias: "drop" + } +} +actions { + preamble { + id: 28792405 + name: "MyIngress.ipv4_forward" + alias: "ipv4_forward" + } + params { + id: 1 + name: "dstAddr" + bitwidth: 48 + } + params { + id: 2 + name: "port" + bitwidth: 32 + } +} +type_info { +} diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-issue1630-first.p4 b/testdata/p4_16_samples_outputs/psa-dpdk-issue1630-first.p4 new file mode 100644 index 00000000000..249f48f879e --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-issue1630-first.p4 @@ -0,0 +1,130 @@ +#include +#include + +header EMPTY_H { +} + +struct EMPTY_RESUB { +} + +struct EMPTY_CLONE { +} + +struct EMPTY_BRIDGE { +} + +struct EMPTY_RECIRC { +} + +const bit<16> TYPE_IPV4 = 16w0x800; +typedef bit<9> egressSpec_t; +typedef bit<48> macAddr_t; +typedef bit<32> ip4Addr_t; +header ethernet_t { + macAddr_t dstAddr; + macAddr_t srcAddr; + bit<16> etherType; +} + +header ipv4_t { + bit<4> version; + bit<4> ihl; + bit<8> diffserv; + bit<16> totalLen; + bit<16> identification; + bit<3> flags; + bit<13> fragOffset; + bit<8> ttl; + bit<8> protocol; + bit<16> hdrChecksum; + ip4Addr_t srcAddr; + ip4Addr_t dstAddr; +} + +struct metadata { +} + +struct headers { + ethernet_t ethernet; + ipv4_t ipv4; +} + +parser MyParser(packet_in packet, out headers hdr, inout metadata meta, in psa_ingress_parser_input_metadata_t x, in EMPTY_RESUB resub_meta, in EMPTY_RECIRC recirc_meta) { + state start { + packet.extract(hdr.ethernet); + transition select(hdr.ethernet.etherType) { + 16w0x800: ipv4; + default: accept; + } + } + state ipv4 { + packet.extract(hdr.ipv4); + transition accept; + } +} + +parser egressParserImpl(packet_in buffer, out EMPTY_H a, inout metadata b, in psa_egress_parser_input_metadata_t c, in EMPTY_BRIDGE d, in EMPTY_CLONE e, in EMPTY_CLONE f) { + state start { + transition accept; + } +} + +control MyIngress(inout headers hdr, inout metadata meta, in psa_ingress_input_metadata_t istd, inout psa_ingress_output_metadata_t ostd) { + action drop() { + ingress_drop(ostd); + } + action ipv4_forward(macAddr_t dstAddr, PortIdUint_t port) { + hdr.ethernet.srcAddr = hdr.ethernet.dstAddr; + hdr.ethernet.dstAddr = dstAddr; + ostd.egress_port = (PortId_t)port; + hdr.ipv4.ttl = hdr.ipv4.ttl + 8w255; + hdr.ipv4.hdrChecksum = 16w1; + } + table ipv4_lpm { + key = { + hdr.ipv4.dstAddr: lpm @name("hdr.ipv4.dstAddr") ; + } + actions = { + ipv4_forward(); + drop(); + NoAction(); + } + size = 1024; + default_action = NoAction(); + } + apply { + if (hdr.ipv4.isValid()) { + ipv4_lpm.apply(); + } + } +} + +control egressControlImpl(inout EMPTY_H hdr, inout metadata meta, in psa_egress_input_metadata_t x, inout psa_egress_output_metadata_t ostd) { + apply { + } +} + +control MyDeparser(packet_out packet, out EMPTY_CLONE clone_i2e_meta, out EMPTY_RESUB resubmit_meta, out EMPTY_BRIDGE normal_meta, inout headers hdr, in metadata local_metadata, in psa_ingress_output_metadata_t istd) { + InternetChecksum() ck; + apply { + ck.clear(); + ck.add, bit<4>, bit<8>, bit<16>, bit<16>, bit<3>, bit<13>, bit<8>, bit<8>, bit<32>, bit<32>>>({ hdr.ipv4.version, hdr.ipv4.ihl, hdr.ipv4.diffserv, hdr.ipv4.totalLen, hdr.ipv4.identification, hdr.ipv4.flags, hdr.ipv4.fragOffset, hdr.ipv4.ttl, hdr.ipv4.protocol, hdr.ipv4.srcAddr, hdr.ipv4.dstAddr }); + hdr.ipv4.hdrChecksum = ck.get(); + ck.clear(); + ck.add>>({ hdr.ipv4.srcAddr }); + packet.emit(hdr.ethernet); + packet.emit(hdr.ipv4); + } +} + +control egressDeparserImpl(packet_out buffer, out EMPTY_CLONE a, out EMPTY_RECIRC b, inout EMPTY_H c, in metadata d, in psa_egress_output_metadata_t e, in psa_egress_deparser_input_metadata_t f) { + apply { + } +} + +IngressPipeline(MyParser(), MyIngress(), MyDeparser()) ip; + +EgressPipeline(egressParserImpl(), egressControlImpl(), egressDeparserImpl()) ep; + +PSA_Switch(ip, PacketReplicationEngine(), ep, BufferingQueueingEngine()) main; + diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-issue1630-frontend.p4 b/testdata/p4_16_samples_outputs/psa-dpdk-issue1630-frontend.p4 new file mode 100644 index 00000000000..fe0e12a08aa --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-issue1630-frontend.p4 @@ -0,0 +1,133 @@ +#include +#include + +header EMPTY_H { +} + +struct EMPTY_RESUB { +} + +struct EMPTY_CLONE { +} + +struct EMPTY_BRIDGE { +} + +struct EMPTY_RECIRC { +} + +typedef bit<48> macAddr_t; +typedef bit<32> ip4Addr_t; +header ethernet_t { + macAddr_t dstAddr; + macAddr_t srcAddr; + bit<16> etherType; +} + +header ipv4_t { + bit<4> version; + bit<4> ihl; + bit<8> diffserv; + bit<16> totalLen; + bit<16> identification; + bit<3> flags; + bit<13> fragOffset; + bit<8> ttl; + bit<8> protocol; + bit<16> hdrChecksum; + ip4Addr_t srcAddr; + ip4Addr_t dstAddr; +} + +struct metadata { +} + +struct headers { + ethernet_t ethernet; + ipv4_t ipv4; +} + +parser MyParser(packet_in packet, out headers hdr, inout metadata meta, in psa_ingress_parser_input_metadata_t x, in EMPTY_RESUB resub_meta, in EMPTY_RECIRC recirc_meta) { + state start { + packet.extract(hdr.ethernet); + transition select(hdr.ethernet.etherType) { + 16w0x800: ipv4; + default: accept; + } + } + state ipv4 { + packet.extract(hdr.ipv4); + transition accept; + } +} + +parser egressParserImpl(packet_in buffer, out EMPTY_H a, inout metadata b, in psa_egress_parser_input_metadata_t c, in EMPTY_BRIDGE d, in EMPTY_CLONE e, in EMPTY_CLONE f) { + state start { + transition accept; + } +} + +control MyIngress(inout headers hdr, inout metadata meta, in psa_ingress_input_metadata_t istd, inout psa_ingress_output_metadata_t ostd) { + @name("MyIngress.meta") psa_ingress_output_metadata_t meta_1; + @noWarn("unused") @name(".NoAction") action NoAction_1() { + } + @name("MyIngress.drop") action drop_1() { + meta_1 = ostd; + meta_1.drop = true; + ostd = meta_1; + } + @name("MyIngress.ipv4_forward") action ipv4_forward(@name("dstAddr") macAddr_t dstAddr_1, @name("port") PortIdUint_t port) { + hdr.ethernet.srcAddr = hdr.ethernet.dstAddr; + hdr.ethernet.dstAddr = dstAddr_1; + ostd.egress_port = (PortId_t)port; + hdr.ipv4.ttl = hdr.ipv4.ttl + 8w255; + hdr.ipv4.hdrChecksum = 16w1; + } + @name("MyIngress.ipv4_lpm") table ipv4_lpm_0 { + key = { + hdr.ipv4.dstAddr: lpm @name("hdr.ipv4.dstAddr") ; + } + actions = { + ipv4_forward(); + drop_1(); + NoAction_1(); + } + size = 1024; + default_action = NoAction_1(); + } + apply { + if (hdr.ipv4.isValid()) { + ipv4_lpm_0.apply(); + } + } +} + +control egressControlImpl(inout EMPTY_H hdr, inout metadata meta, in psa_egress_input_metadata_t x, inout psa_egress_output_metadata_t ostd) { + apply { + } +} + +control MyDeparser(packet_out packet, out EMPTY_CLONE clone_i2e_meta, out EMPTY_RESUB resubmit_meta, out EMPTY_BRIDGE normal_meta, inout headers hdr, in metadata local_metadata, in psa_ingress_output_metadata_t istd) { + @name("MyDeparser.ck") InternetChecksum() ck_0; + apply { + ck_0.clear(); + ck_0.add, bit<4>, bit<8>, bit<16>, bit<16>, bit<3>, bit<13>, bit<8>, bit<8>, bit<32>, bit<32>>>({ hdr.ipv4.version, hdr.ipv4.ihl, hdr.ipv4.diffserv, hdr.ipv4.totalLen, hdr.ipv4.identification, hdr.ipv4.flags, hdr.ipv4.fragOffset, hdr.ipv4.ttl, hdr.ipv4.protocol, hdr.ipv4.srcAddr, hdr.ipv4.dstAddr }); + hdr.ipv4.hdrChecksum = ck_0.get(); + ck_0.clear(); + ck_0.add>>({ hdr.ipv4.srcAddr }); + packet.emit(hdr.ethernet); + packet.emit(hdr.ipv4); + } +} + +control egressDeparserImpl(packet_out buffer, out EMPTY_CLONE a, out EMPTY_RECIRC b, inout EMPTY_H c, in metadata d, in psa_egress_output_metadata_t e, in psa_egress_deparser_input_metadata_t f) { + apply { + } +} + +IngressPipeline(MyParser(), MyIngress(), MyDeparser()) ip; + +EgressPipeline(egressParserImpl(), egressControlImpl(), egressDeparserImpl()) ep; + +PSA_Switch(ip, PacketReplicationEngine(), ep, BufferingQueueingEngine()) main; + diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-issue1630-midend.p4 b/testdata/p4_16_samples_outputs/psa-dpdk-issue1630-midend.p4 new file mode 100644 index 00000000000..3e2c8749d85 --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-issue1630-midend.p4 @@ -0,0 +1,157 @@ +#include +#include + +header EMPTY_H { +} + +struct EMPTY_RESUB { +} + +struct EMPTY_CLONE { +} + +struct EMPTY_BRIDGE { +} + +struct EMPTY_RECIRC { +} + +typedef bit<48> macAddr_t; +typedef bit<32> ip4Addr_t; +header ethernet_t { + macAddr_t dstAddr; + macAddr_t srcAddr; + bit<16> etherType; +} + +header ipv4_t { + bit<4> version; + bit<4> ihl; + bit<8> diffserv; + bit<16> totalLen; + bit<16> identification; + bit<3> flags; + bit<13> fragOffset; + bit<8> ttl; + bit<8> protocol; + bit<16> hdrChecksum; + ip4Addr_t srcAddr; + ip4Addr_t dstAddr; +} + +struct metadata { +} + +struct headers { + ethernet_t ethernet; + ipv4_t ipv4; +} + +parser MyParser(packet_in packet, out headers hdr, inout metadata meta, in psa_ingress_parser_input_metadata_t x, in EMPTY_RESUB resub_meta, in EMPTY_RECIRC recirc_meta) { + state start { + packet.extract(hdr.ethernet); + transition select(hdr.ethernet.etherType) { + 16w0x800: ipv4; + default: accept; + } + } + state ipv4 { + packet.extract(hdr.ipv4); + transition accept; + } +} + +parser egressParserImpl(packet_in buffer, out EMPTY_H a, inout metadata b, in psa_egress_parser_input_metadata_t c, in EMPTY_BRIDGE d, in EMPTY_CLONE e, in EMPTY_CLONE f) { + state start { + transition accept; + } +} + +control MyIngress(inout headers hdr, inout metadata meta, in psa_ingress_input_metadata_t istd, inout psa_ingress_output_metadata_t ostd) { + @noWarn("unused") @name(".NoAction") action NoAction_1() { + } + @name("MyIngress.drop") action drop_1() { + ostd.drop = true; + } + @name("MyIngress.ipv4_forward") action ipv4_forward(@name("dstAddr") macAddr_t dstAddr_1, @name("port") PortIdUint_t port) { + hdr.ethernet.srcAddr = hdr.ethernet.dstAddr; + hdr.ethernet.dstAddr = dstAddr_1; + ostd.egress_port = port; + hdr.ipv4.ttl = hdr.ipv4.ttl + 8w255; + hdr.ipv4.hdrChecksum = 16w1; + } + @name("MyIngress.ipv4_lpm") table ipv4_lpm_0 { + key = { + hdr.ipv4.dstAddr: lpm @name("hdr.ipv4.dstAddr") ; + } + actions = { + ipv4_forward(); + drop_1(); + NoAction_1(); + } + size = 1024; + default_action = NoAction_1(); + } + apply { + if (hdr.ipv4.isValid()) { + ipv4_lpm_0.apply(); + } + } +} + +control egressControlImpl(inout EMPTY_H hdr, inout metadata meta, in psa_egress_input_metadata_t x, inout psa_egress_output_metadata_t ostd) { + apply { + } +} + +struct tuple_0 { + bit<4> f0; + bit<4> f1; + bit<8> f2; + bit<16> f3; + bit<16> f4; + bit<3> f5; + bit<13> f6; + bit<8> f7; + bit<8> f8; + bit<32> f9; + bit<32> f10; +} + +struct tuple_1 { + bit<32> f0; +} + +control MyDeparser(packet_out packet, out EMPTY_CLONE clone_i2e_meta, out EMPTY_RESUB resubmit_meta, out EMPTY_BRIDGE normal_meta, inout headers hdr, in metadata local_metadata, in psa_ingress_output_metadata_t istd) { + @name("MyDeparser.ck") InternetChecksum() ck_0; + @hidden action psadpdkissue1630l179() { + ck_0.clear(); + ck_0.add((tuple_0){f0 = hdr.ipv4.version,f1 = hdr.ipv4.ihl,f2 = hdr.ipv4.diffserv,f3 = hdr.ipv4.totalLen,f4 = hdr.ipv4.identification,f5 = hdr.ipv4.flags,f6 = hdr.ipv4.fragOffset,f7 = hdr.ipv4.ttl,f8 = hdr.ipv4.protocol,f9 = hdr.ipv4.srcAddr,f10 = hdr.ipv4.dstAddr}); + hdr.ipv4.hdrChecksum = ck_0.get(); + ck_0.clear(); + ck_0.add((tuple_1){f0 = hdr.ipv4.srcAddr}); + packet.emit(hdr.ethernet); + packet.emit(hdr.ipv4); + } + @hidden table tbl_psadpdkissue1630l179 { + actions = { + psadpdkissue1630l179(); + } + const default_action = psadpdkissue1630l179(); + } + apply { + tbl_psadpdkissue1630l179.apply(); + } +} + +control egressDeparserImpl(packet_out buffer, out EMPTY_CLONE a, out EMPTY_RECIRC b, inout EMPTY_H c, in metadata d, in psa_egress_output_metadata_t e, in psa_egress_deparser_input_metadata_t f) { + apply { + } +} + +IngressPipeline(MyParser(), MyIngress(), MyDeparser()) ip; + +EgressPipeline(egressParserImpl(), egressControlImpl(), egressDeparserImpl()) ep; + +PSA_Switch(ip, PacketReplicationEngine(), ep, BufferingQueueingEngine()) main; + diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-issue1630.p4 b/testdata/p4_16_samples_outputs/psa-dpdk-issue1630.p4 new file mode 100644 index 00000000000..a61aceabbd6 --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-issue1630.p4 @@ -0,0 +1,130 @@ +#include +#include + +header EMPTY_H { +} + +struct EMPTY_RESUB { +} + +struct EMPTY_CLONE { +} + +struct EMPTY_BRIDGE { +} + +struct EMPTY_RECIRC { +} + +const bit<16> TYPE_IPV4 = 0x800; +typedef bit<9> egressSpec_t; +typedef bit<48> macAddr_t; +typedef bit<32> ip4Addr_t; +header ethernet_t { + macAddr_t dstAddr; + macAddr_t srcAddr; + bit<16> etherType; +} + +header ipv4_t { + bit<4> version; + bit<4> ihl; + bit<8> diffserv; + bit<16> totalLen; + bit<16> identification; + bit<3> flags; + bit<13> fragOffset; + bit<8> ttl; + bit<8> protocol; + bit<16> hdrChecksum; + ip4Addr_t srcAddr; + ip4Addr_t dstAddr; +} + +struct metadata { +} + +struct headers { + ethernet_t ethernet; + ipv4_t ipv4; +} + +parser MyParser(packet_in packet, out headers hdr, inout metadata meta, in psa_ingress_parser_input_metadata_t x, in EMPTY_RESUB resub_meta, in EMPTY_RECIRC recirc_meta) { + state start { + packet.extract(hdr.ethernet); + transition select(hdr.ethernet.etherType) { + TYPE_IPV4: ipv4; + default: accept; + } + } + state ipv4 { + packet.extract(hdr.ipv4); + transition accept; + } +} + +parser egressParserImpl(packet_in buffer, out EMPTY_H a, inout metadata b, in psa_egress_parser_input_metadata_t c, in EMPTY_BRIDGE d, in EMPTY_CLONE e, in EMPTY_CLONE f) { + state start { + transition accept; + } +} + +control MyIngress(inout headers hdr, inout metadata meta, in psa_ingress_input_metadata_t istd, inout psa_ingress_output_metadata_t ostd) { + action drop() { + ingress_drop(ostd); + } + action ipv4_forward(macAddr_t dstAddr, PortIdUint_t port) { + hdr.ethernet.srcAddr = hdr.ethernet.dstAddr; + hdr.ethernet.dstAddr = dstAddr; + ostd.egress_port = (PortId_t)(PortIdUint_t)port; + hdr.ipv4.ttl = hdr.ipv4.ttl - 1; + hdr.ipv4.hdrChecksum = 1; + } + table ipv4_lpm { + key = { + hdr.ipv4.dstAddr: lpm; + } + actions = { + ipv4_forward; + drop; + NoAction; + } + size = 1024; + default_action = NoAction(); + } + apply { + if (hdr.ipv4.isValid()) { + ipv4_lpm.apply(); + } + } +} + +control egressControlImpl(inout EMPTY_H hdr, inout metadata meta, in psa_egress_input_metadata_t x, inout psa_egress_output_metadata_t ostd) { + apply { + } +} + +control MyDeparser(packet_out packet, out EMPTY_CLONE clone_i2e_meta, out EMPTY_RESUB resubmit_meta, out EMPTY_BRIDGE normal_meta, inout headers hdr, in metadata local_metadata, in psa_ingress_output_metadata_t istd) { + InternetChecksum() ck; + apply { + ck.clear(); + ck.add({ hdr.ipv4.version, hdr.ipv4.ihl, hdr.ipv4.diffserv, hdr.ipv4.totalLen, hdr.ipv4.identification, hdr.ipv4.flags, hdr.ipv4.fragOffset, hdr.ipv4.ttl, hdr.ipv4.protocol, hdr.ipv4.srcAddr, hdr.ipv4.dstAddr }); + hdr.ipv4.hdrChecksum = ck.get(); + ck.clear(); + ck.add({ hdr.ipv4.srcAddr }); + packet.emit(hdr.ethernet); + packet.emit(hdr.ipv4); + } +} + +control egressDeparserImpl(packet_out buffer, out EMPTY_CLONE a, out EMPTY_RECIRC b, inout EMPTY_H c, in metadata d, in psa_egress_output_metadata_t e, in psa_egress_deparser_input_metadata_t f) { + apply { + } +} + +IngressPipeline(MyParser(), MyIngress(), MyDeparser()) ip; + +EgressPipeline(egressParserImpl(), egressControlImpl(), egressDeparserImpl()) ep; + +PSA_Switch(ip, PacketReplicationEngine(), ep, BufferingQueueingEngine()) main; + diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-issue1630.p4-stderr b/testdata/p4_16_samples_outputs/psa-dpdk-issue1630.p4-stderr new file mode 100644 index 00000000000..e69de29bb2d diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-issue1630.p4.entries.txt b/testdata/p4_16_samples_outputs/psa-dpdk-issue1630.p4.entries.txt new file mode 100644 index 00000000000..e69de29bb2d diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-issue1630.p4.p4info.txt b/testdata/p4_16_samples_outputs/psa-dpdk-issue1630.p4.p4info.txt new file mode 100644 index 00000000000..3c2a3884122 --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-issue1630.p4.p4info.txt @@ -0,0 +1,60 @@ +pkg_info { + arch: "psa" +} +tables { + preamble { + id: 37375156 + name: "MyIngress.ipv4_lpm" + alias: "ipv4_lpm" + } + match_fields { + id: 1 + name: "hdr.ipv4.dstAddr" + bitwidth: 32 + match_type: LPM + } + action_refs { + id: 28792405 + } + action_refs { + id: 25652968 + } + action_refs { + id: 21257015 + } + size: 1024 +} +actions { + preamble { + id: 21257015 + name: "NoAction" + alias: "NoAction" + annotations: "@noWarn(\"unused\")" + } +} +actions { + preamble { + id: 25652968 + name: "MyIngress.drop" + alias: "drop" + } +} +actions { + preamble { + id: 28792405 + name: "MyIngress.ipv4_forward" + alias: "ipv4_forward" + } + params { + id: 1 + name: "dstAddr" + bitwidth: 48 + } + params { + id: 2 + name: "port" + bitwidth: 32 + } +} +type_info { +} diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-issue1653-complex-first.p4 b/testdata/p4_16_samples_outputs/psa-dpdk-issue1653-complex-first.p4 new file mode 100644 index 00000000000..8a912d93021 --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-issue1653-complex-first.p4 @@ -0,0 +1,123 @@ +#include +#include + +header EMPTY_H { +} + +struct EMPTY_RESUB { +} + +struct EMPTY_CLONE { +} + +struct EMPTY_BRIDGE { +} + +struct EMPTY_RECIRC { +} + +enum bit<16> EthTypes { + IPv4 = 16w0x800, + ARP = 16w0x806, + RARP = 16w0x8035, + EtherTalk = 16w0x809b, + VLAN = 16w0x8100, + IPX = 16w0x8137, + IPv6 = 16w0x86dd +} + +struct alt_t { + bit<1> valid; + bit<7> port; + int<8> hashRes; + bool useHash; + EthTypes type; + bit<7> pad; +} + +struct row_t { + alt_t alt0; + alt_t alt1; +} + +header bitvec_hdr { + row_t row; +} + +struct local_metadata_t { + @field_list(0) + row_t row0; + row_t row1; + bitvec_hdr bvh0; + bitvec_hdr bvh1; +} + +struct parsed_packet_t { + bitvec_hdr bvh0; + bitvec_hdr bvh1; +} + +parser parse(packet_in pk, out parsed_packet_t h, inout local_metadata_t local_metadata, in psa_ingress_parser_input_metadata_t x, in EMPTY_RESUB resub_meta, in EMPTY_RECIRC recirc_meta) { + state start { + pk.extract(h.bvh0); + pk.extract(h.bvh1); + transition accept; + } +} + +parser egressParserImpl(packet_in buffer, out EMPTY_H a, inout local_metadata_t b, in psa_egress_parser_input_metadata_t c, in EMPTY_BRIDGE d, in EMPTY_CLONE e, in EMPTY_CLONE f) { + state start { + transition accept; + } +} + +control ingress(inout parsed_packet_t h, inout local_metadata_t local_metadata, in psa_ingress_input_metadata_t istd, inout psa_ingress_output_metadata_t ostd) { + bitvec_hdr bh; + action do_act() { + h.bvh1.row.alt1.valid = 1w0; + local_metadata.row0.alt0.valid = 1w0; + } + table tns { + key = { + h.bvh1.row.alt1.valid : exact @name("h.bvh1.row.alt1.valid") ; + local_metadata.row0.alt0.valid: exact @name("local_metadata.row0.alt0.valid") ; + } + actions = { + do_act(); + @defaultonly NoAction(); + } + default_action = NoAction(); + } + apply { + tns.apply(); + bh.row.alt0.useHash = h.bvh0.row.alt0.useHash; + bh.row.alt1.type = EthTypes.IPv4; + h.bvh0.row.alt1.type = bh.row.alt1.type; + local_metadata.row0.alt0.useHash = true; + psa_clone_i2e(ostd); + } +} + +control egressControlImpl(inout EMPTY_H hdr, inout local_metadata_t meta, in psa_egress_input_metadata_t x, inout psa_egress_output_metadata_t ostd) { + apply { + } +} + +control deparser(packet_out b, out EMPTY_CLONE clone_i2e_meta, out EMPTY_RESUB resubmit_meta, out EMPTY_BRIDGE normal_meta, inout parsed_packet_t h, in local_metadata_t local_metadata, in psa_ingress_output_metadata_t istd) { + apply { + b.emit(h.bvh0); + b.emit(h.bvh1); + } +} + +control egressDeparserImpl(packet_out buffer, out EMPTY_CLONE a, out EMPTY_RECIRC b, inout EMPTY_H c, in local_metadata_t d, in psa_egress_output_metadata_t e, in psa_egress_deparser_input_metadata_t f) { + apply { + } +} + +IngressPipeline(parse(), ingress(), deparser()) ip; + +EgressPipeline(egressParserImpl(), egressControlImpl(), egressDeparserImpl()) ep; + +PSA_Switch(ip, PacketReplicationEngine(), ep, BufferingQueueingEngine()) main; + diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-issue1653-complex-frontend.p4 b/testdata/p4_16_samples_outputs/psa-dpdk-issue1653-complex-frontend.p4 new file mode 100644 index 00000000000..e63d43c2b73 --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-issue1653-complex-frontend.p4 @@ -0,0 +1,125 @@ +#include +#include + +header EMPTY_H { +} + +struct EMPTY_RESUB { +} + +struct EMPTY_CLONE { +} + +struct EMPTY_BRIDGE { +} + +struct EMPTY_RECIRC { +} + +enum bit<16> EthTypes { + IPv4 = 16w0x800, + ARP = 16w0x806, + RARP = 16w0x8035, + EtherTalk = 16w0x809b, + VLAN = 16w0x8100, + IPX = 16w0x8137, + IPv6 = 16w0x86dd +} + +struct alt_t { + bit<1> valid; + bit<7> port; + int<8> hashRes; + bool useHash; + EthTypes type; + bit<7> pad; +} + +struct row_t { + alt_t alt0; + alt_t alt1; +} + +header bitvec_hdr { + row_t row; +} + +struct local_metadata_t { + @field_list(0) + row_t row0; + row_t row1; + bitvec_hdr bvh0; + bitvec_hdr bvh1; +} + +struct parsed_packet_t { + bitvec_hdr bvh0; + bitvec_hdr bvh1; +} + +parser parse(packet_in pk, out parsed_packet_t h, inout local_metadata_t local_metadata, in psa_ingress_parser_input_metadata_t x, in EMPTY_RESUB resub_meta, in EMPTY_RECIRC recirc_meta) { + state start { + pk.extract(h.bvh0); + pk.extract(h.bvh1); + transition accept; + } +} + +parser egressParserImpl(packet_in buffer, out EMPTY_H a, inout local_metadata_t b, in psa_egress_parser_input_metadata_t c, in EMPTY_BRIDGE d, in EMPTY_CLONE e, in EMPTY_CLONE f) { + state start { + transition accept; + } +} + +control ingress(inout parsed_packet_t h, inout local_metadata_t local_metadata, in psa_ingress_input_metadata_t istd, inout psa_ingress_output_metadata_t ostd) { + @name("ingress.bh") bitvec_hdr bh_0; + @noWarn("unused") @name(".NoAction") action NoAction_1() { + } + @name("ingress.do_act") action do_act() { + h.bvh1.row.alt1.valid = 1w0; + local_metadata.row0.alt0.valid = 1w0; + } + @name("ingress.tns") table tns_0 { + key = { + h.bvh1.row.alt1.valid : exact @name("h.bvh1.row.alt1.valid") ; + local_metadata.row0.alt0.valid: exact @name("local_metadata.row0.alt0.valid") ; + } + actions = { + do_act(); + @defaultonly NoAction_1(); + } + default_action = NoAction_1(); + } + apply { + bh_0.setInvalid(); + tns_0.apply(); + bh_0.row.alt1.type = EthTypes.IPv4; + h.bvh0.row.alt1.type = bh_0.row.alt1.type; + local_metadata.row0.alt0.useHash = true; + psa_clone_i2e(ostd); + } +} + +control egressControlImpl(inout EMPTY_H hdr, inout local_metadata_t meta, in psa_egress_input_metadata_t x, inout psa_egress_output_metadata_t ostd) { + apply { + } +} + +control deparser(packet_out b, out EMPTY_CLONE clone_i2e_meta, out EMPTY_RESUB resubmit_meta, out EMPTY_BRIDGE normal_meta, inout parsed_packet_t h, in local_metadata_t local_metadata, in psa_ingress_output_metadata_t istd) { + apply { + b.emit(h.bvh0); + b.emit(h.bvh1); + } +} + +control egressDeparserImpl(packet_out buffer, out EMPTY_CLONE a, out EMPTY_RECIRC b, inout EMPTY_H c, in local_metadata_t d, in psa_egress_output_metadata_t e, in psa_egress_deparser_input_metadata_t f) { + apply { + } +} + +IngressPipeline(parse(), ingress(), deparser()) ip; + +EgressPipeline(egressParserImpl(), egressControlImpl(), egressDeparserImpl()) ep; + +PSA_Switch(ip, PacketReplicationEngine(), ep, BufferingQueueingEngine()) main; + diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-issue1653-complex-midend.p4 b/testdata/p4_16_samples_outputs/psa-dpdk-issue1653-complex-midend.p4 new file mode 100644 index 00000000000..f3ab2ca29e4 --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-issue1653-complex-midend.p4 @@ -0,0 +1,186 @@ +#include +#include + +header EMPTY_H { +} + +struct EMPTY_RESUB { +} + +struct EMPTY_CLONE { +} + +struct EMPTY_BRIDGE { +} + +struct EMPTY_RECIRC { +} + +struct alt_t { + bit<1> valid; + bit<7> port; + int<8> hashRes; + bool useHash; + bit<16> type; + bit<7> pad; +} + +struct row_t { + alt_t alt0; + alt_t alt1; +} + +header bitvec_hdr { + bit<1> _row_alt0_valid0; + bit<7> _row_alt0_port1; + int<8> _row_alt0_hashRes2; + bool _row_alt0_useHash3; + bit<16> _row_alt0_type4; + bit<7> _row_alt0_pad5; + bit<1> _row_alt1_valid6; + bit<7> _row_alt1_port7; + int<8> _row_alt1_hashRes8; + bool _row_alt1_useHash9; + bit<16> _row_alt1_type10; + bit<7> _row_alt1_pad11; +} + +struct local_metadata_t { + @field_list(0) + bit<1> _row0_alt0_valid0; + @field_list(0) + bit<7> _row0_alt0_port1; + @field_list(0) + int<8> _row0_alt0_hashRes2; + @field_list(0) + bool _row0_alt0_useHash3; + @field_list(0) + bit<16> _row0_alt0_type4; + @field_list(0) + bit<7> _row0_alt0_pad5; + @field_list(0) + bit<1> _row0_alt1_valid6; + @field_list(0) + bit<7> _row0_alt1_port7; + @field_list(0) + int<8> _row0_alt1_hashRes8; + @field_list(0) + bool _row0_alt1_useHash9; + @field_list(0) + bit<16> _row0_alt1_type10; + @field_list(0) + bit<7> _row0_alt1_pad11; + bit<1> _row1_alt0_valid12; + bit<7> _row1_alt0_port13; + int<8> _row1_alt0_hashRes14; + bool _row1_alt0_useHash15; + bit<16> _row1_alt0_type16; + bit<7> _row1_alt0_pad17; + bit<1> _row1_alt1_valid18; + bit<7> _row1_alt1_port19; + int<8> _row1_alt1_hashRes20; + bool _row1_alt1_useHash21; + bit<16> _row1_alt1_type22; + bit<7> _row1_alt1_pad23; + bitvec_hdr _bvh024; + bitvec_hdr _bvh125; +} + +struct parsed_packet_t { + bitvec_hdr bvh0; + bitvec_hdr bvh1; +} + +parser parse(packet_in pk, out parsed_packet_t h, inout local_metadata_t local_metadata, in psa_ingress_parser_input_metadata_t x, in EMPTY_RESUB resub_meta, in EMPTY_RECIRC recirc_meta) { + state start { + pk.extract(h.bvh0); + pk.extract(h.bvh1); + transition accept; + } +} + +parser egressParserImpl(packet_in buffer, out EMPTY_H a, inout local_metadata_t b, in psa_egress_parser_input_metadata_t c, in EMPTY_BRIDGE d, in EMPTY_CLONE e, in EMPTY_CLONE f) { + state start { + transition accept; + } +} + +control ingress(inout parsed_packet_t h, inout local_metadata_t local_metadata, in psa_ingress_input_metadata_t istd, inout psa_ingress_output_metadata_t ostd) { + @name("ingress.bh") bitvec_hdr bh_0; + @noWarn("unused") @name(".NoAction") action NoAction_1() { + } + @name("ingress.do_act") action do_act() { + h.bvh1._row_alt1_valid6 = 1w0; + local_metadata._row0_alt0_valid0 = 1w0; + } + @name("ingress.tns") table tns_0 { + key = { + h.bvh1._row_alt1_valid6 : exact @name("h.bvh1.row.alt1.valid") ; + local_metadata._row0_alt0_valid0: exact @name("local_metadata.row0.alt0.valid") ; + } + actions = { + do_act(); + @defaultonly NoAction_1(); + } + default_action = NoAction_1(); + } + @hidden action psadpdkissue1653complex96() { + bh_0.setInvalid(); + } + @hidden action psadpdkissue1653complex119() { + bh_0._row_alt1_type10 = 16w0x800; + h.bvh0._row_alt1_type10 = 16w0x800; + local_metadata._row0_alt0_useHash3 = true; + psa_clone_i2e(ostd); + } + @hidden table tbl_psadpdkissue1653complex96 { + actions = { + psadpdkissue1653complex96(); + } + const default_action = psadpdkissue1653complex96(); + } + @hidden table tbl_psadpdkissue1653complex119 { + actions = { + psadpdkissue1653complex119(); + } + const default_action = psadpdkissue1653complex119(); + } + apply { + tbl_psadpdkissue1653complex96.apply(); + tns_0.apply(); + tbl_psadpdkissue1653complex119.apply(); + } +} + +control egressControlImpl(inout EMPTY_H hdr, inout local_metadata_t meta, in psa_egress_input_metadata_t x, inout psa_egress_output_metadata_t ostd) { + apply { + } +} + +control deparser(packet_out b, out EMPTY_CLONE clone_i2e_meta, out EMPTY_RESUB resubmit_meta, out EMPTY_BRIDGE normal_meta, inout parsed_packet_t h, in local_metadata_t local_metadata, in psa_ingress_output_metadata_t istd) { + @hidden action psadpdkissue1653complex144() { + b.emit(h.bvh0); + b.emit(h.bvh1); + } + @hidden table tbl_psadpdkissue1653complex144 { + actions = { + psadpdkissue1653complex144(); + } + const default_action = psadpdkissue1653complex144(); + } + apply { + tbl_psadpdkissue1653complex144.apply(); + } +} + +control egressDeparserImpl(packet_out buffer, out EMPTY_CLONE a, out EMPTY_RECIRC b, inout EMPTY_H c, in local_metadata_t d, in psa_egress_output_metadata_t e, in psa_egress_deparser_input_metadata_t f) { + apply { + } +} + +IngressPipeline(parse(), ingress(), deparser()) ip; + +EgressPipeline(egressParserImpl(), egressControlImpl(), egressDeparserImpl()) ep; + +PSA_Switch(ip, PacketReplicationEngine(), ep, BufferingQueueingEngine()) main; + diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-issue1653-complex.p4 b/testdata/p4_16_samples_outputs/psa-dpdk-issue1653-complex.p4 new file mode 100644 index 00000000000..eaced0551ba --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-issue1653-complex.p4 @@ -0,0 +1,121 @@ +#include +#include + +header EMPTY_H { +} + +struct EMPTY_RESUB { +} + +struct EMPTY_CLONE { +} + +struct EMPTY_BRIDGE { +} + +struct EMPTY_RECIRC { +} + +enum bit<16> EthTypes { + IPv4 = 0x800, + ARP = 0x806, + RARP = 0x8035, + EtherTalk = 0x809b, + VLAN = 0x8100, + IPX = 0x8137, + IPv6 = 0x86dd +} + +struct alt_t { + bit<1> valid; + bit<7> port; + int<8> hashRes; + bool useHash; + EthTypes type; + bit<7> pad; +} + +struct row_t { + alt_t alt0; + alt_t alt1; +} + +header bitvec_hdr { + row_t row; +} + +struct local_metadata_t { + @field_list(0) + row_t row0; + row_t row1; + bitvec_hdr bvh0; + bitvec_hdr bvh1; +} + +struct parsed_packet_t { + bitvec_hdr bvh0; + bitvec_hdr bvh1; +} + +parser parse(packet_in pk, out parsed_packet_t h, inout local_metadata_t local_metadata, in psa_ingress_parser_input_metadata_t x, in EMPTY_RESUB resub_meta, in EMPTY_RECIRC recirc_meta) { + state start { + pk.extract(h.bvh0); + pk.extract(h.bvh1); + transition accept; + } +} + +parser egressParserImpl(packet_in buffer, out EMPTY_H a, inout local_metadata_t b, in psa_egress_parser_input_metadata_t c, in EMPTY_BRIDGE d, in EMPTY_CLONE e, in EMPTY_CLONE f) { + state start { + transition accept; + } +} + +control ingress(inout parsed_packet_t h, inout local_metadata_t local_metadata, in psa_ingress_input_metadata_t istd, inout psa_ingress_output_metadata_t ostd) { + bitvec_hdr bh; + action do_act() { + h.bvh1.row.alt1.valid = 0; + local_metadata.row0.alt0.valid = 0; + } + table tns { + key = { + h.bvh1.row.alt1.valid : exact; + local_metadata.row0.alt0.valid: exact; + } + actions = { + do_act; + } + } + apply { + tns.apply(); + bh.row.alt0.useHash = h.bvh0.row.alt0.useHash; + bh.row.alt1.type = EthTypes.IPv4; + h.bvh0.row.alt1.type = bh.row.alt1.type; + local_metadata.row0.alt0.useHash = true; + psa_clone_i2e(ostd); + } +} + +control egressControlImpl(inout EMPTY_H hdr, inout local_metadata_t meta, in psa_egress_input_metadata_t x, inout psa_egress_output_metadata_t ostd) { + apply { + } +} + +control deparser(packet_out b, out EMPTY_CLONE clone_i2e_meta, out EMPTY_RESUB resubmit_meta, out EMPTY_BRIDGE normal_meta, inout parsed_packet_t h, in local_metadata_t local_metadata, in psa_ingress_output_metadata_t istd) { + apply { + b.emit(h.bvh0); + b.emit(h.bvh1); + } +} + +control egressDeparserImpl(packet_out buffer, out EMPTY_CLONE a, out EMPTY_RECIRC b, inout EMPTY_H c, in local_metadata_t d, in psa_egress_output_metadata_t e, in psa_egress_deparser_input_metadata_t f) { + apply { + } +} + +IngressPipeline(parse(), ingress(), deparser()) ip; + +EgressPipeline(egressParserImpl(), egressControlImpl(), egressDeparserImpl()) ep; + +PSA_Switch(ip, PacketReplicationEngine(), ep, BufferingQueueingEngine()) main; + diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-issue1653-complex.p4-stderr b/testdata/p4_16_samples_outputs/psa-dpdk-issue1653-complex.p4-stderr new file mode 100644 index 00000000000..86a590f17a8 --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-issue1653-complex.p4-stderr @@ -0,0 +1,9 @@ +psa-dpdk-issue1653-complex.p4(118): [--Wwarn=invalid_header] warning: accessing a field of an invalid header bh + bh.row.alt0.useHash = h.bvh0.row.alt0.useHash; + ^^ +psa-dpdk-issue1653-complex.p4(119): [--Wwarn=invalid_header] warning: accessing a field of an invalid header bh + bh.row.alt1.type = EthTypes.IPv4; + ^^ +psa-dpdk-issue1653-complex.p4(120): [--Wwarn=invalid_header] warning: accessing a field of an invalid header bh + h.bvh0.row.alt1.type = bh.row.alt1.type; + ^^ diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-issue1653-complex.p4.entries.txt b/testdata/p4_16_samples_outputs/psa-dpdk-issue1653-complex.p4.entries.txt new file mode 100644 index 00000000000..e69de29bb2d diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-issue1653-complex.p4.p4info.txt b/testdata/p4_16_samples_outputs/psa-dpdk-issue1653-complex.p4.p4info.txt new file mode 100644 index 00000000000..e150d351652 --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-issue1653-complex.p4.p4info.txt @@ -0,0 +1,48 @@ +pkg_info { + arch: "psa" +} +tables { + preamble { + id: 46138463 + name: "ingress.tns" + alias: "tns" + } + match_fields { + id: 1 + name: "h.bvh1.row.alt1.valid" + bitwidth: 1 + match_type: EXACT + } + match_fields { + id: 2 + name: "local_metadata.row0.alt0.valid" + bitwidth: 1 + match_type: EXACT + } + action_refs { + id: 22708368 + } + action_refs { + id: 21257015 + annotations: "@defaultonly" + scope: DEFAULT_ONLY + } + size: 1024 +} +actions { + preamble { + id: 21257015 + name: "NoAction" + alias: "NoAction" + annotations: "@noWarn(\"unused\")" + } +} +actions { + preamble { + id: 22708368 + name: "ingress.do_act" + alias: "do_act" + } +} +type_info { +} diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-issue1660-first.p4 b/testdata/p4_16_samples_outputs/psa-dpdk-issue1660-first.p4 new file mode 100644 index 00000000000..f294a7ea1ca --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-issue1660-first.p4 @@ -0,0 +1,70 @@ +#include +#include + +header EMPTY_H { +} + +struct EMPTY_RESUB { +} + +struct EMPTY_CLONE { +} + +struct EMPTY_BRIDGE { +} + +struct EMPTY_RECIRC { +} + +struct HasBool { + @field_list(0) + bool x; +} + +struct parsed_packet_t { +} + +struct local_metadata_t { +} + +parser parse(packet_in pk, out parsed_packet_t h, inout local_metadata_t local_metadata, in psa_ingress_parser_input_metadata_t x, in EMPTY_RESUB resub_meta, in EMPTY_RECIRC recirc_meta) { + state start { + transition accept; + } +} + +parser egressParserImpl(packet_in buffer, out EMPTY_H a, inout local_metadata_t b, in psa_egress_parser_input_metadata_t c, in EMPTY_BRIDGE d, in EMPTY_CLONE e, in EMPTY_CLONE f) { + state start { + transition accept; + } +} + +control ingress(inout parsed_packet_t h, inout local_metadata_t local_metadata, in psa_ingress_input_metadata_t istd, inout psa_ingress_output_metadata_t ostd) { + apply { + HasBool b; + b.x = true; + psa_clone_i2e(ostd); + } +} + +control egressControlImpl(inout EMPTY_H hdr, inout local_metadata_t meta, in psa_egress_input_metadata_t x, inout psa_egress_output_metadata_t ostd) { + apply { + } +} + +control deparser(packet_out b, out EMPTY_CLONE clone_i2e_meta, out EMPTY_RESUB resubmit_meta, out EMPTY_BRIDGE normal_meta, inout parsed_packet_t hdr, in local_metadata_t local_metadata, in psa_ingress_output_metadata_t istd) { + apply { + } +} + +control egressDeparserImpl(packet_out buffer, out EMPTY_CLONE a, out EMPTY_RECIRC b, inout EMPTY_H c, in local_metadata_t d, in psa_egress_output_metadata_t e, in psa_egress_deparser_input_metadata_t f) { + apply { + } +} + +IngressPipeline(parse(), ingress(), deparser()) ip; + +EgressPipeline(egressParserImpl(), egressControlImpl(), egressDeparserImpl()) ep; + +PSA_Switch(ip, PacketReplicationEngine(), ep, BufferingQueueingEngine()) main; + diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-issue1660-frontend.p4 b/testdata/p4_16_samples_outputs/psa-dpdk-issue1660-frontend.p4 new file mode 100644 index 00000000000..41b2e9ca556 --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-issue1660-frontend.p4 @@ -0,0 +1,68 @@ +#include +#include + +header EMPTY_H { +} + +struct EMPTY_RESUB { +} + +struct EMPTY_CLONE { +} + +struct EMPTY_BRIDGE { +} + +struct EMPTY_RECIRC { +} + +struct HasBool { + @field_list(0) + bool x; +} + +struct parsed_packet_t { +} + +struct local_metadata_t { +} + +parser parse(packet_in pk, out parsed_packet_t h, inout local_metadata_t local_metadata, in psa_ingress_parser_input_metadata_t x, in EMPTY_RESUB resub_meta, in EMPTY_RECIRC recirc_meta) { + state start { + transition accept; + } +} + +parser egressParserImpl(packet_in buffer, out EMPTY_H a, inout local_metadata_t b, in psa_egress_parser_input_metadata_t c, in EMPTY_BRIDGE d, in EMPTY_CLONE e, in EMPTY_CLONE f) { + state start { + transition accept; + } +} + +control ingress(inout parsed_packet_t h, inout local_metadata_t local_metadata, in psa_ingress_input_metadata_t istd, inout psa_ingress_output_metadata_t ostd) { + apply { + psa_clone_i2e(ostd); + } +} + +control egressControlImpl(inout EMPTY_H hdr, inout local_metadata_t meta, in psa_egress_input_metadata_t x, inout psa_egress_output_metadata_t ostd) { + apply { + } +} + +control deparser(packet_out b, out EMPTY_CLONE clone_i2e_meta, out EMPTY_RESUB resubmit_meta, out EMPTY_BRIDGE normal_meta, inout parsed_packet_t hdr, in local_metadata_t local_metadata, in psa_ingress_output_metadata_t istd) { + apply { + } +} + +control egressDeparserImpl(packet_out buffer, out EMPTY_CLONE a, out EMPTY_RECIRC b, inout EMPTY_H c, in local_metadata_t d, in psa_egress_output_metadata_t e, in psa_egress_deparser_input_metadata_t f) { + apply { + } +} + +IngressPipeline(parse(), ingress(), deparser()) ip; + +EgressPipeline(egressParserImpl(), egressControlImpl(), egressDeparserImpl()) ep; + +PSA_Switch(ip, PacketReplicationEngine(), ep, BufferingQueueingEngine()) main; + diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-issue1660-midend.p4 b/testdata/p4_16_samples_outputs/psa-dpdk-issue1660-midend.p4 new file mode 100644 index 00000000000..45a4680afa7 --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-issue1660-midend.p4 @@ -0,0 +1,77 @@ +#include +#include + +header EMPTY_H { +} + +struct EMPTY_RESUB { +} + +struct EMPTY_CLONE { +} + +struct EMPTY_BRIDGE { +} + +struct EMPTY_RECIRC { +} + +struct HasBool { + @field_list(0) + bool x; +} + +struct parsed_packet_t { +} + +struct local_metadata_t { +} + +parser parse(packet_in pk, out parsed_packet_t h, inout local_metadata_t local_metadata, in psa_ingress_parser_input_metadata_t x, in EMPTY_RESUB resub_meta, in EMPTY_RECIRC recirc_meta) { + state start { + transition accept; + } +} + +parser egressParserImpl(packet_in buffer, out EMPTY_H a, inout local_metadata_t b, in psa_egress_parser_input_metadata_t c, in EMPTY_BRIDGE d, in EMPTY_CLONE e, in EMPTY_CLONE f) { + state start { + transition accept; + } +} + +control ingress(inout parsed_packet_t h, inout local_metadata_t local_metadata, in psa_ingress_input_metadata_t istd, inout psa_ingress_output_metadata_t ostd) { + @hidden action psadpdkissue1660l46() { + psa_clone_i2e(ostd); + } + @hidden table tbl_psadpdkissue1660l46 { + actions = { + psadpdkissue1660l46(); + } + const default_action = psadpdkissue1660l46(); + } + apply { + tbl_psadpdkissue1660l46.apply(); + } +} + +control egressControlImpl(inout EMPTY_H hdr, inout local_metadata_t meta, in psa_egress_input_metadata_t x, inout psa_egress_output_metadata_t ostd) { + apply { + } +} + +control deparser(packet_out b, out EMPTY_CLONE clone_i2e_meta, out EMPTY_RESUB resubmit_meta, out EMPTY_BRIDGE normal_meta, inout parsed_packet_t hdr, in local_metadata_t local_metadata, in psa_ingress_output_metadata_t istd) { + apply { + } +} + +control egressDeparserImpl(packet_out buffer, out EMPTY_CLONE a, out EMPTY_RECIRC b, inout EMPTY_H c, in local_metadata_t d, in psa_egress_output_metadata_t e, in psa_egress_deparser_input_metadata_t f) { + apply { + } +} + +IngressPipeline(parse(), ingress(), deparser()) ip; + +EgressPipeline(egressParserImpl(), egressControlImpl(), egressDeparserImpl()) ep; + +PSA_Switch(ip, PacketReplicationEngine(), ep, BufferingQueueingEngine()) main; + diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-issue1660.p4 b/testdata/p4_16_samples_outputs/psa-dpdk-issue1660.p4 new file mode 100644 index 00000000000..46ac57575ee --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-issue1660.p4 @@ -0,0 +1,70 @@ +#include +#include + +header EMPTY_H { +} + +struct EMPTY_RESUB { +} + +struct EMPTY_CLONE { +} + +struct EMPTY_BRIDGE { +} + +struct EMPTY_RECIRC { +} + +struct HasBool { + @field_list(0) + bool x; +} + +struct parsed_packet_t { +} + +struct local_metadata_t { +} + +parser parse(packet_in pk, out parsed_packet_t h, inout local_metadata_t local_metadata, in psa_ingress_parser_input_metadata_t x, in EMPTY_RESUB resub_meta, in EMPTY_RECIRC recirc_meta) { + state start { + transition accept; + } +} + +parser egressParserImpl(packet_in buffer, out EMPTY_H a, inout local_metadata_t b, in psa_egress_parser_input_metadata_t c, in EMPTY_BRIDGE d, in EMPTY_CLONE e, in EMPTY_CLONE f) { + state start { + transition accept; + } +} + +control ingress(inout parsed_packet_t h, inout local_metadata_t local_metadata, in psa_ingress_input_metadata_t istd, inout psa_ingress_output_metadata_t ostd) { + apply { + HasBool b; + b.x = true; + psa_clone_i2e(ostd); + } +} + +control egressControlImpl(inout EMPTY_H hdr, inout local_metadata_t meta, in psa_egress_input_metadata_t x, inout psa_egress_output_metadata_t ostd) { + apply { + } +} + +control deparser(packet_out b, out EMPTY_CLONE clone_i2e_meta, out EMPTY_RESUB resubmit_meta, out EMPTY_BRIDGE normal_meta, inout parsed_packet_t hdr, in local_metadata_t local_metadata, in psa_ingress_output_metadata_t istd) { + apply { + } +} + +control egressDeparserImpl(packet_out buffer, out EMPTY_CLONE a, out EMPTY_RECIRC b, inout EMPTY_H c, in local_metadata_t d, in psa_egress_output_metadata_t e, in psa_egress_deparser_input_metadata_t f) { + apply { + } +} + +IngressPipeline(parse(), ingress(), deparser()) ip; + +EgressPipeline(egressParserImpl(), egressControlImpl(), egressDeparserImpl()) ep; + +PSA_Switch(ip, PacketReplicationEngine(), ep, BufferingQueueingEngine()) main; + diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-issue1660.p4-stderr b/testdata/p4_16_samples_outputs/psa-dpdk-issue1660.p4-stderr new file mode 100644 index 00000000000..e69de29bb2d diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-issue1660.p4.entries.txt b/testdata/p4_16_samples_outputs/psa-dpdk-issue1660.p4.entries.txt new file mode 100644 index 00000000000..e69de29bb2d diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-issue1660.p4.p4info.txt b/testdata/p4_16_samples_outputs/psa-dpdk-issue1660.p4.p4info.txt new file mode 100644 index 00000000000..77612386454 --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-issue1660.p4.p4info.txt @@ -0,0 +1,3 @@ +pkg_info { + arch: "psa" +} diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-issue1781-bmv2.p4-error b/testdata/p4_16_samples_outputs/psa-dpdk-issue1781-bmv2.p4-error new file mode 100644 index 00000000000..e69de29bb2d diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-issue1781-bmv2.p4.bfrt.json b/testdata/p4_16_samples_outputs/psa-dpdk-issue1781-bmv2.p4.bfrt.json new file mode 100644 index 00000000000..b6d66a630db --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-issue1781-bmv2.p4.bfrt.json @@ -0,0 +1,5 @@ +{ + "schema_version" : "1.0.0", + "tables" : [], + "learn_filters" : [] +} \ No newline at end of file diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-issue1781-bmv2.p4.spec b/testdata/p4_16_samples_outputs/psa-dpdk-issue1781-bmv2.p4.spec new file mode 100644 index 00000000000..64d959571a2 --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-issue1781-bmv2.p4.spec @@ -0,0 +1,38 @@ + +struct psa_ingress_output_metadata_t { + bit<8> class_of_service + bit<8> clone + bit<16> clone_session_id + bit<8> drop + bit<8> resubmit + bit<32> multicast_group + bit<32> egress_port +} + +struct psa_egress_output_metadata_t { + bit<8> clone + bit<16> clone_session_id + bit<8> drop +} + +struct psa_egress_deparser_input_metadata_t { + bit<32> egress_port +} + + +struct metadata { + bit<32> psa_ingress_input_metadata_ingress_port + bit<8> psa_ingress_output_metadata_drop + bit<32> psa_ingress_output_metadata_egress_port +} +metadata instanceof metadata + +apply { + rx m.psa_ingress_input_metadata_ingress_port + mov m.psa_ingress_output_metadata_drop 0x0 + jmpneq LABEL_DROP m.psa_ingress_output_metadata_drop 0x0 + tx m.psa_ingress_output_metadata_egress_port + LABEL_DROP : drop +} + + diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-issue1781-first.p4 b/testdata/p4_16_samples_outputs/psa-dpdk-issue1781-first.p4 new file mode 100644 index 00000000000..9cf2642bf75 --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-issue1781-first.p4 @@ -0,0 +1,71 @@ +#include +#include + +header EMPTY_H { +} + +struct EMPTY_RESUB { +} + +struct EMPTY_CLONE { +} + +struct EMPTY_BRIDGE { +} + +struct EMPTY_RECIRC { +} + +struct headers { +} + +struct metadata { +} + +parser ParserImpl(packet_in packet, out headers hdr, inout metadata meta, in psa_ingress_parser_input_metadata_t x, in EMPTY_RESUB resub_meta, in EMPTY_RECIRC recirc_meta) { + state start { + transition accept; + } +} + +parser egressParserImpl(packet_in buffer, out EMPTY_H a, inout metadata b, in psa_egress_parser_input_metadata_t c, in EMPTY_BRIDGE d, in EMPTY_CLONE e, in EMPTY_CLONE f) { + state start { + transition accept; + } +} + +bit<32> test_func() { + return 32w1; +} +control IngressImpl(inout headers hdr, inout metadata meta, in psa_ingress_input_metadata_t istd, inout psa_ingress_output_metadata_t ostd) { + action update_value(out bit<32> value) { + value = test_func(); + } + apply { + bit<32> value; + value = test_func(); + update_value(value); + } +} + +control egressControlImpl(inout EMPTY_H hdr, inout metadata meta, in psa_egress_input_metadata_t x, inout psa_egress_output_metadata_t ostd) { + apply { + } +} + +control DeparserImpl(packet_out packet, out EMPTY_CLONE clone_i2e_meta, out EMPTY_RESUB resubmit_meta, out EMPTY_BRIDGE normal_meta, inout headers hdr, in metadata local_metadata, in psa_ingress_output_metadata_t istd) { + apply { + } +} + +control egressDeparserImpl(packet_out buffer, out EMPTY_CLONE a, out EMPTY_RECIRC b, inout EMPTY_H c, in metadata d, in psa_egress_output_metadata_t e, in psa_egress_deparser_input_metadata_t f) { + apply { + } +} + +IngressPipeline(ParserImpl(), IngressImpl(), DeparserImpl()) ip; + +EgressPipeline(egressParserImpl(), egressControlImpl(), egressDeparserImpl()) ep; + +PSA_Switch(ip, PacketReplicationEngine(), ep, BufferingQueueingEngine()) main; + diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-issue1781-frontend.p4 b/testdata/p4_16_samples_outputs/psa-dpdk-issue1781-frontend.p4 new file mode 100644 index 00000000000..c5fcc1b66bd --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-issue1781-frontend.p4 @@ -0,0 +1,79 @@ +#include +#include + +header EMPTY_H { +} + +struct EMPTY_RESUB { +} + +struct EMPTY_CLONE { +} + +struct EMPTY_BRIDGE { +} + +struct EMPTY_RECIRC { +} + +struct headers { +} + +struct metadata { +} + +parser ParserImpl(packet_in packet, out headers hdr, inout metadata meta, in psa_ingress_parser_input_metadata_t x, in EMPTY_RESUB resub_meta, in EMPTY_RECIRC recirc_meta) { + state start { + transition accept; + } +} + +parser egressParserImpl(packet_in buffer, out EMPTY_H a, inout metadata b, in psa_egress_parser_input_metadata_t c, in EMPTY_BRIDGE d, in EMPTY_CLONE e, in EMPTY_CLONE f) { + state start { + transition accept; + } +} + +control IngressImpl(inout headers hdr, inout metadata meta, in psa_ingress_input_metadata_t istd, inout psa_ingress_output_metadata_t ostd) { + @name("IngressImpl.value") bit<32> value_1; + @name("IngressImpl.value") bit<32> value_3; + @name("IngressImpl.hasReturned") bool hasReturned; + @name("IngressImpl.retval") bit<32> retval; + @name("IngressImpl.hasReturned") bool hasReturned_1; + @name("IngressImpl.retval") bit<32> retval_1; + @name("IngressImpl.update_value") action update_value() { + hasReturned = false; + hasReturned = true; + retval = 32w1; + value_3 = retval; + value_1 = value_3; + } + apply { + hasReturned_1 = false; + hasReturned_1 = true; + retval_1 = 32w1; + update_value(); + } +} + +control egressControlImpl(inout EMPTY_H hdr, inout metadata meta, in psa_egress_input_metadata_t x, inout psa_egress_output_metadata_t ostd) { + apply { + } +} + +control DeparserImpl(packet_out packet, out EMPTY_CLONE clone_i2e_meta, out EMPTY_RESUB resubmit_meta, out EMPTY_BRIDGE normal_meta, inout headers hdr, in metadata local_metadata, in psa_ingress_output_metadata_t istd) { + apply { + } +} + +control egressDeparserImpl(packet_out buffer, out EMPTY_CLONE a, out EMPTY_RECIRC b, inout EMPTY_H c, in metadata d, in psa_egress_output_metadata_t e, in psa_egress_deparser_input_metadata_t f) { + apply { + } +} + +IngressPipeline(ParserImpl(), IngressImpl(), DeparserImpl()) ip; + +EgressPipeline(egressParserImpl(), egressControlImpl(), egressDeparserImpl()) ep; + +PSA_Switch(ip, PacketReplicationEngine(), ep, BufferingQueueingEngine()) main; + diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-issue1781-midend.p4 b/testdata/p4_16_samples_outputs/psa-dpdk-issue1781-midend.p4 new file mode 100644 index 00000000000..db45a32ea83 --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-issue1781-midend.p4 @@ -0,0 +1,71 @@ +#include +#include + +header EMPTY_H { +} + +struct EMPTY_RESUB { +} + +struct EMPTY_CLONE { +} + +struct EMPTY_BRIDGE { +} + +struct EMPTY_RECIRC { +} + +struct headers { +} + +struct metadata { +} + +parser ParserImpl(packet_in packet, out headers hdr, inout metadata meta, in psa_ingress_parser_input_metadata_t x, in EMPTY_RESUB resub_meta, in EMPTY_RECIRC recirc_meta) { + state start { + transition accept; + } +} + +parser egressParserImpl(packet_in buffer, out EMPTY_H a, inout metadata b, in psa_egress_parser_input_metadata_t c, in EMPTY_BRIDGE d, in EMPTY_CLONE e, in EMPTY_CLONE f) { + state start { + transition accept; + } +} + +control IngressImpl(inout headers hdr, inout metadata meta, in psa_ingress_input_metadata_t istd, inout psa_ingress_output_metadata_t ostd) { + @name("IngressImpl.update_value") action update_value() { + } + @hidden table tbl_update_value { + actions = { + update_value(); + } + const default_action = update_value(); + } + apply { + tbl_update_value.apply(); + } +} + +control egressControlImpl(inout EMPTY_H hdr, inout metadata meta, in psa_egress_input_metadata_t x, inout psa_egress_output_metadata_t ostd) { + apply { + } +} + +control DeparserImpl(packet_out packet, out EMPTY_CLONE clone_i2e_meta, out EMPTY_RESUB resubmit_meta, out EMPTY_BRIDGE normal_meta, inout headers hdr, in metadata local_metadata, in psa_ingress_output_metadata_t istd) { + apply { + } +} + +control egressDeparserImpl(packet_out buffer, out EMPTY_CLONE a, out EMPTY_RECIRC b, inout EMPTY_H c, in metadata d, in psa_egress_output_metadata_t e, in psa_egress_deparser_input_metadata_t f) { + apply { + } +} + +IngressPipeline(ParserImpl(), IngressImpl(), DeparserImpl()) ip; + +EgressPipeline(egressParserImpl(), egressControlImpl(), egressDeparserImpl()) ep; + +PSA_Switch(ip, PacketReplicationEngine(), ep, BufferingQueueingEngine()) main; + diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-issue1781.p4 b/testdata/p4_16_samples_outputs/psa-dpdk-issue1781.p4 new file mode 100644 index 00000000000..4576ae55b0f --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-issue1781.p4 @@ -0,0 +1,71 @@ +#include +#include + +header EMPTY_H { +} + +struct EMPTY_RESUB { +} + +struct EMPTY_CLONE { +} + +struct EMPTY_BRIDGE { +} + +struct EMPTY_RECIRC { +} + +struct headers { +} + +struct metadata { +} + +parser ParserImpl(packet_in packet, out headers hdr, inout metadata meta, in psa_ingress_parser_input_metadata_t x, in EMPTY_RESUB resub_meta, in EMPTY_RECIRC recirc_meta) { + state start { + transition accept; + } +} + +parser egressParserImpl(packet_in buffer, out EMPTY_H a, inout metadata b, in psa_egress_parser_input_metadata_t c, in EMPTY_BRIDGE d, in EMPTY_CLONE e, in EMPTY_CLONE f) { + state start { + transition accept; + } +} + +bit<32> test_func() { + return 1; +} +control IngressImpl(inout headers hdr, inout metadata meta, in psa_ingress_input_metadata_t istd, inout psa_ingress_output_metadata_t ostd) { + action update_value(out bit<32> value) { + value = test_func(); + } + apply { + bit<32> value; + value = test_func(); + update_value(value); + } +} + +control egressControlImpl(inout EMPTY_H hdr, inout metadata meta, in psa_egress_input_metadata_t x, inout psa_egress_output_metadata_t ostd) { + apply { + } +} + +control DeparserImpl(packet_out packet, out EMPTY_CLONE clone_i2e_meta, out EMPTY_RESUB resubmit_meta, out EMPTY_BRIDGE normal_meta, inout headers hdr, in metadata local_metadata, in psa_ingress_output_metadata_t istd) { + apply { + } +} + +control egressDeparserImpl(packet_out buffer, out EMPTY_CLONE a, out EMPTY_RECIRC b, inout EMPTY_H c, in metadata d, in psa_egress_output_metadata_t e, in psa_egress_deparser_input_metadata_t f) { + apply { + } +} + +IngressPipeline(ParserImpl(), IngressImpl(), DeparserImpl()) ip; + +EgressPipeline(egressParserImpl(), egressControlImpl(), egressDeparserImpl()) ep; + +PSA_Switch(ip, PacketReplicationEngine(), ep, BufferingQueueingEngine()) main; + diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-issue1781.p4-error b/testdata/p4_16_samples_outputs/psa-dpdk-issue1781.p4-error new file mode 100644 index 00000000000..e69de29bb2d diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-issue1781.p4-stderr b/testdata/p4_16_samples_outputs/psa-dpdk-issue1781.p4-stderr new file mode 100644 index 00000000000..e69de29bb2d diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-issue1781.p4.bfrt.json b/testdata/p4_16_samples_outputs/psa-dpdk-issue1781.p4.bfrt.json new file mode 100644 index 00000000000..b6d66a630db --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-issue1781.p4.bfrt.json @@ -0,0 +1,5 @@ +{ + "schema_version" : "1.0.0", + "tables" : [], + "learn_filters" : [] +} \ No newline at end of file diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-issue1781.p4.entries.txt b/testdata/p4_16_samples_outputs/psa-dpdk-issue1781.p4.entries.txt new file mode 100644 index 00000000000..e69de29bb2d diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-issue1781.p4.p4info.txt b/testdata/p4_16_samples_outputs/psa-dpdk-issue1781.p4.p4info.txt new file mode 100644 index 00000000000..707aacbe5c1 --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-issue1781.p4.p4info.txt @@ -0,0 +1,10 @@ +pkg_info { + arch: "psa" +} +actions { + preamble { + id: 25324817 + name: "IngressImpl.update_value" + alias: "update_value" + } +} diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-issue1781.p4.spec b/testdata/p4_16_samples_outputs/psa-dpdk-issue1781.p4.spec new file mode 100644 index 00000000000..64d959571a2 --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-issue1781.p4.spec @@ -0,0 +1,38 @@ + +struct psa_ingress_output_metadata_t { + bit<8> class_of_service + bit<8> clone + bit<16> clone_session_id + bit<8> drop + bit<8> resubmit + bit<32> multicast_group + bit<32> egress_port +} + +struct psa_egress_output_metadata_t { + bit<8> clone + bit<16> clone_session_id + bit<8> drop +} + +struct psa_egress_deparser_input_metadata_t { + bit<32> egress_port +} + + +struct metadata { + bit<32> psa_ingress_input_metadata_ingress_port + bit<8> psa_ingress_output_metadata_drop + bit<32> psa_ingress_output_metadata_egress_port +} +metadata instanceof metadata + +apply { + rx m.psa_ingress_input_metadata_ingress_port + mov m.psa_ingress_output_metadata_drop 0x0 + jmpneq LABEL_DROP m.psa_ingress_output_metadata_drop 0x0 + tx m.psa_ingress_output_metadata_egress_port + LABEL_DROP : drop +} + + diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-issue2314-first.p4 b/testdata/p4_16_samples_outputs/psa-dpdk-issue2314-first.p4 new file mode 100644 index 00000000000..92d9fefa02c --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-issue2314-first.p4 @@ -0,0 +1,103 @@ +#include +#include + +header EMPTY_H { +} + +struct EMPTY_RESUB { +} + +struct EMPTY_CLONE { +} + +struct EMPTY_BRIDGE { +} + +struct EMPTY_RECIRC { +} + +header ethernet_t { + bit<48> dstAddr; + bit<48> srcAddr; + bit<16> etherType; +} + +header H { + bit<8> a; +} + +header I { + bit<16> etherType; +} + +struct h { + ethernet_t ether; + H h; + I i; +} + +struct m { +} + +parser L3(packet_in b, inout h hdr) { + bit<16> etherType = hdr.ether.etherType; + state start { + transition select(etherType) { + 16w0x800: h0; + 16w0x8100: i; + default: accept; + } + } + state h0 { + b.extract(hdr.h); + transition accept; + } + state i { + b.extract(hdr.i); + etherType = hdr.i.etherType; + transition start; + } +} + +parser MyParser(packet_in b, out h hdr, inout m meta, in psa_ingress_parser_input_metadata_t x, in EMPTY_RESUB resub_meta, in EMPTY_RECIRC recirc_meta) { + L3() l3; + state start { + b.extract(hdr.ether); + l3.apply(b, hdr); + transition accept; + } +} + +parser egressParserImpl(packet_in buffer, out EMPTY_H a, inout m b, in psa_egress_parser_input_metadata_t c, in EMPTY_BRIDGE d, in EMPTY_CLONE e, in EMPTY_CLONE f) { + state start { + transition accept; + } +} + +control MyIngress(inout h hdr, inout m meta, in psa_ingress_input_metadata_t istd, inout psa_ingress_output_metadata_t ostd) { + apply { + } +} + +control egressControlImpl(inout EMPTY_H hdr, inout m meta, in psa_egress_input_metadata_t x, inout psa_egress_output_metadata_t ostd) { + apply { + } +} + +control MyDeparser(packet_out b, out EMPTY_CLONE clone_i2e_meta, out EMPTY_RESUB resubmit_meta, out EMPTY_BRIDGE normal_meta, inout h hdr, in m local_metadata, in psa_ingress_output_metadata_t istd) { + apply { + b.emit(hdr); + } +} + +control egressDeparserImpl(packet_out buffer, out EMPTY_CLONE a, out EMPTY_RECIRC b, inout EMPTY_H c, in m d, in psa_egress_output_metadata_t e, in psa_egress_deparser_input_metadata_t f) { + apply { + } +} + +IngressPipeline(MyParser(), MyIngress(), MyDeparser()) ip; + +EgressPipeline(egressParserImpl(), egressControlImpl(), egressDeparserImpl()) ep; + +PSA_Switch(ip, PacketReplicationEngine(), ep, BufferingQueueingEngine()) main; + diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-issue2314-frontend.p4 b/testdata/p4_16_samples_outputs/psa-dpdk-issue2314-frontend.p4 new file mode 100644 index 00000000000..d1208e4499b --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-issue2314-frontend.p4 @@ -0,0 +1,111 @@ +#include +#include + +header EMPTY_H { +} + +struct EMPTY_RESUB { +} + +struct EMPTY_CLONE { +} + +struct EMPTY_BRIDGE { +} + +struct EMPTY_RECIRC { +} + +header ethernet_t { + bit<48> dstAddr; + bit<48> srcAddr; + bit<16> etherType; +} + +header H { + bit<8> a; +} + +header I { + bit<16> etherType; +} + +struct h { + ethernet_t ether; + H h; + I i; +} + +struct m { +} + +parser MyParser(packet_in b, out h hdr, inout m meta, in psa_ingress_parser_input_metadata_t x, in EMPTY_RESUB resub_meta, in EMPTY_RECIRC recirc_meta) { + @name("MyParser.l3.etherType") bit<16> l3_etherType; + state start { + transition start_0; + } + state start_0 { + b.extract(hdr.ether); + transition L3_start; + } + state L3_start { + l3_etherType = hdr.ether.etherType; + transition L3_start_0; + } + state L3_start_0 { + transition select(l3_etherType) { + 16w0x800: L3_h0; + 16w0x8100: L3_i; + default: start_1; + } + } + state L3_h0 { + b.extract(hdr.h); + transition start_1; + } + state L3_i { + b.extract(hdr.i); + l3_etherType = hdr.i.etherType; + transition L3_start_0; + } + state start_1 { + transition accept; + } +} + +parser egressParserImpl(packet_in buffer, out EMPTY_H a, inout m b, in psa_egress_parser_input_metadata_t c, in EMPTY_BRIDGE d, in EMPTY_CLONE e, in EMPTY_CLONE f) { + state start { + transition start_0; + } + state start_0 { + transition accept; + } +} + +control MyIngress(inout h hdr, inout m meta, in psa_ingress_input_metadata_t istd, inout psa_ingress_output_metadata_t ostd) { + apply { + } +} + +control egressControlImpl(inout EMPTY_H hdr, inout m meta, in psa_egress_input_metadata_t x, inout psa_egress_output_metadata_t ostd) { + apply { + } +} + +control MyDeparser(packet_out b, out EMPTY_CLONE clone_i2e_meta, out EMPTY_RESUB resubmit_meta, out EMPTY_BRIDGE normal_meta, inout h hdr, in m local_metadata, in psa_ingress_output_metadata_t istd) { + apply { + b.emit(hdr); + } +} + +control egressDeparserImpl(packet_out buffer, out EMPTY_CLONE a, out EMPTY_RECIRC b, inout EMPTY_H c, in m d, in psa_egress_output_metadata_t e, in psa_egress_deparser_input_metadata_t f) { + apply { + } +} + +IngressPipeline(MyParser(), MyIngress(), MyDeparser()) ip; + +EgressPipeline(egressParserImpl(), egressControlImpl(), egressDeparserImpl()) ep; + +PSA_Switch(ip, PacketReplicationEngine(), ep, BufferingQueueingEngine()) main; + diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-issue2314-midend.p4 b/testdata/p4_16_samples_outputs/psa-dpdk-issue2314-midend.p4 new file mode 100644 index 00000000000..c8826c248ec --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-issue2314-midend.p4 @@ -0,0 +1,113 @@ +#include +#include + +header EMPTY_H { +} + +struct EMPTY_RESUB { +} + +struct EMPTY_CLONE { +} + +struct EMPTY_BRIDGE { +} + +struct EMPTY_RECIRC { +} + +header ethernet_t { + bit<48> dstAddr; + bit<48> srcAddr; + bit<16> etherType; +} + +header H { + bit<8> a; +} + +header I { + bit<16> etherType; +} + +struct h { + ethernet_t ether; + H h; + I i; +} + +struct m { +} + +parser MyParser(packet_in b, out h hdr, inout m meta, in psa_ingress_parser_input_metadata_t x, in EMPTY_RESUB resub_meta, in EMPTY_RECIRC recirc_meta) { + @name("MyParser.l3.etherType") bit<16> l3_etherType; + state start { + b.extract(hdr.ether); + l3_etherType = hdr.ether.etherType; + transition L3_start_0; + } + state L3_start_0 { + transition select(l3_etherType) { + 16w0x800: L3_h0; + 16w0x8100: L3_i; + default: start_1; + } + } + state L3_h0 { + b.extract(hdr.h); + transition start_1; + } + state L3_i { + b.extract(hdr.i); + l3_etherType = hdr.i.etherType; + transition L3_start_0; + } + state start_1 { + transition accept; + } +} + +parser egressParserImpl(packet_in buffer, out EMPTY_H a, inout m b, in psa_egress_parser_input_metadata_t c, in EMPTY_BRIDGE d, in EMPTY_CLONE e, in EMPTY_CLONE f) { + state start { + transition accept; + } +} + +control MyIngress(inout h hdr, inout m meta, in psa_ingress_input_metadata_t istd, inout psa_ingress_output_metadata_t ostd) { + apply { + } +} + +control egressControlImpl(inout EMPTY_H hdr, inout m meta, in psa_egress_input_metadata_t x, inout psa_egress_output_metadata_t ostd) { + apply { + } +} + +control MyDeparser(packet_out b, out EMPTY_CLONE clone_i2e_meta, out EMPTY_RESUB resubmit_meta, out EMPTY_BRIDGE normal_meta, inout h hdr, in m local_metadata, in psa_ingress_output_metadata_t istd) { + @hidden action psadpdkissue2314l116() { + b.emit(hdr.ether); + b.emit(hdr.h); + b.emit(hdr.i); + } + @hidden table tbl_psadpdkissue2314l116 { + actions = { + psadpdkissue2314l116(); + } + const default_action = psadpdkissue2314l116(); + } + apply { + tbl_psadpdkissue2314l116.apply(); + } +} + +control egressDeparserImpl(packet_out buffer, out EMPTY_CLONE a, out EMPTY_RECIRC b, inout EMPTY_H c, in m d, in psa_egress_output_metadata_t e, in psa_egress_deparser_input_metadata_t f) { + apply { + } +} + +IngressPipeline(MyParser(), MyIngress(), MyDeparser()) ip; + +EgressPipeline(egressParserImpl(), egressControlImpl(), egressDeparserImpl()) ep; + +PSA_Switch(ip, PacketReplicationEngine(), ep, BufferingQueueingEngine()) main; + diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-issue2314.p4 b/testdata/p4_16_samples_outputs/psa-dpdk-issue2314.p4 new file mode 100644 index 00000000000..9285de16c4b --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-issue2314.p4 @@ -0,0 +1,103 @@ +#include +#include + +header EMPTY_H { +} + +struct EMPTY_RESUB { +} + +struct EMPTY_CLONE { +} + +struct EMPTY_BRIDGE { +} + +struct EMPTY_RECIRC { +} + +header ethernet_t { + bit<48> dstAddr; + bit<48> srcAddr; + bit<16> etherType; +} + +header H { + bit<8> a; +} + +header I { + bit<16> etherType; +} + +struct h { + ethernet_t ether; + H h; + I i; +} + +struct m { +} + +parser L3(packet_in b, inout h hdr) { + bit<16> etherType = hdr.ether.etherType; + state start { + transition select(etherType) { + 0x800: h0; + 0x8100: i; + default: accept; + } + } + state h0 { + b.extract(hdr.h); + transition accept; + } + state i { + b.extract(hdr.i); + etherType = hdr.i.etherType; + transition start; + } +} + +parser MyParser(packet_in b, out h hdr, inout m meta, in psa_ingress_parser_input_metadata_t x, in EMPTY_RESUB resub_meta, in EMPTY_RECIRC recirc_meta) { + L3() l3; + state start { + b.extract(hdr.ether); + l3.apply(b, hdr); + transition accept; + } +} + +parser egressParserImpl(packet_in buffer, out EMPTY_H a, inout m b, in psa_egress_parser_input_metadata_t c, in EMPTY_BRIDGE d, in EMPTY_CLONE e, in EMPTY_CLONE f) { + state start { + transition accept; + } +} + +control MyIngress(inout h hdr, inout m meta, in psa_ingress_input_metadata_t istd, inout psa_ingress_output_metadata_t ostd) { + apply { + } +} + +control egressControlImpl(inout EMPTY_H hdr, inout m meta, in psa_egress_input_metadata_t x, inout psa_egress_output_metadata_t ostd) { + apply { + } +} + +control MyDeparser(packet_out b, out EMPTY_CLONE clone_i2e_meta, out EMPTY_RESUB resubmit_meta, out EMPTY_BRIDGE normal_meta, inout h hdr, in m local_metadata, in psa_ingress_output_metadata_t istd) { + apply { + b.emit(hdr); + } +} + +control egressDeparserImpl(packet_out buffer, out EMPTY_CLONE a, out EMPTY_RECIRC b, inout EMPTY_H c, in m d, in psa_egress_output_metadata_t e, in psa_egress_deparser_input_metadata_t f) { + apply { + } +} + +IngressPipeline(MyParser(), MyIngress(), MyDeparser()) ip; + +EgressPipeline(egressParserImpl(), egressControlImpl(), egressDeparserImpl()) ep; + +PSA_Switch(ip, PacketReplicationEngine(), ep, BufferingQueueingEngine()) main; + diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-issue2314.p4-stderr b/testdata/p4_16_samples_outputs/psa-dpdk-issue2314.p4-stderr new file mode 100644 index 00000000000..5f1abab984e --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-issue2314.p4-stderr @@ -0,0 +1,3 @@ +psa-dpdk-issue2314.p4(79): [--Wwarn=uninitialized_use] warning: hdr may not be completely initialized + l3.apply(b, hdr); + ^^^ diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-issue2314.p4.entries.txt b/testdata/p4_16_samples_outputs/psa-dpdk-issue2314.p4.entries.txt new file mode 100644 index 00000000000..e69de29bb2d diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-issue2314.p4.p4info.txt b/testdata/p4_16_samples_outputs/psa-dpdk-issue2314.p4.p4info.txt new file mode 100644 index 00000000000..77612386454 --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-issue2314.p4.p4info.txt @@ -0,0 +1,3 @@ +pkg_info { + arch: "psa" +} diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-issue232-bmv2.p4-error b/testdata/p4_16_samples_outputs/psa-dpdk-issue232-bmv2.p4-error new file mode 100644 index 00000000000..e69de29bb2d diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-issue232-bmv2.p4.bfrt.json b/testdata/p4_16_samples_outputs/psa-dpdk-issue232-bmv2.p4.bfrt.json new file mode 100644 index 00000000000..b6d66a630db --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-issue232-bmv2.p4.bfrt.json @@ -0,0 +1,5 @@ +{ + "schema_version" : "1.0.0", + "tables" : [], + "learn_filters" : [] +} \ No newline at end of file diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-issue232-bmv2.p4.spec b/testdata/p4_16_samples_outputs/psa-dpdk-issue232-bmv2.p4.spec new file mode 100644 index 00000000000..2f8f1f9afa7 --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-issue232-bmv2.p4.spec @@ -0,0 +1,38 @@ + +struct psa_ingress_output_metadata_t { + bit<8> class_of_service + bit<8> clone + bit<16> clone_session_id + bit<8> drop + bit<8> resubmit + bit<32> multicast_group + bit<32> egress_port +} + +struct psa_egress_output_metadata_t { + bit<8> clone + bit<16> clone_session_id + bit<8> drop +} + +struct psa_egress_deparser_input_metadata_t { + bit<32> egress_port +} + + +struct Metadata { + bit<32> psa_ingress_input_metadata_ingress_port + bit<8> psa_ingress_output_metadata_drop + bit<32> psa_ingress_output_metadata_egress_port +} +metadata instanceof Metadata + +apply { + rx m.psa_ingress_input_metadata_ingress_port + mov m.psa_ingress_output_metadata_drop 0x0 + jmpneq LABEL_DROP m.psa_ingress_output_metadata_drop 0x0 + tx m.psa_ingress_output_metadata_egress_port + LABEL_DROP : drop +} + + diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-issue232-first.p4 b/testdata/p4_16_samples_outputs/psa-dpdk-issue232-first.p4 new file mode 100644 index 00000000000..f6b8b80b860 --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-issue232-first.p4 @@ -0,0 +1,72 @@ +#include +#include + +header EMPTY_H { +} + +struct EMPTY_RESUB { +} + +struct EMPTY_CLONE { +} + +struct EMPTY_BRIDGE { +} + +struct EMPTY_RECIRC { +} + +typedef bit<48> EthernetAddress; +typedef bit<32> IPv4Address; +struct Headers { +} + +struct Key { + bit<32> field1; +} + +struct Value { + bit<32> field1; +} + +struct Metadata { +} + +parser P(packet_in b, out Headers p, inout Metadata meta, in psa_ingress_parser_input_metadata_t x, in EMPTY_RESUB resub_meta, in EMPTY_RECIRC recirc_meta) { + state start { + transition accept; + } +} + +parser egressParserImpl(packet_in buffer, out EMPTY_H a, inout Metadata b, in psa_egress_parser_input_metadata_t c, in EMPTY_BRIDGE d, in EMPTY_CLONE e, in EMPTY_CLONE f) { + state start { + transition accept; + } +} + +control Ing(inout Headers headers, inout Metadata meta, in psa_ingress_input_metadata_t istd, inout psa_ingress_output_metadata_t ostd) { + apply { + } +} + +control egressControlImpl(inout EMPTY_H hdr, inout Metadata meta, in psa_egress_input_metadata_t x, inout psa_egress_output_metadata_t ostd) { + apply { + } +} + +control DP(packet_out b, out EMPTY_CLONE clone_i2e_meta, out EMPTY_RESUB resubmit_meta, out EMPTY_BRIDGE normal_meta, inout Headers h, in Metadata local_metadata, in psa_ingress_output_metadata_t istd) { + apply { + } +} + +control egressDeparserImpl(packet_out buffer, out EMPTY_CLONE a, out EMPTY_RECIRC b, inout EMPTY_H c, in Metadata d, in psa_egress_output_metadata_t e, in psa_egress_deparser_input_metadata_t f) { + apply { + } +} + +IngressPipeline(P(), Ing(), DP()) ip; + +EgressPipeline(egressParserImpl(), egressControlImpl(), egressDeparserImpl()) ep; + +PSA_Switch(ip, PacketReplicationEngine(), ep, BufferingQueueingEngine()) main; + diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-issue232-frontend.p4 b/testdata/p4_16_samples_outputs/psa-dpdk-issue232-frontend.p4 new file mode 100644 index 00000000000..fbf93bd9314 --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-issue232-frontend.p4 @@ -0,0 +1,70 @@ +#include +#include + +header EMPTY_H { +} + +struct EMPTY_RESUB { +} + +struct EMPTY_CLONE { +} + +struct EMPTY_BRIDGE { +} + +struct EMPTY_RECIRC { +} + +struct Headers { +} + +struct Key { + bit<32> field1; +} + +struct Value { + bit<32> field1; +} + +struct Metadata { +} + +parser P(packet_in b, out Headers p, inout Metadata meta, in psa_ingress_parser_input_metadata_t x, in EMPTY_RESUB resub_meta, in EMPTY_RECIRC recirc_meta) { + state start { + transition accept; + } +} + +parser egressParserImpl(packet_in buffer, out EMPTY_H a, inout Metadata b, in psa_egress_parser_input_metadata_t c, in EMPTY_BRIDGE d, in EMPTY_CLONE e, in EMPTY_CLONE f) { + state start { + transition accept; + } +} + +control Ing(inout Headers headers, inout Metadata meta, in psa_ingress_input_metadata_t istd, inout psa_ingress_output_metadata_t ostd) { + apply { + } +} + +control egressControlImpl(inout EMPTY_H hdr, inout Metadata meta, in psa_egress_input_metadata_t x, inout psa_egress_output_metadata_t ostd) { + apply { + } +} + +control DP(packet_out b, out EMPTY_CLONE clone_i2e_meta, out EMPTY_RESUB resubmit_meta, out EMPTY_BRIDGE normal_meta, inout Headers h, in Metadata local_metadata, in psa_ingress_output_metadata_t istd) { + apply { + } +} + +control egressDeparserImpl(packet_out buffer, out EMPTY_CLONE a, out EMPTY_RECIRC b, inout EMPTY_H c, in Metadata d, in psa_egress_output_metadata_t e, in psa_egress_deparser_input_metadata_t f) { + apply { + } +} + +IngressPipeline(P(), Ing(), DP()) ip; + +EgressPipeline(egressParserImpl(), egressControlImpl(), egressDeparserImpl()) ep; + +PSA_Switch(ip, PacketReplicationEngine(), ep, BufferingQueueingEngine()) main; + diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-issue232-midend.p4 b/testdata/p4_16_samples_outputs/psa-dpdk-issue232-midend.p4 new file mode 100644 index 00000000000..fbf93bd9314 --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-issue232-midend.p4 @@ -0,0 +1,70 @@ +#include +#include + +header EMPTY_H { +} + +struct EMPTY_RESUB { +} + +struct EMPTY_CLONE { +} + +struct EMPTY_BRIDGE { +} + +struct EMPTY_RECIRC { +} + +struct Headers { +} + +struct Key { + bit<32> field1; +} + +struct Value { + bit<32> field1; +} + +struct Metadata { +} + +parser P(packet_in b, out Headers p, inout Metadata meta, in psa_ingress_parser_input_metadata_t x, in EMPTY_RESUB resub_meta, in EMPTY_RECIRC recirc_meta) { + state start { + transition accept; + } +} + +parser egressParserImpl(packet_in buffer, out EMPTY_H a, inout Metadata b, in psa_egress_parser_input_metadata_t c, in EMPTY_BRIDGE d, in EMPTY_CLONE e, in EMPTY_CLONE f) { + state start { + transition accept; + } +} + +control Ing(inout Headers headers, inout Metadata meta, in psa_ingress_input_metadata_t istd, inout psa_ingress_output_metadata_t ostd) { + apply { + } +} + +control egressControlImpl(inout EMPTY_H hdr, inout Metadata meta, in psa_egress_input_metadata_t x, inout psa_egress_output_metadata_t ostd) { + apply { + } +} + +control DP(packet_out b, out EMPTY_CLONE clone_i2e_meta, out EMPTY_RESUB resubmit_meta, out EMPTY_BRIDGE normal_meta, inout Headers h, in Metadata local_metadata, in psa_ingress_output_metadata_t istd) { + apply { + } +} + +control egressDeparserImpl(packet_out buffer, out EMPTY_CLONE a, out EMPTY_RECIRC b, inout EMPTY_H c, in Metadata d, in psa_egress_output_metadata_t e, in psa_egress_deparser_input_metadata_t f) { + apply { + } +} + +IngressPipeline(P(), Ing(), DP()) ip; + +EgressPipeline(egressParserImpl(), egressControlImpl(), egressDeparserImpl()) ep; + +PSA_Switch(ip, PacketReplicationEngine(), ep, BufferingQueueingEngine()) main; + diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-issue232.p4 b/testdata/p4_16_samples_outputs/psa-dpdk-issue232.p4 new file mode 100644 index 00000000000..e2cf4dcd894 --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-issue232.p4 @@ -0,0 +1,72 @@ +#include +#include + +header EMPTY_H { +} + +struct EMPTY_RESUB { +} + +struct EMPTY_CLONE { +} + +struct EMPTY_BRIDGE { +} + +struct EMPTY_RECIRC { +} + +typedef bit<48> EthernetAddress; +typedef bit<32> IPv4Address; +struct Headers { +} + +struct Key { + bit<32> field1; +} + +struct Value { + bit<32> field1; +} + +struct Metadata { +} + +parser P(packet_in b, out Headers p, inout Metadata meta, in psa_ingress_parser_input_metadata_t x, in EMPTY_RESUB resub_meta, in EMPTY_RECIRC recirc_meta) { + state start { + transition accept; + } +} + +parser egressParserImpl(packet_in buffer, out EMPTY_H a, inout Metadata b, in psa_egress_parser_input_metadata_t c, in EMPTY_BRIDGE d, in EMPTY_CLONE e, in EMPTY_CLONE f) { + state start { + transition accept; + } +} + +control Ing(inout Headers headers, inout Metadata meta, in psa_ingress_input_metadata_t istd, inout psa_ingress_output_metadata_t ostd) { + apply { + } +} + +control egressControlImpl(inout EMPTY_H hdr, inout Metadata meta, in psa_egress_input_metadata_t x, inout psa_egress_output_metadata_t ostd) { + apply { + } +} + +control DP(packet_out b, out EMPTY_CLONE clone_i2e_meta, out EMPTY_RESUB resubmit_meta, out EMPTY_BRIDGE normal_meta, inout Headers h, in Metadata local_metadata, in psa_ingress_output_metadata_t istd) { + apply { + } +} + +control egressDeparserImpl(packet_out buffer, out EMPTY_CLONE a, out EMPTY_RECIRC b, inout EMPTY_H c, in Metadata d, in psa_egress_output_metadata_t e, in psa_egress_deparser_input_metadata_t f) { + apply { + } +} + +IngressPipeline(P(), Ing(), DP()) ip; + +EgressPipeline(egressParserImpl(), egressControlImpl(), egressDeparserImpl()) ep; + +PSA_Switch(ip, PacketReplicationEngine(), ep, BufferingQueueingEngine()) main; + diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-issue232.p4-error b/testdata/p4_16_samples_outputs/psa-dpdk-issue232.p4-error new file mode 100644 index 00000000000..e69de29bb2d diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-issue232.p4-stderr b/testdata/p4_16_samples_outputs/psa-dpdk-issue232.p4-stderr new file mode 100644 index 00000000000..e69de29bb2d diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-issue232.p4.bfrt.json b/testdata/p4_16_samples_outputs/psa-dpdk-issue232.p4.bfrt.json new file mode 100644 index 00000000000..b6d66a630db --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-issue232.p4.bfrt.json @@ -0,0 +1,5 @@ +{ + "schema_version" : "1.0.0", + "tables" : [], + "learn_filters" : [] +} \ No newline at end of file diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-issue232.p4.entries.txt b/testdata/p4_16_samples_outputs/psa-dpdk-issue232.p4.entries.txt new file mode 100644 index 00000000000..e69de29bb2d diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-issue232.p4.p4info.txt b/testdata/p4_16_samples_outputs/psa-dpdk-issue232.p4.p4info.txt new file mode 100644 index 00000000000..77612386454 --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-issue232.p4.p4info.txt @@ -0,0 +1,3 @@ +pkg_info { + arch: "psa" +} diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-issue232.p4.spec b/testdata/p4_16_samples_outputs/psa-dpdk-issue232.p4.spec new file mode 100644 index 00000000000..2f8f1f9afa7 --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-issue232.p4.spec @@ -0,0 +1,38 @@ + +struct psa_ingress_output_metadata_t { + bit<8> class_of_service + bit<8> clone + bit<16> clone_session_id + bit<8> drop + bit<8> resubmit + bit<32> multicast_group + bit<32> egress_port +} + +struct psa_egress_output_metadata_t { + bit<8> clone + bit<16> clone_session_id + bit<8> drop +} + +struct psa_egress_deparser_input_metadata_t { + bit<32> egress_port +} + + +struct Metadata { + bit<32> psa_ingress_input_metadata_ingress_port + bit<8> psa_ingress_output_metadata_drop + bit<32> psa_ingress_output_metadata_egress_port +} +metadata instanceof Metadata + +apply { + rx m.psa_ingress_input_metadata_ingress_port + mov m.psa_ingress_output_metadata_drop 0x0 + jmpneq LABEL_DROP m.psa_ingress_output_metadata_drop 0x0 + tx m.psa_ingress_output_metadata_egress_port + LABEL_DROP : drop +} + + diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-issue2330-1-first.p4 b/testdata/p4_16_samples_outputs/psa-dpdk-issue2330-1-first.p4 new file mode 100644 index 00000000000..a31ec91b095 --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-issue2330-1-first.p4 @@ -0,0 +1,88 @@ +#include +#include + +header EMPTY_H { +} + +struct EMPTY_RESUB { +} + +struct EMPTY_CLONE { +} + +struct EMPTY_BRIDGE { +} + +struct EMPTY_RECIRC { +} + +typedef bit<48> EthernetAddress; +header ethernet_t { + bit<48> dst_addr; + bit<48> src_addr; + bit<16> eth_type; +} + +struct Headers { + ethernet_t eth_hdr; +} + +struct Meta { +} + +void do_function(inout bit<16> val1, inout bit<48> val2) { +} +parser p(packet_in pkt, out Headers hdr, inout Meta m, in psa_ingress_parser_input_metadata_t x, in EMPTY_RESUB resub_meta, in EMPTY_RECIRC recirc_meta) { + state start { + transition parse_hdrs; + } + state parse_hdrs { + pkt.extract(hdr.eth_hdr); + transition accept; + } +} + +parser egressParserImpl(packet_in buffer, out EMPTY_H a, inout Meta b, in psa_egress_parser_input_metadata_t c, in EMPTY_BRIDGE d, in EMPTY_CLONE e, in EMPTY_CLONE f) { + state start { + transition accept; + } +} + +control ingress(inout Headers h, inout Meta m, in psa_ingress_input_metadata_t istd, inout psa_ingress_output_metadata_t ostd) { + action do_action() { + bool pointless_bool = true; + if (h.eth_hdr.dst_addr != 48w0) { + ; + } else { + return; + } + do_function(h.eth_hdr.eth_type, h.eth_hdr.src_addr); + h.eth_hdr.src_addr = (pointless_bool ? 48w1 : 48w2); + } + apply { + do_action(); + } +} + +control egressControlImpl(inout EMPTY_H hdr, inout Meta meta, in psa_egress_input_metadata_t x, inout psa_egress_output_metadata_t ostd) { + apply { + } +} + +control deparser(packet_out pkt, out EMPTY_CLONE clone_i2e_meta, out EMPTY_RESUB resubmit_meta, out EMPTY_BRIDGE normal_meta, inout Headers h, in Meta local_metadata, in psa_ingress_output_metadata_t istd) { + apply { + pkt.emit(h); + } +} + +control egressDeparserImpl(packet_out buffer, out EMPTY_CLONE a, out EMPTY_RECIRC b, inout EMPTY_H c, in Meta d, in psa_egress_output_metadata_t e, in psa_egress_deparser_input_metadata_t f) { + apply { + } +} + +IngressPipeline(p(), ingress(), deparser()) ip; + +EgressPipeline(egressParserImpl(), egressControlImpl(), egressDeparserImpl()) ep; + +PSA_Switch(ip, PacketReplicationEngine(), ep, BufferingQueueingEngine()) main; + diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-issue2330-1-frontend.p4 b/testdata/p4_16_samples_outputs/psa-dpdk-issue2330-1-frontend.p4 new file mode 100644 index 00000000000..427e1c87ca3 --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-issue2330-1-frontend.p4 @@ -0,0 +1,100 @@ +#include +#include + +header EMPTY_H { +} + +struct EMPTY_RESUB { +} + +struct EMPTY_CLONE { +} + +struct EMPTY_BRIDGE { +} + +struct EMPTY_RECIRC { +} + +header ethernet_t { + bit<48> dst_addr; + bit<48> src_addr; + bit<16> eth_type; +} + +struct Headers { + ethernet_t eth_hdr; +} + +struct Meta { +} + +parser p(packet_in pkt, out Headers hdr, inout Meta m, in psa_ingress_parser_input_metadata_t x, in EMPTY_RESUB resub_meta, in EMPTY_RECIRC recirc_meta) { + state start { + pkt.extract(hdr.eth_hdr); + transition accept; + } +} + +parser egressParserImpl(packet_in buffer, out EMPTY_H a, inout Meta b, in psa_egress_parser_input_metadata_t c, in EMPTY_BRIDGE d, in EMPTY_CLONE e, in EMPTY_CLONE f) { + state start { + transition accept; + } +} + +control ingress(inout Headers h, inout Meta m, in psa_ingress_input_metadata_t istd, inout psa_ingress_output_metadata_t ostd) { + @name("ingress.pointless_bool") bool pointless_bool_0; + @name("ingress.tmp") bit<48> tmp; + @name("ingress.hasReturned") bool hasReturned; + @name("ingress.val1_0") bit<16> val1; + @name("ingress.val2_0") bit<48> val2; + @name("ingress.do_action") action do_action() { + hasReturned = false; + pointless_bool_0 = true; + if (h.eth_hdr.dst_addr != 48w0) { + ; + } else { + hasReturned = true; + } + if (hasReturned) { + ; + } else { + val1 = h.eth_hdr.eth_type; + val2 = h.eth_hdr.src_addr; + h.eth_hdr.eth_type = val1; + h.eth_hdr.src_addr = val2; + if (pointless_bool_0) { + tmp = 48w1; + } else { + tmp = 48w2; + } + h.eth_hdr.src_addr = tmp; + } + } + apply { + do_action(); + } +} + +control egressControlImpl(inout EMPTY_H hdr, inout Meta meta, in psa_egress_input_metadata_t x, inout psa_egress_output_metadata_t ostd) { + apply { + } +} + +control deparser(packet_out pkt, out EMPTY_CLONE clone_i2e_meta, out EMPTY_RESUB resubmit_meta, out EMPTY_BRIDGE normal_meta, inout Headers h, in Meta local_metadata, in psa_ingress_output_metadata_t istd) { + apply { + pkt.emit(h); + } +} + +control egressDeparserImpl(packet_out buffer, out EMPTY_CLONE a, out EMPTY_RECIRC b, inout EMPTY_H c, in Meta d, in psa_egress_output_metadata_t e, in psa_egress_deparser_input_metadata_t f) { + apply { + } +} + +IngressPipeline(p(), ingress(), deparser()) ip; + +EgressPipeline(egressParserImpl(), egressControlImpl(), egressDeparserImpl()) ep; + +PSA_Switch(ip, PacketReplicationEngine(), ep, BufferingQueueingEngine()) main; + diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-issue2330-1-midend.p4 b/testdata/p4_16_samples_outputs/psa-dpdk-issue2330-1-midend.p4 new file mode 100644 index 00000000000..5a7131134ae --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-issue2330-1-midend.p4 @@ -0,0 +1,98 @@ +#include +#include + +header EMPTY_H { +} + +struct EMPTY_RESUB { +} + +struct EMPTY_CLONE { +} + +struct EMPTY_BRIDGE { +} + +struct EMPTY_RECIRC { +} + +header ethernet_t { + bit<48> dst_addr; + bit<48> src_addr; + bit<16> eth_type; +} + +struct Headers { + ethernet_t eth_hdr; +} + +struct Meta { +} + +parser p(packet_in pkt, out Headers hdr, inout Meta m, in psa_ingress_parser_input_metadata_t x, in EMPTY_RESUB resub_meta, in EMPTY_RECIRC recirc_meta) { + state start { + pkt.extract(hdr.eth_hdr); + transition accept; + } +} + +parser egressParserImpl(packet_in buffer, out EMPTY_H a, inout Meta b, in psa_egress_parser_input_metadata_t c, in EMPTY_BRIDGE d, in EMPTY_CLONE e, in EMPTY_CLONE f) { + state start { + transition accept; + } +} + +control ingress(inout Headers h, inout Meta m, in psa_ingress_input_metadata_t istd, inout psa_ingress_output_metadata_t ostd) { + @name("ingress.tmp") bit<48> tmp; + @name("ingress.val1_0") bit<16> val1; + @name("ingress.val2_0") bit<48> val2; + @name("ingress.do_action") action do_action() { + val1 = (h.eth_hdr.dst_addr != 48w0 ? h.eth_hdr.eth_type : val1); + val2 = (h.eth_hdr.dst_addr != 48w0 ? h.eth_hdr.src_addr : val2); + h.eth_hdr.eth_type = (h.eth_hdr.dst_addr != 48w0 ? val1 : h.eth_hdr.eth_type); + h.eth_hdr.src_addr = (h.eth_hdr.dst_addr != 48w0 ? val2 : h.eth_hdr.src_addr); + tmp = (h.eth_hdr.dst_addr != 48w0 ? 48w1 : tmp); + h.eth_hdr.src_addr = (h.eth_hdr.dst_addr != 48w0 ? tmp : h.eth_hdr.src_addr); + } + @hidden table tbl_do_action { + actions = { + do_action(); + } + const default_action = do_action(); + } + apply { + tbl_do_action.apply(); + } +} + +control egressControlImpl(inout EMPTY_H hdr, inout Meta meta, in psa_egress_input_metadata_t x, inout psa_egress_output_metadata_t ostd) { + apply { + } +} + +control deparser(packet_out pkt, out EMPTY_CLONE clone_i2e_meta, out EMPTY_RESUB resubmit_meta, out EMPTY_BRIDGE normal_meta, inout Headers h, in Meta local_metadata, in psa_ingress_output_metadata_t istd) { + @hidden action psadpdkissue23301l89() { + pkt.emit(h.eth_hdr); + } + @hidden table tbl_psadpdkissue23301l89 { + actions = { + psadpdkissue23301l89(); + } + const default_action = psadpdkissue23301l89(); + } + apply { + tbl_psadpdkissue23301l89.apply(); + } +} + +control egressDeparserImpl(packet_out buffer, out EMPTY_CLONE a, out EMPTY_RECIRC b, inout EMPTY_H c, in Meta d, in psa_egress_output_metadata_t e, in psa_egress_deparser_input_metadata_t f) { + apply { + } +} + +IngressPipeline(p(), ingress(), deparser()) ip; + +EgressPipeline(egressParserImpl(), egressControlImpl(), egressDeparserImpl()) ep; + +PSA_Switch(ip, PacketReplicationEngine(), ep, BufferingQueueingEngine()) main; + diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-issue2330-1.p4 b/testdata/p4_16_samples_outputs/psa-dpdk-issue2330-1.p4 new file mode 100644 index 00000000000..8eea28629ca --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-issue2330-1.p4 @@ -0,0 +1,87 @@ +#include +#include + +header EMPTY_H { +} + +struct EMPTY_RESUB { +} + +struct EMPTY_CLONE { +} + +struct EMPTY_BRIDGE { +} + +struct EMPTY_RECIRC { +} + +typedef bit<48> EthernetAddress; +header ethernet_t { + bit<48> dst_addr; + bit<48> src_addr; + bit<16> eth_type; +} + +struct Headers { + ethernet_t eth_hdr; +} + +struct Meta { +} + +void do_function(inout bit<16> val1, inout bit<48> val2) { +} +parser p(packet_in pkt, out Headers hdr, inout Meta m, in psa_ingress_parser_input_metadata_t x, in EMPTY_RESUB resub_meta, in EMPTY_RECIRC recirc_meta) { + state start { + transition parse_hdrs; + } + state parse_hdrs { + pkt.extract(hdr.eth_hdr); + transition accept; + } +} + +parser egressParserImpl(packet_in buffer, out EMPTY_H a, inout Meta b, in psa_egress_parser_input_metadata_t c, in EMPTY_BRIDGE d, in EMPTY_CLONE e, in EMPTY_CLONE f) { + state start { + transition accept; + } +} + +control ingress(inout Headers h, inout Meta m, in psa_ingress_input_metadata_t istd, inout psa_ingress_output_metadata_t ostd) { + action do_action() { + bool pointless_bool = true; + if (h.eth_hdr.dst_addr != 48w0) { + } else { + return; + } + do_function(h.eth_hdr.eth_type, h.eth_hdr.src_addr); + h.eth_hdr.src_addr = (pointless_bool ? 48w1 : 48w2); + } + apply { + do_action(); + } +} + +control egressControlImpl(inout EMPTY_H hdr, inout Meta meta, in psa_egress_input_metadata_t x, inout psa_egress_output_metadata_t ostd) { + apply { + } +} + +control deparser(packet_out pkt, out EMPTY_CLONE clone_i2e_meta, out EMPTY_RESUB resubmit_meta, out EMPTY_BRIDGE normal_meta, inout Headers h, in Meta local_metadata, in psa_ingress_output_metadata_t istd) { + apply { + pkt.emit(h); + } +} + +control egressDeparserImpl(packet_out buffer, out EMPTY_CLONE a, out EMPTY_RECIRC b, inout EMPTY_H c, in Meta d, in psa_egress_output_metadata_t e, in psa_egress_deparser_input_metadata_t f) { + apply { + } +} + +IngressPipeline(p(), ingress(), deparser()) ip; + +EgressPipeline(egressParserImpl(), egressControlImpl(), egressDeparserImpl()) ep; + +PSA_Switch(ip, PacketReplicationEngine(), ep, BufferingQueueingEngine()) main; + diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-issue2330-1.p4-error b/testdata/p4_16_samples_outputs/psa-dpdk-issue2330-1.p4-error new file mode 100644 index 00000000000..e69de29bb2d diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-issue2330-1.p4-stderr b/testdata/p4_16_samples_outputs/psa-dpdk-issue2330-1.p4-stderr new file mode 100644 index 00000000000..e69de29bb2d diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-issue2330-1.p4.bfrt.json b/testdata/p4_16_samples_outputs/psa-dpdk-issue2330-1.p4.bfrt.json new file mode 100644 index 00000000000..b6d66a630db --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-issue2330-1.p4.bfrt.json @@ -0,0 +1,5 @@ +{ + "schema_version" : "1.0.0", + "tables" : [], + "learn_filters" : [] +} \ No newline at end of file diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-issue2330-1.p4.entries.txt b/testdata/p4_16_samples_outputs/psa-dpdk-issue2330-1.p4.entries.txt new file mode 100644 index 00000000000..e69de29bb2d diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-issue2330-1.p4.p4info.txt b/testdata/p4_16_samples_outputs/psa-dpdk-issue2330-1.p4.p4info.txt new file mode 100644 index 00000000000..24e6ff8d85b --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-issue2330-1.p4.p4info.txt @@ -0,0 +1,10 @@ +pkg_info { + arch: "psa" +} +actions { + preamble { + id: 21566949 + name: "ingress.do_action" + alias: "do_action" + } +} diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-issue2330-1.p4.spec b/testdata/p4_16_samples_outputs/psa-dpdk-issue2330-1.p4.spec new file mode 100644 index 00000000000..8ce2e94b1d2 --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-issue2330-1.p4.spec @@ -0,0 +1,57 @@ + +struct ethernet_t { + bit<48> dst_addr + bit<48> src_addr + bit<16> eth_type +} + +struct psa_ingress_output_metadata_t { + bit<8> class_of_service + bit<8> clone + bit<16> clone_session_id + bit<8> drop + bit<8> resubmit + bit<32> multicast_group + bit<32> egress_port +} + +struct psa_egress_output_metadata_t { + bit<8> clone + bit<16> clone_session_id + bit<8> drop +} + +struct psa_egress_deparser_input_metadata_t { + bit<32> egress_port +} + +header eth_hdr instanceof ethernet_t + +struct Meta { + bit<32> psa_ingress_input_metadata_ingress_port + bit<8> psa_ingress_output_metadata_drop + bit<32> psa_ingress_output_metadata_egress_port + bit<48> Ingress_tmp + bit<8> Ingress_hasReturned +} +metadata instanceof Meta + +apply { + rx m.psa_ingress_input_metadata_ingress_port + mov m.psa_ingress_output_metadata_drop 0x0 + extract h.eth_hdr + mov m.Ingress_hasReturned 0 + jmpeq LABEL_FALSE h.eth_hdr.dst_addr 0x0 + jmp LABEL_END + LABEL_FALSE : mov m.Ingress_hasReturned 1 + LABEL_END : jmpneq LABEL_FALSE_0 m.Ingress_hasReturned 0x1 + jmp LABEL_END_0 + LABEL_FALSE_0 : mov m.Ingress_tmp 0x1 + mov h.eth_hdr.src_addr m.Ingress_tmp + LABEL_END_0 : jmpneq LABEL_DROP m.psa_ingress_output_metadata_drop 0x0 + emit h.eth_hdr + tx m.psa_ingress_output_metadata_egress_port + LABEL_DROP : drop +} + + diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-issue242-first.p4 b/testdata/p4_16_samples_outputs/psa-dpdk-issue242-first.p4 new file mode 100644 index 00000000000..d83491ef540 --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-issue242-first.p4 @@ -0,0 +1,101 @@ +#include +#include + +header EMPTY_H { +} + +struct EMPTY_RESUB { +} + +struct EMPTY_CLONE { +} + +struct EMPTY_BRIDGE { +} + +struct EMPTY_RECIRC { +} + +typedef bit<48> EthernetAddress; +typedef bit<32> IPv4Address; +header ethernet_t { + EthernetAddress dstAddr; + EthernetAddress srcAddr; + bit<16> etherType; +} + +header ipv4_t { + bit<4> version; + bit<4> ihl; + bit<8> diffserv; + bit<16> packet_length; + bit<16> identification; + bit<3> flags; + bit<13> fragOffset; + bit<8> ttl; + bit<8> protocol; + bit<16> hdrChecksum; + IPv4Address srcAddr; + IPv4Address dstAddr; +} + +struct Headers { + ethernet_t ethernet; + ipv4_t ip; +} + +struct Value { + bit<32> field1; +} + +struct Metadata { +} + +parser P(packet_in b, out Headers p, inout Metadata meta, in psa_ingress_parser_input_metadata_t x, in EMPTY_RESUB resub_meta, in EMPTY_RECIRC recirc_meta) { + state start { + b.extract(p.ethernet); + transition select(p.ethernet.etherType) { + 16w0x800: parse_ipv4; + } + } + state parse_ipv4 { + b.extract(p.ip); + transition accept; + } +} + +parser egressParserImpl(packet_in buffer, out EMPTY_H a, inout Metadata b, in psa_egress_parser_input_metadata_t c, in EMPTY_BRIDGE d, in EMPTY_CLONE e, in EMPTY_CLONE f) { + state start { + transition accept; + } +} + +control Ing(inout Headers headers, inout Metadata meta, in psa_ingress_input_metadata_t istd, inout psa_ingress_output_metadata_t ostd) { + apply { + ostd.egress_port = (PortId_t)32w0; + } +} + +control egressControlImpl(inout EMPTY_H hdr, inout Metadata meta, in psa_egress_input_metadata_t x, inout psa_egress_output_metadata_t ostd) { + apply { + } +} + +control DP(packet_out b, out EMPTY_CLONE clone_i2e_meta, out EMPTY_RESUB resubmit_meta, out EMPTY_BRIDGE normal_meta, inout Headers p, in Metadata local_metadata, in psa_ingress_output_metadata_t istd) { + apply { + b.emit(p.ethernet); + b.emit(p.ip); + } +} + +control egressDeparserImpl(packet_out buffer, out EMPTY_CLONE a, out EMPTY_RECIRC b, inout EMPTY_H c, in Metadata d, in psa_egress_output_metadata_t e, in psa_egress_deparser_input_metadata_t f) { + apply { + } +} + +IngressPipeline(P(), Ing(), DP()) ip; + +EgressPipeline(egressParserImpl(), egressControlImpl(), egressDeparserImpl()) ep; + +PSA_Switch(ip, PacketReplicationEngine(), ep, BufferingQueueingEngine()) main; + diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-issue242-frontend.p4 b/testdata/p4_16_samples_outputs/psa-dpdk-issue242-frontend.p4 new file mode 100644 index 00000000000..d83491ef540 --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-issue242-frontend.p4 @@ -0,0 +1,101 @@ +#include +#include + +header EMPTY_H { +} + +struct EMPTY_RESUB { +} + +struct EMPTY_CLONE { +} + +struct EMPTY_BRIDGE { +} + +struct EMPTY_RECIRC { +} + +typedef bit<48> EthernetAddress; +typedef bit<32> IPv4Address; +header ethernet_t { + EthernetAddress dstAddr; + EthernetAddress srcAddr; + bit<16> etherType; +} + +header ipv4_t { + bit<4> version; + bit<4> ihl; + bit<8> diffserv; + bit<16> packet_length; + bit<16> identification; + bit<3> flags; + bit<13> fragOffset; + bit<8> ttl; + bit<8> protocol; + bit<16> hdrChecksum; + IPv4Address srcAddr; + IPv4Address dstAddr; +} + +struct Headers { + ethernet_t ethernet; + ipv4_t ip; +} + +struct Value { + bit<32> field1; +} + +struct Metadata { +} + +parser P(packet_in b, out Headers p, inout Metadata meta, in psa_ingress_parser_input_metadata_t x, in EMPTY_RESUB resub_meta, in EMPTY_RECIRC recirc_meta) { + state start { + b.extract(p.ethernet); + transition select(p.ethernet.etherType) { + 16w0x800: parse_ipv4; + } + } + state parse_ipv4 { + b.extract(p.ip); + transition accept; + } +} + +parser egressParserImpl(packet_in buffer, out EMPTY_H a, inout Metadata b, in psa_egress_parser_input_metadata_t c, in EMPTY_BRIDGE d, in EMPTY_CLONE e, in EMPTY_CLONE f) { + state start { + transition accept; + } +} + +control Ing(inout Headers headers, inout Metadata meta, in psa_ingress_input_metadata_t istd, inout psa_ingress_output_metadata_t ostd) { + apply { + ostd.egress_port = (PortId_t)32w0; + } +} + +control egressControlImpl(inout EMPTY_H hdr, inout Metadata meta, in psa_egress_input_metadata_t x, inout psa_egress_output_metadata_t ostd) { + apply { + } +} + +control DP(packet_out b, out EMPTY_CLONE clone_i2e_meta, out EMPTY_RESUB resubmit_meta, out EMPTY_BRIDGE normal_meta, inout Headers p, in Metadata local_metadata, in psa_ingress_output_metadata_t istd) { + apply { + b.emit(p.ethernet); + b.emit(p.ip); + } +} + +control egressDeparserImpl(packet_out buffer, out EMPTY_CLONE a, out EMPTY_RECIRC b, inout EMPTY_H c, in Metadata d, in psa_egress_output_metadata_t e, in psa_egress_deparser_input_metadata_t f) { + apply { + } +} + +IngressPipeline(P(), Ing(), DP()) ip; + +EgressPipeline(egressParserImpl(), egressControlImpl(), egressDeparserImpl()) ep; + +PSA_Switch(ip, PacketReplicationEngine(), ep, BufferingQueueingEngine()) main; + diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-issue242-midend.p4 b/testdata/p4_16_samples_outputs/psa-dpdk-issue242-midend.p4 new file mode 100644 index 00000000000..f56e1d42deb --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-issue242-midend.p4 @@ -0,0 +1,124 @@ +#include +#include + +header EMPTY_H { +} + +struct EMPTY_RESUB { +} + +struct EMPTY_CLONE { +} + +struct EMPTY_BRIDGE { +} + +struct EMPTY_RECIRC { +} + +typedef bit<48> EthernetAddress; +typedef bit<32> IPv4Address; +header ethernet_t { + EthernetAddress dstAddr; + EthernetAddress srcAddr; + bit<16> etherType; +} + +header ipv4_t { + bit<4> version; + bit<4> ihl; + bit<8> diffserv; + bit<16> packet_length; + bit<16> identification; + bit<3> flags; + bit<13> fragOffset; + bit<8> ttl; + bit<8> protocol; + bit<16> hdrChecksum; + IPv4Address srcAddr; + IPv4Address dstAddr; +} + +struct Headers { + ethernet_t ethernet; + ipv4_t ip; +} + +struct Value { + bit<32> field1; +} + +struct Metadata { +} + +parser P(packet_in b, out Headers p, inout Metadata meta, in psa_ingress_parser_input_metadata_t x, in EMPTY_RESUB resub_meta, in EMPTY_RECIRC recirc_meta) { + state start { + b.extract(p.ethernet); + transition select(p.ethernet.etherType) { + 16w0x800: parse_ipv4; + default: noMatch; + } + } + state parse_ipv4 { + b.extract(p.ip); + transition accept; + } + state noMatch { + verify(false, error.NoMatch); + transition reject; + } +} + +parser egressParserImpl(packet_in buffer, out EMPTY_H a, inout Metadata b, in psa_egress_parser_input_metadata_t c, in EMPTY_BRIDGE d, in EMPTY_CLONE e, in EMPTY_CLONE f) { + state start { + transition accept; + } +} + +control Ing(inout Headers headers, inout Metadata meta, in psa_ingress_input_metadata_t istd, inout psa_ingress_output_metadata_t ostd) { + @hidden action psadpdkissue242l97() { + ostd.egress_port = 32w0; + } + @hidden table tbl_psadpdkissue242l97 { + actions = { + psadpdkissue242l97(); + } + const default_action = psadpdkissue242l97(); + } + apply { + tbl_psadpdkissue242l97.apply(); + } +} + +control egressControlImpl(inout EMPTY_H hdr, inout Metadata meta, in psa_egress_input_metadata_t x, inout psa_egress_output_metadata_t ostd) { + apply { + } +} + +control DP(packet_out b, out EMPTY_CLONE clone_i2e_meta, out EMPTY_RESUB resubmit_meta, out EMPTY_BRIDGE normal_meta, inout Headers p, in Metadata local_metadata, in psa_ingress_output_metadata_t istd) { + @hidden action psadpdkissue242l118() { + b.emit(p.ethernet); + b.emit(p.ip); + } + @hidden table tbl_psadpdkissue242l118 { + actions = { + psadpdkissue242l118(); + } + const default_action = psadpdkissue242l118(); + } + apply { + tbl_psadpdkissue242l118.apply(); + } +} + +control egressDeparserImpl(packet_out buffer, out EMPTY_CLONE a, out EMPTY_RECIRC b, inout EMPTY_H c, in Metadata d, in psa_egress_output_metadata_t e, in psa_egress_deparser_input_metadata_t f) { + apply { + } +} + +IngressPipeline(P(), Ing(), DP()) ip; + +EgressPipeline(egressParserImpl(), egressControlImpl(), egressDeparserImpl()) ep; + +PSA_Switch(ip, PacketReplicationEngine(), ep, BufferingQueueingEngine()) main; + diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-issue242.p4 b/testdata/p4_16_samples_outputs/psa-dpdk-issue242.p4 new file mode 100644 index 00000000000..6cfff149788 --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-issue242.p4 @@ -0,0 +1,101 @@ +#include +#include + +header EMPTY_H { +} + +struct EMPTY_RESUB { +} + +struct EMPTY_CLONE { +} + +struct EMPTY_BRIDGE { +} + +struct EMPTY_RECIRC { +} + +typedef bit<48> EthernetAddress; +typedef bit<32> IPv4Address; +header ethernet_t { + EthernetAddress dstAddr; + EthernetAddress srcAddr; + bit<16> etherType; +} + +header ipv4_t { + bit<4> version; + bit<4> ihl; + bit<8> diffserv; + bit<16> packet_length; + bit<16> identification; + bit<3> flags; + bit<13> fragOffset; + bit<8> ttl; + bit<8> protocol; + bit<16> hdrChecksum; + IPv4Address srcAddr; + IPv4Address dstAddr; +} + +struct Headers { + ethernet_t ethernet; + ipv4_t ip; +} + +struct Value { + bit<32> field1; +} + +struct Metadata { +} + +parser P(packet_in b, out Headers p, inout Metadata meta, in psa_ingress_parser_input_metadata_t x, in EMPTY_RESUB resub_meta, in EMPTY_RECIRC recirc_meta) { + state start { + b.extract(p.ethernet); + transition select(p.ethernet.etherType) { + 0x800: parse_ipv4; + } + } + state parse_ipv4 { + b.extract(p.ip); + transition accept; + } +} + +parser egressParserImpl(packet_in buffer, out EMPTY_H a, inout Metadata b, in psa_egress_parser_input_metadata_t c, in EMPTY_BRIDGE d, in EMPTY_CLONE e, in EMPTY_CLONE f) { + state start { + transition accept; + } +} + +control Ing(inout Headers headers, inout Metadata meta, in psa_ingress_input_metadata_t istd, inout psa_ingress_output_metadata_t ostd) { + apply { + ostd.egress_port = (PortId_t)(PortIdUint_t)0; + } +} + +control egressControlImpl(inout EMPTY_H hdr, inout Metadata meta, in psa_egress_input_metadata_t x, inout psa_egress_output_metadata_t ostd) { + apply { + } +} + +control DP(packet_out b, out EMPTY_CLONE clone_i2e_meta, out EMPTY_RESUB resubmit_meta, out EMPTY_BRIDGE normal_meta, inout Headers p, in Metadata local_metadata, in psa_ingress_output_metadata_t istd) { + apply { + b.emit(p.ethernet); + b.emit(p.ip); + } +} + +control egressDeparserImpl(packet_out buffer, out EMPTY_CLONE a, out EMPTY_RECIRC b, inout EMPTY_H c, in Metadata d, in psa_egress_output_metadata_t e, in psa_egress_deparser_input_metadata_t f) { + apply { + } +} + +IngressPipeline(P(), Ing(), DP()) ip; + +EgressPipeline(egressParserImpl(), egressControlImpl(), egressDeparserImpl()) ep; + +PSA_Switch(ip, PacketReplicationEngine(), ep, BufferingQueueingEngine()) main; + diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-issue242.p4-error b/testdata/p4_16_samples_outputs/psa-dpdk-issue242.p4-error new file mode 100644 index 00000000000..e69de29bb2d diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-issue242.p4-stderr b/testdata/p4_16_samples_outputs/psa-dpdk-issue242.p4-stderr new file mode 100644 index 00000000000..e69de29bb2d diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-issue242.p4.bfrt.json b/testdata/p4_16_samples_outputs/psa-dpdk-issue242.p4.bfrt.json new file mode 100644 index 00000000000..b6d66a630db --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-issue242.p4.bfrt.json @@ -0,0 +1,5 @@ +{ + "schema_version" : "1.0.0", + "tables" : [], + "learn_filters" : [] +} \ No newline at end of file diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-issue242.p4.entries.txt b/testdata/p4_16_samples_outputs/psa-dpdk-issue242.p4.entries.txt new file mode 100644 index 00000000000..e69de29bb2d diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-issue242.p4.p4info.txt b/testdata/p4_16_samples_outputs/psa-dpdk-issue242.p4.p4info.txt new file mode 100644 index 00000000000..77612386454 --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-issue242.p4.p4info.txt @@ -0,0 +1,3 @@ +pkg_info { + arch: "psa" +} diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-issue242.p4.spec b/testdata/p4_16_samples_outputs/psa-dpdk-issue242.p4.spec new file mode 100644 index 00000000000..49838f3b666 --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-issue242.p4.spec @@ -0,0 +1,69 @@ + +struct ethernet_t { + bit<48> dstAddr + bit<48> srcAddr + bit<16> etherType +} + +struct ipv4_t { + bit<8> version_ihl + bit<8> diffserv + bit<16> packet_length + bit<16> identification + bit<16> flags_fragOffset + bit<8> ttl + bit<8> protocol + bit<16> hdrChecksum + bit<32> srcAddr + bit<32> dstAddr +} + +struct psa_ingress_output_metadata_t { + bit<8> class_of_service + bit<8> clone + bit<16> clone_session_id + bit<8> drop + bit<8> resubmit + bit<32> multicast_group + bit<32> egress_port +} + +struct psa_egress_output_metadata_t { + bit<8> clone + bit<16> clone_session_id + bit<8> drop +} + +struct psa_egress_deparser_input_metadata_t { + bit<32> egress_port +} + +header ethernet instanceof ethernet_t +header ip instanceof ipv4_t + +struct Metadata { + bit<32> psa_ingress_input_metadata_ingress_port + bit<16> psa_ingress_input_metadata_parser_error + bit<8> psa_ingress_output_metadata_drop + bit<32> psa_ingress_output_metadata_egress_port +} +metadata instanceof Metadata + +apply { + rx m.psa_ingress_input_metadata_ingress_port + mov m.psa_ingress_output_metadata_drop 0x0 + extract h.ethernet + jmpeq P_PARSE_IPV4 h.ethernet.etherType 0x800 + jmp P_NOMATCH + P_PARSE_IPV4 : extract h.ip + jmp P_ACCEPT + P_NOMATCH : mov m.psa_ingress_input_metadata_parser_error 0x2 + P_ACCEPT : mov m.psa_ingress_output_metadata_egress_port 0x0 + jmpneq LABEL_DROP m.psa_ingress_output_metadata_drop 0x0 + emit h.ethernet + emit h.ip + tx m.psa_ingress_output_metadata_egress_port + LABEL_DROP : drop +} + + diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-issue2488-bmv2.p4-error b/testdata/p4_16_samples_outputs/psa-dpdk-issue2488-bmv2.p4-error new file mode 100644 index 00000000000..e69de29bb2d diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-issue2488-bmv2.p4.bfrt.json b/testdata/p4_16_samples_outputs/psa-dpdk-issue2488-bmv2.p4.bfrt.json new file mode 100644 index 00000000000..b6d66a630db --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-issue2488-bmv2.p4.bfrt.json @@ -0,0 +1,5 @@ +{ + "schema_version" : "1.0.0", + "tables" : [], + "learn_filters" : [] +} \ No newline at end of file diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-issue2488-bmv2.p4.spec b/testdata/p4_16_samples_outputs/psa-dpdk-issue2488-bmv2.p4.spec new file mode 100644 index 00000000000..b57ced69af8 --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-issue2488-bmv2.p4.spec @@ -0,0 +1,56 @@ + +struct ethernet_t { + bit<48> dst_addr + bit<48> src_addr + bit<16> eth_type +} + +struct psa_ingress_output_metadata_t { + bit<8> class_of_service + bit<8> clone + bit<16> clone_session_id + bit<8> drop + bit<8> resubmit + bit<32> multicast_group + bit<32> egress_port +} + +struct psa_egress_output_metadata_t { + bit<8> clone + bit<16> clone_session_id + bit<8> drop +} + +struct psa_egress_deparser_input_metadata_t { + bit<32> egress_port +} + +header eth_hdr instanceof ethernet_t +header Ingress_tmp instanceof ethernet_t + +struct Meta { + bit<32> psa_ingress_input_metadata_ingress_port + bit<8> psa_ingress_output_metadata_drop + bit<32> psa_ingress_output_metadata_egress_port + bit<48> Ingress_tmp_0 +} +metadata instanceof Meta + +apply { + rx m.psa_ingress_input_metadata_ingress_port + mov m.psa_ingress_output_metadata_drop 0x0 + extract h.eth_hdr + mov m.Ingress_tmp_0 h.eth_hdr.dst_addr + mov h.eth_hdr.dst_addr 0x1 + validate h.Ingress_tmp + mov h.Ingress_tmp.dst_addr m.Ingress_tmp_0 + mov h.Ingress_tmp.src_addr 0x2 + mov h.Ingress_tmp.eth_type 0x1 + mov h.eth_hdr.dst_addr 0x1 + jmpneq LABEL_DROP m.psa_ingress_output_metadata_drop 0x0 + emit h.eth_hdr + tx m.psa_ingress_output_metadata_egress_port + LABEL_DROP : drop +} + + diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-issue2488-first.p4 b/testdata/p4_16_samples_outputs/psa-dpdk-issue2488-first.p4 new file mode 100644 index 00000000000..0c1312a4635 --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-issue2488-first.p4 @@ -0,0 +1,85 @@ +#include +#include + +header EMPTY_H { +} + +struct EMPTY_RESUB { +} + +struct EMPTY_CLONE { +} + +struct EMPTY_BRIDGE { +} + +struct EMPTY_RECIRC { +} + +header ethernet_t { + bit<48> dst_addr; + bit<48> src_addr; + bit<16> eth_type; +} + +header H { + bit<16> a; +} + +struct Headers { + ethernet_t eth_hdr; +} + +struct Meta { +} + +parser p(packet_in pkt, out Headers hdr, inout Meta m, in psa_ingress_parser_input_metadata_t x, in EMPTY_RESUB resub_meta, in EMPTY_RECIRC recirc_meta) { + state start { + transition parse_hdrs; + } + state parse_hdrs { + pkt.extract(hdr.eth_hdr); + transition accept; + } +} + +parser egressParserImpl(packet_in buffer, out EMPTY_H a, inout Meta b, in psa_egress_parser_input_metadata_t c, in EMPTY_BRIDGE d, in EMPTY_CLONE e, in EMPTY_CLONE f) { + state start { + transition accept; + } +} + +bit<48> set(inout bit<48> s) { + s = 48w1; + return 48w2; +} +control ingress(inout Headers h, inout Meta m, in psa_ingress_input_metadata_t istd, inout psa_ingress_output_metadata_t ostd) { + Headers tmp = (Headers){eth_hdr = (ethernet_t){dst_addr = h.eth_hdr.dst_addr,src_addr = set(h.eth_hdr.dst_addr),eth_type = 16w1}}; + tuple, bit<48>> t = { h.eth_hdr.dst_addr, set(h.eth_hdr.dst_addr) }; + apply { + h = tmp; + } +} + +control egressControlImpl(inout EMPTY_H hdr, inout Meta meta, in psa_egress_input_metadata_t x, inout psa_egress_output_metadata_t ostd) { + apply { + } +} + +control deparser(packet_out b, out EMPTY_CLONE clone_i2e_meta, out EMPTY_RESUB resubmit_meta, out EMPTY_BRIDGE normal_meta, inout Headers h, in Meta local_metadata, in psa_ingress_output_metadata_t istd) { + apply { + b.emit(h); + } +} + +control egressDeparserImpl(packet_out buffer, out EMPTY_CLONE a, out EMPTY_RECIRC b, inout EMPTY_H c, in Meta d, in psa_egress_output_metadata_t e, in psa_egress_deparser_input_metadata_t f) { + apply { + } +} + +IngressPipeline(p(), ingress(), deparser()) ip; + +EgressPipeline(egressParserImpl(), egressControlImpl(), egressDeparserImpl()) ep; + +PSA_Switch(ip, PacketReplicationEngine(), ep, BufferingQueueingEngine()) main; + diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-issue2488-frontend.p4 b/testdata/p4_16_samples_outputs/psa-dpdk-issue2488-frontend.p4 new file mode 100644 index 00000000000..7ba90f48e9d --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-issue2488-frontend.p4 @@ -0,0 +1,107 @@ +#include +#include + +header EMPTY_H { +} + +struct EMPTY_RESUB { +} + +struct EMPTY_CLONE { +} + +struct EMPTY_BRIDGE { +} + +struct EMPTY_RECIRC { +} + +header ethernet_t { + bit<48> dst_addr; + bit<48> src_addr; + bit<16> eth_type; +} + +header H { + bit<16> a; +} + +struct Headers { + ethernet_t eth_hdr; +} + +struct Meta { +} + +parser p(packet_in pkt, out Headers hdr, inout Meta m, in psa_ingress_parser_input_metadata_t x, in EMPTY_RESUB resub_meta, in EMPTY_RECIRC recirc_meta) { + state start { + pkt.extract(hdr.eth_hdr); + transition accept; + } +} + +parser egressParserImpl(packet_in buffer, out EMPTY_H a, inout Meta b, in psa_egress_parser_input_metadata_t c, in EMPTY_BRIDGE d, in EMPTY_CLONE e, in EMPTY_CLONE f) { + state start { + transition accept; + } +} + +control ingress(inout Headers h, inout Meta m, in psa_ingress_input_metadata_t istd, inout psa_ingress_output_metadata_t ostd) { + @name("ingress.tmp") Headers tmp; + @name("ingress.tmp") ethernet_t tmp_0; + @name("ingress.tmp_1") bit<48> tmp_1; + @name("ingress.tmp_2") bit<48> tmp_2; + @name("ingress.tmp_3") bit<48> tmp_3; + @name("ingress.tmp_4") bit<16> tmp_4; + @name("ingress.s_0") bit<48> s; + @name("ingress.hasReturned") bool hasReturned; + @name("ingress.retval") bit<48> retval; + @name("ingress.s_1") bit<48> s_2; + @name("ingress.hasReturned") bool hasReturned_1; + @name("ingress.retval") bit<48> retval_1; + apply { + tmp_1 = h.eth_hdr.dst_addr; + s = h.eth_hdr.dst_addr; + hasReturned = false; + s = 48w1; + hasReturned = true; + retval = 48w2; + h.eth_hdr.dst_addr = s; + tmp_3 = retval; + tmp_2 = tmp_3; + tmp_4 = 16w1; + tmp_0.setValid(); + tmp_0 = (ethernet_t){dst_addr = tmp_1,src_addr = tmp_2,eth_type = tmp_4}; + tmp = (Headers){eth_hdr = tmp_0}; + s_2 = h.eth_hdr.dst_addr; + hasReturned_1 = false; + s_2 = 48w1; + hasReturned_1 = true; + retval_1 = 48w2; + h.eth_hdr.dst_addr = s_2; + h = tmp; + } +} + +control egressControlImpl(inout EMPTY_H hdr, inout Meta meta, in psa_egress_input_metadata_t x, inout psa_egress_output_metadata_t ostd) { + apply { + } +} + +control deparser(packet_out b, out EMPTY_CLONE clone_i2e_meta, out EMPTY_RESUB resubmit_meta, out EMPTY_BRIDGE normal_meta, inout Headers h, in Meta local_metadata, in psa_ingress_output_metadata_t istd) { + apply { + b.emit(h); + } +} + +control egressDeparserImpl(packet_out buffer, out EMPTY_CLONE a, out EMPTY_RECIRC b, inout EMPTY_H c, in Meta d, in psa_egress_output_metadata_t e, in psa_egress_deparser_input_metadata_t f) { + apply { + } +} + +IngressPipeline(p(), ingress(), deparser()) ip; + +EgressPipeline(egressParserImpl(), egressControlImpl(), egressDeparserImpl()) ep; + +PSA_Switch(ip, PacketReplicationEngine(), ep, BufferingQueueingEngine()) main; + diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-issue2488-midend.p4 b/testdata/p4_16_samples_outputs/psa-dpdk-issue2488-midend.p4 new file mode 100644 index 00000000000..c97ca8bad4d --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-issue2488-midend.p4 @@ -0,0 +1,103 @@ +#include +#include + +header EMPTY_H { +} + +struct EMPTY_RESUB { +} + +struct EMPTY_CLONE { +} + +struct EMPTY_BRIDGE { +} + +struct EMPTY_RECIRC { +} + +header ethernet_t { + bit<48> dst_addr; + bit<48> src_addr; + bit<16> eth_type; +} + +header H { + bit<16> a; +} + +struct Headers { + ethernet_t eth_hdr; +} + +struct Meta { +} + +parser p(packet_in pkt, out Headers hdr, inout Meta m, in psa_ingress_parser_input_metadata_t x, in EMPTY_RESUB resub_meta, in EMPTY_RECIRC recirc_meta) { + state start { + pkt.extract(hdr.eth_hdr); + transition accept; + } +} + +parser egressParserImpl(packet_in buffer, out EMPTY_H a, inout Meta b, in psa_egress_parser_input_metadata_t c, in EMPTY_BRIDGE d, in EMPTY_CLONE e, in EMPTY_CLONE f) { + state start { + transition accept; + } +} + +control ingress(inout Headers h, inout Meta m, in psa_ingress_input_metadata_t istd, inout psa_ingress_output_metadata_t ostd) { + @name("ingress.tmp") ethernet_t tmp_0; + @name("ingress.tmp_1") bit<48> tmp_1; + @hidden action psadpdkissue2488l61() { + tmp_1 = h.eth_hdr.dst_addr; + h.eth_hdr.dst_addr = 48w1; + tmp_0.setValid(); + tmp_0.dst_addr = tmp_1; + tmp_0.src_addr = 48w2; + tmp_0.eth_type = 16w1; + h.eth_hdr.dst_addr = 48w1; + h.eth_hdr = tmp_0; + } + @hidden table tbl_psadpdkissue2488l61 { + actions = { + psadpdkissue2488l61(); + } + const default_action = psadpdkissue2488l61(); + } + apply { + tbl_psadpdkissue2488l61.apply(); + } +} + +control egressControlImpl(inout EMPTY_H hdr, inout Meta meta, in psa_egress_input_metadata_t x, inout psa_egress_output_metadata_t ostd) { + apply { + } +} + +control deparser(packet_out b, out EMPTY_CLONE clone_i2e_meta, out EMPTY_RESUB resubmit_meta, out EMPTY_BRIDGE normal_meta, inout Headers h, in Meta local_metadata, in psa_ingress_output_metadata_t istd) { + @hidden action psadpdkissue2488l80() { + b.emit(h.eth_hdr); + } + @hidden table tbl_psadpdkissue2488l80 { + actions = { + psadpdkissue2488l80(); + } + const default_action = psadpdkissue2488l80(); + } + apply { + tbl_psadpdkissue2488l80.apply(); + } +} + +control egressDeparserImpl(packet_out buffer, out EMPTY_CLONE a, out EMPTY_RECIRC b, inout EMPTY_H c, in Meta d, in psa_egress_output_metadata_t e, in psa_egress_deparser_input_metadata_t f) { + apply { + } +} + +IngressPipeline(p(), ingress(), deparser()) ip; + +EgressPipeline(egressParserImpl(), egressControlImpl(), egressDeparserImpl()) ep; + +PSA_Switch(ip, PacketReplicationEngine(), ep, BufferingQueueingEngine()) main; + diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-issue2488.p4 b/testdata/p4_16_samples_outputs/psa-dpdk-issue2488.p4 new file mode 100644 index 00000000000..df77e56396b --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-issue2488.p4 @@ -0,0 +1,85 @@ +#include +#include + +header EMPTY_H { +} + +struct EMPTY_RESUB { +} + +struct EMPTY_CLONE { +} + +struct EMPTY_BRIDGE { +} + +struct EMPTY_RECIRC { +} + +header ethernet_t { + bit<48> dst_addr; + bit<48> src_addr; + bit<16> eth_type; +} + +header H { + bit<16> a; +} + +struct Headers { + ethernet_t eth_hdr; +} + +struct Meta { +} + +parser p(packet_in pkt, out Headers hdr, inout Meta m, in psa_ingress_parser_input_metadata_t x, in EMPTY_RESUB resub_meta, in EMPTY_RECIRC recirc_meta) { + state start { + transition parse_hdrs; + } + state parse_hdrs { + pkt.extract(hdr.eth_hdr); + transition accept; + } +} + +parser egressParserImpl(packet_in buffer, out EMPTY_H a, inout Meta b, in psa_egress_parser_input_metadata_t c, in EMPTY_BRIDGE d, in EMPTY_CLONE e, in EMPTY_CLONE f) { + state start { + transition accept; + } +} + +bit<48> set(inout bit<48> s) { + s = 1; + return 48w2; +} +control ingress(inout Headers h, inout Meta m, in psa_ingress_input_metadata_t istd, inout psa_ingress_output_metadata_t ostd) { + Headers tmp = { { h.eth_hdr.dst_addr, set(h.eth_hdr.dst_addr), 1 } }; + tuple, bit<48>> t = { h.eth_hdr.dst_addr, set(h.eth_hdr.dst_addr) }; + apply { + h = tmp; + } +} + +control egressControlImpl(inout EMPTY_H hdr, inout Meta meta, in psa_egress_input_metadata_t x, inout psa_egress_output_metadata_t ostd) { + apply { + } +} + +control deparser(packet_out b, out EMPTY_CLONE clone_i2e_meta, out EMPTY_RESUB resubmit_meta, out EMPTY_BRIDGE normal_meta, inout Headers h, in Meta local_metadata, in psa_ingress_output_metadata_t istd) { + apply { + b.emit(h); + } +} + +control egressDeparserImpl(packet_out buffer, out EMPTY_CLONE a, out EMPTY_RECIRC b, inout EMPTY_H c, in Meta d, in psa_egress_output_metadata_t e, in psa_egress_deparser_input_metadata_t f) { + apply { + } +} + +IngressPipeline(p(), ingress(), deparser()) ip; + +EgressPipeline(egressParserImpl(), egressControlImpl(), egressDeparserImpl()) ep; + +PSA_Switch(ip, PacketReplicationEngine(), ep, BufferingQueueingEngine()) main; + diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-issue2488.p4-error b/testdata/p4_16_samples_outputs/psa-dpdk-issue2488.p4-error new file mode 100644 index 00000000000..e69de29bb2d diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-issue2488.p4-stderr b/testdata/p4_16_samples_outputs/psa-dpdk-issue2488.p4-stderr new file mode 100644 index 00000000000..e69de29bb2d diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-issue2488.p4.bfrt.json b/testdata/p4_16_samples_outputs/psa-dpdk-issue2488.p4.bfrt.json new file mode 100644 index 00000000000..b6d66a630db --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-issue2488.p4.bfrt.json @@ -0,0 +1,5 @@ +{ + "schema_version" : "1.0.0", + "tables" : [], + "learn_filters" : [] +} \ No newline at end of file diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-issue2488.p4.entries.txt b/testdata/p4_16_samples_outputs/psa-dpdk-issue2488.p4.entries.txt new file mode 100644 index 00000000000..e69de29bb2d diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-issue2488.p4.p4info.txt b/testdata/p4_16_samples_outputs/psa-dpdk-issue2488.p4.p4info.txt new file mode 100644 index 00000000000..77612386454 --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-issue2488.p4.p4info.txt @@ -0,0 +1,3 @@ +pkg_info { + arch: "psa" +} diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-issue2488.p4.spec b/testdata/p4_16_samples_outputs/psa-dpdk-issue2488.p4.spec new file mode 100644 index 00000000000..b57ced69af8 --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-issue2488.p4.spec @@ -0,0 +1,56 @@ + +struct ethernet_t { + bit<48> dst_addr + bit<48> src_addr + bit<16> eth_type +} + +struct psa_ingress_output_metadata_t { + bit<8> class_of_service + bit<8> clone + bit<16> clone_session_id + bit<8> drop + bit<8> resubmit + bit<32> multicast_group + bit<32> egress_port +} + +struct psa_egress_output_metadata_t { + bit<8> clone + bit<16> clone_session_id + bit<8> drop +} + +struct psa_egress_deparser_input_metadata_t { + bit<32> egress_port +} + +header eth_hdr instanceof ethernet_t +header Ingress_tmp instanceof ethernet_t + +struct Meta { + bit<32> psa_ingress_input_metadata_ingress_port + bit<8> psa_ingress_output_metadata_drop + bit<32> psa_ingress_output_metadata_egress_port + bit<48> Ingress_tmp_0 +} +metadata instanceof Meta + +apply { + rx m.psa_ingress_input_metadata_ingress_port + mov m.psa_ingress_output_metadata_drop 0x0 + extract h.eth_hdr + mov m.Ingress_tmp_0 h.eth_hdr.dst_addr + mov h.eth_hdr.dst_addr 0x1 + validate h.Ingress_tmp + mov h.Ingress_tmp.dst_addr m.Ingress_tmp_0 + mov h.Ingress_tmp.src_addr 0x2 + mov h.Ingress_tmp.eth_type 0x1 + mov h.eth_hdr.dst_addr 0x1 + jmpneq LABEL_DROP m.psa_ingress_output_metadata_drop 0x0 + emit h.eth_hdr + tx m.psa_ingress_output_metadata_egress_port + LABEL_DROP : drop +} + + diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-issue2614-bmv2.p4-error b/testdata/p4_16_samples_outputs/psa-dpdk-issue2614-bmv2.p4-error new file mode 100644 index 00000000000..e69de29bb2d diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-issue2614-bmv2.p4.bfrt.json b/testdata/p4_16_samples_outputs/psa-dpdk-issue2614-bmv2.p4.bfrt.json new file mode 100644 index 00000000000..b6d66a630db --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-issue2614-bmv2.p4.bfrt.json @@ -0,0 +1,5 @@ +{ + "schema_version" : "1.0.0", + "tables" : [], + "learn_filters" : [] +} \ No newline at end of file diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-issue2614-bmv2.p4.spec b/testdata/p4_16_samples_outputs/psa-dpdk-issue2614-bmv2.p4.spec new file mode 100644 index 00000000000..b39504e7d64 --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-issue2614-bmv2.p4.spec @@ -0,0 +1,55 @@ + +struct ethernet_t { + bit<48> dst_addr + bit<48> src_addr + bit<16> eth_type +} + +struct H { + bit<8> a +} + +struct psa_ingress_output_metadata_t { + bit<8> class_of_service + bit<8> clone + bit<16> clone_session_id + bit<8> drop + bit<8> resubmit + bit<32> multicast_group + bit<32> egress_port +} + +struct psa_egress_output_metadata_t { + bit<8> clone + bit<16> clone_session_id + bit<8> drop +} + +struct psa_egress_deparser_input_metadata_t { + bit<32> egress_port +} + +header eth_hdr instanceof ethernet_t +header h instanceof H + +struct Meta { + bit<32> psa_ingress_input_metadata_ingress_port + bit<8> psa_ingress_output_metadata_drop + bit<32> psa_ingress_output_metadata_egress_port +} +metadata instanceof Meta + +apply { + rx m.psa_ingress_input_metadata_ingress_port + mov m.psa_ingress_output_metadata_drop 0x0 + extract h.eth_hdr + extract h.h + mov h.h.a 0x80 + jmpneq LABEL_DROP m.psa_ingress_output_metadata_drop 0x0 + emit h.eth_hdr + emit h.h + tx m.psa_ingress_output_metadata_egress_port + LABEL_DROP : drop +} + + diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-issue2614-first.p4 b/testdata/p4_16_samples_outputs/psa-dpdk-issue2614-first.p4 new file mode 100644 index 00000000000..4e583e1b506 --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-issue2614-first.p4 @@ -0,0 +1,82 @@ +#include +#include + +header EMPTY_H { +} + +struct EMPTY_RESUB { +} + +struct EMPTY_CLONE { +} + +struct EMPTY_BRIDGE { +} + +struct EMPTY_RECIRC { +} + +header ethernet_t { + bit<48> dst_addr; + bit<48> src_addr; + bit<16> eth_type; +} + +header H { + bit<8> a; +} + +struct Headers { + ethernet_t eth_hdr; + H h; +} + +struct Meta { +} + +parser p(packet_in pkt, out Headers hdr, inout Meta m, in psa_ingress_parser_input_metadata_t x, in EMPTY_RESUB resub_meta, in EMPTY_RECIRC recirc_meta) { + state start { + transition parse_hdrs; + } + state parse_hdrs { + pkt.extract(hdr.eth_hdr); + pkt.extract(hdr.h); + transition accept; + } +} + +parser egressParserImpl(packet_in buffer, out EMPTY_H a, inout Meta b, in psa_egress_parser_input_metadata_t c, in EMPTY_BRIDGE d, in EMPTY_CLONE e, in EMPTY_CLONE f) { + state start { + transition accept; + } +} + +control ingress(inout Headers h, inout Meta m, in psa_ingress_input_metadata_t istd, inout psa_ingress_output_metadata_t ostd) { + bit<8> tmp1 = 8w1; + apply { + h.h.a = tmp1[0:0] ++ 7w0; + } +} + +control egressControlImpl(inout EMPTY_H hdr, inout Meta meta, in psa_egress_input_metadata_t x, inout psa_egress_output_metadata_t ostd) { + apply { + } +} + +control deparser(packet_out b, out EMPTY_CLONE clone_i2e_meta, out EMPTY_RESUB resubmit_meta, out EMPTY_BRIDGE normal_meta, inout Headers hdr, in Meta local_metadata, in psa_ingress_output_metadata_t istd) { + apply { + b.emit(hdr); + } +} + +control egressDeparserImpl(packet_out buffer, out EMPTY_CLONE a, out EMPTY_RECIRC b, inout EMPTY_H c, in Meta d, in psa_egress_output_metadata_t e, in psa_egress_deparser_input_metadata_t f) { + apply { + } +} + +IngressPipeline(p(), ingress(), deparser()) ip; + +EgressPipeline(egressParserImpl(), egressControlImpl(), egressDeparserImpl()) ep; + +PSA_Switch(ip, PacketReplicationEngine(), ep, BufferingQueueingEngine()) main; + diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-issue2614-frontend.p4 b/testdata/p4_16_samples_outputs/psa-dpdk-issue2614-frontend.p4 new file mode 100644 index 00000000000..da4b149bf1b --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-issue2614-frontend.p4 @@ -0,0 +1,80 @@ +#include +#include + +header EMPTY_H { +} + +struct EMPTY_RESUB { +} + +struct EMPTY_CLONE { +} + +struct EMPTY_BRIDGE { +} + +struct EMPTY_RECIRC { +} + +header ethernet_t { + bit<48> dst_addr; + bit<48> src_addr; + bit<16> eth_type; +} + +header H { + bit<8> a; +} + +struct Headers { + ethernet_t eth_hdr; + H h; +} + +struct Meta { +} + +parser p(packet_in pkt, out Headers hdr, inout Meta m, in psa_ingress_parser_input_metadata_t x, in EMPTY_RESUB resub_meta, in EMPTY_RECIRC recirc_meta) { + state start { + pkt.extract(hdr.eth_hdr); + pkt.extract(hdr.h); + transition accept; + } +} + +parser egressParserImpl(packet_in buffer, out EMPTY_H a, inout Meta b, in psa_egress_parser_input_metadata_t c, in EMPTY_BRIDGE d, in EMPTY_CLONE e, in EMPTY_CLONE f) { + state start { + transition accept; + } +} + +control ingress(inout Headers h, inout Meta m, in psa_ingress_input_metadata_t istd, inout psa_ingress_output_metadata_t ostd) { + @name("ingress.tmp1") bit<8> tmp1_0; + apply { + tmp1_0 = 8w1; + h.h.a = tmp1_0[0:0] ++ 7w0; + } +} + +control egressControlImpl(inout EMPTY_H hdr, inout Meta meta, in psa_egress_input_metadata_t x, inout psa_egress_output_metadata_t ostd) { + apply { + } +} + +control deparser(packet_out b, out EMPTY_CLONE clone_i2e_meta, out EMPTY_RESUB resubmit_meta, out EMPTY_BRIDGE normal_meta, inout Headers hdr, in Meta local_metadata, in psa_ingress_output_metadata_t istd) { + apply { + b.emit(hdr); + } +} + +control egressDeparserImpl(packet_out buffer, out EMPTY_CLONE a, out EMPTY_RECIRC b, inout EMPTY_H c, in Meta d, in psa_egress_output_metadata_t e, in psa_egress_deparser_input_metadata_t f) { + apply { + } +} + +IngressPipeline(p(), ingress(), deparser()) ip; + +EgressPipeline(egressParserImpl(), egressControlImpl(), egressDeparserImpl()) ep; + +PSA_Switch(ip, PacketReplicationEngine(), ep, BufferingQueueingEngine()) main; + diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-issue2614-midend.p4 b/testdata/p4_16_samples_outputs/psa-dpdk-issue2614-midend.p4 new file mode 100644 index 00000000000..9ac218bad2c --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-issue2614-midend.p4 @@ -0,0 +1,97 @@ +#include +#include + +header EMPTY_H { +} + +struct EMPTY_RESUB { +} + +struct EMPTY_CLONE { +} + +struct EMPTY_BRIDGE { +} + +struct EMPTY_RECIRC { +} + +header ethernet_t { + bit<48> dst_addr; + bit<48> src_addr; + bit<16> eth_type; +} + +header H { + bit<8> a; +} + +struct Headers { + ethernet_t eth_hdr; + H h; +} + +struct Meta { +} + +parser p(packet_in pkt, out Headers hdr, inout Meta m, in psa_ingress_parser_input_metadata_t x, in EMPTY_RESUB resub_meta, in EMPTY_RECIRC recirc_meta) { + state start { + pkt.extract(hdr.eth_hdr); + pkt.extract(hdr.h); + transition accept; + } +} + +parser egressParserImpl(packet_in buffer, out EMPTY_H a, inout Meta b, in psa_egress_parser_input_metadata_t c, in EMPTY_BRIDGE d, in EMPTY_CLONE e, in EMPTY_CLONE f) { + state start { + transition accept; + } +} + +control ingress(inout Headers h, inout Meta m, in psa_ingress_input_metadata_t istd, inout psa_ingress_output_metadata_t ostd) { + @hidden action psadpdkissue2614l59() { + h.h.a = 8w128; + } + @hidden table tbl_psadpdkissue2614l59 { + actions = { + psadpdkissue2614l59(); + } + const default_action = psadpdkissue2614l59(); + } + apply { + tbl_psadpdkissue2614l59.apply(); + } +} + +control egressControlImpl(inout EMPTY_H hdr, inout Meta meta, in psa_egress_input_metadata_t x, inout psa_egress_output_metadata_t ostd) { + apply { + } +} + +control deparser(packet_out b, out EMPTY_CLONE clone_i2e_meta, out EMPTY_RESUB resubmit_meta, out EMPTY_BRIDGE normal_meta, inout Headers hdr, in Meta local_metadata, in psa_ingress_output_metadata_t istd) { + @hidden action psadpdkissue2614l78() { + b.emit(hdr.eth_hdr); + b.emit(hdr.h); + } + @hidden table tbl_psadpdkissue2614l78 { + actions = { + psadpdkissue2614l78(); + } + const default_action = psadpdkissue2614l78(); + } + apply { + tbl_psadpdkissue2614l78.apply(); + } +} + +control egressDeparserImpl(packet_out buffer, out EMPTY_CLONE a, out EMPTY_RECIRC b, inout EMPTY_H c, in Meta d, in psa_egress_output_metadata_t e, in psa_egress_deparser_input_metadata_t f) { + apply { + } +} + +IngressPipeline(p(), ingress(), deparser()) ip; + +EgressPipeline(egressParserImpl(), egressControlImpl(), egressDeparserImpl()) ep; + +PSA_Switch(ip, PacketReplicationEngine(), ep, BufferingQueueingEngine()) main; + diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-issue2614.p4 b/testdata/p4_16_samples_outputs/psa-dpdk-issue2614.p4 new file mode 100644 index 00000000000..3b8e84a8039 --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-issue2614.p4 @@ -0,0 +1,82 @@ +#include +#include + +header EMPTY_H { +} + +struct EMPTY_RESUB { +} + +struct EMPTY_CLONE { +} + +struct EMPTY_BRIDGE { +} + +struct EMPTY_RECIRC { +} + +header ethernet_t { + bit<48> dst_addr; + bit<48> src_addr; + bit<16> eth_type; +} + +header H { + bit<8> a; +} + +struct Headers { + ethernet_t eth_hdr; + H h; +} + +struct Meta { +} + +parser p(packet_in pkt, out Headers hdr, inout Meta m, in psa_ingress_parser_input_metadata_t x, in EMPTY_RESUB resub_meta, in EMPTY_RECIRC recirc_meta) { + state start { + transition parse_hdrs; + } + state parse_hdrs { + pkt.extract(hdr.eth_hdr); + pkt.extract(hdr.h); + transition accept; + } +} + +parser egressParserImpl(packet_in buffer, out EMPTY_H a, inout Meta b, in psa_egress_parser_input_metadata_t c, in EMPTY_BRIDGE d, in EMPTY_CLONE e, in EMPTY_CLONE f) { + state start { + transition accept; + } +} + +control ingress(inout Headers h, inout Meta m, in psa_ingress_input_metadata_t istd, inout psa_ingress_output_metadata_t ostd) { + bit<8> tmp1 = 8w1; + apply { + h.h.a = ((bit<9>)tmp1 << 8w8)[8:1]; + } +} + +control egressControlImpl(inout EMPTY_H hdr, inout Meta meta, in psa_egress_input_metadata_t x, inout psa_egress_output_metadata_t ostd) { + apply { + } +} + +control deparser(packet_out b, out EMPTY_CLONE clone_i2e_meta, out EMPTY_RESUB resubmit_meta, out EMPTY_BRIDGE normal_meta, inout Headers hdr, in Meta local_metadata, in psa_ingress_output_metadata_t istd) { + apply { + b.emit(hdr); + } +} + +control egressDeparserImpl(packet_out buffer, out EMPTY_CLONE a, out EMPTY_RECIRC b, inout EMPTY_H c, in Meta d, in psa_egress_output_metadata_t e, in psa_egress_deparser_input_metadata_t f) { + apply { + } +} + +IngressPipeline(p(), ingress(), deparser()) ip; + +EgressPipeline(egressParserImpl(), egressControlImpl(), egressDeparserImpl()) ep; + +PSA_Switch(ip, PacketReplicationEngine(), ep, BufferingQueueingEngine()) main; + diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-issue2614.p4-error b/testdata/p4_16_samples_outputs/psa-dpdk-issue2614.p4-error new file mode 100644 index 00000000000..e69de29bb2d diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-issue2614.p4-stderr b/testdata/p4_16_samples_outputs/psa-dpdk-issue2614.p4-stderr new file mode 100644 index 00000000000..e69de29bb2d diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-issue2614.p4.bfrt.json b/testdata/p4_16_samples_outputs/psa-dpdk-issue2614.p4.bfrt.json new file mode 100644 index 00000000000..b6d66a630db --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-issue2614.p4.bfrt.json @@ -0,0 +1,5 @@ +{ + "schema_version" : "1.0.0", + "tables" : [], + "learn_filters" : [] +} \ No newline at end of file diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-issue2614.p4.entries.txt b/testdata/p4_16_samples_outputs/psa-dpdk-issue2614.p4.entries.txt new file mode 100644 index 00000000000..e69de29bb2d diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-issue2614.p4.p4info.txt b/testdata/p4_16_samples_outputs/psa-dpdk-issue2614.p4.p4info.txt new file mode 100644 index 00000000000..77612386454 --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-issue2614.p4.p4info.txt @@ -0,0 +1,3 @@ +pkg_info { + arch: "psa" +} diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-issue2614.p4.spec b/testdata/p4_16_samples_outputs/psa-dpdk-issue2614.p4.spec new file mode 100644 index 00000000000..b39504e7d64 --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-issue2614.p4.spec @@ -0,0 +1,55 @@ + +struct ethernet_t { + bit<48> dst_addr + bit<48> src_addr + bit<16> eth_type +} + +struct H { + bit<8> a +} + +struct psa_ingress_output_metadata_t { + bit<8> class_of_service + bit<8> clone + bit<16> clone_session_id + bit<8> drop + bit<8> resubmit + bit<32> multicast_group + bit<32> egress_port +} + +struct psa_egress_output_metadata_t { + bit<8> clone + bit<16> clone_session_id + bit<8> drop +} + +struct psa_egress_deparser_input_metadata_t { + bit<32> egress_port +} + +header eth_hdr instanceof ethernet_t +header h instanceof H + +struct Meta { + bit<32> psa_ingress_input_metadata_ingress_port + bit<8> psa_ingress_output_metadata_drop + bit<32> psa_ingress_output_metadata_egress_port +} +metadata instanceof Meta + +apply { + rx m.psa_ingress_input_metadata_ingress_port + mov m.psa_ingress_output_metadata_drop 0x0 + extract h.eth_hdr + extract h.h + mov h.h.a 0x80 + jmpneq LABEL_DROP m.psa_ingress_output_metadata_drop 0x0 + emit h.eth_hdr + emit h.h + tx m.psa_ingress_output_metadata_egress_port + LABEL_DROP : drop +} + + diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-issue272-1-bmv2.p4-error b/testdata/p4_16_samples_outputs/psa-dpdk-issue272-1-bmv2.p4-error new file mode 100644 index 00000000000..e69de29bb2d diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-issue272-1-bmv2.p4.bfrt.json b/testdata/p4_16_samples_outputs/psa-dpdk-issue272-1-bmv2.p4.bfrt.json new file mode 100644 index 00000000000..b6d66a630db --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-issue272-1-bmv2.p4.bfrt.json @@ -0,0 +1,5 @@ +{ + "schema_version" : "1.0.0", + "tables" : [], + "learn_filters" : [] +} \ No newline at end of file diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-issue272-1-bmv2.p4.spec b/testdata/p4_16_samples_outputs/psa-dpdk-issue272-1-bmv2.p4.spec new file mode 100644 index 00000000000..1fd3f815b38 --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-issue272-1-bmv2.p4.spec @@ -0,0 +1,40 @@ + +struct psa_ingress_output_metadata_t { + bit<8> class_of_service + bit<8> clone + bit<16> clone_session_id + bit<8> drop + bit<8> resubmit + bit<32> multicast_group + bit<32> egress_port +} + +struct psa_egress_output_metadata_t { + bit<8> clone + bit<16> clone_session_id + bit<8> drop +} + +struct psa_egress_deparser_input_metadata_t { + bit<32> egress_port +} + + +struct M { + bit<32> psa_ingress_input_metadata_ingress_port + bit<8> psa_ingress_output_metadata_drop + bit<32> psa_ingress_output_metadata_egress_port + bit<8> local_metadata__some_meta_flag0 +} +metadata instanceof M + +apply { + rx m.psa_ingress_input_metadata_ingress_port + mov m.psa_ingress_output_metadata_drop 0x0 + mov m.local_metadata__some_meta_flag0 1 + jmpneq LABEL_DROP m.psa_ingress_output_metadata_drop 0x0 + tx m.psa_ingress_output_metadata_egress_port + LABEL_DROP : drop +} + + diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-issue272-1-first.p4 b/testdata/p4_16_samples_outputs/psa-dpdk-issue272-1-first.p4 new file mode 100644 index 00000000000..646adc36b94 --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-issue272-1-first.p4 @@ -0,0 +1,68 @@ +#include +#include + +header EMPTY_H { +} + +struct EMPTY_RESUB { +} + +struct EMPTY_CLONE { +} + +struct EMPTY_BRIDGE { +} + +struct EMPTY_RECIRC { +} + +struct some_meta_t { + bool flag; +} + +struct H { +} + +struct M { + some_meta_t some_meta; +} + +parser ParserI(packet_in pk, out H hdr, inout M meta, in psa_ingress_parser_input_metadata_t x, in EMPTY_RESUB resub_meta, in EMPTY_RECIRC recirc_meta) { + state start { + transition accept; + } +} + +parser egressParserImpl(packet_in buffer, out EMPTY_H a, inout M b, in psa_egress_parser_input_metadata_t c, in EMPTY_BRIDGE d, in EMPTY_CLONE e, in EMPTY_CLONE f) { + state start { + transition accept; + } +} + +control IngressI(inout H hdr, inout M meta, in psa_ingress_input_metadata_t istd, inout psa_ingress_output_metadata_t ostd) { + apply { + meta.some_meta.flag = true; + } +} + +control egressControlImpl(inout EMPTY_H hdr, inout M meta, in psa_egress_input_metadata_t x, inout psa_egress_output_metadata_t ostd) { + apply { + } +} + +control DeparserI(packet_out packet, out EMPTY_CLONE clone_i2e_meta, out EMPTY_RESUB resubmit_meta, out EMPTY_BRIDGE normal_meta, inout H hdr, in M local_metadata, in psa_ingress_output_metadata_t istd) { + apply { + } +} + +control egressDeparserImpl(packet_out buffer, out EMPTY_CLONE a, out EMPTY_RECIRC b, inout EMPTY_H c, in M d, in psa_egress_output_metadata_t e, in psa_egress_deparser_input_metadata_t f) { + apply { + } +} + +IngressPipeline(ParserI(), IngressI(), DeparserI()) ip; + +EgressPipeline(egressParserImpl(), egressControlImpl(), egressDeparserImpl()) ep; + +PSA_Switch(ip, PacketReplicationEngine(), ep, BufferingQueueingEngine()) main; + diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-issue272-1-frontend.p4 b/testdata/p4_16_samples_outputs/psa-dpdk-issue272-1-frontend.p4 new file mode 100644 index 00000000000..646adc36b94 --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-issue272-1-frontend.p4 @@ -0,0 +1,68 @@ +#include +#include + +header EMPTY_H { +} + +struct EMPTY_RESUB { +} + +struct EMPTY_CLONE { +} + +struct EMPTY_BRIDGE { +} + +struct EMPTY_RECIRC { +} + +struct some_meta_t { + bool flag; +} + +struct H { +} + +struct M { + some_meta_t some_meta; +} + +parser ParserI(packet_in pk, out H hdr, inout M meta, in psa_ingress_parser_input_metadata_t x, in EMPTY_RESUB resub_meta, in EMPTY_RECIRC recirc_meta) { + state start { + transition accept; + } +} + +parser egressParserImpl(packet_in buffer, out EMPTY_H a, inout M b, in psa_egress_parser_input_metadata_t c, in EMPTY_BRIDGE d, in EMPTY_CLONE e, in EMPTY_CLONE f) { + state start { + transition accept; + } +} + +control IngressI(inout H hdr, inout M meta, in psa_ingress_input_metadata_t istd, inout psa_ingress_output_metadata_t ostd) { + apply { + meta.some_meta.flag = true; + } +} + +control egressControlImpl(inout EMPTY_H hdr, inout M meta, in psa_egress_input_metadata_t x, inout psa_egress_output_metadata_t ostd) { + apply { + } +} + +control DeparserI(packet_out packet, out EMPTY_CLONE clone_i2e_meta, out EMPTY_RESUB resubmit_meta, out EMPTY_BRIDGE normal_meta, inout H hdr, in M local_metadata, in psa_ingress_output_metadata_t istd) { + apply { + } +} + +control egressDeparserImpl(packet_out buffer, out EMPTY_CLONE a, out EMPTY_RECIRC b, inout EMPTY_H c, in M d, in psa_egress_output_metadata_t e, in psa_egress_deparser_input_metadata_t f) { + apply { + } +} + +IngressPipeline(ParserI(), IngressI(), DeparserI()) ip; + +EgressPipeline(egressParserImpl(), egressControlImpl(), egressDeparserImpl()) ep; + +PSA_Switch(ip, PacketReplicationEngine(), ep, BufferingQueueingEngine()) main; + diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-issue272-1-midend.p4 b/testdata/p4_16_samples_outputs/psa-dpdk-issue272-1-midend.p4 new file mode 100644 index 00000000000..8ddf43f2cba --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-issue272-1-midend.p4 @@ -0,0 +1,77 @@ +#include +#include + +header EMPTY_H { +} + +struct EMPTY_RESUB { +} + +struct EMPTY_CLONE { +} + +struct EMPTY_BRIDGE { +} + +struct EMPTY_RECIRC { +} + +struct some_meta_t { + bool flag; +} + +struct H { +} + +struct M { + bool _some_meta_flag0; +} + +parser ParserI(packet_in pk, out H hdr, inout M meta, in psa_ingress_parser_input_metadata_t x, in EMPTY_RESUB resub_meta, in EMPTY_RECIRC recirc_meta) { + state start { + transition accept; + } +} + +parser egressParserImpl(packet_in buffer, out EMPTY_H a, inout M b, in psa_egress_parser_input_metadata_t c, in EMPTY_BRIDGE d, in EMPTY_CLONE e, in EMPTY_CLONE f) { + state start { + transition accept; + } +} + +control IngressI(inout H hdr, inout M meta, in psa_ingress_input_metadata_t istd, inout psa_ingress_output_metadata_t ostd) { + @hidden action psadpdkissue2721l56() { + meta._some_meta_flag0 = true; + } + @hidden table tbl_psadpdkissue2721l56 { + actions = { + psadpdkissue2721l56(); + } + const default_action = psadpdkissue2721l56(); + } + apply { + tbl_psadpdkissue2721l56.apply(); + } +} + +control egressControlImpl(inout EMPTY_H hdr, inout M meta, in psa_egress_input_metadata_t x, inout psa_egress_output_metadata_t ostd) { + apply { + } +} + +control DeparserI(packet_out packet, out EMPTY_CLONE clone_i2e_meta, out EMPTY_RESUB resubmit_meta, out EMPTY_BRIDGE normal_meta, inout H hdr, in M local_metadata, in psa_ingress_output_metadata_t istd) { + apply { + } +} + +control egressDeparserImpl(packet_out buffer, out EMPTY_CLONE a, out EMPTY_RECIRC b, inout EMPTY_H c, in M d, in psa_egress_output_metadata_t e, in psa_egress_deparser_input_metadata_t f) { + apply { + } +} + +IngressPipeline(ParserI(), IngressI(), DeparserI()) ip; + +EgressPipeline(egressParserImpl(), egressControlImpl(), egressDeparserImpl()) ep; + +PSA_Switch(ip, PacketReplicationEngine(), ep, BufferingQueueingEngine()) main; + diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-issue272-1.p4 b/testdata/p4_16_samples_outputs/psa-dpdk-issue272-1.p4 new file mode 100644 index 00000000000..bcc28e9a8ee --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-issue272-1.p4 @@ -0,0 +1,68 @@ +#include +#include + +header EMPTY_H { +} + +struct EMPTY_RESUB { +} + +struct EMPTY_CLONE { +} + +struct EMPTY_BRIDGE { +} + +struct EMPTY_RECIRC { +} + +struct some_meta_t { + bool flag; +} + +struct H { +} + +struct M { + some_meta_t some_meta; +} + +parser ParserI(packet_in pk, out H hdr, inout M meta, in psa_ingress_parser_input_metadata_t x, in EMPTY_RESUB resub_meta, in EMPTY_RECIRC recirc_meta) { + state start { + transition accept; + } +} + +parser egressParserImpl(packet_in buffer, out EMPTY_H a, inout M b, in psa_egress_parser_input_metadata_t c, in EMPTY_BRIDGE d, in EMPTY_CLONE e, in EMPTY_CLONE f) { + state start { + transition accept; + } +} + +control IngressI(inout H hdr, inout M meta, in psa_ingress_input_metadata_t istd, inout psa_ingress_output_metadata_t ostd) { + apply { + meta.some_meta.flag = true; + } +} + +control egressControlImpl(inout EMPTY_H hdr, inout M meta, in psa_egress_input_metadata_t x, inout psa_egress_output_metadata_t ostd) { + apply { + } +} + +control DeparserI(packet_out packet, out EMPTY_CLONE clone_i2e_meta, out EMPTY_RESUB resubmit_meta, out EMPTY_BRIDGE normal_meta, inout H hdr, in M local_metadata, in psa_ingress_output_metadata_t istd) { + apply { + } +} + +control egressDeparserImpl(packet_out buffer, out EMPTY_CLONE a, out EMPTY_RECIRC b, inout EMPTY_H c, in M d, in psa_egress_output_metadata_t e, in psa_egress_deparser_input_metadata_t f) { + apply { + } +} + +IngressPipeline(ParserI(), IngressI(), DeparserI()) ip; + +EgressPipeline(egressParserImpl(), egressControlImpl(), egressDeparserImpl()) ep; + +PSA_Switch(ip, PacketReplicationEngine(), ep, BufferingQueueingEngine()) main; + diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-issue272-1.p4-error b/testdata/p4_16_samples_outputs/psa-dpdk-issue272-1.p4-error new file mode 100644 index 00000000000..e69de29bb2d diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-issue272-1.p4-stderr b/testdata/p4_16_samples_outputs/psa-dpdk-issue272-1.p4-stderr new file mode 100644 index 00000000000..e69de29bb2d diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-issue272-1.p4.bfrt.json b/testdata/p4_16_samples_outputs/psa-dpdk-issue272-1.p4.bfrt.json new file mode 100644 index 00000000000..b6d66a630db --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-issue272-1.p4.bfrt.json @@ -0,0 +1,5 @@ +{ + "schema_version" : "1.0.0", + "tables" : [], + "learn_filters" : [] +} \ No newline at end of file diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-issue272-1.p4.entries.txt b/testdata/p4_16_samples_outputs/psa-dpdk-issue272-1.p4.entries.txt new file mode 100644 index 00000000000..e69de29bb2d diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-issue272-1.p4.p4info.txt b/testdata/p4_16_samples_outputs/psa-dpdk-issue272-1.p4.p4info.txt new file mode 100644 index 00000000000..77612386454 --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-issue272-1.p4.p4info.txt @@ -0,0 +1,3 @@ +pkg_info { + arch: "psa" +} diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-issue272-1.p4.spec b/testdata/p4_16_samples_outputs/psa-dpdk-issue272-1.p4.spec new file mode 100644 index 00000000000..1fd3f815b38 --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-issue272-1.p4.spec @@ -0,0 +1,40 @@ + +struct psa_ingress_output_metadata_t { + bit<8> class_of_service + bit<8> clone + bit<16> clone_session_id + bit<8> drop + bit<8> resubmit + bit<32> multicast_group + bit<32> egress_port +} + +struct psa_egress_output_metadata_t { + bit<8> clone + bit<16> clone_session_id + bit<8> drop +} + +struct psa_egress_deparser_input_metadata_t { + bit<32> egress_port +} + + +struct M { + bit<32> psa_ingress_input_metadata_ingress_port + bit<8> psa_ingress_output_metadata_drop + bit<32> psa_ingress_output_metadata_egress_port + bit<8> local_metadata__some_meta_flag0 +} +metadata instanceof M + +apply { + rx m.psa_ingress_input_metadata_ingress_port + mov m.psa_ingress_output_metadata_drop 0x0 + mov m.local_metadata__some_meta_flag0 1 + jmpneq LABEL_DROP m.psa_ingress_output_metadata_drop 0x0 + tx m.psa_ingress_output_metadata_egress_port + LABEL_DROP : drop +} + + diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-issue3329-bmv2.p4-error b/testdata/p4_16_samples_outputs/psa-dpdk-issue3329-bmv2.p4-error new file mode 100644 index 00000000000..e69de29bb2d diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-issue3329-bmv2.p4.bfrt.json b/testdata/p4_16_samples_outputs/psa-dpdk-issue3329-bmv2.p4.bfrt.json new file mode 100644 index 00000000000..b6d66a630db --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-issue3329-bmv2.p4.bfrt.json @@ -0,0 +1,5 @@ +{ + "schema_version" : "1.0.0", + "tables" : [], + "learn_filters" : [] +} \ No newline at end of file diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-issue3329-bmv2.p4.spec b/testdata/p4_16_samples_outputs/psa-dpdk-issue3329-bmv2.p4.spec new file mode 100644 index 00000000000..c6fa5ef065d --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-issue3329-bmv2.p4.spec @@ -0,0 +1,43 @@ + +struct packet_out_header_t { + bit<32> _b_b0 +} + +struct psa_ingress_output_metadata_t { + bit<8> class_of_service + bit<8> clone + bit<16> clone_session_id + bit<8> drop + bit<8> resubmit + bit<32> multicast_group + bit<32> egress_port +} + +struct psa_egress_output_metadata_t { + bit<8> clone + bit<16> clone_session_id + bit<8> drop +} + +struct psa_egress_deparser_input_metadata_t { + bit<32> egress_port +} + +header packet_out instanceof packet_out_header_t + +struct metadata_t { + bit<32> psa_ingress_input_metadata_ingress_port + bit<8> psa_ingress_output_metadata_drop + bit<32> psa_ingress_output_metadata_egress_port +} +metadata instanceof metadata_t + +apply { + rx m.psa_ingress_input_metadata_ingress_port + mov m.psa_ingress_output_metadata_drop 0x0 + jmpneq LABEL_DROP m.psa_ingress_output_metadata_drop 0x0 + tx m.psa_ingress_output_metadata_egress_port + LABEL_DROP : drop +} + + diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-issue3329-first.p4 b/testdata/p4_16_samples_outputs/psa-dpdk-issue3329-first.p4 new file mode 100644 index 00000000000..4a009a975b4 --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-issue3329-first.p4 @@ -0,0 +1,71 @@ +#include +#include + +header EMPTY_H { +} + +struct EMPTY_RESUB { +} + +struct EMPTY_CLONE { +} + +struct EMPTY_BRIDGE { +} + +struct EMPTY_RECIRC { +} + +struct s { + bit<32> b; +} + +@controller_header("packet_out") header packet_out_header_t { + s b; +} + +struct headers_t { + packet_out_header_t packet_out; +} + +struct metadata_t { +} + +parser ParserImpl(packet_in packet, out headers_t hdr, inout metadata_t meta, in psa_ingress_parser_input_metadata_t x, in EMPTY_RESUB resub_meta, in EMPTY_RECIRC recirc_meta) { + state start { + transition accept; + } +} + +parser egressParserImpl(packet_in buffer, out EMPTY_H a, inout metadata_t b, in psa_egress_parser_input_metadata_t c, in EMPTY_BRIDGE d, in EMPTY_CLONE e, in EMPTY_CLONE f) { + state start { + transition accept; + } +} + +control ingress(inout headers_t hdr, inout metadata_t meta, in psa_ingress_input_metadata_t istd, inout psa_ingress_output_metadata_t ostd) { + apply { + } +} + +control egressControlImpl(inout EMPTY_H hdr, inout metadata_t meta, in psa_egress_input_metadata_t x, inout psa_egress_output_metadata_t ostd) { + apply { + } +} + +control DeparserImpl(packet_out packet, out EMPTY_CLONE clone_i2e_meta, out EMPTY_RESUB resubmit_meta, out EMPTY_BRIDGE normal_meta, inout headers_t h, in metadata_t local_metadata, in psa_ingress_output_metadata_t istd) { + apply { + } +} + +control egressDeparserImpl(packet_out buffer, out EMPTY_CLONE a, out EMPTY_RECIRC b, inout EMPTY_H c, in metadata_t d, in psa_egress_output_metadata_t e, in psa_egress_deparser_input_metadata_t f) { + apply { + } +} + +IngressPipeline(ParserImpl(), ingress(), DeparserImpl()) ip; + +EgressPipeline(egressParserImpl(), egressControlImpl(), egressDeparserImpl()) ep; + +PSA_Switch(ip, PacketReplicationEngine(), ep, BufferingQueueingEngine()) main; + diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-issue3329-frontend.p4 b/testdata/p4_16_samples_outputs/psa-dpdk-issue3329-frontend.p4 new file mode 100644 index 00000000000..4a009a975b4 --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-issue3329-frontend.p4 @@ -0,0 +1,71 @@ +#include +#include + +header EMPTY_H { +} + +struct EMPTY_RESUB { +} + +struct EMPTY_CLONE { +} + +struct EMPTY_BRIDGE { +} + +struct EMPTY_RECIRC { +} + +struct s { + bit<32> b; +} + +@controller_header("packet_out") header packet_out_header_t { + s b; +} + +struct headers_t { + packet_out_header_t packet_out; +} + +struct metadata_t { +} + +parser ParserImpl(packet_in packet, out headers_t hdr, inout metadata_t meta, in psa_ingress_parser_input_metadata_t x, in EMPTY_RESUB resub_meta, in EMPTY_RECIRC recirc_meta) { + state start { + transition accept; + } +} + +parser egressParserImpl(packet_in buffer, out EMPTY_H a, inout metadata_t b, in psa_egress_parser_input_metadata_t c, in EMPTY_BRIDGE d, in EMPTY_CLONE e, in EMPTY_CLONE f) { + state start { + transition accept; + } +} + +control ingress(inout headers_t hdr, inout metadata_t meta, in psa_ingress_input_metadata_t istd, inout psa_ingress_output_metadata_t ostd) { + apply { + } +} + +control egressControlImpl(inout EMPTY_H hdr, inout metadata_t meta, in psa_egress_input_metadata_t x, inout psa_egress_output_metadata_t ostd) { + apply { + } +} + +control DeparserImpl(packet_out packet, out EMPTY_CLONE clone_i2e_meta, out EMPTY_RESUB resubmit_meta, out EMPTY_BRIDGE normal_meta, inout headers_t h, in metadata_t local_metadata, in psa_ingress_output_metadata_t istd) { + apply { + } +} + +control egressDeparserImpl(packet_out buffer, out EMPTY_CLONE a, out EMPTY_RECIRC b, inout EMPTY_H c, in metadata_t d, in psa_egress_output_metadata_t e, in psa_egress_deparser_input_metadata_t f) { + apply { + } +} + +IngressPipeline(ParserImpl(), ingress(), DeparserImpl()) ip; + +EgressPipeline(egressParserImpl(), egressControlImpl(), egressDeparserImpl()) ep; + +PSA_Switch(ip, PacketReplicationEngine(), ep, BufferingQueueingEngine()) main; + diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-issue3329-midend.p4 b/testdata/p4_16_samples_outputs/psa-dpdk-issue3329-midend.p4 new file mode 100644 index 00000000000..365cc9de698 --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-issue3329-midend.p4 @@ -0,0 +1,72 @@ +#include +#include + +header EMPTY_H { +} + +struct EMPTY_RESUB { +} + +struct EMPTY_CLONE { +} + +struct EMPTY_BRIDGE { +} + +struct EMPTY_RECIRC { +} + +struct s { + bit<32> b; +} + +header packet_out_header_t { + @controller_header("packet_out") + bit<32> _b_b0; +} + +struct headers_t { + packet_out_header_t packet_out; +} + +struct metadata_t { +} + +parser ParserImpl(packet_in packet, out headers_t hdr, inout metadata_t meta, in psa_ingress_parser_input_metadata_t x, in EMPTY_RESUB resub_meta, in EMPTY_RECIRC recirc_meta) { + state start { + transition accept; + } +} + +parser egressParserImpl(packet_in buffer, out EMPTY_H a, inout metadata_t b, in psa_egress_parser_input_metadata_t c, in EMPTY_BRIDGE d, in EMPTY_CLONE e, in EMPTY_CLONE f) { + state start { + transition accept; + } +} + +control ingress(inout headers_t hdr, inout metadata_t meta, in psa_ingress_input_metadata_t istd, inout psa_ingress_output_metadata_t ostd) { + apply { + } +} + +control egressControlImpl(inout EMPTY_H hdr, inout metadata_t meta, in psa_egress_input_metadata_t x, inout psa_egress_output_metadata_t ostd) { + apply { + } +} + +control DeparserImpl(packet_out packet, out EMPTY_CLONE clone_i2e_meta, out EMPTY_RESUB resubmit_meta, out EMPTY_BRIDGE normal_meta, inout headers_t h, in metadata_t local_metadata, in psa_ingress_output_metadata_t istd) { + apply { + } +} + +control egressDeparserImpl(packet_out buffer, out EMPTY_CLONE a, out EMPTY_RECIRC b, inout EMPTY_H c, in metadata_t d, in psa_egress_output_metadata_t e, in psa_egress_deparser_input_metadata_t f) { + apply { + } +} + +IngressPipeline(ParserImpl(), ingress(), DeparserImpl()) ip; + +EgressPipeline(egressParserImpl(), egressControlImpl(), egressDeparserImpl()) ep; + +PSA_Switch(ip, PacketReplicationEngine(), ep, BufferingQueueingEngine()) main; + diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-issue3329.p4 b/testdata/p4_16_samples_outputs/psa-dpdk-issue3329.p4 new file mode 100644 index 00000000000..b8619ae4738 --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-issue3329.p4 @@ -0,0 +1,71 @@ +#include +#include + +header EMPTY_H { +} + +struct EMPTY_RESUB { +} + +struct EMPTY_CLONE { +} + +struct EMPTY_BRIDGE { +} + +struct EMPTY_RECIRC { +} + +struct s { + bit<32> b; +} + +@controller_header("packet_out") header packet_out_header_t { + s b; +} + +struct headers_t { + packet_out_header_t packet_out; +} + +struct metadata_t { +} + +parser ParserImpl(packet_in packet, out headers_t hdr, inout metadata_t meta, in psa_ingress_parser_input_metadata_t x, in EMPTY_RESUB resub_meta, in EMPTY_RECIRC recirc_meta) { + state start { + transition accept; + } +} + +parser egressParserImpl(packet_in buffer, out EMPTY_H a, inout metadata_t b, in psa_egress_parser_input_metadata_t c, in EMPTY_BRIDGE d, in EMPTY_CLONE e, in EMPTY_CLONE f) { + state start { + transition accept; + } +} + +control ingress(inout headers_t hdr, inout metadata_t meta, in psa_ingress_input_metadata_t istd, inout psa_ingress_output_metadata_t ostd) { + apply { + } +} + +control egressControlImpl(inout EMPTY_H hdr, inout metadata_t meta, in psa_egress_input_metadata_t x, inout psa_egress_output_metadata_t ostd) { + apply { + } +} + +control DeparserImpl(packet_out packet, out EMPTY_CLONE clone_i2e_meta, out EMPTY_RESUB resubmit_meta, out EMPTY_BRIDGE normal_meta, inout headers_t h, in metadata_t local_metadata, in psa_ingress_output_metadata_t istd) { + apply { + } +} + +control egressDeparserImpl(packet_out buffer, out EMPTY_CLONE a, out EMPTY_RECIRC b, inout EMPTY_H c, in metadata_t d, in psa_egress_output_metadata_t e, in psa_egress_deparser_input_metadata_t f) { + apply { + } +} + +IngressPipeline(ParserImpl(), ingress(), DeparserImpl()) ip; + +EgressPipeline(egressParserImpl(), egressControlImpl(), egressDeparserImpl()) ep; + +PSA_Switch(ip, PacketReplicationEngine(), ep, BufferingQueueingEngine()) main; + diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-issue3329.p4-error b/testdata/p4_16_samples_outputs/psa-dpdk-issue3329.p4-error new file mode 100644 index 00000000000..e69de29bb2d diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-issue3329.p4-stderr b/testdata/p4_16_samples_outputs/psa-dpdk-issue3329.p4-stderr new file mode 100644 index 00000000000..e69de29bb2d diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-issue3329.p4.bfrt.json b/testdata/p4_16_samples_outputs/psa-dpdk-issue3329.p4.bfrt.json new file mode 100644 index 00000000000..b6d66a630db --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-issue3329.p4.bfrt.json @@ -0,0 +1,5 @@ +{ + "schema_version" : "1.0.0", + "tables" : [], + "learn_filters" : [] +} \ No newline at end of file diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-issue3329.p4.entries.txt b/testdata/p4_16_samples_outputs/psa-dpdk-issue3329.p4.entries.txt new file mode 100644 index 00000000000..e69de29bb2d diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-issue3329.p4.p4info.txt b/testdata/p4_16_samples_outputs/psa-dpdk-issue3329.p4.p4info.txt new file mode 100644 index 00000000000..92e995eb481 --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-issue3329.p4.p4info.txt @@ -0,0 +1,18 @@ +pkg_info { + arch: "psa" +} +controller_packet_metadata { + preamble { + id: 76689799 + name: "packet_out" + alias: "packet_out" + annotations: "@controller_header(\"packet_out\")" + } + metadata { + id: 1 + name: "b.b" + bitwidth: 32 + } +} +type_info { +} diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-issue3329.p4.spec b/testdata/p4_16_samples_outputs/psa-dpdk-issue3329.p4.spec new file mode 100644 index 00000000000..c6fa5ef065d --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-issue3329.p4.spec @@ -0,0 +1,43 @@ + +struct packet_out_header_t { + bit<32> _b_b0 +} + +struct psa_ingress_output_metadata_t { + bit<8> class_of_service + bit<8> clone + bit<16> clone_session_id + bit<8> drop + bit<8> resubmit + bit<32> multicast_group + bit<32> egress_port +} + +struct psa_egress_output_metadata_t { + bit<8> clone + bit<16> clone_session_id + bit<8> drop +} + +struct psa_egress_deparser_input_metadata_t { + bit<32> egress_port +} + +header packet_out instanceof packet_out_header_t + +struct metadata_t { + bit<32> psa_ingress_input_metadata_ingress_port + bit<8> psa_ingress_output_metadata_drop + bit<32> psa_ingress_output_metadata_egress_port +} +metadata instanceof metadata_t + +apply { + rx m.psa_ingress_input_metadata_ingress_port + mov m.psa_ingress_output_metadata_drop 0x0 + jmpneq LABEL_DROP m.psa_ingress_output_metadata_drop 0x0 + tx m.psa_ingress_output_metadata_egress_port + LABEL_DROP : drop +} + + diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-issue3374-first.p4 b/testdata/p4_16_samples_outputs/psa-dpdk-issue3374-first.p4 new file mode 100644 index 00000000000..8320d7ebaea --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-issue3374-first.p4 @@ -0,0 +1,142 @@ +#include +#include + +header EMPTY_H { +} + +struct EMPTY_RESUB { +} + +struct EMPTY_CLONE { +} + +struct EMPTY_BRIDGE { +} + +struct EMPTY_RECIRC { +} + +typedef bit<48> EthernetAddress; +enum bit<16> ether_type_t { + TPID = 16w0x8100, + IPV4 = 16w0x800, + IPV6 = 16w0x86dd +} + +header ethernet_t { + EthernetAddress dstAddr; + EthernetAddress srcAddr; + bit<16> etherType; +} + +header vlan_tag_h { + bit<3> pcp; + bit<1> cfi; + bit<12> vid; + ether_type_t ether_type; +} + +struct headers_t { + ethernet_t ethernet; + vlan_tag_h[2] vlan_tag; +} + +struct main_metadata_t { + bit<2> depth; + bit<16> ethType; +} + +parser ingressParserImpl(packet_in pkt, out headers_t hdrs, inout main_metadata_t meta, in psa_ingress_parser_input_metadata_t x, in EMPTY_RESUB resub_meta, in EMPTY_RECIRC recirc_meta) { + state start { + meta.depth = 2w1; + pkt.extract(hdrs.ethernet); + transition select(hdrs.ethernet.etherType) { + ether_type_t.TPID: parse_vlan_tag; + default: accept; + } + } + state parse_vlan_tag { + pkt.extract(hdrs.vlan_tag.next); + meta.depth = meta.depth + 2w3; + transition select(hdrs.vlan_tag.last.ether_type) { + ether_type_t.TPID: parse_vlan_tag; + default: accept; + } + } +} + +parser egressParserImpl(packet_in buffer, out EMPTY_H a, inout main_metadata_t b, in psa_egress_parser_input_metadata_t c, in EMPTY_BRIDGE d, in EMPTY_CLONE e, in EMPTY_CLONE f) { + state start { + transition accept; + } +} + +control ingressControlImpl(inout headers_t hdrs, inout main_metadata_t meta, in psa_ingress_input_metadata_t istd, inout psa_ingress_output_metadata_t ostd) { + action drop_packet() { + ingress_drop(ostd); + } + action execute() { + meta.ethType = hdrs.vlan_tag[meta.depth + 2w3].ether_type; + hdrs.vlan_tag[meta.depth + 2w3].ether_type = (ether_type_t)16w2; + hdrs.vlan_tag[meta.depth].vid = (bit<12>)hdrs.vlan_tag[meta.depth].cfi; + hdrs.vlan_tag[meta.depth].vid = hdrs.vlan_tag[meta.depth + 2w3].vid; + } + action execute_1() { + drop_packet(); + } + table stub { + key = { + hdrs.vlan_tag[meta.depth].vid: exact @name("hdrs.vlan_tag[meta.depth].vid") ; + } + actions = { + execute(); + } + const default_action = execute(); + size = 1000000; + } + table stub1 { + key = { + hdrs.ethernet.etherType: exact @name("hdrs.ethernet.etherType") ; + } + actions = { + execute_1(); + } + const default_action = execute_1(); + size = 1000000; + } + apply { + switch (hdrs.vlan_tag[meta.depth].vid) { + 12w1: { + stub.apply(); + } + 12w2: { + if (hdrs.vlan_tag[meta.depth].ether_type == hdrs.ethernet.etherType) { + stub1.apply(); + } + } + } + } +} + +control egressControlImpl(inout EMPTY_H hdr, inout main_metadata_t meta, in psa_egress_input_metadata_t x, inout psa_egress_output_metadata_t ostd) { + apply { + } +} + +control ingressDeparserImpl(packet_out pkt, out EMPTY_CLONE clone_i2e_meta, out EMPTY_RESUB resubmit_meta, out EMPTY_BRIDGE normal_meta, inout headers_t hdr, in main_metadata_t local_metadata, in psa_ingress_output_metadata_t istd) { + apply { + pkt.emit(hdr.ethernet); + } +} + +control egressDeparserImpl(packet_out buffer, out EMPTY_CLONE a, out EMPTY_RECIRC b, inout EMPTY_H c, in main_metadata_t d, in psa_egress_output_metadata_t e, in psa_egress_deparser_input_metadata_t f) { + apply { + } +} + +IngressPipeline(ingressParserImpl(), ingressControlImpl(), ingressDeparserImpl()) ip; + +EgressPipeline(egressParserImpl(), egressControlImpl(), egressDeparserImpl()) ep; + +PSA_Switch(ip, PacketReplicationEngine(), ep, BufferingQueueingEngine()) main; + diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-issue3374-frontend.p4 b/testdata/p4_16_samples_outputs/psa-dpdk-issue3374-frontend.p4 new file mode 100644 index 00000000000..4b7ad871e63 --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-issue3374-frontend.p4 @@ -0,0 +1,142 @@ +#include +#include + +header EMPTY_H { +} + +struct EMPTY_RESUB { +} + +struct EMPTY_CLONE { +} + +struct EMPTY_BRIDGE { +} + +struct EMPTY_RECIRC { +} + +typedef bit<48> EthernetAddress; +enum bit<16> ether_type_t { + TPID = 16w0x8100, + IPV4 = 16w0x800, + IPV6 = 16w0x86dd +} + +header ethernet_t { + EthernetAddress dstAddr; + EthernetAddress srcAddr; + bit<16> etherType; +} + +header vlan_tag_h { + bit<3> pcp; + bit<1> cfi; + bit<12> vid; + ether_type_t ether_type; +} + +struct headers_t { + ethernet_t ethernet; + vlan_tag_h[2] vlan_tag; +} + +struct main_metadata_t { + bit<2> depth; + bit<16> ethType; +} + +parser ingressParserImpl(packet_in pkt, out headers_t hdrs, inout main_metadata_t meta, in psa_ingress_parser_input_metadata_t x, in EMPTY_RESUB resub_meta, in EMPTY_RECIRC recirc_meta) { + state start { + meta.depth = 2w1; + pkt.extract(hdrs.ethernet); + transition select(hdrs.ethernet.etherType) { + ether_type_t.TPID: parse_vlan_tag; + default: accept; + } + } + state parse_vlan_tag { + pkt.extract(hdrs.vlan_tag.next); + meta.depth = meta.depth + 2w3; + transition select(hdrs.vlan_tag.last.ether_type) { + ether_type_t.TPID: parse_vlan_tag; + default: accept; + } + } +} + +parser egressParserImpl(packet_in buffer, out EMPTY_H a, inout main_metadata_t b, in psa_egress_parser_input_metadata_t c, in EMPTY_BRIDGE d, in EMPTY_CLONE e, in EMPTY_CLONE f) { + state start { + transition accept; + } +} + +control ingressControlImpl(inout headers_t hdrs, inout main_metadata_t meta, in psa_ingress_input_metadata_t istd, inout psa_ingress_output_metadata_t ostd) { + @name("ingressControlImpl.meta") psa_ingress_output_metadata_t meta_1; + @name("ingressControlImpl.execute") action execute_1() { + meta.ethType = hdrs.vlan_tag[meta.depth + 2w3].ether_type; + hdrs.vlan_tag[meta.depth + 2w3].ether_type = (ether_type_t)16w2; + hdrs.vlan_tag[meta.depth].vid = (bit<12>)hdrs.vlan_tag[meta.depth].cfi; + hdrs.vlan_tag[meta.depth].vid = hdrs.vlan_tag[meta.depth + 2w3].vid; + } + @name("ingressControlImpl.execute_1") action execute_3() { + meta_1 = ostd; + meta_1.drop = true; + ostd = meta_1; + } + @name("ingressControlImpl.stub") table stub_0 { + key = { + hdrs.vlan_tag[meta.depth].vid: exact @name("hdrs.vlan_tag[meta.depth].vid") ; + } + actions = { + execute_1(); + } + const default_action = execute_1(); + size = 1000000; + } + @name("ingressControlImpl.stub1") table stub1_0 { + key = { + hdrs.ethernet.etherType: exact @name("hdrs.ethernet.etherType") ; + } + actions = { + execute_3(); + } + const default_action = execute_3(); + size = 1000000; + } + apply { + switch (hdrs.vlan_tag[meta.depth].vid) { + 12w1: { + stub_0.apply(); + } + 12w2: { + if (hdrs.vlan_tag[meta.depth].ether_type == hdrs.ethernet.etherType) { + stub1_0.apply(); + } + } + } + } +} + +control egressControlImpl(inout EMPTY_H hdr, inout main_metadata_t meta, in psa_egress_input_metadata_t x, inout psa_egress_output_metadata_t ostd) { + apply { + } +} + +control ingressDeparserImpl(packet_out pkt, out EMPTY_CLONE clone_i2e_meta, out EMPTY_RESUB resubmit_meta, out EMPTY_BRIDGE normal_meta, inout headers_t hdr, in main_metadata_t local_metadata, in psa_ingress_output_metadata_t istd) { + apply { + pkt.emit(hdr.ethernet); + } +} + +control egressDeparserImpl(packet_out buffer, out EMPTY_CLONE a, out EMPTY_RECIRC b, inout EMPTY_H c, in main_metadata_t d, in psa_egress_output_metadata_t e, in psa_egress_deparser_input_metadata_t f) { + apply { + } +} + +IngressPipeline(ingressParserImpl(), ingressControlImpl(), ingressDeparserImpl()) ip; + +EgressPipeline(egressParserImpl(), egressControlImpl(), egressDeparserImpl()) ep; + +PSA_Switch(ip, PacketReplicationEngine(), ep, BufferingQueueingEngine()) main; + diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-issue3374-midend.p4 b/testdata/p4_16_samples_outputs/psa-dpdk-issue3374-midend.p4 new file mode 100644 index 00000000000..25f52953256 --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-issue3374-midend.p4 @@ -0,0 +1,307 @@ +#include +#include + +header EMPTY_H { +} + +struct EMPTY_RESUB { +} + +struct EMPTY_CLONE { +} + +struct EMPTY_BRIDGE { +} + +struct EMPTY_RECIRC { +} + +typedef bit<48> EthernetAddress; +header ethernet_t { + EthernetAddress dstAddr; + EthernetAddress srcAddr; + bit<16> etherType; +} + +header vlan_tag_h { + bit<3> pcp; + bit<1> cfi; + bit<12> vid; + bit<16> ether_type; +} + +struct headers_t { + ethernet_t ethernet; + vlan_tag_h[2] vlan_tag; +} + +struct main_metadata_t { + bit<2> depth; + bit<16> ethType; +} + +parser ingressParserImpl(packet_in pkt, out headers_t hdrs, inout main_metadata_t meta, in psa_ingress_parser_input_metadata_t x, in EMPTY_RESUB resub_meta, in EMPTY_RECIRC recirc_meta) { + state start { + meta.depth = 2w1; + pkt.extract(hdrs.ethernet); + transition select(hdrs.ethernet.etherType) { + 16w0x8100: parse_vlan_tag; + default: accept; + } + } + state parse_vlan_tag { + pkt.extract(hdrs.vlan_tag.next); + meta.depth = meta.depth + 2w3; + transition select(hdrs.vlan_tag.last.ether_type) { + 16w0x8100: parse_vlan_tag; + default: accept; + } + } +} + +parser egressParserImpl(packet_in buffer, out EMPTY_H a, inout main_metadata_t b, in psa_egress_parser_input_metadata_t c, in EMPTY_BRIDGE d, in EMPTY_CLONE e, in EMPTY_CLONE f) { + state start { + transition accept; + } +} + +control ingressControlImpl(inout headers_t hdrs, inout main_metadata_t meta, in psa_ingress_input_metadata_t istd, inout psa_ingress_output_metadata_t ostd) { + bit<2> hsiVar; + bit<12> hsVar; + bit<2> hsiVar_0; + bit<16> hsVar_0; + @name("ingressControlImpl.execute") action execute_1() { + hsiVar_0 = meta.depth + 2w3; + if (hsiVar_0 == 2w0) { + meta.ethType = hdrs.vlan_tag[2w0].ether_type; + } else if (hsiVar_0 == 2w1) { + meta.ethType = hdrs.vlan_tag[2w1].ether_type; + } else if (hsiVar_0 >= 2w1) { + meta.ethType = hsVar_0; + } + hsiVar_0 = meta.depth + 2w3; + if (hsiVar_0 == 2w0) { + hdrs.vlan_tag[2w0].ether_type = 16w2; + } else if (hsiVar_0 == 2w1) { + hdrs.vlan_tag[2w1].ether_type = 16w2; + } + hsiVar = meta.depth; + if (hsiVar == 2w0) { + hdrs.vlan_tag[2w0].vid = (bit<12>)hdrs.vlan_tag[2w0].cfi; + } else if (hsiVar == 2w1) { + hdrs.vlan_tag[2w1].vid = (bit<12>)hdrs.vlan_tag[2w1].cfi; + } + hsiVar = meta.depth; + if (hsiVar == 2w0) { + hsiVar_0 = meta.depth + 2w3; + if (hsiVar_0 == 2w0) { + hdrs.vlan_tag[2w0].vid = hdrs.vlan_tag[2w0].vid; + } else if (hsiVar_0 == 2w1) { + hdrs.vlan_tag[2w0].vid = hdrs.vlan_tag[2w1].vid; + } else if (hsiVar_0 >= 2w1) { + hdrs.vlan_tag[2w0].vid = hsVar; + } + } else if (hsiVar == 2w1) { + hsiVar_0 = meta.depth + 2w3; + if (hsiVar_0 == 2w0) { + hdrs.vlan_tag[2w1].vid = hdrs.vlan_tag[2w0].vid; + } else if (hsiVar_0 == 2w1) { + hdrs.vlan_tag[2w1].vid = hdrs.vlan_tag[2w1].vid; + } else if (hsiVar_0 >= 2w1) { + hdrs.vlan_tag[2w1].vid = hsVar; + } + } + } + @name("ingressControlImpl.execute_1") action execute_3() { + ostd.drop = true; + } + bit<12> key_0; + @name("ingressControlImpl.stub") table stub_0 { + key = { + key_0: exact @name("hdrs.vlan_tag[meta.depth].vid") ; + } + actions = { + execute_1(); + } + const default_action = execute_1(); + size = 1000000; + } + @name("ingressControlImpl.stub1") table stub1_0 { + key = { + hdrs.ethernet.etherType: exact @name("hdrs.ethernet.etherType") ; + } + actions = { + execute_3(); + } + const default_action = execute_3(); + size = 1000000; + } + bit<12> switch_0_key; + @hidden action switch_0_case() { + } + @hidden action switch_0_case_0() { + } + @hidden action switch_0_case_1() { + } + @hidden table switch_0_table { + key = { + switch_0_key: exact; + } + actions = { + switch_0_case(); + switch_0_case_0(); + switch_0_case_1(); + } + const default_action = switch_0_case_1(); + const entries = { + 12w1 : switch_0_case(); + 12w2 : switch_0_case_0(); + } + } + @hidden action psadpdkissue3374l140() { + switch_0_key = hdrs.vlan_tag[2w0].vid; + } + @hidden action psadpdkissue3374l140_0() { + switch_0_key = hdrs.vlan_tag[2w1].vid; + } + @hidden action psadpdkissue3374l140_1() { + switch_0_key = hsVar; + } + @hidden action psadpdkissue3374l140_2() { + hsiVar = meta.depth; + } + @hidden action psadpdkissue3374l118() { + key_0 = hdrs.vlan_tag[2w0].vid; + } + @hidden action psadpdkissue3374l118_0() { + key_0 = hdrs.vlan_tag[2w1].vid; + } + @hidden action psadpdkissue3374l118_1() { + key_0 = hsVar; + } + @hidden action psadpdkissue3374l118_2() { + hsiVar = meta.depth; + } + @hidden action psadpdkissue3374l144() { + hsiVar = meta.depth; + } + @hidden table tbl_psadpdkissue3374l140 { + actions = { + psadpdkissue3374l140_2(); + } + const default_action = psadpdkissue3374l140_2(); + } + @hidden table tbl_psadpdkissue3374l140_0 { + actions = { + psadpdkissue3374l140(); + } + const default_action = psadpdkissue3374l140(); + } + @hidden table tbl_psadpdkissue3374l140_1 { + actions = { + psadpdkissue3374l140_0(); + } + const default_action = psadpdkissue3374l140_0(); + } + @hidden table tbl_psadpdkissue3374l140_2 { + actions = { + psadpdkissue3374l140_1(); + } + const default_action = psadpdkissue3374l140_1(); + } + @hidden table tbl_psadpdkissue3374l118 { + actions = { + psadpdkissue3374l118_2(); + } + const default_action = psadpdkissue3374l118_2(); + } + @hidden table tbl_psadpdkissue3374l118_0 { + actions = { + psadpdkissue3374l118(); + } + const default_action = psadpdkissue3374l118(); + } + @hidden table tbl_psadpdkissue3374l118_1 { + actions = { + psadpdkissue3374l118_0(); + } + const default_action = psadpdkissue3374l118_0(); + } + @hidden table tbl_psadpdkissue3374l118_2 { + actions = { + psadpdkissue3374l118_1(); + } + const default_action = psadpdkissue3374l118_1(); + } + @hidden table tbl_psadpdkissue3374l144 { + actions = { + psadpdkissue3374l144(); + } + const default_action = psadpdkissue3374l144(); + } + apply { + tbl_psadpdkissue3374l140.apply(); + if (hsiVar == 2w0) { + tbl_psadpdkissue3374l140_0.apply(); + } else if (hsiVar == 2w1) { + tbl_psadpdkissue3374l140_1.apply(); + } else if (hsiVar >= 2w1) { + tbl_psadpdkissue3374l140_2.apply(); + } + switch (switch_0_table.apply().action_run) { + switch_0_case: { + tbl_psadpdkissue3374l118.apply(); + if (hsiVar == 2w0) { + tbl_psadpdkissue3374l118_0.apply(); + } else if (hsiVar == 2w1) { + tbl_psadpdkissue3374l118_1.apply(); + } else if (hsiVar >= 2w1) { + tbl_psadpdkissue3374l118_2.apply(); + } + stub_0.apply(); + } + switch_0_case_0: { + tbl_psadpdkissue3374l144.apply(); + if (hsiVar == 2w0 && hdrs.vlan_tag[2w0].ether_type == hdrs.ethernet.etherType) { + stub1_0.apply(); + } else if (hsiVar == 2w1 && hdrs.vlan_tag[2w1].ether_type == hdrs.ethernet.etherType) { + stub1_0.apply(); + } + } + switch_0_case_1: { + } + } + } +} + +control egressControlImpl(inout EMPTY_H hdr, inout main_metadata_t meta, in psa_egress_input_metadata_t x, inout psa_egress_output_metadata_t ostd) { + apply { + } +} + +control ingressDeparserImpl(packet_out pkt, out EMPTY_CLONE clone_i2e_meta, out EMPTY_RESUB resubmit_meta, out EMPTY_BRIDGE normal_meta, inout headers_t hdr, in main_metadata_t local_metadata, in psa_ingress_output_metadata_t istd) { + @hidden action psadpdkissue3374l170() { + pkt.emit(hdr.ethernet); + } + @hidden table tbl_psadpdkissue3374l170 { + actions = { + psadpdkissue3374l170(); + } + const default_action = psadpdkissue3374l170(); + } + apply { + tbl_psadpdkissue3374l170.apply(); + } +} + +control egressDeparserImpl(packet_out buffer, out EMPTY_CLONE a, out EMPTY_RECIRC b, inout EMPTY_H c, in main_metadata_t d, in psa_egress_output_metadata_t e, in psa_egress_deparser_input_metadata_t f) { + apply { + } +} + +IngressPipeline(ingressParserImpl(), ingressControlImpl(), ingressDeparserImpl()) ip; + +EgressPipeline(egressParserImpl(), egressControlImpl(), egressDeparserImpl()) ep; + +PSA_Switch(ip, PacketReplicationEngine(), ep, BufferingQueueingEngine()) main; + diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-issue3374.p4 b/testdata/p4_16_samples_outputs/psa-dpdk-issue3374.p4 new file mode 100644 index 00000000000..005d017580c --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-issue3374.p4 @@ -0,0 +1,142 @@ +#include +#include + +header EMPTY_H { +} + +struct EMPTY_RESUB { +} + +struct EMPTY_CLONE { +} + +struct EMPTY_BRIDGE { +} + +struct EMPTY_RECIRC { +} + +typedef bit<48> EthernetAddress; +enum bit<16> ether_type_t { + TPID = 0x8100, + IPV4 = 0x800, + IPV6 = 0x86dd +} + +header ethernet_t { + EthernetAddress dstAddr; + EthernetAddress srcAddr; + bit<16> etherType; +} + +header vlan_tag_h { + bit<3> pcp; + bit<1> cfi; + bit<12> vid; + ether_type_t ether_type; +} + +struct headers_t { + ethernet_t ethernet; + vlan_tag_h[2] vlan_tag; +} + +struct main_metadata_t { + bit<2> depth; + bit<16> ethType; +} + +parser ingressParserImpl(packet_in pkt, out headers_t hdrs, inout main_metadata_t meta, in psa_ingress_parser_input_metadata_t x, in EMPTY_RESUB resub_meta, in EMPTY_RECIRC recirc_meta) { + state start { + meta.depth = 2 - 1; + pkt.extract(hdrs.ethernet); + transition select(hdrs.ethernet.etherType) { + ether_type_t.TPID: parse_vlan_tag; + default: accept; + } + } + state parse_vlan_tag { + pkt.extract(hdrs.vlan_tag.next); + meta.depth = meta.depth - 1; + transition select(hdrs.vlan_tag.last.ether_type) { + ether_type_t.TPID: parse_vlan_tag; + default: accept; + } + } +} + +parser egressParserImpl(packet_in buffer, out EMPTY_H a, inout main_metadata_t b, in psa_egress_parser_input_metadata_t c, in EMPTY_BRIDGE d, in EMPTY_CLONE e, in EMPTY_CLONE f) { + state start { + transition accept; + } +} + +control ingressControlImpl(inout headers_t hdrs, inout main_metadata_t meta, in psa_ingress_input_metadata_t istd, inout psa_ingress_output_metadata_t ostd) { + action drop_packet() { + ingress_drop(ostd); + } + action execute() { + meta.ethType = hdrs.vlan_tag[meta.depth - 1].ether_type; + hdrs.vlan_tag[meta.depth - 1].ether_type = (ether_type_t)16w2; + hdrs.vlan_tag[meta.depth].vid = (bit<12>)hdrs.vlan_tag[meta.depth].cfi; + hdrs.vlan_tag[meta.depth].vid = hdrs.vlan_tag[meta.depth - 1].vid; + } + action execute_1() { + drop_packet(); + } + table stub { + key = { + hdrs.vlan_tag[meta.depth].vid: exact; + } + actions = { + execute; + } + const default_action = execute; + size = 1000000; + } + table stub1 { + key = { + hdrs.ethernet.etherType: exact; + } + actions = { + execute_1; + } + const default_action = execute_1; + size = 1000000; + } + apply { + switch (hdrs.vlan_tag[meta.depth].vid) { + 12w1: { + stub.apply(); + } + 12w2: { + if (hdrs.vlan_tag[meta.depth].ether_type == hdrs.ethernet.etherType) { + stub1.apply(); + } + } + } + } +} + +control egressControlImpl(inout EMPTY_H hdr, inout main_metadata_t meta, in psa_egress_input_metadata_t x, inout psa_egress_output_metadata_t ostd) { + apply { + } +} + +control ingressDeparserImpl(packet_out pkt, out EMPTY_CLONE clone_i2e_meta, out EMPTY_RESUB resubmit_meta, out EMPTY_BRIDGE normal_meta, inout headers_t hdr, in main_metadata_t local_metadata, in psa_ingress_output_metadata_t istd) { + apply { + pkt.emit(hdr.ethernet); + } +} + +control egressDeparserImpl(packet_out buffer, out EMPTY_CLONE a, out EMPTY_RECIRC b, inout EMPTY_H c, in main_metadata_t d, in psa_egress_output_metadata_t e, in psa_egress_deparser_input_metadata_t f) { + apply { + } +} + +IngressPipeline(ingressParserImpl(), ingressControlImpl(), ingressDeparserImpl()) ip; + +EgressPipeline(egressParserImpl(), egressControlImpl(), egressDeparserImpl()) ep; + +PSA_Switch(ip, PacketReplicationEngine(), ep, BufferingQueueingEngine()) main; + diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-issue3374.p4-error b/testdata/p4_16_samples_outputs/psa-dpdk-issue3374.p4-error new file mode 100644 index 00000000000..e69de29bb2d diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-issue3374.p4-stderr b/testdata/p4_16_samples_outputs/psa-dpdk-issue3374.p4-stderr new file mode 100644 index 00000000000..e69de29bb2d diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-issue3374.p4.bfrt.json b/testdata/p4_16_samples_outputs/psa-dpdk-issue3374.p4.bfrt.json new file mode 100644 index 00000000000..0752e5e1773 --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-issue3374.p4.bfrt.json @@ -0,0 +1,76 @@ +{ + "schema_version" : "1.0.0", + "tables" : [ + { + "name" : "ip.ingressControlImpl.stub", + "id" : 34411041, + "table_type" : "MatchAction_Direct", + "size" : 1000000, + "annotations" : [], + "depends_on" : [], + "has_const_default_action" : true, + "key" : [ + { + "id" : 1, + "name" : "hdrs.vlan_tag[meta.depth].vid", + "repeated" : false, + "annotations" : [], + "mandatory" : false, + "match_type" : "Exact", + "type" : { + "type" : "bytes", + "width" : 12 + } + } + ], + "action_specs" : [ + { + "id" : 28119643, + "name" : "ingressControlImpl.execute", + "action_scope" : "TableAndDefault", + "annotations" : [], + "data" : [] + } + ], + "data" : [], + "supported_operations" : [], + "attributes" : ["EntryScope"] + }, + { + "name" : "ip.ingressControlImpl.stub1", + "id" : 48274176, + "table_type" : "MatchAction_Direct", + "size" : 1000000, + "annotations" : [], + "depends_on" : [], + "has_const_default_action" : true, + "key" : [ + { + "id" : 1, + "name" : "hdrs.ethernet.etherType", + "repeated" : false, + "annotations" : [], + "mandatory" : false, + "match_type" : "Exact", + "type" : { + "type" : "bytes", + "width" : 16 + } + } + ], + "action_specs" : [ + { + "id" : 25418768, + "name" : "ingressControlImpl.execute_1", + "action_scope" : "TableAndDefault", + "annotations" : [], + "data" : [] + } + ], + "data" : [], + "supported_operations" : [], + "attributes" : ["EntryScope"] + } + ], + "learn_filters" : [] +} \ No newline at end of file diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-issue3374.p4.entries.txt b/testdata/p4_16_samples_outputs/psa-dpdk-issue3374.p4.entries.txt new file mode 100644 index 00000000000..e69de29bb2d diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-issue3374.p4.p4info.txt b/testdata/p4_16_samples_outputs/psa-dpdk-issue3374.p4.p4info.txt new file mode 100644 index 00000000000..fb63de3a0cd --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-issue3374.p4.p4info.txt @@ -0,0 +1,55 @@ +pkg_info { + arch: "psa" +} +tables { + preamble { + id: 34411041 + name: "ingressControlImpl.stub" + alias: "stub" + } + match_fields { + id: 1 + name: "hdrs.vlan_tag[meta.depth].vid" + bitwidth: 12 + match_type: EXACT + } + action_refs { + id: 28119643 + } + const_default_action_id: 28119643 + size: 1000000 +} +tables { + preamble { + id: 48274176 + name: "ingressControlImpl.stub1" + alias: "stub1" + } + match_fields { + id: 1 + name: "hdrs.ethernet.etherType" + bitwidth: 16 + match_type: EXACT + } + action_refs { + id: 25418768 + } + const_default_action_id: 25418768 + size: 1000000 +} +actions { + preamble { + id: 28119643 + name: "ingressControlImpl.execute" + alias: "execute" + } +} +actions { + preamble { + id: 25418768 + name: "ingressControlImpl.execute_1" + alias: "execute_1" + } +} +type_info { +} diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-issue3374.p4.spec b/testdata/p4_16_samples_outputs/psa-dpdk-issue3374.p4.spec new file mode 100644 index 00000000000..ce6a7b0b5e7 --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-issue3374.p4.spec @@ -0,0 +1,305 @@ + +struct ethernet_t { + bit<48> dstAddr + bit<48> srcAddr + bit<16> etherType +} + +struct vlan_tag_h { + bit<16> pcp_cfi_vid + bit<16> ether_type +} + +struct psa_ingress_output_metadata_t { + bit<8> class_of_service + bit<8> clone + bit<16> clone_session_id + bit<8> drop + bit<8> resubmit + bit<32> multicast_group + bit<32> egress_port +} + +struct psa_egress_output_metadata_t { + bit<8> clone + bit<16> clone_session_id + bit<8> drop +} + +struct psa_egress_deparser_input_metadata_t { + bit<32> egress_port +} + +header ethernet instanceof ethernet_t +header vlan_tag_0 instanceof vlan_tag_h +header vlan_tag_1 instanceof vlan_tag_h + + +struct main_metadata_t { + bit<32> psa_ingress_input_metadata_ingress_port + bit<16> psa_ingress_input_metadata_parser_error + bit<8> psa_ingress_output_metadata_drop + bit<32> psa_ingress_output_metadata_egress_port + bit<32> local_metadata_depth + bit<16> local_metadata_ethType + bit<32> Ingress_tmp + bit<32> Ingress_tmp_0 + bit<32> Ingress_tmp_1 + bit<32> Ingress_tmp_2 + bit<32> Ingress_tmp_3 + bit<32> Ingress_tmp_4 + bit<32> Ingress_tmp_5 + bit<32> Ingress_tmp_6 + bit<32> Ingress_tmp_7 + bit<32> Ingress_tmp_8 + bit<32> Ingress_tmp_9 + bit<16> Ingress_tmp_10 + bit<32> Ingress_tmp_11 + bit<16> Ingress_tmp_12 + bit<32> Ingress_tmp_13 + bit<16> Ingress_tmp_14 + bit<16> Ingress_tmp_15 + bit<32> Ingress_tmp_16 + bit<32> Ingress_tmp_17 + bit<16> Ingress_tmp_18 + bit<16> Ingress_tmp_19 + bit<16> Ingress_tmp_20 + bit<16> Ingress_tmp_21 + bit<16> Ingress_tmp_22 + bit<32> Ingress_tmp_23 + bit<32> Ingress_tmp_24 + bit<16> Ingress_tmp_25 + bit<16> Ingress_tmp_26 + bit<16> Ingress_tmp_27 + bit<16> Ingress_tmp_28 + bit<16> Ingress_tmp_29 + bit<32> Ingress_tmp_30 + bit<16> Ingress_tmp_31 + bit<16> Ingress_tmp_32 + bit<16> Ingress_tmp_33 + bit<16> Ingress_tmp_34 + bit<16> Ingress_tmp_35 + bit<16> Ingress_tmp_36 + bit<16> Ingress_tmp_37 + bit<16> Ingress_tmp_38 + bit<16> Ingress_tmp_39 + bit<32> Ingress_tmp_40 + bit<16> Ingress_tmp_41 + bit<16> Ingress_tmp_42 + bit<16> Ingress_tmp_43 + bit<16> Ingress_tmp_44 + bit<16> Ingress_tmp_45 + bit<16> Ingress_tmp_46 + bit<16> Ingress_tmp_47 + bit<16> Ingress_tmp_48 + bit<16> Ingress_tmp_49 + bit<16> Ingress_hsVar + bit<32> Ingress_hsVar_0 + bit<32> Ingress_key +} +metadata instanceof main_metadata_t + +action execute_1 args none { + mov m.Ingress_tmp_1 m.local_metadata_depth + add m.Ingress_tmp_1 0x3 + jmpneq LABEL_FALSE_3 m.Ingress_tmp_1 0x0 + mov m.local_metadata_ethType h.vlan_tag_0.ether_type + jmp LABEL_END_4 + LABEL_FALSE_3 : mov m.Ingress_tmp_0 m.local_metadata_depth + add m.Ingress_tmp_0 0x3 + jmpneq LABEL_FALSE_4 m.Ingress_tmp_0 0x1 + mov m.local_metadata_ethType h.vlan_tag_1.ether_type + jmp LABEL_END_4 + LABEL_FALSE_4 : mov m.Ingress_tmp m.local_metadata_depth + add m.Ingress_tmp 0x3 + jmplt LABEL_END_4 m.Ingress_tmp 0x1 + mov m.local_metadata_ethType m.Ingress_hsVar + LABEL_END_4 : mov m.Ingress_tmp_3 m.local_metadata_depth + add m.Ingress_tmp_3 0x3 + jmpneq LABEL_FALSE_6 m.Ingress_tmp_3 0x0 + mov h.vlan_tag_0.ether_type 0x2 + jmp LABEL_END_7 + LABEL_FALSE_6 : mov m.Ingress_tmp_2 m.local_metadata_depth + add m.Ingress_tmp_2 0x3 + jmpneq LABEL_END_7 m.Ingress_tmp_2 0x1 + mov h.vlan_tag_1.ether_type 0x2 + LABEL_END_7 : jmpneq LABEL_FALSE_8 m.local_metadata_depth 0x0 + mov m.Ingress_tmp_14 h.vlan_tag_0.pcp_cfi_vid + and m.Ingress_tmp_14 0xf + mov m.Ingress_tmp_15 h.vlan_tag_0.pcp_cfi_vid + shr m.Ingress_tmp_15 0x3 + mov m.Ingress_tmp_16 m.Ingress_tmp_15 + mov m.Ingress_tmp_17 m.Ingress_tmp_16 + mov m.Ingress_tmp_18 m.Ingress_tmp_17 + mov m.Ingress_tmp_19 m.Ingress_tmp_18 + shl m.Ingress_tmp_19 0x4 + mov m.Ingress_tmp_20 m.Ingress_tmp_19 + and m.Ingress_tmp_20 0xfff0 + mov h.vlan_tag_0.pcp_cfi_vid m.Ingress_tmp_14 + or h.vlan_tag_0.pcp_cfi_vid m.Ingress_tmp_20 + jmp LABEL_END_9 + LABEL_FALSE_8 : jmpneq LABEL_END_9 m.local_metadata_depth 0x1 + mov m.Ingress_tmp_21 h.vlan_tag_1.pcp_cfi_vid + and m.Ingress_tmp_21 0xf + mov m.Ingress_tmp_22 h.vlan_tag_1.pcp_cfi_vid + shr m.Ingress_tmp_22 0x3 + mov m.Ingress_tmp_23 m.Ingress_tmp_22 + mov m.Ingress_tmp_24 m.Ingress_tmp_23 + mov m.Ingress_tmp_25 m.Ingress_tmp_24 + mov m.Ingress_tmp_26 m.Ingress_tmp_25 + shl m.Ingress_tmp_26 0x4 + mov m.Ingress_tmp_27 m.Ingress_tmp_26 + and m.Ingress_tmp_27 0xfff0 + mov h.vlan_tag_1.pcp_cfi_vid m.Ingress_tmp_21 + or h.vlan_tag_1.pcp_cfi_vid m.Ingress_tmp_27 + LABEL_END_9 : jmpneq LABEL_FALSE_10 m.local_metadata_depth 0x0 + mov m.Ingress_tmp_6 m.local_metadata_depth + add m.Ingress_tmp_6 0x3 + jmpneq LABEL_FALSE_11 m.Ingress_tmp_6 0x0 + jmp LABEL_END_11 + LABEL_FALSE_11 : mov m.Ingress_tmp_5 m.local_metadata_depth + add m.Ingress_tmp_5 0x3 + jmpneq LABEL_FALSE_12 m.Ingress_tmp_5 0x1 + mov m.Ingress_tmp_28 h.vlan_tag_0.pcp_cfi_vid + and m.Ingress_tmp_28 0xf + mov m.Ingress_tmp_29 h.vlan_tag_1.pcp_cfi_vid + shr m.Ingress_tmp_29 0x4 + mov m.Ingress_tmp_30 m.Ingress_tmp_29 + mov m.Ingress_tmp_31 m.Ingress_tmp_30 + mov m.Ingress_tmp_32 m.Ingress_tmp_31 + shl m.Ingress_tmp_32 0x4 + mov m.Ingress_tmp_33 m.Ingress_tmp_32 + and m.Ingress_tmp_33 0xfff0 + mov h.vlan_tag_0.pcp_cfi_vid m.Ingress_tmp_28 + or h.vlan_tag_0.pcp_cfi_vid m.Ingress_tmp_33 + jmp LABEL_END_11 + LABEL_FALSE_12 : mov m.Ingress_tmp_4 m.local_metadata_depth + add m.Ingress_tmp_4 0x3 + jmplt LABEL_END_11 m.Ingress_tmp_4 0x1 + mov m.Ingress_tmp_34 h.vlan_tag_0.pcp_cfi_vid + and m.Ingress_tmp_34 0xf + mov m.Ingress_tmp_35 m.Ingress_hsVar_0 + mov m.Ingress_tmp_36 m.Ingress_tmp_35 + shl m.Ingress_tmp_36 0x4 + mov m.Ingress_tmp_37 m.Ingress_tmp_36 + and m.Ingress_tmp_37 0xfff0 + mov h.vlan_tag_0.pcp_cfi_vid m.Ingress_tmp_34 + or h.vlan_tag_0.pcp_cfi_vid m.Ingress_tmp_37 + jmp LABEL_END_11 + LABEL_FALSE_10 : jmpneq LABEL_END_11 m.local_metadata_depth 0x1 + mov m.Ingress_tmp_9 m.local_metadata_depth + add m.Ingress_tmp_9 0x3 + jmpneq LABEL_FALSE_15 m.Ingress_tmp_9 0x0 + mov m.Ingress_tmp_38 h.vlan_tag_1.pcp_cfi_vid + and m.Ingress_tmp_38 0xf + mov m.Ingress_tmp_39 h.vlan_tag_0.pcp_cfi_vid + shr m.Ingress_tmp_39 0x4 + mov m.Ingress_tmp_40 m.Ingress_tmp_39 + mov m.Ingress_tmp_41 m.Ingress_tmp_40 + mov m.Ingress_tmp_42 m.Ingress_tmp_41 + shl m.Ingress_tmp_42 0x4 + mov m.Ingress_tmp_43 m.Ingress_tmp_42 + and m.Ingress_tmp_43 0xfff0 + mov h.vlan_tag_1.pcp_cfi_vid m.Ingress_tmp_38 + or h.vlan_tag_1.pcp_cfi_vid m.Ingress_tmp_43 + jmp LABEL_END_11 + LABEL_FALSE_15 : mov m.Ingress_tmp_8 m.local_metadata_depth + add m.Ingress_tmp_8 0x3 + jmpneq LABEL_FALSE_16 m.Ingress_tmp_8 0x1 + jmp LABEL_END_11 + LABEL_FALSE_16 : mov m.Ingress_tmp_7 m.local_metadata_depth + add m.Ingress_tmp_7 0x3 + jmplt LABEL_END_11 m.Ingress_tmp_7 0x1 + mov m.Ingress_tmp_44 h.vlan_tag_1.pcp_cfi_vid + and m.Ingress_tmp_44 0xf + mov m.Ingress_tmp_45 m.Ingress_hsVar_0 + mov m.Ingress_tmp_46 m.Ingress_tmp_45 + shl m.Ingress_tmp_46 0x4 + mov m.Ingress_tmp_47 m.Ingress_tmp_46 + and m.Ingress_tmp_47 0xfff0 + mov h.vlan_tag_1.pcp_cfi_vid m.Ingress_tmp_44 + or h.vlan_tag_1.pcp_cfi_vid m.Ingress_tmp_47 + LABEL_END_11 : return +} + +action execute_3 args none { + mov m.psa_ingress_output_metadata_drop 1 + return +} + +table stub { + key { + m.Ingress_key exact + } + actions { + execute_1 + } + default_action execute_1 args none const + size 0xf4240 +} + + +table stub1 { + key { + h.ethernet.etherType exact + } + actions { + execute_3 + } + default_action execute_3 args none const + size 0xf4240 +} + + +apply { + rx m.psa_ingress_input_metadata_ingress_port + mov m.psa_ingress_output_metadata_drop 0x0 + mov m.local_metadata_depth 0x1 + extract h.ethernet + jmpeq INGRESSPARSERIMPL_PARSE_VLAN_TAG h.ethernet.etherType 0x8100 + jmp INGRESSPARSERIMPL_ACCEPT + INGRESSPARSERIMPL_PARSE_VLAN_TAG : extract h.vlan_tag_0 + add m.local_metadata_depth 0x3 + jmpeq INGRESSPARSERIMPL_PARSE_VLAN_TAG1 h.vlan_tag_0.ether_type 0x8100 + jmp INGRESSPARSERIMPL_ACCEPT + INGRESSPARSERIMPL_PARSE_VLAN_TAG1 : extract h.vlan_tag_1 + add m.local_metadata_depth 0x3 + jmpeq INGRESSPARSERIMPL_PARSE_VLAN_TAG2 h.vlan_tag_1.ether_type 0x8100 + jmp INGRESSPARSERIMPL_ACCEPT + INGRESSPARSERIMPL_PARSE_VLAN_TAG2 : mov m.psa_ingress_input_metadata_parser_error 0x3 + INGRESSPARSERIMPL_ACCEPT : jmpneq LABEL_FALSE m.local_metadata_depth 0x0 + mov m.Ingress_tmp_10 h.vlan_tag_0.pcp_cfi_vid + shr m.Ingress_tmp_10 0x4 + mov m.Ingress_tmp_11 m.Ingress_tmp_10 + jmpeq LABEL_SWITCH m.Ingress_tmp_11 0x1 + jmpeq LABEL_SWITCH_0 m.Ingress_tmp_11 0x2 + jmp LABEL_END_0 + LABEL_SWITCH : mov m.Ingress_tmp_48 h.vlan_tag_0.pcp_cfi_vid + shr m.Ingress_tmp_48 0x4 + mov m.Ingress_key m.Ingress_tmp_48 + table stub + jmp LABEL_END_0 + LABEL_SWITCH_0 : jmpneq LABEL_END_0 h.vlan_tag_0.ether_type h.ethernet.etherType + table stub1 + jmp LABEL_END_0 + LABEL_FALSE : jmpneq LABEL_END_0 m.local_metadata_depth 0x1 + mov m.Ingress_tmp_12 h.vlan_tag_1.pcp_cfi_vid + shr m.Ingress_tmp_12 0x4 + mov m.Ingress_tmp_13 m.Ingress_tmp_12 + jmpeq LABEL_SWITCH_1 m.Ingress_tmp_13 0x1 + jmpeq LABEL_SWITCH_2 m.Ingress_tmp_13 0x2 + jmp LABEL_END_0 + LABEL_SWITCH_1 : mov m.Ingress_tmp_49 h.vlan_tag_1.pcp_cfi_vid + shr m.Ingress_tmp_49 0x4 + mov m.Ingress_key m.Ingress_tmp_49 + table stub + jmp LABEL_END_0 + LABEL_SWITCH_2 : jmpneq LABEL_END_0 h.vlan_tag_1.ether_type h.ethernet.etherType + table stub1 + LABEL_END_0 : jmpneq LABEL_DROP m.psa_ingress_output_metadata_drop 0x0 + emit h.ethernet + tx m.psa_ingress_output_metadata_egress_port + LABEL_DROP : drop +} + + diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-issue361-bmv2.p4-error b/testdata/p4_16_samples_outputs/psa-dpdk-issue361-bmv2.p4-error new file mode 100644 index 00000000000..1a063a87f5c --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-issue361-bmv2.p4-error @@ -0,0 +1 @@ +[--Wwarn=parser-transition] warning: SelectCase: unreachable case diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-issue361-bmv2.p4.bfrt.json b/testdata/p4_16_samples_outputs/psa-dpdk-issue361-bmv2.p4.bfrt.json new file mode 100644 index 00000000000..b6d66a630db --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-issue361-bmv2.p4.bfrt.json @@ -0,0 +1,5 @@ +{ + "schema_version" : "1.0.0", + "tables" : [], + "learn_filters" : [] +} \ No newline at end of file diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-issue361-bmv2.p4.spec b/testdata/p4_16_samples_outputs/psa-dpdk-issue361-bmv2.p4.spec new file mode 100644 index 00000000000..9f6019365e2 --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-issue361-bmv2.p4.spec @@ -0,0 +1,43 @@ + +struct H { + bit<32> f +} + +struct psa_ingress_output_metadata_t { + bit<8> class_of_service + bit<8> clone + bit<16> clone_session_id + bit<8> drop + bit<8> resubmit + bit<32> multicast_group + bit<32> egress_port +} + +struct psa_egress_output_metadata_t { + bit<8> clone + bit<16> clone_session_id + bit<8> drop +} + +struct psa_egress_deparser_input_metadata_t { + bit<32> egress_port +} + +header h instanceof H + +struct my_metadata { + bit<32> psa_ingress_input_metadata_ingress_port + bit<8> psa_ingress_output_metadata_drop + bit<32> psa_ingress_output_metadata_egress_port +} +metadata instanceof my_metadata + +apply { + rx m.psa_ingress_input_metadata_ingress_port + mov m.psa_ingress_output_metadata_drop 0x0 + jmpneq LABEL_DROP m.psa_ingress_output_metadata_drop 0x0 + tx m.psa_ingress_output_metadata_egress_port + LABEL_DROP : drop +} + + diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-issue361-first.p4 b/testdata/p4_16_samples_outputs/psa-dpdk-issue361-first.p4 new file mode 100644 index 00000000000..f91f0a25192 --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-issue361-first.p4 @@ -0,0 +1,80 @@ +#include +#include + +header EMPTY_H { +} + +struct EMPTY_RESUB { +} + +struct EMPTY_CLONE { +} + +struct EMPTY_BRIDGE { +} + +struct EMPTY_RECIRC { +} + +header H { + bit<32> f; +} + +struct my_packet { + H h; +} + +struct my_metadata { +} + +parser MyParser(packet_in b, out my_packet p, inout my_metadata m, in psa_ingress_parser_input_metadata_t x, in EMPTY_RESUB resub_meta, in EMPTY_RECIRC recirc_meta) { + bool bv = true; + state start { + transition select(bv) { + false: next; + true: accept; + } + } + state next { + b.extract(p.h); + transition accept; + } +} + +parser egressParserImpl(packet_in buffer, out EMPTY_H a, inout my_metadata b, in psa_egress_parser_input_metadata_t c, in EMPTY_BRIDGE d, in EMPTY_CLONE e, in EMPTY_CLONE f) { + state start { + transition accept; + } +} + +control C() { + apply { + } +} + +control MyIngress(inout my_packet p, inout my_metadata m, in psa_ingress_input_metadata_t istd, inout psa_ingress_output_metadata_t ostd) { + apply { + } +} + +control egressControlImpl(inout EMPTY_H hdr, inout my_metadata meta, in psa_egress_input_metadata_t x, inout psa_egress_output_metadata_t ostd) { + apply { + } +} + +control MyDeparser(packet_out b, out EMPTY_CLONE clone_i2e_meta, out EMPTY_RESUB resubmit_meta, out EMPTY_BRIDGE normal_meta, inout my_packet hdr, in my_metadata local_metadata, in psa_ingress_output_metadata_t istd) { + apply { + } +} + +control egressDeparserImpl(packet_out buffer, out EMPTY_CLONE a, out EMPTY_RECIRC b, inout EMPTY_H c, in my_metadata d, in psa_egress_output_metadata_t e, in psa_egress_deparser_input_metadata_t f) { + apply { + } +} + +IngressPipeline(MyParser(), MyIngress(), MyDeparser()) ip; + +EgressPipeline(egressParserImpl(), egressControlImpl(), egressDeparserImpl()) ep; + +PSA_Switch(ip, PacketReplicationEngine(), ep, BufferingQueueingEngine()) main; + diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-issue361-frontend.p4 b/testdata/p4_16_samples_outputs/psa-dpdk-issue361-frontend.p4 new file mode 100644 index 00000000000..f4b41b61141 --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-issue361-frontend.p4 @@ -0,0 +1,82 @@ +#include +#include + +header EMPTY_H { +} + +struct EMPTY_RESUB { +} + +struct EMPTY_CLONE { +} + +struct EMPTY_BRIDGE { +} + +struct EMPTY_RECIRC { +} + +header H { + bit<32> f; +} + +struct my_packet { + H h; +} + +struct my_metadata { +} + +parser MyParser(packet_in b, out my_packet p, inout my_metadata m, in psa_ingress_parser_input_metadata_t x, in EMPTY_RESUB resub_meta, in EMPTY_RECIRC recirc_meta) { + @name("MyParser.bv") bool bv_0; + state start { + bv_0 = true; + transition start_0; + } + state start_0 { + transition select(bv_0) { + false: next; + true: accept; + } + } + state next { + b.extract(p.h); + transition accept; + } +} + +parser egressParserImpl(packet_in buffer, out EMPTY_H a, inout my_metadata b, in psa_egress_parser_input_metadata_t c, in EMPTY_BRIDGE d, in EMPTY_CLONE e, in EMPTY_CLONE f) { + state start { + transition start_0; + } + state start_0 { + transition accept; + } +} + +control MyIngress(inout my_packet p, inout my_metadata m, in psa_ingress_input_metadata_t istd, inout psa_ingress_output_metadata_t ostd) { + apply { + } +} + +control egressControlImpl(inout EMPTY_H hdr, inout my_metadata meta, in psa_egress_input_metadata_t x, inout psa_egress_output_metadata_t ostd) { + apply { + } +} + +control MyDeparser(packet_out b, out EMPTY_CLONE clone_i2e_meta, out EMPTY_RESUB resubmit_meta, out EMPTY_BRIDGE normal_meta, inout my_packet hdr, in my_metadata local_metadata, in psa_ingress_output_metadata_t istd) { + apply { + } +} + +control egressDeparserImpl(packet_out buffer, out EMPTY_CLONE a, out EMPTY_RECIRC b, inout EMPTY_H c, in my_metadata d, in psa_egress_output_metadata_t e, in psa_egress_deparser_input_metadata_t f) { + apply { + } +} + +IngressPipeline(MyParser(), MyIngress(), MyDeparser()) ip; + +EgressPipeline(egressParserImpl(), egressControlImpl(), egressDeparserImpl()) ep; + +PSA_Switch(ip, PacketReplicationEngine(), ep, BufferingQueueingEngine()) main; + diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-issue361-midend.p4 b/testdata/p4_16_samples_outputs/psa-dpdk-issue361-midend.p4 new file mode 100644 index 00000000000..e7e4521e308 --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-issue361-midend.p4 @@ -0,0 +1,75 @@ +#include +#include + +header EMPTY_H { +} + +struct EMPTY_RESUB { +} + +struct EMPTY_CLONE { +} + +struct EMPTY_BRIDGE { +} + +struct EMPTY_RECIRC { +} + +header H { + bit<32> f; +} + +struct my_packet { + H h; +} + +struct my_metadata { +} + +parser MyParser(packet_in b, out my_packet p, inout my_metadata m, in psa_ingress_parser_input_metadata_t x, in EMPTY_RESUB resub_meta, in EMPTY_RECIRC recirc_meta) { + state start { + transition accept; + } + state next { + b.extract(p.h); + transition accept; + } + state noMatch { + verify(false, error.NoMatch); + transition reject; + } +} + +parser egressParserImpl(packet_in buffer, out EMPTY_H a, inout my_metadata b, in psa_egress_parser_input_metadata_t c, in EMPTY_BRIDGE d, in EMPTY_CLONE e, in EMPTY_CLONE f) { + state start { + transition accept; + } +} + +control MyIngress(inout my_packet p, inout my_metadata m, in psa_ingress_input_metadata_t istd, inout psa_ingress_output_metadata_t ostd) { + apply { + } +} + +control egressControlImpl(inout EMPTY_H hdr, inout my_metadata meta, in psa_egress_input_metadata_t x, inout psa_egress_output_metadata_t ostd) { + apply { + } +} + +control MyDeparser(packet_out b, out EMPTY_CLONE clone_i2e_meta, out EMPTY_RESUB resubmit_meta, out EMPTY_BRIDGE normal_meta, inout my_packet hdr, in my_metadata local_metadata, in psa_ingress_output_metadata_t istd) { + apply { + } +} + +control egressDeparserImpl(packet_out buffer, out EMPTY_CLONE a, out EMPTY_RECIRC b, inout EMPTY_H c, in my_metadata d, in psa_egress_output_metadata_t e, in psa_egress_deparser_input_metadata_t f) { + apply { + } +} + +IngressPipeline(MyParser(), MyIngress(), MyDeparser()) ip; + +EgressPipeline(egressParserImpl(), egressControlImpl(), egressDeparserImpl()) ep; + +PSA_Switch(ip, PacketReplicationEngine(), ep, BufferingQueueingEngine()) main; + diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-issue361.p4 b/testdata/p4_16_samples_outputs/psa-dpdk-issue361.p4 new file mode 100644 index 00000000000..9fe2929ea67 --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-issue361.p4 @@ -0,0 +1,80 @@ +#include +#include + +header EMPTY_H { +} + +struct EMPTY_RESUB { +} + +struct EMPTY_CLONE { +} + +struct EMPTY_BRIDGE { +} + +struct EMPTY_RECIRC { +} + +header H { + bit<32> f; +} + +struct my_packet { + H h; +} + +struct my_metadata { +} + +parser MyParser(packet_in b, out my_packet p, inout my_metadata m, in psa_ingress_parser_input_metadata_t x, in EMPTY_RESUB resub_meta, in EMPTY_RECIRC recirc_meta) { + bool bv = true; + state start { + transition select(bv) { + false: next; + true: accept; + } + } + state next { + b.extract(p.h); + transition accept; + } +} + +parser egressParserImpl(packet_in buffer, out EMPTY_H a, inout my_metadata b, in psa_egress_parser_input_metadata_t c, in EMPTY_BRIDGE d, in EMPTY_CLONE e, in EMPTY_CLONE f) { + state start { + transition accept; + } +} + +control C() { + apply { + } +} + +control MyIngress(inout my_packet p, inout my_metadata m, in psa_ingress_input_metadata_t istd, inout psa_ingress_output_metadata_t ostd) { + apply { + } +} + +control egressControlImpl(inout EMPTY_H hdr, inout my_metadata meta, in psa_egress_input_metadata_t x, inout psa_egress_output_metadata_t ostd) { + apply { + } +} + +control MyDeparser(packet_out b, out EMPTY_CLONE clone_i2e_meta, out EMPTY_RESUB resubmit_meta, out EMPTY_BRIDGE normal_meta, inout my_packet hdr, in my_metadata local_metadata, in psa_ingress_output_metadata_t istd) { + apply { + } +} + +control egressDeparserImpl(packet_out buffer, out EMPTY_CLONE a, out EMPTY_RECIRC b, inout EMPTY_H c, in my_metadata d, in psa_egress_output_metadata_t e, in psa_egress_deparser_input_metadata_t f) { + apply { + } +} + +IngressPipeline(MyParser(), MyIngress(), MyDeparser()) ip; + +EgressPipeline(egressParserImpl(), egressControlImpl(), egressDeparserImpl()) ep; + +PSA_Switch(ip, PacketReplicationEngine(), ep, BufferingQueueingEngine()) main; + diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-issue361.p4-error b/testdata/p4_16_samples_outputs/psa-dpdk-issue361.p4-error new file mode 100644 index 00000000000..1a063a87f5c --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-issue361.p4-error @@ -0,0 +1 @@ +[--Wwarn=parser-transition] warning: SelectCase: unreachable case diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-issue361.p4-stderr b/testdata/p4_16_samples_outputs/psa-dpdk-issue361.p4-stderr new file mode 100644 index 00000000000..1a063a87f5c --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-issue361.p4-stderr @@ -0,0 +1 @@ +[--Wwarn=parser-transition] warning: SelectCase: unreachable case diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-issue361.p4.bfrt.json b/testdata/p4_16_samples_outputs/psa-dpdk-issue361.p4.bfrt.json new file mode 100644 index 00000000000..b6d66a630db --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-issue361.p4.bfrt.json @@ -0,0 +1,5 @@ +{ + "schema_version" : "1.0.0", + "tables" : [], + "learn_filters" : [] +} \ No newline at end of file diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-issue361.p4.entries.txt b/testdata/p4_16_samples_outputs/psa-dpdk-issue361.p4.entries.txt new file mode 100644 index 00000000000..e69de29bb2d diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-issue361.p4.p4info.txt b/testdata/p4_16_samples_outputs/psa-dpdk-issue361.p4.p4info.txt new file mode 100644 index 00000000000..77612386454 --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-issue361.p4.p4info.txt @@ -0,0 +1,3 @@ +pkg_info { + arch: "psa" +} diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-issue361.p4.spec b/testdata/p4_16_samples_outputs/psa-dpdk-issue361.p4.spec new file mode 100644 index 00000000000..9f6019365e2 --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-issue361.p4.spec @@ -0,0 +1,43 @@ + +struct H { + bit<32> f +} + +struct psa_ingress_output_metadata_t { + bit<8> class_of_service + bit<8> clone + bit<16> clone_session_id + bit<8> drop + bit<8> resubmit + bit<32> multicast_group + bit<32> egress_port +} + +struct psa_egress_output_metadata_t { + bit<8> clone + bit<16> clone_session_id + bit<8> drop +} + +struct psa_egress_deparser_input_metadata_t { + bit<32> egress_port +} + +header h instanceof H + +struct my_metadata { + bit<32> psa_ingress_input_metadata_ingress_port + bit<8> psa_ingress_output_metadata_drop + bit<32> psa_ingress_output_metadata_egress_port +} +metadata instanceof my_metadata + +apply { + rx m.psa_ingress_input_metadata_ingress_port + mov m.psa_ingress_output_metadata_drop 0x0 + jmpneq LABEL_DROP m.psa_ingress_output_metadata_drop 0x0 + tx m.psa_ingress_output_metadata_egress_port + LABEL_DROP : drop +} + + diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-issue447-3-bmv2.p4-error b/testdata/p4_16_samples_outputs/psa-dpdk-issue447-3-bmv2.p4-error new file mode 100644 index 00000000000..e69de29bb2d diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-issue447-3-bmv2.p4.bfrt.json b/testdata/p4_16_samples_outputs/psa-dpdk-issue447-3-bmv2.p4.bfrt.json new file mode 100644 index 00000000000..b6d66a630db --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-issue447-3-bmv2.p4.bfrt.json @@ -0,0 +1,5 @@ +{ + "schema_version" : "1.0.0", + "tables" : [], + "learn_filters" : [] +} \ No newline at end of file diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-issue447-3-bmv2.p4.spec b/testdata/p4_16_samples_outputs/psa-dpdk-issue447-3-bmv2.p4.spec new file mode 100644 index 00000000000..dc0b2127eb8 --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-issue447-3-bmv2.p4.spec @@ -0,0 +1,56 @@ + +struct S { + bit<32> size +} + +struct H { + varbit<32> var +} + +struct psa_ingress_output_metadata_t { + bit<8> class_of_service + bit<8> clone + bit<16> clone_session_id + bit<8> drop + bit<8> resubmit + bit<32> multicast_group + bit<32> egress_port +} + +struct psa_egress_output_metadata_t { + bit<8> clone + bit<16> clone_session_id + bit<8> drop +} + +struct psa_egress_deparser_input_metadata_t { + bit<32> egress_port +} + +header s1 instanceof S +header h instanceof H +header s2 instanceof S + +struct Metadata { + bit<32> psa_ingress_input_metadata_ingress_port + bit<8> psa_ingress_output_metadata_drop + bit<32> psa_ingress_output_metadata_egress_port + bit<32> size_extract_tmp +} +metadata instanceof Metadata + +apply { + rx m.psa_ingress_input_metadata_ingress_port + mov m.psa_ingress_output_metadata_drop 0x0 + extract h.s1 + mov m.size_extract_tmp h.s1.size + shr m.size_extract_tmp 0x3 + extract h.h m.size_extract_tmp + extract h.s2 + jmpneq LABEL_DROP m.psa_ingress_output_metadata_drop 0x0 + emit h.s2 + tx m.psa_ingress_output_metadata_egress_port + LABEL_DROP : drop +} + + diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-issue447-3-first.p4 b/testdata/p4_16_samples_outputs/psa-dpdk-issue447-3-first.p4 new file mode 100644 index 00000000000..ddeae9582fc --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-issue447-3-first.p4 @@ -0,0 +1,78 @@ +#include +#include + +header EMPTY_H { +} + +struct EMPTY_RESUB { +} + +struct EMPTY_CLONE { +} + +struct EMPTY_BRIDGE { +} + +struct EMPTY_RECIRC { +} + +header S { + bit<32> size; +} + +header H { + varbit<32> var; +} + +struct Parsed_packet { + S s1; + H h; + S s2; +} + +struct Metadata { +} + +parser parserI(packet_in pkt, out Parsed_packet hdr, inout Metadata meta, in psa_ingress_parser_input_metadata_t x, in EMPTY_RESUB resub_meta, in EMPTY_RECIRC recirc_meta) { + state start { + pkt.extract(hdr.s1); + bit<32> size = hdr.s1.size; + pkt.extract(hdr.h, size); + pkt.extract(hdr.s2); + transition accept; + } +} + +parser egressParserImpl(packet_in buffer, out EMPTY_H a, inout Metadata b, in psa_egress_parser_input_metadata_t c, in EMPTY_BRIDGE d, in EMPTY_CLONE e, in EMPTY_CLONE f) { + state start { + transition accept; + } +} + +control ingress(inout Parsed_packet hdr, inout Metadata meta, in psa_ingress_input_metadata_t istd, inout psa_ingress_output_metadata_t ostd) { + apply { + } +} + +control egressControlImpl(inout EMPTY_H hdr, inout Metadata meta, in psa_egress_input_metadata_t x, inout psa_egress_output_metadata_t ostd) { + apply { + } +} + +control DeparserI(packet_out packet, out EMPTY_CLONE clone_i2e_meta, out EMPTY_RESUB resubmit_meta, out EMPTY_BRIDGE normal_meta, inout Parsed_packet hdr, in Metadata local_metadata, in psa_ingress_output_metadata_t istd) { + apply { + packet.emit(hdr.s2); + } +} + +control egressDeparserImpl(packet_out buffer, out EMPTY_CLONE a, out EMPTY_RECIRC b, inout EMPTY_H c, in Metadata d, in psa_egress_output_metadata_t e, in psa_egress_deparser_input_metadata_t f) { + apply { + } +} + +IngressPipeline(parserI(), ingress(), DeparserI()) ip; + +EgressPipeline(egressParserImpl(), egressControlImpl(), egressDeparserImpl()) ep; + +PSA_Switch(ip, PacketReplicationEngine(), ep, BufferingQueueingEngine()) main; + diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-issue447-3-frontend.p4 b/testdata/p4_16_samples_outputs/psa-dpdk-issue447-3-frontend.p4 new file mode 100644 index 00000000000..36ddff103bd --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-issue447-3-frontend.p4 @@ -0,0 +1,79 @@ +#include +#include + +header EMPTY_H { +} + +struct EMPTY_RESUB { +} + +struct EMPTY_CLONE { +} + +struct EMPTY_BRIDGE { +} + +struct EMPTY_RECIRC { +} + +header S { + bit<32> size; +} + +header H { + varbit<32> var; +} + +struct Parsed_packet { + S s1; + H h; + S s2; +} + +struct Metadata { +} + +parser parserI(packet_in pkt, out Parsed_packet hdr, inout Metadata meta, in psa_ingress_parser_input_metadata_t x, in EMPTY_RESUB resub_meta, in EMPTY_RECIRC recirc_meta) { + @name("parserI.size") bit<32> size_0; + state start { + pkt.extract(hdr.s1); + size_0 = hdr.s1.size; + pkt.extract(hdr.h, size_0); + pkt.extract(hdr.s2); + transition accept; + } +} + +parser egressParserImpl(packet_in buffer, out EMPTY_H a, inout Metadata b, in psa_egress_parser_input_metadata_t c, in EMPTY_BRIDGE d, in EMPTY_CLONE e, in EMPTY_CLONE f) { + state start { + transition accept; + } +} + +control ingress(inout Parsed_packet hdr, inout Metadata meta, in psa_ingress_input_metadata_t istd, inout psa_ingress_output_metadata_t ostd) { + apply { + } +} + +control egressControlImpl(inout EMPTY_H hdr, inout Metadata meta, in psa_egress_input_metadata_t x, inout psa_egress_output_metadata_t ostd) { + apply { + } +} + +control DeparserI(packet_out packet, out EMPTY_CLONE clone_i2e_meta, out EMPTY_RESUB resubmit_meta, out EMPTY_BRIDGE normal_meta, inout Parsed_packet hdr, in Metadata local_metadata, in psa_ingress_output_metadata_t istd) { + apply { + packet.emit(hdr.s2); + } +} + +control egressDeparserImpl(packet_out buffer, out EMPTY_CLONE a, out EMPTY_RECIRC b, inout EMPTY_H c, in Metadata d, in psa_egress_output_metadata_t e, in psa_egress_deparser_input_metadata_t f) { + apply { + } +} + +IngressPipeline(parserI(), ingress(), DeparserI()) ip; + +EgressPipeline(egressParserImpl(), egressControlImpl(), egressDeparserImpl()) ep; + +PSA_Switch(ip, PacketReplicationEngine(), ep, BufferingQueueingEngine()) main; + diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-issue447-3-midend.p4 b/testdata/p4_16_samples_outputs/psa-dpdk-issue447-3-midend.p4 new file mode 100644 index 00000000000..6e16440f481 --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-issue447-3-midend.p4 @@ -0,0 +1,86 @@ +#include +#include + +header EMPTY_H { +} + +struct EMPTY_RESUB { +} + +struct EMPTY_CLONE { +} + +struct EMPTY_BRIDGE { +} + +struct EMPTY_RECIRC { +} + +header S { + bit<32> size; +} + +header H { + varbit<32> var; +} + +struct Parsed_packet { + S s1; + H h; + S s2; +} + +struct Metadata { +} + +parser parserI(packet_in pkt, out Parsed_packet hdr, inout Metadata meta, in psa_ingress_parser_input_metadata_t x, in EMPTY_RESUB resub_meta, in EMPTY_RECIRC recirc_meta) { + state start { + pkt.extract(hdr.s1); + pkt.extract(hdr.h, hdr.s1.size); + pkt.extract(hdr.s2); + transition accept; + } +} + +parser egressParserImpl(packet_in buffer, out EMPTY_H a, inout Metadata b, in psa_egress_parser_input_metadata_t c, in EMPTY_BRIDGE d, in EMPTY_CLONE e, in EMPTY_CLONE f) { + state start { + transition accept; + } +} + +control ingress(inout Parsed_packet hdr, inout Metadata meta, in psa_ingress_input_metadata_t istd, inout psa_ingress_output_metadata_t ostd) { + apply { + } +} + +control egressControlImpl(inout EMPTY_H hdr, inout Metadata meta, in psa_egress_input_metadata_t x, inout psa_egress_output_metadata_t ostd) { + apply { + } +} + +control DeparserI(packet_out packet, out EMPTY_CLONE clone_i2e_meta, out EMPTY_RESUB resubmit_meta, out EMPTY_BRIDGE normal_meta, inout Parsed_packet hdr, in Metadata local_metadata, in psa_ingress_output_metadata_t istd) { + @hidden action psadpdkissue4473l76() { + packet.emit(hdr.s2); + } + @hidden table tbl_psadpdkissue4473l76 { + actions = { + psadpdkissue4473l76(); + } + const default_action = psadpdkissue4473l76(); + } + apply { + tbl_psadpdkissue4473l76.apply(); + } +} + +control egressDeparserImpl(packet_out buffer, out EMPTY_CLONE a, out EMPTY_RECIRC b, inout EMPTY_H c, in Metadata d, in psa_egress_output_metadata_t e, in psa_egress_deparser_input_metadata_t f) { + apply { + } +} + +IngressPipeline(parserI(), ingress(), DeparserI()) ip; + +EgressPipeline(egressParserImpl(), egressControlImpl(), egressDeparserImpl()) ep; + +PSA_Switch(ip, PacketReplicationEngine(), ep, BufferingQueueingEngine()) main; + diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-issue447-3.p4 b/testdata/p4_16_samples_outputs/psa-dpdk-issue447-3.p4 new file mode 100644 index 00000000000..94dcd9513c3 --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-issue447-3.p4 @@ -0,0 +1,78 @@ +#include +#include + +header EMPTY_H { +} + +struct EMPTY_RESUB { +} + +struct EMPTY_CLONE { +} + +struct EMPTY_BRIDGE { +} + +struct EMPTY_RECIRC { +} + +header S { + bit<32> size; +} + +header H { + varbit<32> var; +} + +struct Parsed_packet { + S s1; + H h; + S s2; +} + +struct Metadata { +} + +parser parserI(packet_in pkt, out Parsed_packet hdr, inout Metadata meta, in psa_ingress_parser_input_metadata_t x, in EMPTY_RESUB resub_meta, in EMPTY_RECIRC recirc_meta) { + state start { + pkt.extract(hdr.s1); + bit<32> size = hdr.s1.size; + pkt.extract(hdr.h, size); + pkt.extract(hdr.s2); + transition accept; + } +} + +parser egressParserImpl(packet_in buffer, out EMPTY_H a, inout Metadata b, in psa_egress_parser_input_metadata_t c, in EMPTY_BRIDGE d, in EMPTY_CLONE e, in EMPTY_CLONE f) { + state start { + transition accept; + } +} + +control ingress(inout Parsed_packet hdr, inout Metadata meta, in psa_ingress_input_metadata_t istd, inout psa_ingress_output_metadata_t ostd) { + apply { + } +} + +control egressControlImpl(inout EMPTY_H hdr, inout Metadata meta, in psa_egress_input_metadata_t x, inout psa_egress_output_metadata_t ostd) { + apply { + } +} + +control DeparserI(packet_out packet, out EMPTY_CLONE clone_i2e_meta, out EMPTY_RESUB resubmit_meta, out EMPTY_BRIDGE normal_meta, inout Parsed_packet hdr, in Metadata local_metadata, in psa_ingress_output_metadata_t istd) { + apply { + packet.emit(hdr.s2); + } +} + +control egressDeparserImpl(packet_out buffer, out EMPTY_CLONE a, out EMPTY_RECIRC b, inout EMPTY_H c, in Metadata d, in psa_egress_output_metadata_t e, in psa_egress_deparser_input_metadata_t f) { + apply { + } +} + +IngressPipeline(parserI(), ingress(), DeparserI()) ip; + +EgressPipeline(egressParserImpl(), egressControlImpl(), egressDeparserImpl()) ep; + +PSA_Switch(ip, PacketReplicationEngine(), ep, BufferingQueueingEngine()) main; + diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-issue447-3.p4-error b/testdata/p4_16_samples_outputs/psa-dpdk-issue447-3.p4-error new file mode 100644 index 00000000000..e69de29bb2d diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-issue447-3.p4-stderr b/testdata/p4_16_samples_outputs/psa-dpdk-issue447-3.p4-stderr new file mode 100644 index 00000000000..e69de29bb2d diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-issue447-3.p4.bfrt.json b/testdata/p4_16_samples_outputs/psa-dpdk-issue447-3.p4.bfrt.json new file mode 100644 index 00000000000..b6d66a630db --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-issue447-3.p4.bfrt.json @@ -0,0 +1,5 @@ +{ + "schema_version" : "1.0.0", + "tables" : [], + "learn_filters" : [] +} \ No newline at end of file diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-issue447-3.p4.entries.txt b/testdata/p4_16_samples_outputs/psa-dpdk-issue447-3.p4.entries.txt new file mode 100644 index 00000000000..e69de29bb2d diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-issue447-3.p4.p4info.txt b/testdata/p4_16_samples_outputs/psa-dpdk-issue447-3.p4.p4info.txt new file mode 100644 index 00000000000..77612386454 --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-issue447-3.p4.p4info.txt @@ -0,0 +1,3 @@ +pkg_info { + arch: "psa" +} diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-issue447-3.p4.spec b/testdata/p4_16_samples_outputs/psa-dpdk-issue447-3.p4.spec new file mode 100644 index 00000000000..dc0b2127eb8 --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-issue447-3.p4.spec @@ -0,0 +1,56 @@ + +struct S { + bit<32> size +} + +struct H { + varbit<32> var +} + +struct psa_ingress_output_metadata_t { + bit<8> class_of_service + bit<8> clone + bit<16> clone_session_id + bit<8> drop + bit<8> resubmit + bit<32> multicast_group + bit<32> egress_port +} + +struct psa_egress_output_metadata_t { + bit<8> clone + bit<16> clone_session_id + bit<8> drop +} + +struct psa_egress_deparser_input_metadata_t { + bit<32> egress_port +} + +header s1 instanceof S +header h instanceof H +header s2 instanceof S + +struct Metadata { + bit<32> psa_ingress_input_metadata_ingress_port + bit<8> psa_ingress_output_metadata_drop + bit<32> psa_ingress_output_metadata_egress_port + bit<32> size_extract_tmp +} +metadata instanceof Metadata + +apply { + rx m.psa_ingress_input_metadata_ingress_port + mov m.psa_ingress_output_metadata_drop 0x0 + extract h.s1 + mov m.size_extract_tmp h.s1.size + shr m.size_extract_tmp 0x3 + extract h.h m.size_extract_tmp + extract h.s2 + jmpneq LABEL_DROP m.psa_ingress_output_metadata_drop 0x0 + emit h.s2 + tx m.psa_ingress_output_metadata_egress_port + LABEL_DROP : drop +} + + diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-issue447-5-first.p4 b/testdata/p4_16_samples_outputs/psa-dpdk-issue447-5-first.p4 new file mode 100644 index 00000000000..4e409376565 --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-issue447-5-first.p4 @@ -0,0 +1,86 @@ +error { + UnhandledIPv4Options, + BadIPv4HeaderChecksum +} +#include +#include + +header EMPTY_H { +} + +struct EMPTY_RESUB { +} + +struct EMPTY_CLONE { +} + +struct EMPTY_BRIDGE { +} + +struct EMPTY_RECIRC { +} + +header S { + bit<32> size; +} + +header H { + varbit<32> var; +} + +struct Parsed_packet { + S s1; + H h1; + H h2; +} + +struct Metadata { +} + +parser parserI(packet_in pkt, out Parsed_packet hdr, inout Metadata meta, in psa_ingress_parser_input_metadata_t x, in EMPTY_RESUB resub_meta, in EMPTY_RECIRC recirc_meta) { + state start { + pkt.extract(hdr.s1); + pkt.extract(hdr.h1, hdr.s1.size); + pkt.extract(hdr.h2, hdr.s1.size); + transition accept; + } +} + +parser egressParserImpl(packet_in buffer, out EMPTY_H a, inout Metadata b, in psa_egress_parser_input_metadata_t c, in EMPTY_BRIDGE d, in EMPTY_CLONE e, in EMPTY_CLONE f) { + state start { + transition accept; + } +} + +control DeparserI(packet_out packet, out EMPTY_CLONE clone_i2e_meta, out EMPTY_RESUB resubmit_meta, out EMPTY_BRIDGE normal_meta, inout Parsed_packet hdr, in Metadata local_metadata, in psa_ingress_output_metadata_t istd) { + apply { + packet.emit(hdr.h1); + packet.emit(hdr.h2); + } +} + +control ingress(inout Parsed_packet hdr, inout Metadata meta, in psa_ingress_input_metadata_t istd, inout psa_ingress_output_metadata_t ostd) { + varbit<32> s; + apply { + s = hdr.h1.var; + hdr.h1.var = hdr.h2.var; + hdr.h2.var = s; + } +} + +control egressControlImpl(inout EMPTY_H hdr, inout Metadata meta, in psa_egress_input_metadata_t x, inout psa_egress_output_metadata_t ostd) { + apply { + } +} + +control egressDeparserImpl(packet_out buffer, out EMPTY_CLONE a, out EMPTY_RECIRC b, inout EMPTY_H c, in Metadata d, in psa_egress_output_metadata_t e, in psa_egress_deparser_input_metadata_t f) { + apply { + } +} + +IngressPipeline(parserI(), ingress(), DeparserI()) ip; + +EgressPipeline(egressParserImpl(), egressControlImpl(), egressDeparserImpl()) ep; + +PSA_Switch(ip, PacketReplicationEngine(), ep, BufferingQueueingEngine()) main; + diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-issue447-5-frontend.p4 b/testdata/p4_16_samples_outputs/psa-dpdk-issue447-5-frontend.p4 new file mode 100644 index 00000000000..d4e2e1da69b --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-issue447-5-frontend.p4 @@ -0,0 +1,86 @@ +error { + UnhandledIPv4Options, + BadIPv4HeaderChecksum +} +#include +#include + +header EMPTY_H { +} + +struct EMPTY_RESUB { +} + +struct EMPTY_CLONE { +} + +struct EMPTY_BRIDGE { +} + +struct EMPTY_RECIRC { +} + +header S { + bit<32> size; +} + +header H { + varbit<32> var; +} + +struct Parsed_packet { + S s1; + H h1; + H h2; +} + +struct Metadata { +} + +parser parserI(packet_in pkt, out Parsed_packet hdr, inout Metadata meta, in psa_ingress_parser_input_metadata_t x, in EMPTY_RESUB resub_meta, in EMPTY_RECIRC recirc_meta) { + state start { + pkt.extract(hdr.s1); + pkt.extract(hdr.h1, hdr.s1.size); + pkt.extract(hdr.h2, hdr.s1.size); + transition accept; + } +} + +parser egressParserImpl(packet_in buffer, out EMPTY_H a, inout Metadata b, in psa_egress_parser_input_metadata_t c, in EMPTY_BRIDGE d, in EMPTY_CLONE e, in EMPTY_CLONE f) { + state start { + transition accept; + } +} + +control DeparserI(packet_out packet, out EMPTY_CLONE clone_i2e_meta, out EMPTY_RESUB resubmit_meta, out EMPTY_BRIDGE normal_meta, inout Parsed_packet hdr, in Metadata local_metadata, in psa_ingress_output_metadata_t istd) { + apply { + packet.emit(hdr.h1); + packet.emit(hdr.h2); + } +} + +control ingress(inout Parsed_packet hdr, inout Metadata meta, in psa_ingress_input_metadata_t istd, inout psa_ingress_output_metadata_t ostd) { + @name("ingress.s") varbit<32> s_0; + apply { + s_0 = hdr.h1.var; + hdr.h1.var = hdr.h2.var; + hdr.h2.var = s_0; + } +} + +control egressControlImpl(inout EMPTY_H hdr, inout Metadata meta, in psa_egress_input_metadata_t x, inout psa_egress_output_metadata_t ostd) { + apply { + } +} + +control egressDeparserImpl(packet_out buffer, out EMPTY_CLONE a, out EMPTY_RECIRC b, inout EMPTY_H c, in Metadata d, in psa_egress_output_metadata_t e, in psa_egress_deparser_input_metadata_t f) { + apply { + } +} + +IngressPipeline(parserI(), ingress(), DeparserI()) ip; + +EgressPipeline(egressParserImpl(), egressControlImpl(), egressDeparserImpl()) ep; + +PSA_Switch(ip, PacketReplicationEngine(), ep, BufferingQueueingEngine()) main; + diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-issue447-5-midend.p4 b/testdata/p4_16_samples_outputs/psa-dpdk-issue447-5-midend.p4 new file mode 100644 index 00000000000..9176c3fec2b --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-issue447-5-midend.p4 @@ -0,0 +1,104 @@ +error { + UnhandledIPv4Options, + BadIPv4HeaderChecksum +} +#include +#include + +header EMPTY_H { +} + +struct EMPTY_RESUB { +} + +struct EMPTY_CLONE { +} + +struct EMPTY_BRIDGE { +} + +struct EMPTY_RECIRC { +} + +header S { + bit<32> size; +} + +header H { + varbit<32> var; +} + +struct Parsed_packet { + S s1; + H h1; + H h2; +} + +struct Metadata { +} + +parser parserI(packet_in pkt, out Parsed_packet hdr, inout Metadata meta, in psa_ingress_parser_input_metadata_t x, in EMPTY_RESUB resub_meta, in EMPTY_RECIRC recirc_meta) { + state start { + pkt.extract(hdr.s1); + pkt.extract(hdr.h1, hdr.s1.size); + pkt.extract(hdr.h2, hdr.s1.size); + transition accept; + } +} + +parser egressParserImpl(packet_in buffer, out EMPTY_H a, inout Metadata b, in psa_egress_parser_input_metadata_t c, in EMPTY_BRIDGE d, in EMPTY_CLONE e, in EMPTY_CLONE f) { + state start { + transition accept; + } +} + +control DeparserI(packet_out packet, out EMPTY_CLONE clone_i2e_meta, out EMPTY_RESUB resubmit_meta, out EMPTY_BRIDGE normal_meta, inout Parsed_packet hdr, in Metadata local_metadata, in psa_ingress_output_metadata_t istd) { + @hidden action psadpdkissue4475l65() { + packet.emit(hdr.h1); + packet.emit(hdr.h2); + } + @hidden table tbl_psadpdkissue4475l65 { + actions = { + psadpdkissue4475l65(); + } + const default_action = psadpdkissue4475l65(); + } + apply { + tbl_psadpdkissue4475l65.apply(); + } +} + +control ingress(inout Parsed_packet hdr, inout Metadata meta, in psa_ingress_input_metadata_t istd, inout psa_ingress_output_metadata_t ostd) { + @name("ingress.s") varbit<32> s_0; + @hidden action psadpdkissue4475l75() { + s_0 = hdr.h1.var; + hdr.h1.var = hdr.h2.var; + hdr.h2.var = s_0; + } + @hidden table tbl_psadpdkissue4475l75 { + actions = { + psadpdkissue4475l75(); + } + const default_action = psadpdkissue4475l75(); + } + apply { + tbl_psadpdkissue4475l75.apply(); + } +} + +control egressControlImpl(inout EMPTY_H hdr, inout Metadata meta, in psa_egress_input_metadata_t x, inout psa_egress_output_metadata_t ostd) { + apply { + } +} + +control egressDeparserImpl(packet_out buffer, out EMPTY_CLONE a, out EMPTY_RECIRC b, inout EMPTY_H c, in Metadata d, in psa_egress_output_metadata_t e, in psa_egress_deparser_input_metadata_t f) { + apply { + } +} + +IngressPipeline(parserI(), ingress(), DeparserI()) ip; + +EgressPipeline(egressParserImpl(), egressControlImpl(), egressDeparserImpl()) ep; + +PSA_Switch(ip, PacketReplicationEngine(), ep, BufferingQueueingEngine()) main; + diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-issue447-5.p4 b/testdata/p4_16_samples_outputs/psa-dpdk-issue447-5.p4 new file mode 100644 index 00000000000..c50414cd4e1 --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-issue447-5.p4 @@ -0,0 +1,86 @@ +error { + UnhandledIPv4Options, + BadIPv4HeaderChecksum +} +#include +#include + +header EMPTY_H { +} + +struct EMPTY_RESUB { +} + +struct EMPTY_CLONE { +} + +struct EMPTY_BRIDGE { +} + +struct EMPTY_RECIRC { +} + +header S { + bit<32> size; +} + +header H { + varbit<32> var; +} + +struct Parsed_packet { + S s1; + H h1; + H h2; +} + +struct Metadata { +} + +parser parserI(packet_in pkt, out Parsed_packet hdr, inout Metadata meta, in psa_ingress_parser_input_metadata_t x, in EMPTY_RESUB resub_meta, in EMPTY_RECIRC recirc_meta) { + state start { + pkt.extract(hdr.s1); + pkt.extract(hdr.h1, hdr.s1.size); + pkt.extract(hdr.h2, hdr.s1.size); + transition accept; + } +} + +parser egressParserImpl(packet_in buffer, out EMPTY_H a, inout Metadata b, in psa_egress_parser_input_metadata_t c, in EMPTY_BRIDGE d, in EMPTY_CLONE e, in EMPTY_CLONE f) { + state start { + transition accept; + } +} + +control DeparserI(packet_out packet, out EMPTY_CLONE clone_i2e_meta, out EMPTY_RESUB resubmit_meta, out EMPTY_BRIDGE normal_meta, inout Parsed_packet hdr, in Metadata local_metadata, in psa_ingress_output_metadata_t istd) { + apply { + packet.emit(hdr.h1); + packet.emit(hdr.h2); + } +} + +control ingress(inout Parsed_packet hdr, inout Metadata meta, in psa_ingress_input_metadata_t istd, inout psa_ingress_output_metadata_t ostd) { + varbit<32> s; + apply { + s = hdr.h1.var; + hdr.h1.var = hdr.h2.var; + hdr.h2.var = s; + } +} + +control egressControlImpl(inout EMPTY_H hdr, inout Metadata meta, in psa_egress_input_metadata_t x, inout psa_egress_output_metadata_t ostd) { + apply { + } +} + +control egressDeparserImpl(packet_out buffer, out EMPTY_CLONE a, out EMPTY_RECIRC b, inout EMPTY_H c, in Metadata d, in psa_egress_output_metadata_t e, in psa_egress_deparser_input_metadata_t f) { + apply { + } +} + +IngressPipeline(parserI(), ingress(), DeparserI()) ip; + +EgressPipeline(egressParserImpl(), egressControlImpl(), egressDeparserImpl()) ep; + +PSA_Switch(ip, PacketReplicationEngine(), ep, BufferingQueueingEngine()) main; + diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-issue447-5.p4-stderr b/testdata/p4_16_samples_outputs/psa-dpdk-issue447-5.p4-stderr new file mode 100644 index 00000000000..e69de29bb2d diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-issue447-5.p4.entries.txt b/testdata/p4_16_samples_outputs/psa-dpdk-issue447-5.p4.entries.txt new file mode 100644 index 00000000000..e69de29bb2d diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-issue447-5.p4.p4info.txt b/testdata/p4_16_samples_outputs/psa-dpdk-issue447-5.p4.p4info.txt new file mode 100644 index 00000000000..77612386454 --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-issue447-5.p4.p4info.txt @@ -0,0 +1,3 @@ +pkg_info { + arch: "psa" +} diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-issue496-first.p4 b/testdata/p4_16_samples_outputs/psa-dpdk-issue496-first.p4 new file mode 100644 index 00000000000..f83cf493109 --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-issue496-first.p4 @@ -0,0 +1,82 @@ +#include +#include + +header EMPTY_H { +} + +struct EMPTY_RESUB { +} + +struct EMPTY_CLONE { +} + +struct EMPTY_BRIDGE { +} + +struct EMPTY_RECIRC { +} + +header h_t { + bit<8> f; +} + +struct my_packet { + h_t h; +} + +struct my_metadata { +} + +parser MyParser(packet_in b, out my_packet p, inout my_metadata m, in psa_ingress_parser_input_metadata_t x, in EMPTY_RESUB resub_meta, in EMPTY_RECIRC recirc_meta) { + state start { + transition accept; + } +} + +parser egressParserImpl(packet_in buffer, out EMPTY_H a, inout my_metadata b, in psa_egress_parser_input_metadata_t c, in EMPTY_BRIDGE d, in EMPTY_CLONE e, in EMPTY_CLONE f) { + state start { + transition accept; + } +} + +control E(); +control D() { + apply { + } +} + +control C()(E d) { + apply { + d.apply(); + } +} + +control MyIngress(inout my_packet p, inout my_metadata m, in psa_ingress_input_metadata_t istd, inout psa_ingress_output_metadata_t ostd) { + D() d; + C(d) c; + apply { + c.apply(); + } +} + +control egressControlImpl(inout EMPTY_H hdr, inout my_metadata meta, in psa_egress_input_metadata_t x, inout psa_egress_output_metadata_t ostd) { + apply { + } +} + +control MyDeparser(packet_out b, out EMPTY_CLONE clone_i2e_meta, out EMPTY_RESUB resubmit_meta, out EMPTY_BRIDGE normal_meta, inout my_packet hdr, in my_metadata local_metadata, in psa_ingress_output_metadata_t istd) { + apply { + } +} + +control egressDeparserImpl(packet_out buffer, out EMPTY_CLONE a, out EMPTY_RECIRC b, inout EMPTY_H c, in my_metadata d, in psa_egress_output_metadata_t e, in psa_egress_deparser_input_metadata_t f) { + apply { + } +} + +IngressPipeline(MyParser(), MyIngress(), MyDeparser()) ip; + +EgressPipeline(egressParserImpl(), egressControlImpl(), egressDeparserImpl()) ep; + +PSA_Switch(ip, PacketReplicationEngine(), ep, BufferingQueueingEngine()) main; + diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-issue496-frontend.p4 b/testdata/p4_16_samples_outputs/psa-dpdk-issue496-frontend.p4 new file mode 100644 index 00000000000..8dd32fa3c3e --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-issue496-frontend.p4 @@ -0,0 +1,67 @@ +#include +#include + +header EMPTY_H { +} + +struct EMPTY_RESUB { +} + +struct EMPTY_CLONE { +} + +struct EMPTY_BRIDGE { +} + +struct EMPTY_RECIRC { +} + +header h_t { + bit<8> f; +} + +struct my_packet { + h_t h; +} + +struct my_metadata { +} + +parser MyParser(packet_in b, out my_packet p, inout my_metadata m, in psa_ingress_parser_input_metadata_t x, in EMPTY_RESUB resub_meta, in EMPTY_RECIRC recirc_meta) { + state start { + transition accept; + } +} + +parser egressParserImpl(packet_in buffer, out EMPTY_H a, inout my_metadata b, in psa_egress_parser_input_metadata_t c, in EMPTY_BRIDGE d, in EMPTY_CLONE e, in EMPTY_CLONE f) { + state start { + transition accept; + } +} + +control MyIngress(inout my_packet p, inout my_metadata m, in psa_ingress_input_metadata_t istd, inout psa_ingress_output_metadata_t ostd) { + apply { + } +} + +control egressControlImpl(inout EMPTY_H hdr, inout my_metadata meta, in psa_egress_input_metadata_t x, inout psa_egress_output_metadata_t ostd) { + apply { + } +} + +control MyDeparser(packet_out b, out EMPTY_CLONE clone_i2e_meta, out EMPTY_RESUB resubmit_meta, out EMPTY_BRIDGE normal_meta, inout my_packet hdr, in my_metadata local_metadata, in psa_ingress_output_metadata_t istd) { + apply { + } +} + +control egressDeparserImpl(packet_out buffer, out EMPTY_CLONE a, out EMPTY_RECIRC b, inout EMPTY_H c, in my_metadata d, in psa_egress_output_metadata_t e, in psa_egress_deparser_input_metadata_t f) { + apply { + } +} + +IngressPipeline(MyParser(), MyIngress(), MyDeparser()) ip; + +EgressPipeline(egressParserImpl(), egressControlImpl(), egressDeparserImpl()) ep; + +PSA_Switch(ip, PacketReplicationEngine(), ep, BufferingQueueingEngine()) main; + diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-issue496-midend.p4 b/testdata/p4_16_samples_outputs/psa-dpdk-issue496-midend.p4 new file mode 100644 index 00000000000..8dd32fa3c3e --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-issue496-midend.p4 @@ -0,0 +1,67 @@ +#include +#include + +header EMPTY_H { +} + +struct EMPTY_RESUB { +} + +struct EMPTY_CLONE { +} + +struct EMPTY_BRIDGE { +} + +struct EMPTY_RECIRC { +} + +header h_t { + bit<8> f; +} + +struct my_packet { + h_t h; +} + +struct my_metadata { +} + +parser MyParser(packet_in b, out my_packet p, inout my_metadata m, in psa_ingress_parser_input_metadata_t x, in EMPTY_RESUB resub_meta, in EMPTY_RECIRC recirc_meta) { + state start { + transition accept; + } +} + +parser egressParserImpl(packet_in buffer, out EMPTY_H a, inout my_metadata b, in psa_egress_parser_input_metadata_t c, in EMPTY_BRIDGE d, in EMPTY_CLONE e, in EMPTY_CLONE f) { + state start { + transition accept; + } +} + +control MyIngress(inout my_packet p, inout my_metadata m, in psa_ingress_input_metadata_t istd, inout psa_ingress_output_metadata_t ostd) { + apply { + } +} + +control egressControlImpl(inout EMPTY_H hdr, inout my_metadata meta, in psa_egress_input_metadata_t x, inout psa_egress_output_metadata_t ostd) { + apply { + } +} + +control MyDeparser(packet_out b, out EMPTY_CLONE clone_i2e_meta, out EMPTY_RESUB resubmit_meta, out EMPTY_BRIDGE normal_meta, inout my_packet hdr, in my_metadata local_metadata, in psa_ingress_output_metadata_t istd) { + apply { + } +} + +control egressDeparserImpl(packet_out buffer, out EMPTY_CLONE a, out EMPTY_RECIRC b, inout EMPTY_H c, in my_metadata d, in psa_egress_output_metadata_t e, in psa_egress_deparser_input_metadata_t f) { + apply { + } +} + +IngressPipeline(MyParser(), MyIngress(), MyDeparser()) ip; + +EgressPipeline(egressParserImpl(), egressControlImpl(), egressDeparserImpl()) ep; + +PSA_Switch(ip, PacketReplicationEngine(), ep, BufferingQueueingEngine()) main; + diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-issue496.p4 b/testdata/p4_16_samples_outputs/psa-dpdk-issue496.p4 new file mode 100644 index 00000000000..2c9c7e746c7 --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-issue496.p4 @@ -0,0 +1,82 @@ +#include +#include + +header EMPTY_H { +} + +struct EMPTY_RESUB { +} + +struct EMPTY_CLONE { +} + +struct EMPTY_BRIDGE { +} + +struct EMPTY_RECIRC { +} + +header h_t { + bit<8> f; +} + +struct my_packet { + h_t h; +} + +struct my_metadata { +} + +parser MyParser(packet_in b, out my_packet p, inout my_metadata m, in psa_ingress_parser_input_metadata_t x, in EMPTY_RESUB resub_meta, in EMPTY_RECIRC recirc_meta) { + state start { + transition accept; + } +} + +parser egressParserImpl(packet_in buffer, out EMPTY_H a, inout my_metadata b, in psa_egress_parser_input_metadata_t c, in EMPTY_BRIDGE d, in EMPTY_CLONE e, in EMPTY_CLONE f) { + state start { + transition accept; + } +} + +control E(); +control D() { + apply { + } +} + +control C()(E d) { + apply { + d.apply(); + } +} + +control MyIngress(inout my_packet p, inout my_metadata m, in psa_ingress_input_metadata_t istd, inout psa_ingress_output_metadata_t ostd) { + D() d; + C(d) c; + apply { + c.apply(); + } +} + +control egressControlImpl(inout EMPTY_H hdr, inout my_metadata meta, in psa_egress_input_metadata_t x, inout psa_egress_output_metadata_t ostd) { + apply { + } +} + +control MyDeparser(packet_out b, out EMPTY_CLONE clone_i2e_meta, out EMPTY_RESUB resubmit_meta, out EMPTY_BRIDGE normal_meta, inout my_packet hdr, in my_metadata local_metadata, in psa_ingress_output_metadata_t istd) { + apply { + } +} + +control egressDeparserImpl(packet_out buffer, out EMPTY_CLONE a, out EMPTY_RECIRC b, inout EMPTY_H c, in my_metadata d, in psa_egress_output_metadata_t e, in psa_egress_deparser_input_metadata_t f) { + apply { + } +} + +IngressPipeline(MyParser(), MyIngress(), MyDeparser()) ip; + +EgressPipeline(egressParserImpl(), egressControlImpl(), egressDeparserImpl()) ep; + +PSA_Switch(ip, PacketReplicationEngine(), ep, BufferingQueueingEngine()) main; + diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-issue496.p4-error b/testdata/p4_16_samples_outputs/psa-dpdk-issue496.p4-error new file mode 100644 index 00000000000..e69de29bb2d diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-issue496.p4-stderr b/testdata/p4_16_samples_outputs/psa-dpdk-issue496.p4-stderr new file mode 100644 index 00000000000..e69de29bb2d diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-issue496.p4.bfrt.json b/testdata/p4_16_samples_outputs/psa-dpdk-issue496.p4.bfrt.json new file mode 100644 index 00000000000..b6d66a630db --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-issue496.p4.bfrt.json @@ -0,0 +1,5 @@ +{ + "schema_version" : "1.0.0", + "tables" : [], + "learn_filters" : [] +} \ No newline at end of file diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-issue496.p4.entries.txt b/testdata/p4_16_samples_outputs/psa-dpdk-issue496.p4.entries.txt new file mode 100644 index 00000000000..e69de29bb2d diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-issue496.p4.p4info.txt b/testdata/p4_16_samples_outputs/psa-dpdk-issue496.p4.p4info.txt new file mode 100644 index 00000000000..77612386454 --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-issue496.p4.p4info.txt @@ -0,0 +1,3 @@ +pkg_info { + arch: "psa" +} diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-issue496.p4.spec b/testdata/p4_16_samples_outputs/psa-dpdk-issue496.p4.spec new file mode 100644 index 00000000000..15a74730c01 --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-issue496.p4.spec @@ -0,0 +1,43 @@ + +struct h_t { + bit<8> f +} + +struct psa_ingress_output_metadata_t { + bit<8> class_of_service + bit<8> clone + bit<16> clone_session_id + bit<8> drop + bit<8> resubmit + bit<32> multicast_group + bit<32> egress_port +} + +struct psa_egress_output_metadata_t { + bit<8> clone + bit<16> clone_session_id + bit<8> drop +} + +struct psa_egress_deparser_input_metadata_t { + bit<32> egress_port +} + +header h instanceof h_t + +struct my_metadata { + bit<32> psa_ingress_input_metadata_ingress_port + bit<8> psa_ingress_output_metadata_drop + bit<32> psa_ingress_output_metadata_egress_port +} +metadata instanceof my_metadata + +apply { + rx m.psa_ingress_input_metadata_ingress_port + mov m.psa_ingress_output_metadata_drop 0x0 + jmpneq LABEL_DROP m.psa_ingress_output_metadata_drop 0x0 + tx m.psa_ingress_output_metadata_egress_port + LABEL_DROP : drop +} + + diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-issue949-first.p4 b/testdata/p4_16_samples_outputs/psa-dpdk-issue949-first.p4 new file mode 100644 index 00000000000..36ca7220cbf --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-issue949-first.p4 @@ -0,0 +1,105 @@ +#include +#include + +header EMPTY_H { +} + +struct EMPTY_RESUB { +} + +struct EMPTY_CLONE { +} + +struct EMPTY_BRIDGE { +} + +struct EMPTY_RECIRC { +} + +struct routing_metadata_t { + bit<32> nhop_ipv4; +} + +header ethernet_t { + bit<48> dstAddr; + bit<48> srcAddr; + bit<16> etherType; +} + +header ipv4_t { + bit<4> version; + bit<4> ihl; + bit<8> diffserv; +} + +struct metadata { + routing_metadata_t routing_metadata; +} + +struct headers { + ethernet_t ethernet; + ipv4_t ipv4; +} + +parser ParserImpl(packet_in packet, out headers hdr, inout metadata meta, in psa_ingress_parser_input_metadata_t x, in EMPTY_RESUB resub_meta, in EMPTY_RECIRC recirc_meta) { + state start { + packet.extract(hdr.ethernet); + transition select(hdr.ethernet.etherType) { + 16w0x800: parse_ipv4; + default: accept; + } + } + state parse_ipv4 { + packet.extract(hdr.ipv4); + transition accept; + } +} + +parser egressParserImpl(packet_in buffer, out EMPTY_H a, inout metadata b, in psa_egress_parser_input_metadata_t c, in EMPTY_BRIDGE d, in EMPTY_CLONE e, in EMPTY_CLONE f) { + state start { + transition accept; + } +} + +control ingress(inout headers hdr, inout metadata meta, in psa_ingress_input_metadata_t istd, inout psa_ingress_output_metadata_t ostd) { + action setDest() { + hdr.ethernet.dstAddr = 48w0x6af3400426d3; + } + table someTable { + key = { + hdr.ethernet.srcAddr: exact @name("hdr.ethernet.srcAddr") ; + } + actions = { + setDest(); + @defaultonly NoAction(); + } + default_action = NoAction(); + } + apply { + bool didHit = someTable.apply().hit; + } +} + +control egressControlImpl(inout EMPTY_H hdr, inout metadata meta, in psa_egress_input_metadata_t x, inout psa_egress_output_metadata_t ostd) { + apply { + } +} + +control DeparserImpl(packet_out packet, out EMPTY_CLONE clone_i2e_meta, out EMPTY_RESUB resubmit_meta, out EMPTY_BRIDGE normal_meta, inout headers hdr, in metadata local_metadata, in psa_ingress_output_metadata_t istd) { + apply { + packet.emit(hdr.ethernet); + packet.emit(hdr.ipv4); + } +} + +control egressDeparserImpl(packet_out buffer, out EMPTY_CLONE a, out EMPTY_RECIRC b, inout EMPTY_H c, in metadata d, in psa_egress_output_metadata_t e, in psa_egress_deparser_input_metadata_t f) { + apply { + } +} + +IngressPipeline(ParserImpl(), ingress(), DeparserImpl()) ip; + +EgressPipeline(egressParserImpl(), egressControlImpl(), egressDeparserImpl()) ep; + +PSA_Switch(ip, PacketReplicationEngine(), ep, BufferingQueueingEngine()) main; + diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-issue949-frontend.p4 b/testdata/p4_16_samples_outputs/psa-dpdk-issue949-frontend.p4 new file mode 100644 index 00000000000..4110c72728d --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-issue949-frontend.p4 @@ -0,0 +1,107 @@ +#include +#include + +header EMPTY_H { +} + +struct EMPTY_RESUB { +} + +struct EMPTY_CLONE { +} + +struct EMPTY_BRIDGE { +} + +struct EMPTY_RECIRC { +} + +struct routing_metadata_t { + bit<32> nhop_ipv4; +} + +header ethernet_t { + bit<48> dstAddr; + bit<48> srcAddr; + bit<16> etherType; +} + +header ipv4_t { + bit<4> version; + bit<4> ihl; + bit<8> diffserv; +} + +struct metadata { + routing_metadata_t routing_metadata; +} + +struct headers { + ethernet_t ethernet; + ipv4_t ipv4; +} + +parser ParserImpl(packet_in packet, out headers hdr, inout metadata meta, in psa_ingress_parser_input_metadata_t x, in EMPTY_RESUB resub_meta, in EMPTY_RECIRC recirc_meta) { + state start { + packet.extract(hdr.ethernet); + transition select(hdr.ethernet.etherType) { + 16w0x800: parse_ipv4; + default: accept; + } + } + state parse_ipv4 { + packet.extract(hdr.ipv4); + transition accept; + } +} + +parser egressParserImpl(packet_in buffer, out EMPTY_H a, inout metadata b, in psa_egress_parser_input_metadata_t c, in EMPTY_BRIDGE d, in EMPTY_CLONE e, in EMPTY_CLONE f) { + state start { + transition accept; + } +} + +control ingress(inout headers hdr, inout metadata meta, in psa_ingress_input_metadata_t istd, inout psa_ingress_output_metadata_t ostd) { + @noWarn("unused") @name(".NoAction") action NoAction_1() { + } + @name("ingress.setDest") action setDest() { + hdr.ethernet.dstAddr = 48w0x6af3400426d3; + } + @name("ingress.someTable") table someTable_0 { + key = { + hdr.ethernet.srcAddr: exact @name("hdr.ethernet.srcAddr") ; + } + actions = { + setDest(); + @defaultonly NoAction_1(); + } + default_action = NoAction_1(); + } + apply { + someTable_0.apply(); + } +} + +control egressControlImpl(inout EMPTY_H hdr, inout metadata meta, in psa_egress_input_metadata_t x, inout psa_egress_output_metadata_t ostd) { + apply { + } +} + +control DeparserImpl(packet_out packet, out EMPTY_CLONE clone_i2e_meta, out EMPTY_RESUB resubmit_meta, out EMPTY_BRIDGE normal_meta, inout headers hdr, in metadata local_metadata, in psa_ingress_output_metadata_t istd) { + apply { + packet.emit(hdr.ethernet); + packet.emit(hdr.ipv4); + } +} + +control egressDeparserImpl(packet_out buffer, out EMPTY_CLONE a, out EMPTY_RECIRC b, inout EMPTY_H c, in metadata d, in psa_egress_output_metadata_t e, in psa_egress_deparser_input_metadata_t f) { + apply { + } +} + +IngressPipeline(ParserImpl(), ingress(), DeparserImpl()) ip; + +EgressPipeline(egressParserImpl(), egressControlImpl(), egressDeparserImpl()) ep; + +PSA_Switch(ip, PacketReplicationEngine(), ep, BufferingQueueingEngine()) main; + diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-issue949-midend.p4 b/testdata/p4_16_samples_outputs/psa-dpdk-issue949-midend.p4 new file mode 100644 index 00000000000..e64f63237ec --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-issue949-midend.p4 @@ -0,0 +1,116 @@ +#include +#include + +header EMPTY_H { +} + +struct EMPTY_RESUB { +} + +struct EMPTY_CLONE { +} + +struct EMPTY_BRIDGE { +} + +struct EMPTY_RECIRC { +} + +struct routing_metadata_t { + bit<32> nhop_ipv4; +} + +header ethernet_t { + bit<48> dstAddr; + bit<48> srcAddr; + bit<16> etherType; +} + +header ipv4_t { + bit<4> version; + bit<4> ihl; + bit<8> diffserv; +} + +struct metadata { + bit<32> _routing_metadata_nhop_ipv40; +} + +struct headers { + ethernet_t ethernet; + ipv4_t ipv4; +} + +parser ParserImpl(packet_in packet, out headers hdr, inout metadata meta, in psa_ingress_parser_input_metadata_t x, in EMPTY_RESUB resub_meta, in EMPTY_RECIRC recirc_meta) { + state start { + packet.extract(hdr.ethernet); + transition select(hdr.ethernet.etherType) { + 16w0x800: parse_ipv4; + default: accept; + } + } + state parse_ipv4 { + packet.extract(hdr.ipv4); + transition accept; + } +} + +parser egressParserImpl(packet_in buffer, out EMPTY_H a, inout metadata b, in psa_egress_parser_input_metadata_t c, in EMPTY_BRIDGE d, in EMPTY_CLONE e, in EMPTY_CLONE f) { + state start { + transition accept; + } +} + +control ingress(inout headers hdr, inout metadata meta, in psa_ingress_input_metadata_t istd, inout psa_ingress_output_metadata_t ostd) { + @noWarn("unused") @name(".NoAction") action NoAction_1() { + } + @name("ingress.setDest") action setDest() { + hdr.ethernet.dstAddr = 48w0x6af3400426d3; + } + @name("ingress.someTable") table someTable_0 { + key = { + hdr.ethernet.srcAddr: exact @name("hdr.ethernet.srcAddr") ; + } + actions = { + setDest(); + @defaultonly NoAction_1(); + } + default_action = NoAction_1(); + } + apply { + someTable_0.apply(); + } +} + +control egressControlImpl(inout EMPTY_H hdr, inout metadata meta, in psa_egress_input_metadata_t x, inout psa_egress_output_metadata_t ostd) { + apply { + } +} + +control DeparserImpl(packet_out packet, out EMPTY_CLONE clone_i2e_meta, out EMPTY_RESUB resubmit_meta, out EMPTY_BRIDGE normal_meta, inout headers hdr, in metadata local_metadata, in psa_ingress_output_metadata_t istd) { + @hidden action psadpdkissue949l108() { + packet.emit(hdr.ethernet); + packet.emit(hdr.ipv4); + } + @hidden table tbl_psadpdkissue949l108 { + actions = { + psadpdkissue949l108(); + } + const default_action = psadpdkissue949l108(); + } + apply { + tbl_psadpdkissue949l108.apply(); + } +} + +control egressDeparserImpl(packet_out buffer, out EMPTY_CLONE a, out EMPTY_RECIRC b, inout EMPTY_H c, in metadata d, in psa_egress_output_metadata_t e, in psa_egress_deparser_input_metadata_t f) { + apply { + } +} + +IngressPipeline(ParserImpl(), ingress(), DeparserImpl()) ip; + +EgressPipeline(egressParserImpl(), egressControlImpl(), egressDeparserImpl()) ep; + +PSA_Switch(ip, PacketReplicationEngine(), ep, BufferingQueueingEngine()) main; + diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-issue949.p4 b/testdata/p4_16_samples_outputs/psa-dpdk-issue949.p4 new file mode 100644 index 00000000000..8b49c41c5ef --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-issue949.p4 @@ -0,0 +1,103 @@ +#include +#include + +header EMPTY_H { +} + +struct EMPTY_RESUB { +} + +struct EMPTY_CLONE { +} + +struct EMPTY_BRIDGE { +} + +struct EMPTY_RECIRC { +} + +struct routing_metadata_t { + bit<32> nhop_ipv4; +} + +header ethernet_t { + bit<48> dstAddr; + bit<48> srcAddr; + bit<16> etherType; +} + +header ipv4_t { + bit<4> version; + bit<4> ihl; + bit<8> diffserv; +} + +struct metadata { + routing_metadata_t routing_metadata; +} + +struct headers { + ethernet_t ethernet; + ipv4_t ipv4; +} + +parser ParserImpl(packet_in packet, out headers hdr, inout metadata meta, in psa_ingress_parser_input_metadata_t x, in EMPTY_RESUB resub_meta, in EMPTY_RECIRC recirc_meta) { + state start { + packet.extract(hdr.ethernet); + transition select(hdr.ethernet.etherType) { + 16w0x800: parse_ipv4; + default: accept; + } + } + state parse_ipv4 { + packet.extract(hdr.ipv4); + transition accept; + } +} + +parser egressParserImpl(packet_in buffer, out EMPTY_H a, inout metadata b, in psa_egress_parser_input_metadata_t c, in EMPTY_BRIDGE d, in EMPTY_CLONE e, in EMPTY_CLONE f) { + state start { + transition accept; + } +} + +control ingress(inout headers hdr, inout metadata meta, in psa_ingress_input_metadata_t istd, inout psa_ingress_output_metadata_t ostd) { + action setDest() { + hdr.ethernet.dstAddr = 48w0x6af3400426d3; + } + table someTable { + key = { + hdr.ethernet.srcAddr: exact; + } + actions = { + setDest; + } + } + apply { + bool didHit = someTable.apply().hit; + } +} + +control egressControlImpl(inout EMPTY_H hdr, inout metadata meta, in psa_egress_input_metadata_t x, inout psa_egress_output_metadata_t ostd) { + apply { + } +} + +control DeparserImpl(packet_out packet, out EMPTY_CLONE clone_i2e_meta, out EMPTY_RESUB resubmit_meta, out EMPTY_BRIDGE normal_meta, inout headers hdr, in metadata local_metadata, in psa_ingress_output_metadata_t istd) { + apply { + packet.emit(hdr.ethernet); + packet.emit(hdr.ipv4); + } +} + +control egressDeparserImpl(packet_out buffer, out EMPTY_CLONE a, out EMPTY_RECIRC b, inout EMPTY_H c, in metadata d, in psa_egress_output_metadata_t e, in psa_egress_deparser_input_metadata_t f) { + apply { + } +} + +IngressPipeline(ParserImpl(), ingress(), DeparserImpl()) ip; + +EgressPipeline(egressParserImpl(), egressControlImpl(), egressDeparserImpl()) ep; + +PSA_Switch(ip, PacketReplicationEngine(), ep, BufferingQueueingEngine()) main; + diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-issue949.p4-error b/testdata/p4_16_samples_outputs/psa-dpdk-issue949.p4-error new file mode 100644 index 00000000000..e69de29bb2d diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-issue949.p4-stderr b/testdata/p4_16_samples_outputs/psa-dpdk-issue949.p4-stderr new file mode 100644 index 00000000000..e69de29bb2d diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-issue949.p4.bfrt.json b/testdata/p4_16_samples_outputs/psa-dpdk-issue949.p4.bfrt.json new file mode 100644 index 00000000000..895f0d6da65 --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-issue949.p4.bfrt.json @@ -0,0 +1,52 @@ +{ + "schema_version" : "1.0.0", + "tables" : [ + { + "name" : "ip.ingress.someTable", + "id" : 44851186, + "table_type" : "MatchAction_Direct", + "size" : 1024, + "annotations" : [], + "depends_on" : [], + "has_const_default_action" : false, + "key" : [ + { + "id" : 1, + "name" : "hdr.ethernet.srcAddr", + "repeated" : false, + "annotations" : [], + "mandatory" : false, + "match_type" : "Exact", + "type" : { + "type" : "bytes", + "width" : 48 + } + } + ], + "action_specs" : [ + { + "id" : 29955570, + "name" : "ingress.setDest", + "action_scope" : "TableAndDefault", + "annotations" : [], + "data" : [] + }, + { + "id" : 21257015, + "name" : "NoAction", + "action_scope" : "DefaultOnly", + "annotations" : [ + { + "name" : "@defaultonly" + } + ], + "data" : [] + } + ], + "data" : [], + "supported_operations" : [], + "attributes" : ["EntryScope"] + } + ], + "learn_filters" : [] +} \ No newline at end of file diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-issue949.p4.entries.txt b/testdata/p4_16_samples_outputs/psa-dpdk-issue949.p4.entries.txt new file mode 100644 index 00000000000..e69de29bb2d diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-issue949.p4.p4info.txt b/testdata/p4_16_samples_outputs/psa-dpdk-issue949.p4.p4info.txt new file mode 100644 index 00000000000..559b7ddaaff --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-issue949.p4.p4info.txt @@ -0,0 +1,42 @@ +pkg_info { + arch: "psa" +} +tables { + preamble { + id: 44851186 + name: "ingress.someTable" + alias: "someTable" + } + match_fields { + id: 1 + name: "hdr.ethernet.srcAddr" + bitwidth: 48 + match_type: EXACT + } + action_refs { + id: 29955570 + } + action_refs { + id: 21257015 + annotations: "@defaultonly" + scope: DEFAULT_ONLY + } + size: 1024 +} +actions { + preamble { + id: 21257015 + name: "NoAction" + alias: "NoAction" + annotations: "@noWarn(\"unused\")" + } +} +actions { + preamble { + id: 29955570 + name: "ingress.setDest" + alias: "setDest" + } +} +type_info { +} diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-issue949.p4.spec b/testdata/p4_16_samples_outputs/psa-dpdk-issue949.p4.spec new file mode 100644 index 00000000000..d12e0743444 --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-issue949.p4.spec @@ -0,0 +1,80 @@ + +struct ethernet_t { + bit<48> dstAddr + bit<48> srcAddr + bit<16> etherType +} + +struct ipv4_t { + bit<8> version_ihl + bit<8> diffserv +} + +struct psa_ingress_output_metadata_t { + bit<8> class_of_service + bit<8> clone + bit<16> clone_session_id + bit<8> drop + bit<8> resubmit + bit<32> multicast_group + bit<32> egress_port +} + +struct psa_egress_output_metadata_t { + bit<8> clone + bit<16> clone_session_id + bit<8> drop +} + +struct psa_egress_deparser_input_metadata_t { + bit<32> egress_port +} + +struct metadata { + bit<32> psa_ingress_input_metadata_ingress_port + bit<8> psa_ingress_output_metadata_drop + bit<32> psa_ingress_output_metadata_egress_port +} +metadata instanceof metadata + +header ethernet instanceof ethernet_t +header ipv4 instanceof ipv4_t + +action NoAction args none { + return +} + +action setDest args none { + mov h.ethernet.dstAddr 0x6af3400426d3 + return +} + +table someTable { + key { + h.ethernet.srcAddr exact + } + actions { + setDest + NoAction + } + default_action NoAction args none + size 0x10000 +} + + +apply { + rx m.psa_ingress_input_metadata_ingress_port + mov m.psa_ingress_output_metadata_drop 0x0 + extract h.ethernet + jmpeq PARSERIMPL_PARSE_IPV4 h.ethernet.etherType 0x800 + jmp PARSERIMPL_ACCEPT + PARSERIMPL_PARSE_IPV4 : extract h.ipv4 + PARSERIMPL_ACCEPT : table someTable + jmpneq LABEL_DROP m.psa_ingress_output_metadata_drop 0x0 + emit h.ethernet + emit h.ipv4 + tx m.psa_ingress_output_metadata_egress_port + LABEL_DROP : drop +} + + diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-issue955-first.p4 b/testdata/p4_16_samples_outputs/psa-dpdk-issue955-first.p4 new file mode 100644 index 00000000000..d09b8cd1878 --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-issue955-first.p4 @@ -0,0 +1,71 @@ +#include +#include + +header EMPTY_H { +} + +struct EMPTY_RESUB { +} + +struct EMPTY_CLONE { +} + +struct EMPTY_BRIDGE { +} + +struct EMPTY_RECIRC { +} + +header Header { + bit<32> data; +} + +struct H { + Header h; +} + +struct M { + bit<32> hash1; +} + +parser ParserI(packet_in pk, out H hdr, inout M meta, in psa_ingress_parser_input_metadata_t x, in EMPTY_RESUB resub_meta, in EMPTY_RECIRC recirc_meta) { + state start { + transition accept; + } +} + +action empty() { +} +parser egressParserImpl(packet_in buffer, out EMPTY_H a, inout M b, in psa_egress_parser_input_metadata_t c, in EMPTY_BRIDGE d, in EMPTY_CLONE e, in EMPTY_CLONE f) { + state start { + transition accept; + } +} + +control IngressI(inout H hdr, inout M meta, in psa_ingress_input_metadata_t istd, inout psa_ingress_output_metadata_t ostd) { + apply { + bool b = hdr.h.isValid(); + } +} + +control egressControlImpl(inout EMPTY_H hdr, inout M meta, in psa_egress_input_metadata_t x, inout psa_egress_output_metadata_t ostd) { + apply { + } +} + +control DeparserI(packet_out pk, out EMPTY_CLONE clone_i2e_meta, out EMPTY_RESUB resubmit_meta, out EMPTY_BRIDGE normal_meta, inout H hdr, in M local_metadata, in psa_ingress_output_metadata_t istd) { + apply { + } +} + +control egressDeparserImpl(packet_out buffer, out EMPTY_CLONE a, out EMPTY_RECIRC b, inout EMPTY_H c, in M d, in psa_egress_output_metadata_t e, in psa_egress_deparser_input_metadata_t f) { + apply { + } +} + +IngressPipeline(ParserI(), IngressI(), DeparserI()) ip; + +EgressPipeline(egressParserImpl(), egressControlImpl(), egressDeparserImpl()) ep; + +PSA_Switch(ip, PacketReplicationEngine(), ep, BufferingQueueingEngine()) main; + diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-issue955-frontend.p4 b/testdata/p4_16_samples_outputs/psa-dpdk-issue955-frontend.p4 new file mode 100644 index 00000000000..85617bd5ca9 --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-issue955-frontend.p4 @@ -0,0 +1,68 @@ +#include +#include + +header EMPTY_H { +} + +struct EMPTY_RESUB { +} + +struct EMPTY_CLONE { +} + +struct EMPTY_BRIDGE { +} + +struct EMPTY_RECIRC { +} + +header Header { + bit<32> data; +} + +struct H { + Header h; +} + +struct M { + bit<32> hash1; +} + +parser ParserI(packet_in pk, out H hdr, inout M meta, in psa_ingress_parser_input_metadata_t x, in EMPTY_RESUB resub_meta, in EMPTY_RECIRC recirc_meta) { + state start { + transition accept; + } +} + +parser egressParserImpl(packet_in buffer, out EMPTY_H a, inout M b, in psa_egress_parser_input_metadata_t c, in EMPTY_BRIDGE d, in EMPTY_CLONE e, in EMPTY_CLONE f) { + state start { + transition accept; + } +} + +control IngressI(inout H hdr, inout M meta, in psa_ingress_input_metadata_t istd, inout psa_ingress_output_metadata_t ostd) { + apply { + } +} + +control egressControlImpl(inout EMPTY_H hdr, inout M meta, in psa_egress_input_metadata_t x, inout psa_egress_output_metadata_t ostd) { + apply { + } +} + +control DeparserI(packet_out pk, out EMPTY_CLONE clone_i2e_meta, out EMPTY_RESUB resubmit_meta, out EMPTY_BRIDGE normal_meta, inout H hdr, in M local_metadata, in psa_ingress_output_metadata_t istd) { + apply { + } +} + +control egressDeparserImpl(packet_out buffer, out EMPTY_CLONE a, out EMPTY_RECIRC b, inout EMPTY_H c, in M d, in psa_egress_output_metadata_t e, in psa_egress_deparser_input_metadata_t f) { + apply { + } +} + +IngressPipeline(ParserI(), IngressI(), DeparserI()) ip; + +EgressPipeline(egressParserImpl(), egressControlImpl(), egressDeparserImpl()) ep; + +PSA_Switch(ip, PacketReplicationEngine(), ep, BufferingQueueingEngine()) main; + diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-issue955-midend.p4 b/testdata/p4_16_samples_outputs/psa-dpdk-issue955-midend.p4 new file mode 100644 index 00000000000..85617bd5ca9 --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-issue955-midend.p4 @@ -0,0 +1,68 @@ +#include +#include + +header EMPTY_H { +} + +struct EMPTY_RESUB { +} + +struct EMPTY_CLONE { +} + +struct EMPTY_BRIDGE { +} + +struct EMPTY_RECIRC { +} + +header Header { + bit<32> data; +} + +struct H { + Header h; +} + +struct M { + bit<32> hash1; +} + +parser ParserI(packet_in pk, out H hdr, inout M meta, in psa_ingress_parser_input_metadata_t x, in EMPTY_RESUB resub_meta, in EMPTY_RECIRC recirc_meta) { + state start { + transition accept; + } +} + +parser egressParserImpl(packet_in buffer, out EMPTY_H a, inout M b, in psa_egress_parser_input_metadata_t c, in EMPTY_BRIDGE d, in EMPTY_CLONE e, in EMPTY_CLONE f) { + state start { + transition accept; + } +} + +control IngressI(inout H hdr, inout M meta, in psa_ingress_input_metadata_t istd, inout psa_ingress_output_metadata_t ostd) { + apply { + } +} + +control egressControlImpl(inout EMPTY_H hdr, inout M meta, in psa_egress_input_metadata_t x, inout psa_egress_output_metadata_t ostd) { + apply { + } +} + +control DeparserI(packet_out pk, out EMPTY_CLONE clone_i2e_meta, out EMPTY_RESUB resubmit_meta, out EMPTY_BRIDGE normal_meta, inout H hdr, in M local_metadata, in psa_ingress_output_metadata_t istd) { + apply { + } +} + +control egressDeparserImpl(packet_out buffer, out EMPTY_CLONE a, out EMPTY_RECIRC b, inout EMPTY_H c, in M d, in psa_egress_output_metadata_t e, in psa_egress_deparser_input_metadata_t f) { + apply { + } +} + +IngressPipeline(ParserI(), IngressI(), DeparserI()) ip; + +EgressPipeline(egressParserImpl(), egressControlImpl(), egressDeparserImpl()) ep; + +PSA_Switch(ip, PacketReplicationEngine(), ep, BufferingQueueingEngine()) main; + diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-issue955.p4 b/testdata/p4_16_samples_outputs/psa-dpdk-issue955.p4 new file mode 100644 index 00000000000..77cbe280ad8 --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-issue955.p4 @@ -0,0 +1,71 @@ +#include +#include + +header EMPTY_H { +} + +struct EMPTY_RESUB { +} + +struct EMPTY_CLONE { +} + +struct EMPTY_BRIDGE { +} + +struct EMPTY_RECIRC { +} + +header Header { + bit<32> data; +} + +struct H { + Header h; +} + +struct M { + bit<32> hash1; +} + +parser ParserI(packet_in pk, out H hdr, inout M meta, in psa_ingress_parser_input_metadata_t x, in EMPTY_RESUB resub_meta, in EMPTY_RECIRC recirc_meta) { + state start { + transition accept; + } +} + +action empty() { +} +parser egressParserImpl(packet_in buffer, out EMPTY_H a, inout M b, in psa_egress_parser_input_metadata_t c, in EMPTY_BRIDGE d, in EMPTY_CLONE e, in EMPTY_CLONE f) { + state start { + transition accept; + } +} + +control IngressI(inout H hdr, inout M meta, in psa_ingress_input_metadata_t istd, inout psa_ingress_output_metadata_t ostd) { + apply { + bool b = hdr.h.isValid(); + } +} + +control egressControlImpl(inout EMPTY_H hdr, inout M meta, in psa_egress_input_metadata_t x, inout psa_egress_output_metadata_t ostd) { + apply { + } +} + +control DeparserI(packet_out pk, out EMPTY_CLONE clone_i2e_meta, out EMPTY_RESUB resubmit_meta, out EMPTY_BRIDGE normal_meta, inout H hdr, in M local_metadata, in psa_ingress_output_metadata_t istd) { + apply { + } +} + +control egressDeparserImpl(packet_out buffer, out EMPTY_CLONE a, out EMPTY_RECIRC b, inout EMPTY_H c, in M d, in psa_egress_output_metadata_t e, in psa_egress_deparser_input_metadata_t f) { + apply { + } +} + +IngressPipeline(ParserI(), IngressI(), DeparserI()) ip; + +EgressPipeline(egressParserImpl(), egressControlImpl(), egressDeparserImpl()) ep; + +PSA_Switch(ip, PacketReplicationEngine(), ep, BufferingQueueingEngine()) main; + diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-issue955.p4-error b/testdata/p4_16_samples_outputs/psa-dpdk-issue955.p4-error new file mode 100644 index 00000000000..e69de29bb2d diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-issue955.p4-stderr b/testdata/p4_16_samples_outputs/psa-dpdk-issue955.p4-stderr new file mode 100644 index 00000000000..e69de29bb2d diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-issue955.p4.bfrt.json b/testdata/p4_16_samples_outputs/psa-dpdk-issue955.p4.bfrt.json new file mode 100644 index 00000000000..b6d66a630db --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-issue955.p4.bfrt.json @@ -0,0 +1,5 @@ +{ + "schema_version" : "1.0.0", + "tables" : [], + "learn_filters" : [] +} \ No newline at end of file diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-issue955.p4.entries.txt b/testdata/p4_16_samples_outputs/psa-dpdk-issue955.p4.entries.txt new file mode 100644 index 00000000000..e69de29bb2d diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-issue955.p4.p4info.txt b/testdata/p4_16_samples_outputs/psa-dpdk-issue955.p4.p4info.txt new file mode 100644 index 00000000000..77612386454 --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-issue955.p4.p4info.txt @@ -0,0 +1,3 @@ +pkg_info { + arch: "psa" +} diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-issue955.p4.spec b/testdata/p4_16_samples_outputs/psa-dpdk-issue955.p4.spec new file mode 100644 index 00000000000..e94926bd743 --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-issue955.p4.spec @@ -0,0 +1,43 @@ + +struct Header { + bit<32> data +} + +struct psa_ingress_output_metadata_t { + bit<8> class_of_service + bit<8> clone + bit<16> clone_session_id + bit<8> drop + bit<8> resubmit + bit<32> multicast_group + bit<32> egress_port +} + +struct psa_egress_output_metadata_t { + bit<8> clone + bit<16> clone_session_id + bit<8> drop +} + +struct psa_egress_deparser_input_metadata_t { + bit<32> egress_port +} + +header h instanceof Header + +struct M { + bit<32> psa_ingress_input_metadata_ingress_port + bit<8> psa_ingress_output_metadata_drop + bit<32> psa_ingress_output_metadata_egress_port +} +metadata instanceof M + +apply { + rx m.psa_ingress_input_metadata_ingress_port + mov m.psa_ingress_output_metadata_drop 0x0 + jmpneq LABEL_DROP m.psa_ingress_output_metadata_drop 0x0 + tx m.psa_ingress_output_metadata_egress_port + LABEL_DROP : drop +} + + diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-issue983-bmv2.p4-error b/testdata/p4_16_samples_outputs/psa-dpdk-issue983-bmv2.p4-error new file mode 100644 index 00000000000..f982acfa81b --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-issue983-bmv2.p4-error @@ -0,0 +1 @@ +[--Wwarn=mismatch] warning: Mismatched header/metadata struct for key elements in table debug_table_cksum1. Copying all match fields to metadata diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-issue983-bmv2.p4.bfrt.json b/testdata/p4_16_samples_outputs/psa-dpdk-issue983-bmv2.p4.bfrt.json new file mode 100644 index 00000000000..7e6434ae99f --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-issue983-bmv2.p4.bfrt.json @@ -0,0 +1,185 @@ +{ + "schema_version" : "1.0.0", + "tables" : [ + { + "name" : "ip.ingress.debug_table_cksum1", + "id" : 48768774, + "table_type" : "MatchAction_Direct", + "size" : 1024, + "annotations" : [], + "depends_on" : [], + "has_const_default_action" : false, + "key" : [ + { + "id" : 1, + "name" : "hdr.ethernet.srcAddr", + "repeated" : false, + "annotations" : [], + "mandatory" : false, + "match_type" : "Exact", + "type" : { + "type" : "bytes", + "width" : 48 + } + }, + { + "id" : 2, + "name" : "hdr.ethernet.dstAddr", + "repeated" : false, + "annotations" : [], + "mandatory" : false, + "match_type" : "Exact", + "type" : { + "type" : "bytes", + "width" : 48 + } + }, + { + "id" : 3, + "name" : "hdr.ethernet.etherType", + "repeated" : false, + "annotations" : [], + "mandatory" : false, + "match_type" : "Exact", + "type" : { + "type" : "bytes", + "width" : 16 + } + }, + { + "id" : 4, + "name" : "user_meta.fwd_meta.exp_etherType", + "repeated" : false, + "annotations" : [], + "mandatory" : false, + "match_type" : "Exact", + "type" : { + "type" : "bytes", + "width" : 16 + } + }, + { + "id" : 5, + "name" : "user_meta.fwd_meta.tmp", + "repeated" : false, + "annotations" : [], + "mandatory" : false, + "match_type" : "Exact", + "type" : { + "type" : "bytes", + "width" : 16 + } + }, + { + "id" : 6, + "name" : "user_meta.fwd_meta.exp_x1", + "repeated" : false, + "annotations" : [], + "mandatory" : false, + "match_type" : "Exact", + "type" : { + "type" : "bytes", + "width" : 32 + } + }, + { + "id" : 7, + "name" : "user_meta.fwd_meta.x1", + "repeated" : false, + "annotations" : [], + "mandatory" : false, + "match_type" : "Exact", + "type" : { + "type" : "bytes", + "width" : 32 + } + }, + { + "id" : 8, + "name" : "user_meta.fwd_meta.exp_x2", + "repeated" : false, + "annotations" : [], + "mandatory" : false, + "match_type" : "Exact", + "type" : { + "type" : "bytes", + "width" : 16 + } + }, + { + "id" : 9, + "name" : "user_meta.fwd_meta.x2", + "repeated" : false, + "annotations" : [], + "mandatory" : false, + "match_type" : "Exact", + "type" : { + "type" : "bytes", + "width" : 16 + } + }, + { + "id" : 10, + "name" : "user_meta.fwd_meta.exp_x3", + "repeated" : false, + "annotations" : [], + "mandatory" : false, + "match_type" : "Exact", + "type" : { + "type" : "bytes", + "width" : 32 + } + }, + { + "id" : 11, + "name" : "user_meta.fwd_meta.x3", + "repeated" : false, + "annotations" : [], + "mandatory" : false, + "match_type" : "Exact", + "type" : { + "type" : "bytes", + "width" : 32 + } + }, + { + "id" : 12, + "name" : "user_meta.fwd_meta.exp_x4", + "repeated" : false, + "annotations" : [], + "mandatory" : false, + "match_type" : "Exact", + "type" : { + "type" : "bytes", + "width" : 32 + } + }, + { + "id" : 13, + "name" : "user_meta.fwd_meta.x4", + "repeated" : false, + "annotations" : [], + "mandatory" : false, + "match_type" : "Exact", + "type" : { + "type" : "bytes", + "width" : 32 + } + } + ], + "action_specs" : [ + { + "id" : 21257015, + "name" : "NoAction", + "action_scope" : "TableAndDefault", + "annotations" : [], + "data" : [] + } + ], + "data" : [], + "supported_operations" : [], + "attributes" : ["EntryScope"] + } + ], + "learn_filters" : [] +} \ No newline at end of file diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-issue983-bmv2.p4.spec b/testdata/p4_16_samples_outputs/psa-dpdk-issue983-bmv2.p4.spec new file mode 100644 index 00000000000..f3c7370ebb7 --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-issue983-bmv2.p4.spec @@ -0,0 +1,185 @@ + +struct ethernet_t { + bit<48> dstAddr + bit<48> srcAddr + bit<16> etherType +} + +struct psa_ingress_output_metadata_t { + bit<8> class_of_service + bit<8> clone + bit<16> clone_session_id + bit<8> drop + bit<8> resubmit + bit<32> multicast_group + bit<32> egress_port +} + +struct psa_egress_output_metadata_t { + bit<8> clone + bit<16> clone_session_id + bit<8> drop +} + +struct psa_egress_deparser_input_metadata_t { + bit<32> egress_port +} + +struct metadata { + bit<32> psa_ingress_input_metadata_ingress_port + bit<8> psa_ingress_output_metadata_drop + bit<32> psa_ingress_output_metadata_egress_port + bit<16> local_metadata__fwd_meta_tmp0 + bit<32> local_metadata__fwd_meta_x11 + bit<16> local_metadata__fwd_meta_x22 + bit<32> local_metadata__fwd_meta_x33 + bit<32> local_metadata__fwd_meta_x44 + bit<16> local_metadata__fwd_meta_exp_etherType5 + bit<32> local_metadata__fwd_meta_exp_x16 + bit<16> local_metadata__fwd_meta_exp_x27 + bit<32> local_metadata__fwd_meta_exp_x38 + bit<32> local_metadata__fwd_meta_exp_x49 + bit<48> ingress_debug_table_cksum1_ethernet_srcAddr + bit<48> ingress_debug_table_cksum1_ethernet_dstAddr + bit<16> ingress_debug_table_cksum1_ethernet_etherType + bit<16> Ingress_tmp + bit<32> Ingress_tmp_0 + bit<16> Ingress_tmp_1 + bit<32> Ingress_tmp_2 + bit<32> Ingress_tmp_3 + bit<16> Ingress_tmp_4 + bit<16> Ingress_tmp_5 + bit<32> Ingress_tmp_6 + bit<16> Ingress_tmp_7 + bit<16> Ingress_tmp_8 + bit<16> Ingress_tmp_9 + bit<32> Ingress_tmp_10 + bit<32> Ingress_tmp_11 + bit<32> Ingress_tmp_12 + bit<16> Ingress_tmp_13 + bit<16> Ingress_tmp_14 + bit<32> Ingress_tmp_15 + bit<32> Ingress_tmp_16 + bit<16> Ingress_tmp_17 + bit<16> Ingress_tmp_18 + bit<32> Ingress_tmp_19 + bit<16> Ingress_tmp_20 + bit<16> Ingress_tmp_21 + bit<32> Ingress_tmp_22 + bit<48> Ingress_tmp_23 + bit<48> Ingress_tmp_24 + bit<48> Ingress_tmp_25 + bit<48> Ingress_tmp_26 + bit<48> Ingress_tmp_27 +} +metadata instanceof metadata + +header ethernet instanceof ethernet_t + +action NoAction args none { + return +} + +table debug_table_cksum1 { + key { + m.ingress_debug_table_cksum1_ethernet_srcAddr exact + m.ingress_debug_table_cksum1_ethernet_dstAddr exact + m.ingress_debug_table_cksum1_ethernet_etherType exact + m.local_metadata__fwd_meta_exp_etherType5 exact + m.local_metadata__fwd_meta_tmp0 exact + m.local_metadata__fwd_meta_exp_x16 exact + m.local_metadata__fwd_meta_x11 exact + m.local_metadata__fwd_meta_exp_x27 exact + m.local_metadata__fwd_meta_x22 exact + m.local_metadata__fwd_meta_exp_x38 exact + m.local_metadata__fwd_meta_x33 exact + m.local_metadata__fwd_meta_exp_x49 exact + m.local_metadata__fwd_meta_x44 exact + } + actions { + NoAction + } + default_action NoAction args none + size 0x10000 +} + + +apply { + rx m.psa_ingress_input_metadata_ingress_port + mov m.psa_ingress_output_metadata_drop 0x0 + extract h.ethernet + compl m.local_metadata__fwd_meta_tmp0 h.ethernet.etherType + compl m.Ingress_tmp_13 h.ethernet.etherType + mov m.local_metadata__fwd_meta_x11 m.Ingress_tmp_13 + compl m.Ingress_tmp_14 h.ethernet.etherType + mov m.Ingress_tmp_15 m.Ingress_tmp_14 + mov m.Ingress_tmp_16 m.Ingress_tmp_15 + shr m.Ingress_tmp_16 0x10 + mov m.Ingress_tmp_17 m.Ingress_tmp_16 + compl m.Ingress_tmp_18 h.ethernet.etherType + mov m.Ingress_tmp_19 m.Ingress_tmp_18 + mov m.Ingress_tmp_20 m.Ingress_tmp_19 + mov m.local_metadata__fwd_meta_x22 m.Ingress_tmp_17 + add m.local_metadata__fwd_meta_x22 m.Ingress_tmp_20 + compl m.Ingress_tmp_21 h.ethernet.etherType + mov m.local_metadata__fwd_meta_x33 m.Ingress_tmp_21 + mov m.Ingress_tmp_22 h.ethernet.etherType + compl m.local_metadata__fwd_meta_x44 m.Ingress_tmp_22 + mov m.local_metadata__fwd_meta_exp_etherType5 0x800 + mov m.local_metadata__fwd_meta_exp_x16 0xf7ff + mov m.local_metadata__fwd_meta_exp_x27 0xf7ff + mov m.local_metadata__fwd_meta_exp_x38 0xf7ff + mov m.local_metadata__fwd_meta_exp_x49 0xfffff7ff + mov h.ethernet.dstAddr 0x0 + jmpeq LABEL_END h.ethernet.etherType 0x800 + mov m.Ingress_tmp_23 h.ethernet.dstAddr + and m.Ingress_tmp_23 0xffffffffff + mov h.ethernet.dstAddr m.Ingress_tmp_23 + or h.ethernet.dstAddr 0x10000000000 + LABEL_END : compl m.Ingress_tmp h.ethernet.etherType + mov m.Ingress_tmp_0 m.Ingress_tmp + jmpeq LABEL_END_0 m.Ingress_tmp_0 0xf7ff + mov m.Ingress_tmp_24 h.ethernet.dstAddr + and m.Ingress_tmp_24 0xff00ffffffff + mov h.ethernet.dstAddr m.Ingress_tmp_24 + or h.ethernet.dstAddr 0x100000000 + LABEL_END_0 : compl m.Ingress_tmp_1 h.ethernet.etherType + mov m.Ingress_tmp_2 m.Ingress_tmp_1 + mov m.Ingress_tmp_3 m.Ingress_tmp_2 + shr m.Ingress_tmp_3 0x10 + mov m.Ingress_tmp_4 m.Ingress_tmp_3 + compl m.Ingress_tmp_5 h.ethernet.etherType + mov m.Ingress_tmp_6 m.Ingress_tmp_5 + mov m.Ingress_tmp_7 m.Ingress_tmp_6 + mov m.Ingress_tmp_8 m.Ingress_tmp_4 + add m.Ingress_tmp_8 m.Ingress_tmp_7 + jmpeq LABEL_END_1 m.Ingress_tmp_8 0xf7ff + mov m.Ingress_tmp_25 h.ethernet.dstAddr + and m.Ingress_tmp_25 0xffff00ffffff + mov h.ethernet.dstAddr m.Ingress_tmp_25 + or h.ethernet.dstAddr 0x1000000 + LABEL_END_1 : compl m.Ingress_tmp_9 h.ethernet.etherType + mov m.Ingress_tmp_10 m.Ingress_tmp_9 + jmpeq LABEL_END_2 m.Ingress_tmp_10 0xf7ff + mov m.Ingress_tmp_26 h.ethernet.dstAddr + and m.Ingress_tmp_26 0xffffff00ffff + mov h.ethernet.dstAddr m.Ingress_tmp_26 + or h.ethernet.dstAddr 0x10000 + LABEL_END_2 : mov m.Ingress_tmp_11 h.ethernet.etherType + compl m.Ingress_tmp_12 m.Ingress_tmp_11 + jmpeq LABEL_END_3 m.Ingress_tmp_12 0xfffff7ff + mov m.Ingress_tmp_27 h.ethernet.dstAddr + and m.Ingress_tmp_27 0xffffffff00ff + mov h.ethernet.dstAddr m.Ingress_tmp_27 + or h.ethernet.dstAddr 0x100 + LABEL_END_3 : mov m.ingress_debug_table_cksum1_ethernet_srcAddr h.ethernet.srcAddr + mov m.ingress_debug_table_cksum1_ethernet_dstAddr h.ethernet.dstAddr + mov m.ingress_debug_table_cksum1_ethernet_etherType h.ethernet.etherType + table debug_table_cksum1 + jmpneq LABEL_DROP m.psa_ingress_output_metadata_drop 0x0 + emit h.ethernet + tx m.psa_ingress_output_metadata_egress_port + LABEL_DROP : drop +} + + diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-issue995-bmv2.p4-error b/testdata/p4_16_samples_outputs/psa-dpdk-issue995-bmv2.p4-error new file mode 100644 index 00000000000..e69de29bb2d diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-issue995-bmv2.p4.bfrt.json b/testdata/p4_16_samples_outputs/psa-dpdk-issue995-bmv2.p4.bfrt.json new file mode 100644 index 00000000000..b6d66a630db --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-issue995-bmv2.p4.bfrt.json @@ -0,0 +1,5 @@ +{ + "schema_version" : "1.0.0", + "tables" : [], + "learn_filters" : [] +} \ No newline at end of file diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-issue995-bmv2.p4.spec b/testdata/p4_16_samples_outputs/psa-dpdk-issue995-bmv2.p4.spec new file mode 100644 index 00000000000..66ede51af26 --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-issue995-bmv2.p4.spec @@ -0,0 +1,82 @@ + + + + + +struct ethernet_t { + bit<48> dstAddr + bit<48> srcAddr + bit<16> etherType +} + +struct psa_ingress_output_metadata_t { + bit<8> class_of_service + bit<8> clone + bit<16> clone_session_id + bit<8> drop + bit<8> resubmit + bit<32> multicast_group + bit<32> egress_port +} + +struct psa_egress_output_metadata_t { + bit<8> clone + bit<16> clone_session_id + bit<8> drop +} + +struct psa_egress_deparser_input_metadata_t { + bit<32> egress_port +} + +struct metadata { + bit<32> psa_ingress_input_metadata_ingress_port + bit<8> psa_ingress_output_metadata_drop + bit<32> psa_ingress_output_metadata_egress_port + bit<16> local_metadata_transition_taken +} +metadata instanceof metadata + +header ethernet instanceof ethernet_t + +apply { + rx m.psa_ingress_input_metadata_ingress_port + mov m.psa_ingress_output_metadata_drop 0x0 + extract h.ethernet + jmpneq PARSERIMPL_START_0 h.ethernet.srcAddr 0x12f0000 + jmpneq PARSERIMPL_START_0 h.ethernet.dstAddr 0x456 + jmp PARSERIMPL_A1 + PARSERIMPL_START_0 : mov m.tmpMask h.ethernet.srcAddr + and m.tmpMask 0xffff0000 + jmpneq PARSERIMPL_START_1 m.tmpMask 0x12f0000 + jmpneq PARSERIMPL_START_1 h.ethernet.dstAddr 0x456 + jmp PARSERIMPL_A2 + PARSERIMPL_START_1 : jmpneq PARSERIMPL_START_2 h.ethernet.srcAddr 0x12f0000 + mov m.tmpMask_0 h.ethernet.dstAddr + and m.tmpMask_0 0xfff + jmpneq PARSERIMPL_START_2 m.tmpMask_0 0x456 + jmp PARSERIMPL_A3 + PARSERIMPL_START_2 : mov m.tmpMask_1 h.ethernet.srcAddr + and m.tmpMask_1 0xffff0000 + jmpneq PARSERIMPL_START_3 m.tmpMask_1 0x12f0000 + mov m.tmpMask_2 h.ethernet.dstAddr + and m.tmpMask_2 0xfff + jmpneq PARSERIMPL_START_3 m.tmpMask_2 0x456 + jmp PARSERIMPL_A4 + PARSERIMPL_START_3 : mov m.local_metadata_transition_taken 0x5 + jmp PARSERIMPL_ACCEPT + PARSERIMPL_A4 : mov m.local_metadata_transition_taken 0x4 + jmp PARSERIMPL_ACCEPT + PARSERIMPL_A3 : mov m.local_metadata_transition_taken 0x3 + jmp PARSERIMPL_ACCEPT + PARSERIMPL_A2 : mov m.local_metadata_transition_taken 0x2 + jmp PARSERIMPL_ACCEPT + PARSERIMPL_A1 : mov m.local_metadata_transition_taken 0x1 + PARSERIMPL_ACCEPT : mov h.ethernet.etherType m.local_metadata_transition_taken + jmpneq LABEL_DROP m.psa_ingress_output_metadata_drop 0x0 + emit h.ethernet + tx m.psa_ingress_output_metadata_egress_port + LABEL_DROP : drop +} + + diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-issue995-first.p4 b/testdata/p4_16_samples_outputs/psa-dpdk-issue995-first.p4 new file mode 100644 index 00000000000..f32cb542da8 --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-issue995-first.p4 @@ -0,0 +1,102 @@ +#include +#include + +header EMPTY_H { +} + +struct EMPTY_RESUB { +} + +struct EMPTY_CLONE { +} + +struct EMPTY_BRIDGE { +} + +struct EMPTY_RECIRC { +} + +header ethernet_t { + bit<48> dstAddr; + bit<48> srcAddr; + bit<16> etherType; +} + +struct metadata { + bit<16> transition_taken; +} + +struct headers { + ethernet_t ethernet; +} + +parser ParserImpl(packet_in packet, out headers hdr, inout metadata meta, in psa_ingress_parser_input_metadata_t x, in EMPTY_RESUB resub_meta, in EMPTY_RECIRC recirc_meta) { + state start { + transition parse_ethernet; + } + state parse_ethernet { + packet.extract(hdr.ethernet); + transition select(hdr.ethernet.srcAddr, hdr.ethernet.dstAddr) { + (48w0x12f0000, 48w0x456): a1; + (48w0x12f0000 &&& 48w0xffff0000, 48w0x456): a2; + (48w0x12f0000, 48w0x456 &&& 48w0xfff): a3; + (48w0x12f0000 &&& 48w0xffff0000, 48w0x456 &&& 48w0xfff): a4; + default: a5; + } + } + state a1 { + meta.transition_taken = 16w1; + transition accept; + } + state a2 { + meta.transition_taken = 16w2; + transition accept; + } + state a3 { + meta.transition_taken = 16w3; + transition accept; + } + state a4 { + meta.transition_taken = 16w4; + transition accept; + } + state a5 { + meta.transition_taken = 16w5; + transition accept; + } +} + +parser egressParserImpl(packet_in buffer, out EMPTY_H a, inout metadata b, in psa_egress_parser_input_metadata_t c, in EMPTY_BRIDGE d, in EMPTY_CLONE e, in EMPTY_CLONE f) { + state start { + transition accept; + } +} + +control ingress(inout headers hdr, inout metadata meta, in psa_ingress_input_metadata_t istd, inout psa_ingress_output_metadata_t ostd) { + apply { + hdr.ethernet.etherType = meta.transition_taken; + } +} + +control egressControlImpl(inout EMPTY_H hdr, inout metadata meta, in psa_egress_input_metadata_t x, inout psa_egress_output_metadata_t ostd) { + apply { + } +} + +control DeparserImpl(packet_out packet, out EMPTY_CLONE clone_i2e_meta, out EMPTY_RESUB resubmit_meta, out EMPTY_BRIDGE normal_meta, inout headers hdr, in metadata local_metadata, in psa_ingress_output_metadata_t istd) { + apply { + packet.emit(hdr.ethernet); + } +} + +control egressDeparserImpl(packet_out buffer, out EMPTY_CLONE a, out EMPTY_RECIRC b, inout EMPTY_H c, in metadata d, in psa_egress_output_metadata_t e, in psa_egress_deparser_input_metadata_t f) { + apply { + } +} + +IngressPipeline(ParserImpl(), ingress(), DeparserImpl()) ip; + +EgressPipeline(egressParserImpl(), egressControlImpl(), egressDeparserImpl()) ep; + +PSA_Switch(ip, PacketReplicationEngine(), ep, BufferingQueueingEngine()) main; + diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-issue995-frontend.p4 b/testdata/p4_16_samples_outputs/psa-dpdk-issue995-frontend.p4 new file mode 100644 index 00000000000..df84b265c04 --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-issue995-frontend.p4 @@ -0,0 +1,99 @@ +#include +#include + +header EMPTY_H { +} + +struct EMPTY_RESUB { +} + +struct EMPTY_CLONE { +} + +struct EMPTY_BRIDGE { +} + +struct EMPTY_RECIRC { +} + +header ethernet_t { + bit<48> dstAddr; + bit<48> srcAddr; + bit<16> etherType; +} + +struct metadata { + bit<16> transition_taken; +} + +struct headers { + ethernet_t ethernet; +} + +parser ParserImpl(packet_in packet, out headers hdr, inout metadata meta, in psa_ingress_parser_input_metadata_t x, in EMPTY_RESUB resub_meta, in EMPTY_RECIRC recirc_meta) { + state start { + packet.extract(hdr.ethernet); + transition select(hdr.ethernet.srcAddr, hdr.ethernet.dstAddr) { + (48w0x12f0000, 48w0x456): a1; + (48w0x12f0000 &&& 48w0xffff0000, 48w0x456): a2; + (48w0x12f0000, 48w0x456 &&& 48w0xfff): a3; + (48w0x12f0000 &&& 48w0xffff0000, 48w0x456 &&& 48w0xfff): a4; + default: a5; + } + } + state a1 { + meta.transition_taken = 16w1; + transition accept; + } + state a2 { + meta.transition_taken = 16w2; + transition accept; + } + state a3 { + meta.transition_taken = 16w3; + transition accept; + } + state a4 { + meta.transition_taken = 16w4; + transition accept; + } + state a5 { + meta.transition_taken = 16w5; + transition accept; + } +} + +parser egressParserImpl(packet_in buffer, out EMPTY_H a, inout metadata b, in psa_egress_parser_input_metadata_t c, in EMPTY_BRIDGE d, in EMPTY_CLONE e, in EMPTY_CLONE f) { + state start { + transition accept; + } +} + +control ingress(inout headers hdr, inout metadata meta, in psa_ingress_input_metadata_t istd, inout psa_ingress_output_metadata_t ostd) { + apply { + hdr.ethernet.etherType = meta.transition_taken; + } +} + +control egressControlImpl(inout EMPTY_H hdr, inout metadata meta, in psa_egress_input_metadata_t x, inout psa_egress_output_metadata_t ostd) { + apply { + } +} + +control DeparserImpl(packet_out packet, out EMPTY_CLONE clone_i2e_meta, out EMPTY_RESUB resubmit_meta, out EMPTY_BRIDGE normal_meta, inout headers hdr, in metadata local_metadata, in psa_ingress_output_metadata_t istd) { + apply { + packet.emit(hdr.ethernet); + } +} + +control egressDeparserImpl(packet_out buffer, out EMPTY_CLONE a, out EMPTY_RECIRC b, inout EMPTY_H c, in metadata d, in psa_egress_output_metadata_t e, in psa_egress_deparser_input_metadata_t f) { + apply { + } +} + +IngressPipeline(ParserImpl(), ingress(), DeparserImpl()) ip; + +EgressPipeline(egressParserImpl(), egressControlImpl(), egressDeparserImpl()) ep; + +PSA_Switch(ip, PacketReplicationEngine(), ep, BufferingQueueingEngine()) main; + diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-issue995-midend.p4 b/testdata/p4_16_samples_outputs/psa-dpdk-issue995-midend.p4 new file mode 100644 index 00000000000..6c5ac4283cd --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-issue995-midend.p4 @@ -0,0 +1,117 @@ +#include +#include + +header EMPTY_H { +} + +struct EMPTY_RESUB { +} + +struct EMPTY_CLONE { +} + +struct EMPTY_BRIDGE { +} + +struct EMPTY_RECIRC { +} + +header ethernet_t { + bit<48> dstAddr; + bit<48> srcAddr; + bit<16> etherType; +} + +struct metadata { + bit<16> transition_taken; +} + +struct headers { + ethernet_t ethernet; +} + +parser ParserImpl(packet_in packet, out headers hdr, inout metadata meta, in psa_ingress_parser_input_metadata_t x, in EMPTY_RESUB resub_meta, in EMPTY_RECIRC recirc_meta) { + state start { + packet.extract(hdr.ethernet); + transition select(hdr.ethernet.srcAddr, hdr.ethernet.dstAddr) { + (48w0x12f0000, 48w0x456): a1; + (48w0x12f0000 &&& 48w0xffff0000, 48w0x456): a2; + (48w0x12f0000, 48w0x456 &&& 48w0xfff): a3; + (48w0x12f0000 &&& 48w0xffff0000, 48w0x456 &&& 48w0xfff): a4; + default: a5; + } + } + state a1 { + meta.transition_taken = 16w1; + transition accept; + } + state a2 { + meta.transition_taken = 16w2; + transition accept; + } + state a3 { + meta.transition_taken = 16w3; + transition accept; + } + state a4 { + meta.transition_taken = 16w4; + transition accept; + } + state a5 { + meta.transition_taken = 16w5; + transition accept; + } +} + +parser egressParserImpl(packet_in buffer, out EMPTY_H a, inout metadata b, in psa_egress_parser_input_metadata_t c, in EMPTY_BRIDGE d, in EMPTY_CLONE e, in EMPTY_CLONE f) { + state start { + transition accept; + } +} + +control ingress(inout headers hdr, inout metadata meta, in psa_ingress_input_metadata_t istd, inout psa_ingress_output_metadata_t ostd) { + @hidden action psadpdkissue995l92() { + hdr.ethernet.etherType = meta.transition_taken; + } + @hidden table tbl_psadpdkissue995l92 { + actions = { + psadpdkissue995l92(); + } + const default_action = psadpdkissue995l92(); + } + apply { + tbl_psadpdkissue995l92.apply(); + } +} + +control egressControlImpl(inout EMPTY_H hdr, inout metadata meta, in psa_egress_input_metadata_t x, inout psa_egress_output_metadata_t ostd) { + apply { + } +} + +control DeparserImpl(packet_out packet, out EMPTY_CLONE clone_i2e_meta, out EMPTY_RESUB resubmit_meta, out EMPTY_BRIDGE normal_meta, inout headers hdr, in metadata local_metadata, in psa_ingress_output_metadata_t istd) { + @hidden action psadpdkissue995l113() { + packet.emit(hdr.ethernet); + } + @hidden table tbl_psadpdkissue995l113 { + actions = { + psadpdkissue995l113(); + } + const default_action = psadpdkissue995l113(); + } + apply { + tbl_psadpdkissue995l113.apply(); + } +} + +control egressDeparserImpl(packet_out buffer, out EMPTY_CLONE a, out EMPTY_RECIRC b, inout EMPTY_H c, in metadata d, in psa_egress_output_metadata_t e, in psa_egress_deparser_input_metadata_t f) { + apply { + } +} + +IngressPipeline(ParserImpl(), ingress(), DeparserImpl()) ip; + +EgressPipeline(egressParserImpl(), egressControlImpl(), egressDeparserImpl()) ep; + +PSA_Switch(ip, PacketReplicationEngine(), ep, BufferingQueueingEngine()) main; + diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-issue995.p4 b/testdata/p4_16_samples_outputs/psa-dpdk-issue995.p4 new file mode 100644 index 00000000000..87f3970fbb9 --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-issue995.p4 @@ -0,0 +1,102 @@ +#include +#include + +header EMPTY_H { +} + +struct EMPTY_RESUB { +} + +struct EMPTY_CLONE { +} + +struct EMPTY_BRIDGE { +} + +struct EMPTY_RECIRC { +} + +header ethernet_t { + bit<48> dstAddr; + bit<48> srcAddr; + bit<16> etherType; +} + +struct metadata { + bit<16> transition_taken; +} + +struct headers { + ethernet_t ethernet; +} + +parser ParserImpl(packet_in packet, out headers hdr, inout metadata meta, in psa_ingress_parser_input_metadata_t x, in EMPTY_RESUB resub_meta, in EMPTY_RECIRC recirc_meta) { + state start { + transition parse_ethernet; + } + state parse_ethernet { + packet.extract(hdr.ethernet); + transition select(hdr.ethernet.srcAddr, hdr.ethernet.dstAddr) { + (0x12f0000, 0x456): a1; + (0x12f0000 &&& 0xffff0000, 0x456): a2; + (0x12f0000, 0x456 &&& 0xfff): a3; + (0x12f0000 &&& 0xffff0000, 0x456 &&& 0xfff): a4; + default: a5; + } + } + state a1 { + meta.transition_taken = 1; + transition accept; + } + state a2 { + meta.transition_taken = 2; + transition accept; + } + state a3 { + meta.transition_taken = 3; + transition accept; + } + state a4 { + meta.transition_taken = 4; + transition accept; + } + state a5 { + meta.transition_taken = 5; + transition accept; + } +} + +parser egressParserImpl(packet_in buffer, out EMPTY_H a, inout metadata b, in psa_egress_parser_input_metadata_t c, in EMPTY_BRIDGE d, in EMPTY_CLONE e, in EMPTY_CLONE f) { + state start { + transition accept; + } +} + +control ingress(inout headers hdr, inout metadata meta, in psa_ingress_input_metadata_t istd, inout psa_ingress_output_metadata_t ostd) { + apply { + hdr.ethernet.etherType = meta.transition_taken; + } +} + +control egressControlImpl(inout EMPTY_H hdr, inout metadata meta, in psa_egress_input_metadata_t x, inout psa_egress_output_metadata_t ostd) { + apply { + } +} + +control DeparserImpl(packet_out packet, out EMPTY_CLONE clone_i2e_meta, out EMPTY_RESUB resubmit_meta, out EMPTY_BRIDGE normal_meta, inout headers hdr, in metadata local_metadata, in psa_ingress_output_metadata_t istd) { + apply { + packet.emit(hdr.ethernet); + } +} + +control egressDeparserImpl(packet_out buffer, out EMPTY_CLONE a, out EMPTY_RECIRC b, inout EMPTY_H c, in metadata d, in psa_egress_output_metadata_t e, in psa_egress_deparser_input_metadata_t f) { + apply { + } +} + +IngressPipeline(ParserImpl(), ingress(), DeparserImpl()) ip; + +EgressPipeline(egressParserImpl(), egressControlImpl(), egressDeparserImpl()) ep; + +PSA_Switch(ip, PacketReplicationEngine(), ep, BufferingQueueingEngine()) main; + diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-issue995.p4-error b/testdata/p4_16_samples_outputs/psa-dpdk-issue995.p4-error new file mode 100644 index 00000000000..e69de29bb2d diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-issue995.p4-stderr b/testdata/p4_16_samples_outputs/psa-dpdk-issue995.p4-stderr new file mode 100644 index 00000000000..e69de29bb2d diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-issue995.p4.bfrt.json b/testdata/p4_16_samples_outputs/psa-dpdk-issue995.p4.bfrt.json new file mode 100644 index 00000000000..b6d66a630db --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-issue995.p4.bfrt.json @@ -0,0 +1,5 @@ +{ + "schema_version" : "1.0.0", + "tables" : [], + "learn_filters" : [] +} \ No newline at end of file diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-issue995.p4.entries.txt b/testdata/p4_16_samples_outputs/psa-dpdk-issue995.p4.entries.txt new file mode 100644 index 00000000000..e69de29bb2d diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-issue995.p4.p4info.txt b/testdata/p4_16_samples_outputs/psa-dpdk-issue995.p4.p4info.txt new file mode 100644 index 00000000000..77612386454 --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-issue995.p4.p4info.txt @@ -0,0 +1,3 @@ +pkg_info { + arch: "psa" +} diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-issue995.p4.spec b/testdata/p4_16_samples_outputs/psa-dpdk-issue995.p4.spec new file mode 100644 index 00000000000..66ede51af26 --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-issue995.p4.spec @@ -0,0 +1,82 @@ + + + + + +struct ethernet_t { + bit<48> dstAddr + bit<48> srcAddr + bit<16> etherType +} + +struct psa_ingress_output_metadata_t { + bit<8> class_of_service + bit<8> clone + bit<16> clone_session_id + bit<8> drop + bit<8> resubmit + bit<32> multicast_group + bit<32> egress_port +} + +struct psa_egress_output_metadata_t { + bit<8> clone + bit<16> clone_session_id + bit<8> drop +} + +struct psa_egress_deparser_input_metadata_t { + bit<32> egress_port +} + +struct metadata { + bit<32> psa_ingress_input_metadata_ingress_port + bit<8> psa_ingress_output_metadata_drop + bit<32> psa_ingress_output_metadata_egress_port + bit<16> local_metadata_transition_taken +} +metadata instanceof metadata + +header ethernet instanceof ethernet_t + +apply { + rx m.psa_ingress_input_metadata_ingress_port + mov m.psa_ingress_output_metadata_drop 0x0 + extract h.ethernet + jmpneq PARSERIMPL_START_0 h.ethernet.srcAddr 0x12f0000 + jmpneq PARSERIMPL_START_0 h.ethernet.dstAddr 0x456 + jmp PARSERIMPL_A1 + PARSERIMPL_START_0 : mov m.tmpMask h.ethernet.srcAddr + and m.tmpMask 0xffff0000 + jmpneq PARSERIMPL_START_1 m.tmpMask 0x12f0000 + jmpneq PARSERIMPL_START_1 h.ethernet.dstAddr 0x456 + jmp PARSERIMPL_A2 + PARSERIMPL_START_1 : jmpneq PARSERIMPL_START_2 h.ethernet.srcAddr 0x12f0000 + mov m.tmpMask_0 h.ethernet.dstAddr + and m.tmpMask_0 0xfff + jmpneq PARSERIMPL_START_2 m.tmpMask_0 0x456 + jmp PARSERIMPL_A3 + PARSERIMPL_START_2 : mov m.tmpMask_1 h.ethernet.srcAddr + and m.tmpMask_1 0xffff0000 + jmpneq PARSERIMPL_START_3 m.tmpMask_1 0x12f0000 + mov m.tmpMask_2 h.ethernet.dstAddr + and m.tmpMask_2 0xfff + jmpneq PARSERIMPL_START_3 m.tmpMask_2 0x456 + jmp PARSERIMPL_A4 + PARSERIMPL_START_3 : mov m.local_metadata_transition_taken 0x5 + jmp PARSERIMPL_ACCEPT + PARSERIMPL_A4 : mov m.local_metadata_transition_taken 0x4 + jmp PARSERIMPL_ACCEPT + PARSERIMPL_A3 : mov m.local_metadata_transition_taken 0x3 + jmp PARSERIMPL_ACCEPT + PARSERIMPL_A2 : mov m.local_metadata_transition_taken 0x2 + jmp PARSERIMPL_ACCEPT + PARSERIMPL_A1 : mov m.local_metadata_transition_taken 0x1 + PARSERIMPL_ACCEPT : mov h.ethernet.etherType m.local_metadata_transition_taken + jmpneq LABEL_DROP m.psa_ingress_output_metadata_drop 0x0 + emit h.ethernet + tx m.psa_ingress_output_metadata_egress_port + LABEL_DROP : drop +} + + diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-parser-locals2-first.p4 b/testdata/p4_16_samples_outputs/psa-dpdk-parser-locals2-first.p4 new file mode 100644 index 00000000000..fc24991cc78 --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-parser-locals2-first.p4 @@ -0,0 +1,119 @@ +#include +#include + +header EMPTY_H { +} + +struct EMPTY_RESUB { +} + +struct EMPTY_CLONE { +} + +struct EMPTY_BRIDGE { +} + +struct EMPTY_RECIRC { +} + +typedef bit<48> EthernetAddress; +header Ethernet_h { + EthernetAddress dstAddr; + EthernetAddress srcAddr; + bit<16> etherType; +} + +header ipv4_t { + bit<4> version; + bit<4> ihl; + bit<6> dscp; + bit<2> ecn; + bit<16> totalLen; + bit<16> identification; + bit<1> flag_rsvd; + bit<1> flag_noFrag; + bit<1> flag_more; + bit<13> fragOffset; + bit<8> ttl; + bit<8> protocol; + bit<16> hdrChecksum; + bit<32> srcAddr; + bit<32> dstAddr; +} + +struct Parsed_packet { + Ethernet_h ethernet; + ipv4_t ipv4; +} + +struct mystruct1 { + bit<4> a; + bit<4> b; +} + +parser parserI(packet_in pkt, out Parsed_packet hdr, inout mystruct1 meta, in psa_ingress_parser_input_metadata_t x, in EMPTY_RESUB resub_meta, in EMPTY_RECIRC recirc_meta) { + state start { + bit<8> my_local = 8w1; + pkt.extract(hdr.ethernet); + transition select(hdr.ethernet.etherType) { + 16w0x800: parse_ipv4; + default: accept; + } + } + state parse_ipv4 { + bit<16> my_local = 16w2; + pkt.extract(hdr.ipv4); + transition select(hdr.ipv4.version, hdr.ipv4.protocol) { + (4w0x4, 8w0x6): accept; + (4w0x4, 8w0x17): accept; + default: accept; + } + } +} + +parser egressParserImpl(packet_in buffer, out EMPTY_H a, inout mystruct1 b, in psa_egress_parser_input_metadata_t c, in EMPTY_BRIDGE d, in EMPTY_CLONE e, in EMPTY_CLONE f) { + state start { + transition accept; + } +} + +control cIngress(inout Parsed_packet hdr, inout mystruct1 meta, in psa_ingress_input_metadata_t istd, inout psa_ingress_output_metadata_t ostd) { + action foo() { + meta.b = meta.b + 4w5; + } + table guh { + key = { + hdr.ethernet.srcAddr: exact @name("hdr.ethernet.srcAddr") ; + } + actions = { + foo(); + } + default_action = foo(); + } + apply { + guh.apply(); + } +} + +control egressControlImpl(inout EMPTY_H hdr, inout mystruct1 meta, in psa_egress_input_metadata_t x, inout psa_egress_output_metadata_t ostd) { + apply { + } +} + +control DeparserI(packet_out packet, out EMPTY_CLONE clone_i2e_meta, out EMPTY_RESUB resubmit_meta, out EMPTY_BRIDGE normal_meta, inout Parsed_packet hdr, in mystruct1 local_metadata, in psa_ingress_output_metadata_t istd) { + apply { + packet.emit(hdr.ethernet); + } +} + +control egressDeparserImpl(packet_out buffer, out EMPTY_CLONE a, out EMPTY_RECIRC b, inout EMPTY_H c, in mystruct1 d, in psa_egress_output_metadata_t e, in psa_egress_deparser_input_metadata_t f) { + apply { + } +} + +IngressPipeline(parserI(), cIngress(), DeparserI()) ip; + +EgressPipeline(egressParserImpl(), egressControlImpl(), egressDeparserImpl()) ep; + +PSA_Switch(ip, PacketReplicationEngine(), ep, BufferingQueueingEngine()) main; + diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-parser-locals2-frontend.p4 b/testdata/p4_16_samples_outputs/psa-dpdk-parser-locals2-frontend.p4 new file mode 100644 index 00000000000..18f8add4eac --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-parser-locals2-frontend.p4 @@ -0,0 +1,117 @@ +#include +#include + +header EMPTY_H { +} + +struct EMPTY_RESUB { +} + +struct EMPTY_CLONE { +} + +struct EMPTY_BRIDGE { +} + +struct EMPTY_RECIRC { +} + +typedef bit<48> EthernetAddress; +header Ethernet_h { + EthernetAddress dstAddr; + EthernetAddress srcAddr; + bit<16> etherType; +} + +header ipv4_t { + bit<4> version; + bit<4> ihl; + bit<6> dscp; + bit<2> ecn; + bit<16> totalLen; + bit<16> identification; + bit<1> flag_rsvd; + bit<1> flag_noFrag; + bit<1> flag_more; + bit<13> fragOffset; + bit<8> ttl; + bit<8> protocol; + bit<16> hdrChecksum; + bit<32> srcAddr; + bit<32> dstAddr; +} + +struct Parsed_packet { + Ethernet_h ethernet; + ipv4_t ipv4; +} + +struct mystruct1 { + bit<4> a; + bit<4> b; +} + +parser parserI(packet_in pkt, out Parsed_packet hdr, inout mystruct1 meta, in psa_ingress_parser_input_metadata_t x, in EMPTY_RESUB resub_meta, in EMPTY_RECIRC recirc_meta) { + state start { + pkt.extract(hdr.ethernet); + transition select(hdr.ethernet.etherType) { + 16w0x800: parse_ipv4; + default: accept; + } + } + state parse_ipv4 { + pkt.extract(hdr.ipv4); + transition select(hdr.ipv4.version, hdr.ipv4.protocol) { + (4w0x4, 8w0x6): accept; + (4w0x4, 8w0x17): accept; + default: accept; + } + } +} + +parser egressParserImpl(packet_in buffer, out EMPTY_H a, inout mystruct1 b, in psa_egress_parser_input_metadata_t c, in EMPTY_BRIDGE d, in EMPTY_CLONE e, in EMPTY_CLONE f) { + state start { + transition accept; + } +} + +control cIngress(inout Parsed_packet hdr, inout mystruct1 meta, in psa_ingress_input_metadata_t istd, inout psa_ingress_output_metadata_t ostd) { + @name("cIngress.foo") action foo() { + meta.b = meta.b + 4w5; + } + @name("cIngress.guh") table guh_0 { + key = { + hdr.ethernet.srcAddr: exact @name("hdr.ethernet.srcAddr") ; + } + actions = { + foo(); + } + default_action = foo(); + } + apply { + guh_0.apply(); + } +} + +control egressControlImpl(inout EMPTY_H hdr, inout mystruct1 meta, in psa_egress_input_metadata_t x, inout psa_egress_output_metadata_t ostd) { + apply { + } +} + +control DeparserI(packet_out packet, out EMPTY_CLONE clone_i2e_meta, out EMPTY_RESUB resubmit_meta, out EMPTY_BRIDGE normal_meta, inout Parsed_packet hdr, in mystruct1 local_metadata, in psa_ingress_output_metadata_t istd) { + apply { + packet.emit(hdr.ethernet); + } +} + +control egressDeparserImpl(packet_out buffer, out EMPTY_CLONE a, out EMPTY_RECIRC b, inout EMPTY_H c, in mystruct1 d, in psa_egress_output_metadata_t e, in psa_egress_deparser_input_metadata_t f) { + apply { + } +} + +IngressPipeline(parserI(), cIngress(), DeparserI()) ip; + +EgressPipeline(egressParserImpl(), egressControlImpl(), egressDeparserImpl()) ep; + +PSA_Switch(ip, PacketReplicationEngine(), ep, BufferingQueueingEngine()) main; + diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-parser-locals2-midend.p4 b/testdata/p4_16_samples_outputs/psa-dpdk-parser-locals2-midend.p4 new file mode 100644 index 00000000000..a3d61345055 --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-parser-locals2-midend.p4 @@ -0,0 +1,126 @@ +#include +#include + +header EMPTY_H { +} + +struct EMPTY_RESUB { +} + +struct EMPTY_CLONE { +} + +struct EMPTY_BRIDGE { +} + +struct EMPTY_RECIRC { +} + +typedef bit<48> EthernetAddress; +header Ethernet_h { + EthernetAddress dstAddr; + EthernetAddress srcAddr; + bit<16> etherType; +} + +header ipv4_t { + bit<4> version; + bit<4> ihl; + bit<6> dscp; + bit<2> ecn; + bit<16> totalLen; + bit<16> identification; + bit<1> flag_rsvd; + bit<1> flag_noFrag; + bit<1> flag_more; + bit<13> fragOffset; + bit<8> ttl; + bit<8> protocol; + bit<16> hdrChecksum; + bit<32> srcAddr; + bit<32> dstAddr; +} + +struct Parsed_packet { + Ethernet_h ethernet; + ipv4_t ipv4; +} + +struct mystruct1 { + bit<4> a; + bit<4> b; +} + +parser parserI(packet_in pkt, out Parsed_packet hdr, inout mystruct1 meta, in psa_ingress_parser_input_metadata_t x, in EMPTY_RESUB resub_meta, in EMPTY_RECIRC recirc_meta) { + state start { + pkt.extract(hdr.ethernet); + transition select(hdr.ethernet.etherType) { + 16w0x800: parse_ipv4; + default: accept; + } + } + state parse_ipv4 { + pkt.extract(hdr.ipv4); + transition select(hdr.ipv4.version, hdr.ipv4.protocol) { + (4w0x4, 8w0x6): accept; + (4w0x4, 8w0x17): accept; + default: accept; + } + } +} + +parser egressParserImpl(packet_in buffer, out EMPTY_H a, inout mystruct1 b, in psa_egress_parser_input_metadata_t c, in EMPTY_BRIDGE d, in EMPTY_CLONE e, in EMPTY_CLONE f) { + state start { + transition accept; + } +} + +control cIngress(inout Parsed_packet hdr, inout mystruct1 meta, in psa_ingress_input_metadata_t istd, inout psa_ingress_output_metadata_t ostd) { + @name("cIngress.foo") action foo() { + meta.b = meta.b + 4w5; + } + @name("cIngress.guh") table guh_0 { + key = { + hdr.ethernet.srcAddr: exact @name("hdr.ethernet.srcAddr") ; + } + actions = { + foo(); + } + default_action = foo(); + } + apply { + guh_0.apply(); + } +} + +control egressControlImpl(inout EMPTY_H hdr, inout mystruct1 meta, in psa_egress_input_metadata_t x, inout psa_egress_output_metadata_t ostd) { + apply { + } +} + +control DeparserI(packet_out packet, out EMPTY_CLONE clone_i2e_meta, out EMPTY_RESUB resubmit_meta, out EMPTY_BRIDGE normal_meta, inout Parsed_packet hdr, in mystruct1 local_metadata, in psa_ingress_output_metadata_t istd) { + @hidden action psadpdkparserlocals2l138() { + packet.emit(hdr.ethernet); + } + @hidden table tbl_psadpdkparserlocals2l138 { + actions = { + psadpdkparserlocals2l138(); + } + const default_action = psadpdkparserlocals2l138(); + } + apply { + tbl_psadpdkparserlocals2l138.apply(); + } +} + +control egressDeparserImpl(packet_out buffer, out EMPTY_CLONE a, out EMPTY_RECIRC b, inout EMPTY_H c, in mystruct1 d, in psa_egress_output_metadata_t e, in psa_egress_deparser_input_metadata_t f) { + apply { + } +} + +IngressPipeline(parserI(), cIngress(), DeparserI()) ip; + +EgressPipeline(egressParserImpl(), egressControlImpl(), egressDeparserImpl()) ep; + +PSA_Switch(ip, PacketReplicationEngine(), ep, BufferingQueueingEngine()) main; + diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-parser-locals2.p4 b/testdata/p4_16_samples_outputs/psa-dpdk-parser-locals2.p4 new file mode 100644 index 00000000000..ea4d1134fab --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-parser-locals2.p4 @@ -0,0 +1,119 @@ +#include +#include + +header EMPTY_H { +} + +struct EMPTY_RESUB { +} + +struct EMPTY_CLONE { +} + +struct EMPTY_BRIDGE { +} + +struct EMPTY_RECIRC { +} + +typedef bit<48> EthernetAddress; +header Ethernet_h { + EthernetAddress dstAddr; + EthernetAddress srcAddr; + bit<16> etherType; +} + +header ipv4_t { + bit<4> version; + bit<4> ihl; + bit<6> dscp; + bit<2> ecn; + bit<16> totalLen; + bit<16> identification; + bit<1> flag_rsvd; + bit<1> flag_noFrag; + bit<1> flag_more; + bit<13> fragOffset; + bit<8> ttl; + bit<8> protocol; + bit<16> hdrChecksum; + bit<32> srcAddr; + bit<32> dstAddr; +} + +struct Parsed_packet { + Ethernet_h ethernet; + ipv4_t ipv4; +} + +struct mystruct1 { + bit<4> a; + bit<4> b; +} + +parser parserI(packet_in pkt, out Parsed_packet hdr, inout mystruct1 meta, in psa_ingress_parser_input_metadata_t x, in EMPTY_RESUB resub_meta, in EMPTY_RECIRC recirc_meta) { + state start { + bit<8> my_local = 1; + pkt.extract(hdr.ethernet); + transition select(hdr.ethernet.etherType) { + 16w0x800: parse_ipv4; + default: accept; + } + } + state parse_ipv4 { + bit<16> my_local = 2; + pkt.extract(hdr.ipv4); + transition select(hdr.ipv4.version, hdr.ipv4.protocol) { + (4w0x4, 8w0x6): accept; + (4w0x4, 8w0x17): accept; + default: accept; + } + } +} + +parser egressParserImpl(packet_in buffer, out EMPTY_H a, inout mystruct1 b, in psa_egress_parser_input_metadata_t c, in EMPTY_BRIDGE d, in EMPTY_CLONE e, in EMPTY_CLONE f) { + state start { + transition accept; + } +} + +control cIngress(inout Parsed_packet hdr, inout mystruct1 meta, in psa_ingress_input_metadata_t istd, inout psa_ingress_output_metadata_t ostd) { + action foo() { + meta.b = meta.b + 5; + } + table guh { + key = { + hdr.ethernet.srcAddr: exact; + } + actions = { + foo; + } + default_action = foo; + } + apply { + guh.apply(); + } +} + +control egressControlImpl(inout EMPTY_H hdr, inout mystruct1 meta, in psa_egress_input_metadata_t x, inout psa_egress_output_metadata_t ostd) { + apply { + } +} + +control DeparserI(packet_out packet, out EMPTY_CLONE clone_i2e_meta, out EMPTY_RESUB resubmit_meta, out EMPTY_BRIDGE normal_meta, inout Parsed_packet hdr, in mystruct1 local_metadata, in psa_ingress_output_metadata_t istd) { + apply { + packet.emit(hdr.ethernet); + } +} + +control egressDeparserImpl(packet_out buffer, out EMPTY_CLONE a, out EMPTY_RECIRC b, inout EMPTY_H c, in mystruct1 d, in psa_egress_output_metadata_t e, in psa_egress_deparser_input_metadata_t f) { + apply { + } +} + +IngressPipeline(parserI(), cIngress(), DeparserI()) ip; + +EgressPipeline(egressParserImpl(), egressControlImpl(), egressDeparserImpl()) ep; + +PSA_Switch(ip, PacketReplicationEngine(), ep, BufferingQueueingEngine()) main; + diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-parser-locals2.p4-error b/testdata/p4_16_samples_outputs/psa-dpdk-parser-locals2.p4-error new file mode 100644 index 00000000000..e69de29bb2d diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-parser-locals2.p4-stderr b/testdata/p4_16_samples_outputs/psa-dpdk-parser-locals2.p4-stderr new file mode 100644 index 00000000000..e69de29bb2d diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-parser-locals2.p4.bfrt.json b/testdata/p4_16_samples_outputs/psa-dpdk-parser-locals2.p4.bfrt.json new file mode 100644 index 00000000000..811435cfe80 --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-parser-locals2.p4.bfrt.json @@ -0,0 +1,41 @@ +{ + "schema_version" : "1.0.0", + "tables" : [ + { + "name" : "ip.cIngress.guh", + "id" : 48165785, + "table_type" : "MatchAction_Direct", + "size" : 1024, + "annotations" : [], + "depends_on" : [], + "has_const_default_action" : false, + "key" : [ + { + "id" : 1, + "name" : "hdr.ethernet.srcAddr", + "repeated" : false, + "annotations" : [], + "mandatory" : false, + "match_type" : "Exact", + "type" : { + "type" : "bytes", + "width" : 48 + } + } + ], + "action_specs" : [ + { + "id" : 25131402, + "name" : "cIngress.foo", + "action_scope" : "TableAndDefault", + "annotations" : [], + "data" : [] + } + ], + "data" : [], + "supported_operations" : [], + "attributes" : ["EntryScope"] + } + ], + "learn_filters" : [] +} \ No newline at end of file diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-parser-locals2.p4.entries.txt b/testdata/p4_16_samples_outputs/psa-dpdk-parser-locals2.p4.entries.txt new file mode 100644 index 00000000000..e69de29bb2d diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-parser-locals2.p4.p4info.txt b/testdata/p4_16_samples_outputs/psa-dpdk-parser-locals2.p4.p4info.txt new file mode 100644 index 00000000000..695dff62a0b --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-parser-locals2.p4.p4info.txt @@ -0,0 +1,29 @@ +pkg_info { + arch: "psa" +} +tables { + preamble { + id: 48165785 + name: "cIngress.guh" + alias: "guh" + } + match_fields { + id: 1 + name: "hdr.ethernet.srcAddr" + bitwidth: 48 + match_type: EXACT + } + action_refs { + id: 25131402 + } + size: 1024 +} +actions { + preamble { + id: 25131402 + name: "cIngress.foo" + alias: "foo" + } +} +type_info { +} diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-parser-locals2.p4.spec b/testdata/p4_16_samples_outputs/psa-dpdk-parser-locals2.p4.spec new file mode 100644 index 00000000000..05d6c6f3314 --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-parser-locals2.p4.spec @@ -0,0 +1,86 @@ + +struct Ethernet_h { + bit<48> dstAddr + bit<48> srcAddr + bit<16> etherType +} + +struct ipv4_t { + bit<8> version_ihl + bit<8> dscp_ecn + bit<16> totalLen + bit<16> identification + ;oldname:flag_rsvd_flag_noFrag_flag_more_fragOffset + bit<16> flag_rsvd_flag_noFrag_flag_mo0 + bit<8> ttl + bit<8> protocol + bit<16> hdrChecksum + bit<32> srcAddr + bit<32> dstAddr +} + +struct psa_ingress_output_metadata_t { + bit<8> class_of_service + bit<8> clone + bit<16> clone_session_id + bit<8> drop + bit<8> resubmit + bit<32> multicast_group + bit<32> egress_port +} + +struct psa_egress_output_metadata_t { + bit<8> clone + bit<16> clone_session_id + bit<8> drop +} + +struct psa_egress_deparser_input_metadata_t { + bit<32> egress_port +} + +header ethernet instanceof Ethernet_h +header ipv4 instanceof ipv4_t + +struct mystruct1 { + bit<32> psa_ingress_input_metadata_ingress_port + bit<8> psa_ingress_output_metadata_drop + bit<32> psa_ingress_output_metadata_egress_port + bit<32> local_metadata_b + bit<32> IngressParser_parser_tmp +} +metadata instanceof mystruct1 + +action foo args none { + add m.local_metadata_b 0x5 + return +} + +table guh { + key { + h.ethernet.srcAddr exact + } + actions { + foo + } + default_action foo args none + size 0x10000 +} + + +apply { + rx m.psa_ingress_input_metadata_ingress_port + mov m.psa_ingress_output_metadata_drop 0x0 + extract h.ethernet + jmpeq PARSERI_PARSE_IPV4 h.ethernet.etherType 0x800 + jmp PARSERI_ACCEPT + PARSERI_PARSE_IPV4 : extract h.ipv4 + mov m.IngressParser_parser_tmp h.ipv4.version_ihl + PARSERI_ACCEPT : table guh + jmpneq LABEL_DROP m.psa_ingress_output_metadata_drop 0x0 + emit h.ethernet + tx m.psa_ingress_output_metadata_egress_port + LABEL_DROP : drop +} + + diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-parser-unroll-test6-first.p4 b/testdata/p4_16_samples_outputs/psa-dpdk-parser-unroll-test6-first.p4 new file mode 100644 index 00000000000..fbaa12fee57 --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-parser-unroll-test6-first.p4 @@ -0,0 +1,78 @@ +#include +#include + +header EMPTY_H { +} + +struct EMPTY_RESUB { +} + +struct EMPTY_CLONE { +} + +struct EMPTY_BRIDGE { +} + +struct EMPTY_RECIRC { +} + +header test_header_t { + bit<8> value; +} + +struct headers_t { + test_header_t[2] test; +} + +struct metadata_t { +} + +parser TestParser(packet_in b, out headers_t headers, inout metadata_t meta, in psa_ingress_parser_input_metadata_t x, in EMPTY_RESUB resub_meta, in EMPTY_RECIRC recirc_meta) { + state start { + b.extract(headers.test.next); + bit<32> test_f = headers.test.lastIndex << 1; + transition select(test_f + 32w4294967295) { + 32w0: f; + default: a; + } + } + state a { + transition accept; + } + state f { + transition reject; + } +} + +parser egressParserImpl(packet_in buffer, out EMPTY_H a, inout metadata_t b, in psa_egress_parser_input_metadata_t c, in EMPTY_BRIDGE d, in EMPTY_CLONE e, in EMPTY_CLONE f) { + state start { + transition accept; + } +} + +control TestIngress(inout headers_t headers, inout metadata_t meta, in psa_ingress_input_metadata_t istd, inout psa_ingress_output_metadata_t ostd) { + apply { + } +} + +control egressControlImpl(inout EMPTY_H hdr, inout metadata_t meta, in psa_egress_input_metadata_t x, inout psa_egress_output_metadata_t ostd) { + apply { + } +} + +control DeparserI(packet_out packet, out EMPTY_CLONE clone_i2e_meta, out EMPTY_RESUB resubmit_meta, out EMPTY_BRIDGE normal_meta, inout headers_t hdr, in metadata_t local_metadata, in psa_ingress_output_metadata_t istd) { + apply { + } +} + +control egressDeparserImpl(packet_out buffer, out EMPTY_CLONE a, out EMPTY_RECIRC b, inout EMPTY_H c, in metadata_t d, in psa_egress_output_metadata_t e, in psa_egress_deparser_input_metadata_t f) { + apply { + } +} + +IngressPipeline(TestParser(), TestIngress(), DeparserI()) ip; + +EgressPipeline(egressParserImpl(), egressControlImpl(), egressDeparserImpl()) ep; + +PSA_Switch(ip, PacketReplicationEngine(), ep, BufferingQueueingEngine()) main; + diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-parser-unroll-test6-frontend.p4 b/testdata/p4_16_samples_outputs/psa-dpdk-parser-unroll-test6-frontend.p4 new file mode 100644 index 00000000000..46d32f928d5 --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-parser-unroll-test6-frontend.p4 @@ -0,0 +1,79 @@ +#include +#include + +header EMPTY_H { +} + +struct EMPTY_RESUB { +} + +struct EMPTY_CLONE { +} + +struct EMPTY_BRIDGE { +} + +struct EMPTY_RECIRC { +} + +header test_header_t { + bit<8> value; +} + +struct headers_t { + test_header_t[2] test; +} + +struct metadata_t { +} + +parser TestParser(packet_in b, out headers_t headers, inout metadata_t meta, in psa_ingress_parser_input_metadata_t x, in EMPTY_RESUB resub_meta, in EMPTY_RECIRC recirc_meta) { + @name("TestParser.test_f") bit<32> test_f_0; + state start { + b.extract(headers.test.next); + test_f_0 = headers.test.lastIndex << 1; + transition select(test_f_0 + 32w4294967295) { + 32w0: f; + default: a; + } + } + state a { + transition accept; + } + state f { + transition reject; + } +} + +parser egressParserImpl(packet_in buffer, out EMPTY_H a, inout metadata_t b, in psa_egress_parser_input_metadata_t c, in EMPTY_BRIDGE d, in EMPTY_CLONE e, in EMPTY_CLONE f) { + state start { + transition accept; + } +} + +control TestIngress(inout headers_t headers, inout metadata_t meta, in psa_ingress_input_metadata_t istd, inout psa_ingress_output_metadata_t ostd) { + apply { + } +} + +control egressControlImpl(inout EMPTY_H hdr, inout metadata_t meta, in psa_egress_input_metadata_t x, inout psa_egress_output_metadata_t ostd) { + apply { + } +} + +control DeparserI(packet_out packet, out EMPTY_CLONE clone_i2e_meta, out EMPTY_RESUB resubmit_meta, out EMPTY_BRIDGE normal_meta, inout headers_t hdr, in metadata_t local_metadata, in psa_ingress_output_metadata_t istd) { + apply { + } +} + +control egressDeparserImpl(packet_out buffer, out EMPTY_CLONE a, out EMPTY_RECIRC b, inout EMPTY_H c, in metadata_t d, in psa_egress_output_metadata_t e, in psa_egress_deparser_input_metadata_t f) { + apply { + } +} + +IngressPipeline(TestParser(), TestIngress(), DeparserI()) ip; + +EgressPipeline(egressParserImpl(), egressControlImpl(), egressDeparserImpl()) ep; + +PSA_Switch(ip, PacketReplicationEngine(), ep, BufferingQueueingEngine()) main; + diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-parser-unroll-test6-midend.p4 b/testdata/p4_16_samples_outputs/psa-dpdk-parser-unroll-test6-midend.p4 new file mode 100644 index 00000000000..7875f90632a --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-parser-unroll-test6-midend.p4 @@ -0,0 +1,77 @@ +#include +#include + +header EMPTY_H { +} + +struct EMPTY_RESUB { +} + +struct EMPTY_CLONE { +} + +struct EMPTY_BRIDGE { +} + +struct EMPTY_RECIRC { +} + +header test_header_t { + bit<8> value; +} + +struct headers_t { + test_header_t[2] test; +} + +struct metadata_t { +} + +parser TestParser(packet_in b, out headers_t headers, inout metadata_t meta, in psa_ingress_parser_input_metadata_t x, in EMPTY_RESUB resub_meta, in EMPTY_RECIRC recirc_meta) { + state start { + b.extract(headers.test.next); + transition select((headers.test.lastIndex << 1) + 32w4294967295) { + 32w0: f; + default: a; + } + } + state a { + transition accept; + } + state f { + transition reject; + } +} + +parser egressParserImpl(packet_in buffer, out EMPTY_H a, inout metadata_t b, in psa_egress_parser_input_metadata_t c, in EMPTY_BRIDGE d, in EMPTY_CLONE e, in EMPTY_CLONE f) { + state start { + transition accept; + } +} + +control TestIngress(inout headers_t headers, inout metadata_t meta, in psa_ingress_input_metadata_t istd, inout psa_ingress_output_metadata_t ostd) { + apply { + } +} + +control egressControlImpl(inout EMPTY_H hdr, inout metadata_t meta, in psa_egress_input_metadata_t x, inout psa_egress_output_metadata_t ostd) { + apply { + } +} + +control DeparserI(packet_out packet, out EMPTY_CLONE clone_i2e_meta, out EMPTY_RESUB resubmit_meta, out EMPTY_BRIDGE normal_meta, inout headers_t hdr, in metadata_t local_metadata, in psa_ingress_output_metadata_t istd) { + apply { + } +} + +control egressDeparserImpl(packet_out buffer, out EMPTY_CLONE a, out EMPTY_RECIRC b, inout EMPTY_H c, in metadata_t d, in psa_egress_output_metadata_t e, in psa_egress_deparser_input_metadata_t f) { + apply { + } +} + +IngressPipeline(TestParser(), TestIngress(), DeparserI()) ip; + +EgressPipeline(egressParserImpl(), egressControlImpl(), egressDeparserImpl()) ep; + +PSA_Switch(ip, PacketReplicationEngine(), ep, BufferingQueueingEngine()) main; + diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-parser-unroll-test6.p4 b/testdata/p4_16_samples_outputs/psa-dpdk-parser-unroll-test6.p4 new file mode 100644 index 00000000000..3fd5486458b --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-parser-unroll-test6.p4 @@ -0,0 +1,77 @@ +#include +#include + +header EMPTY_H { +} + +struct EMPTY_RESUB { +} + +struct EMPTY_CLONE { +} + +struct EMPTY_BRIDGE { +} + +struct EMPTY_RECIRC { +} + +header test_header_t { + bit<8> value; +} + +struct headers_t { + test_header_t[2] test; +} + +struct metadata_t { +} + +parser TestParser(packet_in b, out headers_t headers, inout metadata_t meta, in psa_ingress_parser_input_metadata_t x, in EMPTY_RESUB resub_meta, in EMPTY_RECIRC recirc_meta) { + state start { + b.extract(headers.test.next); + bit<32> test_f = 2 * headers.test.lastIndex; + transition select(test_f - 1) { + 0: f; + default: a; + } + } + state a { + transition accept; + } + state f { + } +} + +parser egressParserImpl(packet_in buffer, out EMPTY_H a, inout metadata_t b, in psa_egress_parser_input_metadata_t c, in EMPTY_BRIDGE d, in EMPTY_CLONE e, in EMPTY_CLONE f) { + state start { + transition accept; + } +} + +control TestIngress(inout headers_t headers, inout metadata_t meta, in psa_ingress_input_metadata_t istd, inout psa_ingress_output_metadata_t ostd) { + apply { + } +} + +control egressControlImpl(inout EMPTY_H hdr, inout metadata_t meta, in psa_egress_input_metadata_t x, inout psa_egress_output_metadata_t ostd) { + apply { + } +} + +control DeparserI(packet_out packet, out EMPTY_CLONE clone_i2e_meta, out EMPTY_RESUB resubmit_meta, out EMPTY_BRIDGE normal_meta, inout headers_t hdr, in metadata_t local_metadata, in psa_ingress_output_metadata_t istd) { + apply { + } +} + +control egressDeparserImpl(packet_out buffer, out EMPTY_CLONE a, out EMPTY_RECIRC b, inout EMPTY_H c, in metadata_t d, in psa_egress_output_metadata_t e, in psa_egress_deparser_input_metadata_t f) { + apply { + } +} + +IngressPipeline(TestParser(), TestIngress(), DeparserI()) ip; + +EgressPipeline(egressParserImpl(), egressControlImpl(), egressDeparserImpl()) ep; + +PSA_Switch(ip, PacketReplicationEngine(), ep, BufferingQueueingEngine()) main; + diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-parser-unroll-test6.p4-error b/testdata/p4_16_samples_outputs/psa-dpdk-parser-unroll-test6.p4-error new file mode 100644 index 00000000000..6c713d3b722 --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-parser-unroll-test6.p4-error @@ -0,0 +1,3 @@ +psa-dpdk-parser-unroll-test6.p4(41): [--Wwarn=parser-transition] warning: f: implicit transition to `reject' + state f { + ^ diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-parser-unroll-test6.p4-stderr b/testdata/p4_16_samples_outputs/psa-dpdk-parser-unroll-test6.p4-stderr new file mode 100644 index 00000000000..6c713d3b722 --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-parser-unroll-test6.p4-stderr @@ -0,0 +1,3 @@ +psa-dpdk-parser-unroll-test6.p4(41): [--Wwarn=parser-transition] warning: f: implicit transition to `reject' + state f { + ^ diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-parser-unroll-test6.p4.bfrt.json b/testdata/p4_16_samples_outputs/psa-dpdk-parser-unroll-test6.p4.bfrt.json new file mode 100644 index 00000000000..b6d66a630db --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-parser-unroll-test6.p4.bfrt.json @@ -0,0 +1,5 @@ +{ + "schema_version" : "1.0.0", + "tables" : [], + "learn_filters" : [] +} \ No newline at end of file diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-parser-unroll-test6.p4.entries.txt b/testdata/p4_16_samples_outputs/psa-dpdk-parser-unroll-test6.p4.entries.txt new file mode 100644 index 00000000000..e69de29bb2d diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-parser-unroll-test6.p4.p4info.txt b/testdata/p4_16_samples_outputs/psa-dpdk-parser-unroll-test6.p4.p4info.txt new file mode 100644 index 00000000000..77612386454 --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-parser-unroll-test6.p4.p4info.txt @@ -0,0 +1,3 @@ +pkg_info { + arch: "psa" +} diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-parser-unroll-test6.p4.spec b/testdata/p4_16_samples_outputs/psa-dpdk-parser-unroll-test6.p4.spec new file mode 100644 index 00000000000..16d52a34270 --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-parser-unroll-test6.p4.spec @@ -0,0 +1,46 @@ + +struct test_header_t { + bit<8> value +} + +struct psa_ingress_output_metadata_t { + bit<8> class_of_service + bit<8> clone + bit<16> clone_session_id + bit<8> drop + bit<8> resubmit + bit<32> multicast_group + bit<32> egress_port +} + +struct psa_egress_output_metadata_t { + bit<8> clone + bit<16> clone_session_id + bit<8> drop +} + +struct psa_egress_deparser_input_metadata_t { + bit<32> egress_port +} + +header test_0 instanceof test_header_t +header test_1 instanceof test_header_t + + +struct metadata_t { + bit<32> psa_ingress_input_metadata_ingress_port + bit<8> psa_ingress_output_metadata_drop + bit<32> psa_ingress_output_metadata_egress_port +} +metadata instanceof metadata_t + +apply { + rx m.psa_ingress_input_metadata_ingress_port + mov m.psa_ingress_output_metadata_drop 0x0 + extract h.test_0 + jmpneq LABEL_DROP m.psa_ingress_output_metadata_drop 0x0 + tx m.psa_ingress_output_metadata_egress_port + LABEL_DROP : drop +} + + diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-pred-first.p4 b/testdata/p4_16_samples_outputs/psa-dpdk-pred-first.p4 new file mode 100644 index 00000000000..fb98af5acb3 --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-pred-first.p4 @@ -0,0 +1,38 @@ +#include +#include + +header EMPTY_H { +} + +struct EMPTY_RESUB { +} + +struct EMPTY_CLONE { +} + +struct EMPTY_BRIDGE { +} + +struct EMPTY_RECIRC { +} + +control empty(); +package top(empty e); +control Ing() { + bool b; + bit<32> a; + action cond() { + b = true; + if (b) { + a = 32w5; + } else { + a = 32w10; + } + } + apply { + cond(); + } +} + +top(Ing()) main; + diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-pred-frontend.p4 b/testdata/p4_16_samples_outputs/psa-dpdk-pred-frontend.p4 new file mode 100644 index 00000000000..b08c18ce435 --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-pred-frontend.p4 @@ -0,0 +1,32 @@ +#include +#include + +header EMPTY_H { +} + +struct EMPTY_RESUB { +} + +struct EMPTY_CLONE { +} + +struct EMPTY_BRIDGE { +} + +struct EMPTY_RECIRC { +} + +control empty(); +package top(empty e); +control Ing() { + @name("Ing.b") bool b_0; + @name("Ing.cond") action cond() { + b_0 = true; + } + apply { + cond(); + } +} + +top(Ing()) main; + diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-pred-midend.p4 b/testdata/p4_16_samples_outputs/psa-dpdk-pred-midend.p4 new file mode 100644 index 00000000000..7783ad8bf13 --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-pred-midend.p4 @@ -0,0 +1,36 @@ +#include +#include + +header EMPTY_H { +} + +struct EMPTY_RESUB { +} + +struct EMPTY_CLONE { +} + +struct EMPTY_BRIDGE { +} + +struct EMPTY_RECIRC { +} + +control empty(); +package top(empty e); +control Ing() { + @name("Ing.cond") action cond() { + } + @hidden table tbl_cond { + actions = { + cond(); + } + const default_action = cond(); + } + apply { + tbl_cond.apply(); + } +} + +top(Ing()) main; + diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-pred.p4 b/testdata/p4_16_samples_outputs/psa-dpdk-pred.p4 new file mode 100644 index 00000000000..0b36114c52a --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-pred.p4 @@ -0,0 +1,38 @@ +#include +#include + +header EMPTY_H { +} + +struct EMPTY_RESUB { +} + +struct EMPTY_CLONE { +} + +struct EMPTY_BRIDGE { +} + +struct EMPTY_RECIRC { +} + +control empty(); +package top(empty e); +control Ing() { + bool b; + bit<32> a; + action cond() { + b = true; + if (b) { + a = 5; + } else { + a = 10; + } + } + apply { + cond(); + } +} + +top(Ing()) main; + diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-pred.p4-stderr b/testdata/p4_16_samples_outputs/psa-dpdk-pred.p4-stderr new file mode 100644 index 00000000000..e69de29bb2d diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-pred.p4.entries.txt b/testdata/p4_16_samples_outputs/psa-dpdk-pred.p4.entries.txt new file mode 100644 index 00000000000..e69de29bb2d diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-pred.p4.p4info.txt b/testdata/p4_16_samples_outputs/psa-dpdk-pred.p4.p4info.txt new file mode 100644 index 00000000000..dc7d619ed9d --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-pred.p4.p4info.txt @@ -0,0 +1,10 @@ +pkg_info { + arch: "psa" +} +actions { + preamble { + id: 33546633 + name: "Ing.cond" + alias: "cond" + } +} diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-same_name_for_table_and_action-first.p4 b/testdata/p4_16_samples_outputs/psa-dpdk-same_name_for_table_and_action-first.p4 new file mode 100644 index 00000000000..7e395db9b88 --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-same_name_for_table_and_action-first.p4 @@ -0,0 +1,79 @@ +#include +#include + +header EMPTY_H { +} + +struct EMPTY_RESUB { +} + +struct EMPTY_CLONE { +} + +struct EMPTY_BRIDGE { +} + +struct EMPTY_RECIRC { +} + +struct H { +} + +struct M { + bit<32> hash1; +} + +parser ParserI(packet_in pk, out H hdr, inout M meta, in psa_ingress_parser_input_metadata_t x, in EMPTY_RESUB resub_meta, in EMPTY_RECIRC recirc_meta) { + state start { + transition accept; + } +} + +parser egressParserImpl(packet_in buffer, out EMPTY_H a, inout M b, in psa_egress_parser_input_metadata_t c, in EMPTY_BRIDGE d, in EMPTY_CLONE e, in EMPTY_CLONE f) { + state start { + transition accept; + } +} + +action empty() { +} +control IngressI(inout H hdr, inout M meta, in psa_ingress_input_metadata_t istd, inout psa_ingress_output_metadata_t ostd) { + @name("do_something") action do_something_0() { + ingress_drop(ostd); + } + @name("do_something") table do_something { + key = { + istd.ingress_port: exact @name("istd.ingress_port") ; + } + actions = { + do_something_0(); + NoAction(); + } + const default_action = NoAction(); + } + apply { + do_something.apply(); + } +} + +control egressControlImpl(inout EMPTY_H hdr, inout M meta, in psa_egress_input_metadata_t x, inout psa_egress_output_metadata_t ostd) { + apply { + } +} + +control DeparserI(packet_out pk, out EMPTY_CLONE clone_i2e_meta, out EMPTY_RESUB resubmit_meta, out EMPTY_BRIDGE normal_meta, inout H hdr, in M local_metadata, in psa_ingress_output_metadata_t istd) { + apply { + } +} + +control egressDeparserImpl(packet_out buffer, out EMPTY_CLONE a, out EMPTY_RECIRC b, inout EMPTY_H c, in M d, in psa_egress_output_metadata_t e, in psa_egress_deparser_input_metadata_t f) { + apply { + } +} + +IngressPipeline(ParserI(), IngressI(), DeparserI()) ip; + +EgressPipeline(egressParserImpl(), egressControlImpl(), egressDeparserImpl()) ep; + +PSA_Switch(ip, PacketReplicationEngine(), ep, BufferingQueueingEngine()) main; + diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-same_name_for_table_and_action-frontend.p4 b/testdata/p4_16_samples_outputs/psa-dpdk-same_name_for_table_and_action-frontend.p4 new file mode 100644 index 00000000000..27f6ea0aff0 --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-same_name_for_table_and_action-frontend.p4 @@ -0,0 +1,82 @@ +#include +#include + +header EMPTY_H { +} + +struct EMPTY_RESUB { +} + +struct EMPTY_CLONE { +} + +struct EMPTY_BRIDGE { +} + +struct EMPTY_RECIRC { +} + +struct H { +} + +struct M { + bit<32> hash1; +} + +parser ParserI(packet_in pk, out H hdr, inout M meta, in psa_ingress_parser_input_metadata_t x, in EMPTY_RESUB resub_meta, in EMPTY_RECIRC recirc_meta) { + state start { + transition accept; + } +} + +parser egressParserImpl(packet_in buffer, out EMPTY_H a, inout M b, in psa_egress_parser_input_metadata_t c, in EMPTY_BRIDGE d, in EMPTY_CLONE e, in EMPTY_CLONE f) { + state start { + transition accept; + } +} + +control IngressI(inout H hdr, inout M meta, in psa_ingress_input_metadata_t istd, inout psa_ingress_output_metadata_t ostd) { + @name("IngressI.meta") psa_ingress_output_metadata_t meta_1; + @noWarn("unused") @name(".NoAction") action NoAction_1() { + } + @name("IngressI.do_something") action do_something() { + meta_1 = ostd; + meta_1.drop = true; + ostd = meta_1; + } + @name("IngressI.do_something") table do_something_2 { + key = { + istd.ingress_port: exact @name("istd.ingress_port") ; + } + actions = { + do_something(); + NoAction_1(); + } + const default_action = NoAction_1(); + } + apply { + do_something_2.apply(); + } +} + +control egressControlImpl(inout EMPTY_H hdr, inout M meta, in psa_egress_input_metadata_t x, inout psa_egress_output_metadata_t ostd) { + apply { + } +} + +control DeparserI(packet_out pk, out EMPTY_CLONE clone_i2e_meta, out EMPTY_RESUB resubmit_meta, out EMPTY_BRIDGE normal_meta, inout H hdr, in M local_metadata, in psa_ingress_output_metadata_t istd) { + apply { + } +} + +control egressDeparserImpl(packet_out buffer, out EMPTY_CLONE a, out EMPTY_RECIRC b, inout EMPTY_H c, in M d, in psa_egress_output_metadata_t e, in psa_egress_deparser_input_metadata_t f) { + apply { + } +} + +IngressPipeline(ParserI(), IngressI(), DeparserI()) ip; + +EgressPipeline(egressParserImpl(), egressControlImpl(), egressDeparserImpl()) ep; + +PSA_Switch(ip, PacketReplicationEngine(), ep, BufferingQueueingEngine()) main; + diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-same_name_for_table_and_action-midend.p4 b/testdata/p4_16_samples_outputs/psa-dpdk-same_name_for_table_and_action-midend.p4 new file mode 100644 index 00000000000..af833c9c349 --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-same_name_for_table_and_action-midend.p4 @@ -0,0 +1,79 @@ +#include +#include + +header EMPTY_H { +} + +struct EMPTY_RESUB { +} + +struct EMPTY_CLONE { +} + +struct EMPTY_BRIDGE { +} + +struct EMPTY_RECIRC { +} + +struct H { +} + +struct M { + bit<32> hash1; +} + +parser ParserI(packet_in pk, out H hdr, inout M meta, in psa_ingress_parser_input_metadata_t x, in EMPTY_RESUB resub_meta, in EMPTY_RECIRC recirc_meta) { + state start { + transition accept; + } +} + +parser egressParserImpl(packet_in buffer, out EMPTY_H a, inout M b, in psa_egress_parser_input_metadata_t c, in EMPTY_BRIDGE d, in EMPTY_CLONE e, in EMPTY_CLONE f) { + state start { + transition accept; + } +} + +control IngressI(inout H hdr, inout M meta, in psa_ingress_input_metadata_t istd, inout psa_ingress_output_metadata_t ostd) { + @noWarn("unused") @name(".NoAction") action NoAction_1() { + } + @name("IngressI.do_something") action do_something() { + ostd.drop = true; + } + @name("IngressI.do_something") table do_something_2 { + key = { + istd.ingress_port: exact @name("istd.ingress_port") ; + } + actions = { + do_something(); + NoAction_1(); + } + const default_action = NoAction_1(); + } + apply { + do_something_2.apply(); + } +} + +control egressControlImpl(inout EMPTY_H hdr, inout M meta, in psa_egress_input_metadata_t x, inout psa_egress_output_metadata_t ostd) { + apply { + } +} + +control DeparserI(packet_out pk, out EMPTY_CLONE clone_i2e_meta, out EMPTY_RESUB resubmit_meta, out EMPTY_BRIDGE normal_meta, inout H hdr, in M local_metadata, in psa_ingress_output_metadata_t istd) { + apply { + } +} + +control egressDeparserImpl(packet_out buffer, out EMPTY_CLONE a, out EMPTY_RECIRC b, inout EMPTY_H c, in M d, in psa_egress_output_metadata_t e, in psa_egress_deparser_input_metadata_t f) { + apply { + } +} + +IngressPipeline(ParserI(), IngressI(), DeparserI()) ip; + +EgressPipeline(egressParserImpl(), egressControlImpl(), egressDeparserImpl()) ep; + +PSA_Switch(ip, PacketReplicationEngine(), ep, BufferingQueueingEngine()) main; + diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-same_name_for_table_and_action.p4 b/testdata/p4_16_samples_outputs/psa-dpdk-same_name_for_table_and_action.p4 new file mode 100644 index 00000000000..5a723916244 --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-same_name_for_table_and_action.p4 @@ -0,0 +1,79 @@ +#include +#include + +header EMPTY_H { +} + +struct EMPTY_RESUB { +} + +struct EMPTY_CLONE { +} + +struct EMPTY_BRIDGE { +} + +struct EMPTY_RECIRC { +} + +struct H { +} + +struct M { + bit<32> hash1; +} + +parser ParserI(packet_in pk, out H hdr, inout M meta, in psa_ingress_parser_input_metadata_t x, in EMPTY_RESUB resub_meta, in EMPTY_RECIRC recirc_meta) { + state start { + transition accept; + } +} + +parser egressParserImpl(packet_in buffer, out EMPTY_H a, inout M b, in psa_egress_parser_input_metadata_t c, in EMPTY_BRIDGE d, in EMPTY_CLONE e, in EMPTY_CLONE f) { + state start { + transition accept; + } +} + +action empty() { +} +control IngressI(inout H hdr, inout M meta, in psa_ingress_input_metadata_t istd, inout psa_ingress_output_metadata_t ostd) { + @name("do_something") action do_something_0() { + ingress_drop(ostd); + } + @name("do_something") table do_something { + key = { + istd.ingress_port: exact; + } + actions = { + do_something_0; + NoAction; + } + const default_action = NoAction(); + } + apply { + do_something.apply(); + } +} + +control egressControlImpl(inout EMPTY_H hdr, inout M meta, in psa_egress_input_metadata_t x, inout psa_egress_output_metadata_t ostd) { + apply { + } +} + +control DeparserI(packet_out pk, out EMPTY_CLONE clone_i2e_meta, out EMPTY_RESUB resubmit_meta, out EMPTY_BRIDGE normal_meta, inout H hdr, in M local_metadata, in psa_ingress_output_metadata_t istd) { + apply { + } +} + +control egressDeparserImpl(packet_out buffer, out EMPTY_CLONE a, out EMPTY_RECIRC b, inout EMPTY_H c, in M d, in psa_egress_output_metadata_t e, in psa_egress_deparser_input_metadata_t f) { + apply { + } +} + +IngressPipeline(ParserI(), IngressI(), DeparserI()) ip; + +EgressPipeline(egressParserImpl(), egressControlImpl(), egressDeparserImpl()) ep; + +PSA_Switch(ip, PacketReplicationEngine(), ep, BufferingQueueingEngine()) main; + diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-same_name_for_table_and_action.p4-error b/testdata/p4_16_samples_outputs/psa-dpdk-same_name_for_table_and_action.p4-error new file mode 100644 index 00000000000..e69de29bb2d diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-same_name_for_table_and_action.p4-stderr b/testdata/p4_16_samples_outputs/psa-dpdk-same_name_for_table_and_action.p4-stderr new file mode 100644 index 00000000000..e69de29bb2d diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-same_name_for_table_and_action.p4.bfrt.json b/testdata/p4_16_samples_outputs/psa-dpdk-same_name_for_table_and_action.p4.bfrt.json new file mode 100644 index 00000000000..32ecea2fee0 --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-same_name_for_table_and_action.p4.bfrt.json @@ -0,0 +1,48 @@ +{ + "schema_version" : "1.0.0", + "tables" : [ + { + "name" : "ip.IngressI.do_something", + "id" : 46322784, + "table_type" : "MatchAction_Direct", + "size" : 1024, + "annotations" : [], + "depends_on" : [], + "has_const_default_action" : true, + "key" : [ + { + "id" : 1, + "name" : "istd.ingress_port", + "repeated" : false, + "annotations" : [], + "mandatory" : false, + "match_type" : "Exact", + "type" : { + "type" : "bytes", + "width" : 32 + } + } + ], + "action_specs" : [ + { + "id" : 29545568, + "name" : "IngressI.do_something", + "action_scope" : "TableAndDefault", + "annotations" : [], + "data" : [] + }, + { + "id" : 21257015, + "name" : "NoAction", + "action_scope" : "TableAndDefault", + "annotations" : [], + "data" : [] + } + ], + "data" : [], + "supported_operations" : [], + "attributes" : ["EntryScope"] + } + ], + "learn_filters" : [] +} \ No newline at end of file diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-same_name_for_table_and_action.p4.entries.txt b/testdata/p4_16_samples_outputs/psa-dpdk-same_name_for_table_and_action.p4.entries.txt new file mode 100644 index 00000000000..e69de29bb2d diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-same_name_for_table_and_action.p4.p4info.txt b/testdata/p4_16_samples_outputs/psa-dpdk-same_name_for_table_and_action.p4.p4info.txt new file mode 100644 index 00000000000..c147c2bd01a --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-same_name_for_table_and_action.p4.p4info.txt @@ -0,0 +1,53 @@ +pkg_info { + arch: "psa" +} +tables { + preamble { + id: 46322784 + name: "IngressI.do_something" + alias: "do_something" + } + match_fields { + id: 1 + name: "istd.ingress_port" + bitwidth: 32 + match_type: EXACT + type_name { + name: "PortId_t" + } + } + action_refs { + id: 29545568 + } + action_refs { + id: 21257015 + } + const_default_action_id: 21257015 + size: 1024 +} +actions { + preamble { + id: 21257015 + name: "NoAction" + alias: "NoAction" + annotations: "@noWarn(\"unused\")" + } +} +actions { + preamble { + id: 29545568 + name: "IngressI.do_something" + alias: "do_something" + } +} +type_info { + new_types { + key: "PortId_t" + value { + translated_type { + uri: "p4.org/psa/v1/PortId_t" + sdn_bitwidth: 32 + } + } + } +} diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-same_name_for_table_and_action.p4.spec b/testdata/p4_16_samples_outputs/psa-dpdk-same_name_for_table_and_action.p4.spec new file mode 100644 index 00000000000..40a41e8a14a --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-same_name_for_table_and_action.p4.spec @@ -0,0 +1,61 @@ + +struct psa_ingress_output_metadata_t { + bit<8> class_of_service + bit<8> clone + bit<16> clone_session_id + bit<8> drop + bit<8> resubmit + bit<32> multicast_group + bit<32> egress_port +} + +struct psa_egress_output_metadata_t { + bit<8> clone + bit<16> clone_session_id + bit<8> drop +} + +struct psa_egress_deparser_input_metadata_t { + bit<32> egress_port +} + + +struct M { + bit<32> psa_ingress_input_metadata_ingress_port + bit<8> psa_ingress_output_metadata_drop + bit<32> psa_ingress_output_metadata_egress_port +} +metadata instanceof M + +action NoAction args none { + return +} + +action do_something args none { + mov m.psa_ingress_output_metadata_drop 1 + return +} + +table do_something { + key { + m.psa_ingress_input_metadata_ingress_port exact + } + actions { + do_something + NoAction + } + default_action NoAction args none const + size 0x10000 +} + + +apply { + rx m.psa_ingress_input_metadata_ingress_port + mov m.psa_ingress_output_metadata_drop 0x0 + table do_something + jmpneq LABEL_DROP m.psa_ingress_output_metadata_drop 0x0 + tx m.psa_ingress_output_metadata_egress_port + LABEL_DROP : drop +} + + diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-table-entries-exact-ternary-bmv2.p4-error b/testdata/p4_16_samples_outputs/psa-dpdk-table-entries-exact-ternary-bmv2.p4-error new file mode 100644 index 00000000000..09eef65b582 --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-table-entries-exact-ternary-bmv2.p4-error @@ -0,0 +1,6 @@ +psa-dpdk-table-entries-exact-ternary-bmv2.p4(82): [--Wwarn=mismatch] warning: P4Runtime requires that Ternary matches have masked-off bits set to 0, updating value 16w0x1111 to conform to the P4Runtime specification + (0x01, 0x1111 &&& 0xF ) : a_with_control_params(1); + ^^^^^^ +psa-dpdk-table-entries-exact-ternary-bmv2.p4(84): [--Wwarn=mismatch] warning: P4Runtime requires that Ternary matches have masked-off bits set to 0, updating value 16w0x1111 to conform to the P4Runtime specification + (0x03, 0x1111 &&& 0xF000) : a_with_control_params(3); + ^^^^^^ diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-table-entries-exact-ternary-bmv2.p4.bfrt.json b/testdata/p4_16_samples_outputs/psa-dpdk-table-entries-exact-ternary-bmv2.p4.bfrt.json new file mode 100644 index 00000000000..001320ca54a --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-table-entries-exact-ternary-bmv2.p4.bfrt.json @@ -0,0 +1,84 @@ +{ + "schema_version" : "1.0.0", + "tables" : [ + { + "name" : "ip.ingress.t_exact_ternary", + "id" : 44168292, + "table_type" : "MatchAction_Direct", + "size" : 1024, + "annotations" : [], + "depends_on" : [], + "has_const_default_action" : false, + "key" : [ + { + "id" : 1, + "name" : "h.h.e", + "repeated" : false, + "annotations" : [], + "mandatory" : false, + "match_type" : "Exact", + "type" : { + "type" : "bytes", + "width" : 8 + } + }, + { + "id" : 2, + "name" : "h.h.t", + "repeated" : false, + "annotations" : [], + "mandatory" : false, + "match_type" : "Ternary", + "type" : { + "type" : "bytes", + "width" : 16 + } + }, + { + "id" : 65537, + "name" : "$MATCH_PRIORITY", + "repeated" : false, + "annotations" : [], + "mandatory" : false, + "match_type" : "Exact", + "type" : { + "type" : "uint32" + } + } + ], + "action_specs" : [ + { + "id" : 21186165, + "name" : "ingress.a", + "action_scope" : "TableAndDefault", + "annotations" : [], + "data" : [] + }, + { + "id" : 17165658, + "name" : "ingress.a_with_control_params", + "action_scope" : "TableAndDefault", + "annotations" : [], + "data" : [ + { + "id" : 1, + "name" : "x", + "repeated" : false, + "mandatory" : true, + "read_only" : false, + "annotations" : [], + "type" : { + "type" : "bytes", + "width" : 9 + } + } + ] + } + ], + "data" : [], + "supported_operations" : [], + "attributes" : ["EntryScope", "ConstTable"] + } + ], + "learn_filters" : [] +} \ No newline at end of file diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-table-entries-exact-ternary-bmv2.p4.spec b/testdata/p4_16_samples_outputs/psa-dpdk-table-entries-exact-ternary-bmv2.p4.spec new file mode 100644 index 00000000000..5376e151957 --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-table-entries-exact-ternary-bmv2.p4.spec @@ -0,0 +1,78 @@ + +struct hdr { + bit<8> e + bit<16> t + bit<8> l + bit<8> r + bit<8> v +} + +struct psa_ingress_output_metadata_t { + bit<8> class_of_service + bit<8> clone + bit<16> clone_session_id + bit<8> drop + bit<8> resubmit + bit<32> multicast_group + bit<32> egress_port +} + +struct psa_egress_output_metadata_t { + bit<8> clone + bit<16> clone_session_id + bit<8> drop +} + +struct psa_egress_deparser_input_metadata_t { + bit<32> egress_port +} + +struct a_with_control_params_arg_t { + bit<32> x +} + +header h instanceof hdr + +struct Meta_t { + bit<32> psa_ingress_input_metadata_ingress_port + bit<8> psa_ingress_output_metadata_drop + bit<32> psa_ingress_output_metadata_egress_port +} +metadata instanceof Meta_t + +action a_1 args none { + mov m.psa_ingress_output_metadata_egress_port 0x0 + return +} + +action a_with_control_params args instanceof a_with_control_params_arg_t { + mov m.psa_ingress_output_metadata_egress_port t.x + return +} + +table t_exact_ternary { + key { + h.h.e exact + h.h.t wildcard + } + actions { + a_1 + a_with_control_params + } + default_action a_1 args none + size 0x10000 +} + + +apply { + rx m.psa_ingress_input_metadata_ingress_port + mov m.psa_ingress_output_metadata_drop 0x0 + extract h.h + table t_exact_ternary + jmpneq LABEL_DROP m.psa_ingress_output_metadata_drop 0x0 + emit h.h + tx m.psa_ingress_output_metadata_egress_port + LABEL_DROP : drop +} + + diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-table-entries-exact-ternary-first.p4 b/testdata/p4_16_samples_outputs/psa-dpdk-table-entries-exact-ternary-first.p4 new file mode 100644 index 00000000000..b53330d699e --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-table-entries-exact-ternary-first.p4 @@ -0,0 +1,97 @@ +#include +#include + +header EMPTY_H { +} + +struct EMPTY_RESUB { +} + +struct EMPTY_CLONE { +} + +struct EMPTY_BRIDGE { +} + +struct EMPTY_RECIRC { +} + +header hdr { + bit<8> e; + bit<16> t; + bit<8> l; + bit<8> r; + bit<8> v; +} + +struct Header_t { + hdr h; +} + +struct Meta_t { +} + +parser p(packet_in b, out Header_t h, inout Meta_t m, in psa_ingress_parser_input_metadata_t x, in EMPTY_RESUB resub_meta, in EMPTY_RECIRC recirc_meta) { + state start { + b.extract(h.h); + transition accept; + } +} + +parser egressParserImpl(packet_in buffer, out EMPTY_H a, inout Meta_t b, in psa_egress_parser_input_metadata_t c, in EMPTY_BRIDGE d, in EMPTY_CLONE e, in EMPTY_CLONE f) { + state start { + transition accept; + } +} + +control ingress(inout Header_t h, inout Meta_t m, in psa_ingress_input_metadata_t istd, inout psa_ingress_output_metadata_t ostd) { + action a() { + ostd.egress_port = (PortId_t)32w0; + } + action a_with_control_params(bit<9> x) { + ostd.egress_port = (PortId_t)(PortIdUint_t)x; + } + table t_exact_ternary { + key = { + h.h.e: exact @name("h.h.e") ; + h.h.t: ternary @name("h.h.t") ; + } + actions = { + a(); + a_with_control_params(); + } + default_action = a(); + const entries = { + (8w0x1, 16w0x1111 &&& 16w0xf) : a_with_control_params(9w1); + (8w0x2, 16w0x1181) : a_with_control_params(9w2); + (8w0x3, 16w0x1111 &&& 16w0xf000) : a_with_control_params(9w3); + (8w0x4, default) : a_with_control_params(9w4); + } + } + apply { + t_exact_ternary.apply(); + } +} + +control egressControlImpl(inout EMPTY_H h, inout Meta_t meta, in psa_egress_input_metadata_t x, inout psa_egress_output_metadata_t ostd) { + apply { + } +} + +control deparser(packet_out b, out EMPTY_CLONE clone_i2e_meta, out EMPTY_RESUB resubmit_meta, out EMPTY_BRIDGE normal_meta, inout Header_t h, in Meta_t local_metadata, in psa_ingress_output_metadata_t istd) { + apply { + b.emit(h.h); + } +} + +control egressDeparserImpl(packet_out buffer, out EMPTY_CLONE a, out EMPTY_RECIRC b, inout EMPTY_H c, in Meta_t d, in psa_egress_output_metadata_t e, in psa_egress_deparser_input_metadata_t f) { + apply { + } +} + +IngressPipeline(p(), ingress(), deparser()) ip; + +EgressPipeline(egressParserImpl(), egressControlImpl(), egressDeparserImpl()) ep; + +PSA_Switch(ip, PacketReplicationEngine(), ep, BufferingQueueingEngine()) main; + diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-table-entries-exact-ternary-frontend.p4 b/testdata/p4_16_samples_outputs/psa-dpdk-table-entries-exact-ternary-frontend.p4 new file mode 100644 index 00000000000..2b7bb029427 --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-table-entries-exact-ternary-frontend.p4 @@ -0,0 +1,97 @@ +#include +#include + +header EMPTY_H { +} + +struct EMPTY_RESUB { +} + +struct EMPTY_CLONE { +} + +struct EMPTY_BRIDGE { +} + +struct EMPTY_RECIRC { +} + +header hdr { + bit<8> e; + bit<16> t; + bit<8> l; + bit<8> r; + bit<8> v; +} + +struct Header_t { + hdr h; +} + +struct Meta_t { +} + +parser p(packet_in b, out Header_t h, inout Meta_t m, in psa_ingress_parser_input_metadata_t x, in EMPTY_RESUB resub_meta, in EMPTY_RECIRC recirc_meta) { + state start { + b.extract(h.h); + transition accept; + } +} + +parser egressParserImpl(packet_in buffer, out EMPTY_H a, inout Meta_t b, in psa_egress_parser_input_metadata_t c, in EMPTY_BRIDGE d, in EMPTY_CLONE e, in EMPTY_CLONE f) { + state start { + transition accept; + } +} + +control ingress(inout Header_t h, inout Meta_t m, in psa_ingress_input_metadata_t istd, inout psa_ingress_output_metadata_t ostd) { + @name("ingress.a") action a_1() { + ostd.egress_port = (PortId_t)32w0; + } + @name("ingress.a_with_control_params") action a_with_control_params(@name("x") bit<9> x_1) { + ostd.egress_port = (PortId_t)(PortIdUint_t)x_1; + } + @name("ingress.t_exact_ternary") table t_exact_ternary_0 { + key = { + h.h.e: exact @name("h.h.e") ; + h.h.t: ternary @name("h.h.t") ; + } + actions = { + a_1(); + a_with_control_params(); + } + default_action = a_1(); + const entries = { + (8w0x1, 16w0x1111 &&& 16w0xf) : a_with_control_params(9w1); + (8w0x2, 16w0x1181) : a_with_control_params(9w2); + (8w0x3, 16w0x1111 &&& 16w0xf000) : a_with_control_params(9w3); + (8w0x4, default) : a_with_control_params(9w4); + } + } + apply { + t_exact_ternary_0.apply(); + } +} + +control egressControlImpl(inout EMPTY_H h, inout Meta_t meta, in psa_egress_input_metadata_t x, inout psa_egress_output_metadata_t ostd) { + apply { + } +} + +control deparser(packet_out b, out EMPTY_CLONE clone_i2e_meta, out EMPTY_RESUB resubmit_meta, out EMPTY_BRIDGE normal_meta, inout Header_t h, in Meta_t local_metadata, in psa_ingress_output_metadata_t istd) { + apply { + b.emit(h.h); + } +} + +control egressDeparserImpl(packet_out buffer, out EMPTY_CLONE a, out EMPTY_RECIRC b, inout EMPTY_H c, in Meta_t d, in psa_egress_output_metadata_t e, in psa_egress_deparser_input_metadata_t f) { + apply { + } +} + +IngressPipeline(p(), ingress(), deparser()) ip; + +EgressPipeline(egressParserImpl(), egressControlImpl(), egressDeparserImpl()) ep; + +PSA_Switch(ip, PacketReplicationEngine(), ep, BufferingQueueingEngine()) main; + diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-table-entries-exact-ternary-midend.p4 b/testdata/p4_16_samples_outputs/psa-dpdk-table-entries-exact-ternary-midend.p4 new file mode 100644 index 00000000000..f4c57ca9b3d --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-table-entries-exact-ternary-midend.p4 @@ -0,0 +1,106 @@ +#include +#include + +header EMPTY_H { +} + +struct EMPTY_RESUB { +} + +struct EMPTY_CLONE { +} + +struct EMPTY_BRIDGE { +} + +struct EMPTY_RECIRC { +} + +header hdr { + bit<8> e; + bit<16> t; + bit<8> l; + bit<8> r; + bit<8> v; +} + +struct Header_t { + hdr h; +} + +struct Meta_t { +} + +parser p(packet_in b, out Header_t h, inout Meta_t m, in psa_ingress_parser_input_metadata_t x, in EMPTY_RESUB resub_meta, in EMPTY_RECIRC recirc_meta) { + state start { + b.extract(h.h); + transition accept; + } +} + +parser egressParserImpl(packet_in buffer, out EMPTY_H a, inout Meta_t b, in psa_egress_parser_input_metadata_t c, in EMPTY_BRIDGE d, in EMPTY_CLONE e, in EMPTY_CLONE f) { + state start { + transition accept; + } +} + +control ingress(inout Header_t h, inout Meta_t m, in psa_ingress_input_metadata_t istd, inout psa_ingress_output_metadata_t ostd) { + @name("ingress.a") action a_1() { + ostd.egress_port = 32w0; + } + @name("ingress.a_with_control_params") action a_with_control_params(@name("x") bit<9> x_1) { + ostd.egress_port = (PortIdUint_t)x_1; + } + @name("ingress.t_exact_ternary") table t_exact_ternary_0 { + key = { + h.h.e: exact @name("h.h.e") ; + h.h.t: ternary @name("h.h.t") ; + } + actions = { + a_1(); + a_with_control_params(); + } + default_action = a_1(); + const entries = { + (8w0x1, 16w0x1111 &&& 16w0xf) : a_with_control_params(9w1); + (8w0x2, 16w0x1181) : a_with_control_params(9w2); + (8w0x3, 16w0x1111 &&& 16w0xf000) : a_with_control_params(9w3); + (8w0x4, default) : a_with_control_params(9w4); + } + } + apply { + t_exact_ternary_0.apply(); + } +} + +control egressControlImpl(inout EMPTY_H h, inout Meta_t meta, in psa_egress_input_metadata_t x, inout psa_egress_output_metadata_t ostd) { + apply { + } +} + +control deparser(packet_out b, out EMPTY_CLONE clone_i2e_meta, out EMPTY_RESUB resubmit_meta, out EMPTY_BRIDGE normal_meta, inout Header_t h, in Meta_t local_metadata, in psa_ingress_output_metadata_t istd) { + @hidden action psadpdktableentriesexactternary109() { + b.emit(h.h); + } + @hidden table tbl_psadpdktableentriesexactternary109 { + actions = { + psadpdktableentriesexactternary109(); + } + const default_action = psadpdktableentriesexactternary109(); + } + apply { + tbl_psadpdktableentriesexactternary109.apply(); + } +} + +control egressDeparserImpl(packet_out buffer, out EMPTY_CLONE a, out EMPTY_RECIRC b, inout EMPTY_H c, in Meta_t d, in psa_egress_output_metadata_t e, in psa_egress_deparser_input_metadata_t f) { + apply { + } +} + +IngressPipeline(p(), ingress(), deparser()) ip; + +EgressPipeline(egressParserImpl(), egressControlImpl(), egressDeparserImpl()) ep; + +PSA_Switch(ip, PacketReplicationEngine(), ep, BufferingQueueingEngine()) main; + diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-table-entries-exact-ternary.p4 b/testdata/p4_16_samples_outputs/psa-dpdk-table-entries-exact-ternary.p4 new file mode 100644 index 00000000000..e6f2aaaba89 --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-table-entries-exact-ternary.p4 @@ -0,0 +1,97 @@ +#include +#include + +header EMPTY_H { +} + +struct EMPTY_RESUB { +} + +struct EMPTY_CLONE { +} + +struct EMPTY_BRIDGE { +} + +struct EMPTY_RECIRC { +} + +header hdr { + bit<8> e; + bit<16> t; + bit<8> l; + bit<8> r; + bit<8> v; +} + +struct Header_t { + hdr h; +} + +struct Meta_t { +} + +parser p(packet_in b, out Header_t h, inout Meta_t m, in psa_ingress_parser_input_metadata_t x, in EMPTY_RESUB resub_meta, in EMPTY_RECIRC recirc_meta) { + state start { + b.extract(h.h); + transition accept; + } +} + +parser egressParserImpl(packet_in buffer, out EMPTY_H a, inout Meta_t b, in psa_egress_parser_input_metadata_t c, in EMPTY_BRIDGE d, in EMPTY_CLONE e, in EMPTY_CLONE f) { + state start { + transition accept; + } +} + +control ingress(inout Header_t h, inout Meta_t m, in psa_ingress_input_metadata_t istd, inout psa_ingress_output_metadata_t ostd) { + action a() { + ostd.egress_port = (PortId_t)(PortIdUint_t)0; + } + action a_with_control_params(bit<9> x) { + ostd.egress_port = (PortId_t)(PortIdUint_t)x; + } + table t_exact_ternary { + key = { + h.h.e: exact; + h.h.t: ternary; + } + actions = { + a; + a_with_control_params; + } + default_action = a; + const entries = { + (0x1, 0x1111 &&& 0xf) : a_with_control_params(1); + (0x2, 0x1181) : a_with_control_params(2); + (0x3, 0x1111 &&& 0xf000) : a_with_control_params(3); + (0x4, default) : a_with_control_params(4); + } + } + apply { + t_exact_ternary.apply(); + } +} + +control egressControlImpl(inout EMPTY_H h, inout Meta_t meta, in psa_egress_input_metadata_t x, inout psa_egress_output_metadata_t ostd) { + apply { + } +} + +control deparser(packet_out b, out EMPTY_CLONE clone_i2e_meta, out EMPTY_RESUB resubmit_meta, out EMPTY_BRIDGE normal_meta, inout Header_t h, in Meta_t local_metadata, in psa_ingress_output_metadata_t istd) { + apply { + b.emit(h.h); + } +} + +control egressDeparserImpl(packet_out buffer, out EMPTY_CLONE a, out EMPTY_RECIRC b, inout EMPTY_H c, in Meta_t d, in psa_egress_output_metadata_t e, in psa_egress_deparser_input_metadata_t f) { + apply { + } +} + +IngressPipeline(p(), ingress(), deparser()) ip; + +EgressPipeline(egressParserImpl(), egressControlImpl(), egressDeparserImpl()) ep; + +PSA_Switch(ip, PacketReplicationEngine(), ep, BufferingQueueingEngine()) main; + diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-table-entries-exact-ternary.p4-error b/testdata/p4_16_samples_outputs/psa-dpdk-table-entries-exact-ternary.p4-error new file mode 100644 index 00000000000..f2570171773 --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-table-entries-exact-ternary.p4-error @@ -0,0 +1,6 @@ +psa-dpdk-table-entries-exact-ternary.p4(82): [--Wwarn=mismatch] warning: P4Runtime requires that Ternary matches have masked-off bits set to 0, updating value 16w0x1111 to conform to the P4Runtime specification + (0x01, 0x1111 &&& 0xF ) : a_with_control_params(1); + ^^^^^^ +psa-dpdk-table-entries-exact-ternary.p4(84): [--Wwarn=mismatch] warning: P4Runtime requires that Ternary matches have masked-off bits set to 0, updating value 16w0x1111 to conform to the P4Runtime specification + (0x03, 0x1111 &&& 0xF000) : a_with_control_params(3); + ^^^^^^ diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-table-entries-exact-ternary.p4-stderr b/testdata/p4_16_samples_outputs/psa-dpdk-table-entries-exact-ternary.p4-stderr new file mode 100644 index 00000000000..f2570171773 --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-table-entries-exact-ternary.p4-stderr @@ -0,0 +1,6 @@ +psa-dpdk-table-entries-exact-ternary.p4(82): [--Wwarn=mismatch] warning: P4Runtime requires that Ternary matches have masked-off bits set to 0, updating value 16w0x1111 to conform to the P4Runtime specification + (0x01, 0x1111 &&& 0xF ) : a_with_control_params(1); + ^^^^^^ +psa-dpdk-table-entries-exact-ternary.p4(84): [--Wwarn=mismatch] warning: P4Runtime requires that Ternary matches have masked-off bits set to 0, updating value 16w0x1111 to conform to the P4Runtime specification + (0x03, 0x1111 &&& 0xF000) : a_with_control_params(3); + ^^^^^^ diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-table-entries-exact-ternary.p4.bfrt.json b/testdata/p4_16_samples_outputs/psa-dpdk-table-entries-exact-ternary.p4.bfrt.json new file mode 100644 index 00000000000..001320ca54a --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-table-entries-exact-ternary.p4.bfrt.json @@ -0,0 +1,84 @@ +{ + "schema_version" : "1.0.0", + "tables" : [ + { + "name" : "ip.ingress.t_exact_ternary", + "id" : 44168292, + "table_type" : "MatchAction_Direct", + "size" : 1024, + "annotations" : [], + "depends_on" : [], + "has_const_default_action" : false, + "key" : [ + { + "id" : 1, + "name" : "h.h.e", + "repeated" : false, + "annotations" : [], + "mandatory" : false, + "match_type" : "Exact", + "type" : { + "type" : "bytes", + "width" : 8 + } + }, + { + "id" : 2, + "name" : "h.h.t", + "repeated" : false, + "annotations" : [], + "mandatory" : false, + "match_type" : "Ternary", + "type" : { + "type" : "bytes", + "width" : 16 + } + }, + { + "id" : 65537, + "name" : "$MATCH_PRIORITY", + "repeated" : false, + "annotations" : [], + "mandatory" : false, + "match_type" : "Exact", + "type" : { + "type" : "uint32" + } + } + ], + "action_specs" : [ + { + "id" : 21186165, + "name" : "ingress.a", + "action_scope" : "TableAndDefault", + "annotations" : [], + "data" : [] + }, + { + "id" : 17165658, + "name" : "ingress.a_with_control_params", + "action_scope" : "TableAndDefault", + "annotations" : [], + "data" : [ + { + "id" : 1, + "name" : "x", + "repeated" : false, + "mandatory" : true, + "read_only" : false, + "annotations" : [], + "type" : { + "type" : "bytes", + "width" : 9 + } + } + ] + } + ], + "data" : [], + "supported_operations" : [], + "attributes" : ["EntryScope", "ConstTable"] + } + ], + "learn_filters" : [] +} \ No newline at end of file diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-table-entries-exact-ternary.p4.entries.txt b/testdata/p4_16_samples_outputs/psa-dpdk-table-entries-exact-ternary.p4.entries.txt new file mode 100644 index 00000000000..fd2d19bb199 --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-table-entries-exact-ternary.p4.entries.txt @@ -0,0 +1,117 @@ +updates { + type: INSERT + entity { + table_entry { + table_id: 44168292 + match { + field_id: 1 + exact { + value: "\001" + } + } + match { + field_id: 2 + ternary { + value: "\000\001" + mask: "\000\017" + } + } + action { + action { + action_id: 17165658 + params { + param_id: 1 + value: "\000\001" + } + } + } + priority: 4 + } + } +} +updates { + type: INSERT + entity { + table_entry { + table_id: 44168292 + match { + field_id: 1 + exact { + value: "\002" + } + } + match { + field_id: 2 + ternary { + value: "\021\201" + mask: "\377\377" + } + } + action { + action { + action_id: 17165658 + params { + param_id: 1 + value: "\000\002" + } + } + } + priority: 3 + } + } +} +updates { + type: INSERT + entity { + table_entry { + table_id: 44168292 + match { + field_id: 1 + exact { + value: "\003" + } + } + match { + field_id: 2 + ternary { + value: "\020\000" + mask: "\360\000" + } + } + action { + action { + action_id: 17165658 + params { + param_id: 1 + value: "\000\003" + } + } + } + priority: 2 + } + } +} +updates { + type: INSERT + entity { + table_entry { + table_id: 44168292 + match { + field_id: 1 + exact { + value: "\004" + } + } + action { + action { + action_id: 17165658 + params { + param_id: 1 + value: "\000\004" + } + } + } + priority: 1 + } + } +} diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-table-entries-exact-ternary.p4.p4info.txt b/testdata/p4_16_samples_outputs/psa-dpdk-table-entries-exact-ternary.p4.p4info.txt new file mode 100644 index 00000000000..3c4077510ce --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-table-entries-exact-ternary.p4.p4info.txt @@ -0,0 +1,51 @@ +pkg_info { + arch: "psa" +} +tables { + preamble { + id: 44168292 + name: "ingress.t_exact_ternary" + alias: "t_exact_ternary" + } + match_fields { + id: 1 + name: "h.h.e" + bitwidth: 8 + match_type: EXACT + } + match_fields { + id: 2 + name: "h.h.t" + bitwidth: 16 + match_type: TERNARY + } + action_refs { + id: 21186165 + } + action_refs { + id: 17165658 + } + size: 1024 + is_const_table: true +} +actions { + preamble { + id: 21186165 + name: "ingress.a" + alias: "a" + } +} +actions { + preamble { + id: 17165658 + name: "ingress.a_with_control_params" + alias: "a_with_control_params" + } + params { + id: 1 + name: "x" + bitwidth: 9 + } +} +type_info { +} diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-table-entries-exact-ternary.p4.spec b/testdata/p4_16_samples_outputs/psa-dpdk-table-entries-exact-ternary.p4.spec new file mode 100644 index 00000000000..5376e151957 --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-table-entries-exact-ternary.p4.spec @@ -0,0 +1,78 @@ + +struct hdr { + bit<8> e + bit<16> t + bit<8> l + bit<8> r + bit<8> v +} + +struct psa_ingress_output_metadata_t { + bit<8> class_of_service + bit<8> clone + bit<16> clone_session_id + bit<8> drop + bit<8> resubmit + bit<32> multicast_group + bit<32> egress_port +} + +struct psa_egress_output_metadata_t { + bit<8> clone + bit<16> clone_session_id + bit<8> drop +} + +struct psa_egress_deparser_input_metadata_t { + bit<32> egress_port +} + +struct a_with_control_params_arg_t { + bit<32> x +} + +header h instanceof hdr + +struct Meta_t { + bit<32> psa_ingress_input_metadata_ingress_port + bit<8> psa_ingress_output_metadata_drop + bit<32> psa_ingress_output_metadata_egress_port +} +metadata instanceof Meta_t + +action a_1 args none { + mov m.psa_ingress_output_metadata_egress_port 0x0 + return +} + +action a_with_control_params args instanceof a_with_control_params_arg_t { + mov m.psa_ingress_output_metadata_egress_port t.x + return +} + +table t_exact_ternary { + key { + h.h.e exact + h.h.t wildcard + } + actions { + a_1 + a_with_control_params + } + default_action a_1 args none + size 0x10000 +} + + +apply { + rx m.psa_ingress_input_metadata_ingress_port + mov m.psa_ingress_output_metadata_drop 0x0 + extract h.h + table t_exact_ternary + jmpneq LABEL_DROP m.psa_ingress_output_metadata_drop 0x0 + emit h.h + tx m.psa_ingress_output_metadata_egress_port + LABEL_DROP : drop +} + + diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-table-entries-valid-bmv2.p4-error b/testdata/p4_16_samples_outputs/psa-dpdk-table-entries-valid-bmv2.p4-error new file mode 100644 index 00000000000..2c37b84bd1a --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-table-entries-valid-bmv2.p4-error @@ -0,0 +1 @@ +[--Wwarn=mismatch] warning: Mismatched header/metadata struct for key elements in table t_valid. Copying all match fields to metadata diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-table-entries-valid-bmv2.p4.bfrt.json b/testdata/p4_16_samples_outputs/psa-dpdk-table-entries-valid-bmv2.p4.bfrt.json new file mode 100644 index 00000000000..b01da230f26 --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-table-entries-valid-bmv2.p4.bfrt.json @@ -0,0 +1,73 @@ +{ + "schema_version" : "1.0.0", + "tables" : [ + { + "name" : "ip.ingress.t_valid", + "id" : 40847808, + "table_type" : "MatchAction_Direct", + "size" : 1024, + "annotations" : [], + "depends_on" : [], + "has_const_default_action" : false, + "key" : [ + { + "id" : 1, + "name" : "h.h.$valid", + "repeated" : false, + "annotations" : [], + "mandatory" : false, + "match_type" : "Exact", + "type" : { + "type" : "bytes", + "width" : 1 + } + }, + { + "id" : 2, + "name" : "h.h.e", + "repeated" : false, + "annotations" : [], + "mandatory" : false, + "match_type" : "Exact", + "type" : { + "type" : "bytes", + "width" : 8 + } + } + ], + "action_specs" : [ + { + "id" : 21186165, + "name" : "ingress.a", + "action_scope" : "TableAndDefault", + "annotations" : [], + "data" : [] + }, + { + "id" : 17165658, + "name" : "ingress.a_with_control_params", + "action_scope" : "TableAndDefault", + "annotations" : [], + "data" : [ + { + "id" : 1, + "name" : "x", + "repeated" : false, + "mandatory" : true, + "read_only" : false, + "annotations" : [], + "type" : { + "type" : "bytes", + "width" : 9 + } + } + ] + } + ], + "data" : [], + "supported_operations" : [], + "attributes" : ["EntryScope", "ConstTable"] + } + ], + "learn_filters" : [] +} \ No newline at end of file diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-table-entries-valid-bmv2.p4.spec b/testdata/p4_16_samples_outputs/psa-dpdk-table-entries-valid-bmv2.p4.spec new file mode 100644 index 00000000000..bbd6841afcc --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-table-entries-valid-bmv2.p4.spec @@ -0,0 +1,84 @@ + +struct hdr { + bit<8> e + bit<16> t + bit<8> l + bit<8> r + bit<8> v +} + +struct psa_ingress_output_metadata_t { + bit<8> class_of_service + bit<8> clone + bit<16> clone_session_id + bit<8> drop + bit<8> resubmit + bit<32> multicast_group + bit<32> egress_port +} + +struct psa_egress_output_metadata_t { + bit<8> clone + bit<16> clone_session_id + bit<8> drop +} + +struct psa_egress_deparser_input_metadata_t { + bit<32> egress_port +} + +struct a_with_control_params_arg_t { + bit<32> x +} + +header h instanceof hdr + +struct Meta_t { + bit<32> psa_ingress_input_metadata_ingress_port + bit<8> psa_ingress_output_metadata_drop + bit<32> psa_ingress_output_metadata_egress_port + bit<8> ingress_t_valid_ingress_t_valid_isValid + bit<8> ingress_t_valid_ingress_t_valid_e +} +metadata instanceof Meta_t + +action a_1 args none { + mov m.psa_ingress_output_metadata_egress_port 0x0 + return +} + +action a_with_control_params args instanceof a_with_control_params_arg_t { + mov m.psa_ingress_output_metadata_egress_port t.x + return +} + +table t_valid { + key { + m.ingress_t_valid_ingress_t_valid_isValid exact + m.ingress_t_valid_ingress_t_valid_e exact + } + actions { + a_1 + a_with_control_params + } + default_action a_1 args none + size 0x10000 +} + + +apply { + rx m.psa_ingress_input_metadata_ingress_port + mov m.psa_ingress_output_metadata_drop 0x0 + extract h.h + mov m.ingress_t_valid_ingress_t_valid_isValid 1 + jmpv LABEL_END h.h + mov m.ingress_t_valid_ingress_t_valid_isValid 0 + LABEL_END : mov m.ingress_t_valid_ingress_t_valid_e h.h.e + table t_valid + jmpneq LABEL_DROP m.psa_ingress_output_metadata_drop 0x0 + emit h.h + tx m.psa_ingress_output_metadata_egress_port + LABEL_DROP : drop +} + + diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-table-entries-valid-first.p4 b/testdata/p4_16_samples_outputs/psa-dpdk-table-entries-valid-first.p4 new file mode 100644 index 00000000000..d14a2d7a8c9 --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-table-entries-valid-first.p4 @@ -0,0 +1,95 @@ +#include +#include + +header EMPTY_H { +} + +struct EMPTY_RESUB { +} + +struct EMPTY_CLONE { +} + +struct EMPTY_BRIDGE { +} + +struct EMPTY_RECIRC { +} + +header hdr { + bit<8> e; + bit<16> t; + bit<8> l; + bit<8> r; + bit<8> v; +} + +struct Header_t { + hdr h; +} + +struct Meta_t { +} + +parser p(packet_in b, out Header_t h, inout Meta_t m, in psa_ingress_parser_input_metadata_t x, in EMPTY_RESUB resub_meta, in EMPTY_RECIRC recirc_meta) { + state start { + b.extract(h.h); + transition accept; + } +} + +parser egressParserImpl(packet_in buffer, out EMPTY_H a, inout Meta_t b, in psa_egress_parser_input_metadata_t c, in EMPTY_BRIDGE d, in EMPTY_CLONE e, in EMPTY_CLONE f) { + state start { + transition accept; + } +} + +control ingress(inout Header_t h, inout Meta_t m, in psa_ingress_input_metadata_t istd, inout psa_ingress_output_metadata_t ostd) { + action a() { + ostd.egress_port = (PortId_t)32w0; + } + action a_with_control_params(bit<9> x) { + ostd.egress_port = (PortId_t)(PortIdUint_t)x; + } + table t_valid { + key = { + h.h.isValid(): exact @name("h.h.$valid$") ; + h.h.e : exact @name("h.h.e") ; + } + actions = { + a(); + a_with_control_params(); + } + default_action = a(); + const entries = { + (true, 8w0x1) : a_with_control_params(9w1); + (false, 8w0x2) : a_with_control_params(9w2); + } + } + apply { + t_valid.apply(); + } +} + +control egressControlImpl(inout EMPTY_H h, inout Meta_t meta, in psa_egress_input_metadata_t x, inout psa_egress_output_metadata_t ostd) { + apply { + } +} + +control deparser(packet_out b, out EMPTY_CLONE clone_i2e_meta, out EMPTY_RESUB resubmit_meta, out EMPTY_BRIDGE normal_meta, inout Header_t h, in Meta_t local_metadata, in psa_ingress_output_metadata_t istd) { + apply { + b.emit(h.h); + } +} + +control egressDeparserImpl(packet_out buffer, out EMPTY_CLONE a, out EMPTY_RECIRC b, inout EMPTY_H c, in Meta_t d, in psa_egress_output_metadata_t e, in psa_egress_deparser_input_metadata_t f) { + apply { + } +} + +IngressPipeline(p(), ingress(), deparser()) ip; + +EgressPipeline(egressParserImpl(), egressControlImpl(), egressDeparserImpl()) ep; + +PSA_Switch(ip, PacketReplicationEngine(), ep, BufferingQueueingEngine()) main; + diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-table-entries-valid-frontend.p4 b/testdata/p4_16_samples_outputs/psa-dpdk-table-entries-valid-frontend.p4 new file mode 100644 index 00000000000..0e984a99ff7 --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-table-entries-valid-frontend.p4 @@ -0,0 +1,95 @@ +#include +#include + +header EMPTY_H { +} + +struct EMPTY_RESUB { +} + +struct EMPTY_CLONE { +} + +struct EMPTY_BRIDGE { +} + +struct EMPTY_RECIRC { +} + +header hdr { + bit<8> e; + bit<16> t; + bit<8> l; + bit<8> r; + bit<8> v; +} + +struct Header_t { + hdr h; +} + +struct Meta_t { +} + +parser p(packet_in b, out Header_t h, inout Meta_t m, in psa_ingress_parser_input_metadata_t x, in EMPTY_RESUB resub_meta, in EMPTY_RECIRC recirc_meta) { + state start { + b.extract(h.h); + transition accept; + } +} + +parser egressParserImpl(packet_in buffer, out EMPTY_H a, inout Meta_t b, in psa_egress_parser_input_metadata_t c, in EMPTY_BRIDGE d, in EMPTY_CLONE e, in EMPTY_CLONE f) { + state start { + transition accept; + } +} + +control ingress(inout Header_t h, inout Meta_t m, in psa_ingress_input_metadata_t istd, inout psa_ingress_output_metadata_t ostd) { + @name("ingress.a") action a_1() { + ostd.egress_port = (PortId_t)32w0; + } + @name("ingress.a_with_control_params") action a_with_control_params(@name("x") bit<9> x_1) { + ostd.egress_port = (PortId_t)(PortIdUint_t)x_1; + } + @name("ingress.t_valid") table t_valid_0 { + key = { + h.h.isValid(): exact @name("h.h.$valid$") ; + h.h.e : exact @name("h.h.e") ; + } + actions = { + a_1(); + a_with_control_params(); + } + default_action = a_1(); + const entries = { + (true, 8w0x1) : a_with_control_params(9w1); + (false, 8w0x2) : a_with_control_params(9w2); + } + } + apply { + t_valid_0.apply(); + } +} + +control egressControlImpl(inout EMPTY_H h, inout Meta_t meta, in psa_egress_input_metadata_t x, inout psa_egress_output_metadata_t ostd) { + apply { + } +} + +control deparser(packet_out b, out EMPTY_CLONE clone_i2e_meta, out EMPTY_RESUB resubmit_meta, out EMPTY_BRIDGE normal_meta, inout Header_t h, in Meta_t local_metadata, in psa_ingress_output_metadata_t istd) { + apply { + b.emit(h.h); + } +} + +control egressDeparserImpl(packet_out buffer, out EMPTY_CLONE a, out EMPTY_RECIRC b, inout EMPTY_H c, in Meta_t d, in psa_egress_output_metadata_t e, in psa_egress_deparser_input_metadata_t f) { + apply { + } +} + +IngressPipeline(p(), ingress(), deparser()) ip; + +EgressPipeline(egressParserImpl(), egressControlImpl(), egressDeparserImpl()) ep; + +PSA_Switch(ip, PacketReplicationEngine(), ep, BufferingQueueingEngine()) main; + diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-table-entries-valid-midend.p4 b/testdata/p4_16_samples_outputs/psa-dpdk-table-entries-valid-midend.p4 new file mode 100644 index 00000000000..e5196a1d40f --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-table-entries-valid-midend.p4 @@ -0,0 +1,104 @@ +#include +#include + +header EMPTY_H { +} + +struct EMPTY_RESUB { +} + +struct EMPTY_CLONE { +} + +struct EMPTY_BRIDGE { +} + +struct EMPTY_RECIRC { +} + +header hdr { + bit<8> e; + bit<16> t; + bit<8> l; + bit<8> r; + bit<8> v; +} + +struct Header_t { + hdr h; +} + +struct Meta_t { +} + +parser p(packet_in b, out Header_t h, inout Meta_t m, in psa_ingress_parser_input_metadata_t x, in EMPTY_RESUB resub_meta, in EMPTY_RECIRC recirc_meta) { + state start { + b.extract(h.h); + transition accept; + } +} + +parser egressParserImpl(packet_in buffer, out EMPTY_H a, inout Meta_t b, in psa_egress_parser_input_metadata_t c, in EMPTY_BRIDGE d, in EMPTY_CLONE e, in EMPTY_CLONE f) { + state start { + transition accept; + } +} + +control ingress(inout Header_t h, inout Meta_t m, in psa_ingress_input_metadata_t istd, inout psa_ingress_output_metadata_t ostd) { + @name("ingress.a") action a_1() { + ostd.egress_port = 32w0; + } + @name("ingress.a_with_control_params") action a_with_control_params(@name("x") bit<9> x_1) { + ostd.egress_port = (PortIdUint_t)x_1; + } + @name("ingress.t_valid") table t_valid_0 { + key = { + h.h.isValid(): exact @name("h.h.$valid$") ; + h.h.e : exact @name("h.h.e") ; + } + actions = { + a_1(); + a_with_control_params(); + } + default_action = a_1(); + const entries = { + (true, 8w0x1) : a_with_control_params(9w1); + (false, 8w0x2) : a_with_control_params(9w2); + } + } + apply { + t_valid_0.apply(); + } +} + +control egressControlImpl(inout EMPTY_H h, inout Meta_t meta, in psa_egress_input_metadata_t x, inout psa_egress_output_metadata_t ostd) { + apply { + } +} + +control deparser(packet_out b, out EMPTY_CLONE clone_i2e_meta, out EMPTY_RESUB resubmit_meta, out EMPTY_BRIDGE normal_meta, inout Header_t h, in Meta_t local_metadata, in psa_ingress_output_metadata_t istd) { + @hidden action psadpdktableentriesvalid107() { + b.emit(h.h); + } + @hidden table tbl_psadpdktableentriesvalid107 { + actions = { + psadpdktableentriesvalid107(); + } + const default_action = psadpdktableentriesvalid107(); + } + apply { + tbl_psadpdktableentriesvalid107.apply(); + } +} + +control egressDeparserImpl(packet_out buffer, out EMPTY_CLONE a, out EMPTY_RECIRC b, inout EMPTY_H c, in Meta_t d, in psa_egress_output_metadata_t e, in psa_egress_deparser_input_metadata_t f) { + apply { + } +} + +IngressPipeline(p(), ingress(), deparser()) ip; + +EgressPipeline(egressParserImpl(), egressControlImpl(), egressDeparserImpl()) ep; + +PSA_Switch(ip, PacketReplicationEngine(), ep, BufferingQueueingEngine()) main; + diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-table-entries-valid.p4 b/testdata/p4_16_samples_outputs/psa-dpdk-table-entries-valid.p4 new file mode 100644 index 00000000000..c11f830ca67 --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-table-entries-valid.p4 @@ -0,0 +1,95 @@ +#include +#include + +header EMPTY_H { +} + +struct EMPTY_RESUB { +} + +struct EMPTY_CLONE { +} + +struct EMPTY_BRIDGE { +} + +struct EMPTY_RECIRC { +} + +header hdr { + bit<8> e; + bit<16> t; + bit<8> l; + bit<8> r; + bit<8> v; +} + +struct Header_t { + hdr h; +} + +struct Meta_t { +} + +parser p(packet_in b, out Header_t h, inout Meta_t m, in psa_ingress_parser_input_metadata_t x, in EMPTY_RESUB resub_meta, in EMPTY_RECIRC recirc_meta) { + state start { + b.extract(h.h); + transition accept; + } +} + +parser egressParserImpl(packet_in buffer, out EMPTY_H a, inout Meta_t b, in psa_egress_parser_input_metadata_t c, in EMPTY_BRIDGE d, in EMPTY_CLONE e, in EMPTY_CLONE f) { + state start { + transition accept; + } +} + +control ingress(inout Header_t h, inout Meta_t m, in psa_ingress_input_metadata_t istd, inout psa_ingress_output_metadata_t ostd) { + action a() { + ostd.egress_port = (PortId_t)(PortIdUint_t)0; + } + action a_with_control_params(bit<9> x) { + ostd.egress_port = (PortId_t)(PortIdUint_t)x; + } + table t_valid { + key = { + h.h.isValid(): exact; + h.h.e : exact; + } + actions = { + a; + a_with_control_params; + } + default_action = a; + const entries = { + (true, 0x1) : a_with_control_params(1); + (false, 0x2) : a_with_control_params(2); + } + } + apply { + t_valid.apply(); + } +} + +control egressControlImpl(inout EMPTY_H h, inout Meta_t meta, in psa_egress_input_metadata_t x, inout psa_egress_output_metadata_t ostd) { + apply { + } +} + +control deparser(packet_out b, out EMPTY_CLONE clone_i2e_meta, out EMPTY_RESUB resubmit_meta, out EMPTY_BRIDGE normal_meta, inout Header_t h, in Meta_t local_metadata, in psa_ingress_output_metadata_t istd) { + apply { + b.emit(h.h); + } +} + +control egressDeparserImpl(packet_out buffer, out EMPTY_CLONE a, out EMPTY_RECIRC b, inout EMPTY_H c, in Meta_t d, in psa_egress_output_metadata_t e, in psa_egress_deparser_input_metadata_t f) { + apply { + } +} + +IngressPipeline(p(), ingress(), deparser()) ip; + +EgressPipeline(egressParserImpl(), egressControlImpl(), egressDeparserImpl()) ep; + +PSA_Switch(ip, PacketReplicationEngine(), ep, BufferingQueueingEngine()) main; + diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-table-entries-valid.p4-error b/testdata/p4_16_samples_outputs/psa-dpdk-table-entries-valid.p4-error new file mode 100644 index 00000000000..2c37b84bd1a --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-table-entries-valid.p4-error @@ -0,0 +1 @@ +[--Wwarn=mismatch] warning: Mismatched header/metadata struct for key elements in table t_valid. Copying all match fields to metadata diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-table-entries-valid.p4-stderr b/testdata/p4_16_samples_outputs/psa-dpdk-table-entries-valid.p4-stderr new file mode 100644 index 00000000000..e69de29bb2d diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-table-entries-valid.p4.bfrt.json b/testdata/p4_16_samples_outputs/psa-dpdk-table-entries-valid.p4.bfrt.json new file mode 100644 index 00000000000..b01da230f26 --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-table-entries-valid.p4.bfrt.json @@ -0,0 +1,73 @@ +{ + "schema_version" : "1.0.0", + "tables" : [ + { + "name" : "ip.ingress.t_valid", + "id" : 40847808, + "table_type" : "MatchAction_Direct", + "size" : 1024, + "annotations" : [], + "depends_on" : [], + "has_const_default_action" : false, + "key" : [ + { + "id" : 1, + "name" : "h.h.$valid", + "repeated" : false, + "annotations" : [], + "mandatory" : false, + "match_type" : "Exact", + "type" : { + "type" : "bytes", + "width" : 1 + } + }, + { + "id" : 2, + "name" : "h.h.e", + "repeated" : false, + "annotations" : [], + "mandatory" : false, + "match_type" : "Exact", + "type" : { + "type" : "bytes", + "width" : 8 + } + } + ], + "action_specs" : [ + { + "id" : 21186165, + "name" : "ingress.a", + "action_scope" : "TableAndDefault", + "annotations" : [], + "data" : [] + }, + { + "id" : 17165658, + "name" : "ingress.a_with_control_params", + "action_scope" : "TableAndDefault", + "annotations" : [], + "data" : [ + { + "id" : 1, + "name" : "x", + "repeated" : false, + "mandatory" : true, + "read_only" : false, + "annotations" : [], + "type" : { + "type" : "bytes", + "width" : 9 + } + } + ] + } + ], + "data" : [], + "supported_operations" : [], + "attributes" : ["EntryScope", "ConstTable"] + } + ], + "learn_filters" : [] +} \ No newline at end of file diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-table-entries-valid.p4.entries.txt b/testdata/p4_16_samples_outputs/psa-dpdk-table-entries-valid.p4.entries.txt new file mode 100644 index 00000000000..837d6136c6a --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-table-entries-valid.p4.entries.txt @@ -0,0 +1,58 @@ +updates { + type: INSERT + entity { + table_entry { + table_id: 40847808 + match { + field_id: 1 + exact { + value: "\001" + } + } + match { + field_id: 2 + exact { + value: "\001" + } + } + action { + action { + action_id: 17165658 + params { + param_id: 1 + value: "\000\001" + } + } + } + } + } +} +updates { + type: INSERT + entity { + table_entry { + table_id: 40847808 + match { + field_id: 1 + exact { + value: "\000" + } + } + match { + field_id: 2 + exact { + value: "\002" + } + } + action { + action { + action_id: 17165658 + params { + param_id: 1 + value: "\000\002" + } + } + } + } + } +} diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-table-entries-valid.p4.p4info.txt b/testdata/p4_16_samples_outputs/psa-dpdk-table-entries-valid.p4.p4info.txt new file mode 100644 index 00000000000..0e460bd36a3 --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-table-entries-valid.p4.p4info.txt @@ -0,0 +1,51 @@ +pkg_info { + arch: "psa" +} +tables { + preamble { + id: 40847808 + name: "ingress.t_valid" + alias: "t_valid" + } + match_fields { + id: 1 + name: "h.h.$valid$" + bitwidth: 1 + match_type: EXACT + } + match_fields { + id: 2 + name: "h.h.e" + bitwidth: 8 + match_type: EXACT + } + action_refs { + id: 21186165 + } + action_refs { + id: 17165658 + } + size: 1024 + is_const_table: true +} +actions { + preamble { + id: 21186165 + name: "ingress.a" + alias: "a" + } +} +actions { + preamble { + id: 17165658 + name: "ingress.a_with_control_params" + alias: "a_with_control_params" + } + params { + id: 1 + name: "x" + bitwidth: 9 + } +} +type_info { +} diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-table-entries-valid.p4.spec b/testdata/p4_16_samples_outputs/psa-dpdk-table-entries-valid.p4.spec new file mode 100644 index 00000000000..bbd6841afcc --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-table-entries-valid.p4.spec @@ -0,0 +1,84 @@ + +struct hdr { + bit<8> e + bit<16> t + bit<8> l + bit<8> r + bit<8> v +} + +struct psa_ingress_output_metadata_t { + bit<8> class_of_service + bit<8> clone + bit<16> clone_session_id + bit<8> drop + bit<8> resubmit + bit<32> multicast_group + bit<32> egress_port +} + +struct psa_egress_output_metadata_t { + bit<8> clone + bit<16> clone_session_id + bit<8> drop +} + +struct psa_egress_deparser_input_metadata_t { + bit<32> egress_port +} + +struct a_with_control_params_arg_t { + bit<32> x +} + +header h instanceof hdr + +struct Meta_t { + bit<32> psa_ingress_input_metadata_ingress_port + bit<8> psa_ingress_output_metadata_drop + bit<32> psa_ingress_output_metadata_egress_port + bit<8> ingress_t_valid_ingress_t_valid_isValid + bit<8> ingress_t_valid_ingress_t_valid_e +} +metadata instanceof Meta_t + +action a_1 args none { + mov m.psa_ingress_output_metadata_egress_port 0x0 + return +} + +action a_with_control_params args instanceof a_with_control_params_arg_t { + mov m.psa_ingress_output_metadata_egress_port t.x + return +} + +table t_valid { + key { + m.ingress_t_valid_ingress_t_valid_isValid exact + m.ingress_t_valid_ingress_t_valid_e exact + } + actions { + a_1 + a_with_control_params + } + default_action a_1 args none + size 0x10000 +} + + +apply { + rx m.psa_ingress_input_metadata_ingress_port + mov m.psa_ingress_output_metadata_drop 0x0 + extract h.h + mov m.ingress_t_valid_ingress_t_valid_isValid 1 + jmpv LABEL_END h.h + mov m.ingress_t_valid_ingress_t_valid_isValid 0 + LABEL_END : mov m.ingress_t_valid_ingress_t_valid_e h.h.e + table t_valid + jmpneq LABEL_DROP m.psa_ingress_output_metadata_drop 0x0 + emit h.h + tx m.psa_ingress_output_metadata_egress_port + LABEL_DROP : drop +} + + diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-union4-bmv2.p4-error b/testdata/p4_16_samples_outputs/psa-dpdk-union4-bmv2.p4-error new file mode 100644 index 00000000000..0c9bfceff16 --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-union4-bmv2.p4-error @@ -0,0 +1,3 @@ +psa-dpdk-union4-bmv2.p4(92): [--Wwarn=invalid_header] warning: accessing a field of an invalid header h.u.h2 + h.u.h1.a = h.u.h2.b[7:0]; + ^^^^^^ diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-union4-bmv2.p4.bfrt.json b/testdata/p4_16_samples_outputs/psa-dpdk-union4-bmv2.p4.bfrt.json new file mode 100644 index 00000000000..b6d66a630db --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-union4-bmv2.p4.bfrt.json @@ -0,0 +1,5 @@ +{ + "schema_version" : "1.0.0", + "tables" : [], + "learn_filters" : [] +} \ No newline at end of file diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-union4-bmv2.p4.spec b/testdata/p4_16_samples_outputs/psa-dpdk-union4-bmv2.p4.spec new file mode 100644 index 00000000000..1325db51178 --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-union4-bmv2.p4.spec @@ -0,0 +1,64 @@ + +struct Hdr1 { + bit<8> a +} + +struct Hdr2 { + bit<16> b +} + +struct psa_ingress_output_metadata_t { + bit<8> class_of_service + bit<8> clone + bit<16> clone_session_id + bit<8> drop + bit<8> resubmit + bit<32> multicast_group + bit<32> egress_port +} + +struct psa_egress_output_metadata_t { + bit<8> clone + bit<16> clone_session_id + bit<8> drop +} + +struct psa_egress_deparser_input_metadata_t { + bit<32> egress_port +} + +header h1 instanceof Hdr1 +header u instanceof U +header h2 instanceof Hdr2 + +struct Meta { + bit<32> psa_ingress_input_metadata_ingress_port + bit<8> psa_ingress_output_metadata_drop + bit<32> psa_ingress_output_metadata_egress_port +} +metadata instanceof Meta + +apply { + rx m.psa_ingress_input_metadata_ingress_port + mov m.psa_ingress_output_metadata_drop 0x0 + extract h.h1 + jmpeq P_GETH1 h.h1.a 0x0 + extract h.u.h2 + jmp P_ACCEPT + P_GETH1 : extract h.u.h1 + P_ACCEPT : jmpnv LABEL_END h.u.h2 + validate h.h2 + mov h.h2.b h.u.h2.b + validate h.u.h1 + mov h.u.h1.a h.u.h2.b + invalidate h.u.h2 + LABEL_END : jmpneq LABEL_DROP m.psa_ingress_output_metadata_drop 0x0 + emit h.h1 + emit h.u.h1 + emit h.u.h2 + emit h.h2 + tx m.psa_ingress_output_metadata_egress_port + LABEL_DROP : drop +} + + diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-union4-first.p4 b/testdata/p4_16_samples_outputs/psa-dpdk-union4-first.p4 new file mode 100644 index 00000000000..c2a5845a136 --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-union4-first.p4 @@ -0,0 +1,100 @@ +#include +#include + +header EMPTY_H { +} + +struct EMPTY_RESUB { +} + +struct EMPTY_CLONE { +} + +struct EMPTY_BRIDGE { +} + +struct EMPTY_RECIRC { +} + +header Hdr1 { + bit<8> a; +} + +header Hdr2 { + bit<16> b; +} + +header_union U { + Hdr1 h1; + Hdr2 h2; +} + +struct Headers { + Hdr1 h1; + U u; + Hdr2 h2; +} + +struct Meta { +} + +parser p(packet_in b, out Headers h, inout Meta m, in psa_ingress_parser_input_metadata_t x, in EMPTY_RESUB resub_meta, in EMPTY_RECIRC recirc_meta) { + state start { + b.extract(h.h1); + transition select(h.h1.a) { + 8w0: getH1; + default: getH2; + } + } + state getH1 { + b.extract(h.u.h1); + transition accept; + } + state getH2 { + b.extract(h.u.h2); + transition accept; + } +} + +parser egressParserImpl(packet_in buffer, out EMPTY_H a, inout Meta b, in psa_egress_parser_input_metadata_t c, in EMPTY_BRIDGE d, in EMPTY_CLONE e, in EMPTY_CLONE f) { + state start { + transition accept; + } +} + +control ingress(inout Headers h, inout Meta m, in psa_ingress_input_metadata_t istd, inout psa_ingress_output_metadata_t ostd) { + apply { + if (h.u.h2.isValid()) { + h.h2.setValid(); + h.h2.b = h.u.h2.b; + h.u.h1.setValid(); + h.u.h1.a = h.u.h2.b[7:0]; + h.u.h2.setInvalid(); + } + } +} + +control egressControlImpl(inout EMPTY_H hdr, inout Meta meta, in psa_egress_input_metadata_t x, inout psa_egress_output_metadata_t ostd) { + apply { + } +} + +control deparser(packet_out b, out EMPTY_CLONE clone_i2e_meta, out EMPTY_RESUB resubmit_meta, out EMPTY_BRIDGE normal_meta, inout Headers h, in Meta local_metadata, in psa_ingress_output_metadata_t istd) { + apply { + b.emit(h.h1); + b.emit(h.u); + b.emit(h.h2); + } +} + +control egressDeparserImpl(packet_out buffer, out EMPTY_CLONE a, out EMPTY_RECIRC b, inout EMPTY_H c, in Meta d, in psa_egress_output_metadata_t e, in psa_egress_deparser_input_metadata_t f) { + apply { + } +} + +IngressPipeline(p(), ingress(), deparser()) ip; + +EgressPipeline(egressParserImpl(), egressControlImpl(), egressDeparserImpl()) ep; + +PSA_Switch(ip, PacketReplicationEngine(), ep, BufferingQueueingEngine()) main; + diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-union4-frontend.p4 b/testdata/p4_16_samples_outputs/psa-dpdk-union4-frontend.p4 new file mode 100644 index 00000000000..c2a5845a136 --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-union4-frontend.p4 @@ -0,0 +1,100 @@ +#include +#include + +header EMPTY_H { +} + +struct EMPTY_RESUB { +} + +struct EMPTY_CLONE { +} + +struct EMPTY_BRIDGE { +} + +struct EMPTY_RECIRC { +} + +header Hdr1 { + bit<8> a; +} + +header Hdr2 { + bit<16> b; +} + +header_union U { + Hdr1 h1; + Hdr2 h2; +} + +struct Headers { + Hdr1 h1; + U u; + Hdr2 h2; +} + +struct Meta { +} + +parser p(packet_in b, out Headers h, inout Meta m, in psa_ingress_parser_input_metadata_t x, in EMPTY_RESUB resub_meta, in EMPTY_RECIRC recirc_meta) { + state start { + b.extract(h.h1); + transition select(h.h1.a) { + 8w0: getH1; + default: getH2; + } + } + state getH1 { + b.extract(h.u.h1); + transition accept; + } + state getH2 { + b.extract(h.u.h2); + transition accept; + } +} + +parser egressParserImpl(packet_in buffer, out EMPTY_H a, inout Meta b, in psa_egress_parser_input_metadata_t c, in EMPTY_BRIDGE d, in EMPTY_CLONE e, in EMPTY_CLONE f) { + state start { + transition accept; + } +} + +control ingress(inout Headers h, inout Meta m, in psa_ingress_input_metadata_t istd, inout psa_ingress_output_metadata_t ostd) { + apply { + if (h.u.h2.isValid()) { + h.h2.setValid(); + h.h2.b = h.u.h2.b; + h.u.h1.setValid(); + h.u.h1.a = h.u.h2.b[7:0]; + h.u.h2.setInvalid(); + } + } +} + +control egressControlImpl(inout EMPTY_H hdr, inout Meta meta, in psa_egress_input_metadata_t x, inout psa_egress_output_metadata_t ostd) { + apply { + } +} + +control deparser(packet_out b, out EMPTY_CLONE clone_i2e_meta, out EMPTY_RESUB resubmit_meta, out EMPTY_BRIDGE normal_meta, inout Headers h, in Meta local_metadata, in psa_ingress_output_metadata_t istd) { + apply { + b.emit(h.h1); + b.emit(h.u); + b.emit(h.h2); + } +} + +control egressDeparserImpl(packet_out buffer, out EMPTY_CLONE a, out EMPTY_RECIRC b, inout EMPTY_H c, in Meta d, in psa_egress_output_metadata_t e, in psa_egress_deparser_input_metadata_t f) { + apply { + } +} + +IngressPipeline(p(), ingress(), deparser()) ip; + +EgressPipeline(egressParserImpl(), egressControlImpl(), egressDeparserImpl()) ep; + +PSA_Switch(ip, PacketReplicationEngine(), ep, BufferingQueueingEngine()) main; + diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-union4-midend.p4 b/testdata/p4_16_samples_outputs/psa-dpdk-union4-midend.p4 new file mode 100644 index 00000000000..3a00d92442b --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-union4-midend.p4 @@ -0,0 +1,119 @@ +#include +#include + +header EMPTY_H { +} + +struct EMPTY_RESUB { +} + +struct EMPTY_CLONE { +} + +struct EMPTY_BRIDGE { +} + +struct EMPTY_RECIRC { +} + +header Hdr1 { + bit<8> a; +} + +header Hdr2 { + bit<16> b; +} + +header_union U { + Hdr1 h1; + Hdr2 h2; +} + +struct Headers { + Hdr1 h1; + U u; + Hdr2 h2; +} + +struct Meta { +} + +parser p(packet_in b, out Headers h, inout Meta m, in psa_ingress_parser_input_metadata_t x, in EMPTY_RESUB resub_meta, in EMPTY_RECIRC recirc_meta) { + state start { + b.extract(h.h1); + transition select(h.h1.a) { + 8w0: getH1; + default: getH2; + } + } + state getH1 { + b.extract(h.u.h1); + transition accept; + } + state getH2 { + b.extract(h.u.h2); + transition accept; + } +} + +parser egressParserImpl(packet_in buffer, out EMPTY_H a, inout Meta b, in psa_egress_parser_input_metadata_t c, in EMPTY_BRIDGE d, in EMPTY_CLONE e, in EMPTY_CLONE f) { + state start { + transition accept; + } +} + +control ingress(inout Headers h, inout Meta m, in psa_ingress_input_metadata_t istd, inout psa_ingress_output_metadata_t ostd) { + @hidden action psadpdkunion4l89() { + h.h2.setValid(); + h.h2.b = h.u.h2.b; + h.u.h1.setValid(); + h.u.h1.a = h.u.h2.b[7:0]; + h.u.h2.setInvalid(); + } + @hidden table tbl_psadpdkunion4l89 { + actions = { + psadpdkunion4l89(); + } + const default_action = psadpdkunion4l89(); + } + apply { + if (h.u.h2.isValid()) { + tbl_psadpdkunion4l89.apply(); + } + } +} + +control egressControlImpl(inout EMPTY_H hdr, inout Meta meta, in psa_egress_input_metadata_t x, inout psa_egress_output_metadata_t ostd) { + apply { + } +} + +control deparser(packet_out b, out EMPTY_CLONE clone_i2e_meta, out EMPTY_RESUB resubmit_meta, out EMPTY_BRIDGE normal_meta, inout Headers h, in Meta local_metadata, in psa_ingress_output_metadata_t istd) { + @hidden action psadpdkunion4l113() { + b.emit(h.h1); + b.emit(h.u.h1); + b.emit(h.u.h2); + b.emit(h.h2); + } + @hidden table tbl_psadpdkunion4l113 { + actions = { + psadpdkunion4l113(); + } + const default_action = psadpdkunion4l113(); + } + apply { + tbl_psadpdkunion4l113.apply(); + } +} + +control egressDeparserImpl(packet_out buffer, out EMPTY_CLONE a, out EMPTY_RECIRC b, inout EMPTY_H c, in Meta d, in psa_egress_output_metadata_t e, in psa_egress_deparser_input_metadata_t f) { + apply { + } +} + +IngressPipeline(p(), ingress(), deparser()) ip; + +EgressPipeline(egressParserImpl(), egressControlImpl(), egressDeparserImpl()) ep; + +PSA_Switch(ip, PacketReplicationEngine(), ep, BufferingQueueingEngine()) main; + diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-union4.p4 b/testdata/p4_16_samples_outputs/psa-dpdk-union4.p4 new file mode 100644 index 00000000000..dc6277eca76 --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-union4.p4 @@ -0,0 +1,100 @@ +#include +#include + +header EMPTY_H { +} + +struct EMPTY_RESUB { +} + +struct EMPTY_CLONE { +} + +struct EMPTY_BRIDGE { +} + +struct EMPTY_RECIRC { +} + +header Hdr1 { + bit<8> a; +} + +header Hdr2 { + bit<16> b; +} + +header_union U { + Hdr1 h1; + Hdr2 h2; +} + +struct Headers { + Hdr1 h1; + U u; + Hdr2 h2; +} + +struct Meta { +} + +parser p(packet_in b, out Headers h, inout Meta m, in psa_ingress_parser_input_metadata_t x, in EMPTY_RESUB resub_meta, in EMPTY_RECIRC recirc_meta) { + state start { + b.extract(h.h1); + transition select(h.h1.a) { + 0: getH1; + default: getH2; + } + } + state getH1 { + b.extract(h.u.h1); + transition accept; + } + state getH2 { + b.extract(h.u.h2); + transition accept; + } +} + +parser egressParserImpl(packet_in buffer, out EMPTY_H a, inout Meta b, in psa_egress_parser_input_metadata_t c, in EMPTY_BRIDGE d, in EMPTY_CLONE e, in EMPTY_CLONE f) { + state start { + transition accept; + } +} + +control ingress(inout Headers h, inout Meta m, in psa_ingress_input_metadata_t istd, inout psa_ingress_output_metadata_t ostd) { + apply { + if (h.u.h2.isValid()) { + h.h2.setValid(); + h.h2.b = h.u.h2.b; + h.u.h1.setValid(); + h.u.h1.a = h.u.h2.b[7:0]; + h.u.h2.setInvalid(); + } + } +} + +control egressControlImpl(inout EMPTY_H hdr, inout Meta meta, in psa_egress_input_metadata_t x, inout psa_egress_output_metadata_t ostd) { + apply { + } +} + +control deparser(packet_out b, out EMPTY_CLONE clone_i2e_meta, out EMPTY_RESUB resubmit_meta, out EMPTY_BRIDGE normal_meta, inout Headers h, in Meta local_metadata, in psa_ingress_output_metadata_t istd) { + apply { + b.emit(h.h1); + b.emit(h.u); + b.emit(h.h2); + } +} + +control egressDeparserImpl(packet_out buffer, out EMPTY_CLONE a, out EMPTY_RECIRC b, inout EMPTY_H c, in Meta d, in psa_egress_output_metadata_t e, in psa_egress_deparser_input_metadata_t f) { + apply { + } +} + +IngressPipeline(p(), ingress(), deparser()) ip; + +EgressPipeline(egressParserImpl(), egressControlImpl(), egressDeparserImpl()) ep; + +PSA_Switch(ip, PacketReplicationEngine(), ep, BufferingQueueingEngine()) main; + diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-union4.p4-error b/testdata/p4_16_samples_outputs/psa-dpdk-union4.p4-error new file mode 100644 index 00000000000..06714d87398 --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-union4.p4-error @@ -0,0 +1,3 @@ +psa-dpdk-union4.p4(92): [--Wwarn=invalid_header] warning: accessing a field of an invalid header h.u.h2 + h.u.h1.a = h.u.h2.b[7:0]; + ^^^^^^ diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-union4.p4-stderr b/testdata/p4_16_samples_outputs/psa-dpdk-union4.p4-stderr new file mode 100644 index 00000000000..06714d87398 --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-union4.p4-stderr @@ -0,0 +1,3 @@ +psa-dpdk-union4.p4(92): [--Wwarn=invalid_header] warning: accessing a field of an invalid header h.u.h2 + h.u.h1.a = h.u.h2.b[7:0]; + ^^^^^^ diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-union4.p4.bfrt.json b/testdata/p4_16_samples_outputs/psa-dpdk-union4.p4.bfrt.json new file mode 100644 index 00000000000..b6d66a630db --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-union4.p4.bfrt.json @@ -0,0 +1,5 @@ +{ + "schema_version" : "1.0.0", + "tables" : [], + "learn_filters" : [] +} \ No newline at end of file diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-union4.p4.entries.txt b/testdata/p4_16_samples_outputs/psa-dpdk-union4.p4.entries.txt new file mode 100644 index 00000000000..e69de29bb2d diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-union4.p4.p4info.txt b/testdata/p4_16_samples_outputs/psa-dpdk-union4.p4.p4info.txt new file mode 100644 index 00000000000..77612386454 --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-union4.p4.p4info.txt @@ -0,0 +1,3 @@ +pkg_info { + arch: "psa" +} diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-union4.p4.spec b/testdata/p4_16_samples_outputs/psa-dpdk-union4.p4.spec new file mode 100644 index 00000000000..1325db51178 --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-union4.p4.spec @@ -0,0 +1,64 @@ + +struct Hdr1 { + bit<8> a +} + +struct Hdr2 { + bit<16> b +} + +struct psa_ingress_output_metadata_t { + bit<8> class_of_service + bit<8> clone + bit<16> clone_session_id + bit<8> drop + bit<8> resubmit + bit<32> multicast_group + bit<32> egress_port +} + +struct psa_egress_output_metadata_t { + bit<8> clone + bit<16> clone_session_id + bit<8> drop +} + +struct psa_egress_deparser_input_metadata_t { + bit<32> egress_port +} + +header h1 instanceof Hdr1 +header u instanceof U +header h2 instanceof Hdr2 + +struct Meta { + bit<32> psa_ingress_input_metadata_ingress_port + bit<8> psa_ingress_output_metadata_drop + bit<32> psa_ingress_output_metadata_egress_port +} +metadata instanceof Meta + +apply { + rx m.psa_ingress_input_metadata_ingress_port + mov m.psa_ingress_output_metadata_drop 0x0 + extract h.h1 + jmpeq P_GETH1 h.h1.a 0x0 + extract h.u.h2 + jmp P_ACCEPT + P_GETH1 : extract h.u.h1 + P_ACCEPT : jmpnv LABEL_END h.u.h2 + validate h.h2 + mov h.h2.b h.u.h2.b + validate h.u.h1 + mov h.u.h1.a h.u.h2.b + invalidate h.u.h2 + LABEL_END : jmpneq LABEL_DROP m.psa_ingress_output_metadata_drop 0x0 + emit h.h1 + emit h.u.h1 + emit h.u.h2 + emit h.h2 + tx m.psa_ingress_output_metadata_egress_port + LABEL_DROP : drop +} + + diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-x-bmv2.p4-error b/testdata/p4_16_samples_outputs/psa-dpdk-x-bmv2.p4-error new file mode 100644 index 00000000000..e69de29bb2d diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-x-bmv2.p4.bfrt.json b/testdata/p4_16_samples_outputs/psa-dpdk-x-bmv2.p4.bfrt.json new file mode 100644 index 00000000000..b6d66a630db --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-x-bmv2.p4.bfrt.json @@ -0,0 +1,5 @@ +{ + "schema_version" : "1.0.0", + "tables" : [], + "learn_filters" : [] +} \ No newline at end of file diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-x-bmv2.p4.spec b/testdata/p4_16_samples_outputs/psa-dpdk-x-bmv2.p4.spec new file mode 100644 index 00000000000..25829e92988 --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-x-bmv2.p4.spec @@ -0,0 +1,43 @@ + +struct T { + bit<32> y +} + +struct psa_ingress_output_metadata_t { + bit<8> class_of_service + bit<8> clone + bit<16> clone_session_id + bit<8> drop + bit<8> resubmit + bit<32> multicast_group + bit<32> egress_port +} + +struct psa_egress_output_metadata_t { + bit<8> clone + bit<16> clone_session_id + bit<8> drop +} + +struct psa_egress_deparser_input_metadata_t { + bit<32> egress_port +} + +header s instanceof T + +struct M { + bit<32> psa_ingress_input_metadata_ingress_port + bit<8> psa_ingress_output_metadata_drop + bit<32> psa_ingress_output_metadata_egress_port +} +metadata instanceof M + +apply { + rx m.psa_ingress_input_metadata_ingress_port + mov m.psa_ingress_output_metadata_drop 0x0 + jmpneq LABEL_DROP m.psa_ingress_output_metadata_drop 0x0 + tx m.psa_ingress_output_metadata_egress_port + LABEL_DROP : drop +} + + diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-x-first.p4 b/testdata/p4_16_samples_outputs/psa-dpdk-x-first.p4 new file mode 100644 index 00000000000..d73e2e05946 --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-x-first.p4 @@ -0,0 +1,79 @@ +#include +#include + +header EMPTY_H { +} + +struct EMPTY_RESUB { +} + +struct EMPTY_CLONE { +} + +struct EMPTY_BRIDGE { +} + +struct EMPTY_RECIRC { +} + +struct S { + bit<32> x; +} + +header T { + bit<32> y; +} + +struct H { + T s; +} + +struct M { + S s; +} + +parser ParserI(packet_in b, out H parsedHdr, inout M meta, in psa_ingress_parser_input_metadata_t x, in EMPTY_RESUB resub_meta, in EMPTY_RECIRC recirc_meta) { + state start { + transition accept; + } +} + +parser egressParserImpl(packet_in buffer, out EMPTY_H a, inout M b, in psa_egress_parser_input_metadata_t c, in EMPTY_BRIDGE d, in EMPTY_CLONE e, in EMPTY_CLONE f) { + state start { + transition accept; + } +} + +control ctrl(inout M meta) { + apply { + } +} + +control IngressI(inout H hdr, inout M meta, in psa_ingress_input_metadata_t istd, inout psa_ingress_output_metadata_t ostd) { + ctrl() do_ctrl; + apply { + do_ctrl.apply(meta); + } +} + +control egressControlImpl(inout EMPTY_H hdr, inout M meta, in psa_egress_input_metadata_t x, inout psa_egress_output_metadata_t ostd) { + apply { + } +} + +control DeparserI(packet_out b, out EMPTY_CLONE clone_i2e_meta, out EMPTY_RESUB resubmit_meta, out EMPTY_BRIDGE normal_meta, inout H h, in M local_metadata, in psa_ingress_output_metadata_t istd) { + apply { + } +} + +control egressDeparserImpl(packet_out buffer, out EMPTY_CLONE a, out EMPTY_RECIRC b, inout EMPTY_H c, in M d, in psa_egress_output_metadata_t e, in psa_egress_deparser_input_metadata_t f) { + apply { + } +} + +IngressPipeline(ParserI(), IngressI(), DeparserI()) ip; + +EgressPipeline(egressParserImpl(), egressControlImpl(), egressDeparserImpl()) ep; + +PSA_Switch(ip, PacketReplicationEngine(), ep, BufferingQueueingEngine()) main; + diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-x-frontend.p4 b/testdata/p4_16_samples_outputs/psa-dpdk-x-frontend.p4 new file mode 100644 index 00000000000..ba6d097c81b --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-x-frontend.p4 @@ -0,0 +1,72 @@ +#include +#include + +header EMPTY_H { +} + +struct EMPTY_RESUB { +} + +struct EMPTY_CLONE { +} + +struct EMPTY_BRIDGE { +} + +struct EMPTY_RECIRC { +} + +struct S { + bit<32> x; +} + +header T { + bit<32> y; +} + +struct H { + T s; +} + +struct M { + S s; +} + +parser ParserI(packet_in b, out H parsedHdr, inout M meta, in psa_ingress_parser_input_metadata_t x, in EMPTY_RESUB resub_meta, in EMPTY_RECIRC recirc_meta) { + state start { + transition accept; + } +} + +parser egressParserImpl(packet_in buffer, out EMPTY_H a, inout M b, in psa_egress_parser_input_metadata_t c, in EMPTY_BRIDGE d, in EMPTY_CLONE e, in EMPTY_CLONE f) { + state start { + transition accept; + } +} + +control IngressI(inout H hdr, inout M meta, in psa_ingress_input_metadata_t istd, inout psa_ingress_output_metadata_t ostd) { + apply { + } +} + +control egressControlImpl(inout EMPTY_H hdr, inout M meta, in psa_egress_input_metadata_t x, inout psa_egress_output_metadata_t ostd) { + apply { + } +} + +control DeparserI(packet_out b, out EMPTY_CLONE clone_i2e_meta, out EMPTY_RESUB resubmit_meta, out EMPTY_BRIDGE normal_meta, inout H h, in M local_metadata, in psa_ingress_output_metadata_t istd) { + apply { + } +} + +control egressDeparserImpl(packet_out buffer, out EMPTY_CLONE a, out EMPTY_RECIRC b, inout EMPTY_H c, in M d, in psa_egress_output_metadata_t e, in psa_egress_deparser_input_metadata_t f) { + apply { + } +} + +IngressPipeline(ParserI(), IngressI(), DeparserI()) ip; + +EgressPipeline(egressParserImpl(), egressControlImpl(), egressDeparserImpl()) ep; + +PSA_Switch(ip, PacketReplicationEngine(), ep, BufferingQueueingEngine()) main; + diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-x-midend.p4 b/testdata/p4_16_samples_outputs/psa-dpdk-x-midend.p4 new file mode 100644 index 00000000000..b071b762904 --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-x-midend.p4 @@ -0,0 +1,72 @@ +#include +#include + +header EMPTY_H { +} + +struct EMPTY_RESUB { +} + +struct EMPTY_CLONE { +} + +struct EMPTY_BRIDGE { +} + +struct EMPTY_RECIRC { +} + +struct S { + bit<32> x; +} + +header T { + bit<32> y; +} + +struct H { + T s; +} + +struct M { + bit<32> _s_x0; +} + +parser ParserI(packet_in b, out H parsedHdr, inout M meta, in psa_ingress_parser_input_metadata_t x, in EMPTY_RESUB resub_meta, in EMPTY_RECIRC recirc_meta) { + state start { + transition accept; + } +} + +parser egressParserImpl(packet_in buffer, out EMPTY_H a, inout M b, in psa_egress_parser_input_metadata_t c, in EMPTY_BRIDGE d, in EMPTY_CLONE e, in EMPTY_CLONE f) { + state start { + transition accept; + } +} + +control IngressI(inout H hdr, inout M meta, in psa_ingress_input_metadata_t istd, inout psa_ingress_output_metadata_t ostd) { + apply { + } +} + +control egressControlImpl(inout EMPTY_H hdr, inout M meta, in psa_egress_input_metadata_t x, inout psa_egress_output_metadata_t ostd) { + apply { + } +} + +control DeparserI(packet_out b, out EMPTY_CLONE clone_i2e_meta, out EMPTY_RESUB resubmit_meta, out EMPTY_BRIDGE normal_meta, inout H h, in M local_metadata, in psa_ingress_output_metadata_t istd) { + apply { + } +} + +control egressDeparserImpl(packet_out buffer, out EMPTY_CLONE a, out EMPTY_RECIRC b, inout EMPTY_H c, in M d, in psa_egress_output_metadata_t e, in psa_egress_deparser_input_metadata_t f) { + apply { + } +} + +IngressPipeline(ParserI(), IngressI(), DeparserI()) ip; + +EgressPipeline(egressParserImpl(), egressControlImpl(), egressDeparserImpl()) ep; + +PSA_Switch(ip, PacketReplicationEngine(), ep, BufferingQueueingEngine()) main; + diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-x.p4 b/testdata/p4_16_samples_outputs/psa-dpdk-x.p4 new file mode 100644 index 00000000000..05c2b7abedb --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-x.p4 @@ -0,0 +1,79 @@ +#include +#include + +header EMPTY_H { +} + +struct EMPTY_RESUB { +} + +struct EMPTY_CLONE { +} + +struct EMPTY_BRIDGE { +} + +struct EMPTY_RECIRC { +} + +struct S { + bit<32> x; +} + +header T { + bit<32> y; +} + +struct H { + T s; +} + +struct M { + S s; +} + +parser ParserI(packet_in b, out H parsedHdr, inout M meta, in psa_ingress_parser_input_metadata_t x, in EMPTY_RESUB resub_meta, in EMPTY_RECIRC recirc_meta) { + state start { + transition accept; + } +} + +parser egressParserImpl(packet_in buffer, out EMPTY_H a, inout M b, in psa_egress_parser_input_metadata_t c, in EMPTY_BRIDGE d, in EMPTY_CLONE e, in EMPTY_CLONE f) { + state start { + transition accept; + } +} + +control ctrl(inout M meta) { + apply { + } +} + +control IngressI(inout H hdr, inout M meta, in psa_ingress_input_metadata_t istd, inout psa_ingress_output_metadata_t ostd) { + ctrl() do_ctrl; + apply { + do_ctrl.apply(meta); + } +} + +control egressControlImpl(inout EMPTY_H hdr, inout M meta, in psa_egress_input_metadata_t x, inout psa_egress_output_metadata_t ostd) { + apply { + } +} + +control DeparserI(packet_out b, out EMPTY_CLONE clone_i2e_meta, out EMPTY_RESUB resubmit_meta, out EMPTY_BRIDGE normal_meta, inout H h, in M local_metadata, in psa_ingress_output_metadata_t istd) { + apply { + } +} + +control egressDeparserImpl(packet_out buffer, out EMPTY_CLONE a, out EMPTY_RECIRC b, inout EMPTY_H c, in M d, in psa_egress_output_metadata_t e, in psa_egress_deparser_input_metadata_t f) { + apply { + } +} + +IngressPipeline(ParserI(), IngressI(), DeparserI()) ip; + +EgressPipeline(egressParserImpl(), egressControlImpl(), egressDeparserImpl()) ep; + +PSA_Switch(ip, PacketReplicationEngine(), ep, BufferingQueueingEngine()) main; + diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-x.p4-error b/testdata/p4_16_samples_outputs/psa-dpdk-x.p4-error new file mode 100644 index 00000000000..e69de29bb2d diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-x.p4-stderr b/testdata/p4_16_samples_outputs/psa-dpdk-x.p4-stderr new file mode 100644 index 00000000000..e69de29bb2d diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-x.p4.bfrt.json b/testdata/p4_16_samples_outputs/psa-dpdk-x.p4.bfrt.json new file mode 100644 index 00000000000..b6d66a630db --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-x.p4.bfrt.json @@ -0,0 +1,5 @@ +{ + "schema_version" : "1.0.0", + "tables" : [], + "learn_filters" : [] +} \ No newline at end of file diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-x.p4.entries.txt b/testdata/p4_16_samples_outputs/psa-dpdk-x.p4.entries.txt new file mode 100644 index 00000000000..e69de29bb2d diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-x.p4.p4info.txt b/testdata/p4_16_samples_outputs/psa-dpdk-x.p4.p4info.txt new file mode 100644 index 00000000000..77612386454 --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-x.p4.p4info.txt @@ -0,0 +1,3 @@ +pkg_info { + arch: "psa" +} diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-x.p4.spec b/testdata/p4_16_samples_outputs/psa-dpdk-x.p4.spec new file mode 100644 index 00000000000..25829e92988 --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-x.p4.spec @@ -0,0 +1,43 @@ + +struct T { + bit<32> y +} + +struct psa_ingress_output_metadata_t { + bit<8> class_of_service + bit<8> clone + bit<16> clone_session_id + bit<8> drop + bit<8> resubmit + bit<32> multicast_group + bit<32> egress_port +} + +struct psa_egress_output_metadata_t { + bit<8> clone + bit<16> clone_session_id + bit<8> drop +} + +struct psa_egress_deparser_input_metadata_t { + bit<32> egress_port +} + +header s instanceof T + +struct M { + bit<32> psa_ingress_input_metadata_ingress_port + bit<8> psa_ingress_output_metadata_drop + bit<32> psa_ingress_output_metadata_egress_port +} +metadata instanceof M + +apply { + rx m.psa_ingress_input_metadata_ingress_port + mov m.psa_ingress_output_metadata_drop 0x0 + jmpneq LABEL_DROP m.psa_ingress_output_metadata_drop 0x0 + tx m.psa_ingress_output_metadata_egress_port + LABEL_DROP : drop +} + + diff --git a/testdata/p4_16_samplespsa-dpdk-gauntlet_exit_combination_8-bmv2.p4 b/testdata/p4_16_samplespsa-dpdk-gauntlet_exit_combination_8-bmv2.p4 new file mode 100644 index 00000000000..e2893d7d0c7 --- /dev/null +++ b/testdata/p4_16_samplespsa-dpdk-gauntlet_exit_combination_8-bmv2.p4 @@ -0,0 +1,104 @@ +#include +#include + +header EMPTY_H {}; +struct EMPTY_RESUB {}; +struct EMPTY_CLONE {}; +struct EMPTY_BRIDGE {}; +struct EMPTY_RECIRC {}; + + +header ethernet_t { + bit<48> dst_addr; + bit<48> src_addr; + bit<16> eth_type; +} + +struct Headers { + ethernet_t eth_hdr; +} + +struct Meta {} + +parser p(packet_in pkt, out Headers hdr, inout Meta m,in psa_ingress_parser_input_metadata_t x, + in EMPTY_RESUB resub_meta, + in EMPTY_RECIRC recirc_meta) { + state start { + transition parse_hdrs; + } + state parse_hdrs { + pkt.extract(hdr.eth_hdr); + transition accept; + } +} + +parser egressParserImpl( + packet_in buffer, + out EMPTY_H a, + inout Meta b, + in psa_egress_parser_input_metadata_t c, + in EMPTY_BRIDGE d, + in EMPTY_CLONE e, + in EMPTY_CLONE f) { + state start { + transition accept; + } +} + + +control ingress(inout Headers h, inout Meta m, in psa_ingress_input_metadata_t istd, + inout psa_ingress_output_metadata_t ostd) { + + + apply { + if (false) { + h.eth_hdr.eth_type = 1; + } else { + return; + } + h.eth_hdr.eth_type = 3; + exit; + } +} + + +control egressControlImpl( + inout EMPTY_H hdr, + inout Meta meta, + in psa_egress_input_metadata_t x, + inout psa_egress_output_metadata_t ostd) +{ + apply { } +} + +control deparser(packet_out pkt, out EMPTY_CLONE clone_i2e_meta, + out EMPTY_RESUB resubmit_meta, + out EMPTY_BRIDGE normal_meta, + inout Headers h, + in Meta local_metadata, + in psa_ingress_output_metadata_t istd) { + apply { + pkt.emit(h); + } +} + +control egressDeparserImpl( + packet_out buffer, + out EMPTY_CLONE a, + out EMPTY_RECIRC b, + inout EMPTY_H c, + in Meta d, + in psa_egress_output_metadata_t e, + in psa_egress_deparser_input_metadata_t f) { + apply { } +} + + +IngressPipeline(p(), ingress(), deparser()) ip; +EgressPipeline(egressParserImpl(), egressControlImpl(), egressDeparserImpl()) ep; + +PSA_Switch( + ip, + PacketReplicationEngine(), + ep, + BufferingQueueingEngine()) main;