Skip to content

Fixed/namespace tofino #5218

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 18 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
998 changes: 0 additions & 998 deletions backends/ebpf/tests/ptf/test.py

This file was deleted.

3 changes: 2 additions & 1 deletion backends/tofino/bf-asm/alloc.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
#include <tuple>
#include <utility>

namespace P4 {
namespace BFN {

template <class T>
Expand Down Expand Up @@ -226,5 +227,5 @@ class Alloc3D : public Alloc3Dbase<T> {
};

} // namespace BFN

}
#endif /* BACKENDS_TOFINO_BF_ASM_ALLOC_H_ */
2 changes: 2 additions & 0 deletions backends/tofino/bf-p4c/arch/add_t2na_meta.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

#include "backends/tofino/bf-p4c/arch/add_t2na_meta.h"

namespace P4 {
namespace BFN {

// Check T2NA metadata structures and headers and add missing fields
Expand Down Expand Up @@ -75,3 +76,4 @@ void AddT2naMeta::postorder(IR::Type_StructLike *typeStructLike) {
}

} // namespace BFN
}
3 changes: 2 additions & 1 deletion backends/tofino/bf-p4c/arch/add_t2na_meta.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@

#include "ir/ir.h"

namespace P4 {
namespace BFN {

// Check T2NA metadata and add missing
Expand All @@ -33,5 +34,5 @@ class AddT2naMeta final : public Modifier {
};

} // namespace BFN

}
#endif /* BF_P4C_ARCH_ADD_T2NA_META_H_ */
3 changes: 3 additions & 0 deletions backends/tofino/bf-p4c/arch/arch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@
#include "ir/id.h"
#include "lib/cstring.h"


namespace P4 {
namespace BFN {

Pipeline::Pipeline(cstring name, const IR::BFN::P4Thread *ingress, const IR::BFN::P4Thread *egress,
Expand Down Expand Up @@ -524,3 +526,4 @@ const IR::Node *RestoreParams::postorder(IR::BFN::TnaDeparser *control) {
}

} // namespace BFN
}
3 changes: 2 additions & 1 deletion backends/tofino/bf-p4c/arch/arch.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
#include "ir/pass_manager.h"
#include "ir/visitor.h"

namespace P4 {
namespace BFN {

// An Inspector pass to extract @pkginfo annotation from the P4 program
Expand Down Expand Up @@ -484,5 +485,5 @@ class ApplyEvaluator : public PassManager {
};

} // namespace BFN

}
#endif /* BF_P4C_ARCH_ARCH_H_ */
3 changes: 3 additions & 0 deletions backends/tofino/bf-p4c/arch/bridge_metadata.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@
#include "lib/ordered_map.h"
#include "lib/ordered_set.h"


namespace P4 {
namespace BFN {
namespace {

Expand Down Expand Up @@ -392,3 +394,4 @@ AddTnaBridgeMetadata::AddTnaBridgeMetadata(P4::ReferenceMap *refMap, P4::TypeMap
}

} // namespace BFN
}
2 changes: 2 additions & 0 deletions backends/tofino/bf-p4c/arch/bridge_metadata.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
#include "lib/ordered_set.h"
#include "midend/eliminateSerEnums.h"

namespace P4 {
namespace BFN {

static const cstring META = "meta"_cs;
Expand All @@ -44,5 +45,6 @@ struct AddTnaBridgeMetadata : public PassManager {
};

} // namespace BFN
}

#endif /* BF_P4C_ARCH_BRIDGE_METADATA_H_ */
2 changes: 2 additions & 0 deletions backends/tofino/bf-p4c/arch/check_extern_invocation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
#include "backends/tofino/bf-p4c/device.h"
#include "lib/bitvec.h"

namespace P4 {
namespace BFN {

void CheckExternInvocationCommon::checkExtern(const P4::ExternMethod *extMethod,
Expand Down Expand Up @@ -144,3 +145,4 @@ void CheckT2NAExternInvocation::initPipeConstraints() {
}

} // namespace BFN
}
3 changes: 2 additions & 1 deletion backends/tofino/bf-p4c/arch/check_extern_invocation.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ class ReferenceMap;
class TypeMap;
} // namespace P4

namespace P4 {
namespace BFN {

class CheckExternInvocationCommon : public P4::CheckExternInvocationCommon {
Expand Down Expand Up @@ -69,7 +70,7 @@ class CheckT2NAExternInvocation : public CheckExternInvocationCommon {
initPipeConstraints();
}
};

}
} // namespace BFN

#endif /* BF_P4C_ARCH_CHECK_EXTERN_INVOCATION_H_ */
4 changes: 3 additions & 1 deletion backends/tofino/bf-p4c/arch/collect_bridged_fields.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@
#include "frontends/p4/typeMap.h"
#include "ir/ir.h"


namespace P4 {
namespace BFN {

int CollectBridgedFields::uid_counter = 0;
Expand Down Expand Up @@ -117,7 +119,7 @@ void forAllTouchedFields(const LinearPath &linearPath, P4::TypeMap *typeMap, Fun
}

} // namespace

}
CollectBridgedFields::CollectBridgedFields(P4::ReferenceMap *refMap, P4::TypeMap *typeMap)
: refMap(refMap), typeMap(typeMap) {
uid = ++uid_counter;
Expand Down
3 changes: 2 additions & 1 deletion backends/tofino/bf-p4c/arch/collect_bridged_fields.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ class ReferenceMap;
class TypeMap;
} // namespace P4

namespace P4 {
namespace BFN {

using FieldRef = std::pair<cstring, cstring>;
Expand Down Expand Up @@ -94,6 +95,6 @@ struct CollectBridgedFields : public Inspector,
static int uid_counter;
};

} // namespace BFN
}} // namespace BFN

#endif /* BF_P4C_ARCH_COLLECT_BRIDGED_FIELDS_H_ */
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@

#include "collect_hardware_constrained_fields.h"


namespace P4 {
namespace BFN {

IR::Member *create_member(cstring hdr, cstring member) {
Expand Down Expand Up @@ -148,3 +150,4 @@ void AddHardwareConstrainedFields::postorder(IR::BFN::Pipe *pipe) {
}

} // namespace BFN
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
#include "lib/ordered_map.h"
#include "lib/ordered_set.h"

namespace P4 {
namespace BFN {

// This class add hardware constrained fields to pipe->thread[gress].hw_constrained_fields. This is
Expand All @@ -46,5 +47,5 @@ class CollectHardwareConstrainedFields : public PassManager {
};

} // namespace BFN

}
#endif /* BF_P4C_ARCH_COLLECT_HARDWARE_CONSTRAINED_FIELDS_H_ */
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
#include "backends/tofino/bf-p4c/arch/intrinsic_metadata.h"
#include "backends/tofino/bf-p4c/arch/remove_set_metadata.h"

namespace P4 {
namespace BFN {

/// If after translation, both the $phase0 and $resubmit states are still empty,
Expand Down Expand Up @@ -96,3 +97,4 @@ AddMetadataParserStates::AddMetadataParserStates(P4::ReferenceMap *refMap, P4::T
}

} // namespace BFN
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ class ReferenceMap;
class TypeMap;
} // namespace P4

namespace P4 {
namespace BFN {

struct ElimUnusedMetadataStates : Transform {
Expand All @@ -50,5 +51,5 @@ struct AddMetadataParserStates : PassManager {
};

} // namespace BFN

}
#endif /* BF_P4C_ARCH_FROMV1_0_ADD_METADATA_PARSER_STATES_H_ */
2 changes: 2 additions & 0 deletions backends/tofino/bf-p4c/arch/fromv1.0/checksum.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

#include "backends/tofino/bf-p4c/arch/fromv1.0/checksum.h"

namespace P4 {
namespace BFN {
namespace V1 {

Expand All @@ -32,3 +33,4 @@ TranslateParserChecksums::TranslateParserChecksums(ProgramStructure *structure,

} // namespace V1
} // namespace BFN
}
2 changes: 2 additions & 0 deletions backends/tofino/bf-p4c/arch/fromv1.0/mirror.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
#include "frontends/p4/methodInstance.h"
#include "ir/annotations.h"

namespace P4 {
namespace BFN {
namespace {

Expand Down Expand Up @@ -309,3 +310,4 @@ FixupMirrorMetadata::FixupMirrorMetadata(P4::ReferenceMap *refMap, P4::TypeMap *
}

} // namespace BFN
}
3 changes: 2 additions & 1 deletion backends/tofino/bf-p4c/arch/fromv1.0/mirror.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ class ReferenceMap;
class TypeMap;
} // namespace P4

namespace P4 {
namespace BFN {

using FieldListId = std::tuple<gress_t, unsigned, cstring>;
Expand Down Expand Up @@ -57,5 +58,5 @@ class FixupMirrorMetadata : public PassManager {
};

} // namespace BFN

}
#endif /* BF_P4C_ARCH_FROMV1_0_MIRROR_H_ */
2 changes: 2 additions & 0 deletions backends/tofino/bf-p4c/arch/fromv1.0/parser_counter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
#include "backends/tofino/bf-p4c/device.h"
#include "ir/ir.h"

namespace P4 {
namespace BFN {
namespace V1 {

Expand Down Expand Up @@ -284,3 +285,4 @@ ParserCounterSelectionConverter::ParserCounterSelectionConverter() {

} // namespace V1
} // namespace BFN
}
3 changes: 2 additions & 1 deletion backends/tofino/bf-p4c/arch/fromv1.0/parser_counter.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@

#include "backends/tofino/bf-p4c/arch/fromv1.0/v1_converters.h"

namespace P4 {
namespace BFN {
namespace V1 {

Expand All @@ -41,5 +42,5 @@ class ParserCounterSelectionConverter : public PassManager {

} // namespace V1
} // namespace BFN

}
#endif /* BF_P4C_ARCH_FROMV1_0_PARSER_COUNTER_H_ */
3 changes: 3 additions & 0 deletions backends/tofino/bf-p4c/arch/fromv1.0/phase0.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@
#include "lib/cstring.h"
#include "lib/indent.h"


namespace P4 {
namespace BFN {

namespace {
Expand Down Expand Up @@ -953,3 +955,4 @@ IR::Node *ConvertPhase0AssignToExtract::preorder(IR::AssignmentStatement *stmt)
cstring getDefaultPhase0TableKeyName() { return defaultPhase0TableKeyName; }

} // namespace BFN
}
5 changes: 3 additions & 2 deletions backends/tofino/bf-p4c/arch/fromv1.0/phase0.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ class TnaProgramStructure;
}
} // namespace P4

namespace P4 {
namespace BFN {

/**
Expand Down Expand Up @@ -201,7 +202,7 @@ class ConvertPhase0 : public PassManager {
};

cstring getDefaultPhase0TableKeyName();

}
} // namespace BFN

}
#endif /* BF_P4C_ARCH_FROMV1_0_PHASE0_H_ */
2 changes: 2 additions & 0 deletions backends/tofino/bf-p4c/arch/fromv1.0/resubmit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
#include "frontends/p4/methodInstance.h"
#include "ir/annotations.h"

namespace P4 {
namespace BFN {
namespace {

Expand Down Expand Up @@ -247,3 +248,4 @@ FixupResubmitMetadata::FixupResubmitMetadata(P4::ReferenceMap *refMap, P4::TypeM
}

} // namespace BFN
}
3 changes: 2 additions & 1 deletion backends/tofino/bf-p4c/arch/fromv1.0/resubmit.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ class ReferenceMap;
class TypeMap;
} // namespace P4

namespace P4 {
namespace BFN {

struct FieldPacking;
Expand All @@ -46,5 +47,5 @@ class FixupResubmitMetadata : public PassManager {
};

} // namespace BFN

}
#endif /* BF_P4C_ARCH_FROMV1_0_RESUBMIT_H_ */
3 changes: 3 additions & 0 deletions backends/tofino/bf-p4c/arch/fromv1.0/v1_converters.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@
#include "lib/ordered_map.h"
#include "v1_program_structure.h"


namespace P4 {
namespace BFN {

namespace V1 {
Expand Down Expand Up @@ -749,3 +751,4 @@ const IR::Node *ParserPriorityConverter::postorder(IR::AssignmentStatement *node
} // namespace V1

} // namespace BFN
}
3 changes: 2 additions & 1 deletion backends/tofino/bf-p4c/arch/fromv1.0/v1_converters.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
#include "lib/safe_vector.h"
#include "v1_program_structure.h"

namespace P4 {
namespace BFN {

namespace V1 {
Expand Down Expand Up @@ -300,5 +301,5 @@ class ParserPriorityConverter : public StatementConverter {
} // namespace V1

} // namespace BFN

}
#endif /* BF_P4C_ARCH_FROMV1_0_V1_CONVERTERS_H_ */
3 changes: 3 additions & 0 deletions backends/tofino/bf-p4c/arch/fromv1.0/v1_program_structure.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@
#include "backends/tofino/bf-p4c/common/pragma/all_pragmas.h"
#include "v1_converters.h"


namespace P4 {
namespace BFN {

namespace V1 {
Expand Down Expand Up @@ -174,3 +176,4 @@ const IR::P4Program *ProgramStructure::create(const IR::P4Program *program) {
} // namespace V1

} // namespace BFN
}
Loading
Loading