From dbc412517f666b16b2e7b02d421411eeaf4e157e Mon Sep 17 00:00:00 2001 From: Bili Dong Date: Mon, 10 Apr 2023 14:35:03 -0700 Subject: [PATCH] Always insert instantiation statement at the end of the local statement list (#3962) --- frontends/p4/directCalls.cpp | 6 +- testdata/p4_16_errors_outputs/list-error.p4 | 1 - testdata/p4_16_errors_outputs/psa-meter2.p4 | 3 - .../p4_16_samples/extern-inst-as-param.p4 | 37 + .../dash/dash-pipeline-first.p4 | 6 +- .../dash/dash-pipeline-frontend.p4 | 488 +++++----- .../dash/dash-pipeline-midend.p4 | 488 +++++----- .../dash/dash-pipeline.p4.p4info.txt | 902 +++++++++--------- .../extern-inst-as-param-first.p4 | 36 + .../extern-inst-as-param-frontend.p4 | 31 + .../extern-inst-as-param-midend.p4 | 29 + .../extern-inst-as-param.p4 | 33 + .../extern-inst-as-param.p4-stderr | 0 .../fabric_20190420/fabric-first.p4 | 6 +- .../fabric_20190420/fabric-frontend.p4 | 154 +-- .../fabric_20190420/fabric-midend.p4 | 154 +-- .../fabric_20190420/fabric.p4.p4info.txt | 150 +-- .../issue561-bmv2-first.p4 | 2 +- testdata/p4_16_samples_outputs/list1-first.p4 | 1 - .../p4_16_samples_outputs/list1-frontend.p4 | 1 - .../p4_16_samples_outputs/list1-midend.p4 | 1 - testdata/p4_16_samples_outputs/list1.p4 | 1 - testdata/p4_16_samples_outputs/list2-first.p4 | 1 - .../p4_16_samples_outputs/list2-frontend.p4 | 1 - .../p4_16_samples_outputs/list2-midend.p4 | 1 - testdata/p4_16_samples_outputs/list2.p4 | 1 - testdata/p4_16_samples_outputs/list3-first.p4 | 1 - .../p4_16_samples_outputs/list3-frontend.p4 | 1 - .../p4_16_samples_outputs/list3-midend.p4 | 1 - testdata/p4_16_samples_outputs/list3.p4 | 1 - testdata/p4_16_samples_outputs/list4-first.p4 | 1 - .../p4_16_samples_outputs/list4-frontend.p4 | 1 - .../p4_16_samples_outputs/list4-midend.p4 | 1 - testdata/p4_16_samples_outputs/list4.p4 | 1 - testdata/p4_16_samples_outputs/list5-first.p4 | 1 - .../p4_16_samples_outputs/list5-frontend.p4 | 1 - .../p4_16_samples_outputs/list5-midend.p4 | 1 - testdata/p4_16_samples_outputs/list5.p4 | 1 - testdata/p4_16_samples_outputs/list6-first.p4 | 1 - .../p4_16_samples_outputs/list6-frontend.p4 | 1 - .../p4_16_samples_outputs/list6-midend.p4 | 1 - testdata/p4_16_samples_outputs/list6.p4 | 1 - .../p4_16_samples_outputs/omec/up4-first.p4 | 4 +- .../omec/up4-frontend.p4 | 128 +-- .../p4_16_samples_outputs/omec/up4-midend.p4 | 128 +-- .../omec/up4.p4.p4info.txt | 310 +++--- .../pna-add_on_miss_action_name-first.p4 | 2 +- .../pna-add_on_miss_action_name-frontend.p4 | 32 +- .../pna-add_on_miss_action_name-midend.p4 | 28 +- .../pna-add_on_miss_action_name.p4.bfrt.json | 24 +- .../pna-add_on_miss_action_name.p4.spec | 28 +- .../psa-end-of-ingress-test-bmv2-first.p4 | 2 +- .../psa-recirculate-no-meta-bmv2-first.p4 | 4 +- 53 files changed, 1688 insertions(+), 1552 deletions(-) create mode 100644 testdata/p4_16_samples/extern-inst-as-param.p4 create mode 100644 testdata/p4_16_samples_outputs/extern-inst-as-param-first.p4 create mode 100644 testdata/p4_16_samples_outputs/extern-inst-as-param-frontend.p4 create mode 100644 testdata/p4_16_samples_outputs/extern-inst-as-param-midend.p4 create mode 100644 testdata/p4_16_samples_outputs/extern-inst-as-param.p4 create mode 100644 testdata/p4_16_samples_outputs/extern-inst-as-param.p4-stderr diff --git a/frontends/p4/directCalls.cpp b/frontends/p4/directCalls.cpp index 710fc024cf..126a6f2a58 100644 --- a/frontends/p4/directCalls.cpp +++ b/frontends/p4/directCalls.cpp @@ -3,15 +3,13 @@ namespace P4 { const IR::Node *DoInstantiateCalls::postorder(IR::P4Parser *parser) { - insert.append(parser->parserLocals); - parser->parserLocals = insert; + parser->parserLocals.append(insert); insert.clear(); return parser; } const IR::Node *DoInstantiateCalls::postorder(IR::P4Control *control) { - insert.append(control->controlLocals); - control->controlLocals = insert; + control->controlLocals.append(insert); insert.clear(); return control; } diff --git a/testdata/p4_16_errors_outputs/list-error.p4 b/testdata/p4_16_errors_outputs/list-error.p4 index e5a2dafd6f..f652bc8a67 100644 --- a/testdata/p4_16_errors_outputs/list-error.p4 +++ b/testdata/p4_16_errors_outputs/list-error.p4 @@ -15,4 +15,3 @@ control c() { control C(); package top(C _c); top(c()) main; - diff --git a/testdata/p4_16_errors_outputs/psa-meter2.p4 b/testdata/p4_16_errors_outputs/psa-meter2.p4 index dce09ba515..859a63feec 100644 --- a/testdata/p4_16_errors_outputs/psa-meter2.p4 +++ b/testdata/p4_16_errors_outputs/psa-meter2.p4 @@ -67,8 +67,5 @@ control MyED(packet_out buffer, out EMPTY a, out EMPTY b, inout EMPTY c, in EMPT } IngressPipeline(MyIP(), MyIC(), MyID()) ip; - EgressPipeline(MyEP(), MyEC(), MyED()) ep; - PSA_Switch(ip, PacketReplicationEngine(), ep, BufferingQueueingEngine()) main; - diff --git a/testdata/p4_16_samples/extern-inst-as-param.p4 b/testdata/p4_16_samples/extern-inst-as-param.p4 new file mode 100644 index 0000000000..1fa0dc7f93 --- /dev/null +++ b/testdata/p4_16_samples/extern-inst-as-param.p4 @@ -0,0 +1,37 @@ +#include + +extern MyCounter { + MyCounter(bit<32> size); + void count(in I index); +} + +typedef bit<10> my_counter_index_t; +typedef MyCounter my_counter_t; + +control Inner(my_counter_t counter_set) { + action count(my_counter_index_t index) { + counter_set.count(index); + } + + table counter_table { + actions = { + count; + } + } + + apply { + counter_table.apply(); + } +} + +control Test() { + my_counter_t(1024) counter_set; + + apply { + Inner.apply(counter_set); + } +} + +control C(); +package P(C _c); +P(Test()) main; diff --git a/testdata/p4_16_samples_outputs/dash/dash-pipeline-first.p4 b/testdata/p4_16_samples_outputs/dash/dash-pipeline-first.p4 index daa30e61ff..8840a89572 100644 --- a/testdata/p4_16_samples_outputs/dash/dash-pipeline-first.p4 +++ b/testdata/p4_16_samples_outputs/dash/dash-pipeline-first.p4 @@ -424,7 +424,6 @@ control acl(inout headers_t hdr, inout metadata_t meta, inout standard_metadata_ } control outbound(inout headers_t hdr, inout metadata_t meta, inout standard_metadata_t standard_metadata) { - @name("acl") acl() acl_inst; action route_vnet(bit<16> dst_vnet_id) { meta.dst_vnet_id = dst_vnet_id; } @@ -488,6 +487,7 @@ control outbound(inout headers_t hdr, inout metadata_t meta, inout standard_meta } default_action = NoAction(); } + @name("acl") acl() acl_inst; apply { if (meta.conntrack_data.allow_out) { ; @@ -560,8 +560,6 @@ control dash_compute_checksum(inout headers_t hdr, inout metadata_t meta) { } control dash_ingress(inout headers_t hdr, inout metadata_t meta, inout standard_metadata_t standard_metadata) { - @name("outbound") outbound() outbound_inst; - @name("inbound") inbound() inbound_inst; action drop_action() { mark_to_drop(standard_metadata); } @@ -730,6 +728,8 @@ control dash_ingress(inout headers_t hdr, inout metadata_t meta, inout standard_ } default_action = NoAction(); } + @name("outbound") outbound() outbound_inst; + @name("inbound") inbound() inbound_inst; apply { standard_metadata.egress_spec = standard_metadata.ingress_port; if (vip.apply().hit) { diff --git a/testdata/p4_16_samples_outputs/dash/dash-pipeline-frontend.p4 b/testdata/p4_16_samples_outputs/dash/dash-pipeline-frontend.p4 index 24646a834a..0ed2a41a56 100644 --- a/testdata/p4_16_samples_outputs/dash/dash-pipeline-frontend.p4 +++ b/testdata/p4_16_samples_outputs/dash/dash-pipeline-frontend.p4 @@ -436,246 +436,6 @@ control dash_ingress(inout headers_t hdr, inout metadata_t meta, inout standard_ hdr_9.vxlan.vni = vni_1; hdr = hdr_9; } - @name("dash_ingress.outbound.acl.permit") action outbound_acl_permit_0() { - } - @name("dash_ingress.outbound.acl.permit") action outbound_acl_permit_1() { - } - @name("dash_ingress.outbound.acl.permit") action outbound_acl_permit_2() { - } - @name("dash_ingress.outbound.acl.permit_and_continue") action outbound_acl_permit_and_continue_0() { - } - @name("dash_ingress.outbound.acl.permit_and_continue") action outbound_acl_permit_and_continue_1() { - } - @name("dash_ingress.outbound.acl.permit_and_continue") action outbound_acl_permit_and_continue_2() { - } - @name("dash_ingress.outbound.acl.deny") action outbound_acl_deny_0() { - meta.dropped = true; - } - @name("dash_ingress.outbound.acl.deny") action outbound_acl_deny_1() { - meta.dropped = true; - } - @name("dash_ingress.outbound.acl.deny") action outbound_acl_deny_2() { - meta.dropped = true; - } - @name("dash_ingress.outbound.acl.deny_and_continue") action outbound_acl_deny_and_continue_0() { - meta.dropped = true; - } - @name("dash_ingress.outbound.acl.deny_and_continue") action outbound_acl_deny_and_continue_1() { - meta.dropped = true; - } - @name("dash_ingress.outbound.acl.deny_and_continue") action outbound_acl_deny_and_continue_2() { - meta.dropped = true; - } - @name("dash_ingress.outbound.acl.stage1_counter") direct_counter(CounterType.packets_and_bytes) outbound_acl_stage1_counter; - @name("dash_ingress.outbound.acl.stage1:dash_acl_rule|dash_acl") table outbound_acl_stage1_dash_acl_rule_dash_acl { - key = { - meta.stage1_dash_acl_group_id: exact @name("meta.dash_acl_group_id:dash_acl_group_id"); - meta.dst_ip_addr : optional @name("meta.dst_ip_addr:dip"); - meta.src_ip_addr : optional @name("meta.src_ip_addr:sip"); - meta.ip_protocol : optional @name("meta.ip_protocol:protocol"); - meta.src_l4_port : optional @name("meta.src_l4_port:src_port"); - meta.dst_l4_port : optional @name("meta.dst_l4_port:dst_port"); - } - actions = { - outbound_acl_permit_0(); - outbound_acl_permit_and_continue_0(); - outbound_acl_deny_0(); - outbound_acl_deny_and_continue_0(); - } - default_action = outbound_acl_deny_0(); - counters = outbound_acl_stage1_counter; - } - @name("dash_ingress.outbound.acl.stage2_counter") direct_counter(CounterType.packets_and_bytes) outbound_acl_stage2_counter; - @name("dash_ingress.outbound.acl.stage2:dash_acl_rule|dash_acl") table outbound_acl_stage2_dash_acl_rule_dash_acl { - key = { - meta.stage2_dash_acl_group_id: exact @name("meta.dash_acl_group_id:dash_acl_group_id"); - meta.dst_ip_addr : optional @name("meta.dst_ip_addr:dip"); - meta.src_ip_addr : optional @name("meta.src_ip_addr:sip"); - meta.ip_protocol : optional @name("meta.ip_protocol:protocol"); - meta.src_l4_port : optional @name("meta.src_l4_port:src_port"); - meta.dst_l4_port : optional @name("meta.dst_l4_port:dst_port"); - } - actions = { - outbound_acl_permit_1(); - outbound_acl_permit_and_continue_1(); - outbound_acl_deny_1(); - outbound_acl_deny_and_continue_1(); - } - default_action = outbound_acl_deny_1(); - counters = outbound_acl_stage2_counter; - } - @name("dash_ingress.outbound.acl.stage3_counter") direct_counter(CounterType.packets_and_bytes) outbound_acl_stage3_counter; - @name("dash_ingress.outbound.acl.stage3:dash_acl_rule|dash_acl") table outbound_acl_stage3_dash_acl_rule_dash_acl { - key = { - meta.stage3_dash_acl_group_id: exact @name("meta.dash_acl_group_id:dash_acl_group_id"); - meta.dst_ip_addr : optional @name("meta.dst_ip_addr:dip"); - meta.src_ip_addr : optional @name("meta.src_ip_addr:sip"); - meta.ip_protocol : optional @name("meta.ip_protocol:protocol"); - meta.src_l4_port : optional @name("meta.src_l4_port:src_port"); - meta.dst_l4_port : optional @name("meta.dst_l4_port:dst_port"); - } - actions = { - outbound_acl_permit_2(); - outbound_acl_permit_and_continue_2(); - outbound_acl_deny_2(); - outbound_acl_deny_and_continue_2(); - } - default_action = outbound_acl_deny_2(); - counters = outbound_acl_stage3_counter; - } - @name("dash_ingress.outbound.route_vnet") action outbound_route_vnet_0(@name("dst_vnet_id") bit<16> dst_vnet_id_2) { - meta.dst_vnet_id = dst_vnet_id_2; - } - @name("dash_ingress.outbound.route_vnet_direct") action outbound_route_vnet_direct_0(@name("dst_vnet_id") bit<16> dst_vnet_id_3, @name("is_overlay_ip_v4_or_v6") bit<1> is_overlay_ip_v4_or_v6, @name("overlay_ip") IPv4ORv6Address overlay_ip) { - meta.dst_vnet_id = dst_vnet_id_3; - meta.lkup_dst_ip_addr = overlay_ip; - meta.is_lkup_dst_ip_v6 = is_overlay_ip_v4_or_v6; - } - @name("dash_ingress.outbound.route_direct") action outbound_route_direct_0() { - } - @name("dash_ingress.outbound.drop") action outbound_drop_0() { - meta.dropped = true; - } - @name("dash_ingress.outbound.drop") action outbound_drop_1() { - meta.dropped = true; - } - @name("dash_ingress.outbound.routing_counter") direct_counter(CounterType.packets_and_bytes) outbound_routing_counter; - @name("dash_ingress.outbound.outbound_routing|dash_outbound_routing") table outbound_outbound_routing_dash_outbound_routing { - key = { - meta.eni_id : exact @name("meta.eni_id:eni_id"); - meta.is_overlay_ip_v6: exact @name("meta.is_overlay_ip_v6:is_destination_v4_or_v6"); - meta.dst_ip_addr : lpm @name("meta.dst_ip_addr:destination"); - } - actions = { - outbound_route_vnet_0(); - outbound_route_vnet_direct_0(); - outbound_route_direct_0(); - outbound_drop_0(); - } - const default_action = outbound_drop_0(); - counters = outbound_routing_counter; - } - @name("dash_ingress.outbound.set_tunnel_mapping") action outbound_set_tunnel_mapping_0(@name("underlay_dip") IPv4Address underlay_dip_4, @name("overlay_dmac") EthernetAddress overlay_dmac_4, @name("use_dst_vnet_vni") bit<1> use_dst_vnet_vni) { - if (use_dst_vnet_vni == 1w1) { - meta.vnet_id = meta.dst_vnet_id; - } - meta.encap_data.overlay_dmac = overlay_dmac_4; - meta.encap_data.underlay_dip = underlay_dip_4; - } - @name("dash_ingress.outbound.ca_to_pa_counter") direct_counter(CounterType.packets_and_bytes) outbound_ca_to_pa_counter; - @name("dash_ingress.outbound.outbound_ca_to_pa|dash_outbound_ca_to_pa") table outbound_outbound_ca_to_pa_dash_outbound_ca_to_pa { - key = { - meta.dst_vnet_id : exact @name("meta.dst_vnet_id:dst_vnet_id"); - meta.is_lkup_dst_ip_v6: exact @name("meta.is_lkup_dst_ip_v6:is_dip_v4_or_v6"); - meta.lkup_dst_ip_addr : exact @name("meta.lkup_dst_ip_addr:dip"); - } - actions = { - outbound_set_tunnel_mapping_0(); - @defaultonly outbound_drop_1(); - } - const default_action = outbound_drop_1(); - counters = outbound_ca_to_pa_counter; - } - @name("dash_ingress.outbound.set_vnet_attrs") action outbound_set_vnet_attrs_0(@name("vni") bit<24> vni_4) { - meta.encap_data.vni = vni_4; - } - @name("dash_ingress.outbound.vnet|dash_vnet") table outbound_vnet_dash_vnet { - key = { - meta.vnet_id: exact @name("meta.vnet_id:vnet_id"); - } - actions = { - outbound_set_vnet_attrs_0(); - @defaultonly NoAction_1(); - } - default_action = NoAction_1(); - } - @name("dash_ingress.inbound.acl.permit") action inbound_acl_permit_0() { - } - @name("dash_ingress.inbound.acl.permit") action inbound_acl_permit_1() { - } - @name("dash_ingress.inbound.acl.permit") action inbound_acl_permit_2() { - } - @name("dash_ingress.inbound.acl.permit_and_continue") action inbound_acl_permit_and_continue_0() { - } - @name("dash_ingress.inbound.acl.permit_and_continue") action inbound_acl_permit_and_continue_1() { - } - @name("dash_ingress.inbound.acl.permit_and_continue") action inbound_acl_permit_and_continue_2() { - } - @name("dash_ingress.inbound.acl.deny") action inbound_acl_deny_0() { - meta.dropped = true; - } - @name("dash_ingress.inbound.acl.deny") action inbound_acl_deny_1() { - meta.dropped = true; - } - @name("dash_ingress.inbound.acl.deny") action inbound_acl_deny_2() { - meta.dropped = true; - } - @name("dash_ingress.inbound.acl.deny_and_continue") action inbound_acl_deny_and_continue_0() { - meta.dropped = true; - } - @name("dash_ingress.inbound.acl.deny_and_continue") action inbound_acl_deny_and_continue_1() { - meta.dropped = true; - } - @name("dash_ingress.inbound.acl.deny_and_continue") action inbound_acl_deny_and_continue_2() { - meta.dropped = true; - } - @name("dash_ingress.inbound.acl.stage1_counter") direct_counter(CounterType.packets_and_bytes) inbound_acl_stage1_counter; - @name("dash_ingress.inbound.acl.stage1:dash_acl_rule|dash_acl") table inbound_acl_stage1_dash_acl_rule_dash_acl { - key = { - meta.stage1_dash_acl_group_id: exact @name("meta.dash_acl_group_id:dash_acl_group_id"); - meta.dst_ip_addr : optional @name("meta.dst_ip_addr:dip"); - meta.src_ip_addr : optional @name("meta.src_ip_addr:sip"); - meta.ip_protocol : optional @name("meta.ip_protocol:protocol"); - meta.src_l4_port : optional @name("meta.src_l4_port:src_port"); - meta.dst_l4_port : optional @name("meta.dst_l4_port:dst_port"); - } - actions = { - inbound_acl_permit_0(); - inbound_acl_permit_and_continue_0(); - inbound_acl_deny_0(); - inbound_acl_deny_and_continue_0(); - } - default_action = inbound_acl_deny_0(); - counters = inbound_acl_stage1_counter; - } - @name("dash_ingress.inbound.acl.stage2_counter") direct_counter(CounterType.packets_and_bytes) inbound_acl_stage2_counter; - @name("dash_ingress.inbound.acl.stage2:dash_acl_rule|dash_acl") table inbound_acl_stage2_dash_acl_rule_dash_acl { - key = { - meta.stage2_dash_acl_group_id: exact @name("meta.dash_acl_group_id:dash_acl_group_id"); - meta.dst_ip_addr : optional @name("meta.dst_ip_addr:dip"); - meta.src_ip_addr : optional @name("meta.src_ip_addr:sip"); - meta.ip_protocol : optional @name("meta.ip_protocol:protocol"); - meta.src_l4_port : optional @name("meta.src_l4_port:src_port"); - meta.dst_l4_port : optional @name("meta.dst_l4_port:dst_port"); - } - actions = { - inbound_acl_permit_1(); - inbound_acl_permit_and_continue_1(); - inbound_acl_deny_1(); - inbound_acl_deny_and_continue_1(); - } - default_action = inbound_acl_deny_1(); - counters = inbound_acl_stage2_counter; - } - @name("dash_ingress.inbound.acl.stage3_counter") direct_counter(CounterType.packets_and_bytes) inbound_acl_stage3_counter; - @name("dash_ingress.inbound.acl.stage3:dash_acl_rule|dash_acl") table inbound_acl_stage3_dash_acl_rule_dash_acl { - key = { - meta.stage3_dash_acl_group_id: exact @name("meta.dash_acl_group_id:dash_acl_group_id"); - meta.dst_ip_addr : optional @name("meta.dst_ip_addr:dip"); - meta.src_ip_addr : optional @name("meta.src_ip_addr:sip"); - meta.ip_protocol : optional @name("meta.ip_protocol:protocol"); - meta.src_l4_port : optional @name("meta.src_l4_port:src_port"); - meta.dst_l4_port : optional @name("meta.dst_l4_port:dst_port"); - } - actions = { - inbound_acl_permit_2(); - inbound_acl_permit_and_continue_2(); - inbound_acl_deny_2(); - inbound_acl_deny_and_continue_2(); - } - default_action = inbound_acl_deny_2(); - counters = inbound_acl_stage3_counter; - } @name("dash_ingress.drop_action") action drop_action() { mark_to_drop(standard_metadata); } @@ -735,9 +495,9 @@ control dash_ingress(inout headers_t hdr, inout metadata_t meta, inout standard_ } actions = { set_appliance(); - @defaultonly NoAction_2(); + @defaultonly NoAction_1(); } - default_action = NoAction_2(); + default_action = NoAction_1(); } @name("dash_ingress.set_eni_attrs") action set_eni_attrs(@name("cps") bit<32> cps_1, @name("pps") bit<32> pps_1, @name("flows") bit<32> flows_1, @name("admin_state") bit<1> admin_state_1, @name("vm_underlay_dip") IPv4Address vm_underlay_dip, @name("vm_vni") bit<24> vm_vni, @name("vnet_id") bit<16> vnet_id_1, @name("inbound_v4_stage1_dash_acl_group_id") bit<16> inbound_v4_stage1_dash_acl_group_id, @name("inbound_v4_stage2_dash_acl_group_id") bit<16> inbound_v4_stage2_dash_acl_group_id, @name("inbound_v4_stage3_dash_acl_group_id") bit<16> inbound_v4_stage3_dash_acl_group_id, @name("inbound_v4_stage4_dash_acl_group_id") bit<16> inbound_v4_stage4_dash_acl_group_id, @name("inbound_v4_stage5_dash_acl_group_id") bit<16> inbound_v4_stage5_dash_acl_group_id, @name("inbound_v6_stage1_dash_acl_group_id") bit<16> inbound_v6_stage1_dash_acl_group_id, @name("inbound_v6_stage2_dash_acl_group_id") bit<16> inbound_v6_stage2_dash_acl_group_id, @name("inbound_v6_stage3_dash_acl_group_id") bit<16> inbound_v6_stage3_dash_acl_group_id, @name("inbound_v6_stage4_dash_acl_group_id") bit<16> inbound_v6_stage4_dash_acl_group_id, @name("inbound_v6_stage5_dash_acl_group_id") bit<16> inbound_v6_stage5_dash_acl_group_id, @name("outbound_v4_stage1_dash_acl_group_id") bit<16> outbound_v4_stage1_dash_acl_group_id, @name("outbound_v4_stage2_dash_acl_group_id") bit<16> outbound_v4_stage2_dash_acl_group_id, @name("outbound_v4_stage3_dash_acl_group_id") bit<16> outbound_v4_stage3_dash_acl_group_id, @name("outbound_v4_stage4_dash_acl_group_id") bit<16> outbound_v4_stage4_dash_acl_group_id, @name("outbound_v4_stage5_dash_acl_group_id") bit<16> outbound_v4_stage5_dash_acl_group_id, @name("outbound_v6_stage1_dash_acl_group_id") bit<16> outbound_v6_stage1_dash_acl_group_id, @name("outbound_v6_stage2_dash_acl_group_id") bit<16> outbound_v6_stage2_dash_acl_group_id, @name("outbound_v6_stage3_dash_acl_group_id") bit<16> outbound_v6_stage3_dash_acl_group_id, @name("outbound_v6_stage4_dash_acl_group_id") bit<16> outbound_v6_stage4_dash_acl_group_id, @name("outbound_v6_stage5_dash_acl_group_id") bit<16> outbound_v6_stage5_dash_acl_group_id) { meta.eni_data.cps = cps_1; @@ -793,10 +553,10 @@ control dash_ingress(inout headers_t hdr, inout metadata_t meta, inout standard_ meta.dropped : exact @name("meta.dropped:dropped"); } actions = { - NoAction_3(); + NoAction_2(); } counters = eni_counter_0; - default_action = NoAction_3(); + default_action = NoAction_2(); } @name("dash_ingress.permit") action permit() { } @@ -855,10 +615,250 @@ control dash_ingress(inout headers_t hdr, inout metadata_t meta, inout standard_ } actions = { set_acl_group_attrs(); + @defaultonly NoAction_3(); + } + default_action = NoAction_3(); + } + @name("dash_ingress.outbound.route_vnet") action outbound_route_vnet_0(@name("dst_vnet_id") bit<16> dst_vnet_id_2) { + meta.dst_vnet_id = dst_vnet_id_2; + } + @name("dash_ingress.outbound.route_vnet_direct") action outbound_route_vnet_direct_0(@name("dst_vnet_id") bit<16> dst_vnet_id_3, @name("is_overlay_ip_v4_or_v6") bit<1> is_overlay_ip_v4_or_v6, @name("overlay_ip") IPv4ORv6Address overlay_ip) { + meta.dst_vnet_id = dst_vnet_id_3; + meta.lkup_dst_ip_addr = overlay_ip; + meta.is_lkup_dst_ip_v6 = is_overlay_ip_v4_or_v6; + } + @name("dash_ingress.outbound.route_direct") action outbound_route_direct_0() { + } + @name("dash_ingress.outbound.drop") action outbound_drop_0() { + meta.dropped = true; + } + @name("dash_ingress.outbound.drop") action outbound_drop_1() { + meta.dropped = true; + } + @name("dash_ingress.outbound.routing_counter") direct_counter(CounterType.packets_and_bytes) outbound_routing_counter; + @name("dash_ingress.outbound.outbound_routing|dash_outbound_routing") table outbound_outbound_routing_dash_outbound_routing { + key = { + meta.eni_id : exact @name("meta.eni_id:eni_id"); + meta.is_overlay_ip_v6: exact @name("meta.is_overlay_ip_v6:is_destination_v4_or_v6"); + meta.dst_ip_addr : lpm @name("meta.dst_ip_addr:destination"); + } + actions = { + outbound_route_vnet_0(); + outbound_route_vnet_direct_0(); + outbound_route_direct_0(); + outbound_drop_0(); + } + const default_action = outbound_drop_0(); + counters = outbound_routing_counter; + } + @name("dash_ingress.outbound.set_tunnel_mapping") action outbound_set_tunnel_mapping_0(@name("underlay_dip") IPv4Address underlay_dip_4, @name("overlay_dmac") EthernetAddress overlay_dmac_4, @name("use_dst_vnet_vni") bit<1> use_dst_vnet_vni) { + if (use_dst_vnet_vni == 1w1) { + meta.vnet_id = meta.dst_vnet_id; + } + meta.encap_data.overlay_dmac = overlay_dmac_4; + meta.encap_data.underlay_dip = underlay_dip_4; + } + @name("dash_ingress.outbound.ca_to_pa_counter") direct_counter(CounterType.packets_and_bytes) outbound_ca_to_pa_counter; + @name("dash_ingress.outbound.outbound_ca_to_pa|dash_outbound_ca_to_pa") table outbound_outbound_ca_to_pa_dash_outbound_ca_to_pa { + key = { + meta.dst_vnet_id : exact @name("meta.dst_vnet_id:dst_vnet_id"); + meta.is_lkup_dst_ip_v6: exact @name("meta.is_lkup_dst_ip_v6:is_dip_v4_or_v6"); + meta.lkup_dst_ip_addr : exact @name("meta.lkup_dst_ip_addr:dip"); + } + actions = { + outbound_set_tunnel_mapping_0(); + @defaultonly outbound_drop_1(); + } + const default_action = outbound_drop_1(); + counters = outbound_ca_to_pa_counter; + } + @name("dash_ingress.outbound.set_vnet_attrs") action outbound_set_vnet_attrs_0(@name("vni") bit<24> vni_4) { + meta.encap_data.vni = vni_4; + } + @name("dash_ingress.outbound.vnet|dash_vnet") table outbound_vnet_dash_vnet { + key = { + meta.vnet_id: exact @name("meta.vnet_id:vnet_id"); + } + actions = { + outbound_set_vnet_attrs_0(); @defaultonly NoAction_4(); } default_action = NoAction_4(); } + @name("dash_ingress.outbound.acl.permit") action outbound_acl_permit_0() { + } + @name("dash_ingress.outbound.acl.permit") action outbound_acl_permit_1() { + } + @name("dash_ingress.outbound.acl.permit") action outbound_acl_permit_2() { + } + @name("dash_ingress.outbound.acl.permit_and_continue") action outbound_acl_permit_and_continue_0() { + } + @name("dash_ingress.outbound.acl.permit_and_continue") action outbound_acl_permit_and_continue_1() { + } + @name("dash_ingress.outbound.acl.permit_and_continue") action outbound_acl_permit_and_continue_2() { + } + @name("dash_ingress.outbound.acl.deny") action outbound_acl_deny_0() { + meta.dropped = true; + } + @name("dash_ingress.outbound.acl.deny") action outbound_acl_deny_1() { + meta.dropped = true; + } + @name("dash_ingress.outbound.acl.deny") action outbound_acl_deny_2() { + meta.dropped = true; + } + @name("dash_ingress.outbound.acl.deny_and_continue") action outbound_acl_deny_and_continue_0() { + meta.dropped = true; + } + @name("dash_ingress.outbound.acl.deny_and_continue") action outbound_acl_deny_and_continue_1() { + meta.dropped = true; + } + @name("dash_ingress.outbound.acl.deny_and_continue") action outbound_acl_deny_and_continue_2() { + meta.dropped = true; + } + @name("dash_ingress.outbound.acl.stage1_counter") direct_counter(CounterType.packets_and_bytes) outbound_acl_stage1_counter; + @name("dash_ingress.outbound.acl.stage1:dash_acl_rule|dash_acl") table outbound_acl_stage1_dash_acl_rule_dash_acl { + key = { + meta.stage1_dash_acl_group_id: exact @name("meta.dash_acl_group_id:dash_acl_group_id"); + meta.dst_ip_addr : optional @name("meta.dst_ip_addr:dip"); + meta.src_ip_addr : optional @name("meta.src_ip_addr:sip"); + meta.ip_protocol : optional @name("meta.ip_protocol:protocol"); + meta.src_l4_port : optional @name("meta.src_l4_port:src_port"); + meta.dst_l4_port : optional @name("meta.dst_l4_port:dst_port"); + } + actions = { + outbound_acl_permit_0(); + outbound_acl_permit_and_continue_0(); + outbound_acl_deny_0(); + outbound_acl_deny_and_continue_0(); + } + default_action = outbound_acl_deny_0(); + counters = outbound_acl_stage1_counter; + } + @name("dash_ingress.outbound.acl.stage2_counter") direct_counter(CounterType.packets_and_bytes) outbound_acl_stage2_counter; + @name("dash_ingress.outbound.acl.stage2:dash_acl_rule|dash_acl") table outbound_acl_stage2_dash_acl_rule_dash_acl { + key = { + meta.stage2_dash_acl_group_id: exact @name("meta.dash_acl_group_id:dash_acl_group_id"); + meta.dst_ip_addr : optional @name("meta.dst_ip_addr:dip"); + meta.src_ip_addr : optional @name("meta.src_ip_addr:sip"); + meta.ip_protocol : optional @name("meta.ip_protocol:protocol"); + meta.src_l4_port : optional @name("meta.src_l4_port:src_port"); + meta.dst_l4_port : optional @name("meta.dst_l4_port:dst_port"); + } + actions = { + outbound_acl_permit_1(); + outbound_acl_permit_and_continue_1(); + outbound_acl_deny_1(); + outbound_acl_deny_and_continue_1(); + } + default_action = outbound_acl_deny_1(); + counters = outbound_acl_stage2_counter; + } + @name("dash_ingress.outbound.acl.stage3_counter") direct_counter(CounterType.packets_and_bytes) outbound_acl_stage3_counter; + @name("dash_ingress.outbound.acl.stage3:dash_acl_rule|dash_acl") table outbound_acl_stage3_dash_acl_rule_dash_acl { + key = { + meta.stage3_dash_acl_group_id: exact @name("meta.dash_acl_group_id:dash_acl_group_id"); + meta.dst_ip_addr : optional @name("meta.dst_ip_addr:dip"); + meta.src_ip_addr : optional @name("meta.src_ip_addr:sip"); + meta.ip_protocol : optional @name("meta.ip_protocol:protocol"); + meta.src_l4_port : optional @name("meta.src_l4_port:src_port"); + meta.dst_l4_port : optional @name("meta.dst_l4_port:dst_port"); + } + actions = { + outbound_acl_permit_2(); + outbound_acl_permit_and_continue_2(); + outbound_acl_deny_2(); + outbound_acl_deny_and_continue_2(); + } + default_action = outbound_acl_deny_2(); + counters = outbound_acl_stage3_counter; + } + @name("dash_ingress.inbound.acl.permit") action inbound_acl_permit_0() { + } + @name("dash_ingress.inbound.acl.permit") action inbound_acl_permit_1() { + } + @name("dash_ingress.inbound.acl.permit") action inbound_acl_permit_2() { + } + @name("dash_ingress.inbound.acl.permit_and_continue") action inbound_acl_permit_and_continue_0() { + } + @name("dash_ingress.inbound.acl.permit_and_continue") action inbound_acl_permit_and_continue_1() { + } + @name("dash_ingress.inbound.acl.permit_and_continue") action inbound_acl_permit_and_continue_2() { + } + @name("dash_ingress.inbound.acl.deny") action inbound_acl_deny_0() { + meta.dropped = true; + } + @name("dash_ingress.inbound.acl.deny") action inbound_acl_deny_1() { + meta.dropped = true; + } + @name("dash_ingress.inbound.acl.deny") action inbound_acl_deny_2() { + meta.dropped = true; + } + @name("dash_ingress.inbound.acl.deny_and_continue") action inbound_acl_deny_and_continue_0() { + meta.dropped = true; + } + @name("dash_ingress.inbound.acl.deny_and_continue") action inbound_acl_deny_and_continue_1() { + meta.dropped = true; + } + @name("dash_ingress.inbound.acl.deny_and_continue") action inbound_acl_deny_and_continue_2() { + meta.dropped = true; + } + @name("dash_ingress.inbound.acl.stage1_counter") direct_counter(CounterType.packets_and_bytes) inbound_acl_stage1_counter; + @name("dash_ingress.inbound.acl.stage1:dash_acl_rule|dash_acl") table inbound_acl_stage1_dash_acl_rule_dash_acl { + key = { + meta.stage1_dash_acl_group_id: exact @name("meta.dash_acl_group_id:dash_acl_group_id"); + meta.dst_ip_addr : optional @name("meta.dst_ip_addr:dip"); + meta.src_ip_addr : optional @name("meta.src_ip_addr:sip"); + meta.ip_protocol : optional @name("meta.ip_protocol:protocol"); + meta.src_l4_port : optional @name("meta.src_l4_port:src_port"); + meta.dst_l4_port : optional @name("meta.dst_l4_port:dst_port"); + } + actions = { + inbound_acl_permit_0(); + inbound_acl_permit_and_continue_0(); + inbound_acl_deny_0(); + inbound_acl_deny_and_continue_0(); + } + default_action = inbound_acl_deny_0(); + counters = inbound_acl_stage1_counter; + } + @name("dash_ingress.inbound.acl.stage2_counter") direct_counter(CounterType.packets_and_bytes) inbound_acl_stage2_counter; + @name("dash_ingress.inbound.acl.stage2:dash_acl_rule|dash_acl") table inbound_acl_stage2_dash_acl_rule_dash_acl { + key = { + meta.stage2_dash_acl_group_id: exact @name("meta.dash_acl_group_id:dash_acl_group_id"); + meta.dst_ip_addr : optional @name("meta.dst_ip_addr:dip"); + meta.src_ip_addr : optional @name("meta.src_ip_addr:sip"); + meta.ip_protocol : optional @name("meta.ip_protocol:protocol"); + meta.src_l4_port : optional @name("meta.src_l4_port:src_port"); + meta.dst_l4_port : optional @name("meta.dst_l4_port:dst_port"); + } + actions = { + inbound_acl_permit_1(); + inbound_acl_permit_and_continue_1(); + inbound_acl_deny_1(); + inbound_acl_deny_and_continue_1(); + } + default_action = inbound_acl_deny_1(); + counters = inbound_acl_stage2_counter; + } + @name("dash_ingress.inbound.acl.stage3_counter") direct_counter(CounterType.packets_and_bytes) inbound_acl_stage3_counter; + @name("dash_ingress.inbound.acl.stage3:dash_acl_rule|dash_acl") table inbound_acl_stage3_dash_acl_rule_dash_acl { + key = { + meta.stage3_dash_acl_group_id: exact @name("meta.dash_acl_group_id:dash_acl_group_id"); + meta.dst_ip_addr : optional @name("meta.dst_ip_addr:dip"); + meta.src_ip_addr : optional @name("meta.src_ip_addr:sip"); + meta.ip_protocol : optional @name("meta.ip_protocol:protocol"); + meta.src_l4_port : optional @name("meta.src_l4_port:src_port"); + meta.dst_l4_port : optional @name("meta.dst_l4_port:dst_port"); + } + actions = { + inbound_acl_permit_2(); + inbound_acl_permit_and_continue_2(); + inbound_acl_deny_2(); + inbound_acl_deny_and_continue_2(); + } + default_action = inbound_acl_deny_2(); + counters = inbound_acl_stage3_counter; + } apply { standard_metadata.egress_spec = standard_metadata.ingress_port; if (vip_0.apply().hit) { diff --git a/testdata/p4_16_samples_outputs/dash/dash-pipeline-midend.p4 b/testdata/p4_16_samples_outputs/dash/dash-pipeline-midend.p4 index 6d153b1983..7558b6c901 100644 --- a/testdata/p4_16_samples_outputs/dash/dash-pipeline-midend.p4 +++ b/testdata/p4_16_samples_outputs/dash/dash-pipeline-midend.p4 @@ -526,246 +526,6 @@ control dash_ingress(inout headers_t hdr, inout metadata_t meta, inout standard_ hdr.inner_udp = hdr_9_inner_udp; hdr.inner_tcp = hdr_9_inner_tcp; } - @name("dash_ingress.outbound.acl.permit") action outbound_acl_permit_0() { - } - @name("dash_ingress.outbound.acl.permit") action outbound_acl_permit_1() { - } - @name("dash_ingress.outbound.acl.permit") action outbound_acl_permit_2() { - } - @name("dash_ingress.outbound.acl.permit_and_continue") action outbound_acl_permit_and_continue_0() { - } - @name("dash_ingress.outbound.acl.permit_and_continue") action outbound_acl_permit_and_continue_1() { - } - @name("dash_ingress.outbound.acl.permit_and_continue") action outbound_acl_permit_and_continue_2() { - } - @name("dash_ingress.outbound.acl.deny") action outbound_acl_deny_0() { - meta._dropped0 = true; - } - @name("dash_ingress.outbound.acl.deny") action outbound_acl_deny_1() { - meta._dropped0 = true; - } - @name("dash_ingress.outbound.acl.deny") action outbound_acl_deny_2() { - meta._dropped0 = true; - } - @name("dash_ingress.outbound.acl.deny_and_continue") action outbound_acl_deny_and_continue_0() { - meta._dropped0 = true; - } - @name("dash_ingress.outbound.acl.deny_and_continue") action outbound_acl_deny_and_continue_1() { - meta._dropped0 = true; - } - @name("dash_ingress.outbound.acl.deny_and_continue") action outbound_acl_deny_and_continue_2() { - meta._dropped0 = true; - } - @name("dash_ingress.outbound.acl.stage1_counter") direct_counter(CounterType.packets_and_bytes) outbound_acl_stage1_counter; - @name("dash_ingress.outbound.acl.stage1:dash_acl_rule|dash_acl") table outbound_acl_stage1_dash_acl_rule_dash_acl { - key = { - meta._stage1_dash_acl_group_id29: exact @name("meta.dash_acl_group_id:dash_acl_group_id"); - meta._dst_ip_addr22 : optional @name("meta.dst_ip_addr:dip"); - meta._src_ip_addr23 : optional @name("meta.src_ip_addr:sip"); - meta._ip_protocol21 : optional @name("meta.ip_protocol:protocol"); - meta._src_l4_port27 : optional @name("meta.src_l4_port:src_port"); - meta._dst_l4_port28 : optional @name("meta.dst_l4_port:dst_port"); - } - actions = { - outbound_acl_permit_0(); - outbound_acl_permit_and_continue_0(); - outbound_acl_deny_0(); - outbound_acl_deny_and_continue_0(); - } - default_action = outbound_acl_deny_0(); - counters = outbound_acl_stage1_counter; - } - @name("dash_ingress.outbound.acl.stage2_counter") direct_counter(CounterType.packets_and_bytes) outbound_acl_stage2_counter; - @name("dash_ingress.outbound.acl.stage2:dash_acl_rule|dash_acl") table outbound_acl_stage2_dash_acl_rule_dash_acl { - key = { - meta._stage2_dash_acl_group_id30: exact @name("meta.dash_acl_group_id:dash_acl_group_id"); - meta._dst_ip_addr22 : optional @name("meta.dst_ip_addr:dip"); - meta._src_ip_addr23 : optional @name("meta.src_ip_addr:sip"); - meta._ip_protocol21 : optional @name("meta.ip_protocol:protocol"); - meta._src_l4_port27 : optional @name("meta.src_l4_port:src_port"); - meta._dst_l4_port28 : optional @name("meta.dst_l4_port:dst_port"); - } - actions = { - outbound_acl_permit_1(); - outbound_acl_permit_and_continue_1(); - outbound_acl_deny_1(); - outbound_acl_deny_and_continue_1(); - } - default_action = outbound_acl_deny_1(); - counters = outbound_acl_stage2_counter; - } - @name("dash_ingress.outbound.acl.stage3_counter") direct_counter(CounterType.packets_and_bytes) outbound_acl_stage3_counter; - @name("dash_ingress.outbound.acl.stage3:dash_acl_rule|dash_acl") table outbound_acl_stage3_dash_acl_rule_dash_acl { - key = { - meta._stage3_dash_acl_group_id31: exact @name("meta.dash_acl_group_id:dash_acl_group_id"); - meta._dst_ip_addr22 : optional @name("meta.dst_ip_addr:dip"); - meta._src_ip_addr23 : optional @name("meta.src_ip_addr:sip"); - meta._ip_protocol21 : optional @name("meta.ip_protocol:protocol"); - meta._src_l4_port27 : optional @name("meta.src_l4_port:src_port"); - meta._dst_l4_port28 : optional @name("meta.dst_l4_port:dst_port"); - } - actions = { - outbound_acl_permit_2(); - outbound_acl_permit_and_continue_2(); - outbound_acl_deny_2(); - outbound_acl_deny_and_continue_2(); - } - default_action = outbound_acl_deny_2(); - counters = outbound_acl_stage3_counter; - } - @name("dash_ingress.outbound.route_vnet") action outbound_route_vnet_0(@name("dst_vnet_id") bit<16> dst_vnet_id_2) { - meta._dst_vnet_id11 = dst_vnet_id_2; - } - @name("dash_ingress.outbound.route_vnet_direct") action outbound_route_vnet_direct_0(@name("dst_vnet_id") bit<16> dst_vnet_id_3, @name("is_overlay_ip_v4_or_v6") bit<1> is_overlay_ip_v4_or_v6, @name("overlay_ip") bit<128> overlay_ip) { - meta._dst_vnet_id11 = dst_vnet_id_3; - meta._lkup_dst_ip_addr24 = overlay_ip; - meta._is_lkup_dst_ip_v620 = is_overlay_ip_v4_or_v6; - } - @name("dash_ingress.outbound.route_direct") action outbound_route_direct_0() { - } - @name("dash_ingress.outbound.drop") action outbound_drop_0() { - meta._dropped0 = true; - } - @name("dash_ingress.outbound.drop") action outbound_drop_1() { - meta._dropped0 = true; - } - @name("dash_ingress.outbound.routing_counter") direct_counter(CounterType.packets_and_bytes) outbound_routing_counter; - @name("dash_ingress.outbound.outbound_routing|dash_outbound_routing") table outbound_outbound_routing_dash_outbound_routing { - key = { - meta._eni_id12 : exact @name("meta.eni_id:eni_id"); - meta._is_overlay_ip_v619: exact @name("meta.is_overlay_ip_v6:is_destination_v4_or_v6"); - meta._dst_ip_addr22 : lpm @name("meta.dst_ip_addr:destination"); - } - actions = { - outbound_route_vnet_0(); - outbound_route_vnet_direct_0(); - outbound_route_direct_0(); - outbound_drop_0(); - } - const default_action = outbound_drop_0(); - counters = outbound_routing_counter; - } - @name("dash_ingress.outbound.set_tunnel_mapping") action outbound_set_tunnel_mapping_0(@name("underlay_dip") bit<32> underlay_dip_4, @name("overlay_dmac") bit<48> overlay_dmac_4, @name("use_dst_vnet_vni") bit<1> use_dst_vnet_vni) { - if (use_dst_vnet_vni == 1w1) { - meta._vnet_id10 = meta._dst_vnet_id11; - } - meta._encap_data_overlay_dmac8 = overlay_dmac_4; - meta._encap_data_underlay_dip5 = underlay_dip_4; - } - @name("dash_ingress.outbound.ca_to_pa_counter") direct_counter(CounterType.packets_and_bytes) outbound_ca_to_pa_counter; - @name("dash_ingress.outbound.outbound_ca_to_pa|dash_outbound_ca_to_pa") table outbound_outbound_ca_to_pa_dash_outbound_ca_to_pa { - key = { - meta._dst_vnet_id11 : exact @name("meta.dst_vnet_id:dst_vnet_id"); - meta._is_lkup_dst_ip_v620: exact @name("meta.is_lkup_dst_ip_v6:is_dip_v4_or_v6"); - meta._lkup_dst_ip_addr24 : exact @name("meta.lkup_dst_ip_addr:dip"); - } - actions = { - outbound_set_tunnel_mapping_0(); - @defaultonly outbound_drop_1(); - } - const default_action = outbound_drop_1(); - counters = outbound_ca_to_pa_counter; - } - @name("dash_ingress.outbound.set_vnet_attrs") action outbound_set_vnet_attrs_0(@name("vni") bit<24> vni_4) { - meta._encap_data_vni2 = vni_4; - } - @name("dash_ingress.outbound.vnet|dash_vnet") table outbound_vnet_dash_vnet { - key = { - meta._vnet_id10: exact @name("meta.vnet_id:vnet_id"); - } - actions = { - outbound_set_vnet_attrs_0(); - @defaultonly NoAction_1(); - } - default_action = NoAction_1(); - } - @name("dash_ingress.inbound.acl.permit") action inbound_acl_permit_0() { - } - @name("dash_ingress.inbound.acl.permit") action inbound_acl_permit_1() { - } - @name("dash_ingress.inbound.acl.permit") action inbound_acl_permit_2() { - } - @name("dash_ingress.inbound.acl.permit_and_continue") action inbound_acl_permit_and_continue_0() { - } - @name("dash_ingress.inbound.acl.permit_and_continue") action inbound_acl_permit_and_continue_1() { - } - @name("dash_ingress.inbound.acl.permit_and_continue") action inbound_acl_permit_and_continue_2() { - } - @name("dash_ingress.inbound.acl.deny") action inbound_acl_deny_0() { - meta._dropped0 = true; - } - @name("dash_ingress.inbound.acl.deny") action inbound_acl_deny_1() { - meta._dropped0 = true; - } - @name("dash_ingress.inbound.acl.deny") action inbound_acl_deny_2() { - meta._dropped0 = true; - } - @name("dash_ingress.inbound.acl.deny_and_continue") action inbound_acl_deny_and_continue_0() { - meta._dropped0 = true; - } - @name("dash_ingress.inbound.acl.deny_and_continue") action inbound_acl_deny_and_continue_1() { - meta._dropped0 = true; - } - @name("dash_ingress.inbound.acl.deny_and_continue") action inbound_acl_deny_and_continue_2() { - meta._dropped0 = true; - } - @name("dash_ingress.inbound.acl.stage1_counter") direct_counter(CounterType.packets_and_bytes) inbound_acl_stage1_counter; - @name("dash_ingress.inbound.acl.stage1:dash_acl_rule|dash_acl") table inbound_acl_stage1_dash_acl_rule_dash_acl { - key = { - meta._stage1_dash_acl_group_id29: exact @name("meta.dash_acl_group_id:dash_acl_group_id"); - meta._dst_ip_addr22 : optional @name("meta.dst_ip_addr:dip"); - meta._src_ip_addr23 : optional @name("meta.src_ip_addr:sip"); - meta._ip_protocol21 : optional @name("meta.ip_protocol:protocol"); - meta._src_l4_port27 : optional @name("meta.src_l4_port:src_port"); - meta._dst_l4_port28 : optional @name("meta.dst_l4_port:dst_port"); - } - actions = { - inbound_acl_permit_0(); - inbound_acl_permit_and_continue_0(); - inbound_acl_deny_0(); - inbound_acl_deny_and_continue_0(); - } - default_action = inbound_acl_deny_0(); - counters = inbound_acl_stage1_counter; - } - @name("dash_ingress.inbound.acl.stage2_counter") direct_counter(CounterType.packets_and_bytes) inbound_acl_stage2_counter; - @name("dash_ingress.inbound.acl.stage2:dash_acl_rule|dash_acl") table inbound_acl_stage2_dash_acl_rule_dash_acl { - key = { - meta._stage2_dash_acl_group_id30: exact @name("meta.dash_acl_group_id:dash_acl_group_id"); - meta._dst_ip_addr22 : optional @name("meta.dst_ip_addr:dip"); - meta._src_ip_addr23 : optional @name("meta.src_ip_addr:sip"); - meta._ip_protocol21 : optional @name("meta.ip_protocol:protocol"); - meta._src_l4_port27 : optional @name("meta.src_l4_port:src_port"); - meta._dst_l4_port28 : optional @name("meta.dst_l4_port:dst_port"); - } - actions = { - inbound_acl_permit_1(); - inbound_acl_permit_and_continue_1(); - inbound_acl_deny_1(); - inbound_acl_deny_and_continue_1(); - } - default_action = inbound_acl_deny_1(); - counters = inbound_acl_stage2_counter; - } - @name("dash_ingress.inbound.acl.stage3_counter") direct_counter(CounterType.packets_and_bytes) inbound_acl_stage3_counter; - @name("dash_ingress.inbound.acl.stage3:dash_acl_rule|dash_acl") table inbound_acl_stage3_dash_acl_rule_dash_acl { - key = { - meta._stage3_dash_acl_group_id31: exact @name("meta.dash_acl_group_id:dash_acl_group_id"); - meta._dst_ip_addr22 : optional @name("meta.dst_ip_addr:dip"); - meta._src_ip_addr23 : optional @name("meta.src_ip_addr:sip"); - meta._ip_protocol21 : optional @name("meta.ip_protocol:protocol"); - meta._src_l4_port27 : optional @name("meta.src_l4_port:src_port"); - meta._dst_l4_port28 : optional @name("meta.dst_l4_port:dst_port"); - } - actions = { - inbound_acl_permit_2(); - inbound_acl_permit_and_continue_2(); - inbound_acl_deny_2(); - inbound_acl_deny_and_continue_2(); - } - default_action = inbound_acl_deny_2(); - counters = inbound_acl_stage3_counter; - } @name("dash_ingress.drop_action") action drop_action() { mark_to_drop(standard_metadata); } @@ -825,9 +585,9 @@ control dash_ingress(inout headers_t hdr, inout metadata_t meta, inout standard_ } actions = { set_appliance(); - @defaultonly NoAction_2(); + @defaultonly NoAction_1(); } - default_action = NoAction_2(); + default_action = NoAction_1(); } @name("dash_ingress.set_eni_attrs") action set_eni_attrs(@name("cps") bit<32> cps_1, @name("pps") bit<32> pps_1, @name("flows") bit<32> flows_1, @name("admin_state") bit<1> admin_state_1, @name("vm_underlay_dip") bit<32> vm_underlay_dip, @name("vm_vni") bit<24> vm_vni, @name("vnet_id") bit<16> vnet_id_1, @name("inbound_v4_stage1_dash_acl_group_id") bit<16> inbound_v4_stage1_dash_acl_group_id, @name("inbound_v4_stage2_dash_acl_group_id") bit<16> inbound_v4_stage2_dash_acl_group_id, @name("inbound_v4_stage3_dash_acl_group_id") bit<16> inbound_v4_stage3_dash_acl_group_id, @name("inbound_v4_stage4_dash_acl_group_id") bit<16> inbound_v4_stage4_dash_acl_group_id, @name("inbound_v4_stage5_dash_acl_group_id") bit<16> inbound_v4_stage5_dash_acl_group_id, @name("inbound_v6_stage1_dash_acl_group_id") bit<16> inbound_v6_stage1_dash_acl_group_id, @name("inbound_v6_stage2_dash_acl_group_id") bit<16> inbound_v6_stage2_dash_acl_group_id, @name("inbound_v6_stage3_dash_acl_group_id") bit<16> inbound_v6_stage3_dash_acl_group_id, @name("inbound_v6_stage4_dash_acl_group_id") bit<16> inbound_v6_stage4_dash_acl_group_id, @name("inbound_v6_stage5_dash_acl_group_id") bit<16> inbound_v6_stage5_dash_acl_group_id, @name("outbound_v4_stage1_dash_acl_group_id") bit<16> outbound_v4_stage1_dash_acl_group_id, @name("outbound_v4_stage2_dash_acl_group_id") bit<16> outbound_v4_stage2_dash_acl_group_id, @name("outbound_v4_stage3_dash_acl_group_id") bit<16> outbound_v4_stage3_dash_acl_group_id, @name("outbound_v4_stage4_dash_acl_group_id") bit<16> outbound_v4_stage4_dash_acl_group_id, @name("outbound_v4_stage5_dash_acl_group_id") bit<16> outbound_v4_stage5_dash_acl_group_id, @name("outbound_v6_stage1_dash_acl_group_id") bit<16> outbound_v6_stage1_dash_acl_group_id, @name("outbound_v6_stage2_dash_acl_group_id") bit<16> outbound_v6_stage2_dash_acl_group_id, @name("outbound_v6_stage3_dash_acl_group_id") bit<16> outbound_v6_stage3_dash_acl_group_id, @name("outbound_v6_stage4_dash_acl_group_id") bit<16> outbound_v6_stage4_dash_acl_group_id, @name("outbound_v6_stage5_dash_acl_group_id") bit<16> outbound_v6_stage5_dash_acl_group_id) { meta._eni_data_cps13 = cps_1; @@ -883,10 +643,10 @@ control dash_ingress(inout headers_t hdr, inout metadata_t meta, inout standard_ meta._dropped0 : exact @name("meta.dropped:dropped"); } actions = { - NoAction_3(); + NoAction_2(); } counters = eni_counter_0; - default_action = NoAction_3(); + default_action = NoAction_2(); } @name("dash_ingress.permit") action permit() { } @@ -945,10 +705,250 @@ control dash_ingress(inout headers_t hdr, inout metadata_t meta, inout standard_ } actions = { set_acl_group_attrs(); + @defaultonly NoAction_3(); + } + default_action = NoAction_3(); + } + @name("dash_ingress.outbound.route_vnet") action outbound_route_vnet_0(@name("dst_vnet_id") bit<16> dst_vnet_id_2) { + meta._dst_vnet_id11 = dst_vnet_id_2; + } + @name("dash_ingress.outbound.route_vnet_direct") action outbound_route_vnet_direct_0(@name("dst_vnet_id") bit<16> dst_vnet_id_3, @name("is_overlay_ip_v4_or_v6") bit<1> is_overlay_ip_v4_or_v6, @name("overlay_ip") bit<128> overlay_ip) { + meta._dst_vnet_id11 = dst_vnet_id_3; + meta._lkup_dst_ip_addr24 = overlay_ip; + meta._is_lkup_dst_ip_v620 = is_overlay_ip_v4_or_v6; + } + @name("dash_ingress.outbound.route_direct") action outbound_route_direct_0() { + } + @name("dash_ingress.outbound.drop") action outbound_drop_0() { + meta._dropped0 = true; + } + @name("dash_ingress.outbound.drop") action outbound_drop_1() { + meta._dropped0 = true; + } + @name("dash_ingress.outbound.routing_counter") direct_counter(CounterType.packets_and_bytes) outbound_routing_counter; + @name("dash_ingress.outbound.outbound_routing|dash_outbound_routing") table outbound_outbound_routing_dash_outbound_routing { + key = { + meta._eni_id12 : exact @name("meta.eni_id:eni_id"); + meta._is_overlay_ip_v619: exact @name("meta.is_overlay_ip_v6:is_destination_v4_or_v6"); + meta._dst_ip_addr22 : lpm @name("meta.dst_ip_addr:destination"); + } + actions = { + outbound_route_vnet_0(); + outbound_route_vnet_direct_0(); + outbound_route_direct_0(); + outbound_drop_0(); + } + const default_action = outbound_drop_0(); + counters = outbound_routing_counter; + } + @name("dash_ingress.outbound.set_tunnel_mapping") action outbound_set_tunnel_mapping_0(@name("underlay_dip") bit<32> underlay_dip_4, @name("overlay_dmac") bit<48> overlay_dmac_4, @name("use_dst_vnet_vni") bit<1> use_dst_vnet_vni) { + if (use_dst_vnet_vni == 1w1) { + meta._vnet_id10 = meta._dst_vnet_id11; + } + meta._encap_data_overlay_dmac8 = overlay_dmac_4; + meta._encap_data_underlay_dip5 = underlay_dip_4; + } + @name("dash_ingress.outbound.ca_to_pa_counter") direct_counter(CounterType.packets_and_bytes) outbound_ca_to_pa_counter; + @name("dash_ingress.outbound.outbound_ca_to_pa|dash_outbound_ca_to_pa") table outbound_outbound_ca_to_pa_dash_outbound_ca_to_pa { + key = { + meta._dst_vnet_id11 : exact @name("meta.dst_vnet_id:dst_vnet_id"); + meta._is_lkup_dst_ip_v620: exact @name("meta.is_lkup_dst_ip_v6:is_dip_v4_or_v6"); + meta._lkup_dst_ip_addr24 : exact @name("meta.lkup_dst_ip_addr:dip"); + } + actions = { + outbound_set_tunnel_mapping_0(); + @defaultonly outbound_drop_1(); + } + const default_action = outbound_drop_1(); + counters = outbound_ca_to_pa_counter; + } + @name("dash_ingress.outbound.set_vnet_attrs") action outbound_set_vnet_attrs_0(@name("vni") bit<24> vni_4) { + meta._encap_data_vni2 = vni_4; + } + @name("dash_ingress.outbound.vnet|dash_vnet") table outbound_vnet_dash_vnet { + key = { + meta._vnet_id10: exact @name("meta.vnet_id:vnet_id"); + } + actions = { + outbound_set_vnet_attrs_0(); @defaultonly NoAction_4(); } default_action = NoAction_4(); } + @name("dash_ingress.outbound.acl.permit") action outbound_acl_permit_0() { + } + @name("dash_ingress.outbound.acl.permit") action outbound_acl_permit_1() { + } + @name("dash_ingress.outbound.acl.permit") action outbound_acl_permit_2() { + } + @name("dash_ingress.outbound.acl.permit_and_continue") action outbound_acl_permit_and_continue_0() { + } + @name("dash_ingress.outbound.acl.permit_and_continue") action outbound_acl_permit_and_continue_1() { + } + @name("dash_ingress.outbound.acl.permit_and_continue") action outbound_acl_permit_and_continue_2() { + } + @name("dash_ingress.outbound.acl.deny") action outbound_acl_deny_0() { + meta._dropped0 = true; + } + @name("dash_ingress.outbound.acl.deny") action outbound_acl_deny_1() { + meta._dropped0 = true; + } + @name("dash_ingress.outbound.acl.deny") action outbound_acl_deny_2() { + meta._dropped0 = true; + } + @name("dash_ingress.outbound.acl.deny_and_continue") action outbound_acl_deny_and_continue_0() { + meta._dropped0 = true; + } + @name("dash_ingress.outbound.acl.deny_and_continue") action outbound_acl_deny_and_continue_1() { + meta._dropped0 = true; + } + @name("dash_ingress.outbound.acl.deny_and_continue") action outbound_acl_deny_and_continue_2() { + meta._dropped0 = true; + } + @name("dash_ingress.outbound.acl.stage1_counter") direct_counter(CounterType.packets_and_bytes) outbound_acl_stage1_counter; + @name("dash_ingress.outbound.acl.stage1:dash_acl_rule|dash_acl") table outbound_acl_stage1_dash_acl_rule_dash_acl { + key = { + meta._stage1_dash_acl_group_id29: exact @name("meta.dash_acl_group_id:dash_acl_group_id"); + meta._dst_ip_addr22 : optional @name("meta.dst_ip_addr:dip"); + meta._src_ip_addr23 : optional @name("meta.src_ip_addr:sip"); + meta._ip_protocol21 : optional @name("meta.ip_protocol:protocol"); + meta._src_l4_port27 : optional @name("meta.src_l4_port:src_port"); + meta._dst_l4_port28 : optional @name("meta.dst_l4_port:dst_port"); + } + actions = { + outbound_acl_permit_0(); + outbound_acl_permit_and_continue_0(); + outbound_acl_deny_0(); + outbound_acl_deny_and_continue_0(); + } + default_action = outbound_acl_deny_0(); + counters = outbound_acl_stage1_counter; + } + @name("dash_ingress.outbound.acl.stage2_counter") direct_counter(CounterType.packets_and_bytes) outbound_acl_stage2_counter; + @name("dash_ingress.outbound.acl.stage2:dash_acl_rule|dash_acl") table outbound_acl_stage2_dash_acl_rule_dash_acl { + key = { + meta._stage2_dash_acl_group_id30: exact @name("meta.dash_acl_group_id:dash_acl_group_id"); + meta._dst_ip_addr22 : optional @name("meta.dst_ip_addr:dip"); + meta._src_ip_addr23 : optional @name("meta.src_ip_addr:sip"); + meta._ip_protocol21 : optional @name("meta.ip_protocol:protocol"); + meta._src_l4_port27 : optional @name("meta.src_l4_port:src_port"); + meta._dst_l4_port28 : optional @name("meta.dst_l4_port:dst_port"); + } + actions = { + outbound_acl_permit_1(); + outbound_acl_permit_and_continue_1(); + outbound_acl_deny_1(); + outbound_acl_deny_and_continue_1(); + } + default_action = outbound_acl_deny_1(); + counters = outbound_acl_stage2_counter; + } + @name("dash_ingress.outbound.acl.stage3_counter") direct_counter(CounterType.packets_and_bytes) outbound_acl_stage3_counter; + @name("dash_ingress.outbound.acl.stage3:dash_acl_rule|dash_acl") table outbound_acl_stage3_dash_acl_rule_dash_acl { + key = { + meta._stage3_dash_acl_group_id31: exact @name("meta.dash_acl_group_id:dash_acl_group_id"); + meta._dst_ip_addr22 : optional @name("meta.dst_ip_addr:dip"); + meta._src_ip_addr23 : optional @name("meta.src_ip_addr:sip"); + meta._ip_protocol21 : optional @name("meta.ip_protocol:protocol"); + meta._src_l4_port27 : optional @name("meta.src_l4_port:src_port"); + meta._dst_l4_port28 : optional @name("meta.dst_l4_port:dst_port"); + } + actions = { + outbound_acl_permit_2(); + outbound_acl_permit_and_continue_2(); + outbound_acl_deny_2(); + outbound_acl_deny_and_continue_2(); + } + default_action = outbound_acl_deny_2(); + counters = outbound_acl_stage3_counter; + } + @name("dash_ingress.inbound.acl.permit") action inbound_acl_permit_0() { + } + @name("dash_ingress.inbound.acl.permit") action inbound_acl_permit_1() { + } + @name("dash_ingress.inbound.acl.permit") action inbound_acl_permit_2() { + } + @name("dash_ingress.inbound.acl.permit_and_continue") action inbound_acl_permit_and_continue_0() { + } + @name("dash_ingress.inbound.acl.permit_and_continue") action inbound_acl_permit_and_continue_1() { + } + @name("dash_ingress.inbound.acl.permit_and_continue") action inbound_acl_permit_and_continue_2() { + } + @name("dash_ingress.inbound.acl.deny") action inbound_acl_deny_0() { + meta._dropped0 = true; + } + @name("dash_ingress.inbound.acl.deny") action inbound_acl_deny_1() { + meta._dropped0 = true; + } + @name("dash_ingress.inbound.acl.deny") action inbound_acl_deny_2() { + meta._dropped0 = true; + } + @name("dash_ingress.inbound.acl.deny_and_continue") action inbound_acl_deny_and_continue_0() { + meta._dropped0 = true; + } + @name("dash_ingress.inbound.acl.deny_and_continue") action inbound_acl_deny_and_continue_1() { + meta._dropped0 = true; + } + @name("dash_ingress.inbound.acl.deny_and_continue") action inbound_acl_deny_and_continue_2() { + meta._dropped0 = true; + } + @name("dash_ingress.inbound.acl.stage1_counter") direct_counter(CounterType.packets_and_bytes) inbound_acl_stage1_counter; + @name("dash_ingress.inbound.acl.stage1:dash_acl_rule|dash_acl") table inbound_acl_stage1_dash_acl_rule_dash_acl { + key = { + meta._stage1_dash_acl_group_id29: exact @name("meta.dash_acl_group_id:dash_acl_group_id"); + meta._dst_ip_addr22 : optional @name("meta.dst_ip_addr:dip"); + meta._src_ip_addr23 : optional @name("meta.src_ip_addr:sip"); + meta._ip_protocol21 : optional @name("meta.ip_protocol:protocol"); + meta._src_l4_port27 : optional @name("meta.src_l4_port:src_port"); + meta._dst_l4_port28 : optional @name("meta.dst_l4_port:dst_port"); + } + actions = { + inbound_acl_permit_0(); + inbound_acl_permit_and_continue_0(); + inbound_acl_deny_0(); + inbound_acl_deny_and_continue_0(); + } + default_action = inbound_acl_deny_0(); + counters = inbound_acl_stage1_counter; + } + @name("dash_ingress.inbound.acl.stage2_counter") direct_counter(CounterType.packets_and_bytes) inbound_acl_stage2_counter; + @name("dash_ingress.inbound.acl.stage2:dash_acl_rule|dash_acl") table inbound_acl_stage2_dash_acl_rule_dash_acl { + key = { + meta._stage2_dash_acl_group_id30: exact @name("meta.dash_acl_group_id:dash_acl_group_id"); + meta._dst_ip_addr22 : optional @name("meta.dst_ip_addr:dip"); + meta._src_ip_addr23 : optional @name("meta.src_ip_addr:sip"); + meta._ip_protocol21 : optional @name("meta.ip_protocol:protocol"); + meta._src_l4_port27 : optional @name("meta.src_l4_port:src_port"); + meta._dst_l4_port28 : optional @name("meta.dst_l4_port:dst_port"); + } + actions = { + inbound_acl_permit_1(); + inbound_acl_permit_and_continue_1(); + inbound_acl_deny_1(); + inbound_acl_deny_and_continue_1(); + } + default_action = inbound_acl_deny_1(); + counters = inbound_acl_stage2_counter; + } + @name("dash_ingress.inbound.acl.stage3_counter") direct_counter(CounterType.packets_and_bytes) inbound_acl_stage3_counter; + @name("dash_ingress.inbound.acl.stage3:dash_acl_rule|dash_acl") table inbound_acl_stage3_dash_acl_rule_dash_acl { + key = { + meta._stage3_dash_acl_group_id31: exact @name("meta.dash_acl_group_id:dash_acl_group_id"); + meta._dst_ip_addr22 : optional @name("meta.dst_ip_addr:dip"); + meta._src_ip_addr23 : optional @name("meta.src_ip_addr:sip"); + meta._ip_protocol21 : optional @name("meta.ip_protocol:protocol"); + meta._src_l4_port27 : optional @name("meta.src_l4_port:src_port"); + meta._dst_l4_port28 : optional @name("meta.dst_l4_port:dst_port"); + } + actions = { + inbound_acl_permit_2(); + inbound_acl_permit_and_continue_2(); + inbound_acl_deny_2(); + inbound_acl_deny_and_continue_2(); + } + default_action = inbound_acl_deny_2(); + counters = inbound_acl_stage3_counter; + } @hidden action dashpipeline721() { meta._encap_data_underlay_sip4 = hdr.ipv4.dst_addr; } diff --git a/testdata/p4_16_samples_outputs/dash/dash-pipeline.p4.p4info.txt b/testdata/p4_16_samples_outputs/dash/dash-pipeline.p4.p4info.txt index 24cb1b3c37..4d9d01fcd5 100644 --- a/testdata/p4_16_samples_outputs/dash/dash-pipeline.p4.p4info.txt +++ b/testdata/p4_16_samples_outputs/dash/dash-pipeline.p4.p4info.txt @@ -3,173 +3,235 @@ pkg_info { } tables { preamble { - id: 33810473 - name: "dash_ingress.outbound.acl.stage1:dash_acl_rule|dash_acl" - alias: "outbound.acl.stage1:dash_acl_rule|dash_acl" + id: 38937816 + name: "dash_ingress.vip|dash_vip" + alias: "vip|dash_vip" } match_fields { id: 1 - name: "meta.dash_acl_group_id:dash_acl_group_id" - bitwidth: 16 + name: "hdr.ipv4.dst_addr:VIP" + bitwidth: 32 match_type: EXACT } - match_fields { - id: 2 - name: "meta.dst_ip_addr:dip" - bitwidth: 128 - match_type: OPTIONAL + action_refs { + id: 26041632 } - match_fields { - id: 3 - name: "meta.src_ip_addr:sip" - bitwidth: 128 - match_type: OPTIONAL + action_refs { + id: 23563653 + annotations: "@defaultonly" + scope: DEFAULT_ONLY } - match_fields { - id: 4 - name: "meta.ip_protocol:protocol" - bitwidth: 8 - match_type: OPTIONAL + const_default_action_id: 23563653 + size: 1024 +} +tables { + preamble { + id: 38960243 + name: "dash_ingress.direction_lookup|dash_direction_lookup" + alias: "direction_lookup|dash_direction_lookup" } match_fields { - id: 5 - name: "meta.src_l4_port:src_port" - bitwidth: 16 - match_type: OPTIONAL + id: 1 + name: "hdr.vxlan.vni:VNI" + bitwidth: 24 + match_type: EXACT + } + action_refs { + id: 21912829 + } + action_refs { + id: 20977739 + annotations: "@defaultonly" + scope: DEFAULT_ONLY + } + const_default_action_id: 20977739 + size: 1024 +} +tables { + preamble { + id: 42701762 + name: "dash_ingress.appliance" + alias: "appliance" } match_fields { - id: 6 - name: "meta.dst_l4_port:dst_port" - bitwidth: 16 - match_type: OPTIONAL + id: 1 + name: "meta.appliance_id:appliance_id" + bitwidth: 8 + match_type: TERNARY } action_refs { - id: 18858683 + id: 21793905 } action_refs { - id: 24263137 + id: 21257015 + annotations: "@defaultonly" + scope: DEFAULT_ONLY + } + size: 1024 +} +tables { + preamble { + id: 47336097 + name: "dash_ingress.eni|dash_eni" + alias: "eni|dash_eni" + } + match_fields { + id: 1 + name: "meta.eni_id:eni_id" + bitwidth: 16 + match_type: EXACT } action_refs { - id: 29962337 + id: 27167550 } action_refs { - id: 26077229 + id: 23563653 + annotations: "@defaultonly" + scope: DEFAULT_ONLY } - direct_resource_ids: 324963620 + const_default_action_id: 23563653 size: 1024 } tables { preamble { - id: 49812549 - name: "dash_ingress.outbound.acl.stage2:dash_acl_rule|dash_acl" - alias: "outbound.acl.stage2:dash_acl_rule|dash_acl" + id: 40418231 + name: "dash_ingress.eni_meter" + alias: "eni_meter" } match_fields { id: 1 - name: "meta.dash_acl_group_id:dash_acl_group_id" + name: "meta.eni_id:eni_id" bitwidth: 16 match_type: EXACT } match_fields { id: 2 - name: "meta.dst_ip_addr:dip" - bitwidth: 128 - match_type: OPTIONAL + name: "meta.direction:direction" + bitwidth: 16 + match_type: EXACT } match_fields { id: 3 - name: "meta.src_ip_addr:sip" - bitwidth: 128 - match_type: OPTIONAL + name: "meta.dropped:dropped" + bitwidth: 1 + match_type: EXACT } - match_fields { - id: 4 - name: "meta.ip_protocol:protocol" - bitwidth: 8 - match_type: OPTIONAL + action_refs { + id: 21257015 } - match_fields { - id: 5 - name: "meta.src_l4_port:src_port" - bitwidth: 16 - match_type: OPTIONAL + direct_resource_ids: 322696367 + size: 1024 +} +tables { + preamble { + id: 48948181 + name: "dash_ingress.pa_validation|dash_pa_validation" + alias: "pa_validation|dash_pa_validation" } match_fields { - id: 6 - name: "meta.dst_l4_port:dst_port" + id: 1 + name: "meta.vnet_id:vnet_id" bitwidth: 16 - match_type: OPTIONAL - } - action_refs { - id: 18858683 + match_type: EXACT } - action_refs { - id: 24263137 + match_fields { + id: 2 + name: "hdr.ipv4.src_addr:sip" + bitwidth: 32 + match_type: EXACT } action_refs { - id: 29962337 + id: 32591400 } action_refs { - id: 26077229 + id: 23563653 + annotations: "@defaultonly" + scope: DEFAULT_ONLY } - direct_resource_ids: 334749261 + const_default_action_id: 23563653 size: 1024 } tables { preamble { - id: 40782112 - name: "dash_ingress.outbound.acl.stage3:dash_acl_rule|dash_acl" - alias: "outbound.acl.stage3:dash_acl_rule|dash_acl" + id: 42758350 + name: "dash_ingress.inbound_routing|dash_inbound_routing" + alias: "inbound_routing|dash_inbound_routing" } match_fields { id: 1 - name: "meta.dash_acl_group_id:dash_acl_group_id" + name: "meta.eni_id:eni_id" bitwidth: 16 match_type: EXACT } match_fields { id: 2 - name: "meta.dst_ip_addr:dip" - bitwidth: 128 - match_type: OPTIONAL + name: "hdr.vxlan.vni:VNI" + bitwidth: 24 + match_type: EXACT } match_fields { id: 3 - name: "meta.src_ip_addr:sip" - bitwidth: 128 - match_type: OPTIONAL + name: "hdr.ipv4.src_addr:sip" + bitwidth: 32 + match_type: TERNARY } - match_fields { - id: 4 - name: "meta.ip_protocol:protocol" - bitwidth: 8 - match_type: OPTIONAL + action_refs { + id: 28528336 } - match_fields { - id: 5 - name: "meta.src_l4_port:src_port" - bitwidth: 16 - match_type: OPTIONAL + action_refs { + id: 22711915 + } + action_refs { + id: 23563653 + annotations: "@defaultonly" + scope: DEFAULT_ONLY + } + const_default_action_id: 23563653 + size: 1024 +} +tables { + preamble { + id: 38612462 + name: "dash_ingress.eni_ether_address_map|dash_eni" + alias: "eni_ether_address_map|dash_eni" } match_fields { - id: 6 - name: "meta.dst_l4_port:dst_port" - bitwidth: 16 - match_type: OPTIONAL + id: 1 + name: "meta.eni_addr:address" + bitwidth: 48 + match_type: EXACT } action_refs { - id: 18858683 + id: 18228884 } action_refs { - id: 24263137 + id: 23563653 + annotations: "@defaultonly" + scope: DEFAULT_ONLY + } + const_default_action_id: 23563653 + size: 1024 +} +tables { + preamble { + id: 45323240 + name: "dash_ingress.dash_acl_group|dash_acl" + alias: "dash_acl_group|dash_acl" + } + match_fields { + id: 1 + name: "meta.stage1_dash_acl_group_id:dash_acl_group_id" + bitwidth: 16 + match_type: EXACT } action_refs { - id: 29962337 + id: 25655048 } action_refs { - id: 26077229 + id: 21257015 + annotations: "@defaultonly" + scope: DEFAULT_ONLY } - direct_resource_ids: 320450761 size: 1024 } tables { @@ -272,9 +334,9 @@ tables { } tables { preamble { - id: 33901322 - name: "dash_ingress.inbound.acl.stage1:dash_acl_rule|dash_acl" - alias: "inbound.acl.stage1:dash_acl_rule|dash_acl" + id: 33810473 + name: "dash_ingress.outbound.acl.stage1:dash_acl_rule|dash_acl" + alias: "outbound.acl.stage1:dash_acl_rule|dash_acl" } match_fields { id: 1 @@ -313,25 +375,25 @@ tables { match_type: OPTIONAL } action_refs { - id: 32161567 + id: 18858683 } action_refs { - id: 20706700 + id: 24263137 } action_refs { - id: 28146588 + id: 29962337 } action_refs { - id: 31424218 + id: 26077229 } - direct_resource_ids: 320981527 + direct_resource_ids: 324963620 size: 1024 } tables { preamble { - id: 44184066 - name: "dash_ingress.inbound.acl.stage2:dash_acl_rule|dash_acl" - alias: "inbound.acl.stage2:dash_acl_rule|dash_acl" + id: 49812549 + name: "dash_ingress.outbound.acl.stage2:dash_acl_rule|dash_acl" + alias: "outbound.acl.stage2:dash_acl_rule|dash_acl" } match_fields { id: 1 @@ -370,25 +432,25 @@ tables { match_type: OPTIONAL } action_refs { - id: 32161567 + id: 18858683 } action_refs { - id: 20706700 + id: 24263137 } action_refs { - id: 28146588 + id: 29962337 } action_refs { - id: 31424218 + id: 26077229 } - direct_resource_ids: 322865948 + direct_resource_ids: 334749261 size: 1024 } tables { preamble { - id: 46150034 - name: "dash_ingress.inbound.acl.stage3:dash_acl_rule|dash_acl" - alias: "inbound.acl.stage3:dash_acl_rule|dash_acl" + id: 40782112 + name: "dash_ingress.outbound.acl.stage3:dash_acl_rule|dash_acl" + alias: "outbound.acl.stage3:dash_acl_rule|dash_acl" } match_fields { id: 1 @@ -427,411 +489,211 @@ tables { match_type: OPTIONAL } action_refs { - id: 32161567 + id: 18858683 } action_refs { - id: 20706700 + id: 24263137 } action_refs { - id: 28146588 + id: 29962337 } action_refs { - id: 31424218 + id: 26077229 } - direct_resource_ids: 328370481 + direct_resource_ids: 320450761 size: 1024 } tables { preamble { - id: 38937816 - name: "dash_ingress.vip|dash_vip" - alias: "vip|dash_vip" + id: 33901322 + name: "dash_ingress.inbound.acl.stage1:dash_acl_rule|dash_acl" + alias: "inbound.acl.stage1:dash_acl_rule|dash_acl" } match_fields { id: 1 - name: "hdr.ipv4.dst_addr:VIP" - bitwidth: 32 + name: "meta.dash_acl_group_id:dash_acl_group_id" + bitwidth: 16 match_type: EXACT } - action_refs { - id: 26041632 - } - action_refs { - id: 23563653 - annotations: "@defaultonly" - scope: DEFAULT_ONLY - } - const_default_action_id: 23563653 - size: 1024 -} -tables { - preamble { - id: 38960243 - name: "dash_ingress.direction_lookup|dash_direction_lookup" - alias: "direction_lookup|dash_direction_lookup" - } match_fields { - id: 1 - name: "hdr.vxlan.vni:VNI" - bitwidth: 24 - match_type: EXACT + id: 2 + name: "meta.dst_ip_addr:dip" + bitwidth: 128 + match_type: OPTIONAL } - action_refs { - id: 21912829 + match_fields { + id: 3 + name: "meta.src_ip_addr:sip" + bitwidth: 128 + match_type: OPTIONAL } - action_refs { - id: 20977739 - annotations: "@defaultonly" - scope: DEFAULT_ONLY + match_fields { + id: 4 + name: "meta.ip_protocol:protocol" + bitwidth: 8 + match_type: OPTIONAL } - const_default_action_id: 20977739 - size: 1024 -} -tables { - preamble { - id: 42701762 - name: "dash_ingress.appliance" - alias: "appliance" + match_fields { + id: 5 + name: "meta.src_l4_port:src_port" + bitwidth: 16 + match_type: OPTIONAL } match_fields { - id: 1 - name: "meta.appliance_id:appliance_id" - bitwidth: 8 - match_type: TERNARY + id: 6 + name: "meta.dst_l4_port:dst_port" + bitwidth: 16 + match_type: OPTIONAL } action_refs { - id: 21793905 + id: 32161567 } action_refs { - id: 21257015 - annotations: "@defaultonly" - scope: DEFAULT_ONLY - } - size: 1024 -} -tables { - preamble { - id: 47336097 - name: "dash_ingress.eni|dash_eni" - alias: "eni|dash_eni" - } - match_fields { - id: 1 - name: "meta.eni_id:eni_id" - bitwidth: 16 - match_type: EXACT + id: 20706700 } action_refs { - id: 27167550 + id: 28146588 } action_refs { - id: 23563653 - annotations: "@defaultonly" - scope: DEFAULT_ONLY + id: 31424218 } - const_default_action_id: 23563653 + direct_resource_ids: 320981527 size: 1024 } tables { preamble { - id: 40418231 - name: "dash_ingress.eni_meter" - alias: "eni_meter" + id: 44184066 + name: "dash_ingress.inbound.acl.stage2:dash_acl_rule|dash_acl" + alias: "inbound.acl.stage2:dash_acl_rule|dash_acl" } match_fields { id: 1 - name: "meta.eni_id:eni_id" + name: "meta.dash_acl_group_id:dash_acl_group_id" bitwidth: 16 match_type: EXACT } match_fields { id: 2 - name: "meta.direction:direction" - bitwidth: 16 - match_type: EXACT + name: "meta.dst_ip_addr:dip" + bitwidth: 128 + match_type: OPTIONAL } match_fields { id: 3 - name: "meta.dropped:dropped" - bitwidth: 1 - match_type: EXACT - } - action_refs { - id: 21257015 - } - direct_resource_ids: 322696367 - size: 1024 -} -tables { - preamble { - id: 48948181 - name: "dash_ingress.pa_validation|dash_pa_validation" - alias: "pa_validation|dash_pa_validation" - } - match_fields { - id: 1 - name: "meta.vnet_id:vnet_id" - bitwidth: 16 - match_type: EXACT + name: "meta.src_ip_addr:sip" + bitwidth: 128 + match_type: OPTIONAL } match_fields { - id: 2 - name: "hdr.ipv4.src_addr:sip" - bitwidth: 32 - match_type: EXACT - } - action_refs { - id: 32591400 - } - action_refs { - id: 23563653 - annotations: "@defaultonly" - scope: DEFAULT_ONLY - } - const_default_action_id: 23563653 - size: 1024 -} -tables { - preamble { - id: 42758350 - name: "dash_ingress.inbound_routing|dash_inbound_routing" - alias: "inbound_routing|dash_inbound_routing" + id: 4 + name: "meta.ip_protocol:protocol" + bitwidth: 8 + match_type: OPTIONAL } match_fields { - id: 1 - name: "meta.eni_id:eni_id" + id: 5 + name: "meta.src_l4_port:src_port" bitwidth: 16 - match_type: EXACT - } - match_fields { - id: 2 - name: "hdr.vxlan.vni:VNI" - bitwidth: 24 - match_type: EXACT + match_type: OPTIONAL } match_fields { - id: 3 - name: "hdr.ipv4.src_addr:sip" - bitwidth: 32 - match_type: TERNARY - } - action_refs { - id: 28528336 + id: 6 + name: "meta.dst_l4_port:dst_port" + bitwidth: 16 + match_type: OPTIONAL } action_refs { - id: 22711915 + id: 32161567 } action_refs { - id: 23563653 - annotations: "@defaultonly" - scope: DEFAULT_ONLY - } - const_default_action_id: 23563653 - size: 1024 -} -tables { - preamble { - id: 38612462 - name: "dash_ingress.eni_ether_address_map|dash_eni" - alias: "eni_ether_address_map|dash_eni" - } - match_fields { - id: 1 - name: "meta.eni_addr:address" - bitwidth: 48 - match_type: EXACT + id: 20706700 } action_refs { - id: 18228884 + id: 28146588 } action_refs { - id: 23563653 - annotations: "@defaultonly" - scope: DEFAULT_ONLY + id: 31424218 } - const_default_action_id: 23563653 + direct_resource_ids: 322865948 size: 1024 } tables { preamble { - id: 45323240 - name: "dash_ingress.dash_acl_group|dash_acl" - alias: "dash_acl_group|dash_acl" + id: 46150034 + name: "dash_ingress.inbound.acl.stage3:dash_acl_rule|dash_acl" + alias: "inbound.acl.stage3:dash_acl_rule|dash_acl" } match_fields { id: 1 - name: "meta.stage1_dash_acl_group_id:dash_acl_group_id" + name: "meta.dash_acl_group_id:dash_acl_group_id" bitwidth: 16 match_type: EXACT } - action_refs { - id: 25655048 - } - 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: 28528336 - name: "vxlan_decap" - alias: "vxlan_decap" - } -} -actions { - preamble { - id: 29669127 - name: "vxlan_encap" - alias: "vxlan_encap" - } -} -actions { - preamble { - id: 18858683 - name: "dash_ingress.outbound.acl.permit" - alias: "outbound.acl.permit" - } -} -actions { - preamble { - id: 24263137 - name: "dash_ingress.outbound.acl.permit_and_continue" - alias: "outbound.acl.permit_and_continue" - } -} -actions { - preamble { - id: 29962337 - name: "dash_ingress.outbound.acl.deny" - alias: "outbound.acl.deny" - } -} -actions { - preamble { - id: 26077229 - name: "dash_ingress.outbound.acl.deny_and_continue" - alias: "outbound.acl.deny_and_continue" - } -} -actions { - preamble { - id: 25364446 - name: "dash_ingress.outbound.route_vnet" - alias: "route_vnet" - } - params { - id: 1 - name: "dst_vnet_id" - bitwidth: 16 - } -} -actions { - preamble { - id: 31116088 - name: "dash_ingress.outbound.route_vnet_direct" - alias: "route_vnet_direct" - } - params { - id: 1 - name: "dst_vnet_id" - bitwidth: 16 - } - params { + match_fields { id: 2 - name: "is_overlay_ip_v4_or_v6" - bitwidth: 1 + name: "meta.dst_ip_addr:dip" + bitwidth: 128 + match_type: OPTIONAL } - params { + match_fields { id: 3 - name: "overlay_ip" + name: "meta.src_ip_addr:sip" bitwidth: 128 + match_type: OPTIONAL } -} -actions { - preamble { - id: 22900588 - name: "dash_ingress.outbound.route_direct" - alias: "route_direct" - } -} -actions { - preamble { - id: 33407636 - name: "dash_ingress.outbound.drop" - alias: "drop" - } -} -actions { - preamble { - id: 25450412 - name: "dash_ingress.outbound.set_tunnel_mapping" - alias: "set_tunnel_mapping" + match_fields { + id: 4 + name: "meta.ip_protocol:protocol" + bitwidth: 8 + match_type: OPTIONAL } - params { - id: 1 - name: "underlay_dip" - bitwidth: 32 + match_fields { + id: 5 + name: "meta.src_l4_port:src_port" + bitwidth: 16 + match_type: OPTIONAL } - params { - id: 2 - name: "overlay_dmac" - bitwidth: 48 + match_fields { + id: 6 + name: "meta.dst_l4_port:dst_port" + bitwidth: 16 + match_type: OPTIONAL } - params { - id: 3 - name: "use_dst_vnet_vni" - bitwidth: 1 + action_refs { + id: 32161567 } -} -actions { - preamble { - id: 17187022 - name: "dash_ingress.outbound.set_vnet_attrs" - alias: "set_vnet_attrs" + action_refs { + id: 20706700 } - params { - id: 1 - name: "vni" - bitwidth: 24 + action_refs { + id: 28146588 } -} -actions { - preamble { - id: 32161567 - name: "dash_ingress.inbound.acl.permit" - alias: "inbound.acl.permit" + action_refs { + id: 31424218 } + direct_resource_ids: 328370481 + size: 1024 } actions { preamble { - id: 20706700 - name: "dash_ingress.inbound.acl.permit_and_continue" - alias: "inbound.acl.permit_and_continue" + id: 21257015 + name: "NoAction" + alias: "NoAction" + annotations: "@noWarn(\"unused\")" } } actions { preamble { - id: 28146588 - name: "dash_ingress.inbound.acl.deny" - alias: "inbound.acl.deny" + id: 28528336 + name: "vxlan_decap" + alias: "vxlan_decap" } } actions { preamble { - id: 31424218 - name: "dash_ingress.inbound.acl.deny_and_continue" - alias: "inbound.acl.deny_and_continue" + id: 29669127 + name: "vxlan_encap" + alias: "vxlan_encap" } } actions { @@ -1071,38 +933,154 @@ actions { bitwidth: 32 } } -direct_counters { +actions { preamble { - id: 324963620 - name: "dash_ingress.outbound.acl.stage1_counter" - alias: "outbound.acl.stage1_counter" + id: 25364446 + name: "dash_ingress.outbound.route_vnet" + alias: "route_vnet" } - spec { - unit: BOTH + params { + id: 1 + name: "dst_vnet_id" + bitwidth: 16 } - direct_table_id: 33810473 } -direct_counters { +actions { preamble { - id: 334749261 - name: "dash_ingress.outbound.acl.stage2_counter" - alias: "outbound.acl.stage2_counter" + id: 31116088 + name: "dash_ingress.outbound.route_vnet_direct" + alias: "route_vnet_direct" } - spec { - unit: BOTH + params { + id: 1 + name: "dst_vnet_id" + bitwidth: 16 + } + params { + id: 2 + name: "is_overlay_ip_v4_or_v6" + bitwidth: 1 + } + params { + id: 3 + name: "overlay_ip" + bitwidth: 128 + } +} +actions { + preamble { + id: 22900588 + name: "dash_ingress.outbound.route_direct" + alias: "route_direct" + } +} +actions { + preamble { + id: 33407636 + name: "dash_ingress.outbound.drop" + alias: "drop" + } +} +actions { + preamble { + id: 25450412 + name: "dash_ingress.outbound.set_tunnel_mapping" + alias: "set_tunnel_mapping" + } + params { + id: 1 + name: "underlay_dip" + bitwidth: 32 + } + params { + id: 2 + name: "overlay_dmac" + bitwidth: 48 + } + params { + id: 3 + name: "use_dst_vnet_vni" + bitwidth: 1 + } +} +actions { + preamble { + id: 17187022 + name: "dash_ingress.outbound.set_vnet_attrs" + alias: "set_vnet_attrs" + } + params { + id: 1 + name: "vni" + bitwidth: 24 + } +} +actions { + preamble { + id: 18858683 + name: "dash_ingress.outbound.acl.permit" + alias: "outbound.acl.permit" + } +} +actions { + preamble { + id: 24263137 + name: "dash_ingress.outbound.acl.permit_and_continue" + alias: "outbound.acl.permit_and_continue" + } +} +actions { + preamble { + id: 29962337 + name: "dash_ingress.outbound.acl.deny" + alias: "outbound.acl.deny" + } +} +actions { + preamble { + id: 26077229 + name: "dash_ingress.outbound.acl.deny_and_continue" + alias: "outbound.acl.deny_and_continue" + } +} +actions { + preamble { + id: 32161567 + name: "dash_ingress.inbound.acl.permit" + alias: "inbound.acl.permit" + } +} +actions { + preamble { + id: 20706700 + name: "dash_ingress.inbound.acl.permit_and_continue" + alias: "inbound.acl.permit_and_continue" + } +} +actions { + preamble { + id: 28146588 + name: "dash_ingress.inbound.acl.deny" + alias: "inbound.acl.deny" + } +} +actions { + preamble { + id: 31424218 + name: "dash_ingress.inbound.acl.deny_and_continue" + alias: "inbound.acl.deny_and_continue" } - direct_table_id: 49812549 } direct_counters { preamble { - id: 320450761 - name: "dash_ingress.outbound.acl.stage3_counter" - alias: "outbound.acl.stage3_counter" + id: 322696367 + name: "dash_ingress.eni_counter" + alias: "eni_counter" } spec { unit: BOTH } - direct_table_id: 40782112 + direct_table_id: 40418231 } direct_counters { preamble { @@ -1126,6 +1104,39 @@ direct_counters { } direct_table_id: 48860231 } +direct_counters { + preamble { + id: 324963620 + name: "dash_ingress.outbound.acl.stage1_counter" + alias: "outbound.acl.stage1_counter" + } + spec { + unit: BOTH + } + direct_table_id: 33810473 +} +direct_counters { + preamble { + id: 334749261 + name: "dash_ingress.outbound.acl.stage2_counter" + alias: "outbound.acl.stage2_counter" + } + spec { + unit: BOTH + } + direct_table_id: 49812549 +} +direct_counters { + preamble { + id: 320450761 + name: "dash_ingress.outbound.acl.stage3_counter" + alias: "outbound.acl.stage3_counter" + } + spec { + unit: BOTH + } + direct_table_id: 40782112 +} direct_counters { preamble { id: 320981527 @@ -1159,17 +1170,6 @@ direct_counters { } direct_table_id: 46150034 } -direct_counters { - preamble { - id: 322696367 - name: "dash_ingress.eni_counter" - alias: "eni_counter" - } - spec { - unit: BOTH - } - direct_table_id: 40418231 -} type_info { serializable_enums { key: "direction_t" diff --git a/testdata/p4_16_samples_outputs/extern-inst-as-param-first.p4 b/testdata/p4_16_samples_outputs/extern-inst-as-param-first.p4 new file mode 100644 index 0000000000..67c6e757ba --- /dev/null +++ b/testdata/p4_16_samples_outputs/extern-inst-as-param-first.p4 @@ -0,0 +1,36 @@ +#include + +extern MyCounter { + MyCounter(bit<32> size); + void count(in I index); +} + +typedef bit<10> my_counter_index_t; +typedef MyCounter my_counter_t; +control Inner(my_counter_t counter_set) { + action count(my_counter_index_t index) { + counter_set.count(index); + } + table counter_table { + actions = { + count(); + @defaultonly NoAction(); + } + default_action = NoAction(); + } + apply { + counter_table.apply(); + } +} + +control Test() { + my_counter_t(32w1024) counter_set; + @name("Inner") Inner() Inner_inst; + apply { + Inner_inst.apply(counter_set); + } +} + +control C(); +package P(C _c); +P(Test()) main; diff --git a/testdata/p4_16_samples_outputs/extern-inst-as-param-frontend.p4 b/testdata/p4_16_samples_outputs/extern-inst-as-param-frontend.p4 new file mode 100644 index 0000000000..4d728d29a2 --- /dev/null +++ b/testdata/p4_16_samples_outputs/extern-inst-as-param-frontend.p4 @@ -0,0 +1,31 @@ +#include + +extern MyCounter { + MyCounter(bit<32> size); + void count(in I index); +} + +typedef bit<10> my_counter_index_t; +typedef MyCounter my_counter_t; +control Test() { + @noWarn("unused") @name(".NoAction") action NoAction_1() { + } + @name("Test.counter_set") my_counter_t(32w1024) counter_set_0; + @name("Test.Inner.count") action Inner_count_0(@name("index") my_counter_index_t index_1) { + counter_set_0.count(index_1); + } + @name("Test.Inner.counter_table") table Inner_counter_table { + actions = { + Inner_count_0(); + @defaultonly NoAction_1(); + } + default_action = NoAction_1(); + } + apply { + Inner_counter_table.apply(); + } +} + +control C(); +package P(C _c); +P(Test()) main; diff --git a/testdata/p4_16_samples_outputs/extern-inst-as-param-midend.p4 b/testdata/p4_16_samples_outputs/extern-inst-as-param-midend.p4 new file mode 100644 index 0000000000..aa4c688cb5 --- /dev/null +++ b/testdata/p4_16_samples_outputs/extern-inst-as-param-midend.p4 @@ -0,0 +1,29 @@ +#include + +extern MyCounter { + MyCounter(bit<32> size); + void count(in I index); +} + +control Test() { + @noWarn("unused") @name(".NoAction") action NoAction_1() { + } + @name("Test.counter_set") MyCounter>(32w1024) counter_set_0; + @name("Test.Inner.count") action Inner_count_0(@name("index") bit<10> index_1) { + counter_set_0.count(index_1); + } + @name("Test.Inner.counter_table") table Inner_counter_table { + actions = { + Inner_count_0(); + @defaultonly NoAction_1(); + } + default_action = NoAction_1(); + } + apply { + Inner_counter_table.apply(); + } +} + +control C(); +package P(C _c); +P(Test()) main; diff --git a/testdata/p4_16_samples_outputs/extern-inst-as-param.p4 b/testdata/p4_16_samples_outputs/extern-inst-as-param.p4 new file mode 100644 index 0000000000..bf492f8754 --- /dev/null +++ b/testdata/p4_16_samples_outputs/extern-inst-as-param.p4 @@ -0,0 +1,33 @@ +#include + +extern MyCounter { + MyCounter(bit<32> size); + void count(in I index); +} + +typedef bit<10> my_counter_index_t; +typedef MyCounter my_counter_t; +control Inner(my_counter_t counter_set) { + action count(my_counter_index_t index) { + counter_set.count(index); + } + table counter_table { + actions = { + count; + } + } + apply { + counter_table.apply(); + } +} + +control Test() { + my_counter_t(1024) counter_set; + apply { + Inner.apply(counter_set); + } +} + +control C(); +package P(C _c); +P(Test()) main; diff --git a/testdata/p4_16_samples_outputs/extern-inst-as-param.p4-stderr b/testdata/p4_16_samples_outputs/extern-inst-as-param.p4-stderr new file mode 100644 index 0000000000..e69de29bb2 diff --git a/testdata/p4_16_samples_outputs/fabric_20190420/fabric-first.p4 b/testdata/p4_16_samples_outputs/fabric_20190420/fabric-first.p4 index d18f0200ce..47dfc17ae0 100644 --- a/testdata/p4_16_samples_outputs/fabric_20190420/fabric-first.p4 +++ b/testdata/p4_16_samples_outputs/fabric_20190420/fabric-first.p4 @@ -928,14 +928,14 @@ control PortCountersControl(inout parsed_headers_t hdr, inout fabric_metadata_t } control FabricIngress(inout parsed_headers_t hdr, inout fabric_metadata_t fabric_metadata, inout standard_metadata_t standard_metadata) { - @name("spgw_normalizer") spgw_normalizer() spgw_normalizer_inst; - @name("spgw_ingress") spgw_ingress() spgw_ingress_inst; PacketIoIngress() pkt_io_ingress; Filtering() filtering; Forwarding() forwarding; Acl() acl; Next() next; PortCountersControl() port_counters_control; + @name("spgw_normalizer") spgw_normalizer() spgw_normalizer_inst; + @name("spgw_ingress") spgw_ingress() spgw_ingress_inst; apply { spgw_normalizer_inst.apply(hdr.gtpu.isValid(), hdr.gtpu_ipv4, hdr.gtpu_udp, hdr.ipv4, hdr.udp, hdr.inner_ipv4, hdr.inner_udp); pkt_io_ingress.apply(hdr, fabric_metadata, standard_metadata); @@ -957,9 +957,9 @@ control FabricIngress(inout parsed_headers_t hdr, inout fabric_metadata_t fabric } control FabricEgress(inout parsed_headers_t hdr, inout fabric_metadata_t fabric_metadata, inout standard_metadata_t standard_metadata) { - @name("spgw_egress") spgw_egress() spgw_egress_inst; PacketIoEgress() pkt_io_egress; EgressNextControl() egress_next; + @name("spgw_egress") spgw_egress() spgw_egress_inst; apply { pkt_io_egress.apply(hdr, fabric_metadata, standard_metadata); egress_next.apply(hdr, fabric_metadata, standard_metadata); diff --git a/testdata/p4_16_samples_outputs/fabric_20190420/fabric-frontend.p4 b/testdata/p4_16_samples_outputs/fabric_20190420/fabric-frontend.p4 index 046e0bb97b..057d131085 100644 --- a/testdata/p4_16_samples_outputs/fabric_20190420/fabric-frontend.p4 +++ b/testdata/p4_16_samples_outputs/fabric_20190420/fabric-frontend.p4 @@ -357,38 +357,6 @@ control FabricIngress(inout parsed_headers_t hdr, inout fabric_metadata_t fabric } @name(".nop") action nop_10() { } - @name("FabricIngress.spgw_ingress.ue_counter") direct_counter(CounterType.packets_and_bytes) spgw_ingress_ue_counter; - @hidden @name("FabricIngress.spgw_ingress.gtpu_decap") action spgw_ingress_gtpu_decap_0() { - hdr.gtpu_ipv4.setInvalid(); - hdr.gtpu_udp.setInvalid(); - hdr.gtpu.setInvalid(); - } - @name("FabricIngress.spgw_ingress.set_dl_sess_info") action spgw_ingress_set_dl_sess_info_0(@name("teid") bit<32> teid_1, @name("s1u_enb_addr") bit<32> s1u_enb_addr_1, @name("s1u_sgw_addr") bit<32> s1u_sgw_addr_1) { - fabric_metadata.spgw.teid = teid_1; - fabric_metadata.spgw.s1u_enb_addr = s1u_enb_addr_1; - fabric_metadata.spgw.s1u_sgw_addr = s1u_sgw_addr_1; - spgw_ingress_ue_counter.count(); - } - @name("FabricIngress.spgw_ingress.dl_sess_lookup") table spgw_ingress_dl_sess_lookup { - key = { - hdr.ipv4.dst_addr: exact @name("ipv4_dst"); - } - actions = { - spgw_ingress_set_dl_sess_info_0(); - @defaultonly nop_2(); - } - const default_action = nop_2(); - counters = spgw_ingress_ue_counter; - } - @name("FabricIngress.spgw_ingress.s1u_filter_table") table spgw_ingress_s1u_filter_table { - key = { - hdr.gtpu_ipv4.dst_addr: exact @name("gtp_ipv4_dst"); - } - actions = { - nop_3(); - } - const default_action = nop_3(); - } @name("FabricIngress.filtering.ingress_port_vlan_counter") direct_counter(CounterType.packets_and_bytes) filtering_ingress_port_vlan_counter; @name("FabricIngress.filtering.deny") action filtering_deny_0() { fabric_metadata.skip_forwarding = true; @@ -449,9 +417,9 @@ control FabricIngress(inout parsed_headers_t hdr, inout fabric_metadata_t fabric } actions = { forwarding_set_next_id_bridging_0(); - @defaultonly nop_4(); + @defaultonly nop_2(); } - const default_action = nop_4(); + const default_action = nop_2(); counters = forwarding_bridging_counter; size = 1024; } @@ -469,9 +437,9 @@ control FabricIngress(inout parsed_headers_t hdr, inout fabric_metadata_t fabric } actions = { forwarding_pop_mpls_and_next_0(); - @defaultonly nop_5(); + @defaultonly nop_3(); } - const default_action = nop_5(); + const default_action = nop_3(); counters = forwarding_mpls_counter; size = 1024; } @@ -492,9 +460,9 @@ control FabricIngress(inout parsed_headers_t hdr, inout fabric_metadata_t fabric actions = { forwarding_set_next_id_routing_v4_0(); forwarding_nop_routing_v4_0(); - @defaultonly nop_6(); + @defaultonly nop_4(); } - const default_action = nop_6(); + const default_action = nop_4(); counters = forwarding_routing_v4_counter; size = 1024; } @@ -557,9 +525,9 @@ control FabricIngress(inout parsed_headers_t hdr, inout fabric_metadata_t fabric } actions = { next_set_vlan_0(); - @defaultonly nop_7(); + @defaultonly nop_5(); } - const default_action = nop_7(); + const default_action = nop_5(); counters = next_next_vlan_counter; size = 1024; } @@ -582,10 +550,10 @@ control FabricIngress(inout parsed_headers_t hdr, inout fabric_metadata_t fabric actions = { next_output_xconnect_0(); next_set_next_id_xconnect_0(); - @defaultonly nop_8(); + @defaultonly nop_6(); } counters = next_xconnect_counter; - const default_action = nop_8(); + const default_action = nop_6(); size = 1024; } @max_group_size(16) @name("FabricIngress.next.hashed_selector") action_selector(HashAlgorithm.crc16, 32w1024, 32w16) next_hashed_selector; @@ -642,11 +610,11 @@ control FabricIngress(inout parsed_headers_t hdr, inout fabric_metadata_t fabric next_output_hashed_0(); next_routing_hashed_0(); next_mpls_routing_hashed_0(); - @defaultonly nop_9(); + @defaultonly nop_7(); } implementation = next_hashed_selector; counters = next_hashed_counter; - const default_action = nop_9(); + const default_action = nop_7(); size = 1024; } @name("FabricIngress.next.multicast_counter") direct_counter(CounterType.packets_and_bytes) next_multicast_counter; @@ -661,14 +629,46 @@ control FabricIngress(inout parsed_headers_t hdr, inout fabric_metadata_t fabric } actions = { next_set_mcast_group_id_0(); - @defaultonly nop_10(); + @defaultonly nop_8(); } counters = next_multicast_counter; - const default_action = nop_10(); + const default_action = nop_8(); size = 1024; } @name("FabricIngress.port_counters_control.egress_port_counter") counter(32w511, CounterType.packets_and_bytes) port_counters_control_egress_port_counter; @name("FabricIngress.port_counters_control.ingress_port_counter") counter(32w511, CounterType.packets_and_bytes) port_counters_control_ingress_port_counter; + @name("FabricIngress.spgw_ingress.ue_counter") direct_counter(CounterType.packets_and_bytes) spgw_ingress_ue_counter; + @hidden @name("FabricIngress.spgw_ingress.gtpu_decap") action spgw_ingress_gtpu_decap_0() { + hdr.gtpu_ipv4.setInvalid(); + hdr.gtpu_udp.setInvalid(); + hdr.gtpu.setInvalid(); + } + @name("FabricIngress.spgw_ingress.set_dl_sess_info") action spgw_ingress_set_dl_sess_info_0(@name("teid") bit<32> teid_1, @name("s1u_enb_addr") bit<32> s1u_enb_addr_1, @name("s1u_sgw_addr") bit<32> s1u_sgw_addr_1) { + fabric_metadata.spgw.teid = teid_1; + fabric_metadata.spgw.s1u_enb_addr = s1u_enb_addr_1; + fabric_metadata.spgw.s1u_sgw_addr = s1u_sgw_addr_1; + spgw_ingress_ue_counter.count(); + } + @name("FabricIngress.spgw_ingress.dl_sess_lookup") table spgw_ingress_dl_sess_lookup { + key = { + hdr.ipv4.dst_addr: exact @name("ipv4_dst"); + } + actions = { + spgw_ingress_set_dl_sess_info_0(); + @defaultonly nop_9(); + } + const default_action = nop_9(); + counters = spgw_ingress_ue_counter; + } + @name("FabricIngress.spgw_ingress.s1u_filter_table") table spgw_ingress_s1u_filter_table { + key = { + hdr.gtpu_ipv4.dst_addr: exact @name("gtp_ipv4_dst"); + } + actions = { + nop_10(); + } + const default_action = nop_10(); + } apply { hdr.gtpu_ipv4.setInvalid(); hdr.gtpu_udp.setInvalid(); @@ -759,37 +759,6 @@ control FabricIngress(inout parsed_headers_t hdr, inout fabric_metadata_t fabric control FabricEgress(inout parsed_headers_t hdr, inout fabric_metadata_t fabric_metadata, inout standard_metadata_t standard_metadata) { @name(".nop") action nop_11() { } - @hidden @name("FabricEgress.spgw_egress.gtpu_encap") action spgw_egress_gtpu_encap_0() { - hdr.gtpu_ipv4.setValid(); - hdr.gtpu_ipv4.version = 4w4; - hdr.gtpu_ipv4.ihl = 4w5; - hdr.gtpu_ipv4.dscp = 6w0; - hdr.gtpu_ipv4.ecn = 2w0; - hdr.gtpu_ipv4.total_len = hdr.ipv4.total_len + 16w36; - hdr.gtpu_ipv4.identification = 16w0x1513; - hdr.gtpu_ipv4.flags = 3w0; - hdr.gtpu_ipv4.frag_offset = 13w0; - hdr.gtpu_ipv4.ttl = 8w64; - hdr.gtpu_ipv4.protocol = 8w17; - hdr.gtpu_ipv4.dst_addr = fabric_metadata.spgw.s1u_enb_addr; - hdr.gtpu_ipv4.src_addr = fabric_metadata.spgw.s1u_sgw_addr; - hdr.gtpu_ipv4.hdr_checksum = 16w0; - hdr.gtpu_udp.setValid(); - hdr.gtpu_udp.sport = 16w2152; - hdr.gtpu_udp.dport = 16w2152; - hdr.gtpu_udp.len = fabric_metadata.spgw.ipv4_len + 16w16; - hdr.gtpu_udp.checksum = 16w0; - hdr.gtpu.setValid(); - hdr.gtpu.version = 3w0x1; - hdr.gtpu.pt = 1w0x1; - hdr.gtpu.spare = 1w0; - hdr.gtpu.ex_flag = 1w0; - hdr.gtpu.seq_flag = 1w0; - hdr.gtpu.npdu_flag = 1w0; - hdr.gtpu.msgtype = 8w0xff; - hdr.gtpu.msglen = fabric_metadata.spgw.ipv4_len; - hdr.gtpu.teid = fabric_metadata.spgw.teid; - } @hidden @name("FabricEgress.egress_next.pop_mpls_if_present") action egress_next_pop_mpls_if_present_0() { hdr.mpls.setInvalid(); fabric_metadata.eth_type = fabric_metadata.ip_eth_type; @@ -829,6 +798,37 @@ control FabricEgress(inout parsed_headers_t hdr, inout fabric_metadata_t fabric_ counters = egress_next_egress_vlan_counter; size = 1024; } + @hidden @name("FabricEgress.spgw_egress.gtpu_encap") action spgw_egress_gtpu_encap_0() { + hdr.gtpu_ipv4.setValid(); + hdr.gtpu_ipv4.version = 4w4; + hdr.gtpu_ipv4.ihl = 4w5; + hdr.gtpu_ipv4.dscp = 6w0; + hdr.gtpu_ipv4.ecn = 2w0; + hdr.gtpu_ipv4.total_len = hdr.ipv4.total_len + 16w36; + hdr.gtpu_ipv4.identification = 16w0x1513; + hdr.gtpu_ipv4.flags = 3w0; + hdr.gtpu_ipv4.frag_offset = 13w0; + hdr.gtpu_ipv4.ttl = 8w64; + hdr.gtpu_ipv4.protocol = 8w17; + hdr.gtpu_ipv4.dst_addr = fabric_metadata.spgw.s1u_enb_addr; + hdr.gtpu_ipv4.src_addr = fabric_metadata.spgw.s1u_sgw_addr; + hdr.gtpu_ipv4.hdr_checksum = 16w0; + hdr.gtpu_udp.setValid(); + hdr.gtpu_udp.sport = 16w2152; + hdr.gtpu_udp.dport = 16w2152; + hdr.gtpu_udp.len = fabric_metadata.spgw.ipv4_len + 16w16; + hdr.gtpu_udp.checksum = 16w0; + hdr.gtpu.setValid(); + hdr.gtpu.version = 3w0x1; + hdr.gtpu.pt = 1w0x1; + hdr.gtpu.spare = 1w0; + hdr.gtpu.ex_flag = 1w0; + hdr.gtpu.seq_flag = 1w0; + hdr.gtpu.npdu_flag = 1w0; + hdr.gtpu.msgtype = 8w0xff; + hdr.gtpu.msglen = fabric_metadata.spgw.ipv4_len; + hdr.gtpu.teid = fabric_metadata.spgw.teid; + } apply { if (fabric_metadata.is_controller_packet_out) { exit; diff --git a/testdata/p4_16_samples_outputs/fabric_20190420/fabric-midend.p4 b/testdata/p4_16_samples_outputs/fabric_20190420/fabric-midend.p4 index a79ef718c4..0a673d0080 100644 --- a/testdata/p4_16_samples_outputs/fabric_20190420/fabric-midend.p4 +++ b/testdata/p4_16_samples_outputs/fabric_20190420/fabric-midend.p4 @@ -364,38 +364,6 @@ control FabricIngress(inout parsed_headers_t hdr, inout fabric_metadata_t fabric } @name(".nop") action nop_10() { } - @name("FabricIngress.spgw_ingress.ue_counter") direct_counter(CounterType.packets_and_bytes) spgw_ingress_ue_counter; - @hidden @name("FabricIngress.spgw_ingress.gtpu_decap") action spgw_ingress_gtpu_decap_0() { - hdr.gtpu_ipv4.setInvalid(); - hdr.gtpu_udp.setInvalid(); - hdr.gtpu.setInvalid(); - } - @name("FabricIngress.spgw_ingress.set_dl_sess_info") action spgw_ingress_set_dl_sess_info_0(@name("teid") bit<32> teid_1, @name("s1u_enb_addr") bit<32> s1u_enb_addr_1, @name("s1u_sgw_addr") bit<32> s1u_sgw_addr_1) { - fabric_metadata._spgw_teid19 = teid_1; - fabric_metadata._spgw_s1u_enb_addr20 = s1u_enb_addr_1; - fabric_metadata._spgw_s1u_sgw_addr21 = s1u_sgw_addr_1; - spgw_ingress_ue_counter.count(); - } - @name("FabricIngress.spgw_ingress.dl_sess_lookup") table spgw_ingress_dl_sess_lookup { - key = { - hdr.ipv4.dst_addr: exact @name("ipv4_dst"); - } - actions = { - spgw_ingress_set_dl_sess_info_0(); - @defaultonly nop_2(); - } - const default_action = nop_2(); - counters = spgw_ingress_ue_counter; - } - @name("FabricIngress.spgw_ingress.s1u_filter_table") table spgw_ingress_s1u_filter_table { - key = { - hdr.gtpu_ipv4.dst_addr: exact @name("gtp_ipv4_dst"); - } - actions = { - nop_3(); - } - const default_action = nop_3(); - } @name("FabricIngress.filtering.ingress_port_vlan_counter") direct_counter(CounterType.packets_and_bytes) filtering_ingress_port_vlan_counter; @name("FabricIngress.filtering.deny") action filtering_deny_0() { fabric_metadata._skip_forwarding7 = true; @@ -454,9 +422,9 @@ control FabricIngress(inout parsed_headers_t hdr, inout fabric_metadata_t fabric } actions = { forwarding_set_next_id_bridging_0(); - @defaultonly nop_4(); + @defaultonly nop_2(); } - const default_action = nop_4(); + const default_action = nop_2(); counters = forwarding_bridging_counter; size = 1024; } @@ -472,9 +440,9 @@ control FabricIngress(inout parsed_headers_t hdr, inout fabric_metadata_t fabric } actions = { forwarding_pop_mpls_and_next_0(); - @defaultonly nop_5(); + @defaultonly nop_3(); } - const default_action = nop_5(); + const default_action = nop_3(); counters = forwarding_mpls_counter; size = 1024; } @@ -493,9 +461,9 @@ control FabricIngress(inout parsed_headers_t hdr, inout fabric_metadata_t fabric actions = { forwarding_set_next_id_routing_v4_0(); forwarding_nop_routing_v4_0(); - @defaultonly nop_6(); + @defaultonly nop_4(); } - const default_action = nop_6(); + const default_action = nop_4(); counters = forwarding_routing_v4_counter; size = 1024; } @@ -558,9 +526,9 @@ control FabricIngress(inout parsed_headers_t hdr, inout fabric_metadata_t fabric } actions = { next_set_vlan_0(); - @defaultonly nop_7(); + @defaultonly nop_5(); } - const default_action = nop_7(); + const default_action = nop_5(); counters = next_next_vlan_counter; size = 1024; } @@ -581,10 +549,10 @@ control FabricIngress(inout parsed_headers_t hdr, inout fabric_metadata_t fabric actions = { next_output_xconnect_0(); next_set_next_id_xconnect_0(); - @defaultonly nop_8(); + @defaultonly nop_6(); } counters = next_xconnect_counter; - const default_action = nop_8(); + const default_action = nop_6(); size = 1024; } @max_group_size(16) @name("FabricIngress.next.hashed_selector") action_selector(HashAlgorithm.crc16, 32w1024, 32w16) next_hashed_selector; @@ -619,11 +587,11 @@ control FabricIngress(inout parsed_headers_t hdr, inout fabric_metadata_t fabric next_output_hashed_0(); next_routing_hashed_0(); next_mpls_routing_hashed_0(); - @defaultonly nop_9(); + @defaultonly nop_7(); } implementation = next_hashed_selector; counters = next_hashed_counter; - const default_action = nop_9(); + const default_action = nop_7(); size = 1024; } @name("FabricIngress.next.multicast_counter") direct_counter(CounterType.packets_and_bytes) next_multicast_counter; @@ -638,14 +606,46 @@ control FabricIngress(inout parsed_headers_t hdr, inout fabric_metadata_t fabric } actions = { next_set_mcast_group_id_0(); - @defaultonly nop_10(); + @defaultonly nop_8(); } counters = next_multicast_counter; - const default_action = nop_10(); + const default_action = nop_8(); size = 1024; } @name("FabricIngress.port_counters_control.egress_port_counter") counter(32w511, CounterType.packets_and_bytes) port_counters_control_egress_port_counter; @name("FabricIngress.port_counters_control.ingress_port_counter") counter(32w511, CounterType.packets_and_bytes) port_counters_control_ingress_port_counter; + @name("FabricIngress.spgw_ingress.ue_counter") direct_counter(CounterType.packets_and_bytes) spgw_ingress_ue_counter; + @hidden @name("FabricIngress.spgw_ingress.gtpu_decap") action spgw_ingress_gtpu_decap_0() { + hdr.gtpu_ipv4.setInvalid(); + hdr.gtpu_udp.setInvalid(); + hdr.gtpu.setInvalid(); + } + @name("FabricIngress.spgw_ingress.set_dl_sess_info") action spgw_ingress_set_dl_sess_info_0(@name("teid") bit<32> teid_1, @name("s1u_enb_addr") bit<32> s1u_enb_addr_1, @name("s1u_sgw_addr") bit<32> s1u_sgw_addr_1) { + fabric_metadata._spgw_teid19 = teid_1; + fabric_metadata._spgw_s1u_enb_addr20 = s1u_enb_addr_1; + fabric_metadata._spgw_s1u_sgw_addr21 = s1u_sgw_addr_1; + spgw_ingress_ue_counter.count(); + } + @name("FabricIngress.spgw_ingress.dl_sess_lookup") table spgw_ingress_dl_sess_lookup { + key = { + hdr.ipv4.dst_addr: exact @name("ipv4_dst"); + } + actions = { + spgw_ingress_set_dl_sess_info_0(); + @defaultonly nop_9(); + } + const default_action = nop_9(); + counters = spgw_ingress_ue_counter; + } + @name("FabricIngress.spgw_ingress.s1u_filter_table") table spgw_ingress_s1u_filter_table { + key = { + hdr.gtpu_ipv4.dst_addr: exact @name("gtp_ipv4_dst"); + } + actions = { + nop_10(); + } + const default_action = nop_10(); + } @hidden action spgw30() { spgw_normalizer_hasReturned = true; } @@ -892,37 +892,6 @@ control FabricEgress(inout parsed_headers_t hdr, inout fabric_metadata_t fabric_ bool hasExited_0; @name(".nop") action nop_11() { } - @hidden @name("FabricEgress.spgw_egress.gtpu_encap") action spgw_egress_gtpu_encap_0() { - hdr.gtpu_ipv4.setValid(); - hdr.gtpu_ipv4.version = 4w4; - hdr.gtpu_ipv4.ihl = 4w5; - hdr.gtpu_ipv4.dscp = 6w0; - hdr.gtpu_ipv4.ecn = 2w0; - hdr.gtpu_ipv4.total_len = hdr.ipv4.total_len + 16w36; - hdr.gtpu_ipv4.identification = 16w0x1513; - hdr.gtpu_ipv4.flags = 3w0; - hdr.gtpu_ipv4.frag_offset = 13w0; - hdr.gtpu_ipv4.ttl = 8w64; - hdr.gtpu_ipv4.protocol = 8w17; - hdr.gtpu_ipv4.dst_addr = fabric_metadata._spgw_s1u_enb_addr20; - hdr.gtpu_ipv4.src_addr = fabric_metadata._spgw_s1u_sgw_addr21; - hdr.gtpu_ipv4.hdr_checksum = 16w0; - hdr.gtpu_udp.setValid(); - hdr.gtpu_udp.sport = 16w2152; - hdr.gtpu_udp.dport = 16w2152; - hdr.gtpu_udp.len = fabric_metadata._spgw_ipv4_len18 + 16w16; - hdr.gtpu_udp.checksum = 16w0; - hdr.gtpu.setValid(); - hdr.gtpu.version = 3w0x1; - hdr.gtpu.pt = 1w0x1; - hdr.gtpu.spare = 1w0; - hdr.gtpu.ex_flag = 1w0; - hdr.gtpu.seq_flag = 1w0; - hdr.gtpu.npdu_flag = 1w0; - hdr.gtpu.msgtype = 8w0xff; - hdr.gtpu.msglen = fabric_metadata._spgw_ipv4_len18; - hdr.gtpu.teid = fabric_metadata._spgw_teid19; - } @hidden @name("FabricEgress.egress_next.pop_mpls_if_present") action egress_next_pop_mpls_if_present_0() { hdr.mpls.setInvalid(); fabric_metadata._eth_type0 = fabric_metadata._ip_eth_type1; @@ -962,6 +931,37 @@ control FabricEgress(inout parsed_headers_t hdr, inout fabric_metadata_t fabric_ counters = egress_next_egress_vlan_counter; size = 1024; } + @hidden @name("FabricEgress.spgw_egress.gtpu_encap") action spgw_egress_gtpu_encap_0() { + hdr.gtpu_ipv4.setValid(); + hdr.gtpu_ipv4.version = 4w4; + hdr.gtpu_ipv4.ihl = 4w5; + hdr.gtpu_ipv4.dscp = 6w0; + hdr.gtpu_ipv4.ecn = 2w0; + hdr.gtpu_ipv4.total_len = hdr.ipv4.total_len + 16w36; + hdr.gtpu_ipv4.identification = 16w0x1513; + hdr.gtpu_ipv4.flags = 3w0; + hdr.gtpu_ipv4.frag_offset = 13w0; + hdr.gtpu_ipv4.ttl = 8w64; + hdr.gtpu_ipv4.protocol = 8w17; + hdr.gtpu_ipv4.dst_addr = fabric_metadata._spgw_s1u_enb_addr20; + hdr.gtpu_ipv4.src_addr = fabric_metadata._spgw_s1u_sgw_addr21; + hdr.gtpu_ipv4.hdr_checksum = 16w0; + hdr.gtpu_udp.setValid(); + hdr.gtpu_udp.sport = 16w2152; + hdr.gtpu_udp.dport = 16w2152; + hdr.gtpu_udp.len = fabric_metadata._spgw_ipv4_len18 + 16w16; + hdr.gtpu_udp.checksum = 16w0; + hdr.gtpu.setValid(); + hdr.gtpu.version = 3w0x1; + hdr.gtpu.pt = 1w0x1; + hdr.gtpu.spare = 1w0; + hdr.gtpu.ex_flag = 1w0; + hdr.gtpu.seq_flag = 1w0; + hdr.gtpu.npdu_flag = 1w0; + hdr.gtpu.msgtype = 8w0xff; + hdr.gtpu.msglen = fabric_metadata._spgw_ipv4_len18; + hdr.gtpu.teid = fabric_metadata._spgw_teid19; + } @hidden action packetio41() { hasExited_0 = true; } diff --git a/testdata/p4_16_samples_outputs/fabric_20190420/fabric.p4.p4info.txt b/testdata/p4_16_samples_outputs/fabric_20190420/fabric.p4.p4info.txt index c0484aba37..a0e52bd0df 100644 --- a/testdata/p4_16_samples_outputs/fabric_20190420/fabric.p4.p4info.txt +++ b/testdata/p4_16_samples_outputs/fabric_20190420/fabric.p4.p4info.txt @@ -1,48 +1,6 @@ pkg_info { arch: "v1model" } -tables { - preamble { - id: 49442443 - name: "FabricIngress.spgw_ingress.dl_sess_lookup" - alias: "dl_sess_lookup" - } - match_fields { - id: 1 - name: "ipv4_dst" - bitwidth: 32 - match_type: EXACT - } - action_refs { - id: 31156449 - } - action_refs { - id: 28485346 - annotations: "@defaultonly" - scope: DEFAULT_ONLY - } - const_default_action_id: 28485346 - direct_resource_ids: 334575698 - size: 1024 -} -tables { - preamble { - id: 40038434 - name: "FabricIngress.spgw_ingress.s1u_filter_table" - alias: "s1u_filter_table" - } - match_fields { - id: 1 - name: "gtp_ipv4_dst" - bitwidth: 32 - match_type: EXACT - } - action_refs { - id: 28485346 - } - const_default_action_id: 28485346 - size: 1024 -} tables { preamble { id: 43310977 @@ -401,6 +359,48 @@ tables { direct_resource_ids: 319194968 size: 1024 } +tables { + preamble { + id: 49442443 + name: "FabricIngress.spgw_ingress.dl_sess_lookup" + alias: "dl_sess_lookup" + } + match_fields { + id: 1 + name: "ipv4_dst" + bitwidth: 32 + match_type: EXACT + } + action_refs { + id: 31156449 + } + action_refs { + id: 28485346 + annotations: "@defaultonly" + scope: DEFAULT_ONLY + } + const_default_action_id: 28485346 + direct_resource_ids: 334575698 + size: 1024 +} +tables { + preamble { + id: 40038434 + name: "FabricIngress.spgw_ingress.s1u_filter_table" + alias: "s1u_filter_table" + } + match_fields { + id: 1 + name: "gtp_ipv4_dst" + bitwidth: 32 + match_type: EXACT + } + action_refs { + id: 28485346 + } + const_default_action_id: 28485346 + size: 1024 +} tables { preamble { id: 49262446 @@ -438,28 +438,6 @@ actions { alias: "nop" } } -actions { - preamble { - id: 31156449 - name: "FabricIngress.spgw_ingress.set_dl_sess_info" - alias: "set_dl_sess_info" - } - params { - id: 1 - name: "teid" - bitwidth: 32 - } - params { - id: 2 - name: "s1u_enb_addr" - bitwidth: 32 - } - params { - id: 3 - name: "s1u_sgw_addr" - bitwidth: 32 - } -} actions { preamble { id: 17164167 @@ -690,6 +668,28 @@ actions { bitwidth: 16 } } +actions { + preamble { + id: 31156449 + name: "FabricIngress.spgw_ingress.set_dl_sess_info" + alias: "set_dl_sess_info" + } + params { + id: 1 + name: "teid" + bitwidth: 32 + } + params { + id: 2 + name: "s1u_enb_addr" + bitwidth: 32 + } + params { + id: 3 + name: "s1u_sgw_addr" + bitwidth: 32 + } +} actions { preamble { id: 17183246 @@ -730,17 +730,6 @@ counters { } size: 511 } -direct_counters { - preamble { - id: 334575698 - name: "FabricIngress.spgw_ingress.ue_counter" - alias: "ue_counter" - } - spec { - unit: BOTH - } - direct_table_id: 49442443 -} direct_counters { preamble { id: 326221069 @@ -851,6 +840,17 @@ direct_counters { } direct_table_id: 40619180 } +direct_counters { + preamble { + id: 334575698 + name: "FabricIngress.spgw_ingress.ue_counter" + alias: "ue_counter" + } + spec { + unit: BOTH + } + direct_table_id: 49442443 +} direct_counters { preamble { id: 318892680 diff --git a/testdata/p4_16_samples_outputs/issue561-bmv2-first.p4 b/testdata/p4_16_samples_outputs/issue561-bmv2-first.p4 index 159488f6ad..c38bff24a2 100644 --- a/testdata/p4_16_samples_outputs/issue561-bmv2-first.p4 +++ b/testdata/p4_16_samples_outputs/issue561-bmv2-first.p4 @@ -161,8 +161,8 @@ parser Tcp_option_parser(packet_in b, in bit<4> tcp_hdr_data_offset, out Tcp_opt } parser ParserImpl(packet_in packet, out headers hdr, inout metadata meta, inout standard_metadata_t standard_metadata) { - @name("Tcp_option_parser") Tcp_option_parser() Tcp_option_parser_inst; const bit<16> ETHERTYPE_IPV4 = 16w0x800; + @name("Tcp_option_parser") Tcp_option_parser() Tcp_option_parser_inst; state start { transition parse_ethernet; } diff --git a/testdata/p4_16_samples_outputs/list1-first.p4 b/testdata/p4_16_samples_outputs/list1-first.p4 index 3f174a0020..3ce43a14a3 100644 --- a/testdata/p4_16_samples_outputs/list1-first.p4 +++ b/testdata/p4_16_samples_outputs/list1-first.p4 @@ -20,4 +20,3 @@ control c() { control C(); package top(C _c); top(c()) main; - diff --git a/testdata/p4_16_samples_outputs/list1-frontend.p4 b/testdata/p4_16_samples_outputs/list1-frontend.p4 index 0e6c33a27b..de32072169 100644 --- a/testdata/p4_16_samples_outputs/list1-frontend.p4 +++ b/testdata/p4_16_samples_outputs/list1-frontend.p4 @@ -20,4 +20,3 @@ control c() { control C(); package top(C _c); top(c()) main; - diff --git a/testdata/p4_16_samples_outputs/list1-midend.p4 b/testdata/p4_16_samples_outputs/list1-midend.p4 index 54c1231424..abb1333ca0 100644 --- a/testdata/p4_16_samples_outputs/list1-midend.p4 +++ b/testdata/p4_16_samples_outputs/list1-midend.p4 @@ -29,4 +29,3 @@ control c() { control C(); package top(C _c); top(c()) main; - diff --git a/testdata/p4_16_samples_outputs/list1.p4 b/testdata/p4_16_samples_outputs/list1.p4 index 394774c00e..a33a1f67e1 100644 --- a/testdata/p4_16_samples_outputs/list1.p4 +++ b/testdata/p4_16_samples_outputs/list1.p4 @@ -20,4 +20,3 @@ control c() { control C(); package top(C _c); top(c()) main; - diff --git a/testdata/p4_16_samples_outputs/list2-first.p4 b/testdata/p4_16_samples_outputs/list2-first.p4 index 376f93feb0..86b4fb9dcb 100644 --- a/testdata/p4_16_samples_outputs/list2-first.p4 +++ b/testdata/p4_16_samples_outputs/list2-first.p4 @@ -15,4 +15,3 @@ control c() { control C(); package top(C _c); top(c()) main; - diff --git a/testdata/p4_16_samples_outputs/list2-frontend.p4 b/testdata/p4_16_samples_outputs/list2-frontend.p4 index d3c9efd25b..5c8400fac1 100644 --- a/testdata/p4_16_samples_outputs/list2-frontend.p4 +++ b/testdata/p4_16_samples_outputs/list2-frontend.p4 @@ -15,4 +15,3 @@ control c() { control C(); package top(C _c); top(c()) main; - diff --git a/testdata/p4_16_samples_outputs/list2-midend.p4 b/testdata/p4_16_samples_outputs/list2-midend.p4 index 2bdf99a13e..9eb0f5d546 100644 --- a/testdata/p4_16_samples_outputs/list2-midend.p4 +++ b/testdata/p4_16_samples_outputs/list2-midend.p4 @@ -24,4 +24,3 @@ control c() { control C(); package top(C _c); top(c()) main; - diff --git a/testdata/p4_16_samples_outputs/list2.p4 b/testdata/p4_16_samples_outputs/list2.p4 index c8ab1dd0d4..991b5c093e 100644 --- a/testdata/p4_16_samples_outputs/list2.p4 +++ b/testdata/p4_16_samples_outputs/list2.p4 @@ -15,4 +15,3 @@ control c() { control C(); package top(C _c); top(c()) main; - diff --git a/testdata/p4_16_samples_outputs/list3-first.p4 b/testdata/p4_16_samples_outputs/list3-first.p4 index 3f2806d52e..04322c5f1b 100644 --- a/testdata/p4_16_samples_outputs/list3-first.p4 +++ b/testdata/p4_16_samples_outputs/list3-first.p4 @@ -16,4 +16,3 @@ control c() { control C(); package top(C _c); top(c()) main; - diff --git a/testdata/p4_16_samples_outputs/list3-frontend.p4 b/testdata/p4_16_samples_outputs/list3-frontend.p4 index b2ef6172b1..b0ee6801bc 100644 --- a/testdata/p4_16_samples_outputs/list3-frontend.p4 +++ b/testdata/p4_16_samples_outputs/list3-frontend.p4 @@ -16,4 +16,3 @@ control c() { control C(); package top(C _c); top(c()) main; - diff --git a/testdata/p4_16_samples_outputs/list3-midend.p4 b/testdata/p4_16_samples_outputs/list3-midend.p4 index 297804abca..ac64c4a9cf 100644 --- a/testdata/p4_16_samples_outputs/list3-midend.p4 +++ b/testdata/p4_16_samples_outputs/list3-midend.p4 @@ -24,4 +24,3 @@ control c() { control C(); package top(C _c); top(c()) main; - diff --git a/testdata/p4_16_samples_outputs/list3.p4 b/testdata/p4_16_samples_outputs/list3.p4 index 6f57191dee..5573214f53 100644 --- a/testdata/p4_16_samples_outputs/list3.p4 +++ b/testdata/p4_16_samples_outputs/list3.p4 @@ -16,4 +16,3 @@ control c() { control C(); package top(C _c); top(c()) main; - diff --git a/testdata/p4_16_samples_outputs/list4-first.p4 b/testdata/p4_16_samples_outputs/list4-first.p4 index 3f2806d52e..04322c5f1b 100644 --- a/testdata/p4_16_samples_outputs/list4-first.p4 +++ b/testdata/p4_16_samples_outputs/list4-first.p4 @@ -16,4 +16,3 @@ control c() { control C(); package top(C _c); top(c()) main; - diff --git a/testdata/p4_16_samples_outputs/list4-frontend.p4 b/testdata/p4_16_samples_outputs/list4-frontend.p4 index b2ef6172b1..b0ee6801bc 100644 --- a/testdata/p4_16_samples_outputs/list4-frontend.p4 +++ b/testdata/p4_16_samples_outputs/list4-frontend.p4 @@ -16,4 +16,3 @@ control c() { control C(); package top(C _c); top(c()) main; - diff --git a/testdata/p4_16_samples_outputs/list4-midend.p4 b/testdata/p4_16_samples_outputs/list4-midend.p4 index dd8badf235..626a6fc620 100644 --- a/testdata/p4_16_samples_outputs/list4-midend.p4 +++ b/testdata/p4_16_samples_outputs/list4-midend.p4 @@ -24,4 +24,3 @@ control c() { control C(); package top(C _c); top(c()) main; - diff --git a/testdata/p4_16_samples_outputs/list4.p4 b/testdata/p4_16_samples_outputs/list4.p4 index 1801d04f7b..eb667e9523 100644 --- a/testdata/p4_16_samples_outputs/list4.p4 +++ b/testdata/p4_16_samples_outputs/list4.p4 @@ -16,4 +16,3 @@ control c() { control C(); package top(C _c); top(c()) main; - diff --git a/testdata/p4_16_samples_outputs/list5-first.p4 b/testdata/p4_16_samples_outputs/list5-first.p4 index 28b1f3c971..5aa7dd7dd2 100644 --- a/testdata/p4_16_samples_outputs/list5-first.p4 +++ b/testdata/p4_16_samples_outputs/list5-first.p4 @@ -16,4 +16,3 @@ control c() { control C(); package top(C _c); top(c()) main; - diff --git a/testdata/p4_16_samples_outputs/list5-frontend.p4 b/testdata/p4_16_samples_outputs/list5-frontend.p4 index d4a47d2397..208230aefb 100644 --- a/testdata/p4_16_samples_outputs/list5-frontend.p4 +++ b/testdata/p4_16_samples_outputs/list5-frontend.p4 @@ -16,4 +16,3 @@ control c() { control C(); package top(C _c); top(c()) main; - diff --git a/testdata/p4_16_samples_outputs/list5-midend.p4 b/testdata/p4_16_samples_outputs/list5-midend.p4 index efb33b7f3a..a90c05ef9b 100644 --- a/testdata/p4_16_samples_outputs/list5-midend.p4 +++ b/testdata/p4_16_samples_outputs/list5-midend.p4 @@ -24,4 +24,3 @@ control c() { control C(); package top(C _c); top(c()) main; - diff --git a/testdata/p4_16_samples_outputs/list5.p4 b/testdata/p4_16_samples_outputs/list5.p4 index 374e98c30c..bd5dff9eed 100644 --- a/testdata/p4_16_samples_outputs/list5.p4 +++ b/testdata/p4_16_samples_outputs/list5.p4 @@ -16,4 +16,3 @@ control c() { control C(); package top(C _c); top(c()) main; - diff --git a/testdata/p4_16_samples_outputs/list6-first.p4 b/testdata/p4_16_samples_outputs/list6-first.p4 index 28b1f3c971..5aa7dd7dd2 100644 --- a/testdata/p4_16_samples_outputs/list6-first.p4 +++ b/testdata/p4_16_samples_outputs/list6-first.p4 @@ -16,4 +16,3 @@ control c() { control C(); package top(C _c); top(c()) main; - diff --git a/testdata/p4_16_samples_outputs/list6-frontend.p4 b/testdata/p4_16_samples_outputs/list6-frontend.p4 index d4a47d2397..208230aefb 100644 --- a/testdata/p4_16_samples_outputs/list6-frontend.p4 +++ b/testdata/p4_16_samples_outputs/list6-frontend.p4 @@ -16,4 +16,3 @@ control c() { control C(); package top(C _c); top(c()) main; - diff --git a/testdata/p4_16_samples_outputs/list6-midend.p4 b/testdata/p4_16_samples_outputs/list6-midend.p4 index 92cf627384..51090fd8af 100644 --- a/testdata/p4_16_samples_outputs/list6-midend.p4 +++ b/testdata/p4_16_samples_outputs/list6-midend.p4 @@ -24,4 +24,3 @@ control c() { control C(); package top(C _c); top(c()) main; - diff --git a/testdata/p4_16_samples_outputs/list6.p4 b/testdata/p4_16_samples_outputs/list6.p4 index 735ba497a3..e6eca36b75 100644 --- a/testdata/p4_16_samples_outputs/list6.p4 +++ b/testdata/p4_16_samples_outputs/list6.p4 @@ -16,4 +16,3 @@ control c() { control C(); package top(C _c); top(c()) main; - diff --git a/testdata/p4_16_samples_outputs/omec/up4-first.p4 b/testdata/p4_16_samples_outputs/omec/up4-first.p4 index c5535779c1..072b424bd0 100644 --- a/testdata/p4_16_samples_outputs/omec/up4-first.p4 +++ b/testdata/p4_16_samples_outputs/omec/up4-first.p4 @@ -444,8 +444,6 @@ control Routing(inout parsed_headers_t hdr, inout local_metadata_t local_meta, i } control PreQosPipe(inout parsed_headers_t hdr, inout local_metadata_t local_meta, inout standard_metadata_t std_meta) { - @name("Routing") Routing() Routing_inst; - @name("Acl") Acl() Acl_inst; counter(32w1024, CounterType.packets_and_bytes) pre_qos_counter; meter(32w1024, MeterType.bytes) app_meter; meter(32w1024, MeterType.bytes) session_meter; @@ -684,6 +682,8 @@ control PreQosPipe(inout parsed_headers_t hdr, inout local_metadata_t local_meta hdr.gtpu_ext_psc.qfi = local_meta.tunnel_out_qfi; hdr.gtpu_ext_psc.next_ext = 8w0x0; } + @name("Routing") Routing() Routing_inst; + @name("Acl") Acl() Acl_inst; apply { _initialize_metadata(); if (hdr.packet_out.isValid()) { diff --git a/testdata/p4_16_samples_outputs/omec/up4-frontend.p4 b/testdata/p4_16_samples_outputs/omec/up4-frontend.p4 index fc81898f48..da22621975 100644 --- a/testdata/p4_16_samples_outputs/omec/up4-frontend.p4 +++ b/testdata/p4_16_samples_outputs/omec/up4-frontend.p4 @@ -357,66 +357,6 @@ control PreQosPipe(inout parsed_headers_t hdr, inout local_metadata_t local_meta } @noWarn("unused") @name(".NoAction") action NoAction_4() { } - @name("PreQosPipe.Routing.drop") action Routing_drop_0() { - mark_to_drop(std_meta); - } - @name("PreQosPipe.Routing.route") action Routing_route_0(@name("src_mac") mac_addr_t src_mac, @name("dst_mac") mac_addr_t dst_mac, @name("egress_port") PortId_t egress_port_1) { - std_meta.egress_spec = egress_port_1; - hdr.ethernet.src_addr = src_mac; - hdr.ethernet.dst_addr = dst_mac; - } - @name("PreQosPipe.Routing.routes_v4") table Routing_routes_v4 { - key = { - hdr.ipv4.dst_addr : lpm @name("dst_prefix"); - hdr.ipv4.src_addr : selector @name("hdr.ipv4.src_addr"); - hdr.ipv4.proto : selector @name("hdr.ipv4.proto"); - local_meta.l4_sport: selector @name("local_meta.l4_sport"); - local_meta.l4_dport: selector @name("local_meta.l4_dport"); - } - actions = { - Routing_route_0(); - @defaultonly NoAction_1(); - } - @name("hashed_selector") implementation = action_selector(HashAlgorithm.crc16, 32w1024, 32w16); - size = 1024; - default_action = NoAction_1(); - } - @name("PreQosPipe.Acl.set_port") action Acl_set_port_0(@name("port") PortId_t port) { - std_meta.egress_spec = port; - } - @name("PreQosPipe.Acl.punt") action Acl_punt_0() { - std_meta.egress_spec = 9w255; - } - @name("PreQosPipe.Acl.clone_to_cpu") action Acl_clone_to_cpu_0() { - clone_preserving_field_list(CloneType.I2E, 32w99, 8w0); - } - @name("PreQosPipe.Acl.drop") action Acl_drop_0() { - mark_to_drop(std_meta); - exit; - } - @name("PreQosPipe.Acl.acls") table Acl_acls { - key = { - std_meta.ingress_port : ternary @name("inport"); - local_meta.src_iface : ternary @name("src_iface"); - hdr.ethernet.src_addr : ternary @name("eth_src"); - hdr.ethernet.dst_addr : ternary @name("eth_dst"); - hdr.ethernet.ether_type: ternary @name("eth_type"); - hdr.ipv4.src_addr : ternary @name("ipv4_src"); - hdr.ipv4.dst_addr : ternary @name("ipv4_dst"); - hdr.ipv4.proto : ternary @name("ipv4_proto"); - local_meta.l4_sport : ternary @name("l4_sport"); - local_meta.l4_dport : ternary @name("l4_dport"); - } - actions = { - Acl_set_port_0(); - Acl_punt_0(); - Acl_clone_to_cpu_0(); - Acl_drop_0(); - NoAction_2(); - } - const default_action = NoAction_2(); - @name("acls") counters = direct_counter(CounterType.packets_and_bytes); - } @name("PreQosPipe.pre_qos_counter") counter(32w1024, CounterType.packets_and_bytes) pre_qos_counter_0; @name("PreQosPipe.app_meter") meter(32w1024, MeterType.bytes) app_meter_0; @name("PreQosPipe.session_meter") meter(32w1024, MeterType.bytes) session_meter_0; @@ -432,9 +372,9 @@ control PreQosPipe(inout parsed_headers_t hdr, inout local_metadata_t local_meta hdr.ethernet.dst_addr: exact @name("dst_mac"); } actions = { - NoAction_3(); + NoAction_1(); } - default_action = NoAction_3(); + default_action = NoAction_1(); } @name("PreQosPipe.set_source_iface") action set_source_iface(@name("src_iface") InterfaceType src_iface_1, @name("direction") Direction direction_1, @name("slice_id") Slice slice_id_1) { local_meta.src_iface = src_iface_1; @@ -613,9 +553,9 @@ control PreQosPipe(inout parsed_headers_t hdr, inout local_metadata_t local_meta } actions = { load_tunnel_param(); - @defaultonly NoAction_4(); + @defaultonly NoAction_2(); } - default_action = NoAction_4(); + default_action = NoAction_2(); } @name("PreQosPipe.do_gtpu_tunnel") action do_gtpu_tunnel() { @hidden { @@ -713,6 +653,66 @@ control PreQosPipe(inout parsed_headers_t hdr, inout local_metadata_t local_meta hdr.gtpu_ext_psc.qfi = local_meta.tunnel_out_qfi; hdr.gtpu_ext_psc.next_ext = 8w0x0; } + @name("PreQosPipe.Routing.drop") action Routing_drop_0() { + mark_to_drop(std_meta); + } + @name("PreQosPipe.Routing.route") action Routing_route_0(@name("src_mac") mac_addr_t src_mac, @name("dst_mac") mac_addr_t dst_mac, @name("egress_port") PortId_t egress_port_1) { + std_meta.egress_spec = egress_port_1; + hdr.ethernet.src_addr = src_mac; + hdr.ethernet.dst_addr = dst_mac; + } + @name("PreQosPipe.Routing.routes_v4") table Routing_routes_v4 { + key = { + hdr.ipv4.dst_addr : lpm @name("dst_prefix"); + hdr.ipv4.src_addr : selector @name("hdr.ipv4.src_addr"); + hdr.ipv4.proto : selector @name("hdr.ipv4.proto"); + local_meta.l4_sport: selector @name("local_meta.l4_sport"); + local_meta.l4_dport: selector @name("local_meta.l4_dport"); + } + actions = { + Routing_route_0(); + @defaultonly NoAction_3(); + } + @name("hashed_selector") implementation = action_selector(HashAlgorithm.crc16, 32w1024, 32w16); + size = 1024; + default_action = NoAction_3(); + } + @name("PreQosPipe.Acl.set_port") action Acl_set_port_0(@name("port") PortId_t port) { + std_meta.egress_spec = port; + } + @name("PreQosPipe.Acl.punt") action Acl_punt_0() { + std_meta.egress_spec = 9w255; + } + @name("PreQosPipe.Acl.clone_to_cpu") action Acl_clone_to_cpu_0() { + clone_preserving_field_list(CloneType.I2E, 32w99, 8w0); + } + @name("PreQosPipe.Acl.drop") action Acl_drop_0() { + mark_to_drop(std_meta); + exit; + } + @name("PreQosPipe.Acl.acls") table Acl_acls { + key = { + std_meta.ingress_port : ternary @name("inport"); + local_meta.src_iface : ternary @name("src_iface"); + hdr.ethernet.src_addr : ternary @name("eth_src"); + hdr.ethernet.dst_addr : ternary @name("eth_dst"); + hdr.ethernet.ether_type: ternary @name("eth_type"); + hdr.ipv4.src_addr : ternary @name("ipv4_src"); + hdr.ipv4.dst_addr : ternary @name("ipv4_dst"); + hdr.ipv4.proto : ternary @name("ipv4_proto"); + local_meta.l4_sport : ternary @name("l4_sport"); + local_meta.l4_dport : ternary @name("l4_dport"); + } + actions = { + Acl_set_port_0(); + Acl_punt_0(); + Acl_clone_to_cpu_0(); + Acl_drop_0(); + NoAction_4(); + } + const default_action = NoAction_4(); + @name("acls") counters = direct_counter(CounterType.packets_and_bytes); + } apply { hasReturned_0 = false; _initialize_metadata(); diff --git a/testdata/p4_16_samples_outputs/omec/up4-midend.p4 b/testdata/p4_16_samples_outputs/omec/up4-midend.p4 index 8826e3b648..63025ecc2c 100644 --- a/testdata/p4_16_samples_outputs/omec/up4-midend.p4 +++ b/testdata/p4_16_samples_outputs/omec/up4-midend.p4 @@ -318,66 +318,6 @@ control PreQosPipe(inout parsed_headers_t hdr, inout local_metadata_t local_meta } @noWarn("unused") @name(".NoAction") action NoAction_4() { } - @name("PreQosPipe.Routing.drop") action Routing_drop_0() { - mark_to_drop(std_meta); - } - @name("PreQosPipe.Routing.route") action Routing_route_0(@name("src_mac") bit<48> src_mac, @name("dst_mac") bit<48> dst_mac, @name("egress_port") bit<9> egress_port_1) { - std_meta.egress_spec = egress_port_1; - hdr.ethernet.src_addr = src_mac; - hdr.ethernet.dst_addr = dst_mac; - } - @name("PreQosPipe.Routing.routes_v4") table Routing_routes_v4 { - key = { - hdr.ipv4.dst_addr : lpm @name("dst_prefix"); - hdr.ipv4.src_addr : selector @name("hdr.ipv4.src_addr"); - hdr.ipv4.proto : selector @name("hdr.ipv4.proto"); - local_meta.l4_sport: selector @name("local_meta.l4_sport"); - local_meta.l4_dport: selector @name("local_meta.l4_dport"); - } - actions = { - Routing_route_0(); - @defaultonly NoAction_1(); - } - @name("hashed_selector") implementation = action_selector(HashAlgorithm.crc16, 32w1024, 32w16); - size = 1024; - default_action = NoAction_1(); - } - @name("PreQosPipe.Acl.set_port") action Acl_set_port_0(@name("port") bit<9> port) { - std_meta.egress_spec = port; - } - @name("PreQosPipe.Acl.punt") action Acl_punt_0() { - std_meta.egress_spec = 9w255; - } - @name("PreQosPipe.Acl.clone_to_cpu") action Acl_clone_to_cpu_0() { - clone_preserving_field_list(CloneType.I2E, 32w99, 8w0); - } - @name("PreQosPipe.Acl.drop") action Acl_drop_0() { - mark_to_drop(std_meta); - hasExited = true; - } - @name("PreQosPipe.Acl.acls") table Acl_acls { - key = { - std_meta.ingress_port : ternary @name("inport"); - local_meta.src_iface : ternary @name("src_iface"); - hdr.ethernet.src_addr : ternary @name("eth_src"); - hdr.ethernet.dst_addr : ternary @name("eth_dst"); - hdr.ethernet.ether_type: ternary @name("eth_type"); - hdr.ipv4.src_addr : ternary @name("ipv4_src"); - hdr.ipv4.dst_addr : ternary @name("ipv4_dst"); - hdr.ipv4.proto : ternary @name("ipv4_proto"); - local_meta.l4_sport : ternary @name("l4_sport"); - local_meta.l4_dport : ternary @name("l4_dport"); - } - actions = { - Acl_set_port_0(); - Acl_punt_0(); - Acl_clone_to_cpu_0(); - Acl_drop_0(); - NoAction_2(); - } - const default_action = NoAction_2(); - @name("acls") counters = direct_counter(CounterType.packets_and_bytes); - } @name("PreQosPipe.pre_qos_counter") counter>(32w1024, CounterType.packets_and_bytes) pre_qos_counter_0; @name("PreQosPipe.app_meter") meter>(32w1024, MeterType.bytes) app_meter_0; @name("PreQosPipe.session_meter") meter>(32w1024, MeterType.bytes) session_meter_0; @@ -393,9 +333,9 @@ control PreQosPipe(inout parsed_headers_t hdr, inout local_metadata_t local_meta hdr.ethernet.dst_addr: exact @name("dst_mac"); } actions = { - NoAction_3(); + NoAction_1(); } - default_action = NoAction_3(); + default_action = NoAction_1(); } @name("PreQosPipe.set_source_iface") action set_source_iface(@name("src_iface") bit<8> src_iface_1, @name("direction") bit<8> direction_1, @name("slice_id") bit<4> slice_id_1) { local_meta.src_iface = src_iface_1; @@ -566,9 +506,9 @@ control PreQosPipe(inout parsed_headers_t hdr, inout local_metadata_t local_meta } actions = { load_tunnel_param(); - @defaultonly NoAction_4(); + @defaultonly NoAction_2(); } - default_action = NoAction_4(); + default_action = NoAction_2(); } @name("PreQosPipe.do_gtpu_tunnel") action do_gtpu_tunnel() { hdr.inner_udp = hdr.udp; @@ -658,6 +598,66 @@ control PreQosPipe(inout parsed_headers_t hdr, inout local_metadata_t local_meta hdr.gtpu_ext_psc.qfi = local_meta.tunnel_out_qfi; hdr.gtpu_ext_psc.next_ext = 8w0x0; } + @name("PreQosPipe.Routing.drop") action Routing_drop_0() { + mark_to_drop(std_meta); + } + @name("PreQosPipe.Routing.route") action Routing_route_0(@name("src_mac") bit<48> src_mac, @name("dst_mac") bit<48> dst_mac, @name("egress_port") bit<9> egress_port_1) { + std_meta.egress_spec = egress_port_1; + hdr.ethernet.src_addr = src_mac; + hdr.ethernet.dst_addr = dst_mac; + } + @name("PreQosPipe.Routing.routes_v4") table Routing_routes_v4 { + key = { + hdr.ipv4.dst_addr : lpm @name("dst_prefix"); + hdr.ipv4.src_addr : selector @name("hdr.ipv4.src_addr"); + hdr.ipv4.proto : selector @name("hdr.ipv4.proto"); + local_meta.l4_sport: selector @name("local_meta.l4_sport"); + local_meta.l4_dport: selector @name("local_meta.l4_dport"); + } + actions = { + Routing_route_0(); + @defaultonly NoAction_3(); + } + @name("hashed_selector") implementation = action_selector(HashAlgorithm.crc16, 32w1024, 32w16); + size = 1024; + default_action = NoAction_3(); + } + @name("PreQosPipe.Acl.set_port") action Acl_set_port_0(@name("port") bit<9> port) { + std_meta.egress_spec = port; + } + @name("PreQosPipe.Acl.punt") action Acl_punt_0() { + std_meta.egress_spec = 9w255; + } + @name("PreQosPipe.Acl.clone_to_cpu") action Acl_clone_to_cpu_0() { + clone_preserving_field_list(CloneType.I2E, 32w99, 8w0); + } + @name("PreQosPipe.Acl.drop") action Acl_drop_0() { + mark_to_drop(std_meta); + hasExited = true; + } + @name("PreQosPipe.Acl.acls") table Acl_acls { + key = { + std_meta.ingress_port : ternary @name("inport"); + local_meta.src_iface : ternary @name("src_iface"); + hdr.ethernet.src_addr : ternary @name("eth_src"); + hdr.ethernet.dst_addr : ternary @name("eth_dst"); + hdr.ethernet.ether_type: ternary @name("eth_type"); + hdr.ipv4.src_addr : ternary @name("ipv4_src"); + hdr.ipv4.dst_addr : ternary @name("ipv4_dst"); + hdr.ipv4.proto : ternary @name("ipv4_proto"); + local_meta.l4_sport : ternary @name("l4_sport"); + local_meta.l4_dport : ternary @name("l4_dport"); + } + actions = { + Acl_set_port_0(); + Acl_punt_0(); + Acl_clone_to_cpu_0(); + Acl_drop_0(); + NoAction_4(); + } + const default_action = NoAction_4(); + @name("acls") counters = direct_counter(CounterType.packets_and_bytes); + } @hidden action act() { hasExited = false; hasReturned_0 = false; diff --git a/testdata/p4_16_samples_outputs/omec/up4.p4.p4info.txt b/testdata/p4_16_samples_outputs/omec/up4.p4.p4info.txt index d8cccabe45..b5b4bb6adb 100644 --- a/testdata/p4_16_samples_outputs/omec/up4.p4.p4info.txt +++ b/testdata/p4_16_samples_outputs/omec/up4.p4.p4info.txt @@ -1,114 +1,6 @@ pkg_info { arch: "v1model" } -tables { - preamble { - id: 39015874 - name: "PreQosPipe.Routing.routes_v4" - alias: "routes_v4" - } - match_fields { - id: 1 - name: "dst_prefix" - bitwidth: 32 - match_type: LPM - } - action_refs { - id: 23965128 - } - action_refs { - id: 21257015 - annotations: "@defaultonly" - scope: DEFAULT_ONLY - } - implementation_id: 297808402 - size: 1024 -} -tables { - preamble { - id: 47204971 - name: "PreQosPipe.Acl.acls" - alias: "Acl.acls" - } - match_fields { - id: 1 - name: "inport" - bitwidth: 9 - match_type: TERNARY - } - match_fields { - id: 2 - name: "src_iface" - bitwidth: 8 - match_type: TERNARY - } - match_fields { - id: 3 - name: "eth_src" - bitwidth: 48 - match_type: TERNARY - } - match_fields { - id: 4 - name: "eth_dst" - bitwidth: 48 - match_type: TERNARY - } - match_fields { - id: 5 - name: "eth_type" - bitwidth: 16 - match_type: TERNARY - } - match_fields { - id: 6 - name: "ipv4_src" - bitwidth: 32 - match_type: TERNARY - } - match_fields { - id: 7 - name: "ipv4_dst" - bitwidth: 32 - match_type: TERNARY - } - match_fields { - id: 8 - name: "ipv4_proto" - bitwidth: 8 - match_type: TERNARY - } - match_fields { - id: 9 - name: "l4_sport" - bitwidth: 16 - match_type: TERNARY - } - match_fields { - id: 10 - name: "l4_dport" - bitwidth: 16 - match_type: TERNARY - } - action_refs { - id: 30494847 - } - action_refs { - id: 26495283 - } - action_refs { - id: 21596798 - } - action_refs { - id: 18812293 - } - action_refs { - id: 21257015 - } - const_default_action_id: 21257015 - direct_resource_ids: 325583051 - size: 1024 -} tables { preamble { id: 40931612 @@ -327,74 +219,120 @@ tables { } size: 1024 } -actions { +tables { preamble { - id: 21257015 - name: "NoAction" - alias: "NoAction" - annotations: "@noWarn(\"unused\")" + id: 39015874 + name: "PreQosPipe.Routing.routes_v4" + alias: "routes_v4" } -} -actions { - preamble { - id: 31448256 - name: "PreQosPipe.Routing.drop" - alias: "Routing.drop" + match_fields { + id: 1 + name: "dst_prefix" + bitwidth: 32 + match_type: LPM + } + action_refs { + id: 23965128 + } + action_refs { + id: 21257015 + annotations: "@defaultonly" + scope: DEFAULT_ONLY } + implementation_id: 297808402 + size: 1024 } -actions { +tables { preamble { - id: 23965128 - name: "PreQosPipe.Routing.route" - alias: "route" + id: 47204971 + name: "PreQosPipe.Acl.acls" + alias: "Acl.acls" } - params { + match_fields { id: 1 - name: "src_mac" - bitwidth: 48 + name: "inport" + bitwidth: 9 + match_type: TERNARY } - params { + match_fields { id: 2 - name: "dst_mac" - bitwidth: 48 + name: "src_iface" + bitwidth: 8 + match_type: TERNARY } - params { + match_fields { id: 3 - name: "egress_port" - bitwidth: 9 + name: "eth_src" + bitwidth: 48 + match_type: TERNARY } -} -actions { - preamble { - id: 30494847 - name: "PreQosPipe.Acl.set_port" - alias: "set_port" + match_fields { + id: 4 + name: "eth_dst" + bitwidth: 48 + match_type: TERNARY } - params { - id: 1 - name: "port" - bitwidth: 9 + match_fields { + id: 5 + name: "eth_type" + bitwidth: 16 + match_type: TERNARY } -} -actions { - preamble { + match_fields { + id: 6 + name: "ipv4_src" + bitwidth: 32 + match_type: TERNARY + } + match_fields { + id: 7 + name: "ipv4_dst" + bitwidth: 32 + match_type: TERNARY + } + match_fields { + id: 8 + name: "ipv4_proto" + bitwidth: 8 + match_type: TERNARY + } + match_fields { + id: 9 + name: "l4_sport" + bitwidth: 16 + match_type: TERNARY + } + match_fields { + id: 10 + name: "l4_dport" + bitwidth: 16 + match_type: TERNARY + } + action_refs { + id: 30494847 + } + action_refs { id: 26495283 - name: "PreQosPipe.Acl.punt" - alias: "punt" } -} -actions { - preamble { + action_refs { id: 21596798 - name: "PreQosPipe.Acl.clone_to_cpu" - alias: "clone_to_cpu" } + action_refs { + id: 18812293 + } + action_refs { + id: 21257015 + } + const_default_action_id: 21257015 + direct_resource_ids: 325583051 + size: 1024 } actions { preamble { - id: 18812293 - name: "PreQosPipe.Acl.drop" - alias: "Acl.drop" + id: 21257015 + name: "NoAction" + alias: "NoAction" + annotations: "@noWarn(\"unused\")" } } actions { @@ -614,6 +552,68 @@ actions { alias: "do_gtpu_tunnel_with_psc" } } +actions { + preamble { + id: 31448256 + name: "PreQosPipe.Routing.drop" + alias: "Routing.drop" + } +} +actions { + preamble { + id: 23965128 + name: "PreQosPipe.Routing.route" + alias: "route" + } + params { + id: 1 + name: "src_mac" + bitwidth: 48 + } + params { + id: 2 + name: "dst_mac" + bitwidth: 48 + } + params { + id: 3 + name: "egress_port" + bitwidth: 9 + } +} +actions { + preamble { + id: 30494847 + name: "PreQosPipe.Acl.set_port" + alias: "set_port" + } + params { + id: 1 + name: "port" + bitwidth: 9 + } +} +actions { + preamble { + id: 26495283 + name: "PreQosPipe.Acl.punt" + alias: "punt" + } +} +actions { + preamble { + id: 21596798 + name: "PreQosPipe.Acl.clone_to_cpu" + alias: "clone_to_cpu" + } +} +actions { + preamble { + id: 18812293 + name: "PreQosPipe.Acl.drop" + alias: "Acl.drop" + } +} action_profiles { preamble { id: 297808402 diff --git a/testdata/p4_16_samples_outputs/pna-add_on_miss_action_name-first.p4 b/testdata/p4_16_samples_outputs/pna-add_on_miss_action_name-first.p4 index b692ee474d..4dbaed5546 100644 --- a/testdata/p4_16_samples_outputs/pna-add_on_miss_action_name-first.p4 +++ b/testdata/p4_16_samples_outputs/pna-add_on_miss_action_name-first.p4 @@ -83,7 +83,6 @@ control ct(inout headers_t hdr, inout main_metadata_t user_meta, in pna_main_inp } control MainControlImpl(inout headers_t hdr, inout main_metadata_t user_meta, in pna_main_input_metadata_t istd, inout pna_main_output_metadata_t ostd) { - @name("ct") ct() ct_inst; action next_hop1(PortId_t vport) { send_to_port(vport); } @@ -102,6 +101,7 @@ control MainControlImpl(inout headers_t hdr, inout main_metadata_t user_meta, in add_on_miss = true; const default_action = add_on_miss_action(); } + @name("ct") ct() ct_inst; apply { if (hdr.ipv4.isValid()) { ipv4_da.apply(); diff --git a/testdata/p4_16_samples_outputs/pna-add_on_miss_action_name-frontend.p4 b/testdata/p4_16_samples_outputs/pna-add_on_miss_action_name-frontend.p4 index 5bdc27d3f0..c3e951218f 100644 --- a/testdata/p4_16_samples_outputs/pna-add_on_miss_action_name-frontend.p4 +++ b/testdata/p4_16_samples_outputs/pna-add_on_miss_action_name-frontend.p4 @@ -57,41 +57,41 @@ parser MainParserImpl(packet_in pkt, out headers_t hdr, inout main_metadata_t ma control MainControlImpl(inout headers_t hdr, inout main_metadata_t user_meta, in pna_main_input_metadata_t istd, inout pna_main_output_metadata_t ostd) { @name("MainControlImpl.tmp") bit<32> tmp_0; @name("MainControlImpl.ct.tmp") bit<32> ct_tmp; - @name("MainControlImpl.ct.next_hop") action ct_next_hop_0(@name("vport") PortId_t vport) { + @name("MainControlImpl.next_hop1") action next_hop1(@name("vport") PortId_t vport) { send_to_port(vport); } - @name("MainControlImpl.ct.add_on_miss_action") action ct_add_on_miss_action_0() { - ct_tmp = 32w0; - add_entry>(action_name = "next_hop", action_params = ct_tmp, expire_time_profile_id = user_meta.timeout); + @name("MainControlImpl.add_on_miss_action") action add_on_miss_action() { + tmp_0 = 32w0; + add_entry>(action_name = "next_hop1", action_params = tmp_0, expire_time_profile_id = user_meta.timeout); } - @name("MainControlImpl.ct.ipv4_da") table ct_ipv4_da { + @name("MainControlImpl.ipv4_da") table ipv4_da_0 { key = { hdr.ipv4.dstAddr: exact @name("hdr.ipv4.dstAddr"); } actions = { - @tableonly ct_next_hop_0(); - @defaultonly ct_add_on_miss_action_0(); + @tableonly next_hop1(); + @defaultonly add_on_miss_action(); } add_on_miss = true; - const default_action = ct_add_on_miss_action_0(); + const default_action = add_on_miss_action(); } - @name("MainControlImpl.next_hop1") action next_hop1(@name("vport") PortId_t vport_2) { + @name("MainControlImpl.ct.next_hop") action ct_next_hop_0(@name("vport") PortId_t vport_2) { send_to_port(vport_2); } - @name("MainControlImpl.add_on_miss_action") action add_on_miss_action() { - tmp_0 = 32w0; - add_entry>(action_name = "next_hop1", action_params = tmp_0, expire_time_profile_id = user_meta.timeout); + @name("MainControlImpl.ct.add_on_miss_action") action ct_add_on_miss_action_0() { + ct_tmp = 32w0; + add_entry>(action_name = "next_hop", action_params = ct_tmp, expire_time_profile_id = user_meta.timeout); } - @name("MainControlImpl.ipv4_da") table ipv4_da_0 { + @name("MainControlImpl.ct.ipv4_da") table ct_ipv4_da { key = { hdr.ipv4.dstAddr: exact @name("hdr.ipv4.dstAddr"); } actions = { - @tableonly next_hop1(); - @defaultonly add_on_miss_action(); + @tableonly ct_next_hop_0(); + @defaultonly ct_add_on_miss_action_0(); } add_on_miss = true; - const default_action = add_on_miss_action(); + const default_action = ct_add_on_miss_action_0(); } apply { if (hdr.ipv4.isValid()) { diff --git a/testdata/p4_16_samples_outputs/pna-add_on_miss_action_name-midend.p4 b/testdata/p4_16_samples_outputs/pna-add_on_miss_action_name-midend.p4 index 5e65e704df..22764385eb 100644 --- a/testdata/p4_16_samples_outputs/pna-add_on_miss_action_name-midend.p4 +++ b/testdata/p4_16_samples_outputs/pna-add_on_miss_action_name-midend.p4 @@ -54,39 +54,39 @@ parser MainParserImpl(packet_in pkt, out headers_t hdr, inout main_metadata_t ma } control MainControlImpl(inout headers_t hdr, inout main_metadata_t user_meta, in pna_main_input_metadata_t istd, inout pna_main_output_metadata_t ostd) { - @name("MainControlImpl.ct.next_hop") action ct_next_hop_0(@name("vport") bit<32> vport) { + @name("MainControlImpl.next_hop1") action next_hop1(@name("vport") bit<32> vport) { send_to_port(vport); } - @name("MainControlImpl.ct.add_on_miss_action") action ct_add_on_miss_action_0() { - add_entry>(action_name = "next_hop", action_params = 32w0, expire_time_profile_id = user_meta.timeout); + @name("MainControlImpl.add_on_miss_action") action add_on_miss_action() { + add_entry>(action_name = "next_hop1", action_params = 32w0, expire_time_profile_id = user_meta.timeout); } - @name("MainControlImpl.ct.ipv4_da") table ct_ipv4_da { + @name("MainControlImpl.ipv4_da") table ipv4_da_0 { key = { hdr.ipv4.dstAddr: exact @name("hdr.ipv4.dstAddr"); } actions = { - @tableonly ct_next_hop_0(); - @defaultonly ct_add_on_miss_action_0(); + @tableonly next_hop1(); + @defaultonly add_on_miss_action(); } add_on_miss = true; - const default_action = ct_add_on_miss_action_0(); + const default_action = add_on_miss_action(); } - @name("MainControlImpl.next_hop1") action next_hop1(@name("vport") bit<32> vport_2) { + @name("MainControlImpl.ct.next_hop") action ct_next_hop_0(@name("vport") bit<32> vport_2) { send_to_port(vport_2); } - @name("MainControlImpl.add_on_miss_action") action add_on_miss_action() { - add_entry>(action_name = "next_hop1", action_params = 32w0, expire_time_profile_id = user_meta.timeout); + @name("MainControlImpl.ct.add_on_miss_action") action ct_add_on_miss_action_0() { + add_entry>(action_name = "next_hop", action_params = 32w0, expire_time_profile_id = user_meta.timeout); } - @name("MainControlImpl.ipv4_da") table ipv4_da_0 { + @name("MainControlImpl.ct.ipv4_da") table ct_ipv4_da { key = { hdr.ipv4.dstAddr: exact @name("hdr.ipv4.dstAddr"); } actions = { - @tableonly next_hop1(); - @defaultonly add_on_miss_action(); + @tableonly ct_next_hop_0(); + @defaultonly ct_add_on_miss_action_0(); } add_on_miss = true; - const default_action = add_on_miss_action(); + const default_action = ct_add_on_miss_action_0(); } apply { if (hdr.ipv4.isValid()) { diff --git a/testdata/p4_16_samples_outputs/pna-add_on_miss_action_name.p4.bfrt.json b/testdata/p4_16_samples_outputs/pna-add_on_miss_action_name.p4.bfrt.json index 4bfbf92dd0..dfb6f5c290 100644 --- a/testdata/p4_16_samples_outputs/pna-add_on_miss_action_name.p4.bfrt.json +++ b/testdata/p4_16_samples_outputs/pna-add_on_miss_action_name.p4.bfrt.json @@ -2,8 +2,8 @@ "schema_version" : "1.0.0", "tables" : [ { - "name" : "pipe.MainControlImpl.ct.ipv4_da", - "id" : 44583508, + "name" : "pipe.MainControlImpl.ipv4_da", + "id" : 38237845, "table_type" : "MatchAction_Direct", "size" : 1024, "annotations" : [], @@ -25,8 +25,8 @@ ], "action_specs" : [ { - "id" : 27078786, - "name" : "MainControlImpl.ct.next_hop", + "id" : 20085697, + "name" : "MainControlImpl.next_hop1", "action_scope" : "TableOnly", "annotations" : [ { @@ -49,8 +49,8 @@ ] }, { - "id" : 30700919, - "name" : "MainControlImpl.ct.add_on_miss_action", + "id" : 18241179, + "name" : "MainControlImpl.add_on_miss_action", "action_scope" : "DefaultOnly", "annotations" : [ { @@ -65,8 +65,8 @@ "attributes" : ["EntryScope"] }, { - "name" : "pipe.MainControlImpl.ipv4_da", - "id" : 38237845, + "name" : "pipe.MainControlImpl.ct.ipv4_da", + "id" : 44583508, "table_type" : "MatchAction_Direct", "size" : 1024, "annotations" : [], @@ -88,8 +88,8 @@ ], "action_specs" : [ { - "id" : 20085697, - "name" : "MainControlImpl.next_hop1", + "id" : 27078786, + "name" : "MainControlImpl.ct.next_hop", "action_scope" : "TableOnly", "annotations" : [ { @@ -112,8 +112,8 @@ ] }, { - "id" : 18241179, - "name" : "MainControlImpl.add_on_miss_action", + "id" : 30700919, + "name" : "MainControlImpl.ct.add_on_miss_action", "action_scope" : "DefaultOnly", "annotations" : [ { diff --git a/testdata/p4_16_samples_outputs/pna-add_on_miss_action_name.p4.spec b/testdata/p4_16_samples_outputs/pna-add_on_miss_action_name.p4.spec index 74bb463c22..a5f78ea73a 100644 --- a/testdata/p4_16_samples_outputs/pna-add_on_miss_action_name.p4.spec +++ b/testdata/p4_16_samples_outputs/pna-add_on_miss_action_name.p4.spec @@ -39,37 +39,37 @@ header ethernet instanceof ethernet_t header ipv4 instanceof ipv4_t regarray direction size 0x100 initval 0 -action ct_next_hop_0 args instanceof ct_next_hop_0_arg_t { +action next_hop1 args instanceof next_hop1_arg_t { mov m.pna_main_output_metadata_output_port t.vport return } -action ct_add_on_miss_action_0 args none { +action add_on_miss_action args none { mov m.learnArg 0x0 - learn ct_next_hop_0 m.learnArg m.local_metadata_timeout + learn next_hop1 m.learnArg m.local_metadata_timeout return } -action next_hop1 args instanceof next_hop1_arg_t { +action ct_next_hop_0 args instanceof ct_next_hop_0_arg_t { mov m.pna_main_output_metadata_output_port t.vport return } -action add_on_miss_action args none { +action ct_add_on_miss_action_0 args none { mov m.learnArg_0 0x0 - learn next_hop1 m.learnArg_0 m.local_metadata_timeout + learn ct_next_hop_0 m.learnArg_0 m.local_metadata_timeout return } -learner ct_ipv4_da { +learner ipv4_da { key { h.ipv4.dstAddr } actions { - ct_next_hop_0 @tableonly - ct_add_on_miss_action_0 @defaultonly + next_hop1 @tableonly + add_on_miss_action @defaultonly } - default_action ct_add_on_miss_action_0 args none + default_action add_on_miss_action args none size 0x10000 timeout { 10 @@ -84,15 +84,15 @@ learner ct_ipv4_da { } } -learner ipv4_da { +learner ct_ipv4_da { key { h.ipv4.dstAddr } actions { - next_hop1 @tableonly - add_on_miss_action @defaultonly + ct_next_hop_0 @tableonly + ct_add_on_miss_action_0 @defaultonly } - default_action add_on_miss_action args none + default_action ct_add_on_miss_action_0 args none size 0x10000 timeout { 10 diff --git a/testdata/p4_16_samples_outputs/psa-end-of-ingress-test-bmv2-first.p4 b/testdata/p4_16_samples_outputs/psa-end-of-ingress-test-bmv2-first.p4 index 70ea1032fb..09576d41e7 100644 --- a/testdata/p4_16_samples_outputs/psa-end-of-ingress-test-bmv2-first.p4 +++ b/testdata/p4_16_samples_outputs/psa-end-of-ingress-test-bmv2-first.p4 @@ -79,8 +79,8 @@ parser EgressParserImpl(packet_in pkt, out headers_t hdr, inout metadata_t user_ } control cEgress(inout headers_t hdr, inout metadata_t user_meta, in psa_egress_input_metadata_t istd, inout psa_egress_output_metadata_t ostd) { - @name("packet_path_to_int") packet_path_to_int() packet_path_to_int_inst_0; Register, bit<8>>(32w256) egress_pkt_seen; + @name("packet_path_to_int") packet_path_to_int() packet_path_to_int_inst_0; apply { bit<8> idx = hdr.ethernet.etherType[7:0]; bit<16> cur_count = egress_pkt_seen.read(idx); diff --git a/testdata/p4_16_samples_outputs/psa-recirculate-no-meta-bmv2-first.p4 b/testdata/p4_16_samples_outputs/psa-recirculate-no-meta-bmv2-first.p4 index d389a68fd2..280773d593 100644 --- a/testdata/p4_16_samples_outputs/psa-recirculate-no-meta-bmv2-first.p4 +++ b/testdata/p4_16_samples_outputs/psa-recirculate-no-meta-bmv2-first.p4 @@ -56,11 +56,11 @@ parser IngressParserImpl(packet_in pkt, out headers_t hdr, inout metadata_t user } control cIngress(inout headers_t hdr, inout metadata_t user_meta, in psa_ingress_input_metadata_t istd, inout psa_ingress_output_metadata_t ostd) { - @name("packet_path_to_int") packet_path_to_int() packet_path_to_int_inst; bit<32> int_packet_path; action record_ingress_ports_in_pkt() { hdr.output_data.word1 = (PortIdUint_t)istd.ingress_port; } + @name("packet_path_to_int") packet_path_to_int() packet_path_to_int_inst; apply { if (hdr.ethernet.dstAddr[3:0] >= 4w4) { record_ingress_ports_in_pkt(); @@ -86,7 +86,6 @@ parser EgressParserImpl(packet_in pkt, out headers_t hdr, inout metadata_t user_ } control cEgress(inout headers_t hdr, inout metadata_t user_meta, in psa_egress_input_metadata_t istd, inout psa_egress_output_metadata_t ostd) { - @name("packet_path_to_int") packet_path_to_int() packet_path_to_int_inst_0; action add() { hdr.ethernet.dstAddr = hdr.ethernet.dstAddr + hdr.ethernet.srcAddr; } @@ -96,6 +95,7 @@ control cEgress(inout headers_t hdr, inout metadata_t user_meta, in psa_egress_i } default_action = add(); } + @name("packet_path_to_int") packet_path_to_int() packet_path_to_int_inst_0; apply { e.apply(); if (istd.egress_port == (PortId_t)32w0xfffffffa) {