From e03d7d6d25f39c47298273d9312604eca9e6c58c Mon Sep 17 00:00:00 2001 From: Kamlesh Kumar Date: Wed, 6 Apr 2022 13:06:43 +0000 Subject: [PATCH] [dpdk] Shorten the Identifer name, including dots(.) in Member expression to be less than 64 because dpdk does not allow Identifer longer than 63 chars --- backends/dpdk/backend.cpp | 4 +- backends/dpdk/dpdk.def | 5 +- backends/dpdk/dpdkAsmOpt.cpp | 3 + backends/dpdk/dpdkAsmOpt.h | 119 +++++++ backends/dpdk/dpdkProgram.cpp | 11 +- backends/dpdk/dpdkProgram.h | 2 +- backends/dpdk/run-dpdk-test.py | 51 ++- backends/dpdk/spec.cpp | 40 ++- ir/ir.cpp | 2 + .../p4_16_samples/psa-dpdk-token-too-big.p4 | 177 ++++++++++ .../pna-example-dpdk-varbit.p4.spec | 7 +- .../pna-example-tunnel.p4.spec | 17 +- .../pna-lookahead-structure-bit-field.p4.spec | 7 +- .../pna-lookahead-structure.p4.spec | 14 +- .../psa-dpdk-token-too-big.p4-error | 0 .../psa-dpdk-token-too-big.p4.bfrt.json | 313 ++++++++++++++++++ .../psa-dpdk-token-too-big.p4.spec | 180 ++++++++++ .../psa-example-dpdk-varbit-bmv2.p4.spec | 14 +- 18 files changed, 925 insertions(+), 41 deletions(-) create mode 100644 testdata/p4_16_samples/psa-dpdk-token-too-big.p4 create mode 100644 testdata/p4_16_samples_outputs/psa-dpdk-token-too-big.p4-error create mode 100644 testdata/p4_16_samples_outputs/psa-dpdk-token-too-big.p4.bfrt.json create mode 100644 testdata/p4_16_samples_outputs/psa-dpdk-token-too-big.p4.spec diff --git a/backends/dpdk/backend.cpp b/backends/dpdk/backend.cpp index 8b4d82f77f3..52f04d23584 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(IR::IDPDKNode::origNameMap), }; 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/dpdk.def b/backends/dpdk/dpdk.def index 768328ba55e..90e1b57e580 100644 --- a/backends/dpdk/dpdk.def +++ b/backends/dpdk/dpdk.def @@ -1,5 +1,6 @@ interface IDPDKNode { virtual std::ostream& toSpec(std::ostream& out) const = 0; + static ordered_map origNameMap; } class DpdkDeclaration : IDPDKNode { @@ -50,8 +51,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/dpdkAsmOpt.cpp b/backends/dpdk/dpdkAsmOpt.cpp index 691e7e3997e..604d173d119 100644 --- a/backends/dpdk/dpdkAsmOpt.cpp +++ b/backends/dpdk/dpdkAsmOpt.cpp @@ -279,4 +279,7 @@ 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 7243207d534..6fa685569b4 100644 --- a/backends/dpdk/dpdkAsmOpt.h +++ b/backends/dpdk/dpdkAsmOpt.h @@ -173,6 +173,125 @@ class ValidateTableKeys : public Inspector { int getFieldSizeBits(const IR::Type *field_type); }; +// This pass shorten the Identifier length +class ShortenTokenLength : public Transform { + ordered_map newNameMap; + ordered_map &origNameMap; + 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: + explicit ShortenTokenLength(ordered_map &origNameMap) + : origNameMap{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 a783ec7231f..c529f1d2dd5 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 40e57eeee45..6e9e6a43549 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 b6a315207b6..f76aaf12645 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 0be38c66925..8c1ede64611 100644 --- a/backends/dpdk/spec.cpp +++ b/backends/dpdk/spec.cpp @@ -6,6 +6,7 @@ using namespace DBPrint; static constexpr unsigned DEFAULT_LEARNER_TABLE_SIZE = 0x10000; static constexpr unsigned DEFAULT_LEARNER_TABLE_TIMEOUT = 120; +auto& origNameMap = IR::IDPDKNode::origNameMap; void add_space(std::ostream &out, int size) { out << std::setfill(' ') << std::setw(size) << " "; @@ -16,22 +17,39 @@ std::ostream &IR::DpdkAsmProgram::toSpec(std::ostream &out) const { l->toSpec(out) << std::endl; } out << std::endl; - for (auto h : headerType) + for (auto h : headerType) { + if (origNameMap.count(h->name.toString())) + out<<";oldname:"<name.toString())<<"\n"; h->toSpec(out) << std::endl; - for (auto s : structType) + } + for (auto s : structType) { + if (origNameMap.count(s->name.toString())) + out<<";oldname:"<name.toString())<<"\n"; s->toSpec(out) << std::endl; - for (auto s : externDeclarations) + } + for (auto s : externDeclarations) { + if (origNameMap.count(s->name.toString())) + out<<";oldname:"<name.toString())<<"\n"; s->toSpec(out) << std::endl; + } for (auto a : actions) { + if (origNameMap.count(a->name.toString())) + out<<";oldname:"<name.toString())<<"\n"; a->toSpec(out) << std::endl << std::endl; } for (auto t : tables) { + if (origNameMap.count(t->name)) + out<<";oldname:"<name)<<"\n"; t->toSpec(out) << std::endl << std::endl; } for (auto s : selectors) { + if (origNameMap.count(s->name)) + out<<";oldname:"<name)<<"\n"; s->toSpec(out) << std::endl; } for (auto s : learners) { + if (origNameMap.count(s->name)) + out<<";oldname:"<name)<<"\n"; s->toSpec(out) << std::endl; } for (auto s : statements) { @@ -104,6 +122,8 @@ 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) { + if (origNameMap.count((*it)->name.toString())) + out<<"\t;oldname:"<name.toString())<<"\n"; if (auto t = (*it)->type->to()) out << "\tbit<" << t->width_bits() << ">"; else if (auto t = (*it)->type->to()) @@ -125,6 +145,8 @@ 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) { + if (origNameMap.count((*it)->name.toString())) + out<<";oldname:"<name.toString())<<"\n"; if (auto t = (*it)->type->to()) { out << "header " << (*it)->name << " instanceof " << t->path->name; @@ -147,6 +169,8 @@ std::ostream &IR::DpdkStructType::toSpec(std::ostream &out) const { } else { out << "struct " << name << " {" << std::endl; for (auto it = fields.begin(); it != fields.end(); ++it) { + if (origNameMap.count((*it)->name.toString())) + out<<"\t;oldname:"<name.toString())<<"\n"; if (auto t = (*it)->type->to()) out << "\tbit<" << t->width_bits() << ">"; else if (auto t = (*it)->type->to()) { @@ -341,7 +365,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 +373,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 +495,8 @@ std::ostream &IR::DpdkVerifyStatement::toSpec(std::ostream &out) const { } std::ostream &IR::DpdkMeterDeclStatement::toSpec(std::ostream &out) const { + if (origNameMap.count(meter)) + out<<";oldname:"< IR::IDPDKNode::origNameMap = {}; const Type_Method* P4Control::getConstructorMethodType() const { return new Type_Method(getTypeParameters(), type, constructorParams, getName()); 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 00000000000..c3a3133374a --- /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 4db347dd996..8c5a9ca5ad6 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 3eb1cf275f6..61de18c83c2 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 58cb53812f1..3e4924110ef 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 eb631860db8..31f08717e1e 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.p4-error b/testdata/p4_16_samples_outputs/psa-dpdk-token-too-big.p4-error new file mode 100644 index 00000000000..e69de29bb2d 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 00000000000..d64dd3f745d --- /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.spec b/testdata/p4_16_samples_outputs/psa-dpdk-token-too-big.p4.spec new file mode 100644 index 00000000000..acc50a1bb1f --- /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 280ea57946c..da2f6a8ef7c 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