diff --git a/BUILD.bazel b/BUILD.bazel index 9a3900bd8a..d107e682e6 100644 --- a/BUILD.bazel +++ b/BUILD.bazel @@ -145,6 +145,7 @@ filegroup( srcs = [ "frontends/p4-14/ir-v1.def", "backends/bmv2/bmv2.def", + "backends/dpdk/dpdk.def", # p4c extensions may set this target to a `filegroup` containing # additional .def files. "@com_github_p4lang_p4c_extension//:ir_extensions", @@ -190,6 +191,9 @@ cc_library( "frontends/parsers/p4/p4lexer.cc", "frontends/parsers/v1/v1lexer.cc", "ir/ir-generated.cpp", + "backends/dpdk/spec.cpp", + "backends/dpdk/dbprint-dpdk.cpp", + "backends/dpdk/printUtils.cpp", ], textual_hdrs = glob([ "ir/**/*.h", @@ -197,6 +201,7 @@ cc_library( "frontends/**/*.hpp", "midend/**/*.h", "control-plane/**/*.h", + "backends/dpdk/*.h", ]) + [ ":p4_parser_yacc", ":v1_parser_yacc", @@ -275,8 +280,71 @@ cc_binary( data = [":p4include"], ) -# This builds the p4test backend. +# dpdk backend +genrule( + name = "dest_dir_dpdk", + srcs = ["backends/dpdk/control-plane/proto/p4info.proto"], + outs = ["p4/config/dpdk/p4info.proto"], + cmd = "mkdir -p p4/config/dpdk; cp $(SRCS) $(OUTS)", + visibility = ["//visibility:private"], +) + +proto_library( + name = "p4info_dpdk_proto", + srcs = ["p4/config/dpdk/p4info.proto"], + deps = [ + "@com_google_protobuf//:any_proto", + "@com_google_protobuf//:descriptor_proto", + ], +) + +cc_proto_library( + name = "p4info_dpdk_cc_proto", + deps = [":p4info_dpdk_proto"], +) + +cc_library( + name = "p4c_dpdk_lib", + srcs = glob( + ["backends/dpdk/*.cpp", "backends/dpdk/control-plane/*.cpp", "backends/bmv2/common/lower.cpp"], + exclude = ["backends/dpdk/main.cpp", "backends/dpdk/spec.cpp", "backends/dpdk/printUtils.cpp", "backends/dpdk/dbprint-dpdk.cpp"], + ), + hdrs = glob(["backends/dpdk/*.h", "backends/dpdk/control-plane/*.h", "backends/bmv2/common/lower.h"]), + deps = [ + ":ir_frontend_midend_control_plane", + ":lib", + ":p4info_dpdk_cc_proto", + ], +) + +genrule( + name = "p4c_dpdk_version", + srcs = ["backends/dpdk/version.h.cmake"], + outs = ["backends/dpdk/version.h"], + cmd = "sed 's|@P4C_VERSION@|0.0.0.0|g' $(SRCS) > $(OUTS)", + visibility = ["//visibility:private"], +) + +cc_binary( + name = "p4c_dpdk", + srcs = [ + "backends/dpdk/main.cpp", + "backends/dpdk/version.h", + ], + linkopts = [ + "-lgmp", + "-lgmpxx", + ], + deps = [ + ":p4c_dpdk_lib", + ":ir_frontend_midend_control_plane", + ":lib", + ], + data = [":p4include"], +) + +# This builds the p4test backend. cc_binary( name = "p4c_backend_p4test", srcs = [ diff --git a/backends/dpdk/backend.cpp b/backends/dpdk/backend.cpp index 8b4d82f77f..eb9b62ea0d 100644 --- a/backends/dpdk/backend.cpp +++ b/backends/dpdk/backend.cpp @@ -127,7 +127,8 @@ void DpdkBackend::convert(const IR::ToplevelBlock *tlb) { new DpdkAsmOptimization, new CollectUsedMetadataField(used_fields), new RemoveUnusedMetadataFields(used_fields), - new ValidateTableKeys() + new ValidateTableKeys(), + new ShortenTokenLength(), }; dpdk_program = dpdk_program->apply(post_code_gen)->to(); @@ -136,5 +137,4 @@ void DpdkBackend::convert(const IR::ToplevelBlock *tlb) { void DpdkBackend::codegen(std::ostream &out) const { dpdk_program->toSpec(out) << std::endl; } - } // namespace DPDK diff --git a/backends/dpdk/dbprint-dpdk.cpp b/backends/dpdk/dbprint-dpdk.cpp index 563441436c..c7c002d4ce 100644 --- a/backends/dpdk/dbprint-dpdk.cpp +++ b/backends/dpdk/dbprint-dpdk.cpp @@ -1,4 +1,4 @@ -#include +#include "ir/ir.h" void IR::DpdkJmpLabelStatement::dbprint(std::ostream& out) const { out << "jmp " << label << std::endl; diff --git a/backends/dpdk/dpdk.def b/backends/dpdk/dpdk.def index 768328ba55..8fbb38b86d 100644 --- a/backends/dpdk/dpdk.def +++ b/backends/dpdk/dpdk.def @@ -50,8 +50,8 @@ class DpdkTable { class DpdkSelector { inline cstring name; - inline cstring group_id; - inline cstring member_id; + Expression group_id; + Expression member_id; Key selectors; int n_groups_max; int n_members_per_group_max; diff --git a/backends/dpdk/dpdkArch.h b/backends/dpdk/dpdkArch.h index 3f4f91ef51..48a61f2cb5 100644 --- a/backends/dpdk/dpdkArch.h +++ b/backends/dpdk/dpdkArch.h @@ -17,7 +17,6 @@ limitations under the License. #ifndef BACKENDS_DPDK_DPDKARCH_H_ #define BACKENDS_DPDK_DPDKARCH_H_ -#include #include "frontends/common/resolveReferences/resolveReferences.h" #include "frontends/p4/evaluator/evaluator.h" #include "frontends/p4/typeMap.h" diff --git a/backends/dpdk/dpdkAsmOpt.cpp b/backends/dpdk/dpdkAsmOpt.cpp index 691e7e3997..e298634017 100644 --- a/backends/dpdk/dpdkAsmOpt.cpp +++ b/backends/dpdk/dpdkAsmOpt.cpp @@ -279,4 +279,6 @@ bool ValidateTableKeys::preorder(const IR::DpdkAsmProgram *p) { } return false; } + +size_t ShortenTokenLength::count = 0; } // namespace DPDK diff --git a/backends/dpdk/dpdkAsmOpt.h b/backends/dpdk/dpdkAsmOpt.h index 7243207d53..c5268217f4 100644 --- a/backends/dpdk/dpdkAsmOpt.h +++ b/backends/dpdk/dpdkAsmOpt.h @@ -173,6 +173,124 @@ class ValidateTableKeys : public Inspector { int getFieldSizeBits(const IR::Type *field_type); }; +// This pass shorten the Identifier length +class ShortenTokenLength : public Transform { + ordered_map newNameMap; + static size_t count; + // Currently Dpdk allows Identifier of 63 char long or less + // including dots(.) for member exp. + // worst case member expression will look like below(for headers) + // 1.30.30 => 63(including dot(.)) + // if id name less than allowedLength keep it same + cstring shortenString(cstring str, size_t allowedLength = 60) { + if (str.size() <= allowedLength) + return str; + auto itr = newNameMap.find(str); + if (itr != newNameMap.end()) + return itr->second; + // make sure new string length less or equal allowedLength + cstring newStr = str.substr(0, allowedLength - std::to_string(count).size()); + newStr += std::to_string(count); + count++; + newNameMap.insert(std::pair(str, newStr)); + origNameMap.insert(std::pair(newStr, str)); + return newStr; + } + + public: + static ordered_map origNameMap; + + const IR::Node* preorder(IR::Member *m) override { + if (m->toString().startsWith("m.")) + m->member = shortenString(m->member); + else + m->member = shortenString(m->member, 30); + return m; + } + + const IR::Node* preorder(IR::DpdkStructType *s) override { + if (s->getAnnotations()->getSingle("__packet_data__")) { + s->name = shortenString(s->name); + IR::IndexedVector changedFields; + for (auto field : s->fields) { + IR::StructField *f = new IR::StructField(field->name, field->type); + f->name = shortenString(f->name, 30); + changedFields.push_back(f); + } + return new IR::DpdkStructType(s->srcInfo, s->name, + s->annotations, changedFields); + } else { + s->name = shortenString(s->name); + IR::IndexedVector changedFields; + for (auto field : s->fields) { + IR::StructField *f = new IR::StructField(field->name, field->type); + f->name = shortenString(f->name); + changedFields.push_back(f); + } + return new IR::DpdkStructType(s->srcInfo, s->name, + s->annotations, changedFields); + } + return s; + } + + const IR::Node* preorder(IR::DpdkHeaderType *h) override { + h->name = shortenString(h->name, 30); + IR::IndexedVector changedFields; + for (auto field : h->fields) { + IR::StructField *f = new IR::StructField(field->name, field->type); + f->name = shortenString(f->name, 30); + changedFields.push_back(f); + } + return new IR::DpdkHeaderType(h->srcInfo, h->name, + h->annotations, changedFields); + } + + const IR::Node* preorder(IR::DpdkExternDeclaration *e) override { + e->name = shortenString(e->name); + return e; + } + + const IR::Node* preorder(IR::Declaration *g) override { + g->name = shortenString(g->name); + return g; + } + + const IR::Node* preorder(IR::Path *p) override { + p->name = shortenString(p->name); + return p; + } + + const IR::Node* preorder(IR::DpdkAction *a) override { + a->name = shortenString(a->name); + return a; + } + + const IR::Node* preorder(IR::DpdkTable *t) override { + t->name = shortenString(t->name); + return t; + } + + const IR::Node* preorder(IR::DpdkLearner *l) override { + l->name = shortenString(l->name); + return l; + } + + const IR::Node* preorder(IR::DpdkSelector *s) override { + s->name = shortenString(s->name); + return s; + } + + const IR::Node* preorder(IR::DpdkLearnStatement *ls) override{ + ls->action = shortenString(ls->action); + return ls; + } + + const IR::Node* preorder(IR::DpdkApplyStatement *as) override{ + as->table = shortenString(as->table); + return as; + } +}; + // Instructions can only appear in actions and apply block of .spec file. // All these individual passes work on the actions and apply block of .spec file. class DpdkAsmOptimization : public PassRepeated { diff --git a/backends/dpdk/dpdkProgram.cpp b/backends/dpdk/dpdkProgram.cpp index a783ec7231..c529f1d2dd 100644 --- a/backends/dpdk/dpdkProgram.cpp +++ b/backends/dpdk/dpdkProgram.cpp @@ -559,7 +559,8 @@ bool ConvertToDpdkControl::checkTableValid(const IR::P4Table *a) { return true; } -boost::optional ConvertToDpdkControl::getIdFromProperty(const IR::P4Table* table, +boost::optional +ConvertToDpdkControl::getMemExprFromProperty(const IR::P4Table* table, cstring propertyName) { auto property = table->properties->getProperty(propertyName); if (property == nullptr) return boost::none; @@ -577,7 +578,7 @@ boost::optional ConvertToDpdkControl::getIdFromProperty(const IR::P4Tab return boost::none; } - return expr->to()->toString(); + return expr->to(); } boost::optional ConvertToDpdkControl::getNumberFromProperty(const IR::P4Table* table, @@ -607,8 +608,8 @@ bool ConvertToDpdkControl::preorder(const IR::P4Table *t) { return false; if (t->properties->getProperty("selector") != nullptr) { - auto group_id = getIdFromProperty(t, "group_id"); - auto member_id = getIdFromProperty(t, "member_id"); + auto group_id = getMemExprFromProperty(t, "group_id"); + auto member_id = getMemExprFromProperty(t, "member_id"); auto selector_key = t->properties->getProperty("selector"); auto n_groups_max = getNumberFromProperty(t, "n_groups_max"); auto n_members_per_group_max = getNumberFromProperty(t, "n_members_per_group_max"); @@ -618,7 +619,7 @@ bool ConvertToDpdkControl::preorder(const IR::P4Table *t) { return false; auto selector = new IR::DpdkSelector(t->name, - *group_id, *member_id, selector_key->value->to(), + (*group_id)->clone(), (*member_id)->clone(), selector_key->value->to(), *n_groups_max, *n_members_per_group_max); selectors.push_back(selector); diff --git a/backends/dpdk/dpdkProgram.h b/backends/dpdk/dpdkProgram.h index 40e57eeee4..6e9e6a4354 100644 --- a/backends/dpdk/dpdkProgram.h +++ b/backends/dpdk/dpdkProgram.h @@ -132,7 +132,7 @@ class ConvertToDpdkControl : public Inspector { void add_table(const IR::DpdkLearner*s) { learners.push_back(s); } void add_action(const IR::DpdkAction *a) { actions.push_back(a); } - boost::optional getIdFromProperty(const IR::P4Table*, cstring); + boost::optional getMemExprFromProperty(const IR::P4Table*, cstring); boost::optional getNumberFromProperty(const IR::P4Table*, cstring); }; diff --git a/backends/dpdk/run-dpdk-test.py b/backends/dpdk/run-dpdk-test.py index b6a315207b..f76aaf1264 100755 --- a/backends/dpdk/run-dpdk-test.py +++ b/backends/dpdk/run-dpdk-test.py @@ -15,7 +15,8 @@ # Runs the compiler on a sample P4 V1.2 program - +from os import environ +from threading import Timer from subprocess import Popen,PIPE from threading import Thread import errno @@ -160,6 +161,54 @@ def check_generated_files(options, tmpdir, expecteddir): return SUCCESS if result != SUCCESS and not ignoreStderr(options): return result + if produced.endswith(".spec") and environ.get('DPDK_PIPELINE') is not None: + clifile = os.path.splitext(produced)[0] + ".cli" + with open(clifile,'w',encoding = 'utf-8') as f: + f.write("; SPDX-License-Identifier: BSD-3-Clause\n") + f.write("; Copyright(c) 2020 Intel Corporation\n") + f.write("\n") + f.write("mempool MEMPOOL0 buffer 9304 pool 32K cache 256 cpu 0\n") + f.write("\n") + f.write("link LINK0 dev 0000:00:04.0 rxq 1 128 MEMPOOL0 txq 1 512 promiscuous on\n") + f.write("link LINK1 dev 0000:00:05.0 rxq 1 128 MEMPOOL0 txq 1 512 promiscuous on\n") + f.write("link LINK2 dev 0000:00:06.0 rxq 1 128 MEMPOOL0 txq 1 512 promiscuous on\n") + f.write("link LINK3 dev 0000:00:07.0 rxq 1 128 MEMPOOL0 txq 1 512 promiscuous on\n") + f.write("\n") + f.write("pipeline PIPELINE0 create 0\n") + f.write("\n") + f.write("pipeline PIPELINE0 port in 0 link LINK0 rxq 0 bsz 32\n") + f.write("pipeline PIPELINE0 port in 1 link LINK1 rxq 0 bsz 32\n") + f.write("pipeline PIPELINE0 port in 2 link LINK2 rxq 0 bsz 32\n") + f.write("pipeline PIPELINE0 port in 3 link LINK3 rxq 0 bsz 32\n") + f.write("\n") + f.write("pipeline PIPELINE0 port out 0 link LINK0 txq 0 bsz 32\n") + f.write("pipeline PIPELINE0 port out 1 link LINK1 txq 0 bsz 32\n") + f.write("pipeline PIPELINE0 port out 2 link LINK2 txq 0 bsz 32\n") + f.write("pipeline PIPELINE0 port out 3 link LINK3 txq 0 bsz 32\n") + f.write("\n") + f.write("pipeline PIPELINE0 build ") + f.write(str(expected)) + f.write("\n") + f.write("pipeline PIPELINE0 commit\n") + f.write("thread 1 pipeline PIPELINE0 enable\n") + f.write("pipeline PIPELINE0 abort\n") + f.close() + dpdk_log = os.path.splitext(produced)[0] + ".log" + def kill(process): + process.kill() + print("exec " + environ.get('DPDK_PIPELINE')+ " -n 4 -c 0x3 -- -s " + str(clifile)+ " 1>" + dpdk_log) + pipe = subprocess.Popen("exec " + environ.get('DPDK_PIPELINE')+ " -n 4 -c 0x3 -- -s " + str(clifile)+ " 1>" + dpdk_log ,cwd=".", shell=True) + timer = Timer(5, kill, [pipe]) + try: + timer.start() + out, err = pipe.communicate() + finally: + timer.cancel() + with open(dpdk_log, "r") as f: + readfile = f.read() + if 'Error' in readfile: + print(readfile) + return FAILURE return SUCCESS def file_name(tmpfolder, base, suffix, ext): diff --git a/backends/dpdk/spec.cpp b/backends/dpdk/spec.cpp index 0be38c6692..1c715ad702 100644 --- a/backends/dpdk/spec.cpp +++ b/backends/dpdk/spec.cpp @@ -1,37 +1,55 @@ #include "dpdkHelpers.h" #include "ir/dbprint.h" #include "printUtils.h" - +#include "dpdkAsmOpt.h" using namespace DBPrint; static constexpr unsigned DEFAULT_LEARNER_TABLE_SIZE = 0x10000; static constexpr unsigned DEFAULT_LEARNER_TABLE_TIMEOUT = 120; +ordered_map DPDK::ShortenTokenLength::origNameMap = {}; +auto& origNameMap = DPDK::ShortenTokenLength::origNameMap; void add_space(std::ostream &out, int size) { out << std::setfill(' ') << std::setw(size) << " "; } +void add_comment(std::ostream& out, cstring str, cstring sep = "") { + if (origNameMap.count(str)) { + out<toSpec(out) << std::endl; } out << std::endl; - for (auto h : headerType) + for (auto h : headerType) { + add_comment(out, h->name.toString()); h->toSpec(out) << std::endl; - for (auto s : structType) + } + for (auto s : structType) { + add_comment(out, s->name.toString()); s->toSpec(out) << std::endl; - for (auto s : externDeclarations) + } + for (auto s : externDeclarations) { + add_comment(out, s->name.toString()); s->toSpec(out) << std::endl; + } for (auto a : actions) { + add_comment(out, a->name.toString()); a->toSpec(out) << std::endl << std::endl; } for (auto t : tables) { + add_comment(out, t->name); t->toSpec(out) << std::endl << std::endl; } for (auto s : selectors) { + add_comment(out, s->name); s->toSpec(out) << std::endl; } for (auto s : learners) { + add_comment(out, s->name); s->toSpec(out) << std::endl; } for (auto s : statements) { @@ -104,6 +122,7 @@ std::ostream &IR::DpdkExternDeclaration::toSpec(std::ostream &out) const { std::ostream &IR::DpdkHeaderType::toSpec(std::ostream &out) const { out << "struct " << name << " {" << std::endl; for (auto it = fields.begin(); it != fields.end(); ++it) { + add_comment(out, (*it)->name.toString(), "\t"); if (auto t = (*it)->type->to()) out << "\tbit<" << t->width_bits() << ">"; else if (auto t = (*it)->type->to()) @@ -125,6 +144,7 @@ std::ostream &IR::DpdkHeaderType::toSpec(std::ostream &out) const { std::ostream &IR::DpdkStructType::toSpec(std::ostream &out) const { if (getAnnotations()->getSingle("__packet_data__")) { for (auto it = fields.begin(); it != fields.end(); ++it) { + add_comment(out, (*it)->name.toString()); if (auto t = (*it)->type->to()) { out << "header " << (*it)->name << " instanceof " << t->path->name; @@ -147,6 +167,7 @@ std::ostream &IR::DpdkStructType::toSpec(std::ostream &out) const { } else { out << "struct " << name << " {" << std::endl; for (auto it = fields.begin(); it != fields.end(); ++it) { + add_comment(out, (*it)->name.toString(), "\t"); if (auto t = (*it)->type->to()) out << "\tbit<" << t->width_bits() << ">"; else if (auto t = (*it)->type->to()) { @@ -341,7 +362,7 @@ std::ostream &IR::DpdkTable::toSpec(std::ostream &out) const { std::ostream &IR::DpdkSelector::toSpec(std::ostream &out) const { out << "selector " << name << " {" << std::endl; - out << "\tgroup_id " << group_id << std::endl; + out << "\tgroup_id " << DPDK::toStr(group_id) << std::endl; if (selectors) { out << "\tselector {" << std::endl; for (auto key : selectors->keyElements) { @@ -349,7 +370,7 @@ std::ostream &IR::DpdkSelector::toSpec(std::ostream &out) const { } out << "\t}" << std::endl; } - out << "\tmember_id " << member_id << std::endl; + out << "\tmember_id " << DPDK::toStr(member_id) << std::endl; out << "\tn_groups_max " << n_groups_max << std::endl; out << "\tn_members_per_group_max " << n_members_per_group_max << std::endl; out << "}" << std::endl; @@ -471,6 +492,7 @@ std::ostream &IR::DpdkVerifyStatement::toSpec(std::ostream &out) const { } std::ostream &IR::DpdkMeterDeclStatement::toSpec(std::ostream &out) const { + add_comment(out, meter); out << "metarray " << meter << " size " << DPDK::toStr(size); return out; } @@ -485,6 +507,7 @@ std::ostream &IR::DpdkMeterExecuteStatement::toSpec(std::ostream &out) const { is used for incrementing the counter. Packet counters are incremented by packet length specified as parameter and byte counters are incremente by 1 */ std::ostream &IR::DpdkCounterCountStatement::toSpec(std::ostream &out) const { + add_comment(out, counter); out << "regadd " << counter << " " << DPDK::toStr(index) << " "; if (incr) out << DPDK::toStr(incr); @@ -494,6 +517,7 @@ std::ostream &IR::DpdkCounterCountStatement::toSpec(std::ostream &out) const { } std::ostream &IR::DpdkRegisterDeclStatement::toSpec(std::ostream &out) const { + add_comment(out, reg); out << "regarray " << reg << " size " << DPDK::toStr(size) << " initval "; if (init_val) out << DPDK::toStr(init_val); diff --git a/testdata/p4_16_samples/psa-dpdk-token-too-big.p4 b/testdata/p4_16_samples/psa-dpdk-token-too-big.p4 new file mode 100644 index 0000000000..c3a3133374 --- /dev/null +++ b/testdata/p4_16_samples/psa-dpdk-token-too-big.p4 @@ -0,0 +1,177 @@ +#include +#include + +struct empty_metadata_t { +} + +typedef bit<48> ethernet_addr_t; + +header ethernet_t { + ethernet_addr_t dst_addr; + ethernet_addr_t src_addr; + bit<16> ether_type; +} + +header ipv4_t { + bit<8> ver_ihl_ddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd_k; + bit<8> diffserv_dpdk_dpdk_dpdk_dpdk_dpdk; + bit<16> total_len; + bit<16> identification; + bit<16> flags_offset; + bit<8> ttl; + bit<8> protocol; + bit<16> hdr_checksum; + bit<32> src_addr; + bit<32> dst_addr; +} + +header udp_t { + bit<16> src_port; + bit<16> dst_port; + bit<16> length; + bit<16> checksum; +} + +header vxlan_t { + bit<8> flags; + bit<24> reserved; + bit<24> vni; + bit<8> reserved2; +} + +struct headers_t { + ethernet_t ethernet; + ipv4_t ipv4; + vxlan_t vxlan; + ethernet_t outer_ethernet; + ipv4_t outer_ipv4_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk; + udp_t outer_udp; + vxlan_t outer_vxlan; +} + +struct local_metadata__dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_t { + ethernet_addr_t dst_addr; + ethernet_addr_t src_addr; +} + +parser packet_parser(packet_in packet, out headers_t headers, inout local_metadata__dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_t local_metadata, in psa_ingress_parser_input_metadata_t standard_metadata, in empty_metadata_t resub_meta, in empty_metadata_t recirc_meta) { + state start { + transition parse_ethernet; + } + state parse_ethernet { + packet.extract(headers.ethernet); + transition parser_ipv4; + } + state parser_ipv4 { + packet.extract(headers.ipv4); + transition accept; + } +} + +control packet_deparser(packet_out packet, out empty_metadata_t clone_i2e_meta, out empty_metadata_t resubmit_meta, out empty_metadata_t normal_meta, inout headers_t headers, in local_metadata__dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_t local_metadata, in psa_ingress_output_metadata_t istd) { + apply { + packet.emit(headers.outer_ethernet); + packet.emit(headers.outer_ipv4_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk); + packet.emit(headers.outer_udp); + packet.emit(headers.outer_vxlan); + packet.emit(headers.ethernet); + packet.emit(headers.ipv4); + } +} + +control ingress(inout headers_t headers, inout local_metadata__dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_t local_metadata1, in psa_ingress_input_metadata_t standard_metadata, inout psa_ingress_output_metadata_t ostd) { + InternetChecksum() csum; + action vxlan_encap_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk( + bit<48> ethernet_dst_addr, + bit<48> ethernet_src_addr, + bit<16> ethernet_ether_type, + bit<8> ipv4_ver_ihl, + bit<8> ipv4_diffserv, + bit<16> ipv4_total_len, + bit<16> ipv4_identification, + bit<16> ipv4_flags_offset, + bit<8> ipv4_ttl, + bit<8> ipv4_protocol, + bit<16> ipv4_hdr_checksum, + bit<32> ipv4_src_addr, + bit<32> ipv4_dst_addr, + bit<16> udp_src_port, + bit<16> udp_dst_port, + bit<16> udp_length, + bit<16> udp_checksum, + bit<8> vxlan_flags, + bit<24> vxlan_reserved, + bit<24> vxlan_vni, + bit<8> vxlan_reserved2, + bit<32> port_out + ) { + headers.outer_ethernet.src_addr = ethernet_src_addr; + headers.outer_ethernet.dst_addr = ethernet_dst_addr; + + headers.outer_ethernet.ether_type = ethernet_ether_type; + headers.outer_ipv4_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk.ver_ihl_ddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd_k = ipv4_ver_ihl; + headers.outer_ipv4_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk.diffserv_dpdk_dpdk_dpdk_dpdk_dpdk = ipv4_diffserv; + headers.outer_ipv4_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk.total_len = ipv4_total_len; + headers.outer_ipv4_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk.identification = ipv4_identification; + headers.outer_ipv4_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk.flags_offset = ipv4_flags_offset; + headers.outer_ipv4_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk.ttl = ipv4_ttl; + headers.outer_ipv4_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk.protocol = ipv4_protocol; + headers.outer_ipv4_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk.hdr_checksum = ipv4_hdr_checksum; + headers.outer_ipv4_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk.src_addr = ipv4_src_addr; + headers.outer_ipv4_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk.dst_addr = ipv4_dst_addr; + headers.outer_udp.src_port = udp_src_port; + headers.outer_udp.dst_port = udp_dst_port; + headers.outer_udp.length = udp_length; + headers.outer_udp.checksum = udp_checksum; + headers.vxlan.flags = vxlan_flags; + headers.vxlan.reserved = vxlan_reserved; + headers.vxlan.vni = vxlan_vni; + headers.vxlan.reserved2 = vxlan_reserved2; + ostd.egress_port = (PortId_t)port_out; + csum.add({headers.outer_ipv4_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk.hdr_checksum, headers.ipv4.total_len}); + headers.outer_ipv4_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk.hdr_checksum = csum.get(); + headers.outer_ipv4_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk.total_len = headers.outer_ipv4_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk.total_len + headers.ipv4.total_len; + headers.outer_udp.length = headers.outer_udp.length + headers.ipv4.total_len; + } + action drop(){ + ostd.egress_port = (PortId_t)4; + } + table vxlan_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk { + key = { + headers.ethernet.dst_addr: exact; + } + actions = { + vxlan_encap_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk; + drop; + } + const default_action = drop; + size = 1024 * 1024; + } + + apply { + vxlan_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk.apply(); + } +} + + +control egress(inout headers_t headers, inout local_metadata__dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_t local_metadata, in psa_egress_input_metadata_t istd, inout psa_egress_output_metadata_t ostd) { + apply { + } +} + +parser egress_parser(packet_in buffer, out headers_t headers, inout local_metadata__dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_t local_metadata, in psa_egress_parser_input_metadata_t istd, in empty_metadata_t normal_meta, in empty_metadata_t clone_i2e_meta, in empty_metadata_t clone_e2e_meta) { + state start { + transition accept; + } +} + +control egress_deparser(packet_out packet, out empty_metadata_t clone_e2e_meta, out empty_metadata_t recirculate_meta, inout headers_t headers, in local_metadata__dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_t local_metadata, in psa_egress_output_metadata_t istd, in psa_egress_deparser_input_metadata_t edstd) { + apply { + } +} + +IngressPipeline(packet_parser(), ingress(), packet_deparser()) ip; + +EgressPipeline(egress_parser(), egress(), egress_deparser()) ep; + +PSA_Switch(ip, PacketReplicationEngine(), ep, BufferingQueueingEngine()) main; diff --git a/testdata/p4_16_samples_outputs/pna-example-dpdk-varbit.p4.spec b/testdata/p4_16_samples_outputs/pna-example-dpdk-varbit.p4.spec index 4db347dd99..8c5a9ca5ad 100644 --- a/testdata/p4_16_samples_outputs/pna-example-dpdk-varbit.p4.spec +++ b/testdata/p4_16_samples_outputs/pna-example-dpdk-varbit.p4.spec @@ -56,7 +56,8 @@ header ethernet instanceof ethernet_t header ipv4_base instanceof ipv4_base_t header ipv4_option_timestamp instanceof ipv4_option_timestamp_t header MainParserT_parser_tmp_hdr instanceof option_t -header MainParserT_parser_lookahead_tmp instanceof lookahead_tmp_hdr +;oldname:MainParserT_parser_lookahead_tmp +header MainParserT_parser_lookahead_0 instanceof lookahead_tmp_hdr action NoAction args none { return @@ -105,8 +106,8 @@ apply { jmp MAINPARSERIMPL_ACCEPT MAINPARSERIMPL_PARSE_IPV4 : extract h.ipv4_base jmpeq MAINPARSERIMPL_ACCEPT h.ipv4_base.version_ihl 0x45 - lookahead h.MainParserT_parser_lookahead_tmp - mov m.MainParserT_parser_tmp_2 h.MainParserT_parser_lookahead_tmp.f + lookahead h.MainParserT_parser_lookahead_0 + mov m.MainParserT_parser_tmp_2 h.MainParserT_parser_lookahead_0.f jmpeq MAINPARSERIMPL_PARSE_IPV4_OPTION_TIMESTAMP m.MainParserT_parser_tmp_2 0x44 jmp MAINPARSERIMPL_ACCEPT MAINPARSERIMPL_PARSE_IPV4_OPTION_TIMESTAMP : lookahead h.MainParserT_parser_tmp_hdr diff --git a/testdata/p4_16_samples_outputs/pna-example-tunnel.p4.spec b/testdata/p4_16_samples_outputs/pna-example-tunnel.p4.spec index 3eb1cf275f..61de18c83c 100644 --- a/testdata/p4_16_samples_outputs/pna-example-tunnel.p4.spec +++ b/testdata/p4_16_samples_outputs/pna-example-tunnel.p4.spec @@ -10,7 +10,8 @@ struct ipv4_t { bit<8> dscp_ecn bit<16> total_len bit<16> identification - bit<16> reserved_do_not_fragment_more_fragments_frag_offset + ;oldname:reserved_do_not_fragment_more_fragments_frag_offset + bit<16> reserved_do_not_fragment_more0 bit<8> ttl bit<8> protocol bit<16> header_checksum @@ -38,8 +39,10 @@ struct local_metadata_t { bit<24> local_metadata__tunnel_id1 bit<32> local_metadata__tunnel_tun_type3 bit<32> pna_main_output_metadata_output_port - bit<32> main_control_tunnel_decap_ipv4_tunnel_term_table_outer_ipv4_src_addr - bit<32> main_control_tunnel_decap_ipv4_tunnel_term_table_outer_ipv4_dst_addr + ;oldname:main_control_tunnel_decap_ipv4_tunnel_term_table_outer_ipv4_src_addr + bit<32> main_control_tunnel_decap_ipv4_tunnel_term_table_outer_ipv41 + ;oldname:main_control_tunnel_decap_ipv4_tunnel_term_table_outer_ipv4_dst_addr + bit<32> main_control_tunnel_decap_ipv4_tunnel_term_table_outer_ipv42 } metadata instanceof local_metadata_t @@ -59,8 +62,8 @@ action tunnel_encap_set_tunnel_0 args instanceof tunnel_encap_set_tunnel_0_arg_t table tunnel_decap_ipv4_tunnel_term_table { key { - m.main_control_tunnel_decap_ipv4_tunnel_term_table_outer_ipv4_src_addr exact - m.main_control_tunnel_decap_ipv4_tunnel_term_table_outer_ipv4_dst_addr exact + m.main_control_tunnel_decap_ipv4_tunnel_term_table_outer_ipv41 exact + m.main_control_tunnel_decap_ipv4_tunnel_term_table_outer_ipv42 exact m.local_metadata__tunnel_tun_type3 exact } actions { @@ -92,8 +95,8 @@ apply { jmp PACKET_PARSER_ACCEPT PACKET_PARSER_PARSE_IPV4_OTR : extract h.outer_ipv4 PACKET_PARSER_ACCEPT : jmpneq LABEL_FALSE m.pna_main_input_metadata_direction 0x0 - mov m.main_control_tunnel_decap_ipv4_tunnel_term_table_outer_ipv4_src_addr h.outer_ipv4.src_addr - mov m.main_control_tunnel_decap_ipv4_tunnel_term_table_outer_ipv4_dst_addr h.outer_ipv4.dst_addr + mov m.main_control_tunnel_decap_ipv4_tunnel_term_table_outer_ipv41 h.outer_ipv4.src_addr + mov m.main_control_tunnel_decap_ipv4_tunnel_term_table_outer_ipv42 h.outer_ipv4.dst_addr table tunnel_decap_ipv4_tunnel_term_table jmp LABEL_END LABEL_FALSE : table tunnel_encap_set_tunnel_encap diff --git a/testdata/p4_16_samples_outputs/pna-lookahead-structure-bit-field.p4.spec b/testdata/p4_16_samples_outputs/pna-lookahead-structure-bit-field.p4.spec index 58cb53812f..3e4924110e 100644 --- a/testdata/p4_16_samples_outputs/pna-lookahead-structure-bit-field.p4.spec +++ b/testdata/p4_16_samples_outputs/pna-lookahead-structure-bit-field.p4.spec @@ -22,12 +22,13 @@ metadata instanceof main_metadata_t header h1 instanceof header1_t header h2 instanceof header2_t -header MainParserT_parser_lookahead_tmp instanceof lookahead_tmp_hdr +;oldname:MainParserT_parser_lookahead_tmp +header MainParserT_parser_lookahead_0 instanceof lookahead_tmp_hdr apply { rx m.pna_main_input_metadata_input_port - lookahead h.MainParserT_parser_lookahead_tmp - mov m.local_metadata_f1 h.MainParserT_parser_lookahead_tmp.f + lookahead h.MainParserT_parser_lookahead_0 + mov m.local_metadata_f1 h.MainParserT_parser_lookahead_0.f jmpeq MAINPARSERIMPL_PARSE_H1 m.local_metadata_f1 0x1 jmpeq MAINPARSERIMPL_PARSE_H2 m.local_metadata_f1 0x2 jmp MAINPARSERIMPL_ACCEPT diff --git a/testdata/p4_16_samples_outputs/pna-lookahead-structure.p4.spec b/testdata/p4_16_samples_outputs/pna-lookahead-structure.p4.spec index eb631860db..31f08717e1 100644 --- a/testdata/p4_16_samples_outputs/pna-lookahead-structure.p4.spec +++ b/testdata/p4_16_samples_outputs/pna-lookahead-structure.p4.spec @@ -29,21 +29,23 @@ metadata instanceof main_metadata_t header h1 instanceof my_header_t header h2 instanceof my_header_t -header MainParserT_parser_lookahead_tmp instanceof lookahead_tmp_hdr -header MainParserT_parser_lookahead_tmp_0 instanceof lookahead_tmp_hdr_0 +;oldname:MainParserT_parser_lookahead_tmp +header MainParserT_parser_lookahead_0 instanceof lookahead_tmp_hdr +;oldname:MainParserT_parser_lookahead_tmp_0 +header MainParserT_parser_lookahead_1 instanceof lookahead_tmp_hdr_0 apply { rx m.pna_main_input_metadata_input_port - lookahead h.MainParserT_parser_lookahead_tmp_0 - mov m.MainParserT_parser_tmp_3 h.MainParserT_parser_lookahead_tmp_0.f + lookahead h.MainParserT_parser_lookahead_1 + mov m.MainParserT_parser_tmp_3 h.MainParserT_parser_lookahead_1.f mov m.MainParserT_parser_tmp_0 m.MainParserT_parser_tmp_3 shr m.MainParserT_parser_tmp_0 0x8 mov m.MainParserT_parser_tmp_2 m.MainParserT_parser_tmp_0 jmpeq MAINPARSERIMPL_PARSE_H1 m.MainParserT_parser_tmp_2 0x1234 jmp MAINPARSERIMPL_ACCEPT MAINPARSERIMPL_PARSE_H1 : extract h.h1 - lookahead h.MainParserT_parser_lookahead_tmp - mov m.MainParserT_parser_tmp_4 h.MainParserT_parser_lookahead_tmp.f + lookahead h.MainParserT_parser_lookahead_0 + mov m.MainParserT_parser_tmp_4 h.MainParserT_parser_lookahead_0.f mov m.MainParserT_parser_tmp m.MainParserT_parser_tmp_4 shr m.MainParserT_parser_tmp 0x8 mov m.local_metadata__s1_type10 m.MainParserT_parser_tmp diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-token-too-big-first.p4 b/testdata/p4_16_samples_outputs/psa-dpdk-token-too-big-first.p4 new file mode 100644 index 0000000000..a3ee2d469c --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-token-too-big-first.p4 @@ -0,0 +1,151 @@ +#include +#include + +struct empty_metadata_t { +} + +typedef bit<48> ethernet_addr_t; +header ethernet_t { + ethernet_addr_t dst_addr; + ethernet_addr_t src_addr; + bit<16> ether_type; +} + +header ipv4_t { + bit<8> ver_ihl_ddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd_k; + bit<8> diffserv_dpdk_dpdk_dpdk_dpdk_dpdk; + bit<16> total_len; + bit<16> identification; + bit<16> flags_offset; + bit<8> ttl; + bit<8> protocol; + bit<16> hdr_checksum; + bit<32> src_addr; + bit<32> dst_addr; +} + +header udp_t { + bit<16> src_port; + bit<16> dst_port; + bit<16> length; + bit<16> checksum; +} + +header vxlan_t { + bit<8> flags; + bit<24> reserved; + bit<24> vni; + bit<8> reserved2; +} + +struct headers_t { + ethernet_t ethernet; + ipv4_t ipv4; + vxlan_t vxlan; + ethernet_t outer_ethernet; + ipv4_t outer_ipv4_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk; + udp_t outer_udp; + vxlan_t outer_vxlan; +} + +struct local_metadata__dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_t { + ethernet_addr_t dst_addr; + ethernet_addr_t src_addr; +} + +parser packet_parser(packet_in packet, out headers_t headers, inout local_metadata__dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_t local_metadata, in psa_ingress_parser_input_metadata_t standard_metadata, in empty_metadata_t resub_meta, in empty_metadata_t recirc_meta) { + state start { + transition parse_ethernet; + } + state parse_ethernet { + packet.extract(headers.ethernet); + transition parser_ipv4; + } + state parser_ipv4 { + packet.extract(headers.ipv4); + transition accept; + } +} + +control packet_deparser(packet_out packet, out empty_metadata_t clone_i2e_meta, out empty_metadata_t resubmit_meta, out empty_metadata_t normal_meta, inout headers_t headers, in local_metadata__dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_t local_metadata, in psa_ingress_output_metadata_t istd) { + apply { + packet.emit(headers.outer_ethernet); + packet.emit(headers.outer_ipv4_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk); + packet.emit(headers.outer_udp); + packet.emit(headers.outer_vxlan); + packet.emit(headers.ethernet); + packet.emit(headers.ipv4); + } +} + +control ingress(inout headers_t headers, inout local_metadata__dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_t local_metadata1, in psa_ingress_input_metadata_t standard_metadata, inout psa_ingress_output_metadata_t ostd) { + InternetChecksum() csum; + action vxlan_encap_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk(bit<48> ethernet_dst_addr, bit<48> ethernet_src_addr, bit<16> ethernet_ether_type, bit<8> ipv4_ver_ihl, bit<8> ipv4_diffserv, bit<16> ipv4_total_len, bit<16> ipv4_identification, bit<16> ipv4_flags_offset, bit<8> ipv4_ttl, bit<8> ipv4_protocol, bit<16> ipv4_hdr_checksum, bit<32> ipv4_src_addr, bit<32> ipv4_dst_addr, bit<16> udp_src_port, bit<16> udp_dst_port, bit<16> udp_length, bit<16> udp_checksum, bit<8> vxlan_flags, bit<24> vxlan_reserved, bit<24> vxlan_vni, bit<8> vxlan_reserved2, bit<32> port_out) { + headers.outer_ethernet.src_addr = ethernet_src_addr; + headers.outer_ethernet.dst_addr = ethernet_dst_addr; + headers.outer_ethernet.ether_type = ethernet_ether_type; + headers.outer_ipv4_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk.ver_ihl_ddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd_k = ipv4_ver_ihl; + headers.outer_ipv4_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk.diffserv_dpdk_dpdk_dpdk_dpdk_dpdk = ipv4_diffserv; + headers.outer_ipv4_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk.total_len = ipv4_total_len; + headers.outer_ipv4_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk.identification = ipv4_identification; + headers.outer_ipv4_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk.flags_offset = ipv4_flags_offset; + headers.outer_ipv4_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk.ttl = ipv4_ttl; + headers.outer_ipv4_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk.protocol = ipv4_protocol; + headers.outer_ipv4_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk.hdr_checksum = ipv4_hdr_checksum; + headers.outer_ipv4_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk.src_addr = ipv4_src_addr; + headers.outer_ipv4_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk.dst_addr = ipv4_dst_addr; + headers.outer_udp.src_port = udp_src_port; + headers.outer_udp.dst_port = udp_dst_port; + headers.outer_udp.length = udp_length; + headers.outer_udp.checksum = udp_checksum; + headers.vxlan.flags = vxlan_flags; + headers.vxlan.reserved = vxlan_reserved; + headers.vxlan.vni = vxlan_vni; + headers.vxlan.reserved2 = vxlan_reserved2; + ostd.egress_port = (PortId_t)port_out; + csum.add, bit<16>>>({ headers.outer_ipv4_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk.hdr_checksum, headers.ipv4.total_len }); + headers.outer_ipv4_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk.hdr_checksum = csum.get(); + headers.outer_ipv4_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk.total_len = headers.outer_ipv4_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk.total_len + headers.ipv4.total_len; + headers.outer_udp.length = headers.outer_udp.length + headers.ipv4.total_len; + } + action drop() { + ostd.egress_port = (PortId_t)32w4; + } + table vxlan_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk { + key = { + headers.ethernet.dst_addr: exact @name("headers.ethernet.dst_addr") ; + } + actions = { + vxlan_encap_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk(); + drop(); + } + const default_action = drop(); + size = 1048576; + } + apply { + vxlan_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk.apply(); + } +} + +control egress(inout headers_t headers, inout local_metadata__dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_t local_metadata, in psa_egress_input_metadata_t istd, inout psa_egress_output_metadata_t ostd) { + apply { + } +} + +parser egress_parser(packet_in buffer, out headers_t headers, inout local_metadata__dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_t local_metadata, in psa_egress_parser_input_metadata_t istd, in empty_metadata_t normal_meta, in empty_metadata_t clone_i2e_meta, in empty_metadata_t clone_e2e_meta) { + state start { + transition accept; + } +} + +control egress_deparser(packet_out packet, out empty_metadata_t clone_e2e_meta, out empty_metadata_t recirculate_meta, inout headers_t headers, in local_metadata__dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_t local_metadata, in psa_egress_output_metadata_t istd, in psa_egress_deparser_input_metadata_t edstd) { + apply { + } +} + +IngressPipeline(packet_parser(), ingress(), packet_deparser()) ip; + +EgressPipeline(egress_parser(), egress(), egress_deparser()) ep; + +PSA_Switch(ip, PacketReplicationEngine(), ep, BufferingQueueingEngine()) main; + diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-token-too-big-frontend.p4 b/testdata/p4_16_samples_outputs/psa-dpdk-token-too-big-frontend.p4 new file mode 100644 index 0000000000..fbd06a3829 --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-token-too-big-frontend.p4 @@ -0,0 +1,145 @@ +#include +#include + +struct empty_metadata_t { +} + +typedef bit<48> ethernet_addr_t; +header ethernet_t { + ethernet_addr_t dst_addr; + ethernet_addr_t src_addr; + bit<16> ether_type; +} + +header ipv4_t { + bit<8> ver_ihl_ddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd_k; + bit<8> diffserv_dpdk_dpdk_dpdk_dpdk_dpdk; + bit<16> total_len; + bit<16> identification; + bit<16> flags_offset; + bit<8> ttl; + bit<8> protocol; + bit<16> hdr_checksum; + bit<32> src_addr; + bit<32> dst_addr; +} + +header udp_t { + bit<16> src_port; + bit<16> dst_port; + bit<16> length; + bit<16> checksum; +} + +header vxlan_t { + bit<8> flags; + bit<24> reserved; + bit<24> vni; + bit<8> reserved2; +} + +struct headers_t { + ethernet_t ethernet; + ipv4_t ipv4; + vxlan_t vxlan; + ethernet_t outer_ethernet; + ipv4_t outer_ipv4_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk; + udp_t outer_udp; + vxlan_t outer_vxlan; +} + +struct local_metadata__dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_t { + ethernet_addr_t dst_addr; + ethernet_addr_t src_addr; +} + +parser packet_parser(packet_in packet, out headers_t headers, inout local_metadata__dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_t local_metadata, in psa_ingress_parser_input_metadata_t standard_metadata, in empty_metadata_t resub_meta, in empty_metadata_t recirc_meta) { + state start { + packet.extract(headers.ethernet); + packet.extract(headers.ipv4); + transition accept; + } +} + +control packet_deparser(packet_out packet, out empty_metadata_t clone_i2e_meta, out empty_metadata_t resubmit_meta, out empty_metadata_t normal_meta, inout headers_t headers, in local_metadata__dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_t local_metadata, in psa_ingress_output_metadata_t istd) { + apply { + packet.emit(headers.outer_ethernet); + packet.emit(headers.outer_ipv4_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk); + packet.emit(headers.outer_udp); + packet.emit(headers.outer_vxlan); + packet.emit(headers.ethernet); + packet.emit(headers.ipv4); + } +} + +control ingress(inout headers_t headers, inout local_metadata__dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_t local_metadata1, in psa_ingress_input_metadata_t standard_metadata, inout psa_ingress_output_metadata_t ostd) { + @name("ingress.csum") InternetChecksum() csum_0; + @name("ingress.vxlan_encap_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk") action vxlan_encap_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk(@name("ethernet_dst_addr") bit<48> ethernet_dst_addr, @name("ethernet_src_addr") bit<48> ethernet_src_addr, @name("ethernet_ether_type") bit<16> ethernet_ether_type, @name("ipv4_ver_ihl") bit<8> ipv4_ver_ihl, @name("ipv4_diffserv") bit<8> ipv4_diffserv, @name("ipv4_total_len") bit<16> ipv4_total_len, @name("ipv4_identification") bit<16> ipv4_identification, @name("ipv4_flags_offset") bit<16> ipv4_flags_offset, @name("ipv4_ttl") bit<8> ipv4_ttl, @name("ipv4_protocol") bit<8> ipv4_protocol, @name("ipv4_hdr_checksum") bit<16> ipv4_hdr_checksum, @name("ipv4_src_addr") bit<32> ipv4_src_addr, @name("ipv4_dst_addr") bit<32> ipv4_dst_addr, @name("udp_src_port") bit<16> udp_src_port, @name("udp_dst_port") bit<16> udp_dst_port, @name("udp_length") bit<16> udp_length, @name("udp_checksum") bit<16> udp_checksum, @name("vxlan_flags") bit<8> vxlan_flags, @name("vxlan_reserved") bit<24> vxlan_reserved, @name("vxlan_vni") bit<24> vxlan_vni, @name("vxlan_reserved2") bit<8> vxlan_reserved2, @name("port_out") bit<32> port_out) { + headers.outer_ethernet.src_addr = ethernet_src_addr; + headers.outer_ethernet.dst_addr = ethernet_dst_addr; + headers.outer_ethernet.ether_type = ethernet_ether_type; + headers.outer_ipv4_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk.ver_ihl_ddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd_k = ipv4_ver_ihl; + headers.outer_ipv4_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk.diffserv_dpdk_dpdk_dpdk_dpdk_dpdk = ipv4_diffserv; + headers.outer_ipv4_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk.total_len = ipv4_total_len; + headers.outer_ipv4_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk.identification = ipv4_identification; + headers.outer_ipv4_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk.flags_offset = ipv4_flags_offset; + headers.outer_ipv4_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk.ttl = ipv4_ttl; + headers.outer_ipv4_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk.protocol = ipv4_protocol; + headers.outer_ipv4_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk.hdr_checksum = ipv4_hdr_checksum; + headers.outer_ipv4_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk.src_addr = ipv4_src_addr; + headers.outer_ipv4_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk.dst_addr = ipv4_dst_addr; + headers.outer_udp.src_port = udp_src_port; + headers.outer_udp.dst_port = udp_dst_port; + headers.outer_udp.length = udp_length; + headers.outer_udp.checksum = udp_checksum; + headers.vxlan.flags = vxlan_flags; + headers.vxlan.reserved = vxlan_reserved; + headers.vxlan.vni = vxlan_vni; + headers.vxlan.reserved2 = vxlan_reserved2; + ostd.egress_port = (PortId_t)port_out; + csum_0.add, bit<16>>>({ headers.outer_ipv4_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk.hdr_checksum, headers.ipv4.total_len }); + headers.outer_ipv4_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk.hdr_checksum = csum_0.get(); + headers.outer_ipv4_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk.total_len = headers.outer_ipv4_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk.total_len + headers.ipv4.total_len; + headers.outer_udp.length = headers.outer_udp.length + headers.ipv4.total_len; + } + @name("ingress.drop") action drop_1() { + ostd.egress_port = (PortId_t)32w4; + } + @name("ingress.vxlan_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk") table vxlan_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_0 { + key = { + headers.ethernet.dst_addr: exact @name("headers.ethernet.dst_addr") ; + } + actions = { + vxlan_encap_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk(); + drop_1(); + } + const default_action = drop_1(); + size = 1048576; + } + apply { + vxlan_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_0.apply(); + } +} + +control egress(inout headers_t headers, inout local_metadata__dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_t local_metadata, in psa_egress_input_metadata_t istd, inout psa_egress_output_metadata_t ostd) { + apply { + } +} + +parser egress_parser(packet_in buffer, out headers_t headers, inout local_metadata__dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_t local_metadata, in psa_egress_parser_input_metadata_t istd, in empty_metadata_t normal_meta, in empty_metadata_t clone_i2e_meta, in empty_metadata_t clone_e2e_meta) { + state start { + transition accept; + } +} + +control egress_deparser(packet_out packet, out empty_metadata_t clone_e2e_meta, out empty_metadata_t recirculate_meta, inout headers_t headers, in local_metadata__dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_t local_metadata, in psa_egress_output_metadata_t istd, in psa_egress_deparser_input_metadata_t edstd) { + apply { + } +} + +IngressPipeline(packet_parser(), ingress(), packet_deparser()) ip; + +EgressPipeline(egress_parser(), egress(), egress_deparser()) ep; + +PSA_Switch(ip, PacketReplicationEngine(), ep, BufferingQueueingEngine()) main; + diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-token-too-big-midend.p4 b/testdata/p4_16_samples_outputs/psa-dpdk-token-too-big-midend.p4 new file mode 100644 index 0000000000..5869466582 --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-token-too-big-midend.p4 @@ -0,0 +1,159 @@ +#include +#include + +struct empty_metadata_t { +} + +typedef bit<48> ethernet_addr_t; +header ethernet_t { + ethernet_addr_t dst_addr; + ethernet_addr_t src_addr; + bit<16> ether_type; +} + +header ipv4_t { + bit<8> ver_ihl_ddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd_k; + bit<8> diffserv_dpdk_dpdk_dpdk_dpdk_dpdk; + bit<16> total_len; + bit<16> identification; + bit<16> flags_offset; + bit<8> ttl; + bit<8> protocol; + bit<16> hdr_checksum; + bit<32> src_addr; + bit<32> dst_addr; +} + +header udp_t { + bit<16> src_port; + bit<16> dst_port; + bit<16> length; + bit<16> checksum; +} + +header vxlan_t { + bit<8> flags; + bit<24> reserved; + bit<24> vni; + bit<8> reserved2; +} + +struct headers_t { + ethernet_t ethernet; + ipv4_t ipv4; + vxlan_t vxlan; + ethernet_t outer_ethernet; + ipv4_t outer_ipv4_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk; + udp_t outer_udp; + vxlan_t outer_vxlan; +} + +struct local_metadata__dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_t { + ethernet_addr_t dst_addr; + ethernet_addr_t src_addr; +} + +parser packet_parser(packet_in packet, out headers_t headers, inout local_metadata__dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_t local_metadata, in psa_ingress_parser_input_metadata_t standard_metadata, in empty_metadata_t resub_meta, in empty_metadata_t recirc_meta) { + state start { + packet.extract(headers.ethernet); + packet.extract(headers.ipv4); + transition accept; + } +} + +control packet_deparser(packet_out packet, out empty_metadata_t clone_i2e_meta, out empty_metadata_t resubmit_meta, out empty_metadata_t normal_meta, inout headers_t headers, in local_metadata__dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_t local_metadata, in psa_ingress_output_metadata_t istd) { + @hidden action psadpdktokentoobig73() { + packet.emit(headers.outer_ethernet); + packet.emit(headers.outer_ipv4_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk); + packet.emit(headers.outer_udp); + packet.emit(headers.outer_vxlan); + packet.emit(headers.ethernet); + packet.emit(headers.ipv4); + } + @hidden table tbl_psadpdktokentoobig73 { + actions = { + psadpdktokentoobig73(); + } + const default_action = psadpdktokentoobig73(); + } + apply { + tbl_psadpdktokentoobig73.apply(); + } +} + +struct tuple_0 { + bit<16> f0; + bit<16> f1; +} + +control ingress(inout headers_t headers, inout local_metadata__dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_t local_metadata1, in psa_ingress_input_metadata_t standard_metadata, inout psa_ingress_output_metadata_t ostd) { + @name("ingress.csum") InternetChecksum() csum_0; + @name("ingress.vxlan_encap_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk") action vxlan_encap_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk(@name("ethernet_dst_addr") bit<48> ethernet_dst_addr, @name("ethernet_src_addr") bit<48> ethernet_src_addr, @name("ethernet_ether_type") bit<16> ethernet_ether_type, @name("ipv4_ver_ihl") bit<8> ipv4_ver_ihl, @name("ipv4_diffserv") bit<8> ipv4_diffserv, @name("ipv4_total_len") bit<16> ipv4_total_len, @name("ipv4_identification") bit<16> ipv4_identification, @name("ipv4_flags_offset") bit<16> ipv4_flags_offset, @name("ipv4_ttl") bit<8> ipv4_ttl, @name("ipv4_protocol") bit<8> ipv4_protocol, @name("ipv4_hdr_checksum") bit<16> ipv4_hdr_checksum, @name("ipv4_src_addr") bit<32> ipv4_src_addr, @name("ipv4_dst_addr") bit<32> ipv4_dst_addr, @name("udp_src_port") bit<16> udp_src_port, @name("udp_dst_port") bit<16> udp_dst_port, @name("udp_length") bit<16> udp_length, @name("udp_checksum") bit<16> udp_checksum, @name("vxlan_flags") bit<8> vxlan_flags, @name("vxlan_reserved") bit<24> vxlan_reserved, @name("vxlan_vni") bit<24> vxlan_vni, @name("vxlan_reserved2") bit<8> vxlan_reserved2, @name("port_out") bit<32> port_out) { + headers.outer_ethernet.src_addr = ethernet_src_addr; + headers.outer_ethernet.dst_addr = ethernet_dst_addr; + headers.outer_ethernet.ether_type = ethernet_ether_type; + headers.outer_ipv4_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk.ver_ihl_ddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd_k = ipv4_ver_ihl; + headers.outer_ipv4_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk.diffserv_dpdk_dpdk_dpdk_dpdk_dpdk = ipv4_diffserv; + headers.outer_ipv4_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk.total_len = ipv4_total_len; + headers.outer_ipv4_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk.identification = ipv4_identification; + headers.outer_ipv4_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk.flags_offset = ipv4_flags_offset; + headers.outer_ipv4_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk.ttl = ipv4_ttl; + headers.outer_ipv4_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk.protocol = ipv4_protocol; + headers.outer_ipv4_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk.hdr_checksum = ipv4_hdr_checksum; + headers.outer_ipv4_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk.src_addr = ipv4_src_addr; + headers.outer_ipv4_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk.dst_addr = ipv4_dst_addr; + headers.outer_udp.src_port = udp_src_port; + headers.outer_udp.dst_port = udp_dst_port; + headers.outer_udp.length = udp_length; + headers.outer_udp.checksum = udp_checksum; + headers.vxlan.flags = vxlan_flags; + headers.vxlan.reserved = vxlan_reserved; + headers.vxlan.vni = vxlan_vni; + headers.vxlan.reserved2 = vxlan_reserved2; + ostd.egress_port = port_out; + csum_0.add((tuple_0){f0 = ipv4_hdr_checksum,f1 = headers.ipv4.total_len}); + headers.outer_ipv4_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk.hdr_checksum = csum_0.get(); + headers.outer_ipv4_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk.total_len = ipv4_total_len + headers.ipv4.total_len; + headers.outer_udp.length = udp_length + headers.ipv4.total_len; + } + @name("ingress.drop") action drop_1() { + ostd.egress_port = 32w4; + } + @name("ingress.vxlan_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk") table vxlan_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_0 { + key = { + headers.ethernet.dst_addr: exact @name("headers.ethernet.dst_addr") ; + } + actions = { + vxlan_encap_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk(); + drop_1(); + } + const default_action = drop_1(); + size = 1048576; + } + apply { + vxlan_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_0.apply(); + } +} + +control egress(inout headers_t headers, inout local_metadata__dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_t local_metadata, in psa_egress_input_metadata_t istd, inout psa_egress_output_metadata_t ostd) { + apply { + } +} + +parser egress_parser(packet_in buffer, out headers_t headers, inout local_metadata__dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_t local_metadata, in psa_egress_parser_input_metadata_t istd, in empty_metadata_t normal_meta, in empty_metadata_t clone_i2e_meta, in empty_metadata_t clone_e2e_meta) { + state start { + transition accept; + } +} + +control egress_deparser(packet_out packet, out empty_metadata_t clone_e2e_meta, out empty_metadata_t recirculate_meta, inout headers_t headers, in local_metadata__dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_t local_metadata, in psa_egress_output_metadata_t istd, in psa_egress_deparser_input_metadata_t edstd) { + apply { + } +} + +IngressPipeline(packet_parser(), ingress(), packet_deparser()) ip; + +EgressPipeline(egress_parser(), egress(), egress_deparser()) ep; + +PSA_Switch(ip, PacketReplicationEngine(), ep, BufferingQueueingEngine()) main; + diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-token-too-big.p4 b/testdata/p4_16_samples_outputs/psa-dpdk-token-too-big.p4 new file mode 100644 index 0000000000..9c4380e68b --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-token-too-big.p4 @@ -0,0 +1,151 @@ +#include +#include + +struct empty_metadata_t { +} + +typedef bit<48> ethernet_addr_t; +header ethernet_t { + ethernet_addr_t dst_addr; + ethernet_addr_t src_addr; + bit<16> ether_type; +} + +header ipv4_t { + bit<8> ver_ihl_ddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd_k; + bit<8> diffserv_dpdk_dpdk_dpdk_dpdk_dpdk; + bit<16> total_len; + bit<16> identification; + bit<16> flags_offset; + bit<8> ttl; + bit<8> protocol; + bit<16> hdr_checksum; + bit<32> src_addr; + bit<32> dst_addr; +} + +header udp_t { + bit<16> src_port; + bit<16> dst_port; + bit<16> length; + bit<16> checksum; +} + +header vxlan_t { + bit<8> flags; + bit<24> reserved; + bit<24> vni; + bit<8> reserved2; +} + +struct headers_t { + ethernet_t ethernet; + ipv4_t ipv4; + vxlan_t vxlan; + ethernet_t outer_ethernet; + ipv4_t outer_ipv4_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk; + udp_t outer_udp; + vxlan_t outer_vxlan; +} + +struct local_metadata__dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_t { + ethernet_addr_t dst_addr; + ethernet_addr_t src_addr; +} + +parser packet_parser(packet_in packet, out headers_t headers, inout local_metadata__dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_t local_metadata, in psa_ingress_parser_input_metadata_t standard_metadata, in empty_metadata_t resub_meta, in empty_metadata_t recirc_meta) { + state start { + transition parse_ethernet; + } + state parse_ethernet { + packet.extract(headers.ethernet); + transition parser_ipv4; + } + state parser_ipv4 { + packet.extract(headers.ipv4); + transition accept; + } +} + +control packet_deparser(packet_out packet, out empty_metadata_t clone_i2e_meta, out empty_metadata_t resubmit_meta, out empty_metadata_t normal_meta, inout headers_t headers, in local_metadata__dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_t local_metadata, in psa_ingress_output_metadata_t istd) { + apply { + packet.emit(headers.outer_ethernet); + packet.emit(headers.outer_ipv4_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk); + packet.emit(headers.outer_udp); + packet.emit(headers.outer_vxlan); + packet.emit(headers.ethernet); + packet.emit(headers.ipv4); + } +} + +control ingress(inout headers_t headers, inout local_metadata__dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_t local_metadata1, in psa_ingress_input_metadata_t standard_metadata, inout psa_ingress_output_metadata_t ostd) { + InternetChecksum() csum; + action vxlan_encap_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk(bit<48> ethernet_dst_addr, bit<48> ethernet_src_addr, bit<16> ethernet_ether_type, bit<8> ipv4_ver_ihl, bit<8> ipv4_diffserv, bit<16> ipv4_total_len, bit<16> ipv4_identification, bit<16> ipv4_flags_offset, bit<8> ipv4_ttl, bit<8> ipv4_protocol, bit<16> ipv4_hdr_checksum, bit<32> ipv4_src_addr, bit<32> ipv4_dst_addr, bit<16> udp_src_port, bit<16> udp_dst_port, bit<16> udp_length, bit<16> udp_checksum, bit<8> vxlan_flags, bit<24> vxlan_reserved, bit<24> vxlan_vni, bit<8> vxlan_reserved2, bit<32> port_out) { + headers.outer_ethernet.src_addr = ethernet_src_addr; + headers.outer_ethernet.dst_addr = ethernet_dst_addr; + headers.outer_ethernet.ether_type = ethernet_ether_type; + headers.outer_ipv4_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk.ver_ihl_ddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd_k = ipv4_ver_ihl; + headers.outer_ipv4_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk.diffserv_dpdk_dpdk_dpdk_dpdk_dpdk = ipv4_diffserv; + headers.outer_ipv4_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk.total_len = ipv4_total_len; + headers.outer_ipv4_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk.identification = ipv4_identification; + headers.outer_ipv4_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk.flags_offset = ipv4_flags_offset; + headers.outer_ipv4_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk.ttl = ipv4_ttl; + headers.outer_ipv4_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk.protocol = ipv4_protocol; + headers.outer_ipv4_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk.hdr_checksum = ipv4_hdr_checksum; + headers.outer_ipv4_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk.src_addr = ipv4_src_addr; + headers.outer_ipv4_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk.dst_addr = ipv4_dst_addr; + headers.outer_udp.src_port = udp_src_port; + headers.outer_udp.dst_port = udp_dst_port; + headers.outer_udp.length = udp_length; + headers.outer_udp.checksum = udp_checksum; + headers.vxlan.flags = vxlan_flags; + headers.vxlan.reserved = vxlan_reserved; + headers.vxlan.vni = vxlan_vni; + headers.vxlan.reserved2 = vxlan_reserved2; + ostd.egress_port = (PortId_t)port_out; + csum.add({ headers.outer_ipv4_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk.hdr_checksum, headers.ipv4.total_len }); + headers.outer_ipv4_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk.hdr_checksum = csum.get(); + headers.outer_ipv4_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk.total_len = headers.outer_ipv4_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk.total_len + headers.ipv4.total_len; + headers.outer_udp.length = headers.outer_udp.length + headers.ipv4.total_len; + } + action drop() { + ostd.egress_port = (PortId_t)4; + } + table vxlan_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk { + key = { + headers.ethernet.dst_addr: exact; + } + actions = { + vxlan_encap_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk; + drop; + } + const default_action = drop; + size = 1024 * 1024; + } + apply { + vxlan_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk.apply(); + } +} + +control egress(inout headers_t headers, inout local_metadata__dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_t local_metadata, in psa_egress_input_metadata_t istd, inout psa_egress_output_metadata_t ostd) { + apply { + } +} + +parser egress_parser(packet_in buffer, out headers_t headers, inout local_metadata__dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_t local_metadata, in psa_egress_parser_input_metadata_t istd, in empty_metadata_t normal_meta, in empty_metadata_t clone_i2e_meta, in empty_metadata_t clone_e2e_meta) { + state start { + transition accept; + } +} + +control egress_deparser(packet_out packet, out empty_metadata_t clone_e2e_meta, out empty_metadata_t recirculate_meta, inout headers_t headers, in local_metadata__dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_t local_metadata, in psa_egress_output_metadata_t istd, in psa_egress_deparser_input_metadata_t edstd) { + apply { + } +} + +IngressPipeline(packet_parser(), ingress(), packet_deparser()) ip; + +EgressPipeline(egress_parser(), egress(), egress_deparser()) ep; + +PSA_Switch(ip, PacketReplicationEngine(), ep, BufferingQueueingEngine()) main; + diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-token-too-big.p4-error b/testdata/p4_16_samples_outputs/psa-dpdk-token-too-big.p4-error new file mode 100644 index 0000000000..e69de29bb2 diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-token-too-big.p4-stderr b/testdata/p4_16_samples_outputs/psa-dpdk-token-too-big.p4-stderr new file mode 100644 index 0000000000..e69de29bb2 diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-token-too-big.p4.bfrt.json b/testdata/p4_16_samples_outputs/psa-dpdk-token-too-big.p4.bfrt.json new file mode 100644 index 0000000000..d64dd3f745 --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-token-too-big.p4.bfrt.json @@ -0,0 +1,313 @@ +{ + "schema_version" : "1.0.0", + "tables" : [ + { + "name" : "ip.ingress.vxlan_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk", + "id" : 47735139, + "table_type" : "MatchAction_Direct", + "size" : 1048576, + "annotations" : [], + "depends_on" : [], + "has_const_default_action" : true, + "key" : [ + { + "id" : 1, + "name" : "headers.ethernet.dst_addr", + "repeated" : false, + "annotations" : [], + "mandatory" : false, + "match_type" : "Exact", + "type" : { + "type" : "bytes", + "width" : 48 + } + } + ], + "action_specs" : [ + { + "id" : 30831807, + "name" : "ingress.vxlan_encap_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk", + "action_scope" : "TableAndDefault", + "annotations" : [], + "data" : [ + { + "id" : 1, + "name" : "ethernet_dst_addr", + "repeated" : false, + "mandatory" : true, + "read_only" : false, + "annotations" : [], + "type" : { + "type" : "bytes", + "width" : 48 + } + }, + { + "id" : 2, + "name" : "ethernet_src_addr", + "repeated" : false, + "mandatory" : true, + "read_only" : false, + "annotations" : [], + "type" : { + "type" : "bytes", + "width" : 48 + } + }, + { + "id" : 3, + "name" : "ethernet_ether_type", + "repeated" : false, + "mandatory" : true, + "read_only" : false, + "annotations" : [], + "type" : { + "type" : "bytes", + "width" : 16 + } + }, + { + "id" : 4, + "name" : "ipv4_ver_ihl", + "repeated" : false, + "mandatory" : true, + "read_only" : false, + "annotations" : [], + "type" : { + "type" : "bytes", + "width" : 8 + } + }, + { + "id" : 5, + "name" : "ipv4_diffserv", + "repeated" : false, + "mandatory" : true, + "read_only" : false, + "annotations" : [], + "type" : { + "type" : "bytes", + "width" : 8 + } + }, + { + "id" : 6, + "name" : "ipv4_total_len", + "repeated" : false, + "mandatory" : true, + "read_only" : false, + "annotations" : [], + "type" : { + "type" : "bytes", + "width" : 16 + } + }, + { + "id" : 7, + "name" : "ipv4_identification", + "repeated" : false, + "mandatory" : true, + "read_only" : false, + "annotations" : [], + "type" : { + "type" : "bytes", + "width" : 16 + } + }, + { + "id" : 8, + "name" : "ipv4_flags_offset", + "repeated" : false, + "mandatory" : true, + "read_only" : false, + "annotations" : [], + "type" : { + "type" : "bytes", + "width" : 16 + } + }, + { + "id" : 9, + "name" : "ipv4_ttl", + "repeated" : false, + "mandatory" : true, + "read_only" : false, + "annotations" : [], + "type" : { + "type" : "bytes", + "width" : 8 + } + }, + { + "id" : 10, + "name" : "ipv4_protocol", + "repeated" : false, + "mandatory" : true, + "read_only" : false, + "annotations" : [], + "type" : { + "type" : "bytes", + "width" : 8 + } + }, + { + "id" : 11, + "name" : "ipv4_hdr_checksum", + "repeated" : false, + "mandatory" : true, + "read_only" : false, + "annotations" : [], + "type" : { + "type" : "bytes", + "width" : 16 + } + }, + { + "id" : 12, + "name" : "ipv4_src_addr", + "repeated" : false, + "mandatory" : true, + "read_only" : false, + "annotations" : [], + "type" : { + "type" : "bytes", + "width" : 32 + } + }, + { + "id" : 13, + "name" : "ipv4_dst_addr", + "repeated" : false, + "mandatory" : true, + "read_only" : false, + "annotations" : [], + "type" : { + "type" : "bytes", + "width" : 32 + } + }, + { + "id" : 14, + "name" : "udp_src_port", + "repeated" : false, + "mandatory" : true, + "read_only" : false, + "annotations" : [], + "type" : { + "type" : "bytes", + "width" : 16 + } + }, + { + "id" : 15, + "name" : "udp_dst_port", + "repeated" : false, + "mandatory" : true, + "read_only" : false, + "annotations" : [], + "type" : { + "type" : "bytes", + "width" : 16 + } + }, + { + "id" : 16, + "name" : "udp_length", + "repeated" : false, + "mandatory" : true, + "read_only" : false, + "annotations" : [], + "type" : { + "type" : "bytes", + "width" : 16 + } + }, + { + "id" : 17, + "name" : "udp_checksum", + "repeated" : false, + "mandatory" : true, + "read_only" : false, + "annotations" : [], + "type" : { + "type" : "bytes", + "width" : 16 + } + }, + { + "id" : 18, + "name" : "vxlan_flags", + "repeated" : false, + "mandatory" : true, + "read_only" : false, + "annotations" : [], + "type" : { + "type" : "bytes", + "width" : 8 + } + }, + { + "id" : 19, + "name" : "vxlan_reserved", + "repeated" : false, + "mandatory" : true, + "read_only" : false, + "annotations" : [], + "type" : { + "type" : "bytes", + "width" : 24 + } + }, + { + "id" : 20, + "name" : "vxlan_vni", + "repeated" : false, + "mandatory" : true, + "read_only" : false, + "annotations" : [], + "type" : { + "type" : "bytes", + "width" : 24 + } + }, + { + "id" : 21, + "name" : "vxlan_reserved2", + "repeated" : false, + "mandatory" : true, + "read_only" : false, + "annotations" : [], + "type" : { + "type" : "bytes", + "width" : 8 + } + }, + { + "id" : 22, + "name" : "port_out", + "repeated" : false, + "mandatory" : true, + "read_only" : false, + "annotations" : [], + "type" : { + "type" : "bytes", + "width" : 32 + } + } + ] + }, + { + "id" : 33281717, + "name" : "ingress.drop", + "action_scope" : "TableAndDefault", + "annotations" : [], + "data" : [] + } + ], + "data" : [], + "supported_operations" : [], + "attributes" : ["EntryScope"] + } + ], + "learn_filters" : [] +} \ No newline at end of file diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-token-too-big.p4.entries.txt b/testdata/p4_16_samples_outputs/psa-dpdk-token-too-big.p4.entries.txt new file mode 100644 index 0000000000..e69de29bb2 diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-token-too-big.p4.p4info.txt b/testdata/p4_16_samples_outputs/psa-dpdk-token-too-big.p4.p4info.txt new file mode 100644 index 0000000000..c6635b9666 --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-token-too-big.p4.p4info.txt @@ -0,0 +1,150 @@ +pkg_info { + arch: "psa" +} +tables { + preamble { + id: 47735139 + name: "ingress.vxlan_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk" + alias: "vxlan_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk" + } + match_fields { + id: 1 + name: "headers.ethernet.dst_addr" + bitwidth: 48 + match_type: EXACT + } + action_refs { + id: 30831807 + } + action_refs { + id: 33281717 + } + const_default_action_id: 33281717 + size: 1048576 +} +actions { + preamble { + id: 30831807 + name: "ingress.vxlan_encap_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk" + alias: "vxlan_encap_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk" + } + params { + id: 1 + name: "ethernet_dst_addr" + bitwidth: 48 + } + params { + id: 2 + name: "ethernet_src_addr" + bitwidth: 48 + } + params { + id: 3 + name: "ethernet_ether_type" + bitwidth: 16 + } + params { + id: 4 + name: "ipv4_ver_ihl" + bitwidth: 8 + } + params { + id: 5 + name: "ipv4_diffserv" + bitwidth: 8 + } + params { + id: 6 + name: "ipv4_total_len" + bitwidth: 16 + } + params { + id: 7 + name: "ipv4_identification" + bitwidth: 16 + } + params { + id: 8 + name: "ipv4_flags_offset" + bitwidth: 16 + } + params { + id: 9 + name: "ipv4_ttl" + bitwidth: 8 + } + params { + id: 10 + name: "ipv4_protocol" + bitwidth: 8 + } + params { + id: 11 + name: "ipv4_hdr_checksum" + bitwidth: 16 + } + params { + id: 12 + name: "ipv4_src_addr" + bitwidth: 32 + } + params { + id: 13 + name: "ipv4_dst_addr" + bitwidth: 32 + } + params { + id: 14 + name: "udp_src_port" + bitwidth: 16 + } + params { + id: 15 + name: "udp_dst_port" + bitwidth: 16 + } + params { + id: 16 + name: "udp_length" + bitwidth: 16 + } + params { + id: 17 + name: "udp_checksum" + bitwidth: 16 + } + params { + id: 18 + name: "vxlan_flags" + bitwidth: 8 + } + params { + id: 19 + name: "vxlan_reserved" + bitwidth: 24 + } + params { + id: 20 + name: "vxlan_vni" + bitwidth: 24 + } + params { + id: 21 + name: "vxlan_reserved2" + bitwidth: 8 + } + params { + id: 22 + name: "port_out" + bitwidth: 32 + } +} +actions { + preamble { + id: 33281717 + name: "ingress.drop" + alias: "drop" + } +} +type_info { +} diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-token-too-big.p4.spec b/testdata/p4_16_samples_outputs/psa-dpdk-token-too-big.p4.spec new file mode 100644 index 0000000000..acc50a1bb1 --- /dev/null +++ b/testdata/p4_16_samples_outputs/psa-dpdk-token-too-big.p4.spec @@ -0,0 +1,180 @@ + + +struct ethernet_t { + bit<48> dst_addr + bit<48> src_addr + bit<16> ether_type +} + +struct ipv4_t { + ;oldname:ver_ihl_ddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd_k + bit<8> ver_ihl_ddddddddddddddddddddd0 + ;oldname:diffserv_dpdk_dpdk_dpdk_dpdk_dpdk + bit<8> diffserv_dpdk_dpdk_dpdk_dpdk_1 + bit<16> total_len + bit<16> identification + bit<16> flags_offset + bit<8> ttl + bit<8> protocol + bit<16> hdr_checksum + bit<32> src_addr + bit<32> dst_addr +} + +struct vxlan_t { + bit<8> flags + bit<24> reserved + bit<24> vni + bit<8> reserved2 +} + +struct udp_t { + bit<16> src_port + bit<16> dst_port + bit<16> length + bit<16> checksum +} + +struct cksum_state_t { + bit<16> state_0 +} + +struct psa_ingress_output_metadata_t { + bit<8> class_of_service + bit<8> clone + bit<16> clone_session_id + bit<8> drop + bit<8> resubmit + bit<32> multicast_group + bit<32> egress_port +} + +struct psa_egress_output_metadata_t { + bit<8> clone + bit<16> clone_session_id + bit<8> drop +} + +struct psa_egress_deparser_input_metadata_t { + bit<32> egress_port +} + +;oldname:vxlan_encap_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_arg_t +struct vxlan_encap_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dp2 { + bit<48> ethernet_dst_addr + bit<48> ethernet_src_addr + bit<16> ethernet_ether_type + bit<8> ipv4_ver_ihl + bit<8> ipv4_diffserv + bit<16> ipv4_total_len + bit<16> ipv4_identification + bit<16> ipv4_flags_offset + bit<8> ipv4_ttl + bit<8> ipv4_protocol + bit<16> ipv4_hdr_checksum + bit<32> ipv4_src_addr + bit<32> ipv4_dst_addr + bit<16> udp_src_port + bit<16> udp_dst_port + bit<16> udp_length + bit<16> udp_checksum + bit<8> vxlan_flags + bit<24> vxlan_reserved + bit<24> vxlan_vni + bit<8> vxlan_reserved2 + bit<32> port_out +} + +header ethernet instanceof ethernet_t +header ipv4 instanceof ipv4_t +header vxlan instanceof vxlan_t +header outer_ethernet instanceof ethernet_t +;oldname:outer_ipv4_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk +header outer_ipv4_dpdk_dpdk_dpdk_dpd3 instanceof ipv4_t +header outer_udp instanceof udp_t +header outer_vxlan instanceof vxlan_t +header cksum_state instanceof cksum_state_t + +;oldname:local_metadata__dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_t +struct local_metadata__dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpd4 { + bit<32> psa_ingress_input_metadata_ingress_port + bit<8> psa_ingress_output_metadata_drop + bit<32> psa_ingress_output_metadata_egress_port + bit<16> Ingress_tmp + bit<16> Ingress_tmp_0 +} +metadata instanceof local_metadata__dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpd4 + +;oldname:vxlan_encap_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk +action vxlan_encap_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dp5 args instanceof vxlan_encap_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dp2 { + mov h.outer_ethernet.src_addr t.ethernet_src_addr + mov h.outer_ethernet.dst_addr t.ethernet_dst_addr + mov h.outer_ethernet.ether_type t.ethernet_ether_type + mov h.outer_ipv4_dpdk_dpdk_dpdk_dpd3.ver_ihl_ddddddddddddddddddddd0 t.ipv4_ver_ihl + mov h.outer_ipv4_dpdk_dpdk_dpdk_dpd3.diffserv_dpdk_dpdk_dpdk_dpdk_1 t.ipv4_diffserv + mov h.outer_ipv4_dpdk_dpdk_dpdk_dpd3.total_len t.ipv4_total_len + mov h.outer_ipv4_dpdk_dpdk_dpdk_dpd3.identification t.ipv4_identification + mov h.outer_ipv4_dpdk_dpdk_dpdk_dpd3.flags_offset t.ipv4_flags_offset + mov h.outer_ipv4_dpdk_dpdk_dpdk_dpd3.ttl t.ipv4_ttl + mov h.outer_ipv4_dpdk_dpdk_dpdk_dpd3.protocol t.ipv4_protocol + mov h.outer_ipv4_dpdk_dpdk_dpdk_dpd3.hdr_checksum t.ipv4_hdr_checksum + mov h.outer_ipv4_dpdk_dpdk_dpdk_dpd3.src_addr t.ipv4_src_addr + mov h.outer_ipv4_dpdk_dpdk_dpdk_dpd3.dst_addr t.ipv4_dst_addr + mov h.outer_udp.src_port t.udp_src_port + mov h.outer_udp.dst_port t.udp_dst_port + mov h.outer_udp.length t.udp_length + mov h.outer_udp.checksum t.udp_checksum + mov h.vxlan.flags t.vxlan_flags + mov h.vxlan.reserved t.vxlan_reserved + mov h.vxlan.vni t.vxlan_vni + mov h.vxlan.reserved2 t.vxlan_reserved2 + mov m.psa_ingress_output_metadata_egress_port t.port_out + mov m.Ingress_tmp h.outer_ipv4_dpdk_dpdk_dpdk_dpd3.hdr_checksum + mov m.Ingress_tmp_0 h.ipv4.total_len + ckadd h.cksum_state.state_0 m.Ingress_tmp + ckadd h.cksum_state.state_0 m.Ingress_tmp_0 + mov h.outer_ipv4_dpdk_dpdk_dpdk_dpd3.hdr_checksum h.cksum_state.state_0 + mov h.outer_ipv4_dpdk_dpdk_dpdk_dpd3.total_len t.ipv4_total_len + add h.outer_ipv4_dpdk_dpdk_dpdk_dpd3.total_len h.ipv4.total_len + mov h.outer_udp.length t.udp_length + add h.outer_udp.length h.ipv4.total_len + return +} + +action drop_1 args none { + mov m.psa_ingress_output_metadata_egress_port 0x4 + return +} + +;oldname:vxlan_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk +table vxlan_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpd6 { + key { + h.ethernet.dst_addr exact + } + actions { + vxlan_encap_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dp5 + drop_1 + } + default_action drop_1 args none + size 0x100000 +} + + +apply { + rx m.psa_ingress_input_metadata_ingress_port + mov m.psa_ingress_output_metadata_drop 0x0 + extract h.ethernet + extract h.ipv4 + table vxlan_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpdk_dpd6 + jmpneq LABEL_DROP m.psa_ingress_output_metadata_drop 0x0 + emit h.outer_ethernet + emit h.outer_ipv4_dpdk_dpdk_dpdk_dpd3 + emit h.outer_udp + emit h.outer_vxlan + emit h.ethernet + emit h.ipv4 + tx m.psa_ingress_output_metadata_egress_port + LABEL_DROP : drop +} + + diff --git a/testdata/p4_16_samples_outputs/psa-example-dpdk-varbit-bmv2.p4.spec b/testdata/p4_16_samples_outputs/psa-example-dpdk-varbit-bmv2.p4.spec index 280ea57946..da2f6a8ef7 100644 --- a/testdata/p4_16_samples_outputs/psa-example-dpdk-varbit-bmv2.p4.spec +++ b/testdata/p4_16_samples_outputs/psa-example-dpdk-varbit-bmv2.p4.spec @@ -72,8 +72,10 @@ struct tbl_set_member_id_arg_t { header ethernet instanceof ethernet_t header ipv4_base instanceof ipv4_base_t header ipv4_option_timestamp instanceof ipv4_option_timestamp_t -header IngressParser_parser_lookahead_tmp instanceof lookahead_tmp_hdr -header IngressParser_parser_lookahead_tmp_0 instanceof lookahead_tmp_hdr_0 +;oldname:IngressParser_parser_lookahead_tmp +header IngressParser_parser_lookahea0 instanceof lookahead_tmp_hdr +;oldname:IngressParser_parser_lookahead_tmp_0 +header IngressParser_parser_lookahea1 instanceof lookahead_tmp_hdr_0 struct EMPTY { bit<32> psa_ingress_input_metadata_ingress_port @@ -157,12 +159,12 @@ apply { jmp MYIP_ACCEPT MYIP_PARSE_IPV4 : extract h.ipv4_base jmpeq MYIP_ACCEPT h.ipv4_base.version_ihl 0x45 - lookahead h.IngressParser_parser_lookahead_tmp_0 - mov m.IngressParser_parser_tmp_3 h.IngressParser_parser_lookahead_tmp_0.f + lookahead h.IngressParser_parser_lookahea1 + mov m.IngressParser_parser_tmp_3 h.IngressParser_parser_lookahea1.f jmpeq MYIP_PARSE_IPV4_OPTION_TIMESTAMP m.IngressParser_parser_tmp_3 0x44 jmp MYIP_ACCEPT - MYIP_PARSE_IPV4_OPTION_TIMESTAMP : lookahead h.IngressParser_parser_lookahead_tmp - mov m.IngressParser_parser_tmp16 h.IngressParser_parser_lookahead_tmp.f + MYIP_PARSE_IPV4_OPTION_TIMESTAMP : lookahead h.IngressParser_parser_lookahea0 + mov m.IngressParser_parser_tmp16 h.IngressParser_parser_lookahea0.f mov m.IngressParser_parser_tmp m.IngressParser_parser_tmp16 mov m.IngressParser_parser_tmp_0 m.IngressParser_parser_tmp mov m.IngressParser_parser_tmp_1 m.IngressParser_parser_tmp_0