From d40ff2f4b4ff455a8d20e23c9f0a5c0485f60866 Mon Sep 17 00:00:00 2001 From: Sosutha Sethuramapandian Date: Mon, 16 Sep 2024 22:26:42 -0700 Subject: [PATCH] Support for 128 bit operations Signed-off-by: Sosutha Sethuramapandian * Added movh statement definition * Added support for 128 bitwise operation * Added support for 128 bit equal and not equal operators. * Added support for 128 bit compliment operation * Updated testcase and output --- backends/dpdk/CMakeLists.txt | 3 +- backends/dpdk/DpdkXfail.cmake | 1 + backends/dpdk/dbprint-dpdk.cpp | 4 + backends/dpdk/dpdk.def | 14 + backends/dpdk/dpdkArch.h | 11 + backends/dpdk/dpdkHelpers.cpp | 354 ++- backends/dpdk/dpdkHelpers.h | 21 +- backends/dpdk/dpdkProgram.cpp | 11 +- backends/dpdk/dpdkProgramStructure.h | 7 + backends/dpdk/spec.cpp | 9 + .../dash-pipeline-pna-dpdk.p4 | 1237 ++++++++ .../dash-pipeline-pna-dpdk.p4-error | 106 + .../dash-pipeline-pna-dpdk.p4.bfrt.json | 2724 +++++++++++++++++ testdata/p4_16_samples/pna-ipv6-actions.p4 | 30 + .../pna-ipv6-actions-first.p4 | 24 + .../pna-ipv6-actions-frontend.p4 | 42 +- .../pna-ipv6-actions-midend.p4 | 52 +- .../p4_16_samples_outputs/pna-ipv6-actions.p4 | 24 + .../pna-ipv6-actions.p4-error | 2 +- .../pna-ipv6-actions.p4-stderr | 2 +- .../pna-ipv6-actions.p4.bfrt.json | 42 + .../pna-ipv6-actions.p4.spec | 108 + .../psa-dpdk-128bitCast.p4.spec | 42 +- 23 files changed, 4807 insertions(+), 63 deletions(-) create mode 100644 testdata/p4_16_dpdk_errors/dash-pipeline-pna-dpdk.p4 create mode 100644 testdata/p4_16_dpdk_errors_outputs/dash-pipeline-pna-dpdk.p4-error create mode 100644 testdata/p4_16_dpdk_errors_outputs/dash-pipeline-pna-dpdk.p4.bfrt.json diff --git a/backends/dpdk/CMakeLists.txt b/backends/dpdk/CMakeLists.txt index e73490421ef..b1211d47c10 100644 --- a/backends/dpdk/CMakeLists.txt +++ b/backends/dpdk/CMakeLists.txt @@ -129,7 +129,8 @@ set (P4_16_SUITES "${P4C_SOURCE_DIR}/testdata/p4_16_samples/pna-*.p4" "${P4C_SOURCE_DIR}/testdata/p4_16_psa_errors/*.p4" "${P4C_SOURCE_DIR}/testdata/p4_16_dpdk_errors/*.p4" - "${P4C_SOURCE_DIR}/testdata/p4_16_pna_errors/*.p4") + "${P4C_SOURCE_DIR}/testdata/p4_16_pna_errors/*.p4" + "${P4C_SOURCE_DIR}/testdata/p4_16_samples/dash/dash-pipeline-pna-dpdk.p4") p4c_add_tests("dpdk" ${DPDK_COMPILER_DRIVER} "${P4_16_SUITES}" "" "--bfrt") #### DPDK-PTF Tests diff --git a/backends/dpdk/DpdkXfail.cmake b/backends/dpdk/DpdkXfail.cmake index 8fc1f992463..9df082cf9ee 100644 --- a/backends/dpdk/DpdkXfail.cmake +++ b/backends/dpdk/DpdkXfail.cmake @@ -26,6 +26,7 @@ p4c_add_xfail_reason("dpdk" testdata/p4_16_samples/pna-dpdk-invalid-hdr-warnings5.p4 testdata/p4_16_samples/pna-dpdk-invalid-hdr-warnings6.p4 testdata/p4_16_samples/pna-dpdk-header-union-stack2.p4 + testdata/p4_16_samples/dash/dash-pipeline-pna-dpdk.p4 ) p4c_add_xfail_reason("dpdk" diff --git a/backends/dpdk/dbprint-dpdk.cpp b/backends/dpdk/dbprint-dpdk.cpp index 50b9e5e80bc..3fe933a7270 100644 --- a/backends/dpdk/dbprint-dpdk.cpp +++ b/backends/dpdk/dbprint-dpdk.cpp @@ -70,4 +70,8 @@ void IR::DpdkMovStatement::dbprint(std::ostream &out) const { out << "mov " << dst << " " << src << std::endl; } +void IR::DpdkMovhStatement::dbprint(std::ostream &out) const { + out << "movh " << dst << " " << src << std::endl; +} + } // namespace P4 diff --git a/backends/dpdk/dpdk.def b/backends/dpdk/dpdk.def index 511c2bcd8f8..fd9dd896b49 100644 --- a/backends/dpdk/dpdk.def +++ b/backends/dpdk/dpdk.def @@ -18,6 +18,13 @@ class DpdkHeaderType : Type_Header, IDPDKNode { #nodbprint } +class DpdkHeaderInstance : IDPDKNode { + Declaration_Variable name; + Type_Header headerType; + std::ostream& toSpec(std::ostream& out) const override; +#nodbprint +} + class DpdkStructType : Type_Struct, IDPDKNode { std::ostream& toSpec(std::ostream& out) const override; #nodbprint @@ -99,6 +106,7 @@ class DpdkLearner { class DpdkAsmProgram { inline IndexedVector headerType; inline IndexedVector structType; + inline IndexedVector headerInstance; inline IndexedVector externDeclarations; inline IndexedVector actions; inline IndexedVector tables; @@ -304,6 +312,12 @@ class DpdkMovStatement : DpdkUnaryStatement { #noconstructor } +class DpdkMovhStatement : DpdkUnaryStatement { + DpdkMovhStatement(Expression dst, Expression src) : + DpdkUnaryStatement("movh"_cs, dst, src) { } +#noconstructor +} + abstract DpdkBinaryStatement : DpdkAssignmentStatement { Expression src1; Expression src2; diff --git a/backends/dpdk/dpdkArch.h b/backends/dpdk/dpdkArch.h index 7a826712e4f..8f8f0e0034e 100644 --- a/backends/dpdk/dpdkArch.h +++ b/backends/dpdk/dpdkArch.h @@ -1101,6 +1101,12 @@ class ValidateOperandSize : public Inspector { } void postorder(const IR::Operation_Binary *binop) override { + if (binop->is() || binop->is() || binop->is() || + binop->is() || binop->is()) { + if (auto src1Type = binop->left->type->to()) { + if (src1Type->width_bits() == 128) return; + } + } isValidOperandSize(binop->left); isValidOperandSize(binop->right); } @@ -1108,6 +1114,11 @@ class ValidateOperandSize : public Inspector { // Reject all operations except typecast if the operand size is beyond the supported limit void postorder(const IR::Operation_Unary *unop) override { if (unop->is()) return; + if (unop->is()) { + if (auto src1Type = unop->expr->type->to()) { + if (src1Type->width_bits() == 128) return; + } + } isValidOperandSize(unop->expr); } diff --git a/backends/dpdk/dpdkHelpers.cpp b/backends/dpdk/dpdkHelpers.cpp index 79d2475a2d0..c3a1f18a7fe 100644 --- a/backends/dpdk/dpdkHelpers.cpp +++ b/backends/dpdk/dpdkHelpers.cpp @@ -37,9 +37,17 @@ void ConvertStatementToDpdk::process_relation_operation(const IR::Expression *ds cstring label2 = true_label; bool condNegated = false; if (op->is()) { - add_instr(new IR::DpdkJmpEqualStatement(true_label, op->left, op->right)); + if (checkIf128bitOp(op->left, op->right)) { + add128ComparisonInstr(true_label, op->left, op->right, "equ"); + } else { + add_instr(new IR::DpdkJmpEqualStatement(true_label, op->left, op->right)); + } } else if (op->is()) { - add_instr(new IR::DpdkJmpNotEqualStatement(true_label, op->left, op->right)); + if (checkIf128bitOp(op->left, op->right)) { + add128ComparisonInstr(true_label, op->left, op->right, "neq"); + } else { + add_instr(new IR::DpdkJmpNotEqualStatement(true_label, op->left, op->right)); + } } else if (op->is()) { add_instr(new IR::DpdkJmpLessStatement(true_label, op->left, op->right)); } else if (op->is()) { @@ -212,11 +220,20 @@ bool ConvertStatementToDpdk::preorder(const IR::AssignmentStatement *a) { } else if (right->is() || right->is()) { process_logical_operation(left, r); } else if (right->is()) { - add_instr(new IR::DpdkOrStatement(left, src1Op, src2Op)); + if (checkIf128bitOp(src1Op, src2Op)) + add128bitwiseInstr(src1Op, src2Op, "or"); + else + add_instr(new IR::DpdkOrStatement(left, src1Op, src2Op)); } else if (right->is()) { - add_instr(new IR::DpdkAndStatement(left, src1Op, src2Op)); + if (checkIf128bitOp(src1Op, src2Op)) + add128bitwiseInstr(src1Op, src2Op, "and"); + else + add_instr(new IR::DpdkAndStatement(left, src1Op, src2Op)); } else if (right->is()) { - add_instr(new IR::DpdkXorStatement(left, src1Op, src2Op)); + if (checkIf128bitOp(src1Op, src2Op)) + add128bitwiseInstr(src1Op, src2Op, "xor"); + else + add_instr(new IR::DpdkXorStatement(left, src1Op, src2Op)); } else if (right->is()) { add_instr(new IR::DpdkMovStatement(a->left, a->right)); } else { @@ -581,14 +598,18 @@ bool ConvertStatementToDpdk::preorder(const IR::AssignmentStatement *a) { "Negate operation is only supported on BIT types"); return false; } - BUG_CHECK(metadataStruct, "Metadata structure missing unexpectedly!"); - IR::ID tmpxor(refmap->newName("tmpxor")); - auto xor1 = new IR::Member(new IR::PathExpression("m"), tmpxor); - metadataStruct->fields.push_back(new IR::StructField(tmpxor, n->expr->type)); - add_instr(new IR::DpdkMovStatement( - xor1, new IR::Constant(Util::mask(n->expr->type->width_bits())))); - add_instr(new IR::DpdkXorStatement(xor1, xor1, n->expr)); - i = new IR::DpdkMovStatement(left, xor1); + if (n->expr->type->to()->width_bits() == 128) { + add128bitComplInstr(left, n->expr); + } else { + BUG_CHECK(metadataStruct, "Metadata structure missing unexpectedly!"); + IR::ID tmpxor(refmap->newName("tmpxor")); + auto xor1 = new IR::Member(new IR::PathExpression("m"), tmpxor); + metadataStruct->fields.push_back(new IR::StructField(tmpxor, n->expr->type)); + add_instr(new IR::DpdkMovStatement( + xor1, new IR::Constant(Util::mask(n->expr->type->width_bits())))); + add_instr(new IR::DpdkXorStatement(xor1, xor1, n->expr)); + i = new IR::DpdkMovStatement(left, xor1); + } } else if (auto ln = right->to()) { /* DPDK target does not support storing result of logical NOT operation. Hence we convert the expression var = !a into if-else statement. @@ -800,7 +821,7 @@ bool BranchingInstructionGeneration::generate(const IR::Expression *expr, cstrin // fall through depends on the return value of recursion for right side. if (nested(land->left) && nested(land->right)) { generate(land->left, true_label + "half", false_label, true); - instructions.push_back(new IR::DpdkLabelStatement(true_label + "half")); + convert->instructions.push_back(new IR::DpdkLabelStatement(true_label + "half")); return generate(land->right, true_label, false_label, true); } else if (!nested(land->left) && nested(land->right)) { // Second, left is simple and right is nested. Call recursion for the @@ -824,7 +845,7 @@ bool BranchingInstructionGeneration::generate(const IR::Expression *expr, cstrin // is chance to eliminate the jmp instruction I just added. generate(land->left, true_label, false_label, true); generate(land->right, true_label, false_label, true); - instructions.push_back(new IR::DpdkJmpLabelStatement(true_label)); + convert->instructions.push_back(new IR::DpdkJmpLabelStatement(true_label)); return true; } else { BUG("Previous simple expression lifting pass failed"); @@ -832,7 +853,7 @@ bool BranchingInstructionGeneration::generate(const IR::Expression *expr, cstrin } else if (auto lor = expr->to()) { if (nested(lor->left) && nested(lor->right)) { generate(lor->left, true_label, false_label + "half", false); - instructions.push_back(new IR::DpdkLabelStatement(false_label + "half")); + convert->instructions.push_back(new IR::DpdkLabelStatement(false_label + "half")); return generate(lor->right, true_label, false_label, false); } else if (!nested(lor->left) && nested(lor->right)) { generate(lor->left, true_label, false_label, false); @@ -840,7 +861,7 @@ bool BranchingInstructionGeneration::generate(const IR::Expression *expr, cstrin } else if (!nested(lor->left) && !nested(lor->right)) { generate(lor->left, true_label, false_label, false); generate(lor->right, true_label, false_label, false); - instructions.push_back(new IR::DpdkJmpLabelStatement(false_label)); + convert->instructions.push_back(new IR::DpdkJmpLabelStatement(false_label)); return false; } else { BUG("Previous simple expression lifting pass failed"); @@ -857,51 +878,71 @@ bool BranchingInstructionGeneration::generate(const IR::Expression *expr, cstrin // through. And finally for a base case, it returns what condition it falls // through. if (is_and) { - instructions.push_back( - new IR::DpdkJmpNotEqualStatement(false_label, equ->left, equ->right)); + if (convert->checkIf128bitOp(equ->left, equ->right)) { + convert->add128ComparisonInstr(false_label, equ->left, equ->right, "neq"); + } else { + convert->instructions.push_back( + new IR::DpdkJmpNotEqualStatement(false_label, equ->left, equ->right)); + } } else { - instructions.push_back( - new IR::DpdkJmpEqualStatement(true_label, equ->left, equ->right)); + if (convert->checkIf128bitOp(equ->left, equ->right)) { + convert->add128ComparisonInstr(true_label, equ->left, equ->right, "equ"); + } else { + convert->instructions.push_back( + new IR::DpdkJmpEqualStatement(true_label, equ->left, equ->right)); + } } return is_and; } else if (auto neq = expr->to()) { if (is_and) { - instructions.push_back( - new IR::DpdkJmpEqualStatement(false_label, neq->left, neq->right)); + if (convert->checkIf128bitOp(neq->left, neq->right)) { + convert->add128ComparisonInstr(false_label, neq->left, neq->right, "equ"); + } else { + convert->instructions.push_back( + new IR::DpdkJmpEqualStatement(false_label, neq->left, neq->right)); + } } else { - instructions.push_back( - new IR::DpdkJmpNotEqualStatement(true_label, neq->left, neq->right)); + if (convert->checkIf128bitOp(neq->left, neq->right)) { + convert->add128ComparisonInstr(true_label, neq->left, neq->right, "neq"); + } else { + convert->instructions.push_back( + new IR::DpdkJmpNotEqualStatement(true_label, neq->left, neq->right)); + } } return is_and; } else if (auto lss = expr->to()) { // Dpdk target does not support the negated condition Geq, // so always jump on true label. - instructions.push_back(new IR::DpdkJmpLessStatement(true_label, lss->left, lss->right)); + convert->instructions.push_back( + new IR::DpdkJmpLessStatement(true_label, lss->left, lss->right)); return false; } else if (auto grt = expr->to()) { // Dpdk target does not support the negated condition Leq, // so always jump on true label. - instructions.push_back(new IR::DpdkJmpGreaterStatement(true_label, grt->left, grt->right)); + convert->instructions.push_back( + new IR::DpdkJmpGreaterStatement(true_label, grt->left, grt->right)); return false; } else if (auto geq = expr->to()) { // Dpdk target does not support the condition Geq, // so always negate the condition and jump on false label. - instructions.push_back(new IR::DpdkJmpLessStatement(false_label, geq->left, geq->right)); + convert->instructions.push_back( + new IR::DpdkJmpLessStatement(false_label, geq->left, geq->right)); return true; } else if (auto leq = expr->to()) { // Dpdk target does not support the condition Leq, // so always negate the condition and jump on false label - instructions.push_back(new IR::DpdkJmpGreaterStatement(false_label, leq->left, leq->right)); + convert->instructions.push_back( + new IR::DpdkJmpGreaterStatement(false_label, leq->left, leq->right)); return true; } else if (auto mce = expr->to()) { auto mi = P4::MethodInstance::resolve(mce, refMap, typeMap); if (auto a = mi->to()) { if (a->name == "isValid") { if (is_and) { - instructions.push_back( + convert->instructions.push_back( new IR::DpdkJmpIfInvalidStatement(false_label, a->appliedTo)); } else { - instructions.push_back( + convert->instructions.push_back( new IR::DpdkJmpIfValidStatement(true_label, a->appliedTo)); } return is_and; @@ -913,10 +954,10 @@ bool BranchingInstructionGeneration::generate(const IR::Expression *expr, cstrin } } else if (expr->is()) { if (is_and) { - instructions.push_back( + convert->instructions.push_back( new IR::DpdkJmpNotEqualStatement(false_label, expr, new IR::Constant(1))); } else { - instructions.push_back( + convert->instructions.push_back( new IR::DpdkJmpEqualStatement(true_label, expr, new IR::Constant(1))); } } else if (auto mem = expr->to()) { @@ -926,11 +967,14 @@ bool BranchingInstructionGeneration::generate(const IR::Expression *expr, cstrin if (a->isTableApply()) { if (mem->member == IR::Type_Table::hit) { auto tbl = a->object->to(); - instructions.push_back(new IR::DpdkApplyStatement(tbl->name.toString())); + convert->instructions.push_back( + new IR::DpdkApplyStatement(tbl->name.toString())); if (is_and) { - instructions.push_back(new IR::DpdkJmpMissStatement(false_label)); + convert->instructions.push_back( + new IR::DpdkJmpMissStatement(false_label)); } else { - instructions.push_back(new IR::DpdkJmpHitStatement(true_label)); + convert->instructions.push_back( + new IR::DpdkJmpHitStatement(true_label)); } } } else { @@ -941,10 +985,10 @@ bool BranchingInstructionGeneration::generate(const IR::Expression *expr, cstrin } } else { if (is_and) { - instructions.push_back( + convert->instructions.push_back( new IR::DpdkJmpNotEqualStatement(false_label, expr, new IR::Constant(1))); } else { - instructions.push_back( + convert->instructions.push_back( new IR::DpdkJmpEqualStatement(true_label, expr, new IR::Constant(1))); } } @@ -966,10 +1010,9 @@ bool ConvertStatementToDpdk::preorder(const IR::IfStatement *s) { auto true_label = refmap->newName("label_true"); auto false_label = refmap->newName("label_false"); auto end_label = refmap->newName("label_end"); - auto gen = new BranchingInstructionGeneration(refmap, typemap); + auto gen = new BranchingInstructionGeneration(this, refmap, typemap); bool res = gen->generate(s->condition, true_label, false_label, true); - instructions.append(gen->instructions); if (res == true) { add_instr(new IR::DpdkLabelStatement(true_label)); visit(s->ifTrue); @@ -1460,4 +1503,235 @@ bool ConvertStatementToDpdk::preorder(const IR::SwitchStatement *s) { return false; } +bool ConvertStatementToDpdk::checkIf128bitOp(const IR::Expression *src1Op, + const IR::Expression *src2Op) { + if (auto src1Type = src1Op->type->to()) { + if (src1Type->width_bits() == 128) { + if (auto src2Type = src2Op->type->to()) { + if (src2Type->width_bits() == 128) return true; + } + } + } + return false; +} + +void ConvertStatementToDpdk::add128bitwiseInstr(const IR::Expression *src1Op, + const IR::Expression *src2Op, const char *op) { + // check bool variable to check and create sandbox struct + // sandbox tmp variable creation + if (!createTmpVar) { + createTmpVar = true; + createTmpVarForSandbox(); + } + if (!createSandboxHeaderType) { + createSandboxHeaderType = true; + createSandboxHeader(); + } + const IR::Type_Header *Type_Header = nullptr; + const IR::Type_Header *Type_Tmp = nullptr; + for (auto header : structure->header_types) { + if (strcmp(header.first, "_p4c_sandbox_header_t") == 0) { + Type_Header = header.second; + } else if (strcmp(header.first, "_p4c_tmp128_t") == 0) { + Type_Tmp = header.second; + } + } + if (Type_Header == nullptr || Type_Tmp == nullptr) { + BUG("Header type not found"); + } + auto src1OpHeaderName = src1Op->toString(); + if (src1Op->is()) { + src1OpHeaderName = src1Op->to()->member.name; + } + auto tmpVarOpName = src1OpHeaderName + "_tmp"; + src1OpHeaderName = src1OpHeaderName + "_128"; + auto src1OpHeader = new IR::Declaration_Variable(src1OpHeaderName, Type_Header); + auto tmpVarOp = new IR::Declaration_Variable(tmpVarOpName, Type_Tmp); + auto src1OpHeaderInstance = new IR::DpdkHeaderInstance(src1OpHeader, Type_Header); + auto tmpVarOpInstance = new IR::DpdkHeaderInstance(tmpVarOp, Type_Tmp); + structure->addHeaderInstances(src1OpHeaderInstance); + structure->addHeaderInstances(tmpVarOpInstance); + auto src1OpUpper = + new IR::Member(new IR::PathExpression("h." + src1OpHeader->name), IR::ID("upper_half")); + auto src1OpLower = + new IR::Member(new IR::PathExpression("h." + src1OpHeader->name), IR::ID("lower_half")); + auto tmp = new IR::Member(new IR::PathExpression("h." + tmpVarOp->name), IR::ID("inter")); + add_instr(new IR::DpdkMovhStatement(src1OpUpper, src1Op)); + add_instr(new IR::DpdkMovStatement(src1OpLower, src1Op)); + if (src2Op->is()) { + add_instr(new IR::DpdkMovStatement(tmp, src1OpLower)); + if (strcmp(op, "xor") == 0) { + add_instr(new IR::DpdkXorStatement(tmp, tmp, src2Op)); + } else if (strcmp(op, "or") == 0) { + add_instr(new IR::DpdkOrStatement(tmp, tmp, src2Op)); + } else if (strcmp(op, "and") == 0) { + add_instr(new IR::DpdkAndStatement(tmp, tmp, src2Op)); + } + add_instr(new IR::DpdkMovStatement(src1Op, tmp)); + add_instr(new IR::DpdkMovStatement(tmp, src1OpUpper)); + if (strcmp(op, "xor") == 0) { + add_instr(new IR::DpdkXorStatement(tmp, tmp, src2Op)); + } else if (strcmp(op, "or") == 0) { + add_instr(new IR::DpdkOrStatement(tmp, tmp, src2Op)); + } else if (strcmp(op, "and") == 0) { + add_instr(new IR::DpdkAndStatement(tmp, tmp, src2Op)); + } + add_instr(new IR::DpdkMovhStatement(src1Op, tmp)); + } else { + auto src2OpHeaderName = src2Op->toString(); + if (src2Op->is()) { + src2OpHeaderName = src2Op->to()->member.name; + } + src2OpHeaderName = src2OpHeaderName + "_128"; + auto src2OpHeader = new IR::Declaration_Variable(src2OpHeaderName, Type_Header); + auto src2OpHeaderInstance = new IR::DpdkHeaderInstance(src2OpHeader, Type_Header); + structure->addHeaderInstances(src2OpHeaderInstance); + auto src2OpUpper = + new IR::Member(new IR::PathExpression("h." + src2OpHeader->name), IR::ID("upper_half")); + auto src2OpLower = + new IR::Member(new IR::PathExpression("h." + src2OpHeader->name), IR::ID("lower_half")); + add_instr(new IR::DpdkMovhStatement(src2OpUpper, src2Op)); + add_instr(new IR::DpdkMovStatement(src2OpLower, src2Op)); + add_instr(new IR::DpdkMovStatement(tmp, src1OpLower)); + if (strcmp(op, "xor") == 0) { + add_instr(new IR::DpdkXorStatement(tmp, tmp, src2OpLower)); + } else if (strcmp(op, "or") == 0) { + add_instr(new IR::DpdkOrStatement(tmp, tmp, src2OpLower)); + } else if (strcmp(op, "and") == 0) { + add_instr(new IR::DpdkAndStatement(tmp, tmp, src2OpLower)); + } + add_instr(new IR::DpdkMovStatement(src1Op, tmp)); + add_instr(new IR::DpdkMovStatement(tmp, src1OpUpper)); + if (strcmp(op, "xor") == 0) { + add_instr(new IR::DpdkXorStatement(tmp, tmp, src2OpUpper)); + } else if (strcmp(op, "or") == 0) { + add_instr(new IR::DpdkOrStatement(tmp, tmp, src2OpUpper)); + } else if (strcmp(op, "and") == 0) { + add_instr(new IR::DpdkAndStatement(tmp, tmp, src2OpUpper)); + } + add_instr(new IR::DpdkMovhStatement(src1Op, tmp)); + } +} + +void ConvertStatementToDpdk::createSandboxHeader() { + auto fields = new IR::IndexedVector; + fields->push_back(new IR::StructField("upper_half", IR::Type_Bits::get(64))); + fields->push_back(new IR::StructField("lower_half", IR::Type_Bits::get(64))); + const IR::Type_Header *headerStruct = + new IR::Type_Header(IR::ID("_p4c_sandbox_header_t"), *fields); + structure->header_types.emplace(cstring("_p4c_sandbox_header_t"), headerStruct); +} + +void ConvertStatementToDpdk::createTmpVarForSandbox() { + auto fields = new IR::IndexedVector; + fields->push_back(new IR::StructField("tmp", IR::Type_Bits::get(64))); + const IR::Type_Header *headerStruct = new IR::Type_Header(IR::ID("_p4c_tmp128_t"), *fields); + structure->header_types.emplace(cstring("_p4c_tmp128_t"), headerStruct); +} + +void ConvertStatementToDpdk::add128ComparisonInstr(cstring true_label, const IR::Expression *src1Op, + const IR::Expression *src2Op, const char *op) { + if (!createSandboxHeaderType) { + createSandboxHeaderType = true; + createSandboxHeader(); + } + const IR::Type_Header *Type_Header = nullptr; + for (auto header : structure->header_types) { + if (strcmp(header.first, "_p4c_sandbox_header_t") == 0) { + Type_Header = header.second; + } + } + if (Type_Header == nullptr) { + BUG("Header type not found"); + } + auto src1OpHeaderName = src1Op->toString(); + if (src1Op->is()) { + src1OpHeaderName = src1Op->to()->member.name; + } + src1OpHeaderName = src1OpHeaderName + "_128"; + auto src1OpHeader = new IR::Declaration_Variable(src1OpHeaderName, Type_Header); + auto src1OpHeaderInstance = new IR::DpdkHeaderInstance(src1OpHeader, Type_Header); + structure->addHeaderInstances(src1OpHeaderInstance); + auto src1OpUpper = + new IR::Member(new IR::PathExpression("h." + src1OpHeader->name), IR::ID("upper_half")); + auto src1OpLower = + new IR::Member(new IR::PathExpression("h." + src1OpHeader->name), IR::ID("lower_half")); + add_instr(new IR::DpdkMovhStatement(src1OpUpper, src1Op)); + add_instr(new IR::DpdkMovStatement(src1OpLower, src1Op)); + if (src2Op->is()) { + add_instr(new IR::DpdkXorStatement(src1OpUpper, src1OpUpper, src2Op)); + add_instr(new IR::DpdkXorStatement(src1OpLower, src1OpLower, src2Op)); + } else { + auto src2OpHeaderName = src2Op->toString(); + if (src2Op->is()) { + src2OpHeaderName = src2Op->to()->member.name; + } + src2OpHeaderName = src2OpHeaderName + "_128"; + auto src2OpHeader = new IR::Declaration_Variable(src2OpHeaderName, Type_Header); + auto src2OpHeaderInstance = new IR::DpdkHeaderInstance(src2OpHeader, Type_Header); + structure->addHeaderInstances(src2OpHeaderInstance); + auto src2OpUpper = + new IR::Member(new IR::PathExpression("h." + src2OpHeader->name), IR::ID("upper_half")); + auto src2OpLower = + new IR::Member(new IR::PathExpression("h." + src2OpHeader->name), IR::ID("lower_half")); + add_instr(new IR::DpdkMovhStatement(src2OpUpper, src2Op)); + add_instr(new IR::DpdkMovStatement(src2OpLower, src2Op)); + add_instr(new IR::DpdkXorStatement(src1OpUpper, src1OpUpper, src2OpUpper)); + add_instr(new IR::DpdkXorStatement(src1OpLower, src1OpLower, src2OpLower)); + } + add_instr(new IR::DpdkXorStatement(src1OpUpper, src1OpUpper, src1OpLower)); + if (strcmp(op, "equ") == 0) { + add_instr(new IR::DpdkJmpEqualStatement(true_label, src1OpUpper, new IR::Constant(0))); + } else { + add_instr(new IR::DpdkJmpNotEqualStatement(true_label, src1OpUpper, new IR::Constant(0))); + } +} + +void ConvertStatementToDpdk::add128bitComplInstr(const IR::Expression *dst, + const IR::Expression *src1Op) { + if (!createTmpVar) { + createTmpVar = true; + createTmpVarForSandbox(); + } + if (!createSandboxHeaderType) { + createSandboxHeaderType = true; + createSandboxHeader(); + } + const IR::Type_Header *Type_Header = nullptr; + const IR::Type_Header *Type_Tmp = nullptr; + for (auto header : structure->header_types) { + if (strcmp(header.first, "_p4c_sandbox_header_t") == 0) { + Type_Header = header.second; + } else if (strcmp(header.first, "_p4c_tmp128_t") == 0) { + Type_Tmp = header.second; + } + } + if (Type_Header == nullptr || Type_Tmp == nullptr) { + BUG("Header type not found"); + } + auto src1OpHeaderName = src1Op->toString(); + if (src1Op->is()) { + src1OpHeaderName = src1Op->to()->member.name; + } + auto tmpVarOpName = src1OpHeaderName + "_tmp"; + src1OpHeaderName = src1OpHeaderName + "_128"; + auto src1OpHeader = new IR::Declaration_Variable(src1OpHeaderName, Type_Header); + auto tmpVarOp = new IR::Declaration_Variable(tmpVarOpName, Type_Tmp); + auto src1OpHeaderInstance = new IR::DpdkHeaderInstance(src1OpHeader, Type_Header); + auto tmpVarOpInstance = new IR::DpdkHeaderInstance(tmpVarOp, Type_Tmp); + structure->addHeaderInstances(src1OpHeaderInstance); + structure->addHeaderInstances(tmpVarOpInstance); + auto src1OpUpper = + new IR::Member(new IR::PathExpression("h." + src1OpHeader->name), IR::ID("upper_half")); + auto src1OpLower = + new IR::Member(new IR::PathExpression("h." + src1OpHeader->name), IR::ID("lower_half")); + auto tmp = new IR::Member(new IR::PathExpression("h." + tmpVarOp->name), IR::ID("inter")); + add_instr(new IR::DpdkMovhStatement(src1OpUpper, src1Op)); + add_instr(new IR::DpdkMovStatement(src1OpLower, src1Op)); + add_instr(new IR::DpdkMovStatement(tmp, new IR::Constant(Util::mask(64)))); + add_instr(new IR::DpdkXorStatement(src1OpLower, src1OpLower, tmp)); + add_instr(new IR::DpdkXorStatement(src1OpUpper, src1OpUpper, tmp)); + add_instr(new IR::DpdkMovStatement(dst, src1OpLower)); + add_instr(new IR::DpdkMovhStatement(dst, src1OpUpper)); +} } // namespace P4::DPDK diff --git a/backends/dpdk/dpdkHelpers.h b/backends/dpdk/dpdkHelpers.h index 91d1cafdf1e..7e9979179b3 100644 --- a/backends/dpdk/dpdkHelpers.h +++ b/backends/dpdk/dpdkHelpers.h @@ -37,6 +37,8 @@ limitations under the License. namespace P4::DPDK { +class ConvertStatementToDpdk; + /// @brief Name of the metadata used as output port. /// /// PNA specification does not contain standard metadata for specifying output port. @@ -115,6 +117,7 @@ const char DirectResourceTableEntryIndex[] = "table_entry_index"; * optmized. */ class BranchingInstructionGeneration { + ConvertStatementToDpdk *convert; P4::ReferenceMap *refMap; P4::TypeMap *typeMap; bool nested(const IR::Node *n) { @@ -126,9 +129,9 @@ class BranchingInstructionGeneration { } public: - IR::IndexedVector instructions; - BranchingInstructionGeneration(P4::ReferenceMap *refMap, P4::TypeMap *typeMap) - : refMap(refMap), typeMap(typeMap) {} + BranchingInstructionGeneration(ConvertStatementToDpdk *convert, P4::ReferenceMap *refMap, + P4::TypeMap *typeMap) + : convert(convert), refMap(refMap), typeMap(typeMap) {} bool generate(const IR::Expression *, cstring, cstring, bool); }; @@ -150,6 +153,8 @@ class ConvertStatementToDpdk : public Inspector { const IR::P4Parser *parser = nullptr; const IR::Node *parent = nullptr; IR::Type_Struct *metadataStruct = nullptr; + bool createSandboxHeaderType = false; + bool createTmpVar = false; private: void processHashParams(const IR::Argument *field, IR::Vector &components); @@ -157,6 +162,9 @@ class ConvertStatementToDpdk : public Inspector { void updateMdStrAndGenInstr(const IR::Argument *field, IR::Vector &components); cstring getHdrMdStrName(const IR::Member *mem); bool checkIfConsecutiveHdrMdfields(const IR::Argument *field); + void createSandboxHeader(); + void createTmpVarForSandbox(); + friend class BranchingInstructionGeneration; public: ConvertStatementToDpdk(P4::ReferenceMap *refmap, P4::TypeMap *typemap, @@ -185,8 +193,13 @@ class ConvertStatementToDpdk : public Inspector { void set_parser(const IR::P4Parser *p) { parser = p; } void set_parent(const IR::Node *p) { parent = p; } bool handleConstSwitch(const IR::SwitchStatement *a); + bool checkIf128bitOp(const IR::Expression *, const IR::Expression *); + void add128bitwiseInstr(const IR::Expression *src1Op, const IR::Expression *src2Op, + const char *op); + void add128ComparisonInstr(cstring true_label, const IR::Expression *src1Op, + const IR::Expression *src2Op, const char *op); + void add128bitComplInstr(const IR::Expression *, const IR::Expression *); }; - /// Only simplify complex expression in ingress/egress. class ProcessControls : public P4::RemoveComplexExpressionsPolicy { const std::set *process; diff --git a/backends/dpdk/dpdkProgram.cpp b/backends/dpdk/dpdkProgram.cpp index 3896a35f4e8..a9eb18878d4 100644 --- a/backends/dpdk/dpdkProgram.cpp +++ b/backends/dpdk/dpdkProgram.cpp @@ -238,8 +238,15 @@ const IR::DpdkAsmProgram *ConvertToDpdkProgram::create(IR::P4Program *prog) { learners.append(egress_converter->getLearners()); } - return new IR::DpdkAsmProgram(headerType, structType, dpdkExternDecls, actions, tables, - selectors, learners, statements, structure->get_globals()); + IR::IndexedVector headerInstances; + + for (auto it : structure->header_instances) { + headerInstances.push_back(it.second); + } + + return new IR::DpdkAsmProgram(headerType, structType, headerInstances, dpdkExternDecls, actions, + tables, selectors, learners, statements, + structure->get_globals()); } const IR::Node *ConvertToDpdkProgram::preorder(IR::P4Program *prog) { diff --git a/backends/dpdk/dpdkProgramStructure.h b/backends/dpdk/dpdkProgramStructure.h index 85fbedfb008..cada579d022 100644 --- a/backends/dpdk/dpdkProgramStructure.h +++ b/backends/dpdk/dpdkProgramStructure.h @@ -36,6 +36,7 @@ struct DpdkProgramStructure { ordered_map learner_action_table; ordered_map table_type_map; ordered_map direct_resource_map; + ordered_map header_instances; IR::IndexedVector variables; @@ -70,6 +71,12 @@ struct DpdkProgramStructure { void push_variable(const IR::DpdkDeclaration *d) { variables.push_back(d); } IR::IndexedVector &get_globals() { return variables; } + void addHeaderInstances(const IR::DpdkHeaderInstance *d) { + if (header_instances.find(d->name->toString()) == header_instances.end()) { + header_instances.emplace(d->name->toString(), d); + } + } + bool hasVisited(const IR::Type_StructLike *st) { if (auto h = st->to()) return header_types.count(h->getName()); diff --git a/backends/dpdk/spec.cpp b/backends/dpdk/spec.cpp index 60510233515..60083e567c4 100644 --- a/backends/dpdk/spec.cpp +++ b/backends/dpdk/spec.cpp @@ -36,6 +36,10 @@ std::ostream &IR::DpdkAsmProgram::toSpec(std::ostream &out) const { add_comment(out, s->name.toString()); s->toSpec(out) << std::endl; } + for (auto hi : headerInstance) { + add_comment(out, hi->name->toString()); + hi->toSpec(out) << std::endl; + } for (auto s : externDeclarations) { add_comment(out, s->name.toString()); s->toSpec(out); @@ -213,6 +217,11 @@ std::ostream &IR::DpdkHeaderType::toSpec(std::ostream &out) const { return out; } +std::ostream &IR::DpdkHeaderInstance::toSpec(std::ostream &out) const { + out << "header " << name->toString() << " instanceof " << headerType->toString(); + return out; +} + std::ostream &IR::DpdkStructType::toSpec(std::ostream &out) const { if (getAnnotations()->getSingle("__packet_data__"_cs)) { for (auto it = fields.begin(); it != fields.end(); ++it) { diff --git a/testdata/p4_16_dpdk_errors/dash-pipeline-pna-dpdk.p4 b/testdata/p4_16_dpdk_errors/dash-pipeline-pna-dpdk.p4 new file mode 100644 index 00000000000..93c0db4ff6b --- /dev/null +++ b/testdata/p4_16_dpdk_errors/dash-pipeline-pna-dpdk.p4 @@ -0,0 +1,1237 @@ +error { + IPv4IncorrectVersion, + IPv4OptionsNotSupported, + InvalidIPv4Header +} +#include +#include + +typedef bit<48> EthernetAddress; +typedef bit<32> IPv4Address; +typedef bit<128> IPv6Address; +typedef bit<128> IPv4ORv6Address; +header ethernet_t { + EthernetAddress dst_addr; + EthernetAddress src_addr; + bit<16> ether_type; +} + +const bit<16> ETHER_HDR_SIZE = 112 / 8; +header ipv4_t { + bit<4> version; + bit<4> ihl; + bit<8> diffserv; + bit<16> total_len; + bit<16> identification; + bit<3> flags; + bit<13> frag_offset; + bit<8> ttl; + bit<8> protocol; + bit<16> hdr_checksum; + IPv4Address src_addr; + IPv4Address dst_addr; +} + +const bit<16> IPV4_HDR_SIZE = 160 / 8; +header ipv4options_t { + varbit<320> options; +} + +header udp_t { + bit<16> src_port; + bit<16> dst_port; + bit<16> length; + bit<16> checksum; +} + +const bit<16> UDP_HDR_SIZE = 64 / 8; +header vxlan_t { + bit<8> flags; + bit<24> reserved; + bit<24> vni; + bit<8> reserved_2; +} + +const bit<16> VXLAN_HDR_SIZE = 64 / 8; +header nvgre_t { + bit<4> flags; + bit<9> reserved; + bit<3> version; + bit<16> protocol_type; + bit<24> vsid; + bit<8> flow_id; +} + +const bit<16> NVGRE_HDR_SIZE = 64 / 8; +header tcp_t { + bit<16> src_port; + bit<16> dst_port; + bit<32> seq_no; + bit<32> ack_no; + bit<4> data_offset; + bit<3> res; + bit<3> ecn; + bit<6> flags; + bit<16> window; + bit<16> checksum; + bit<16> urgent_ptr; +} + +const bit<16> TCP_HDR_SIZE = 160 / 8; +header ipv6_t { + bit<4> version; + bit<8> traffic_class; + bit<20> flow_label; + bit<16> payload_length; + bit<8> next_header; + bit<8> hop_limit; + IPv6Address src_addr; + IPv6Address dst_addr; +} + +const bit<16> IPV6_HDR_SIZE = 320 / 8; +struct headers_t { + ethernet_t u1_ethernet; + ipv4_t u1_ipv4; + ipv4options_t u1_ipv4options; + ipv6_t u1_ipv6; + udp_t u1_udp; + tcp_t u1_tcp; + vxlan_t u1_vxlan; + nvgre_t u1_nvgre; + ethernet_t u0_ethernet; + ipv4_t u0_ipv4; + ipv4options_t u0_ipv4options; + ipv6_t u0_ipv6; + udp_t u0_udp; + tcp_t u0_tcp; + vxlan_t u0_vxlan; + nvgre_t u0_nvgre; + ethernet_t customer_ethernet; + ipv4_t customer_ipv4; + ipv6_t customer_ipv6; + udp_t customer_udp; + tcp_t customer_tcp; +} + +enum bit<16> dash_encapsulation_t { + INVALID = 0, + VXLAN = 1, + NVGRE = 2 +} + +enum bit<32> dash_routing_actions_t { + NONE = 0, + STATIC_ENCAP = 1 << 0, + NAT46 = 1 << 1, + NAT64 = 1 << 2 +} + +enum bit<16> dash_direction_t { + INVALID = 0, + OUTBOUND = 1, + INBOUND = 2 +} + +enum bit<16> dash_pipeline_stage_t { + INVALID = 0, + INBOUND_STAGE_START = 100, + OUTBOUND_STAGE_START = 200, + OUTBOUND_ROUTING = 200, + OUTBOUND_MAPPING = 201, + ROUTING_ACTION_APPLY = 300 +} + +struct conntrack_data_t { + bool allow_in; + bool allow_out; +} + +enum bit<16> dash_tunnel_dscp_mode_t { + PRESERVE_MODEL = 0, + PIPE_MODEL = 1 +} + +struct eni_data_t { + bit<32> cps; + bit<32> pps; + bit<32> flows; + bit<1> admin_state; + IPv6Address pl_sip; + IPv6Address pl_sip_mask; + IPv4Address pl_underlay_sip; + bit<6> dscp; + dash_tunnel_dscp_mode_t dscp_mode; +} + +struct encap_data_t { + bit<24> vni; + bit<24> dest_vnet_vni; + IPv4Address underlay_sip; + IPv4Address underlay_dip; + EthernetAddress underlay_smac; + EthernetAddress underlay_dmac; + dash_encapsulation_t dash_encapsulation; +} + +struct overlay_rewrite_data_t { + bool is_ipv6; + EthernetAddress dmac; + IPv4ORv6Address sip; + IPv4ORv6Address dip; + IPv6Address sip_mask; + IPv6Address dip_mask; +} + +struct metadata_t { + dash_direction_t direction; + EthernetAddress eni_addr; + bit<16> vnet_id; + bit<16> dst_vnet_id; + bit<16> eni_id; + eni_data_t eni_data; + bit<16> inbound_vm_id; + bit<8> appliance_id; + bit<1> is_overlay_ip_v6; + bit<1> is_lkup_dst_ip_v6; + bit<8> ip_protocol; + IPv4ORv6Address dst_ip_addr; + IPv4ORv6Address src_ip_addr; + IPv4ORv6Address lkup_dst_ip_addr; + conntrack_data_t conntrack_data; + bit<16> src_l4_port; + bit<16> dst_l4_port; + bit<16> stage1_dash_acl_group_id; + bit<16> stage2_dash_acl_group_id; + bit<16> stage3_dash_acl_group_id; + bit<16> stage4_dash_acl_group_id; + bit<16> stage5_dash_acl_group_id; + bit<1> meter_policy_en; + bit<1> mapping_meter_class_override; + bit<16> meter_policy_id; + bit<16> policy_meter_class; + bit<16> route_meter_class; + bit<16> mapping_meter_class; + bit<16> meter_class; + bit<32> meter_bucket_index; + bit<16> tunnel_pointer; + bool is_fast_path_icmp_flow_redirection_packet; + bit<1> fast_path_icmp_flow_redirection_disabled; + dash_pipeline_stage_t target_stage; + bit<32> routing_actions; + bool dropped; + encap_data_t encap_data; + overlay_rewrite_data_t overlay_data; +} + +parser dash_parser(packet_in packet, out headers_t hd, inout metadata_t meta, in pna_main_parser_input_metadata_t istd) { + state start { + packet.extract(hd.u0_ethernet); + transition select(hd.u0_ethernet.ether_type) { + 0x800: parse_u0_ipv4; + 0x86dd: parse_u0_ipv6; + default: accept; + } + } + state parse_u0_ipv4 { + packet.extract(hd.u0_ipv4); + verify(hd.u0_ipv4.version == 4w4, error.IPv4IncorrectVersion); + verify(hd.u0_ipv4.ihl >= 5, error.InvalidIPv4Header); + transition select(hd.u0_ipv4.ihl) { + 5: dispatch_on_u0_protocol; + default: parse_u0_ipv4options; + } + } + state parse_u0_ipv4options { + packet.extract(hd.u0_ipv4options, (bit<32>)(((bit<16>)hd.u0_ipv4.ihl - 5) * 32)); + transition dispatch_on_u0_protocol; + } + state dispatch_on_u0_protocol { + transition select(hd.u0_ipv4.protocol) { + 17: parse_u0_udp; + 6: parse_u0_tcp; + default: accept; + } + } + state parse_u0_ipv6 { + packet.extract(hd.u0_ipv6); + transition select(hd.u0_ipv6.next_header) { + 17: parse_u0_udp; + 6: parse_u0_tcp; + default: accept; + } + } + state parse_u0_udp { + packet.extract(hd.u0_udp); + transition select(hd.u0_udp.dst_port) { + 4789: parse_u0_vxlan; + default: accept; + } + } + state parse_u0_tcp { + packet.extract(hd.u0_tcp); + transition accept; + } + state parse_u0_vxlan { + packet.extract(hd.u0_vxlan); + transition parse_customer_ethernet; + } + state parse_customer_ethernet { + packet.extract(hd.customer_ethernet); + transition select(hd.customer_ethernet.ether_type) { + 0x800: parse_customer_ipv4; + 0x86dd: parse_customer_ipv6; + default: accept; + } + } + state parse_customer_ipv4 { + packet.extract(hd.customer_ipv4); + verify(hd.customer_ipv4.version == 4w4, error.IPv4IncorrectVersion); + verify(hd.customer_ipv4.ihl == 4w5, error.IPv4OptionsNotSupported); + transition select(hd.customer_ipv4.protocol) { + 17: parse_customer_udp; + 6: parse_customer_tcp; + default: accept; + } + } + state parse_customer_ipv6 { + packet.extract(hd.customer_ipv6); + transition select(hd.customer_ipv6.next_header) { + 17: parse_customer_udp; + 6: parse_customer_tcp; + default: accept; + } + } + state parse_customer_tcp { + packet.extract(hd.customer_tcp); + transition accept; + } + state parse_customer_udp { + packet.extract(hd.customer_udp); + transition accept; + } +} + +control dash_deparser(packet_out packet, in headers_t hdr, in metadata_t meta, in pna_main_output_metadata_t ostd) { + apply { + packet.emit(hdr.u0_ethernet); + packet.emit(hdr.u0_ipv4); + packet.emit(hdr.u0_ipv4options); + packet.emit(hdr.u0_ipv6); + packet.emit(hdr.u0_udp); + packet.emit(hdr.u0_tcp); + packet.emit(hdr.u0_vxlan); + packet.emit(hdr.u0_nvgre); + packet.emit(hdr.customer_ethernet); + packet.emit(hdr.customer_ipv4); + packet.emit(hdr.customer_ipv6); + packet.emit(hdr.customer_tcp); + packet.emit(hdr.customer_udp); + } +} + +action push_vxlan_tunnel_u0(inout headers_t hdr, in EthernetAddress overlay_dmac, in EthernetAddress underlay_dmac, in EthernetAddress underlay_smac, in IPv4Address underlay_dip, in IPv4Address underlay_sip, in bit<24> tunnel_key) { + hdr.customer_ethernet.dst_addr = overlay_dmac; + hdr.u0_ethernet.setValid(); + hdr.u0_ethernet.dst_addr = underlay_dmac; + hdr.u0_ethernet.src_addr = underlay_smac; + hdr.u0_ethernet.ether_type = 0x800; + hdr.u0_ipv4.setValid(); + bit<16> customer_ip_len = 0; + if (hdr.customer_ipv4.isValid()) { + customer_ip_len = customer_ip_len + hdr.customer_ipv4.total_len; + } + if (hdr.customer_ipv6.isValid()) { + customer_ip_len = customer_ip_len + IPV6_HDR_SIZE + hdr.customer_ipv6.payload_length; + } + hdr.u0_ipv4.total_len = ETHER_HDR_SIZE + IPV4_HDR_SIZE + UDP_HDR_SIZE + VXLAN_HDR_SIZE + customer_ip_len; + hdr.u0_ipv4.version = 4; + hdr.u0_ipv4.ihl = 5; + hdr.u0_ipv4.diffserv = 0; + hdr.u0_ipv4.identification = 1; + hdr.u0_ipv4.flags = 0; + hdr.u0_ipv4.frag_offset = 0; + hdr.u0_ipv4.ttl = 64; + hdr.u0_ipv4.protocol = 17; + hdr.u0_ipv4.dst_addr = underlay_dip; + hdr.u0_ipv4.src_addr = underlay_sip; + hdr.u0_ipv4.hdr_checksum = 0; + hdr.u0_udp.setValid(); + hdr.u0_udp.src_port = 0; + hdr.u0_udp.dst_port = 4789; + hdr.u0_udp.length = UDP_HDR_SIZE + VXLAN_HDR_SIZE + ETHER_HDR_SIZE + customer_ip_len; + hdr.u0_udp.checksum = 0; + hdr.u0_vxlan.setValid(); + hdr.u0_vxlan.reserved = 0; + hdr.u0_vxlan.reserved_2 = 0; + hdr.u0_vxlan.flags = 0; + hdr.u0_vxlan.vni = tunnel_key; +} +action push_vxlan_tunnel_u1(inout headers_t hdr, in EthernetAddress overlay_dmac, in EthernetAddress underlay_dmac, in EthernetAddress underlay_smac, in IPv4Address underlay_dip, in IPv4Address underlay_sip, in bit<24> tunnel_key) { + hdr.u0_ethernet.dst_addr = overlay_dmac; + hdr.u1_ethernet.setValid(); + hdr.u1_ethernet.dst_addr = underlay_dmac; + hdr.u1_ethernet.src_addr = underlay_smac; + hdr.u1_ethernet.ether_type = 0x800; + hdr.u1_ipv4.setValid(); + bit<16> u0_ip_len = 0; + if (hdr.u0_ipv4.isValid()) { + u0_ip_len = u0_ip_len + hdr.u0_ipv4.total_len; + } + if (hdr.u0_ipv6.isValid()) { + u0_ip_len = u0_ip_len + IPV6_HDR_SIZE + hdr.u0_ipv6.payload_length; + } + hdr.u1_ipv4.total_len = ETHER_HDR_SIZE + IPV4_HDR_SIZE + UDP_HDR_SIZE + VXLAN_HDR_SIZE + u0_ip_len; + hdr.u1_ipv4.version = 4; + hdr.u1_ipv4.ihl = 5; + hdr.u1_ipv4.diffserv = 0; + hdr.u1_ipv4.identification = 1; + hdr.u1_ipv4.flags = 0; + hdr.u1_ipv4.frag_offset = 0; + hdr.u1_ipv4.ttl = 64; + hdr.u1_ipv4.protocol = 17; + hdr.u1_ipv4.dst_addr = underlay_dip; + hdr.u1_ipv4.src_addr = underlay_sip; + hdr.u1_ipv4.hdr_checksum = 0; + hdr.u1_udp.setValid(); + hdr.u1_udp.src_port = 0; + hdr.u1_udp.dst_port = 4789; + hdr.u1_udp.length = UDP_HDR_SIZE + VXLAN_HDR_SIZE + ETHER_HDR_SIZE + u0_ip_len; + hdr.u1_udp.checksum = 0; + hdr.u1_vxlan.setValid(); + hdr.u1_vxlan.reserved = 0; + hdr.u1_vxlan.reserved_2 = 0; + hdr.u1_vxlan.flags = 0; + hdr.u1_vxlan.vni = tunnel_key; +} +action push_nvgre_tunnel_u0(inout headers_t hdr, in EthernetAddress overlay_dmac, in EthernetAddress underlay_dmac, in EthernetAddress underlay_smac, in IPv4Address underlay_dip, in IPv4Address underlay_sip, in bit<24> tunnel_key) { + hdr.customer_ethernet.dst_addr = overlay_dmac; + hdr.u0_ethernet.setValid(); + hdr.u0_ethernet.dst_addr = underlay_dmac; + hdr.u0_ethernet.src_addr = underlay_smac; + hdr.u0_ethernet.ether_type = 0x800; + hdr.u0_ipv4.setValid(); + bit<16> customer_ip_len = 0; + if (hdr.customer_ipv4.isValid()) { + customer_ip_len = customer_ip_len + hdr.customer_ipv4.total_len; + } + if (hdr.customer_ipv6.isValid()) { + customer_ip_len = customer_ip_len + IPV6_HDR_SIZE + hdr.customer_ipv6.payload_length; + } + hdr.u0_ipv4.total_len = ETHER_HDR_SIZE + IPV4_HDR_SIZE + UDP_HDR_SIZE + NVGRE_HDR_SIZE + customer_ip_len; + hdr.u0_ipv4.total_len = ETHER_HDR_SIZE + IPV4_HDR_SIZE + NVGRE_HDR_SIZE + hdr.u0_ipv4.total_len; + hdr.u0_ipv4.version = 4; + hdr.u0_ipv4.ihl = 5; + hdr.u0_ipv4.diffserv = 0; + hdr.u0_ipv4.identification = 1; + hdr.u0_ipv4.flags = 0; + hdr.u0_ipv4.frag_offset = 0; + hdr.u0_ipv4.ttl = 64; + hdr.u0_ipv4.protocol = 0x2f; + hdr.u0_ipv4.dst_addr = underlay_dip; + hdr.u0_ipv4.src_addr = underlay_sip; + hdr.u0_ipv4.hdr_checksum = 0; + hdr.u0_nvgre.setValid(); + hdr.u0_nvgre.flags = 4; + hdr.u0_nvgre.reserved = 0; + hdr.u0_nvgre.version = 0; + hdr.u0_nvgre.protocol_type = 0x6558; + hdr.u0_nvgre.vsid = tunnel_key; + hdr.u0_nvgre.flow_id = 0; +} +action push_nvgre_tunnel_u1(inout headers_t hdr, in EthernetAddress overlay_dmac, in EthernetAddress underlay_dmac, in EthernetAddress underlay_smac, in IPv4Address underlay_dip, in IPv4Address underlay_sip, in bit<24> tunnel_key) { + hdr.u0_ethernet.dst_addr = overlay_dmac; + hdr.u1_ethernet.setValid(); + hdr.u1_ethernet.dst_addr = underlay_dmac; + hdr.u1_ethernet.src_addr = underlay_smac; + hdr.u1_ethernet.ether_type = 0x800; + hdr.u1_ipv4.setValid(); + bit<16> u0_ip_len = 0; + if (hdr.u0_ipv4.isValid()) { + u0_ip_len = u0_ip_len + hdr.u0_ipv4.total_len; + } + if (hdr.u0_ipv6.isValid()) { + u0_ip_len = u0_ip_len + IPV6_HDR_SIZE + hdr.u0_ipv6.payload_length; + } + hdr.u1_ipv4.total_len = ETHER_HDR_SIZE + IPV4_HDR_SIZE + UDP_HDR_SIZE + NVGRE_HDR_SIZE + u0_ip_len; + hdr.u1_ipv4.total_len = ETHER_HDR_SIZE + IPV4_HDR_SIZE + NVGRE_HDR_SIZE + hdr.u1_ipv4.total_len; + hdr.u1_ipv4.version = 4; + hdr.u1_ipv4.ihl = 5; + hdr.u1_ipv4.diffserv = 0; + hdr.u1_ipv4.identification = 1; + hdr.u1_ipv4.flags = 0; + hdr.u1_ipv4.frag_offset = 0; + hdr.u1_ipv4.ttl = 64; + hdr.u1_ipv4.protocol = 0x2f; + hdr.u1_ipv4.dst_addr = underlay_dip; + hdr.u1_ipv4.src_addr = underlay_sip; + hdr.u1_ipv4.hdr_checksum = 0; + hdr.u1_nvgre.setValid(); + hdr.u1_nvgre.flags = 4; + hdr.u1_nvgre.reserved = 0; + hdr.u1_nvgre.version = 0; + hdr.u1_nvgre.protocol_type = 0x6558; + hdr.u1_nvgre.vsid = tunnel_key; + hdr.u1_nvgre.flow_id = 0; +} +action tunnel_decap(inout headers_t hdr, inout metadata_t meta) { + hdr.u0_ethernet.setInvalid(); + hdr.u0_ipv4.setInvalid(); + hdr.u0_ipv6.setInvalid(); + hdr.u0_nvgre.setInvalid(); + hdr.u0_vxlan.setInvalid(); + hdr.u0_udp.setInvalid(); + meta.tunnel_pointer = 0; +} +match_kind { + list, + range_list +} + +control acl(inout headers_t hdr, inout metadata_t meta) { + action permit() { + } + action permit_and_continue() { + } + action deny() { + meta.dropped = true; + } + action deny_and_continue() { + meta.dropped = true; + } + @SaiTable[name="dash_acl_rule", stage="acl.stage1", api="dash_acl", isobject="true"] table stage1 { + key = { + meta.stage1_dash_acl_group_id: exact @SaiVal[name="dash_acl_group_id"]; + meta.dst_ip_addr : ternary @SaiVal[name="dip", type="sai_ip_prefix_list_t"]; + meta.src_ip_addr : ternary @SaiVal[name="sip", type="sai_ip_prefix_list_t"]; + meta.ip_protocol : ternary @SaiVal[name="protocol", type="sai_u8_list_t"]; + meta.src_l4_port : range @SaiVal[name="src_port", type="sai_u16_range_list_t"]; + meta.dst_l4_port : range @SaiVal[name="dst_port", type="sai_u16_range_list_t"]; + } + actions = { + permit; + permit_and_continue; + deny; + deny_and_continue; + } + default_action = deny; + } + @SaiTable[name="dash_acl_rule", stage="acl.stage2", api="dash_acl", isobject="true"] table stage2 { + key = { + meta.stage2_dash_acl_group_id: exact @SaiVal[name="dash_acl_group_id"]; + meta.dst_ip_addr : ternary @SaiVal[name="dip", type="sai_ip_prefix_list_t"]; + meta.src_ip_addr : ternary @SaiVal[name="sip", type="sai_ip_prefix_list_t"]; + meta.ip_protocol : ternary @SaiVal[name="protocol", type="sai_u8_list_t"]; + meta.src_l4_port : range @SaiVal[name="src_port", type="sai_u16_range_list_t"]; + meta.dst_l4_port : range @SaiVal[name="dst_port", type="sai_u16_range_list_t"]; + } + actions = { + permit; + permit_and_continue; + deny; + deny_and_continue; + } + default_action = deny; + } + @SaiTable[name="dash_acl_rule", stage="acl.stage3", api="dash_acl", isobject="true"] table stage3 { + key = { + meta.stage3_dash_acl_group_id: exact @SaiVal[name="dash_acl_group_id"]; + meta.dst_ip_addr : ternary @SaiVal[name="dip", type="sai_ip_prefix_list_t"]; + meta.src_ip_addr : ternary @SaiVal[name="sip", type="sai_ip_prefix_list_t"]; + meta.ip_protocol : ternary @SaiVal[name="protocol", type="sai_u8_list_t"]; + meta.src_l4_port : range @SaiVal[name="src_port", type="sai_u16_range_list_t"]; + meta.dst_l4_port : range @SaiVal[name="dst_port", type="sai_u16_range_list_t"]; + } + actions = { + permit; + permit_and_continue; + deny; + deny_and_continue; + } + default_action = deny; + } + apply { + if (meta.stage1_dash_acl_group_id != 0) { + switch (stage1.apply().action_run) { + permit: { + return; + } + deny: { + return; + } + } + } + if (meta.stage2_dash_acl_group_id != 0) { + switch (stage2.apply().action_run) { + permit: { + return; + } + deny: { + return; + } + } + } + if (meta.stage3_dash_acl_group_id != 0) { + switch (stage3.apply().action_run) { + permit: { + return; + } + deny: { + return; + } + } + } + } +} + +action push_action_static_encap(in headers_t hdr, inout metadata_t meta, in dash_encapsulation_t encap=dash_encapsulation_t.VXLAN, in bit<24> vni=0, in IPv4Address underlay_sip=0, in IPv4Address underlay_dip=0, in EthernetAddress underlay_smac=0, in EthernetAddress underlay_dmac=0, in EthernetAddress overlay_dmac=0) { + meta.routing_actions = meta.routing_actions | dash_routing_actions_t.STATIC_ENCAP; + meta.encap_data.dash_encapsulation = encap; + meta.encap_data.vni = (vni == 0 ? meta.encap_data.vni : vni); + meta.encap_data.underlay_smac = (underlay_smac == 0 ? meta.encap_data.underlay_smac : underlay_smac); + meta.encap_data.underlay_dmac = (underlay_dmac == 0 ? meta.encap_data.underlay_dmac : underlay_dmac); + meta.encap_data.underlay_sip = (underlay_sip == 0 ? meta.encap_data.underlay_sip : underlay_sip); + meta.encap_data.underlay_dip = (underlay_dip == 0 ? meta.encap_data.underlay_dip : underlay_dip); + meta.overlay_data.dmac = (overlay_dmac == 0 ? meta.overlay_data.dmac : overlay_dmac); +} +control do_action_static_encap(inout headers_t hdr, inout metadata_t meta) { + apply { + if (meta.routing_actions & dash_routing_actions_t.STATIC_ENCAP == 0) { + return; + } + if (meta.encap_data.dash_encapsulation == dash_encapsulation_t.VXLAN) { + if (meta.tunnel_pointer == 0) { + push_vxlan_tunnel_u0(hdr, meta.overlay_data.dmac, meta.encap_data.underlay_dmac, meta.encap_data.underlay_smac, meta.encap_data.underlay_dip, meta.encap_data.underlay_sip, meta.encap_data.vni); + } else if (meta.tunnel_pointer == 1) { + push_vxlan_tunnel_u1(hdr, meta.overlay_data.dmac, meta.encap_data.underlay_dmac, meta.encap_data.underlay_smac, meta.encap_data.underlay_dip, meta.encap_data.underlay_sip, meta.encap_data.vni); + } + } else if (meta.encap_data.dash_encapsulation == dash_encapsulation_t.NVGRE) { + if (meta.tunnel_pointer == 0) { + push_vxlan_tunnel_u0(hdr, meta.overlay_data.dmac, meta.encap_data.underlay_dmac, meta.encap_data.underlay_smac, meta.encap_data.underlay_dip, meta.encap_data.underlay_sip, meta.encap_data.vni); + } else if (meta.tunnel_pointer == 1) { + push_vxlan_tunnel_u1(hdr, meta.overlay_data.dmac, meta.encap_data.underlay_dmac, meta.encap_data.underlay_smac, meta.encap_data.underlay_dip, meta.encap_data.underlay_sip, meta.encap_data.vni); + } + } + meta.tunnel_pointer = meta.tunnel_pointer + 1; + } +} + +action push_action_nat46(in headers_t hdr, inout metadata_t meta, in IPv6Address sip, in IPv6Address sip_mask, in IPv6Address dip, in IPv6Address dip_mask) { + meta.routing_actions = meta.routing_actions | dash_routing_actions_t.NAT46; + meta.overlay_data.is_ipv6 = true; + meta.overlay_data.sip = sip; + meta.overlay_data.sip_mask = sip_mask; + meta.overlay_data.dip = dip; + meta.overlay_data.dip_mask = dip_mask; +} +control do_action_nat46(inout headers_t hdr, in metadata_t meta) { + apply { + if (meta.routing_actions & dash_routing_actions_t.NAT46 == 0) { + return; + } + ; + hdr.u0_ipv6.setValid(); + hdr.u0_ipv6.version = 6; + hdr.u0_ipv6.traffic_class = 0; + hdr.u0_ipv6.flow_label = 0; + hdr.u0_ipv6.payload_length = hdr.u0_ipv4.total_len - IPV4_HDR_SIZE; + hdr.u0_ipv6.next_header = hdr.u0_ipv4.protocol; + hdr.u0_ipv6.hop_limit = hdr.u0_ipv4.ttl; + hdr.u0_ipv6.dst_addr = (IPv6Address)hdr.u0_ipv4.dst_addr & ~meta.overlay_data.dip_mask | meta.overlay_data.dip & meta.overlay_data.dip_mask; + hdr.u0_ipv6.src_addr = (IPv6Address)hdr.u0_ipv4.src_addr & ~meta.overlay_data.sip_mask | meta.overlay_data.sip & meta.overlay_data.sip_mask; + hdr.u0_ipv4.setInvalid(); + hdr.u0_ethernet.ether_type = 0x86dd; + } +} + +action push_action_nat64(in headers_t hdr, inout metadata_t meta, in IPv4Address src, in IPv4Address dst) { + meta.routing_actions = meta.routing_actions | dash_routing_actions_t.NAT64; + meta.overlay_data.is_ipv6 = false; + meta.overlay_data.sip = (IPv4ORv6Address)src; + meta.overlay_data.dip = (IPv4ORv6Address)dst; +} +control do_action_nat64(inout headers_t hdr, in metadata_t meta) { + apply { + if (meta.routing_actions & dash_routing_actions_t.NAT64 == 0) { + return; + } + ; + hdr.u0_ipv4.setValid(); + hdr.u0_ipv4.version = 4; + hdr.u0_ipv4.ihl = 5; + hdr.u0_ipv4.diffserv = 0; + hdr.u0_ipv4.total_len = hdr.u0_ipv6.payload_length + IPV4_HDR_SIZE; + hdr.u0_ipv4.identification = 1; + hdr.u0_ipv4.flags = 0; + hdr.u0_ipv4.frag_offset = 0; + hdr.u0_ipv4.protocol = hdr.u0_ipv6.next_header; + hdr.u0_ipv4.ttl = hdr.u0_ipv6.hop_limit; + hdr.u0_ipv4.hdr_checksum = 0; + hdr.u0_ipv4.dst_addr = (IPv4Address)meta.overlay_data.dip; + hdr.u0_ipv4.src_addr = (IPv4Address)meta.overlay_data.sip; + hdr.u0_ipv6.setInvalid(); + hdr.u0_ethernet.ether_type = 0x800; + } +} + +action set_route_meter_attrs(inout metadata_t meta, bit<1> meter_policy_en, bit<16> meter_class) { + meta.meter_policy_en = meter_policy_en; + meta.route_meter_class = meter_class; +} +action set_mapping_meter_attr(inout metadata_t meta, in bit<16> meter_class, in bit<1> meter_class_override) { + meta.mapping_meter_class = meter_class; + meta.mapping_meter_class_override = meter_class_override; +} +action drop(inout metadata_t meta) { + meta.target_stage = dash_pipeline_stage_t.ROUTING_ACTION_APPLY; + meta.dropped = true; +} +action route_vnet(inout headers_t hdr, inout metadata_t meta, @SaiVal[type="sai_object_id_t"] bit<16> dst_vnet_id, bit<1> meter_policy_en, bit<16> meter_class) { + meta.target_stage = dash_pipeline_stage_t.OUTBOUND_MAPPING; + meta.dst_vnet_id = dst_vnet_id; + set_route_meter_attrs(meta, meter_policy_en, meter_class); +} +action route_vnet_direct(inout headers_t hdr, inout metadata_t meta, bit<16> dst_vnet_id, bit<1> overlay_ip_is_v6, @SaiVal[type="sai_ip_address_t"] IPv4ORv6Address overlay_ip, bit<1> meter_policy_en, bit<16> meter_class) { + meta.target_stage = dash_pipeline_stage_t.OUTBOUND_MAPPING; + meta.dst_vnet_id = dst_vnet_id; + meta.lkup_dst_ip_addr = overlay_ip; + meta.is_lkup_dst_ip_v6 = overlay_ip_is_v6; + set_route_meter_attrs(meta, meter_policy_en, meter_class); +} +action route_direct(inout headers_t hdr, inout metadata_t meta, bit<1> meter_policy_en, bit<16> meter_class) { + meta.target_stage = dash_pipeline_stage_t.ROUTING_ACTION_APPLY; + set_route_meter_attrs(meta, meter_policy_en, meter_class); +} +action route_service_tunnel(inout headers_t hdr, inout metadata_t meta, bit<1> overlay_dip_is_v6, IPv4ORv6Address overlay_dip, bit<1> overlay_dip_mask_is_v6, IPv4ORv6Address overlay_dip_mask, bit<1> overlay_sip_is_v6, IPv4ORv6Address overlay_sip, bit<1> overlay_sip_mask_is_v6, IPv4ORv6Address overlay_sip_mask, bit<1> underlay_dip_is_v6, IPv4ORv6Address underlay_dip, bit<1> underlay_sip_is_v6, IPv4ORv6Address underlay_sip, @SaiVal[type="sai_dash_encapsulation_t", default_value="SAI_DASH_ENCAPSULATION_VXLAN"] dash_encapsulation_t dash_encapsulation, bit<24> tunnel_key, bit<1> meter_policy_en, bit<16> meter_class) { + meta.target_stage = dash_pipeline_stage_t.ROUTING_ACTION_APPLY; + push_action_nat46(hdr = hdr, meta = meta, sip = overlay_sip, sip_mask = overlay_sip_mask, dip = overlay_dip, dip_mask = overlay_dip_mask); + push_action_static_encap(hdr = hdr, meta = meta, encap = dash_encapsulation, vni = tunnel_key, underlay_sip = (underlay_sip == 0 ? hdr.u0_ipv4.src_addr : (IPv4Address)underlay_sip), underlay_dip = (underlay_dip == 0 ? hdr.u0_ipv4.dst_addr : (IPv4Address)underlay_dip), overlay_dmac = hdr.u0_ethernet.dst_addr); + set_route_meter_attrs(meta, meter_policy_en, meter_class); +} +action set_tunnel_mapping(inout headers_t hdr, inout metadata_t meta, @SaiVal[type="sai_ip_address_t"] IPv4Address underlay_dip, EthernetAddress overlay_dmac, bit<1> use_dst_vnet_vni, bit<16> meter_class, bit<1> meter_class_override) { + meta.target_stage = dash_pipeline_stage_t.ROUTING_ACTION_APPLY; + if (use_dst_vnet_vni == 1) { + meta.vnet_id = meta.dst_vnet_id; + } + push_action_static_encap(hdr = hdr, meta = meta, underlay_dip = underlay_dip, overlay_dmac = overlay_dmac); + set_mapping_meter_attr(meta, meter_class, meter_class_override); +} +action set_private_link_mapping(inout headers_t hdr, inout metadata_t meta, @SaiVal[type="sai_ip_address_t"] IPv4Address underlay_dip, IPv6Address overlay_sip, IPv6Address overlay_dip, @SaiVal[type="sai_dash_encapsulation_t"] dash_encapsulation_t dash_encapsulation, bit<24> tunnel_key, bit<16> meter_class, bit<1> meter_class_override) { + meta.target_stage = dash_pipeline_stage_t.ROUTING_ACTION_APPLY; + push_action_static_encap(hdr = hdr, meta = meta, encap = dash_encapsulation, vni = tunnel_key, underlay_sip = meta.eni_data.pl_underlay_sip, underlay_dip = underlay_dip, overlay_dmac = hdr.u0_ethernet.dst_addr); + push_action_nat46(hdr = hdr, meta = meta, dip = overlay_dip, dip_mask = 0xffffffffffffffffffffffff, sip = overlay_sip & ~meta.eni_data.pl_sip_mask | meta.eni_data.pl_sip | (IPv6Address)hdr.u0_ipv4.src_addr, sip_mask = 0xffffffffffffffffffffffff); + set_mapping_meter_attr(meta, meter_class, meter_class_override); +} +control outbound_routing_stage(inout headers_t hdr, inout metadata_t meta) { + @SaiTable[name="outbound_routing", api="dash_outbound_routing"] table routing { + key = { + meta.eni_id : exact @SaiVal[type="sai_object_id_t"]; + meta.is_overlay_ip_v6: exact @SaiVal[name="destination_is_v6"]; + meta.dst_ip_addr : lpm @SaiVal[name="destination"]; + } + actions = { + route_vnet(hdr, meta); + route_vnet_direct(hdr, meta); + route_direct(hdr, meta); + route_service_tunnel(hdr, meta); + drop(meta); + } + const default_action = drop(meta); + } + apply { + if (meta.target_stage != dash_pipeline_stage_t.OUTBOUND_ROUTING) { + return; + } + routing.apply(); + } +} + +control outbound_mapping_stage(inout headers_t hdr, inout metadata_t meta) { + @SaiTable[name="outbound_ca_to_pa", api="dash_outbound_ca_to_pa"] table ca_to_pa { + key = { + meta.dst_vnet_id : exact @SaiVal[type="sai_object_id_t"]; + meta.is_lkup_dst_ip_v6: exact @SaiVal[name="dip_is_v6"]; + meta.lkup_dst_ip_addr : exact @SaiVal[name="dip"]; + } + actions = { + set_tunnel_mapping(hdr, meta); + set_private_link_mapping(hdr, meta); + @defaultonly drop(meta); + } + const default_action = drop(meta); + } + action set_vnet_attrs(bit<24> vni) { + meta.encap_data.vni = vni; + } + @SaiTable[name="vnet", api="dash_vnet", isobject="true"] table vnet { + key = { + meta.vnet_id: exact @SaiVal[type="sai_object_id_t"]; + } + actions = { + set_vnet_attrs; + } + } + apply { + if (meta.target_stage != dash_pipeline_stage_t.OUTBOUND_MAPPING) { + return; + } + switch (ca_to_pa.apply().action_run) { + set_tunnel_mapping: { + vnet.apply(); + } + } + } +} + +control outbound(inout headers_t hdr, inout metadata_t meta) { + apply { + if (!meta.conntrack_data.allow_out) { + acl.apply(hdr, meta); + } + meta.lkup_dst_ip_addr = meta.dst_ip_addr; + meta.is_lkup_dst_ip_v6 = meta.is_overlay_ip_v6; + outbound_routing_stage.apply(hdr, meta); + outbound_mapping_stage.apply(hdr, meta); + } +} + +action service_tunnel_encode(inout headers_t hdr, in IPv6Address st_dst, in IPv6Address st_dst_mask, in IPv6Address st_src, in IPv6Address st_src_mask) { + hdr.u0_ipv6.setValid(); + hdr.u0_ipv6.version = 6; + hdr.u0_ipv6.traffic_class = 0; + hdr.u0_ipv6.flow_label = 0; + hdr.u0_ipv6.payload_length = hdr.u0_ipv4.total_len - IPV4_HDR_SIZE; + hdr.u0_ipv6.next_header = hdr.u0_ipv4.protocol; + hdr.u0_ipv6.hop_limit = hdr.u0_ipv4.ttl; + hdr.u0_ipv6.dst_addr = (IPv6Address)hdr.u0_ipv4.dst_addr & ~st_dst_mask | st_dst & st_dst_mask; + hdr.u0_ipv6.src_addr = (IPv6Address)hdr.u0_ipv4.src_addr & ~st_src_mask | st_src & st_src_mask; + hdr.u0_ipv4.setInvalid(); + hdr.u0_ethernet.ether_type = 0x86dd; +} +action service_tunnel_decode(inout headers_t hdr, in IPv4Address src, in IPv4Address dst) { + hdr.u0_ipv4.setValid(); + hdr.u0_ipv4.version = 4; + hdr.u0_ipv4.ihl = 5; + hdr.u0_ipv4.diffserv = 0; + hdr.u0_ipv4.total_len = hdr.u0_ipv6.payload_length + IPV4_HDR_SIZE; + hdr.u0_ipv4.identification = 1; + hdr.u0_ipv4.flags = 0; + hdr.u0_ipv4.frag_offset = 0; + hdr.u0_ipv4.protocol = hdr.u0_ipv6.next_header; + hdr.u0_ipv4.ttl = hdr.u0_ipv6.hop_limit; + hdr.u0_ipv4.hdr_checksum = 0; + hdr.u0_ipv4.dst_addr = dst; + hdr.u0_ipv4.src_addr = src; + hdr.u0_ipv6.setInvalid(); + hdr.u0_ethernet.ether_type = 0x800; +} +control inbound(inout headers_t hdr, inout metadata_t meta) { + apply { + if (!meta.conntrack_data.allow_in) { + acl.apply(hdr, meta); + } + { + if (dash_encapsulation_t.VXLAN == dash_encapsulation_t.VXLAN) { + if (meta.tunnel_pointer == 0) { + push_vxlan_tunnel_u0(hdr, meta.overlay_data.dmac, meta.encap_data.underlay_dmac, meta.encap_data.underlay_smac, meta.encap_data.underlay_dip, meta.encap_data.underlay_sip, meta.encap_data.vni); + } else if (meta.tunnel_pointer == 1) { + push_vxlan_tunnel_u1(hdr, meta.overlay_data.dmac, meta.encap_data.underlay_dmac, meta.encap_data.underlay_smac, meta.encap_data.underlay_dip, meta.encap_data.underlay_sip, meta.encap_data.vni); + } + } else if (dash_encapsulation_t.VXLAN == dash_encapsulation_t.NVGRE) { + if (meta.tunnel_pointer == 0) { + push_nvgre_tunnel_u0(hdr, meta.overlay_data.dmac, meta.encap_data.underlay_dmac, meta.encap_data.underlay_smac, meta.encap_data.underlay_dip, meta.encap_data.underlay_sip, meta.encap_data.vni); + } else if (meta.tunnel_pointer == 1) { + push_nvgre_tunnel_u1(hdr, meta.overlay_data.dmac, meta.encap_data.underlay_dmac, meta.encap_data.underlay_smac, meta.encap_data.underlay_dip, meta.encap_data.underlay_sip, meta.encap_data.vni); + } + } + meta.tunnel_pointer = meta.tunnel_pointer + 1; + } + ; + } +} + +control direction_lookup_stage(inout headers_t hdr, inout metadata_t meta) { + action set_outbound_direction() { + meta.direction = dash_direction_t.OUTBOUND; + } + action set_inbound_direction() { + meta.direction = dash_direction_t.INBOUND; + } + @SaiTable[name="direction_lookup", api="dash_direction_lookup"] table direction_lookup { + key = { + hdr.u0_vxlan.vni: exact @SaiVal[name="VNI"]; + } + actions = { + set_outbound_direction; + @defaultonly set_inbound_direction; + } + const default_action = set_inbound_direction; + } + apply { + direction_lookup.apply(); + } +} + +control eni_lookup_stage(inout headers_t hdr, inout metadata_t meta) { + action set_eni(@SaiVal[type="sai_object_id_t"] bit<16> eni_id) { + meta.eni_id = eni_id; + } + action deny() { + meta.dropped = true; + } + @SaiTable[name="eni_ether_address_map", api="dash_eni", order=0] table eni_ether_address_map { + key = { + meta.eni_addr: exact @SaiVal[name="address", type="sai_mac_t"]; + } + actions = { + set_eni; + @defaultonly deny; + } + const default_action = deny; + } + apply { + meta.eni_addr = (meta.direction == dash_direction_t.OUTBOUND ? hdr.customer_ethernet.src_addr : hdr.customer_ethernet.dst_addr); + if (!eni_ether_address_map.apply().hit) { + if (meta.is_fast_path_icmp_flow_redirection_packet) { + ; + } + } + } +} + +control routing_action_apply(inout headers_t hdr, inout metadata_t meta) { + apply { + do_action_nat46.apply(hdr, meta); + do_action_nat64.apply(hdr, meta); + do_action_static_encap.apply(hdr, meta); + } +} + +control metering_update_stage(inout headers_t hdr, inout metadata_t meta) { + action check_ip_addr_family(@SaiVal[type="sai_ip_addr_family_t", isresourcetype="true"] bit<32> ip_addr_family) { + if (ip_addr_family == 0) { + if (meta.is_overlay_ip_v6 == 1) { + meta.dropped = true; + } + } else { + if (meta.is_overlay_ip_v6 == 0) { + meta.dropped = true; + } + } + } + @SaiTable[name="meter_policy", api="dash_meter", order=1, isobject="true"] table meter_policy { + key = { + meta.meter_policy_id: exact; + } + actions = { + check_ip_addr_family; + } + } + action set_policy_meter_class(bit<16> meter_class) { + meta.policy_meter_class = meter_class; + } + @SaiTable[name="meter_rule", api="dash_meter", order=2, isobject="true"] table meter_rule { + key = { + meta.meter_policy_id: exact @SaiVal[type="sai_object_id_t", isresourcetype="true", objects="METER_POLICY"]; + hdr.u0_ipv4.dst_addr: ternary @SaiVal[name="dip", type="sai_ip_address_t"]; + } + actions = { + set_policy_meter_class; + @defaultonly NoAction; + } + const default_action = NoAction(); + } + action meter_bucket_action(@SaiVal[type="sai_uint32_t", skipattr="true"] bit<32> meter_bucket_index) { + meta.meter_bucket_index = meter_bucket_index; + } + @SaiTable[name="meter_bucket", api="dash_meter", order=0, isobject="true"] table meter_bucket { + key = { + meta.eni_id : exact @SaiVal[type="sai_object_id_t"]; + meta.meter_class: exact; + } + actions = { + meter_bucket_action; + @defaultonly NoAction; + } + const default_action = NoAction(); + } + @SaiTable[ignored="true"] table eni_meter { + key = { + meta.eni_id : exact @SaiVal[type="sai_object_id_t"]; + meta.direction: exact; + meta.dropped : exact; + } + actions = { + NoAction; + } + } + apply { + if (meta.meter_policy_en == 1) { + meter_policy.apply(); + meter_rule.apply(); + } + { + if (meta.meter_policy_en == 1) { + meta.meter_class = meta.policy_meter_class; + } else { + meta.meter_class = meta.route_meter_class; + } + if (meta.meter_class == 0 || meta.mapping_meter_class_override == 1) { + meta.meter_class = meta.mapping_meter_class; + } + } + meter_bucket.apply(); + if (meta.direction == dash_direction_t.OUTBOUND) { + ; + } else if (meta.direction == dash_direction_t.INBOUND) { + ; + } + eni_meter.apply(); + } +} + +control underlay(inout headers_t hdr, inout metadata_t meta, in pna_main_input_metadata_t istd) { + action set_nhop(bit<9> next_hop_id) { + } + action pkt_act(bit<9> packet_action, bit<9> next_hop_id) { + if (packet_action == 0) { + meta.dropped = true; + } else if (packet_action == 1) { + set_nhop(next_hop_id); + } + } + action def_act() { + } + @SaiTable[name="route", api="route", api_type="underlay"] table underlay_routing { + key = { + meta.dst_ip_addr: lpm @SaiVal[name="destination"]; + } + actions = { + pkt_act; + @defaultonly def_act; + } + } + apply { + underlay_routing.apply(); + } +} + +control dash_ingress(inout headers_t hdr, inout metadata_t meta, in pna_main_input_metadata_t istd, inout pna_main_output_metadata_t ostd) { + action drop_action() { + drop_packet(); + } + action deny() { + meta.dropped = true; + } + action accept() { + } + @SaiTable[name="vip", api="dash_vip"] table vip { + key = { + hdr.u0_ipv4.dst_addr: exact @SaiVal[name="VIP", type="sai_ip_address_t"]; + } + actions = { + accept; + @defaultonly deny; + } + const default_action = deny; + } + action set_appliance(EthernetAddress neighbor_mac, EthernetAddress mac) { + meta.encap_data.underlay_dmac = neighbor_mac; + meta.encap_data.underlay_smac = mac; + } + @SaiTable[ignored="true"] table appliance { + key = { + meta.appliance_id: ternary; + } + actions = { + set_appliance; + } + } + action set_eni_attrs(bit<32> cps, bit<32> pps, bit<32> flows, bit<1> admin_state, @SaiVal[type="sai_ip_address_t"] IPv4Address vm_underlay_dip, @SaiVal[type="sai_uint32_t"] bit<24> vm_vni, @SaiVal[type="sai_object_id_t"] bit<16> vnet_id, IPv6Address pl_sip, IPv6Address pl_sip_mask, @SaiVal[type="sai_ip_address_t"] IPv4Address pl_underlay_sip, @SaiVal[type="sai_object_id_t"] bit<16> v4_meter_policy_id, @SaiVal[type="sai_object_id_t"] bit<16> v6_meter_policy_id, @SaiVal[type="sai_dash_tunnel_dscp_mode_t"] dash_tunnel_dscp_mode_t dash_tunnel_dscp_mode, @SaiVal[type="sai_uint8_t", validonly="SAI_ENI_ATTR_DASH_TUNNEL_DSCP_MODE == SAI_DASH_TUNNEL_DSCP_MODE_PIPE_MODEL"] bit<6> dscp, @SaiVal[type="sai_object_id_t"] bit<16> inbound_v4_stage1_dash_acl_group_id, @SaiVal[type="sai_object_id_t"] bit<16> inbound_v4_stage2_dash_acl_group_id, @SaiVal[type="sai_object_id_t"] bit<16> inbound_v4_stage3_dash_acl_group_id, @SaiVal[type="sai_object_id_t"] bit<16> inbound_v4_stage4_dash_acl_group_id, @SaiVal[type="sai_object_id_t"] bit<16> inbound_v4_stage5_dash_acl_group_id, @SaiVal[type="sai_object_id_t"] bit<16> inbound_v6_stage1_dash_acl_group_id, @SaiVal[type="sai_object_id_t"] bit<16> inbound_v6_stage2_dash_acl_group_id, @SaiVal[type="sai_object_id_t"] bit<16> inbound_v6_stage3_dash_acl_group_id, @SaiVal[type="sai_object_id_t"] bit<16> inbound_v6_stage4_dash_acl_group_id, @SaiVal[type="sai_object_id_t"] bit<16> inbound_v6_stage5_dash_acl_group_id, @SaiVal[type="sai_object_id_t"] bit<16> outbound_v4_stage1_dash_acl_group_id, @SaiVal[type="sai_object_id_t"] bit<16> outbound_v4_stage2_dash_acl_group_id, @SaiVal[type="sai_object_id_t"] bit<16> outbound_v4_stage3_dash_acl_group_id, @SaiVal[type="sai_object_id_t"] bit<16> outbound_v4_stage4_dash_acl_group_id, @SaiVal[type="sai_object_id_t"] bit<16> outbound_v4_stage5_dash_acl_group_id, @SaiVal[type="sai_object_id_t"] bit<16> outbound_v6_stage1_dash_acl_group_id, @SaiVal[type="sai_object_id_t"] bit<16> outbound_v6_stage2_dash_acl_group_id, @SaiVal[type="sai_object_id_t"] bit<16> outbound_v6_stage3_dash_acl_group_id, @SaiVal[type="sai_object_id_t"] bit<16> outbound_v6_stage4_dash_acl_group_id, @SaiVal[type="sai_object_id_t"] bit<16> outbound_v6_stage5_dash_acl_group_id, bit<1> disable_fast_path_icmp_flow_redirection) { + meta.eni_data.cps = cps; + meta.eni_data.pps = pps; + meta.eni_data.flows = flows; + meta.eni_data.admin_state = admin_state; + meta.eni_data.pl_sip = pl_sip; + meta.eni_data.pl_sip_mask = pl_sip_mask; + meta.eni_data.pl_underlay_sip = pl_underlay_sip; + meta.encap_data.underlay_dip = vm_underlay_dip; + if (dash_tunnel_dscp_mode == dash_tunnel_dscp_mode_t.PIPE_MODEL) { + meta.eni_data.dscp = dscp; + } + meta.encap_data.vni = vm_vni; + meta.vnet_id = vnet_id; + if (meta.is_overlay_ip_v6 == 1) { + if (meta.direction == dash_direction_t.OUTBOUND) { + meta.stage1_dash_acl_group_id = outbound_v6_stage1_dash_acl_group_id; + meta.stage2_dash_acl_group_id = outbound_v6_stage2_dash_acl_group_id; + meta.stage3_dash_acl_group_id = outbound_v6_stage3_dash_acl_group_id; + meta.stage4_dash_acl_group_id = outbound_v6_stage4_dash_acl_group_id; + meta.stage5_dash_acl_group_id = outbound_v6_stage5_dash_acl_group_id; + ; + } else { + meta.stage1_dash_acl_group_id = inbound_v6_stage1_dash_acl_group_id; + meta.stage2_dash_acl_group_id = inbound_v6_stage2_dash_acl_group_id; + meta.stage3_dash_acl_group_id = inbound_v6_stage3_dash_acl_group_id; + meta.stage4_dash_acl_group_id = inbound_v6_stage4_dash_acl_group_id; + meta.stage5_dash_acl_group_id = inbound_v6_stage5_dash_acl_group_id; + ; + } + meta.meter_policy_id = v6_meter_policy_id; + } else { + if (meta.direction == dash_direction_t.OUTBOUND) { + meta.stage1_dash_acl_group_id = outbound_v4_stage1_dash_acl_group_id; + meta.stage2_dash_acl_group_id = outbound_v4_stage2_dash_acl_group_id; + meta.stage3_dash_acl_group_id = outbound_v4_stage3_dash_acl_group_id; + meta.stage4_dash_acl_group_id = outbound_v4_stage4_dash_acl_group_id; + meta.stage5_dash_acl_group_id = outbound_v4_stage5_dash_acl_group_id; + ; + } else { + meta.stage1_dash_acl_group_id = inbound_v4_stage1_dash_acl_group_id; + meta.stage2_dash_acl_group_id = inbound_v4_stage2_dash_acl_group_id; + meta.stage3_dash_acl_group_id = inbound_v4_stage3_dash_acl_group_id; + meta.stage4_dash_acl_group_id = inbound_v4_stage4_dash_acl_group_id; + meta.stage5_dash_acl_group_id = inbound_v4_stage5_dash_acl_group_id; + ; + } + meta.meter_policy_id = v4_meter_policy_id; + } + meta.fast_path_icmp_flow_redirection_disabled = disable_fast_path_icmp_flow_redirection; + } + @SaiTable[name="eni", api="dash_eni", order=1, isobject="true"] table eni { + key = { + meta.eni_id: exact @SaiVal[type="sai_object_id_t"]; + } + actions = { + set_eni_attrs; + @defaultonly deny; + } + const default_action = deny; + } + action permit() { + } + action tunnel_decap_pa_validate(@SaiVal[type="sai_object_id_t"] bit<16> src_vnet_id) { + meta.vnet_id = src_vnet_id; + } + @SaiTable[name="pa_validation", api="dash_pa_validation"] table pa_validation { + key = { + meta.vnet_id : exact @SaiVal[type="sai_object_id_t"]; + hdr.u0_ipv4.src_addr: exact @SaiVal[name="sip", type="sai_ip_address_t"]; + } + actions = { + permit; + @defaultonly deny; + } + const default_action = deny; + } + @SaiTable[name="inbound_routing", api="dash_inbound_routing"] table inbound_routing { + key = { + meta.eni_id : exact @SaiVal[type="sai_object_id_t"]; + hdr.u0_vxlan.vni : exact @SaiVal[name="VNI"]; + hdr.u0_ipv4.src_addr: ternary @SaiVal[name="sip", type="sai_ip_address_t"]; + } + actions = { + tunnel_decap(hdr, meta); + tunnel_decap_pa_validate; + @defaultonly deny; + } + const default_action = deny; + } + action set_acl_group_attrs(@SaiVal[type="sai_ip_addr_family_t", isresourcetype="true"] bit<32> ip_addr_family) { + if (ip_addr_family == 0) { + if (meta.is_overlay_ip_v6 == 1) { + meta.dropped = true; + } + } else { + if (meta.is_overlay_ip_v6 == 0) { + meta.dropped = true; + } + } + } + @SaiTable[name="dash_acl_group", api="dash_acl", order=0, isobject="true"] table acl_group { + key = { + meta.stage1_dash_acl_group_id: exact @SaiVal[name="dash_acl_group_id"]; + } + actions = { + set_acl_group_attrs(); + } + } + apply { + if (meta.is_fast_path_icmp_flow_redirection_packet) { + ; + } + if (vip.apply().hit) { + meta.encap_data.underlay_sip = hdr.u0_ipv4.dst_addr; + } else { + if (meta.is_fast_path_icmp_flow_redirection_packet) { + } + } + direction_lookup_stage.apply(hdr, meta); + appliance.apply(); + eni_lookup_stage.apply(hdr, meta); + meta.eni_data.dscp_mode = dash_tunnel_dscp_mode_t.PRESERVE_MODEL; + meta.eni_data.dscp = (bit<6>)hdr.u0_ipv4.diffserv; + if (meta.direction == dash_direction_t.OUTBOUND) { + tunnel_decap(hdr, meta); + } else if (meta.direction == dash_direction_t.INBOUND) { + switch (inbound_routing.apply().action_run) { + tunnel_decap_pa_validate: { + pa_validation.apply(); + tunnel_decap(hdr, meta); + } + } + } + meta.is_overlay_ip_v6 = 0; + meta.ip_protocol = 0; + meta.dst_ip_addr = 0; + meta.src_ip_addr = 0; + if (hdr.customer_ipv6.isValid()) { + meta.ip_protocol = hdr.customer_ipv6.next_header; + meta.src_ip_addr = hdr.customer_ipv6.src_addr; + meta.dst_ip_addr = hdr.customer_ipv6.dst_addr; + meta.is_overlay_ip_v6 = 1; + } else if (hdr.customer_ipv4.isValid()) { + meta.ip_protocol = hdr.customer_ipv4.protocol; + meta.src_ip_addr = (bit<128>)hdr.customer_ipv4.src_addr; + meta.dst_ip_addr = (bit<128>)hdr.customer_ipv4.dst_addr; + } + if (hdr.customer_tcp.isValid()) { + meta.src_l4_port = hdr.customer_tcp.src_port; + meta.dst_l4_port = hdr.customer_tcp.dst_port; + } else if (hdr.customer_udp.isValid()) { + meta.src_l4_port = hdr.customer_udp.src_port; + meta.dst_l4_port = hdr.customer_udp.dst_port; + } + eni.apply(); + if (meta.eni_data.admin_state == 0) { + deny(); + } + if (meta.is_fast_path_icmp_flow_redirection_packet) { + ; + } + acl_group.apply(); + if (meta.direction == dash_direction_t.OUTBOUND) { + meta.target_stage = dash_pipeline_stage_t.OUTBOUND_ROUTING; + outbound.apply(hdr, meta); + } else if (meta.direction == dash_direction_t.INBOUND) { + inbound.apply(hdr, meta); + } + routing_action_apply.apply(hdr, meta); + meta.dst_ip_addr = (bit<128>)hdr.u0_ipv4.dst_addr; + underlay.apply(hdr, meta, istd); + if (meta.eni_data.dscp_mode == dash_tunnel_dscp_mode_t.PIPE_MODEL) { + hdr.u0_ipv4.diffserv = (bit<8>)meta.eni_data.dscp; + } + metering_update_stage.apply(hdr, meta); + if (meta.dropped) { + drop_action(); + } + } +} + +control dash_precontrol(in headers_t pre_hdr, inout metadata_t pre_user_meta, in pna_pre_input_metadata_t istd, inout pna_pre_output_metadata_t ostd) { + apply { + } +} + +PNA_NIC(dash_parser(), dash_precontrol(), dash_ingress(), dash_deparser()) main; diff --git a/testdata/p4_16_dpdk_errors_outputs/dash-pipeline-pna-dpdk.p4-error b/testdata/p4_16_dpdk_errors_outputs/dash-pipeline-pna-dpdk.p4-error new file mode 100644 index 00000000000..0ae4fcf0047 --- /dev/null +++ b/testdata/p4_16_dpdk_errors_outputs/dash-pipeline-pna-dpdk.p4-error @@ -0,0 +1,106 @@ +dash-pipeline-pna-dpdk.p4(587): [--Wwarn=unused] warning: 'hdr' is unused +action push_action_static_encap(in headers_t hdr, inout metadata_t meta, in dash_encapsulation_t ... + ^^^ +dash-pipeline-pna-dpdk.p4(619): [--Wwarn=unused] warning: 'hdr' is unused +action push_action_nat46(in headers_t hdr, inout metadata_t meta, in IPv6Address sip, in IPv6Addr... + ^^^ +dash-pipeline-pna-dpdk.p4(689): [--Wwarn=unused] warning: 'hdr' is unused +action route_vnet(inout headers_t hdr, inout metadata_t meta, @SaiVal[type="sai_object_id_t"] bit... + ^^^ +dash-pipeline-pna-dpdk.p4(694): [--Wwarn=unused] warning: 'hdr' is unused +action route_vnet_direct(inout headers_t hdr, inout metadata_t meta, bit<16> dst_vnet_id, bit<1> ... + ^^^ +dash-pipeline-pna-dpdk.p4(701): [--Wwarn=unused] warning: 'hdr' is unused +action route_direct(inout headers_t hdr, inout metadata_t meta, bit<1> meter_policy_en, bit<16> m... + ^^^ +dash-pipeline-pna-dpdk.p4(705): [--Wwarn=unused] warning: 'overlay_dip_is_v6' is unused +...s_t hdr, inout metadata_t meta, bit<1> overlay_dip_is_v6, IPv4ORv6Address overlay_dip, bit<1> ... + ^^^^^^^^^^^^^^^^^ +dash-pipeline-pna-dpdk.p4(705): [--Wwarn=unused] warning: 'overlay_dip_mask_is_v6' is unused +...IPv4ORv6Address overlay_dip, bit<1> overlay_dip_mask_is_v6, IPv4ORv6Address overlay_dip_mask, ... + ^^^^^^^^^^^^^^^^^^^^^^ +dash-pipeline-pna-dpdk.p4(705): [--Wwarn=unused] warning: 'overlay_sip_is_v6' is unused +...v4ORv6Address overlay_dip_mask, bit<1> overlay_sip_is_v6, IPv4ORv6Address overlay_sip, bit<1> ... + ^^^^^^^^^^^^^^^^^ +dash-pipeline-pna-dpdk.p4(705): [--Wwarn=unused] warning: 'overlay_sip_mask_is_v6' is unused +...IPv4ORv6Address overlay_sip, bit<1> overlay_sip_mask_is_v6, IPv4ORv6Address overlay_sip_mask, ... + ^^^^^^^^^^^^^^^^^^^^^^ +dash-pipeline-pna-dpdk.p4(705): [--Wwarn=unused] warning: 'underlay_dip_is_v6' is unused +...4ORv6Address overlay_sip_mask, bit<1> underlay_dip_is_v6, IPv4ORv6Address underlay_dip, bit<1>... + ^^^^^^^^^^^^^^^^^^ +dash-pipeline-pna-dpdk.p4(705): [--Wwarn=unused] warning: 'underlay_sip_is_v6' is unused +... IPv4ORv6Address underlay_dip, bit<1> underlay_sip_is_v6, IPv4ORv6Address underlay_sip, @SaiVa... + ^^^^^^^^^^^^^^^^^^ +dash-pipeline-pna-dpdk.p4(994): [--Wwarn=unused] warning: 'next_hop_id' is unused + action set_nhop(bit<9> next_hop_id) { + ^^^^^^^^^^^ +dash-pipeline-pna-dpdk.p4(708): [--Wwarn=invalid_header] warning: accessing a field of a potentially invalid header hdr.u0_ipv4 +..._key, underlay_sip = (underlay_sip == 0 ? hdr.u0_ipv4.src_addr : (IPv4Address)underlay_sip), u... + ^^^^^^^^^^^ +dash-pipeline-pna-dpdk.p4(708): [--Wwarn=invalid_header] warning: accessing a field of a potentially invalid header hdr.u0_ipv4 +...sip), underlay_dip = (underlay_dip == 0 ? hdr.u0_ipv4.dst_addr : (IPv4Address)underlay_dip), o... + ^^^^^^^^^^^ +dash-pipeline-pna-dpdk.p4(708): [--Wwarn=invalid_header] warning: accessing a field of a potentially invalid header hdr.u0_ethernet +... 0 ? hdr.u0_ipv4.dst_addr : (IPv4Address)underlay_dip), overlay_dmac = hdr.u0_ethernet.dst_addr); + ^^^^^^^^^^^^^^^ +dash-pipeline-pna-dpdk.p4(721): [--Wwarn=invalid_header] warning: accessing a field of a potentially invalid header hdr.u0_ethernet +....eni_data.pl_underlay_sip, underlay_dip = underlay_dip, overlay_dmac = hdr.u0_ethernet.dst_addr); + ^^^^^^^^^^^^^^^ +dash-pipeline-pna-dpdk.p4(722): [--Wwarn=invalid_header] warning: accessing a field of a potentially invalid header hdr.u0_ipv4 +...ask | meta.eni_data.pl_sip | (IPv6Address)hdr.u0_ipv4.src_addr, sip_mask = 0xfffffffffffffffff... + ^^^^^^^^^^^ +dash-pipeline-pna-dpdk.p4(371): [--Wwarn=invalid_header] warning: accessing a field of a potentially invalid header hdr.u0_ethernet + hdr.u0_ethernet.dst_addr = overlay_dmac; + ^^^^^^^^^^^^^^^ +dash-pipeline-pna-dpdk.p4(637): [--Wwarn=invalid_header] warning: accessing a field of a potentially invalid header hdr.u0_ipv4 + hdr.u0_ipv6.payload_length = hdr.u0_ipv4.total_len - IPV4_HDR_SIZE; + ^^^^^^^^^^^ +dash-pipeline-pna-dpdk.p4(638): [--Wwarn=invalid_header] warning: accessing a field of a potentially invalid header hdr.u0_ipv4 + hdr.u0_ipv6.next_header = hdr.u0_ipv4.protocol; + ^^^^^^^^^^^ +dash-pipeline-pna-dpdk.p4(639): [--Wwarn=invalid_header] warning: accessing a field of a potentially invalid header hdr.u0_ipv4 + hdr.u0_ipv6.hop_limit = hdr.u0_ipv4.ttl; + ^^^^^^^^^^^ +dash-pipeline-pna-dpdk.p4(640): [--Wwarn=invalid_header] warning: accessing a field of a potentially invalid header hdr.u0_ipv4 + hdr.u0_ipv6.dst_addr = (IPv6Address)hdr.u0_ipv4.dst_addr & ~meta.overlay_data.dip_mask | ... + ^^^^^^^^^^^ +dash-pipeline-pna-dpdk.p4(641): [--Wwarn=invalid_header] warning: accessing a field of a potentially invalid header hdr.u0_ipv4 + hdr.u0_ipv6.src_addr = (IPv6Address)hdr.u0_ipv4.src_addr & ~meta.overlay_data.sip_mask | ... + ^^^^^^^^^^^ +dash-pipeline-pna-dpdk.p4(643): [--Wwarn=invalid_header] warning: accessing a field of a potentially invalid header hdr.u0_ethernet + hdr.u0_ethernet.ether_type = 0x86dd; + ^^^^^^^^^^^^^^^ +dash-pipeline-pna-dpdk.p4(663): [--Wwarn=invalid_header] warning: accessing a field of a potentially invalid header hdr.u0_ipv6 + hdr.u0_ipv4.total_len = hdr.u0_ipv6.payload_length + IPV4_HDR_SIZE; + ^^^^^^^^^^^ +dash-pipeline-pna-dpdk.p4(667): [--Wwarn=invalid_header] warning: accessing a field of a potentially invalid header hdr.u0_ipv6 + hdr.u0_ipv4.protocol = hdr.u0_ipv6.next_header; + ^^^^^^^^^^^ +dash-pipeline-pna-dpdk.p4(668): [--Wwarn=invalid_header] warning: accessing a field of a potentially invalid header hdr.u0_ipv6 + hdr.u0_ipv4.ttl = hdr.u0_ipv6.hop_limit; + ^^^^^^^^^^^ +dash-pipeline-pna-dpdk.p4(673): [--Wwarn=invalid_header] warning: accessing a field of a potentially invalid header hdr.u0_ethernet + hdr.u0_ethernet.ether_type = 0x800; + ^^^^^^^^^^^^^^^ +dash-pipeline-pna-dpdk.p4(1220): [--Wwarn=invalid_header] warning: accessing a field of a potentially invalid header hdr.u0_ipv4 + meta.dst_ip_addr = (bit<128>)hdr.u0_ipv4.dst_addr; + ^^^^^^^^^^^ +dash-pipeline-pna-dpdk.p4(1223): [--Wwarn=invalid_header] warning: accessing a field of a potentially invalid header hdr.u0_ipv4 + hdr.u0_ipv4.diffserv = (bit<8>)meta.eni_data.dscp; + ^^^^^^^^^^^ +dash-pipeline-pna-dpdk.p4(936): [--Wwarn=invalid_header] warning: accessing a field of a potentially invalid header hdr.u0_ipv4 + hdr.u0_ipv4.dst_addr: ternary @SaiVal[name="dip", type="sai_ip_address_t"]; + ^^^^^^^^^^^ +[--Wwarn=mismatch] warning: Mismatched header/metadata struct for key elements in table pa_validation. Copying all match fields to metadata +[--Wwarn=mismatch] warning: Mismatched header/metadata struct for key elements in table inbound_routing. Copying all match fields to metadata +[--Wwarn=mismatch] warning: Mismatched header/metadata struct for key elements in table outbound_outbound_mapping_stage_ca_to_pa. Copying all match fields to metadata +[--Wwarn=mismatch] warning: Mismatched header/metadata struct for key elements in table metering_update_stage_meter_rule. Copying all match fields to metadata +[--Wwarn=mismatch] warning: Mismatched header/metadata struct for key elements in table metering_update_stage_meter_bucket. Copying all match fields to metadata +[--Wwarn=mismatch] warning: Mismatched header/metadata struct for key elements in table metering_update_stage_eni_meter. Copying all match fields to metadata +[--Werror=overlimit] error: DPDK target supports up-to 64-bit immediate values, 128w0xffffffffffffffffffffffff exceeds the limit +[--Werror=overlimit] error: DPDK target supports up-to 64-bit immediate values, 128w0xffffffffffffffffffffffff exceeds the limit +[--Werror=overlimit] error: DPDK target supports up-to 64-bit immediate values, 128w0xffffffffffffffffffffffff exceeds the limit +[--Werror=overlimit] error: DPDK target supports up-to 64-bit immediate values, 128w0xffffffffffffffffffffffff exceeds the limit +dash-pipeline-pna-dpdk.p4(719): [--Werror=overlimit] error: DPDK target supports up-to 64-bit immediate values, 128w0xffffffffffffffffffffffff exceeds the limit +...apping(inout headers_t hdr, inout metadata_t meta, @SaiVal[type="sai_ip_address_t"] IPv4Addres... + ^^^^ diff --git a/testdata/p4_16_dpdk_errors_outputs/dash-pipeline-pna-dpdk.p4.bfrt.json b/testdata/p4_16_dpdk_errors_outputs/dash-pipeline-pna-dpdk.p4.bfrt.json new file mode 100644 index 00000000000..66d3094effa --- /dev/null +++ b/testdata/p4_16_dpdk_errors_outputs/dash-pipeline-pna-dpdk.p4.bfrt.json @@ -0,0 +1,2724 @@ +{ + "schema_version" : "1.0.0", + "tables" : [ + { + "name" : "pipe.dash_ingress.vip", + "id" : 45245089, + "table_type" : "MatchAction_Direct", + "size" : 1024, + "annotations" : [], + "depends_on" : [], + "has_const_default_action" : true, + "key" : [ + { + "id" : 1, + "name" : "hdr.u0_ipv4.dst_addr", + "repeated" : false, + "annotations" : [], + "mandatory" : false, + "match_type" : "Exact", + "type" : { + "type" : "bytes", + "width" : 32 + } + } + ], + "action_specs" : [ + { + "id" : 26041632, + "name" : "dash_ingress.accept", + "action_scope" : "TableAndDefault", + "annotations" : [], + "data" : [] + }, + { + "id" : 23563653, + "name" : "dash_ingress.deny", + "action_scope" : "DefaultOnly", + "annotations" : [ + { + "name" : "@defaultonly" + } + ], + "data" : [] + } + ], + "data" : [], + "supported_operations" : [], + "attributes" : ["EntryScope"] + }, + { + "name" : "pipe.dash_ingress.appliance", + "id" : 42701762, + "table_type" : "MatchAction_Direct", + "size" : 1024, + "annotations" : [], + "depends_on" : [], + "has_const_default_action" : false, + "key" : [ + { + "id" : 1, + "name" : "meta.appliance_id", + "repeated" : false, + "annotations" : [], + "mandatory" : false, + "match_type" : "Ternary", + "type" : { + "type" : "bytes", + "width" : 8 + } + }, + { + "id" : 65537, + "name" : "$MATCH_PRIORITY", + "repeated" : false, + "annotations" : [], + "mandatory" : false, + "match_type" : "Exact", + "type" : { + "type" : "uint32" + } + } + ], + "action_specs" : [ + { + "id" : 21793905, + "name" : "dash_ingress.set_appliance", + "action_scope" : "TableAndDefault", + "annotations" : [], + "data" : [ + { + "id" : 1, + "name" : "neighbor_mac", + "repeated" : false, + "mandatory" : true, + "read_only" : false, + "annotations" : [], + "type" : { + "type" : "bytes", + "width" : 48 + } + }, + { + "id" : 2, + "name" : "mac", + "repeated" : false, + "mandatory" : true, + "read_only" : false, + "annotations" : [], + "type" : { + "type" : "bytes", + "width" : 48 + } + } + ] + }, + { + "id" : 21257015, + "name" : "NoAction", + "action_scope" : "DefaultOnly", + "annotations" : [ + { + "name" : "@defaultonly" + } + ], + "data" : [] + } + ], + "data" : [], + "supported_operations" : [], + "attributes" : ["EntryScope"] + }, + { + "name" : "pipe.dash_ingress.eni", + "id" : 45859274, + "table_type" : "MatchAction_Direct", + "size" : 1024, + "annotations" : [], + "depends_on" : [], + "has_const_default_action" : true, + "key" : [ + { + "id" : 1, + "name" : "meta.eni_id", + "repeated" : false, + "annotations" : [], + "mandatory" : false, + "match_type" : "Exact", + "type" : { + "type" : "bytes", + "width" : 16 + } + } + ], + "action_specs" : [ + { + "id" : 27167550, + "name" : "dash_ingress.set_eni_attrs", + "action_scope" : "TableAndDefault", + "annotations" : [], + "data" : [ + { + "id" : 1, + "name" : "cps", + "repeated" : false, + "mandatory" : true, + "read_only" : false, + "annotations" : [], + "type" : { + "type" : "bytes", + "width" : 32 + } + }, + { + "id" : 2, + "name" : "pps", + "repeated" : false, + "mandatory" : true, + "read_only" : false, + "annotations" : [], + "type" : { + "type" : "bytes", + "width" : 32 + } + }, + { + "id" : 3, + "name" : "flows", + "repeated" : false, + "mandatory" : true, + "read_only" : false, + "annotations" : [], + "type" : { + "type" : "bytes", + "width" : 32 + } + }, + { + "id" : 4, + "name" : "admin_state", + "repeated" : false, + "mandatory" : true, + "read_only" : false, + "annotations" : [], + "type" : { + "type" : "bytes", + "width" : 1 + } + }, + { + "id" : 5, + "name" : "vm_underlay_dip", + "repeated" : false, + "mandatory" : true, + "read_only" : false, + "annotations" : [], + "type" : { + "type" : "bytes", + "width" : 32 + } + }, + { + "id" : 6, + "name" : "vm_vni", + "repeated" : false, + "mandatory" : true, + "read_only" : false, + "annotations" : [], + "type" : { + "type" : "bytes", + "width" : 24 + } + }, + { + "id" : 7, + "name" : "vnet_id", + "repeated" : false, + "mandatory" : true, + "read_only" : false, + "annotations" : [], + "type" : { + "type" : "bytes", + "width" : 16 + } + }, + { + "id" : 8, + "name" : "pl_sip", + "repeated" : false, + "mandatory" : true, + "read_only" : false, + "annotations" : [], + "type" : { + "type" : "bytes", + "width" : 128 + } + }, + { + "id" : 9, + "name" : "pl_sip_mask", + "repeated" : false, + "mandatory" : true, + "read_only" : false, + "annotations" : [], + "type" : { + "type" : "bytes", + "width" : 128 + } + }, + { + "id" : 10, + "name" : "pl_underlay_sip", + "repeated" : false, + "mandatory" : true, + "read_only" : false, + "annotations" : [], + "type" : { + "type" : "bytes", + "width" : 32 + } + }, + { + "id" : 11, + "name" : "v4_meter_policy_id", + "repeated" : false, + "mandatory" : true, + "read_only" : false, + "annotations" : [], + "type" : { + "type" : "bytes", + "width" : 16 + } + }, + { + "id" : 12, + "name" : "v6_meter_policy_id", + "repeated" : false, + "mandatory" : true, + "read_only" : false, + "annotations" : [], + "type" : { + "type" : "bytes", + "width" : 16 + } + }, + { + "id" : 13, + "name" : "dash_tunnel_dscp_mode", + "repeated" : false, + "mandatory" : true, + "read_only" : false, + "annotations" : [], + "type" : { + "type" : "bytes", + "width" : 16 + } + }, + { + "id" : 14, + "name" : "dscp", + "repeated" : false, + "mandatory" : true, + "read_only" : false, + "annotations" : [], + "type" : { + "type" : "bytes", + "width" : 6 + } + }, + { + "id" : 15, + "name" : "inbound_v4_stage1_dash_acl_group_id", + "repeated" : false, + "mandatory" : true, + "read_only" : false, + "annotations" : [], + "type" : { + "type" : "bytes", + "width" : 16 + } + }, + { + "id" : 16, + "name" : "inbound_v4_stage2_dash_acl_group_id", + "repeated" : false, + "mandatory" : true, + "read_only" : false, + "annotations" : [], + "type" : { + "type" : "bytes", + "width" : 16 + } + }, + { + "id" : 17, + "name" : "inbound_v4_stage3_dash_acl_group_id", + "repeated" : false, + "mandatory" : true, + "read_only" : false, + "annotations" : [], + "type" : { + "type" : "bytes", + "width" : 16 + } + }, + { + "id" : 18, + "name" : "inbound_v4_stage4_dash_acl_group_id", + "repeated" : false, + "mandatory" : true, + "read_only" : false, + "annotations" : [], + "type" : { + "type" : "bytes", + "width" : 16 + } + }, + { + "id" : 19, + "name" : "inbound_v4_stage5_dash_acl_group_id", + "repeated" : false, + "mandatory" : true, + "read_only" : false, + "annotations" : [], + "type" : { + "type" : "bytes", + "width" : 16 + } + }, + { + "id" : 20, + "name" : "inbound_v6_stage1_dash_acl_group_id", + "repeated" : false, + "mandatory" : true, + "read_only" : false, + "annotations" : [], + "type" : { + "type" : "bytes", + "width" : 16 + } + }, + { + "id" : 21, + "name" : "inbound_v6_stage2_dash_acl_group_id", + "repeated" : false, + "mandatory" : true, + "read_only" : false, + "annotations" : [], + "type" : { + "type" : "bytes", + "width" : 16 + } + }, + { + "id" : 22, + "name" : "inbound_v6_stage3_dash_acl_group_id", + "repeated" : false, + "mandatory" : true, + "read_only" : false, + "annotations" : [], + "type" : { + "type" : "bytes", + "width" : 16 + } + }, + { + "id" : 23, + "name" : "inbound_v6_stage4_dash_acl_group_id", + "repeated" : false, + "mandatory" : true, + "read_only" : false, + "annotations" : [], + "type" : { + "type" : "bytes", + "width" : 16 + } + }, + { + "id" : 24, + "name" : "inbound_v6_stage5_dash_acl_group_id", + "repeated" : false, + "mandatory" : true, + "read_only" : false, + "annotations" : [], + "type" : { + "type" : "bytes", + "width" : 16 + } + }, + { + "id" : 25, + "name" : "outbound_v4_stage1_dash_acl_group_id", + "repeated" : false, + "mandatory" : true, + "read_only" : false, + "annotations" : [], + "type" : { + "type" : "bytes", + "width" : 16 + } + }, + { + "id" : 26, + "name" : "outbound_v4_stage2_dash_acl_group_id", + "repeated" : false, + "mandatory" : true, + "read_only" : false, + "annotations" : [], + "type" : { + "type" : "bytes", + "width" : 16 + } + }, + { + "id" : 27, + "name" : "outbound_v4_stage3_dash_acl_group_id", + "repeated" : false, + "mandatory" : true, + "read_only" : false, + "annotations" : [], + "type" : { + "type" : "bytes", + "width" : 16 + } + }, + { + "id" : 28, + "name" : "outbound_v4_stage4_dash_acl_group_id", + "repeated" : false, + "mandatory" : true, + "read_only" : false, + "annotations" : [], + "type" : { + "type" : "bytes", + "width" : 16 + } + }, + { + "id" : 29, + "name" : "outbound_v4_stage5_dash_acl_group_id", + "repeated" : false, + "mandatory" : true, + "read_only" : false, + "annotations" : [], + "type" : { + "type" : "bytes", + "width" : 16 + } + }, + { + "id" : 30, + "name" : "outbound_v6_stage1_dash_acl_group_id", + "repeated" : false, + "mandatory" : true, + "read_only" : false, + "annotations" : [], + "type" : { + "type" : "bytes", + "width" : 16 + } + }, + { + "id" : 31, + "name" : "outbound_v6_stage2_dash_acl_group_id", + "repeated" : false, + "mandatory" : true, + "read_only" : false, + "annotations" : [], + "type" : { + "type" : "bytes", + "width" : 16 + } + }, + { + "id" : 32, + "name" : "outbound_v6_stage3_dash_acl_group_id", + "repeated" : false, + "mandatory" : true, + "read_only" : false, + "annotations" : [], + "type" : { + "type" : "bytes", + "width" : 16 + } + }, + { + "id" : 33, + "name" : "outbound_v6_stage4_dash_acl_group_id", + "repeated" : false, + "mandatory" : true, + "read_only" : false, + "annotations" : [], + "type" : { + "type" : "bytes", + "width" : 16 + } + }, + { + "id" : 34, + "name" : "outbound_v6_stage5_dash_acl_group_id", + "repeated" : false, + "mandatory" : true, + "read_only" : false, + "annotations" : [], + "type" : { + "type" : "bytes", + "width" : 16 + } + }, + { + "id" : 35, + "name" : "disable_fast_path_icmp_flow_redirection", + "repeated" : false, + "mandatory" : true, + "read_only" : false, + "annotations" : [], + "type" : { + "type" : "bytes", + "width" : 1 + } + } + ] + }, + { + "id" : 23563653, + "name" : "dash_ingress.deny", + "action_scope" : "DefaultOnly", + "annotations" : [ + { + "name" : "@defaultonly" + } + ], + "data" : [] + } + ], + "data" : [], + "supported_operations" : [], + "attributes" : ["EntryScope"] + }, + { + "name" : "pipe.dash_ingress.pa_validation", + "id" : 35526612, + "table_type" : "MatchAction_Direct", + "size" : 1024, + "annotations" : [], + "depends_on" : [], + "has_const_default_action" : true, + "key" : [ + { + "id" : 1, + "name" : "meta.vnet_id", + "repeated" : false, + "annotations" : [], + "mandatory" : false, + "match_type" : "Exact", + "type" : { + "type" : "bytes", + "width" : 16 + } + }, + { + "id" : 2, + "name" : "hdr.u0_ipv4.src_addr", + "repeated" : false, + "annotations" : [], + "mandatory" : false, + "match_type" : "Exact", + "type" : { + "type" : "bytes", + "width" : 32 + } + } + ], + "action_specs" : [ + { + "id" : 32591400, + "name" : "dash_ingress.permit", + "action_scope" : "TableAndDefault", + "annotations" : [], + "data" : [] + }, + { + "id" : 23563653, + "name" : "dash_ingress.deny", + "action_scope" : "DefaultOnly", + "annotations" : [ + { + "name" : "@defaultonly" + } + ], + "data" : [] + } + ], + "data" : [], + "supported_operations" : [], + "attributes" : ["EntryScope"] + }, + { + "name" : "pipe.dash_ingress.inbound_routing", + "id" : 38920290, + "table_type" : "MatchAction_Direct", + "size" : 1024, + "annotations" : [], + "depends_on" : [], + "has_const_default_action" : true, + "key" : [ + { + "id" : 1, + "name" : "meta.eni_id", + "repeated" : false, + "annotations" : [], + "mandatory" : false, + "match_type" : "Exact", + "type" : { + "type" : "bytes", + "width" : 16 + } + }, + { + "id" : 2, + "name" : "hdr.u0_vxlan.vni", + "repeated" : false, + "annotations" : [], + "mandatory" : false, + "match_type" : "Exact", + "type" : { + "type" : "bytes", + "width" : 24 + } + }, + { + "id" : 3, + "name" : "hdr.u0_ipv4.src_addr", + "repeated" : false, + "annotations" : [], + "mandatory" : false, + "match_type" : "Ternary", + "type" : { + "type" : "bytes", + "width" : 32 + } + }, + { + "id" : 65537, + "name" : "$MATCH_PRIORITY", + "repeated" : false, + "annotations" : [], + "mandatory" : false, + "match_type" : "Exact", + "type" : { + "type" : "uint32" + } + } + ], + "action_specs" : [ + { + "id" : 27844834, + "name" : "tunnel_decap", + "action_scope" : "TableAndDefault", + "annotations" : [], + "data" : [] + }, + { + "id" : 27987616, + "name" : "dash_ingress.tunnel_decap_pa_validate", + "action_scope" : "TableAndDefault", + "annotations" : [], + "data" : [ + { + "id" : 1, + "name" : "src_vnet_id", + "repeated" : false, + "mandatory" : true, + "read_only" : false, + "annotations" : [], + "type" : { + "type" : "bytes", + "width" : 16 + } + } + ] + }, + { + "id" : 23563653, + "name" : "dash_ingress.deny", + "action_scope" : "DefaultOnly", + "annotations" : [ + { + "name" : "@defaultonly" + } + ], + "data" : [] + } + ], + "data" : [], + "supported_operations" : [], + "attributes" : ["EntryScope"] + }, + { + "name" : "pipe.dash_ingress.acl_group", + "id" : 50200087, + "table_type" : "MatchAction_Direct", + "size" : 1024, + "annotations" : [], + "depends_on" : [], + "has_const_default_action" : false, + "key" : [ + { + "id" : 1, + "name" : "meta.stage1_dash_acl_group_id", + "repeated" : false, + "annotations" : [], + "mandatory" : false, + "match_type" : "Exact", + "type" : { + "type" : "bytes", + "width" : 16 + } + } + ], + "action_specs" : [ + { + "id" : 25655048, + "name" : "dash_ingress.set_acl_group_attrs", + "action_scope" : "TableAndDefault", + "annotations" : [], + "data" : [ + { + "id" : 1, + "name" : "ip_addr_family", + "repeated" : false, + "mandatory" : true, + "read_only" : false, + "annotations" : [], + "type" : { + "type" : "bytes", + "width" : 32 + } + } + ] + }, + { + "id" : 21257015, + "name" : "NoAction", + "action_scope" : "DefaultOnly", + "annotations" : [ + { + "name" : "@defaultonly" + } + ], + "data" : [] + } + ], + "data" : [], + "supported_operations" : [], + "attributes" : ["EntryScope"] + }, + { + "name" : "pipe.dash_ingress.direction_lookup_stage.direction_lookup", + "id" : 44703784, + "table_type" : "MatchAction_Direct", + "size" : 1024, + "annotations" : [], + "depends_on" : [], + "has_const_default_action" : true, + "key" : [ + { + "id" : 1, + "name" : "hdr.u0_vxlan.vni", + "repeated" : false, + "annotations" : [], + "mandatory" : false, + "match_type" : "Exact", + "type" : { + "type" : "bytes", + "width" : 24 + } + } + ], + "action_specs" : [ + { + "id" : 17408972, + "name" : "dash_ingress.direction_lookup_stage.set_outbound_direction", + "action_scope" : "TableAndDefault", + "annotations" : [], + "data" : [] + }, + { + "id" : 21063902, + "name" : "dash_ingress.direction_lookup_stage.set_inbound_direction", + "action_scope" : "DefaultOnly", + "annotations" : [ + { + "name" : "@defaultonly" + } + ], + "data" : [] + } + ], + "data" : [], + "supported_operations" : [], + "attributes" : ["EntryScope"] + }, + { + "name" : "pipe.dash_ingress.eni_lookup_stage.eni_ether_address_map", + "id" : 36648123, + "table_type" : "MatchAction_Direct", + "size" : 1024, + "annotations" : [], + "depends_on" : [], + "has_const_default_action" : true, + "key" : [ + { + "id" : 1, + "name" : "meta.eni_addr", + "repeated" : false, + "annotations" : [], + "mandatory" : false, + "match_type" : "Exact", + "type" : { + "type" : "bytes", + "width" : 48 + } + } + ], + "action_specs" : [ + { + "id" : 24618133, + "name" : "dash_ingress.eni_lookup_stage.set_eni", + "action_scope" : "TableAndDefault", + "annotations" : [], + "data" : [ + { + "id" : 1, + "name" : "eni_id", + "repeated" : false, + "mandatory" : true, + "read_only" : false, + "annotations" : [], + "type" : { + "type" : "bytes", + "width" : 16 + } + } + ] + }, + { + "id" : 20772460, + "name" : "dash_ingress.eni_lookup_stage.deny", + "action_scope" : "DefaultOnly", + "annotations" : [ + { + "name" : "@defaultonly" + } + ], + "data" : [] + } + ], + "data" : [], + "supported_operations" : [], + "attributes" : ["EntryScope"] + }, + { + "name" : "pipe.dash_ingress.outbound.acl.stage1", + "id" : 49209582, + "table_type" : "MatchAction_Direct", + "size" : 1024, + "annotations" : [], + "depends_on" : [], + "has_const_default_action" : false, + "key" : [ + { + "id" : 1, + "name" : "meta.stage1_dash_acl_group_id", + "repeated" : false, + "annotations" : [], + "mandatory" : false, + "match_type" : "Exact", + "type" : { + "type" : "bytes", + "width" : 16 + } + }, + { + "id" : 2, + "name" : "meta.dst_ip_addr", + "repeated" : false, + "annotations" : [], + "mandatory" : false, + "match_type" : "Ternary", + "type" : { + "type" : "bytes", + "width" : 128 + } + }, + { + "id" : 3, + "name" : "meta.src_ip_addr", + "repeated" : false, + "annotations" : [], + "mandatory" : false, + "match_type" : "Ternary", + "type" : { + "type" : "bytes", + "width" : 128 + } + }, + { + "id" : 4, + "name" : "meta.ip_protocol", + "repeated" : false, + "annotations" : [], + "mandatory" : false, + "match_type" : "Ternary", + "type" : { + "type" : "bytes", + "width" : 8 + } + }, + { + "id" : 5, + "name" : "meta.src_l4_port", + "repeated" : false, + "annotations" : [], + "mandatory" : false, + "match_type" : "Ternary", + "type" : { + "type" : "bytes", + "width" : 16 + } + }, + { + "id" : 6, + "name" : "meta.dst_l4_port", + "repeated" : false, + "annotations" : [], + "mandatory" : false, + "match_type" : "Ternary", + "type" : { + "type" : "bytes", + "width" : 16 + } + }, + { + "id" : 65537, + "name" : "$MATCH_PRIORITY", + "repeated" : false, + "annotations" : [], + "mandatory" : false, + "match_type" : "Exact", + "type" : { + "type" : "uint32" + } + } + ], + "action_specs" : [ + { + "id" : 18858683, + "name" : "dash_ingress.outbound.acl.permit", + "action_scope" : "TableAndDefault", + "annotations" : [], + "data" : [] + }, + { + "id" : 24263137, + "name" : "dash_ingress.outbound.acl.permit_and_continue", + "action_scope" : "TableAndDefault", + "annotations" : [], + "data" : [] + }, + { + "id" : 29962337, + "name" : "dash_ingress.outbound.acl.deny", + "action_scope" : "TableAndDefault", + "annotations" : [], + "data" : [] + }, + { + "id" : 26077229, + "name" : "dash_ingress.outbound.acl.deny_and_continue", + "action_scope" : "TableAndDefault", + "annotations" : [], + "data" : [] + } + ], + "data" : [], + "supported_operations" : [], + "attributes" : ["EntryScope"] + }, + { + "name" : "pipe.dash_ingress.outbound.acl.stage2", + "id" : 36478314, + "table_type" : "MatchAction_Direct", + "size" : 1024, + "annotations" : [], + "depends_on" : [], + "has_const_default_action" : false, + "key" : [ + { + "id" : 1, + "name" : "meta.stage2_dash_acl_group_id", + "repeated" : false, + "annotations" : [], + "mandatory" : false, + "match_type" : "Exact", + "type" : { + "type" : "bytes", + "width" : 16 + } + }, + { + "id" : 2, + "name" : "meta.dst_ip_addr", + "repeated" : false, + "annotations" : [], + "mandatory" : false, + "match_type" : "Ternary", + "type" : { + "type" : "bytes", + "width" : 128 + } + }, + { + "id" : 3, + "name" : "meta.src_ip_addr", + "repeated" : false, + "annotations" : [], + "mandatory" : false, + "match_type" : "Ternary", + "type" : { + "type" : "bytes", + "width" : 128 + } + }, + { + "id" : 4, + "name" : "meta.ip_protocol", + "repeated" : false, + "annotations" : [], + "mandatory" : false, + "match_type" : "Ternary", + "type" : { + "type" : "bytes", + "width" : 8 + } + }, + { + "id" : 5, + "name" : "meta.src_l4_port", + "repeated" : false, + "annotations" : [], + "mandatory" : false, + "match_type" : "Ternary", + "type" : { + "type" : "bytes", + "width" : 16 + } + }, + { + "id" : 6, + "name" : "meta.dst_l4_port", + "repeated" : false, + "annotations" : [], + "mandatory" : false, + "match_type" : "Ternary", + "type" : { + "type" : "bytes", + "width" : 16 + } + }, + { + "id" : 65537, + "name" : "$MATCH_PRIORITY", + "repeated" : false, + "annotations" : [], + "mandatory" : false, + "match_type" : "Exact", + "type" : { + "type" : "uint32" + } + } + ], + "action_specs" : [ + { + "id" : 18858683, + "name" : "dash_ingress.outbound.acl.permit", + "action_scope" : "TableAndDefault", + "annotations" : [], + "data" : [] + }, + { + "id" : 24263137, + "name" : "dash_ingress.outbound.acl.permit_and_continue", + "action_scope" : "TableAndDefault", + "annotations" : [], + "data" : [] + }, + { + "id" : 29962337, + "name" : "dash_ingress.outbound.acl.deny", + "action_scope" : "TableAndDefault", + "annotations" : [], + "data" : [] + }, + { + "id" : 26077229, + "name" : "dash_ingress.outbound.acl.deny_and_continue", + "action_scope" : "TableAndDefault", + "annotations" : [], + "data" : [] + } + ], + "data" : [], + "supported_operations" : [], + "attributes" : ["EntryScope"] + }, + { + "name" : "pipe.dash_ingress.outbound.acl.stage3", + "id" : 39012793, + "table_type" : "MatchAction_Direct", + "size" : 1024, + "annotations" : [], + "depends_on" : [], + "has_const_default_action" : false, + "key" : [ + { + "id" : 1, + "name" : "meta.stage3_dash_acl_group_id", + "repeated" : false, + "annotations" : [], + "mandatory" : false, + "match_type" : "Exact", + "type" : { + "type" : "bytes", + "width" : 16 + } + }, + { + "id" : 2, + "name" : "meta.dst_ip_addr", + "repeated" : false, + "annotations" : [], + "mandatory" : false, + "match_type" : "Ternary", + "type" : { + "type" : "bytes", + "width" : 128 + } + }, + { + "id" : 3, + "name" : "meta.src_ip_addr", + "repeated" : false, + "annotations" : [], + "mandatory" : false, + "match_type" : "Ternary", + "type" : { + "type" : "bytes", + "width" : 128 + } + }, + { + "id" : 4, + "name" : "meta.ip_protocol", + "repeated" : false, + "annotations" : [], + "mandatory" : false, + "match_type" : "Ternary", + "type" : { + "type" : "bytes", + "width" : 8 + } + }, + { + "id" : 5, + "name" : "meta.src_l4_port", + "repeated" : false, + "annotations" : [], + "mandatory" : false, + "match_type" : "Ternary", + "type" : { + "type" : "bytes", + "width" : 16 + } + }, + { + "id" : 6, + "name" : "meta.dst_l4_port", + "repeated" : false, + "annotations" : [], + "mandatory" : false, + "match_type" : "Ternary", + "type" : { + "type" : "bytes", + "width" : 16 + } + }, + { + "id" : 65537, + "name" : "$MATCH_PRIORITY", + "repeated" : false, + "annotations" : [], + "mandatory" : false, + "match_type" : "Exact", + "type" : { + "type" : "uint32" + } + } + ], + "action_specs" : [ + { + "id" : 18858683, + "name" : "dash_ingress.outbound.acl.permit", + "action_scope" : "TableAndDefault", + "annotations" : [], + "data" : [] + }, + { + "id" : 24263137, + "name" : "dash_ingress.outbound.acl.permit_and_continue", + "action_scope" : "TableAndDefault", + "annotations" : [], + "data" : [] + }, + { + "id" : 29962337, + "name" : "dash_ingress.outbound.acl.deny", + "action_scope" : "TableAndDefault", + "annotations" : [], + "data" : [] + }, + { + "id" : 26077229, + "name" : "dash_ingress.outbound.acl.deny_and_continue", + "action_scope" : "TableAndDefault", + "annotations" : [], + "data" : [] + } + ], + "data" : [], + "supported_operations" : [], + "attributes" : ["EntryScope"] + }, + { + "name" : "pipe.dash_ingress.outbound.outbound_routing_stage.routing", + "id" : 44010720, + "table_type" : "MatchAction_Direct", + "size" : 1024, + "annotations" : [], + "depends_on" : [], + "has_const_default_action" : true, + "key" : [ + { + "id" : 1, + "name" : "meta.eni_id", + "repeated" : false, + "annotations" : [], + "mandatory" : false, + "match_type" : "Exact", + "type" : { + "type" : "bytes", + "width" : 16 + } + }, + { + "id" : 2, + "name" : "meta.is_overlay_ip_v6", + "repeated" : false, + "annotations" : [], + "mandatory" : false, + "match_type" : "Exact", + "type" : { + "type" : "bytes", + "width" : 1 + } + }, + { + "id" : 3, + "name" : "meta.dst_ip_addr", + "repeated" : false, + "annotations" : [], + "mandatory" : false, + "match_type" : "LPM", + "type" : { + "type" : "bytes", + "width" : 128 + } + } + ], + "action_specs" : [ + { + "id" : 21392322, + "name" : "route_vnet", + "action_scope" : "TableAndDefault", + "annotations" : [], + "data" : [ + { + "id" : 1, + "name" : "dst_vnet_id", + "repeated" : false, + "mandatory" : true, + "read_only" : false, + "annotations" : [], + "type" : { + "type" : "bytes", + "width" : 16 + } + }, + { + "id" : 2, + "name" : "meter_policy_en", + "repeated" : false, + "mandatory" : true, + "read_only" : false, + "annotations" : [], + "type" : { + "type" : "bytes", + "width" : 1 + } + }, + { + "id" : 3, + "name" : "meter_class", + "repeated" : false, + "mandatory" : true, + "read_only" : false, + "annotations" : [], + "type" : { + "type" : "bytes", + "width" : 16 + } + } + ] + }, + { + "id" : 24813914, + "name" : "route_vnet_direct", + "action_scope" : "TableAndDefault", + "annotations" : [], + "data" : [ + { + "id" : 1, + "name" : "dst_vnet_id", + "repeated" : false, + "mandatory" : true, + "read_only" : false, + "annotations" : [], + "type" : { + "type" : "bytes", + "width" : 16 + } + }, + { + "id" : 2, + "name" : "overlay_ip_is_v6", + "repeated" : false, + "mandatory" : true, + "read_only" : false, + "annotations" : [], + "type" : { + "type" : "bytes", + "width" : 1 + } + }, + { + "id" : 3, + "name" : "overlay_ip", + "repeated" : false, + "mandatory" : true, + "read_only" : false, + "annotations" : [], + "type" : { + "type" : "bytes", + "width" : 128 + } + }, + { + "id" : 4, + "name" : "meter_policy_en", + "repeated" : false, + "mandatory" : true, + "read_only" : false, + "annotations" : [], + "type" : { + "type" : "bytes", + "width" : 1 + } + }, + { + "id" : 5, + "name" : "meter_class", + "repeated" : false, + "mandatory" : true, + "read_only" : false, + "annotations" : [], + "type" : { + "type" : "bytes", + "width" : 16 + } + } + ] + }, + { + "id" : 31102279, + "name" : "route_direct", + "action_scope" : "TableAndDefault", + "annotations" : [], + "data" : [ + { + "id" : 1, + "name" : "meter_policy_en", + "repeated" : false, + "mandatory" : true, + "read_only" : false, + "annotations" : [], + "type" : { + "type" : "bytes", + "width" : 1 + } + }, + { + "id" : 2, + "name" : "meter_class", + "repeated" : false, + "mandatory" : true, + "read_only" : false, + "annotations" : [], + "type" : { + "type" : "bytes", + "width" : 16 + } + } + ] + }, + { + "id" : 26982790, + "name" : "route_service_tunnel", + "action_scope" : "TableAndDefault", + "annotations" : [], + "data" : [ + { + "id" : 1, + "name" : "overlay_dip_is_v6", + "repeated" : false, + "mandatory" : true, + "read_only" : false, + "annotations" : [], + "type" : { + "type" : "bytes", + "width" : 1 + } + }, + { + "id" : 2, + "name" : "overlay_dip", + "repeated" : false, + "mandatory" : true, + "read_only" : false, + "annotations" : [], + "type" : { + "type" : "bytes", + "width" : 128 + } + }, + { + "id" : 3, + "name" : "overlay_dip_mask_is_v6", + "repeated" : false, + "mandatory" : true, + "read_only" : false, + "annotations" : [], + "type" : { + "type" : "bytes", + "width" : 1 + } + }, + { + "id" : 4, + "name" : "overlay_dip_mask", + "repeated" : false, + "mandatory" : true, + "read_only" : false, + "annotations" : [], + "type" : { + "type" : "bytes", + "width" : 128 + } + }, + { + "id" : 5, + "name" : "overlay_sip_is_v6", + "repeated" : false, + "mandatory" : true, + "read_only" : false, + "annotations" : [], + "type" : { + "type" : "bytes", + "width" : 1 + } + }, + { + "id" : 6, + "name" : "overlay_sip", + "repeated" : false, + "mandatory" : true, + "read_only" : false, + "annotations" : [], + "type" : { + "type" : "bytes", + "width" : 128 + } + }, + { + "id" : 7, + "name" : "overlay_sip_mask_is_v6", + "repeated" : false, + "mandatory" : true, + "read_only" : false, + "annotations" : [], + "type" : { + "type" : "bytes", + "width" : 1 + } + }, + { + "id" : 8, + "name" : "overlay_sip_mask", + "repeated" : false, + "mandatory" : true, + "read_only" : false, + "annotations" : [], + "type" : { + "type" : "bytes", + "width" : 128 + } + }, + { + "id" : 9, + "name" : "underlay_dip_is_v6", + "repeated" : false, + "mandatory" : true, + "read_only" : false, + "annotations" : [], + "type" : { + "type" : "bytes", + "width" : 1 + } + }, + { + "id" : 10, + "name" : "underlay_dip", + "repeated" : false, + "mandatory" : true, + "read_only" : false, + "annotations" : [], + "type" : { + "type" : "bytes", + "width" : 128 + } + }, + { + "id" : 11, + "name" : "underlay_sip_is_v6", + "repeated" : false, + "mandatory" : true, + "read_only" : false, + "annotations" : [], + "type" : { + "type" : "bytes", + "width" : 1 + } + }, + { + "id" : 12, + "name" : "underlay_sip", + "repeated" : false, + "mandatory" : true, + "read_only" : false, + "annotations" : [], + "type" : { + "type" : "bytes", + "width" : 128 + } + }, + { + "id" : 13, + "name" : "dash_encapsulation", + "repeated" : false, + "mandatory" : true, + "read_only" : false, + "annotations" : [], + "type" : { + "type" : "bytes", + "width" : 16 + } + }, + { + "id" : 14, + "name" : "tunnel_key", + "repeated" : false, + "mandatory" : true, + "read_only" : false, + "annotations" : [], + "type" : { + "type" : "bytes", + "width" : 24 + } + }, + { + "id" : 15, + "name" : "meter_policy_en", + "repeated" : false, + "mandatory" : true, + "read_only" : false, + "annotations" : [], + "type" : { + "type" : "bytes", + "width" : 1 + } + }, + { + "id" : 16, + "name" : "meter_class", + "repeated" : false, + "mandatory" : true, + "read_only" : false, + "annotations" : [], + "type" : { + "type" : "bytes", + "width" : 16 + } + } + ] + }, + { + "id" : 18759588, + "name" : "drop", + "action_scope" : "TableAndDefault", + "annotations" : [], + "data" : [] + } + ], + "data" : [], + "supported_operations" : [], + "attributes" : ["EntryScope"] + }, + { + "name" : "pipe.dash_ingress.outbound.outbound_mapping_stage.ca_to_pa", + "id" : 43335456, + "table_type" : "MatchAction_Direct", + "size" : 1024, + "annotations" : [], + "depends_on" : [], + "has_const_default_action" : true, + "key" : [ + { + "id" : 1, + "name" : "meta.dst_vnet_id", + "repeated" : false, + "annotations" : [], + "mandatory" : false, + "match_type" : "Exact", + "type" : { + "type" : "bytes", + "width" : 16 + } + }, + { + "id" : 2, + "name" : "meta.is_lkup_dst_ip_v6", + "repeated" : false, + "annotations" : [], + "mandatory" : false, + "match_type" : "Exact", + "type" : { + "type" : "bytes", + "width" : 1 + } + }, + { + "id" : 3, + "name" : "meta.lkup_dst_ip_addr", + "repeated" : false, + "annotations" : [], + "mandatory" : false, + "match_type" : "Exact", + "type" : { + "type" : "bytes", + "width" : 128 + } + } + ], + "action_specs" : [ + { + "id" : 25614729, + "name" : "set_tunnel_mapping", + "action_scope" : "TableAndDefault", + "annotations" : [], + "data" : [ + { + "id" : 1, + "name" : "underlay_dip", + "repeated" : false, + "mandatory" : true, + "read_only" : false, + "annotations" : [], + "type" : { + "type" : "bytes", + "width" : 32 + } + }, + { + "id" : 2, + "name" : "overlay_dmac", + "repeated" : false, + "mandatory" : true, + "read_only" : false, + "annotations" : [], + "type" : { + "type" : "bytes", + "width" : 48 + } + }, + { + "id" : 3, + "name" : "use_dst_vnet_vni", + "repeated" : false, + "mandatory" : true, + "read_only" : false, + "annotations" : [], + "type" : { + "type" : "bytes", + "width" : 1 + } + }, + { + "id" : 4, + "name" : "meter_class", + "repeated" : false, + "mandatory" : true, + "read_only" : false, + "annotations" : [], + "type" : { + "type" : "bytes", + "width" : 16 + } + }, + { + "id" : 5, + "name" : "meter_class_override", + "repeated" : false, + "mandatory" : true, + "read_only" : false, + "annotations" : [], + "type" : { + "type" : "bytes", + "width" : 1 + } + } + ] + }, + { + "id" : 31441909, + "name" : "set_private_link_mapping", + "action_scope" : "TableAndDefault", + "annotations" : [], + "data" : [ + { + "id" : 1, + "name" : "underlay_dip", + "repeated" : false, + "mandatory" : true, + "read_only" : false, + "annotations" : [], + "type" : { + "type" : "bytes", + "width" : 32 + } + }, + { + "id" : 2, + "name" : "overlay_sip", + "repeated" : false, + "mandatory" : true, + "read_only" : false, + "annotations" : [], + "type" : { + "type" : "bytes", + "width" : 128 + } + }, + { + "id" : 3, + "name" : "overlay_dip", + "repeated" : false, + "mandatory" : true, + "read_only" : false, + "annotations" : [], + "type" : { + "type" : "bytes", + "width" : 128 + } + }, + { + "id" : 4, + "name" : "dash_encapsulation", + "repeated" : false, + "mandatory" : true, + "read_only" : false, + "annotations" : [], + "type" : { + "type" : "bytes", + "width" : 16 + } + }, + { + "id" : 5, + "name" : "tunnel_key", + "repeated" : false, + "mandatory" : true, + "read_only" : false, + "annotations" : [], + "type" : { + "type" : "bytes", + "width" : 24 + } + }, + { + "id" : 6, + "name" : "meter_class", + "repeated" : false, + "mandatory" : true, + "read_only" : false, + "annotations" : [], + "type" : { + "type" : "bytes", + "width" : 16 + } + }, + { + "id" : 7, + "name" : "meter_class_override", + "repeated" : false, + "mandatory" : true, + "read_only" : false, + "annotations" : [], + "type" : { + "type" : "bytes", + "width" : 1 + } + } + ] + }, + { + "id" : 18759588, + "name" : "drop", + "action_scope" : "DefaultOnly", + "annotations" : [ + { + "name" : "@defaultonly" + } + ], + "data" : [] + } + ], + "data" : [], + "supported_operations" : [], + "attributes" : ["EntryScope"] + }, + { + "name" : "pipe.dash_ingress.outbound.outbound_mapping_stage.vnet", + "id" : 49590243, + "table_type" : "MatchAction_Direct", + "size" : 1024, + "annotations" : [], + "depends_on" : [], + "has_const_default_action" : false, + "key" : [ + { + "id" : 1, + "name" : "meta.vnet_id", + "repeated" : false, + "annotations" : [], + "mandatory" : false, + "match_type" : "Exact", + "type" : { + "type" : "bytes", + "width" : 16 + } + } + ], + "action_specs" : [ + { + "id" : 20510911, + "name" : "dash_ingress.outbound.outbound_mapping_stage.set_vnet_attrs", + "action_scope" : "TableAndDefault", + "annotations" : [], + "data" : [ + { + "id" : 1, + "name" : "vni", + "repeated" : false, + "mandatory" : true, + "read_only" : false, + "annotations" : [], + "type" : { + "type" : "bytes", + "width" : 24 + } + } + ] + }, + { + "id" : 21257015, + "name" : "NoAction", + "action_scope" : "DefaultOnly", + "annotations" : [ + { + "name" : "@defaultonly" + } + ], + "data" : [] + } + ], + "data" : [], + "supported_operations" : [], + "attributes" : ["EntryScope"] + }, + { + "name" : "pipe.dash_ingress.inbound.acl.stage1", + "id" : 41950136, + "table_type" : "MatchAction_Direct", + "size" : 1024, + "annotations" : [], + "depends_on" : [], + "has_const_default_action" : false, + "key" : [ + { + "id" : 1, + "name" : "meta.stage1_dash_acl_group_id", + "repeated" : false, + "annotations" : [], + "mandatory" : false, + "match_type" : "Exact", + "type" : { + "type" : "bytes", + "width" : 16 + } + }, + { + "id" : 2, + "name" : "meta.dst_ip_addr", + "repeated" : false, + "annotations" : [], + "mandatory" : false, + "match_type" : "Ternary", + "type" : { + "type" : "bytes", + "width" : 128 + } + }, + { + "id" : 3, + "name" : "meta.src_ip_addr", + "repeated" : false, + "annotations" : [], + "mandatory" : false, + "match_type" : "Ternary", + "type" : { + "type" : "bytes", + "width" : 128 + } + }, + { + "id" : 4, + "name" : "meta.ip_protocol", + "repeated" : false, + "annotations" : [], + "mandatory" : false, + "match_type" : "Ternary", + "type" : { + "type" : "bytes", + "width" : 8 + } + }, + { + "id" : 5, + "name" : "meta.src_l4_port", + "repeated" : false, + "annotations" : [], + "mandatory" : false, + "match_type" : "Ternary", + "type" : { + "type" : "bytes", + "width" : 16 + } + }, + { + "id" : 6, + "name" : "meta.dst_l4_port", + "repeated" : false, + "annotations" : [], + "mandatory" : false, + "match_type" : "Ternary", + "type" : { + "type" : "bytes", + "width" : 16 + } + }, + { + "id" : 65537, + "name" : "$MATCH_PRIORITY", + "repeated" : false, + "annotations" : [], + "mandatory" : false, + "match_type" : "Exact", + "type" : { + "type" : "uint32" + } + } + ], + "action_specs" : [ + { + "id" : 32161567, + "name" : "dash_ingress.inbound.acl.permit", + "action_scope" : "TableAndDefault", + "annotations" : [], + "data" : [] + }, + { + "id" : 20706700, + "name" : "dash_ingress.inbound.acl.permit_and_continue", + "action_scope" : "TableAndDefault", + "annotations" : [], + "data" : [] + }, + { + "id" : 28146588, + "name" : "dash_ingress.inbound.acl.deny", + "action_scope" : "TableAndDefault", + "annotations" : [], + "data" : [] + }, + { + "id" : 31424218, + "name" : "dash_ingress.inbound.acl.deny_and_continue", + "action_scope" : "TableAndDefault", + "annotations" : [], + "data" : [] + } + ], + "data" : [], + "supported_operations" : [], + "attributes" : ["EntryScope"] + }, + { + "name" : "pipe.dash_ingress.inbound.acl.stage2", + "id" : 43016664, + "table_type" : "MatchAction_Direct", + "size" : 1024, + "annotations" : [], + "depends_on" : [], + "has_const_default_action" : false, + "key" : [ + { + "id" : 1, + "name" : "meta.stage2_dash_acl_group_id", + "repeated" : false, + "annotations" : [], + "mandatory" : false, + "match_type" : "Exact", + "type" : { + "type" : "bytes", + "width" : 16 + } + }, + { + "id" : 2, + "name" : "meta.dst_ip_addr", + "repeated" : false, + "annotations" : [], + "mandatory" : false, + "match_type" : "Ternary", + "type" : { + "type" : "bytes", + "width" : 128 + } + }, + { + "id" : 3, + "name" : "meta.src_ip_addr", + "repeated" : false, + "annotations" : [], + "mandatory" : false, + "match_type" : "Ternary", + "type" : { + "type" : "bytes", + "width" : 128 + } + }, + { + "id" : 4, + "name" : "meta.ip_protocol", + "repeated" : false, + "annotations" : [], + "mandatory" : false, + "match_type" : "Ternary", + "type" : { + "type" : "bytes", + "width" : 8 + } + }, + { + "id" : 5, + "name" : "meta.src_l4_port", + "repeated" : false, + "annotations" : [], + "mandatory" : false, + "match_type" : "Ternary", + "type" : { + "type" : "bytes", + "width" : 16 + } + }, + { + "id" : 6, + "name" : "meta.dst_l4_port", + "repeated" : false, + "annotations" : [], + "mandatory" : false, + "match_type" : "Ternary", + "type" : { + "type" : "bytes", + "width" : 16 + } + }, + { + "id" : 65537, + "name" : "$MATCH_PRIORITY", + "repeated" : false, + "annotations" : [], + "mandatory" : false, + "match_type" : "Exact", + "type" : { + "type" : "uint32" + } + } + ], + "action_specs" : [ + { + "id" : 32161567, + "name" : "dash_ingress.inbound.acl.permit", + "action_scope" : "TableAndDefault", + "annotations" : [], + "data" : [] + }, + { + "id" : 20706700, + "name" : "dash_ingress.inbound.acl.permit_and_continue", + "action_scope" : "TableAndDefault", + "annotations" : [], + "data" : [] + }, + { + "id" : 28146588, + "name" : "dash_ingress.inbound.acl.deny", + "action_scope" : "TableAndDefault", + "annotations" : [], + "data" : [] + }, + { + "id" : 31424218, + "name" : "dash_ingress.inbound.acl.deny_and_continue", + "action_scope" : "TableAndDefault", + "annotations" : [], + "data" : [] + } + ], + "data" : [], + "supported_operations" : [], + "attributes" : ["EntryScope"] + }, + { + "name" : "pipe.dash_ingress.inbound.acl.stage3", + "id" : 49695908, + "table_type" : "MatchAction_Direct", + "size" : 1024, + "annotations" : [], + "depends_on" : [], + "has_const_default_action" : false, + "key" : [ + { + "id" : 1, + "name" : "meta.stage3_dash_acl_group_id", + "repeated" : false, + "annotations" : [], + "mandatory" : false, + "match_type" : "Exact", + "type" : { + "type" : "bytes", + "width" : 16 + } + }, + { + "id" : 2, + "name" : "meta.dst_ip_addr", + "repeated" : false, + "annotations" : [], + "mandatory" : false, + "match_type" : "Ternary", + "type" : { + "type" : "bytes", + "width" : 128 + } + }, + { + "id" : 3, + "name" : "meta.src_ip_addr", + "repeated" : false, + "annotations" : [], + "mandatory" : false, + "match_type" : "Ternary", + "type" : { + "type" : "bytes", + "width" : 128 + } + }, + { + "id" : 4, + "name" : "meta.ip_protocol", + "repeated" : false, + "annotations" : [], + "mandatory" : false, + "match_type" : "Ternary", + "type" : { + "type" : "bytes", + "width" : 8 + } + }, + { + "id" : 5, + "name" : "meta.src_l4_port", + "repeated" : false, + "annotations" : [], + "mandatory" : false, + "match_type" : "Ternary", + "type" : { + "type" : "bytes", + "width" : 16 + } + }, + { + "id" : 6, + "name" : "meta.dst_l4_port", + "repeated" : false, + "annotations" : [], + "mandatory" : false, + "match_type" : "Ternary", + "type" : { + "type" : "bytes", + "width" : 16 + } + }, + { + "id" : 65537, + "name" : "$MATCH_PRIORITY", + "repeated" : false, + "annotations" : [], + "mandatory" : false, + "match_type" : "Exact", + "type" : { + "type" : "uint32" + } + } + ], + "action_specs" : [ + { + "id" : 32161567, + "name" : "dash_ingress.inbound.acl.permit", + "action_scope" : "TableAndDefault", + "annotations" : [], + "data" : [] + }, + { + "id" : 20706700, + "name" : "dash_ingress.inbound.acl.permit_and_continue", + "action_scope" : "TableAndDefault", + "annotations" : [], + "data" : [] + }, + { + "id" : 28146588, + "name" : "dash_ingress.inbound.acl.deny", + "action_scope" : "TableAndDefault", + "annotations" : [], + "data" : [] + }, + { + "id" : 31424218, + "name" : "dash_ingress.inbound.acl.deny_and_continue", + "action_scope" : "TableAndDefault", + "annotations" : [], + "data" : [] + } + ], + "data" : [], + "supported_operations" : [], + "attributes" : ["EntryScope"] + }, + { + "name" : "pipe.dash_ingress.underlay.underlay_routing", + "id" : 49279256, + "table_type" : "MatchAction_Direct", + "size" : 1024, + "annotations" : [], + "depends_on" : [], + "has_const_default_action" : false, + "key" : [ + { + "id" : 1, + "name" : "meta.dst_ip_addr", + "repeated" : false, + "annotations" : [], + "mandatory" : false, + "match_type" : "LPM", + "type" : { + "type" : "bytes", + "width" : 128 + } + } + ], + "action_specs" : [ + { + "id" : 32404057, + "name" : "dash_ingress.underlay.pkt_act", + "action_scope" : "TableAndDefault", + "annotations" : [], + "data" : [ + { + "id" : 1, + "name" : "packet_action", + "repeated" : false, + "mandatory" : true, + "read_only" : false, + "annotations" : [], + "type" : { + "type" : "bytes", + "width" : 9 + } + }, + { + "id" : 2, + "name" : "next_hop_id", + "repeated" : false, + "mandatory" : true, + "read_only" : false, + "annotations" : [], + "type" : { + "type" : "bytes", + "width" : 9 + } + } + ] + }, + { + "id" : 25628750, + "name" : "dash_ingress.underlay.def_act", + "action_scope" : "DefaultOnly", + "annotations" : [ + { + "name" : "@defaultonly" + } + ], + "data" : [] + }, + { + "id" : 21257015, + "name" : "NoAction", + "action_scope" : "DefaultOnly", + "annotations" : [ + { + "name" : "@defaultonly" + } + ], + "data" : [] + } + ], + "data" : [], + "supported_operations" : [], + "attributes" : ["EntryScope"] + }, + { + "name" : "pipe.dash_ingress.metering_update_stage.meter_policy", + "id" : 40733610, + "table_type" : "MatchAction_Direct", + "size" : 1024, + "annotations" : [], + "depends_on" : [], + "has_const_default_action" : false, + "key" : [ + { + "id" : 1, + "name" : "meta.meter_policy_id", + "repeated" : false, + "annotations" : [], + "mandatory" : false, + "match_type" : "Exact", + "type" : { + "type" : "bytes", + "width" : 16 + } + } + ], + "action_specs" : [ + { + "id" : 20564717, + "name" : "dash_ingress.metering_update_stage.check_ip_addr_family", + "action_scope" : "TableAndDefault", + "annotations" : [], + "data" : [ + { + "id" : 1, + "name" : "ip_addr_family", + "repeated" : false, + "mandatory" : true, + "read_only" : false, + "annotations" : [], + "type" : { + "type" : "bytes", + "width" : 32 + } + } + ] + }, + { + "id" : 21257015, + "name" : "NoAction", + "action_scope" : "DefaultOnly", + "annotations" : [ + { + "name" : "@defaultonly" + } + ], + "data" : [] + } + ], + "data" : [], + "supported_operations" : [], + "attributes" : ["EntryScope"] + }, + { + "name" : "pipe.dash_ingress.metering_update_stage.meter_rule", + "id" : 44484556, + "table_type" : "MatchAction_Direct", + "size" : 1024, + "annotations" : [], + "depends_on" : [], + "has_const_default_action" : true, + "key" : [ + { + "id" : 1, + "name" : "meta.meter_policy_id", + "repeated" : false, + "annotations" : [], + "mandatory" : false, + "match_type" : "Exact", + "type" : { + "type" : "bytes", + "width" : 16 + } + }, + { + "id" : 2, + "name" : "hdr.u0_ipv4.dst_addr", + "repeated" : false, + "annotations" : [], + "mandatory" : false, + "match_type" : "Ternary", + "type" : { + "type" : "bytes", + "width" : 32 + } + }, + { + "id" : 65537, + "name" : "$MATCH_PRIORITY", + "repeated" : false, + "annotations" : [], + "mandatory" : false, + "match_type" : "Exact", + "type" : { + "type" : "uint32" + } + } + ], + "action_specs" : [ + { + "id" : 19652160, + "name" : "dash_ingress.metering_update_stage.set_policy_meter_class", + "action_scope" : "TableAndDefault", + "annotations" : [], + "data" : [ + { + "id" : 1, + "name" : "meter_class", + "repeated" : false, + "mandatory" : true, + "read_only" : false, + "annotations" : [], + "type" : { + "type" : "bytes", + "width" : 16 + } + } + ] + }, + { + "id" : 21257015, + "name" : "NoAction", + "action_scope" : "DefaultOnly", + "annotations" : [ + { + "name" : "@defaultonly" + } + ], + "data" : [] + } + ], + "data" : [], + "supported_operations" : [], + "attributes" : ["EntryScope"] + }, + { + "name" : "pipe.dash_ingress.metering_update_stage.meter_bucket", + "id" : 45482818, + "table_type" : "MatchAction_Direct", + "size" : 1024, + "annotations" : [], + "depends_on" : [], + "has_const_default_action" : true, + "key" : [ + { + "id" : 1, + "name" : "meta.eni_id", + "repeated" : false, + "annotations" : [], + "mandatory" : false, + "match_type" : "Exact", + "type" : { + "type" : "bytes", + "width" : 16 + } + }, + { + "id" : 2, + "name" : "meta.meter_class", + "repeated" : false, + "annotations" : [], + "mandatory" : false, + "match_type" : "Exact", + "type" : { + "type" : "bytes", + "width" : 16 + } + } + ], + "action_specs" : [ + { + "id" : 21630451, + "name" : "dash_ingress.metering_update_stage.meter_bucket_action", + "action_scope" : "TableAndDefault", + "annotations" : [], + "data" : [ + { + "id" : 1, + "name" : "meter_bucket_index", + "repeated" : false, + "mandatory" : true, + "read_only" : false, + "annotations" : [], + "type" : { + "type" : "bytes", + "width" : 32 + } + } + ] + }, + { + "id" : 21257015, + "name" : "NoAction", + "action_scope" : "DefaultOnly", + "annotations" : [ + { + "name" : "@defaultonly" + } + ], + "data" : [] + } + ], + "data" : [], + "supported_operations" : [], + "attributes" : ["EntryScope"] + }, + { + "name" : "pipe.dash_ingress.metering_update_stage.eni_meter", + "id" : 43925284, + "table_type" : "MatchAction_Direct", + "size" : 1024, + "annotations" : [], + "depends_on" : [], + "has_const_default_action" : false, + "key" : [ + { + "id" : 1, + "name" : "meta.eni_id", + "repeated" : false, + "annotations" : [], + "mandatory" : false, + "match_type" : "Exact", + "type" : { + "type" : "bytes", + "width" : 16 + } + }, + { + "id" : 2, + "name" : "meta.direction", + "repeated" : false, + "annotations" : [], + "mandatory" : false, + "match_type" : "Exact", + "type" : { + "type" : "bytes", + "width" : 16 + } + }, + { + "id" : 3, + "name" : "meta.dropped", + "repeated" : false, + "annotations" : [], + "mandatory" : false, + "match_type" : "Exact", + "type" : { + "type" : "bytes", + "width" : 1 + } + } + ], + "action_specs" : [ + { + "id" : 21257015, + "name" : "NoAction", + "action_scope" : "TableAndDefault", + "annotations" : [], + "data" : [] + } + ], + "data" : [], + "supported_operations" : [], + "attributes" : ["EntryScope"] + } + ], + "learn_filters" : [] +} \ No newline at end of file diff --git a/testdata/p4_16_samples/pna-ipv6-actions.p4 b/testdata/p4_16_samples/pna-ipv6-actions.p4 index 9f802bd6420..56f85e02c9b 100644 --- a/testdata/p4_16_samples/pna-ipv6-actions.p4 +++ b/testdata/p4_16_samples/pna-ipv6-actions.p4 @@ -117,6 +117,30 @@ control MainControlImpl( tmp1 = (bit<32>)headers.ipv6.srcAddr; } + action ipv6_addr_or() { + headers.ipv6.dstAddr = headers.ipv6.dstAddr | headers.ipv6.srcAddr; + } + + action ipv6_addr_and() { + headers.ipv6.dstAddr = tmp & headers.ipv6.srcAddr; + } + + action ipv6_addr_xor() { + headers.ipv6.dstAddr = headers.ipv6.dstAddr ^ tmp; + } + + action ipv6_addr_comp1() { + headers.ipv6.dstAddr = (headers.ipv6.dstAddr == headers.ipv6.srcAddr) ? headers.ipv6.dstAddr : headers.ipv6.srcAddr; + } + + action ipv6_addr_comp2() { + headers.ipv6.dstAddr = (headers.ipv6.dstAddr != headers.ipv6.srcAddr) ? headers.ipv6.dstAddr : headers.ipv6.srcAddr; + } + + action ipv6_addr_cmpl() { + headers.ipv6.dstAddr = ~headers.ipv6.srcAddr; + } + action ipv6_swap_addr() { headers.ipv6.dstAddr = headers.ipv6.srcAddr; headers.ipv6.srcAddr = tmp; @@ -156,6 +180,12 @@ control MainControlImpl( ipv6_modify_dstAddr; ipv6_swap_addr; set_flowlabel; + ipv6_addr_or; + ipv6_addr_xor; + ipv6_addr_and; + ipv6_addr_comp1; + ipv6_addr_comp2; + ipv6_addr_cmpl; set_traffic_class_flow_label; set_ipv6_version; set_next_hdr; diff --git a/testdata/p4_16_samples_outputs/pna-ipv6-actions-first.p4 b/testdata/p4_16_samples_outputs/pna-ipv6-actions-first.p4 index 670e1b9b4be..5759e7b8d10 100644 --- a/testdata/p4_16_samples_outputs/pna-ipv6-actions-first.p4 +++ b/testdata/p4_16_samples_outputs/pna-ipv6-actions-first.p4 @@ -91,6 +91,24 @@ control MainControlImpl(inout headers_t headers, inout main_metadata_t meta, in headers.ipv6.dstAddr = (bit<128>)dstAddr; tmp1 = (bit<32>)headers.ipv6.srcAddr; } + action ipv6_addr_or() { + headers.ipv6.dstAddr = headers.ipv6.dstAddr | headers.ipv6.srcAddr; + } + action ipv6_addr_and() { + headers.ipv6.dstAddr = tmp & headers.ipv6.srcAddr; + } + action ipv6_addr_xor() { + headers.ipv6.dstAddr = headers.ipv6.dstAddr ^ tmp; + } + action ipv6_addr_comp1() { + headers.ipv6.dstAddr = (headers.ipv6.dstAddr == headers.ipv6.srcAddr ? headers.ipv6.dstAddr : headers.ipv6.srcAddr); + } + action ipv6_addr_comp2() { + headers.ipv6.dstAddr = (headers.ipv6.dstAddr != headers.ipv6.srcAddr ? headers.ipv6.dstAddr : headers.ipv6.srcAddr); + } + action ipv6_addr_cmpl() { + headers.ipv6.dstAddr = ~headers.ipv6.srcAddr; + } action ipv6_swap_addr() { headers.ipv6.dstAddr = headers.ipv6.srcAddr; headers.ipv6.srcAddr = tmp; @@ -123,6 +141,12 @@ control MainControlImpl(inout headers_t headers, inout main_metadata_t meta, in ipv6_modify_dstAddr(); ipv6_swap_addr(); set_flowlabel(); + ipv6_addr_or(); + ipv6_addr_xor(); + ipv6_addr_and(); + ipv6_addr_comp1(); + ipv6_addr_comp2(); + ipv6_addr_cmpl(); set_traffic_class_flow_label(); set_ipv6_version(); set_next_hdr(); diff --git a/testdata/p4_16_samples_outputs/pna-ipv6-actions-frontend.p4 b/testdata/p4_16_samples_outputs/pna-ipv6-actions-frontend.p4 index eca6c6ba8e8..98e4273b622 100644 --- a/testdata/p4_16_samples_outputs/pna-ipv6-actions-frontend.p4 +++ b/testdata/p4_16_samples_outputs/pna-ipv6-actions-frontend.p4 @@ -82,8 +82,10 @@ parser MainParserImpl(packet_in p, out headers_t headers, inout main_metadata_t } control MainControlImpl(inout headers_t headers, inout main_metadata_t meta, in pna_main_input_metadata_t istd, inout pna_main_output_metadata_t ostd) { - @name("MainControlImpl.tmp") bit<128> tmp_0; + @name("MainControlImpl.tmp") bit<128> tmp; @name("MainControlImpl.tmp1") bit<32> tmp1_0; + @name("MainControlImpl.tmp") bit<128> tmp_0; + @name("MainControlImpl.tmp_1") bit<128> tmp_1; @noWarn("unused") @name(".NoAction") action NoAction_1() { } @name("MainControlImpl.Reject") action Reject() { @@ -92,9 +94,37 @@ control MainControlImpl(inout headers_t headers, inout main_metadata_t meta, in @name("MainControlImpl.ipv6_modify_dstAddr") action ipv6_modify_dstAddr(@name("dstAddr") bit<32> dstAddr_1) { headers.ipv6.dstAddr = (bit<128>)dstAddr_1; } + @name("MainControlImpl.ipv6_addr_or") action ipv6_addr_or() { + headers.ipv6.dstAddr = headers.ipv6.dstAddr | headers.ipv6.srcAddr; + } + @name("MainControlImpl.ipv6_addr_and") action ipv6_addr_and() { + headers.ipv6.dstAddr = tmp & headers.ipv6.srcAddr; + } + @name("MainControlImpl.ipv6_addr_xor") action ipv6_addr_xor() { + headers.ipv6.dstAddr = headers.ipv6.dstAddr ^ tmp; + } + @name("MainControlImpl.ipv6_addr_comp1") action ipv6_addr_comp1() { + if (headers.ipv6.dstAddr == headers.ipv6.srcAddr) { + tmp_0 = headers.ipv6.dstAddr; + } else { + tmp_0 = headers.ipv6.srcAddr; + } + headers.ipv6.dstAddr = tmp_0; + } + @name("MainControlImpl.ipv6_addr_comp2") action ipv6_addr_comp2() { + if (headers.ipv6.dstAddr != headers.ipv6.srcAddr) { + tmp_1 = headers.ipv6.dstAddr; + } else { + tmp_1 = headers.ipv6.srcAddr; + } + headers.ipv6.dstAddr = tmp_1; + } + @name("MainControlImpl.ipv6_addr_cmpl") action ipv6_addr_cmpl() { + headers.ipv6.dstAddr = ~headers.ipv6.srcAddr; + } @name("MainControlImpl.ipv6_swap_addr") action ipv6_swap_addr() { headers.ipv6.dstAddr = headers.ipv6.srcAddr; - headers.ipv6.srcAddr = tmp_0; + headers.ipv6.srcAddr = tmp; } @name("MainControlImpl.set_flowlabel") action set_flowlabel(@name("label") bit<20> label_2) { headers.ipv6.flowLabel = label_2; @@ -121,6 +151,12 @@ control MainControlImpl(inout headers_t headers, inout main_metadata_t meta, in ipv6_modify_dstAddr(); ipv6_swap_addr(); set_flowlabel(); + ipv6_addr_or(); + ipv6_addr_xor(); + ipv6_addr_and(); + ipv6_addr_comp1(); + ipv6_addr_comp2(); + ipv6_addr_cmpl(); set_traffic_class_flow_label(); set_ipv6_version(); set_next_hdr(); @@ -131,7 +167,7 @@ control MainControlImpl(inout headers_t headers, inout main_metadata_t meta, in default_action = NoAction_1(); } apply { - tmp_0 = 128w0x76; + tmp = 128w0x76; filter_tbl_0.apply(); } } diff --git a/testdata/p4_16_samples_outputs/pna-ipv6-actions-midend.p4 b/testdata/p4_16_samples_outputs/pna-ipv6-actions-midend.p4 index 1f7c2c7451b..f70a8b1c203 100644 --- a/testdata/p4_16_samples_outputs/pna-ipv6-actions-midend.p4 +++ b/testdata/p4_16_samples_outputs/pna-ipv6-actions-midend.p4 @@ -80,8 +80,10 @@ parser MainParserImpl(packet_in p, out headers_t headers, inout main_metadata_t } control MainControlImpl(inout headers_t headers, inout main_metadata_t meta, in pna_main_input_metadata_t istd, inout pna_main_output_metadata_t ostd) { - @name("MainControlImpl.tmp") bit<128> tmp_0; + @name("MainControlImpl.tmp") bit<128> tmp; @name("MainControlImpl.tmp1") bit<32> tmp1_0; + @name("MainControlImpl.tmp") bit<128> tmp_0; + @name("MainControlImpl.tmp_1") bit<128> tmp_1; @noWarn("unused") @name(".NoAction") action NoAction_1() { } @name("MainControlImpl.Reject") action Reject() { @@ -90,9 +92,37 @@ control MainControlImpl(inout headers_t headers, inout main_metadata_t meta, in @name("MainControlImpl.ipv6_modify_dstAddr") action ipv6_modify_dstAddr(@name("dstAddr") bit<32> dstAddr_1) { headers.ipv6.dstAddr = (bit<128>)dstAddr_1; } + @name("MainControlImpl.ipv6_addr_or") action ipv6_addr_or() { + headers.ipv6.dstAddr = headers.ipv6.dstAddr | headers.ipv6.srcAddr; + } + @name("MainControlImpl.ipv6_addr_and") action ipv6_addr_and() { + headers.ipv6.dstAddr = tmp & headers.ipv6.srcAddr; + } + @name("MainControlImpl.ipv6_addr_xor") action ipv6_addr_xor() { + headers.ipv6.dstAddr = headers.ipv6.dstAddr ^ tmp; + } + @name("MainControlImpl.ipv6_addr_comp1") action ipv6_addr_comp1() { + if (headers.ipv6.dstAddr == headers.ipv6.srcAddr) { + tmp_0 = headers.ipv6.dstAddr; + } else { + tmp_0 = headers.ipv6.srcAddr; + } + headers.ipv6.dstAddr = tmp_0; + } + @name("MainControlImpl.ipv6_addr_comp2") action ipv6_addr_comp2() { + if (headers.ipv6.dstAddr != headers.ipv6.srcAddr) { + tmp_1 = headers.ipv6.dstAddr; + } else { + tmp_1 = headers.ipv6.srcAddr; + } + headers.ipv6.dstAddr = tmp_1; + } + @name("MainControlImpl.ipv6_addr_cmpl") action ipv6_addr_cmpl() { + headers.ipv6.dstAddr = ~headers.ipv6.srcAddr; + } @name("MainControlImpl.ipv6_swap_addr") action ipv6_swap_addr() { headers.ipv6.dstAddr = headers.ipv6.srcAddr; - headers.ipv6.srcAddr = tmp_0; + headers.ipv6.srcAddr = tmp; } @name("MainControlImpl.set_flowlabel") action set_flowlabel(@name("label") bit<20> label_2) { headers.ipv6.flowLabel = label_2; @@ -119,6 +149,12 @@ control MainControlImpl(inout headers_t headers, inout main_metadata_t meta, in ipv6_modify_dstAddr(); ipv6_swap_addr(); set_flowlabel(); + ipv6_addr_or(); + ipv6_addr_xor(); + ipv6_addr_and(); + ipv6_addr_comp1(); + ipv6_addr_comp2(); + ipv6_addr_cmpl(); set_traffic_class_flow_label(); set_ipv6_version(); set_next_hdr(); @@ -129,7 +165,7 @@ control MainControlImpl(inout headers_t headers, inout main_metadata_t meta, in default_action = NoAction_1(); } @hidden action pnaipv6actions109() { - tmp_0 = 128w0x76; + tmp = 128w0x76; } @hidden table tbl_pnaipv6actions109 { actions = { @@ -144,20 +180,20 @@ control MainControlImpl(inout headers_t headers, inout main_metadata_t meta, in } control MainDeparserImpl(packet_out packet, in headers_t headers, in main_metadata_t user_meta, in pna_main_output_metadata_t ostd) { - @hidden action pnaipv6actions180() { + @hidden action pnaipv6actions210() { packet.emit(headers.ethernet); packet.emit(headers.mpls); packet.emit(headers.ipv6); packet.emit(headers.ipv4); } - @hidden table tbl_pnaipv6actions180 { + @hidden table tbl_pnaipv6actions210 { actions = { - pnaipv6actions180(); + pnaipv6actions210(); } - const default_action = pnaipv6actions180(); + const default_action = pnaipv6actions210(); } apply { - tbl_pnaipv6actions180.apply(); + tbl_pnaipv6actions210.apply(); } } diff --git a/testdata/p4_16_samples_outputs/pna-ipv6-actions.p4 b/testdata/p4_16_samples_outputs/pna-ipv6-actions.p4 index 782d6b2869c..6223a734943 100644 --- a/testdata/p4_16_samples_outputs/pna-ipv6-actions.p4 +++ b/testdata/p4_16_samples_outputs/pna-ipv6-actions.p4 @@ -91,6 +91,24 @@ control MainControlImpl(inout headers_t headers, inout main_metadata_t meta, in headers.ipv6.dstAddr = (bit<128>)dstAddr; tmp1 = (bit<32>)headers.ipv6.srcAddr; } + action ipv6_addr_or() { + headers.ipv6.dstAddr = headers.ipv6.dstAddr | headers.ipv6.srcAddr; + } + action ipv6_addr_and() { + headers.ipv6.dstAddr = tmp & headers.ipv6.srcAddr; + } + action ipv6_addr_xor() { + headers.ipv6.dstAddr = headers.ipv6.dstAddr ^ tmp; + } + action ipv6_addr_comp1() { + headers.ipv6.dstAddr = (headers.ipv6.dstAddr == headers.ipv6.srcAddr ? headers.ipv6.dstAddr : headers.ipv6.srcAddr); + } + action ipv6_addr_comp2() { + headers.ipv6.dstAddr = (headers.ipv6.dstAddr != headers.ipv6.srcAddr ? headers.ipv6.dstAddr : headers.ipv6.srcAddr); + } + action ipv6_addr_cmpl() { + headers.ipv6.dstAddr = ~headers.ipv6.srcAddr; + } action ipv6_swap_addr() { headers.ipv6.dstAddr = headers.ipv6.srcAddr; headers.ipv6.srcAddr = tmp; @@ -123,6 +141,12 @@ control MainControlImpl(inout headers_t headers, inout main_metadata_t meta, in ipv6_modify_dstAddr; ipv6_swap_addr; set_flowlabel; + ipv6_addr_or; + ipv6_addr_xor; + ipv6_addr_and; + ipv6_addr_comp1; + ipv6_addr_comp2; + ipv6_addr_cmpl; set_traffic_class_flow_label; set_ipv6_version; set_next_hdr; diff --git a/testdata/p4_16_samples_outputs/pna-ipv6-actions.p4-error b/testdata/p4_16_samples_outputs/pna-ipv6-actions.p4-error index 96915c1b3ee..abe0c3c1fe8 100644 --- a/testdata/p4_16_samples_outputs/pna-ipv6-actions.p4-error +++ b/testdata/p4_16_samples_outputs/pna-ipv6-actions.p4-error @@ -1,3 +1,3 @@ -pna-ipv6-actions.p4(136): [--Wwarn=uninitialized_use] warning: tmp1 may be uninitialized +pna-ipv6-actions.p4(160): [--Wwarn=uninitialized_use] warning: tmp1 may be uninitialized headers.ipv6.srcAddr = (bit<128>)tmp1; ^^^^ diff --git a/testdata/p4_16_samples_outputs/pna-ipv6-actions.p4-stderr b/testdata/p4_16_samples_outputs/pna-ipv6-actions.p4-stderr index 96915c1b3ee..abe0c3c1fe8 100644 --- a/testdata/p4_16_samples_outputs/pna-ipv6-actions.p4-stderr +++ b/testdata/p4_16_samples_outputs/pna-ipv6-actions.p4-stderr @@ -1,3 +1,3 @@ -pna-ipv6-actions.p4(136): [--Wwarn=uninitialized_use] warning: tmp1 may be uninitialized +pna-ipv6-actions.p4(160): [--Wwarn=uninitialized_use] warning: tmp1 may be uninitialized headers.ipv6.srcAddr = (bit<128>)tmp1; ^^^^ diff --git a/testdata/p4_16_samples_outputs/pna-ipv6-actions.p4.bfrt.json b/testdata/p4_16_samples_outputs/pna-ipv6-actions.p4.bfrt.json index 03ee286a952..17da9ba7eb8 100644 --- a/testdata/p4_16_samples_outputs/pna-ipv6-actions.p4.bfrt.json +++ b/testdata/p4_16_samples_outputs/pna-ipv6-actions.p4.bfrt.json @@ -71,6 +71,48 @@ } ] }, + { + "id" : 23072859, + "name" : "MainControlImpl.ipv6_addr_or", + "action_scope" : "TableAndDefault", + "annotations" : [], + "data" : [] + }, + { + "id" : 26319412, + "name" : "MainControlImpl.ipv6_addr_xor", + "action_scope" : "TableAndDefault", + "annotations" : [], + "data" : [] + }, + { + "id" : 22390528, + "name" : "MainControlImpl.ipv6_addr_and", + "action_scope" : "TableAndDefault", + "annotations" : [], + "data" : [] + }, + { + "id" : 17555934, + "name" : "MainControlImpl.ipv6_addr_comp1", + "action_scope" : "TableAndDefault", + "annotations" : [], + "data" : [] + }, + { + "id" : 30885237, + "name" : "MainControlImpl.ipv6_addr_comp2", + "action_scope" : "TableAndDefault", + "annotations" : [], + "data" : [] + }, + { + "id" : 21036532, + "name" : "MainControlImpl.ipv6_addr_cmpl", + "action_scope" : "TableAndDefault", + "annotations" : [], + "data" : [] + }, { "id" : 31572308, "name" : "MainControlImpl.set_traffic_class_flow_label", diff --git a/testdata/p4_16_samples_outputs/pna-ipv6-actions.p4.spec b/testdata/p4_16_samples_outputs/pna-ipv6-actions.p4.spec index 6203c1aebc1..d89025734ed 100644 --- a/testdata/p4_16_samples_outputs/pna-ipv6-actions.p4.spec +++ b/testdata/p4_16_samples_outputs/pna-ipv6-actions.p4.spec @@ -38,6 +38,15 @@ struct dpdk_pseudo_header_t { bit<64> pseudo_1 } +struct _p4c_tmp128_t { + bit<64> tmp +} + +struct _p4c_sandbox_header_t { + bit<64> upper_half + bit<64> lower_half +} + struct ipv6_modify_dstAddr_arg_t { bit<32> dstAddr } @@ -84,9 +93,16 @@ struct main_metadata_t { bit<32> MainControlT_tmp_12 bit<128> MainControlT_tmp_13 bit<32> MainControlT_tmp1 + bit<128> MainControlT_tmp_14 + bit<128> MainControlT_tmp_15 } metadata instanceof main_metadata_t +header dstAddr_128 instanceof header _p4c_sandbox_header_t +header dstAddr_tmp instanceof header _p4c_tmp128_t +header srcAddr_128 instanceof header _p4c_sandbox_header_t +header MainControlT_tmp_13_128 instanceof header _p4c_sandbox_header_t +header srcAddr_tmp instanceof header _p4c_tmp128_t regarray direction size 0x100 initval 0 action NoAction args none { return @@ -103,6 +119,92 @@ action ipv6_modify_dstAddr args instanceof ipv6_modify_dstAddr_arg_t { return } +action ipv6_addr_or args none { + movh h.dstAddr_128.upper_half h.ipv6.dstAddr + mov h.dstAddr_128.lower_half h.ipv6.dstAddr + movh h.srcAddr_128.upper_half h.ipv6.srcAddr + mov h.srcAddr_128.lower_half h.ipv6.srcAddr + mov h.dstAddr_tmp.inter h.dstAddr_128.lower_half + or h.dstAddr_tmp.inter h.srcAddr_128.lower_half + mov h.ipv6.dstAddr h.dstAddr_tmp.inter + mov h.dstAddr_tmp.inter h.dstAddr_128.upper_half + or h.dstAddr_tmp.inter h.srcAddr_128.upper_half + movh h.ipv6.dstAddr h.dstAddr_tmp.inter + return +} + +action ipv6_addr_and args none { + mov h.ipv6.dstAddr m.MainControlT_tmp_13 + movh h.dstAddr_128.upper_half h.ipv6.dstAddr + mov h.dstAddr_128.lower_half h.ipv6.dstAddr + movh h.srcAddr_128.upper_half h.ipv6.srcAddr + mov h.srcAddr_128.lower_half h.ipv6.srcAddr + mov h.dstAddr_tmp.inter h.dstAddr_128.lower_half + and h.dstAddr_tmp.inter h.srcAddr_128.lower_half + mov h.ipv6.dstAddr h.dstAddr_tmp.inter + mov h.dstAddr_tmp.inter h.dstAddr_128.upper_half + and h.dstAddr_tmp.inter h.srcAddr_128.upper_half + movh h.ipv6.dstAddr h.dstAddr_tmp.inter + return +} + +action ipv6_addr_xor args none { + movh h.dstAddr_128.upper_half h.ipv6.dstAddr + mov h.dstAddr_128.lower_half h.ipv6.dstAddr + movh h.MainControlT_tmp_13_128.upper_half m.MainControlT_tmp_13 + mov h.MainControlT_tmp_13_128.lower_half m.MainControlT_tmp_13 + mov h.dstAddr_tmp.inter h.dstAddr_128.lower_half + xor h.dstAddr_tmp.inter h.MainControlT_tmp_13_128.lower_half + mov h.ipv6.dstAddr h.dstAddr_tmp.inter + mov h.dstAddr_tmp.inter h.dstAddr_128.upper_half + xor h.dstAddr_tmp.inter h.MainControlT_tmp_13_128.upper_half + movh h.ipv6.dstAddr h.dstAddr_tmp.inter + return +} + +action ipv6_addr_comp1 args none { + movh h.dstAddr_128.upper_half h.ipv6.dstAddr + mov h.dstAddr_128.lower_half h.ipv6.dstAddr + movh h.srcAddr_128.upper_half h.ipv6.srcAddr + mov h.srcAddr_128.lower_half h.ipv6.srcAddr + xor h.dstAddr_128.upper_half h.srcAddr_128.upper_half + xor h.dstAddr_128.lower_half h.srcAddr_128.lower_half + xor h.dstAddr_128.upper_half h.dstAddr_128.lower_half + jmpneq LABEL_FALSE h.dstAddr_128.upper_half 0x0 + mov m.MainControlT_tmp_14 h.ipv6.dstAddr + jmp LABEL_END + LABEL_FALSE : mov m.MainControlT_tmp_14 h.ipv6.srcAddr + LABEL_END : mov h.ipv6.dstAddr m.MainControlT_tmp_14 + return +} + +action ipv6_addr_comp2 args none { + movh h.dstAddr_128.upper_half h.ipv6.dstAddr + mov h.dstAddr_128.lower_half h.ipv6.dstAddr + movh h.srcAddr_128.upper_half h.ipv6.srcAddr + mov h.srcAddr_128.lower_half h.ipv6.srcAddr + xor h.dstAddr_128.upper_half h.srcAddr_128.upper_half + xor h.dstAddr_128.lower_half h.srcAddr_128.lower_half + xor h.dstAddr_128.upper_half h.dstAddr_128.lower_half + jmpeq LABEL_FALSE_0 h.dstAddr_128.upper_half 0x0 + mov m.MainControlT_tmp_15 h.ipv6.dstAddr + jmp LABEL_END_0 + LABEL_FALSE_0 : mov m.MainControlT_tmp_15 h.ipv6.srcAddr + LABEL_END_0 : mov h.ipv6.dstAddr m.MainControlT_tmp_15 + return +} + +action ipv6_addr_cmpl args none { + movh h.srcAddr_128.upper_half h.ipv6.srcAddr + mov h.srcAddr_128.lower_half h.ipv6.srcAddr + mov h.srcAddr_tmp.inter 0xFFFFFFFFFFFFFFFF + xor h.srcAddr_128.lower_half h.srcAddr_tmp.inter + xor h.srcAddr_128.upper_half h.srcAddr_tmp.inter + mov h.ipv6.dstAddr h.srcAddr_128.lower_half + movh h.ipv6.dstAddr h.srcAddr_128.upper_half + return +} + action ipv6_swap_addr args none { mov h.ipv6.dstAddr h.ipv6.srcAddr mov h.ipv6.srcAddr m.MainControlT_tmp_13 @@ -169,6 +271,12 @@ table filter_tbl { ipv6_modify_dstAddr ipv6_swap_addr set_flowlabel + ipv6_addr_or + ipv6_addr_xor + ipv6_addr_and + ipv6_addr_comp1 + ipv6_addr_comp2 + ipv6_addr_cmpl set_traffic_class_flow_label set_ipv6_version set_next_hdr diff --git a/testdata/p4_16_samples_outputs/psa-dpdk-128bitCast.p4.spec b/testdata/p4_16_samples_outputs/psa-dpdk-128bitCast.p4.spec index 42699369936..80392bc0cb1 100644 --- a/testdata/p4_16_samples_outputs/psa-dpdk-128bitCast.p4.spec +++ b/testdata/p4_16_samples_outputs/psa-dpdk-128bitCast.p4.spec @@ -9,6 +9,15 @@ struct dpdk_pseudo_header_t { bit<64> pseudo } +struct _p4c_tmp128_t { + bit<64> tmp +} + +struct _p4c_sandbox_header_t { + bit<64> upper_half + bit<64> lower_half +} + struct psa_ingress_output_metadata_t { bit<8> class_of_service bit<8> clone @@ -44,17 +53,44 @@ struct user_meta_data_t { } metadata instanceof user_meta_data_t +header Ingress_tmp_128 instanceof header _p4c_sandbox_header_t +header Ingress_tmp_tmp instanceof header _p4c_tmp128_t +header Ingress_tmp_0_128 instanceof header _p4c_sandbox_header_t +header Ingress_tmp_0_tmp instanceof header _p4c_tmp128_t +header Ingress_tmp_1_128 instanceof header _p4c_sandbox_header_t +header Ingress_tmp_1_tmp instanceof header _p4c_tmp128_t action NoAction args none { return } action macswp args none { mov m.Ingress_tmp m.Ingress_flg - and m.Ingress_tmp 0xFFFFFFFFFFFFFFFF + movh h.Ingress_tmp_128.upper_half m.Ingress_tmp + mov h.Ingress_tmp_128.lower_half m.Ingress_tmp + mov h.Ingress_tmp_tmp.inter h.Ingress_tmp_128.lower_half + and h.Ingress_tmp_tmp.inter 0xFFFFFFFFFFFFFFFF + mov m.Ingress_tmp h.Ingress_tmp_tmp.inter + mov h.Ingress_tmp_tmp.inter h.Ingress_tmp_128.upper_half + and h.Ingress_tmp_tmp.inter 0xFFFFFFFFFFFFFFFF + movh m.Ingress_tmp h.Ingress_tmp_tmp.inter mov m.Ingress_tmp_0 m.Ingress_tmp - and m.Ingress_tmp_0 0xFFFFFFFFFFFFFFFF + movh h.Ingress_tmp_0_128.upper_half m.Ingress_tmp_0 + mov h.Ingress_tmp_0_128.lower_half m.Ingress_tmp_0 + mov h.Ingress_tmp_0_tmp.inter h.Ingress_tmp_0_128.lower_half + and h.Ingress_tmp_0_tmp.inter 0xFFFFFFFFFFFFFFFF + mov m.Ingress_tmp_0 h.Ingress_tmp_0_tmp.inter + mov h.Ingress_tmp_0_tmp.inter h.Ingress_tmp_0_128.upper_half + and h.Ingress_tmp_0_tmp.inter 0xFFFFFFFFFFFFFFFF + movh m.Ingress_tmp_0 h.Ingress_tmp_0_tmp.inter mov m.Ingress_tmp_1 m.Ingress_tmp_0 - and m.Ingress_tmp_1 0xFFFFFFFFFFFFFFFF + movh h.Ingress_tmp_1_128.upper_half m.Ingress_tmp_1 + mov h.Ingress_tmp_1_128.lower_half m.Ingress_tmp_1 + mov h.Ingress_tmp_1_tmp.inter h.Ingress_tmp_1_128.lower_half + and h.Ingress_tmp_1_tmp.inter 0xFFFFFFFFFFFFFFFF + mov m.Ingress_tmp_1 h.Ingress_tmp_1_tmp.inter + mov h.Ingress_tmp_1_tmp.inter h.Ingress_tmp_1_128.upper_half + and h.Ingress_tmp_1_tmp.inter 0xFFFFFFFFFFFFFFFF + movh m.Ingress_tmp_1 h.Ingress_tmp_1_tmp.inter mov h.dpdk_pseudo_header.pseudo m.Ingress_tmp_1 jmpneq LABEL_END h.dpdk_pseudo_header.pseudo 0x2 mov m.local_metadata_addr h.ethernet.dst_addr