From 8d213046fcdff0d6c1655e07d7dbc20d5870d9eb Mon Sep 17 00:00:00 2001 From: fruffy Date: Tue, 23 Jan 2024 18:45:34 -0500 Subject: [PATCH] Fix up the DPDK and PSA back end, too. --- backends/dpdk/dpdkAsmOpt.cpp | 2 +- backends/dpdk/run-dpdk-ptf-test.py | 2 +- backends/dpdk/run-dpdk-test.py | 4 +- backends/ebpf/ebpfParser.cpp | 2 +- .../{bng.p4info.txt => bng.p4info.txtpb} | 0 ...3-acl.p4info.txt => l2l3-acl.p4info.txtpb} | 0 .../{upf.p4info.txt => upf.p4info.txtpb} | 0 backends/ebpf/run-ebpf-test.py | 10 +- ...4info.txt => action-profile2.p4info.txtpb} | 0 ...info.txt => action-selector2.p4info.txtpb} | 0 ...nters.p4info.txt => counters.p4info.txtpb} | 0 ...{digest.p4info.txt => digest.p4info.txtpb} | 0 ....p4info.txt => meters-direct.p4info.txtpb} | 0 ...{meters.p4info.txt => meters.p4info.txtpb} | 0 .../{pvs.p4info.txt => pvs.p4info.txtpb} | 0 ...p4info.txt => register-apply.p4info.txtpb} | 0 backends/ebpf/tests/ptf/bng.py | 2 +- backends/ebpf/tests/ptf/common.py | 2 +- backends/ebpf/tests/ptf/l2l3_acl.py | 2 +- backends/ebpf/tests/ptf/meters.py | 4 +- backends/ebpf/tests/ptf/register.py | 2 +- .../ebpf/tests/ptf/table_implementation.py | 4 +- backends/ebpf/tests/ptf/test.py | 6 +- backends/ebpf/tests/ptf/upf.py | 2 +- .../psa-action-profile2.p4-error | 6 + .../psa-action-profile2.p4.bfrt.json | 81 ++++++++++ .../psa-counter6.p4-error | 2 + .../psa-counter6.p4.bfrt.json | 120 +++++++++++++++ .../psa-example-dpdk-directmeter-err.p4-error | 3 + ...-example-dpdk-directmeter-err.p4.bfrt.json | 140 ++++++++++++++++++ .../psa-meter6.p4-error | 4 + .../psa-meter6.p4.bfrt.json | 140 ++++++++++++++++++ 32 files changed, 522 insertions(+), 18 deletions(-) rename backends/ebpf/psa/examples/{bng.p4info.txt => bng.p4info.txtpb} (100%) rename backends/ebpf/psa/examples/{l2l3-acl.p4info.txt => l2l3-acl.p4info.txtpb} (100%) rename backends/ebpf/psa/examples/{upf.p4info.txt => upf.p4info.txtpb} (100%) rename backends/ebpf/tests/p4testdata/{action-profile2.p4info.txt => action-profile2.p4info.txtpb} (100%) rename backends/ebpf/tests/p4testdata/{action-selector2.p4info.txt => action-selector2.p4info.txtpb} (100%) rename backends/ebpf/tests/p4testdata/{counters.p4info.txt => counters.p4info.txtpb} (100%) rename backends/ebpf/tests/p4testdata/{digest.p4info.txt => digest.p4info.txtpb} (100%) rename backends/ebpf/tests/p4testdata/{meters-direct.p4info.txt => meters-direct.p4info.txtpb} (100%) rename backends/ebpf/tests/p4testdata/{meters.p4info.txt => meters.p4info.txtpb} (100%) rename backends/ebpf/tests/p4testdata/{pvs.p4info.txt => pvs.p4info.txtpb} (100%) rename backends/ebpf/tests/p4testdata/{register-apply.p4info.txt => register-apply.p4info.txtpb} (100%) create mode 100644 testdata/p4_16_psa_errors_outputs/psa-action-profile2.p4-error create mode 100644 testdata/p4_16_psa_errors_outputs/psa-action-profile2.p4.bfrt.json create mode 100644 testdata/p4_16_psa_errors_outputs/psa-counter6.p4-error create mode 100644 testdata/p4_16_psa_errors_outputs/psa-counter6.p4.bfrt.json create mode 100644 testdata/p4_16_psa_errors_outputs/psa-example-dpdk-directmeter-err.p4-error create mode 100644 testdata/p4_16_psa_errors_outputs/psa-example-dpdk-directmeter-err.p4.bfrt.json create mode 100644 testdata/p4_16_psa_errors_outputs/psa-meter6.p4-error create mode 100644 testdata/p4_16_psa_errors_outputs/psa-meter6.p4.bfrt.json diff --git a/backends/dpdk/dpdkAsmOpt.cpp b/backends/dpdk/dpdkAsmOpt.cpp index b35ee77a72..1223634823 100644 --- a/backends/dpdk/dpdkAsmOpt.cpp +++ b/backends/dpdk/dpdkAsmOpt.cpp @@ -619,7 +619,7 @@ bool EmitDpdkTableConfig::isAllKeysDefaultExpression(const IR::ListExpression *k void EmitDpdkTableConfig::postorder(const IR::DpdkTable *table) { auto entriesList = table->getEntries(); if (entriesList == nullptr) return; - dpdkTableConfigFile.open(table->name + ".txt"); + dpdkTableConfigFile.open(table->name + ".txtpb"); auto needsPriority = tableNeedsPriority(table, refMap); int entryPriority = entriesList->entries.size(); for (auto e : entriesList->entries) { diff --git a/backends/dpdk/run-dpdk-ptf-test.py b/backends/dpdk/run-dpdk-ptf-test.py index efc184ede7..aa6314e152 100755 --- a/backends/dpdk/run-dpdk-ptf-test.py +++ b/backends/dpdk/run-dpdk-ptf-test.py @@ -288,7 +288,7 @@ def run_test(options: Options) -> int: # Define the test environment and compile the P4 target test_name = Path(options.p4_file.name) - info_name = options.testdir.joinpath("p4Info.txt") + info_name = options.testdir.joinpath("p4Info.txtpb") bf_rt_schema = options.testdir.joinpath("bf-rt.json") conf_bin = options.testdir.joinpath(test_name.with_suffix(".pb.bin")) # Files needed by the pipeline diff --git a/backends/dpdk/run-dpdk-test.py b/backends/dpdk/run-dpdk-test.py index f7e608e5a6..13c54d21bc 100755 --- a/backends/dpdk/run-dpdk-test.py +++ b/backends/dpdk/run-dpdk-test.py @@ -281,8 +281,8 @@ def process_file(options, argv): print("Writing temporary files into ", tmpdir) stderr = os.path.join(tmpdir, basename + "-error") spec = os.path.join(tmpdir, basename + ".spec") - p4runtimeFile = os.path.join(tmpdir, basename + ".p4info.txt") - p4runtimeEntriesFile = os.path.join(tmpdir, basename + ".entries.txt") + p4runtimeFile = os.path.join(tmpdir, basename + ".p4info.txtpb") + p4runtimeEntriesFile = os.path.join(tmpdir, basename + ".entries.txtpb") bfRtSchemaFile = os.path.join(tmpdir, basename + ".bfrt.json") def getArch(path): diff --git a/backends/ebpf/ebpfParser.cpp b/backends/ebpf/ebpfParser.cpp index 85389667ff..8637ca370f 100644 --- a/backends/ebpf/ebpfParser.cpp +++ b/backends/ebpf/ebpfParser.cpp @@ -326,7 +326,7 @@ void StateTranslationVisitor::compileExtractField(const IR::Expression *expr, // 0x112233445566778809 // 0x112233445566778890 // To correctly insert that padding, the length of field must be known, but tools like - // nikss-ctl (and the nikss library) don't consume P4info.txt to have such knowledge. + // nikss-ctl (and the nikss library) don't consume P4info.txtpb to have such knowledge. // There is also a bug in (de)parser causing such fields to be deparsed incorrectly. ::error(ErrorType::ERR_UNSUPPORTED_ON_TARGET, "%1%: fields wider than 64 bits must have a size multiple of 8 bits (1 byte) " diff --git a/backends/ebpf/psa/examples/bng.p4info.txt b/backends/ebpf/psa/examples/bng.p4info.txtpb similarity index 100% rename from backends/ebpf/psa/examples/bng.p4info.txt rename to backends/ebpf/psa/examples/bng.p4info.txtpb diff --git a/backends/ebpf/psa/examples/l2l3-acl.p4info.txt b/backends/ebpf/psa/examples/l2l3-acl.p4info.txtpb similarity index 100% rename from backends/ebpf/psa/examples/l2l3-acl.p4info.txt rename to backends/ebpf/psa/examples/l2l3-acl.p4info.txtpb diff --git a/backends/ebpf/psa/examples/upf.p4info.txt b/backends/ebpf/psa/examples/upf.p4info.txtpb similarity index 100% rename from backends/ebpf/psa/examples/upf.p4info.txt rename to backends/ebpf/psa/examples/upf.p4info.txtpb diff --git a/backends/ebpf/run-ebpf-test.py b/backends/ebpf/run-ebpf-test.py index cc76dabf89..6757042a4b 100755 --- a/backends/ebpf/run-ebpf-test.py +++ b/backends/ebpf/run-ebpf-test.py @@ -190,9 +190,15 @@ def run_test(options, argv): result = testutils.SUCCESS else: result = run_model(ebpf, testfile) + elif options.replace: + exp_dir = os.path.dirname(options.p4filename).replace("_errors", "_errors_outputs", 1) + exp_file = options.p4filename.replace("_errors/", "_errors_outputs/", 1) + "-stderr" + testutils.check_and_create_dir(Path(exp_dir)) + with open(exp_file, mode="w+", encoding="utf-8") as error_file: + error_file.write(out) else: # Expected error, check output matches exp_file = options.p4filename.replace("_errors/", "_errors_outputs/", 1) + "-stderr" - with open(exp_file, 'r') as f: + with open(exp_file, 'r', encoding="utf-8") as f: exp_stderr = f.read().strip() # Output will have full path which differs out = out.replace(options.p4filename, basename).strip() @@ -234,6 +240,8 @@ def run_test(options, argv): options.compiler = testutils.check_if_file(args.compiler).as_posix() options.p4filename = testutils.check_if_file(args.p4filename).as_posix() options.replace = args.replace + if "P4TEST_REPLACE" in os.environ: + options.replace = True options.cleanupTmp = args.nocleanup if args.testfile: options.testfile = testutils.check_if_file(args.testfile).as_posix() diff --git a/backends/ebpf/tests/p4testdata/action-profile2.p4info.txt b/backends/ebpf/tests/p4testdata/action-profile2.p4info.txtpb similarity index 100% rename from backends/ebpf/tests/p4testdata/action-profile2.p4info.txt rename to backends/ebpf/tests/p4testdata/action-profile2.p4info.txtpb diff --git a/backends/ebpf/tests/p4testdata/action-selector2.p4info.txt b/backends/ebpf/tests/p4testdata/action-selector2.p4info.txtpb similarity index 100% rename from backends/ebpf/tests/p4testdata/action-selector2.p4info.txt rename to backends/ebpf/tests/p4testdata/action-selector2.p4info.txtpb diff --git a/backends/ebpf/tests/p4testdata/counters.p4info.txt b/backends/ebpf/tests/p4testdata/counters.p4info.txtpb similarity index 100% rename from backends/ebpf/tests/p4testdata/counters.p4info.txt rename to backends/ebpf/tests/p4testdata/counters.p4info.txtpb diff --git a/backends/ebpf/tests/p4testdata/digest.p4info.txt b/backends/ebpf/tests/p4testdata/digest.p4info.txtpb similarity index 100% rename from backends/ebpf/tests/p4testdata/digest.p4info.txt rename to backends/ebpf/tests/p4testdata/digest.p4info.txtpb diff --git a/backends/ebpf/tests/p4testdata/meters-direct.p4info.txt b/backends/ebpf/tests/p4testdata/meters-direct.p4info.txtpb similarity index 100% rename from backends/ebpf/tests/p4testdata/meters-direct.p4info.txt rename to backends/ebpf/tests/p4testdata/meters-direct.p4info.txtpb diff --git a/backends/ebpf/tests/p4testdata/meters.p4info.txt b/backends/ebpf/tests/p4testdata/meters.p4info.txtpb similarity index 100% rename from backends/ebpf/tests/p4testdata/meters.p4info.txt rename to backends/ebpf/tests/p4testdata/meters.p4info.txtpb diff --git a/backends/ebpf/tests/p4testdata/pvs.p4info.txt b/backends/ebpf/tests/p4testdata/pvs.p4info.txtpb similarity index 100% rename from backends/ebpf/tests/p4testdata/pvs.p4info.txt rename to backends/ebpf/tests/p4testdata/pvs.p4info.txtpb diff --git a/backends/ebpf/tests/p4testdata/register-apply.p4info.txt b/backends/ebpf/tests/p4testdata/register-apply.p4info.txtpb similarity index 100% rename from backends/ebpf/tests/p4testdata/register-apply.p4info.txt rename to backends/ebpf/tests/p4testdata/register-apply.p4info.txtpb diff --git a/backends/ebpf/tests/ptf/bng.py b/backends/ebpf/tests/ptf/bng.py index be157c1ba8..d410f934af 100644 --- a/backends/ebpf/tests/ptf/bng.py +++ b/backends/ebpf/tests/ptf/bng.py @@ -118,7 +118,7 @@ def pkt_decrement_ttl(pkt): class BNGTest(P4EbpfTest): p4_file_path = "../psa/examples/bng.p4" - p4info_reference_file_path = "../psa/examples/bng.p4info.txt" + p4info_reference_file_path = "../psa/examples/bng.p4info.txtpb" session_installed = False def setUp(self): diff --git a/backends/ebpf/tests/ptf/common.py b/backends/ebpf/tests/ptf/common.py index 5c48884df8..97780410af 100644 --- a/backends/ebpf/tests/ptf/common.py +++ b/backends/ebpf/tests/ptf/common.py @@ -130,7 +130,7 @@ def setUp(self): p4args += " --xdp" if self.p4info_reference_file_path: - self.p4info_p4c_generated = os.path.join("ptf_out", filename + ".p4info.txt") + self.p4info_p4c_generated = os.path.join("ptf_out", filename + ".p4info.txtpb") p4args += " --p4runtime-files {}".format(self.p4info_p4c_generated) p4args = p4args + " " + self.p4c_additional_args diff --git a/backends/ebpf/tests/ptf/l2l3_acl.py b/backends/ebpf/tests/ptf/l2l3_acl.py index 43325caadc..804f9ce30a 100644 --- a/backends/ebpf/tests/ptf/l2l3_acl.py +++ b/backends/ebpf/tests/ptf/l2l3_acl.py @@ -38,7 +38,7 @@ def pkt_add_vlan(pkt, vlan_vid=10, vlan_pcp=0, dl_vlan_cfi=0): class L2L3SwitchTest(P4EbpfTest): p4_file_path = "../psa/examples/l2l3-acl.p4" - p4info_reference_file_path = "../psa/examples/l2l3-acl.p4info.txt" + p4info_reference_file_path = "../psa/examples/l2l3-acl.p4info.txtpb" def configure_port(self, port_id, vlan_id=None): if vlan_id is None: diff --git a/backends/ebpf/tests/ptf/meters.py b/backends/ebpf/tests/ptf/meters.py index ac8938bfac..e725fa6cf3 100644 --- a/backends/ebpf/tests/ptf/meters.py +++ b/backends/ebpf/tests/ptf/meters.py @@ -123,7 +123,7 @@ class MeterPSATest(P4EbpfTest): """ p4_file_path = "p4testdata/meters.p4" - p4info_reference_file_path = "p4testdata/meters.p4info.txt" + p4info_reference_file_path = "p4testdata/meters.p4info.txtpb" def runTest(self): pkt = testutils.simple_ip_packet() @@ -237,7 +237,7 @@ class DirectMeterPSATest(P4EbpfTest): """ p4_file_path = "p4testdata/meters-direct.p4" - p4info_reference_file_path = "p4testdata/meters-direct.p4info.txt" + p4info_reference_file_path = "p4testdata/meters-direct.p4info.txtpb" def runTest(self): pkt = testutils.simple_ip_packet() diff --git a/backends/ebpf/tests/ptf/register.py b/backends/ebpf/tests/ptf/register.py index 19b61634ad..d80506ccd6 100644 --- a/backends/ebpf/tests/ptf/register.py +++ b/backends/ebpf/tests/ptf/register.py @@ -66,7 +66,7 @@ class RegisterApplyPSATest(P4EbpfTest): """ p4_file_path = "p4testdata/register-apply.p4" - p4info_reference_file_path = "p4testdata/register-apply.p4info.txt" + p4info_reference_file_path = "p4testdata/register-apply.p4info.txtpb" def runTest(self): pkt = testutils.simple_ip_packet() diff --git a/backends/ebpf/tests/ptf/table_implementation.py b/backends/ebpf/tests/ptf/table_implementation.py index 6f4a422421..41726cc632 100644 --- a/backends/ebpf/tests/ptf/table_implementation.py +++ b/backends/ebpf/tests/ptf/table_implementation.py @@ -54,7 +54,7 @@ class ActionProfileTwoTablesSameInstancePSATest(P4EbpfTest): """ p4_file_path = "p4testdata/action-profile2.p4" - p4info_reference_file_path = "p4testdata/action-profile2.p4info.txt" + p4info_reference_file_path = "p4testdata/action-profile2.p4info.txtpb" def runTest(self): ref = self.action_profile_add_action(ap="MyIC_ap", action=2, data=[0x1122]) @@ -236,7 +236,7 @@ class ActionSelectorTwoTablesSameInstancePSATest(ActionSelectorTest): """ p4_file_path = "p4testdata/action-selector2.p4" - p4info_reference_file_path = "p4testdata/action-selector2.p4info.txt" + p4info_reference_file_path = "p4testdata/action-selector2.p4info.txtpb" def runTest(self): self.create_default_rule_set(table="MyIC_tbl", selector="MyIC_as") diff --git a/backends/ebpf/tests/ptf/test.py b/backends/ebpf/tests/ptf/test.py index 4a849db0d3..621100c6f0 100644 --- a/backends/ebpf/tests/ptf/test.py +++ b/backends/ebpf/tests/ptf/test.py @@ -366,7 +366,7 @@ def runTest(self): class DigestPSATest(P4EbpfTest): p4_file_path = "p4testdata/digest.p4" - p4info_reference_file_path = "p4testdata/digest.p4info.txt" + p4info_reference_file_path = "p4testdata/digest.p4info.txtpb" def runTest(self): pkt = testutils.simple_ip_packet(eth_src="fa:fb:fc:fd:fe:f0") @@ -409,7 +409,7 @@ def runTest(self): class CountersPSATest(P4EbpfTest): p4_file_path = "p4testdata/counters.p4" - p4info_reference_file_path = "p4testdata/counters.p4info.txt" + p4info_reference_file_path = "p4testdata/counters.p4info.txtpb" def runTest(self): pkt = testutils.simple_ip_packet( @@ -481,7 +481,7 @@ class ParserValueSetPSATest(P4EbpfTest): """ p4_file_path = "p4testdata/pvs.p4" - p4info_reference_file_path = "p4testdata/pvs.p4info.txt" + p4info_reference_file_path = "p4testdata/pvs.p4info.txtpb" def runTest(self): pkt = testutils.simple_udp_packet(ip_dst="10.0.0.1", udp_dport=80) diff --git a/backends/ebpf/tests/ptf/upf.py b/backends/ebpf/tests/ptf/upf.py index bce7793362..74de6c7073 100644 --- a/backends/ebpf/tests/ptf/upf.py +++ b/backends/ebpf/tests/ptf/upf.py @@ -79,7 +79,7 @@ def pkt_route(pkt, mac_src, mac_dst): class UPFTest(P4EbpfTest): p4_file_path = "../psa/examples/upf.p4" - p4info_reference_file_path = "../psa/examples/upf.p4info.txt" + p4info_reference_file_path = "../psa/examples/upf.p4info.txtpb" def setup_pfcp_session(self, seid, teid, ue_ip): self.table_add( diff --git a/testdata/p4_16_psa_errors_outputs/psa-action-profile2.p4-error b/testdata/p4_16_psa_errors_outputs/psa-action-profile2.p4-error new file mode 100644 index 0000000000..031fd2faf4 --- /dev/null +++ b/testdata/p4_16_psa_errors_outputs/psa-action-profile2.p4-error @@ -0,0 +1,6 @@ +psa-action-profile2.p4(59): [--Werror=invalid] error: Expected psa_implementation property value for table MyIC.tbl to resolve to an extern instance: psa_implementation + psa_implementation = { ap, ap1 }; + ^^^^^^^^^^^^^^^^^^ +psa-action-profile2.p4(59): [--Werror=invalid] error: Expected psa_implementation property value for table MyIC.tbl to resolve to an extern instance: psa_implementation + psa_implementation = { ap, ap1 }; + ^^^^^^^^^^^^^^^^^^ diff --git a/testdata/p4_16_psa_errors_outputs/psa-action-profile2.p4.bfrt.json b/testdata/p4_16_psa_errors_outputs/psa-action-profile2.p4.bfrt.json new file mode 100644 index 0000000000..85bdc66e50 --- /dev/null +++ b/testdata/p4_16_psa_errors_outputs/psa-action-profile2.p4.bfrt.json @@ -0,0 +1,81 @@ +{ + "schema_version" : "1.0.0", + "tables" : [ + { + "name" : "ip.MyIC.tbl", + "id" : 39967501, + "table_type" : "MatchAction_Direct", + "size" : 1024, + "annotations" : [], + "depends_on" : [], + "has_const_default_action" : false, + "key" : [ + { + "id" : 1, + "name" : "hdr.ethernet.srcAddr", + "repeated" : false, + "annotations" : [], + "mandatory" : false, + "match_type" : "Exact", + "type" : { + "type" : "bytes", + "width" : 48 + } + } + ], + "action_specs" : [ + { + "id" : 21257015, + "name" : "NoAction", + "action_scope" : "TableAndDefault", + "annotations" : [], + "data" : [] + }, + { + "id" : 21832421, + "name" : "MyIC.a1", + "action_scope" : "TableAndDefault", + "annotations" : [], + "data" : [ + { + "id" : 1, + "name" : "param", + "repeated" : false, + "mandatory" : true, + "read_only" : false, + "annotations" : [], + "type" : { + "type" : "bytes", + "width" : 48 + } + } + ] + }, + { + "id" : 23466264, + "name" : "MyIC.a2", + "action_scope" : "TableAndDefault", + "annotations" : [], + "data" : [ + { + "id" : 1, + "name" : "param", + "repeated" : false, + "mandatory" : true, + "read_only" : false, + "annotations" : [], + "type" : { + "type" : "bytes", + "width" : 16 + } + } + ] + } + ], + "data" : [], + "supported_operations" : [], + "attributes" : ["EntryScope"] + } + ], + "learn_filters" : [] +} \ No newline at end of file diff --git a/testdata/p4_16_psa_errors_outputs/psa-counter6.p4-error b/testdata/p4_16_psa_errors_outputs/psa-counter6.p4-error new file mode 100644 index 0000000000..c46de5be3f --- /dev/null +++ b/testdata/p4_16_psa_errors_outputs/psa-counter6.p4-error @@ -0,0 +1,2 @@ +[--Werror=duplicate] error: Name 'MyIC.counter0' is used for multiple direct counter objects in the P4Info message +[--Werror=duplicate] error: Found 1 duplicate name(s) in the P4Info diff --git a/testdata/p4_16_psa_errors_outputs/psa-counter6.p4.bfrt.json b/testdata/p4_16_psa_errors_outputs/psa-counter6.p4.bfrt.json new file mode 100644 index 0000000000..7c5331edce --- /dev/null +++ b/testdata/p4_16_psa_errors_outputs/psa-counter6.p4.bfrt.json @@ -0,0 +1,120 @@ +{ + "schema_version" : "1.0.0", + "tables" : [ + { + "name" : "ip.MyIC.tbl", + "id" : 39967501, + "table_type" : "MatchAction_Direct", + "size" : 1024, + "annotations" : [], + "depends_on" : [], + "has_const_default_action" : false, + "key" : [ + { + "id" : 1, + "name" : "hdr.ethernet.srcAddr", + "repeated" : false, + "annotations" : [], + "mandatory" : false, + "match_type" : "Exact", + "type" : { + "type" : "bytes", + "width" : 48 + } + } + ], + "action_specs" : [ + { + "id" : 21257015, + "name" : "NoAction", + "action_scope" : "TableAndDefault", + "annotations" : [], + "data" : [] + }, + { + "id" : 22078320, + "name" : "MyIC.execute", + "action_scope" : "TableAndDefault", + "annotations" : [], + "data" : [] + } + ], + "data" : [ + { + "mandatory" : false, + "read_only" : false, + "singleton" : { + "id" : 65554, + "name" : "$COUNTER_SPEC_PKTS", + "repeated" : false, + "annotations" : [], + "type" : { + "type" : "uint64", + "default_value" : 0 + } + } + } + ], + "supported_operations" : ["SyncCounters"], + "attributes" : ["EntryScope"] + }, + { + "name" : "ip.MyIC.tbl2", + "id" : 47318070, + "table_type" : "MatchAction_Direct", + "size" : 1024, + "annotations" : [], + "depends_on" : [], + "has_const_default_action" : false, + "key" : [ + { + "id" : 1, + "name" : "hdr.ethernet.srcAddr", + "repeated" : false, + "annotations" : [], + "mandatory" : false, + "match_type" : "Exact", + "type" : { + "type" : "bytes", + "width" : 48 + } + } + ], + "action_specs" : [ + { + "id" : 21257015, + "name" : "NoAction", + "action_scope" : "TableAndDefault", + "annotations" : [], + "data" : [] + }, + { + "id" : 22078320, + "name" : "MyIC.execute", + "action_scope" : "TableAndDefault", + "annotations" : [], + "data" : [] + } + ], + "data" : [ + { + "mandatory" : false, + "read_only" : false, + "singleton" : { + "id" : 65554, + "name" : "$COUNTER_SPEC_PKTS", + "repeated" : false, + "annotations" : [], + "type" : { + "type" : "uint64", + "default_value" : 0 + } + } + } + ], + "supported_operations" : ["SyncCounters"], + "attributes" : ["EntryScope"] + } + ], + "learn_filters" : [] +} \ No newline at end of file diff --git a/testdata/p4_16_psa_errors_outputs/psa-example-dpdk-directmeter-err.p4-error b/testdata/p4_16_psa_errors_outputs/psa-example-dpdk-directmeter-err.p4-error new file mode 100644 index 0000000000..845acc057e --- /dev/null +++ b/testdata/p4_16_psa_errors_outputs/psa-example-dpdk-directmeter-err.p4-error @@ -0,0 +1,3 @@ +psa.p4(670): [--Werror=unexpected] error: dpdk_execute method of meter0 extern can only be invoked from within action of ownertable + PSA_MeterColor_t dpdk_execute(in bit<32> pkt_len); + ^^^^^^^^^^^^ diff --git a/testdata/p4_16_psa_errors_outputs/psa-example-dpdk-directmeter-err.p4.bfrt.json b/testdata/p4_16_psa_errors_outputs/psa-example-dpdk-directmeter-err.p4.bfrt.json new file mode 100644 index 0000000000..4c131216b0 --- /dev/null +++ b/testdata/p4_16_psa_errors_outputs/psa-example-dpdk-directmeter-err.p4.bfrt.json @@ -0,0 +1,140 @@ +{ + "schema_version" : "1.0.0", + "tables" : [ + { + "name" : "ip.MyIC.tbl", + "id" : 39967501, + "table_type" : "MatchAction_Direct", + "size" : 1024, + "annotations" : [], + "depends_on" : [], + "has_const_default_action" : false, + "key" : [ + { + "id" : 1, + "name" : "hdr.ethernet.srcAddr", + "repeated" : false, + "annotations" : [], + "mandatory" : false, + "match_type" : "Exact", + "type" : { + "type" : "bytes", + "width" : 48 + } + } + ], + "action_specs" : [ + { + "id" : 21257015, + "name" : "NoAction", + "action_scope" : "TableAndDefault", + "annotations" : [], + "data" : [] + } + ], + "data" : [ + { + "mandatory" : false, + "read_only" : false, + "singleton" : { + "id" : 65545, + "name" : "$METER_SPEC_CIR_KBPS", + "repeated" : false, + "annotations" : [], + "type" : { + "type" : "uint64", + "default_value" : 18446744073709551615 + } + } + }, + { + "mandatory" : false, + "read_only" : false, + "singleton" : { + "id" : 65546, + "name" : "$METER_SPEC_PIR_KBPS", + "repeated" : false, + "annotations" : [], + "type" : { + "type" : "uint64", + "default_value" : 18446744073709551615 + } + } + }, + { + "mandatory" : false, + "read_only" : false, + "singleton" : { + "id" : 65547, + "name" : "$METER_SPEC_CBS_KBITS", + "repeated" : false, + "annotations" : [], + "type" : { + "type" : "uint64", + "default_value" : 18446744073709551615 + } + } + }, + { + "mandatory" : false, + "read_only" : false, + "singleton" : { + "id" : 65548, + "name" : "$METER_SPEC_PBS_KBITS", + "repeated" : false, + "annotations" : [], + "type" : { + "type" : "uint64", + "default_value" : 18446744073709551615 + } + } + } + ], + "supported_operations" : [], + "attributes" : ["MeterByteCountAdjust", "EntryScope"] + }, + { + "name" : "ip.MyIC.tbl2", + "id" : 47318070, + "table_type" : "MatchAction_Direct", + "size" : 1024, + "annotations" : [], + "depends_on" : [], + "has_const_default_action" : false, + "key" : [ + { + "id" : 1, + "name" : "hdr.ethernet.srcAddr", + "repeated" : false, + "annotations" : [], + "mandatory" : false, + "match_type" : "Exact", + "type" : { + "type" : "bytes", + "width" : 48 + } + } + ], + "action_specs" : [ + { + "id" : 21257015, + "name" : "NoAction", + "action_scope" : "TableAndDefault", + "annotations" : [], + "data" : [] + }, + { + "id" : 18579058, + "name" : "MyIC.execute_meter", + "action_scope" : "TableAndDefault", + "annotations" : [], + "data" : [] + } + ], + "data" : [], + "supported_operations" : [], + "attributes" : ["EntryScope"] + } + ], + "learn_filters" : [] +} \ No newline at end of file diff --git a/testdata/p4_16_psa_errors_outputs/psa-meter6.p4-error b/testdata/p4_16_psa_errors_outputs/psa-meter6.p4-error new file mode 100644 index 0000000000..5fbfe5d38e --- /dev/null +++ b/testdata/p4_16_psa_errors_outputs/psa-meter6.p4-error @@ -0,0 +1,4 @@ +psa-meter6.p4(51): [--Wwarn=unsupported] warning: MyIC.meter0: Packet metering is not supported. Falling back to byte metering. + DirectMeter(PSA_MeterType_t.PACKETS) meter0; + ^^^^^^ +[--Werror=unexpected] error: execute method not supported for DirectMeter extern diff --git a/testdata/p4_16_psa_errors_outputs/psa-meter6.p4.bfrt.json b/testdata/p4_16_psa_errors_outputs/psa-meter6.p4.bfrt.json new file mode 100644 index 0000000000..8feb572bea --- /dev/null +++ b/testdata/p4_16_psa_errors_outputs/psa-meter6.p4.bfrt.json @@ -0,0 +1,140 @@ +{ + "schema_version" : "1.0.0", + "tables" : [ + { + "name" : "ip.MyIC.tbl", + "id" : 39967501, + "table_type" : "MatchAction_Direct", + "size" : 1024, + "annotations" : [], + "depends_on" : [], + "has_const_default_action" : false, + "key" : [ + { + "id" : 1, + "name" : "hdr.ethernet.srcAddr", + "repeated" : false, + "annotations" : [], + "mandatory" : false, + "match_type" : "Exact", + "type" : { + "type" : "bytes", + "width" : 48 + } + } + ], + "action_specs" : [ + { + "id" : 21257015, + "name" : "NoAction", + "action_scope" : "TableAndDefault", + "annotations" : [], + "data" : [] + } + ], + "data" : [ + { + "mandatory" : false, + "read_only" : false, + "singleton" : { + "id" : 65549, + "name" : "$METER_SPEC_CIR_PPS", + "repeated" : false, + "annotations" : [], + "type" : { + "type" : "uint64", + "default_value" : 18446744073709551615 + } + } + }, + { + "mandatory" : false, + "read_only" : false, + "singleton" : { + "id" : 65550, + "name" : "$METER_SPEC_PIR_PPS", + "repeated" : false, + "annotations" : [], + "type" : { + "type" : "uint64", + "default_value" : 18446744073709551615 + } + } + }, + { + "mandatory" : false, + "read_only" : false, + "singleton" : { + "id" : 65551, + "name" : "$METER_SPEC_CBS_PKTS", + "repeated" : false, + "annotations" : [], + "type" : { + "type" : "uint64", + "default_value" : 18446744073709551615 + } + } + }, + { + "mandatory" : false, + "read_only" : false, + "singleton" : { + "id" : 65552, + "name" : "$METER_SPEC_PBS_PKTS", + "repeated" : false, + "annotations" : [], + "type" : { + "type" : "uint64", + "default_value" : 18446744073709551615 + } + } + } + ], + "supported_operations" : [], + "attributes" : ["MeterByteCountAdjust", "EntryScope"] + }, + { + "name" : "ip.MyIC.tbl2", + "id" : 47318070, + "table_type" : "MatchAction_Direct", + "size" : 1024, + "annotations" : [], + "depends_on" : [], + "has_const_default_action" : false, + "key" : [ + { + "id" : 1, + "name" : "hdr.ethernet.srcAddr", + "repeated" : false, + "annotations" : [], + "mandatory" : false, + "match_type" : "Exact", + "type" : { + "type" : "bytes", + "width" : 48 + } + } + ], + "action_specs" : [ + { + "id" : 21257015, + "name" : "NoAction", + "action_scope" : "TableAndDefault", + "annotations" : [], + "data" : [] + }, + { + "id" : 18579058, + "name" : "MyIC.execute_meter", + "action_scope" : "TableAndDefault", + "annotations" : [], + "data" : [] + } + ], + "data" : [], + "supported_operations" : [], + "attributes" : ["EntryScope"] + } + ], + "learn_filters" : [] +} \ No newline at end of file