P4C
The P4 Compiler
Loading...
Searching...
No Matches
P4::TC::EBPFTablePNA Class Reference
Inheritance diagram for P4::TC::EBPFTablePNA:
[legend]

Public Member Functions

 EBPFTablePNA (const EBPF::EBPFProgram *program, const IR::TableBlock *table, EBPF::CodeGenInspector *codeGen, const ConvertToBackendIR *tcIR)
 
 DECLARE_TYPEINFO (EBPFTablePNA, EBPF::EBPFTablePSA)
 
void emitAction (EBPF::CodeBuilder *builder, cstring valueName, cstring actionRunVariable) override
 
void emitActionArguments (EBPF::CodeBuilder *builder, const IR::P4Action *action, cstring name)
 
void emitDefaultActionStruct (EBPF::CodeBuilder *builder)
 
void emitInitializer (EBPF::CodeBuilder *builder) override
 
void emitKeyPNA (EBPF::CodeBuilder *builder, cstring keyName)
 
void emitKeyType (EBPF::CodeBuilder *builder) override
 
void emitValueActionIDNames (EBPF::CodeBuilder *builder) override
 
void emitValueStructStructure (EBPF::CodeBuilder *builder) override
 
void emitValueType (EBPF::CodeBuilder *builder) override
 
bool isMatchTypeSupported (const IR::Declaration_ID *matchType) override
 
cstring p4ActionToActionIDName (const IR::P4Action *action) const
 
- Public Member Functions inherited from P4::EBPF::EBPFTablePSA
 EBPFTablePSA (const EBPFProgram *program, CodeGenInspector *codeGen, cstring name)
 
 EBPFTablePSA (const EBPFProgram *program, const IR::TableBlock *table, CodeGenInspector *codeGen)
 
bool cacheEnabled () override
 
 DECLARE_TYPEINFO (EBPFTablePSA, EBPFTable)
 
bool dropOnNoMatchingEntryFound () const override
 
void emitCacheInstance (CodeBuilder *builder)
 
void emitCacheLookup (CodeBuilder *builder, cstring key, cstring value) override
 
virtual void emitCacheTypes (CodeBuilder *builder)
 
void emitCacheUpdate (CodeBuilder *builder, cstring key, cstring value) override
 
void emitDirectValueTypes (CodeBuilder *builder) override
 
void emitInstance (CodeBuilder *builder) override
 
void emitLookupDefault (CodeBuilder *builder, cstring key, cstring value, cstring actionRunVariable) override
 
void emitTypes (CodeBuilder *builder) override
 
const IR::PathExpression * getActionNameExpression (const IR::Expression *expr) const
 
EBPFCounterPSAgetDirectCounter (cstring name) const
 
EBPFMeterPSAgetMeter (cstring name) const
 
- Public Member Functions inherited from P4::EBPF::EBPFTable
 EBPFTable (const EBPFProgram *program, CodeGenInspector *codeGen, cstring name)
 
 EBPFTable (const EBPFProgram *program, const IR::TableBlock *table, CodeGenInspector *codeGen)
 
 DECLARE_TYPEINFO (EBPFTable, EBPFTableBase)
 
void emitActionArguments (CodeBuilder *builder, const IR::P4Action *action, cstring name)
 
void emitKey (CodeBuilder *builder, cstring keyName)
 
virtual void emitLookup (CodeBuilder *builder, cstring key, cstring value)
 
bool isLPMTable () const
 
bool isTernaryTable () const
 
cstring p4ActionToActionIDName (const IR::P4Action *action) const
 
- Public Member Functions inherited from P4::EBPF::EBPFObject
 DECLARE_TYPEINFO (EBPFObject)
 
- Public Member Functions inherited from P4::ICastable
template<typename T >
T & as ()
 Tries to convert the class to type T. A BUG occurs if the cast fails.
 
template<typename T >
const T & as () const
 Tries to convert the class to type T. A BUG occurs if the cast fails.
 
template<typename T >
T * checkedTo ()
 Performs a checked cast. A BUG occurs if the cast fails.
 
template<typename T >
const T * checkedTo () const
 Performs a checked cast. A BUG occurs if the cast fails.
 
- Public Member Functions inherited from P4::RTTI::Base
template<typename T >
bool is () const noexcept
 
virtual bool isA (TypeId typeId) const noexcept=0
 
template<typename T >
const T * to () const noexcept
 Same as to, but returns const pointer to T.
 
template<typename T >
T * to () noexcept
 
virtual TypeId typeId () const noexcept=0
 

Protected Member Functions

EBPF::ActionTranslationVisitorcreateActionTranslationVisitor (cstring valueName, const EBPF::EBPFProgram *program, const IR::P4Action *action, bool isDefaultAction) const
 
void initDirectCounters ()
 
void initDirectMeters ()
 
void validateKeys () const override
 
- Protected Member Functions inherited from P4::EBPF::EBPFTablePSA
ActionTranslationVisitorcreateActionTranslationVisitor (cstring valueName, const EBPFProgram *program) const override
 
void createCacheTypeNames (bool isCacheKeyType, bool isCacheValueType)
 
void emitConstEntriesInitializer (CodeBuilder *builder)
 
void emitDefaultActionInitializer (CodeBuilder *builder)
 
void emitKeyMasks (CodeBuilder *builder, EntriesGroupedByMask_t &entriesGroupedByMask, std::vector< cstring > &keyMasksNames)
 
void emitKeysAndValues (CodeBuilder *builder, EntriesGroup_t &sameMaskEntries, std::vector< cstring > &keyNames, std::vector< cstring > &valueNames)
 
void emitMapUpdateTraceMsg (CodeBuilder *builder, cstring mapName, cstring returnCode) const
 
void emitTableValue (CodeBuilder *builder, const IR::Expression *expr, cstring valueName)
 
void emitTernaryConstEntriesInitializer (CodeBuilder *builder)
 
void emitValueMask (CodeBuilder *builder, cstring valueMask, cstring nextMask, int tupleId) const
 
void initDirectCounters ()
 
void initDirectMeters ()
 
void initImplementation ()
 
void tryEnableTableCache ()
 
- Protected Member Functions inherited from P4::EBPF::EBPFTable
void emitTernaryInstance (CodeBuilder *builder)
 
- Protected Member Functions inherited from P4::EBPF::EBPFTableBase
 EBPFTableBase (const EBPFProgram *program, cstring instanceName, CodeGenInspector *codeGen)
 
 DECLARE_TYPEINFO (EBPFTableBase, EBPFObject)
 
- Protected Member Functions inherited from P4::RTTI::Base
virtual const void * toImpl (TypeId typeId) const noexcept=0
 

Protected Attributes

const ConvertToBackendIRtcIR
 
- Protected Attributes inherited from P4::EBPF::EBPFTablePSA
cstring cacheKeyTypeName
 
cstring cacheTableName
 
cstring cacheValueTypeName
 
bool tableCacheEnabled = false
 

Additional Inherited Members

- Static Public Member Functions inherited from P4::EBPF::EBPFTablePSA
static cstring addPrefixFunc (bool trace)
 
- Static Public Member Functions inherited from P4::EBPF::EBPFObject
static cstring externalName (const IR::IDeclaration *declaration)
 
static cstring getSpecializedTypeName (const IR::Declaration_Instance *di)
 
static cstring getTypeName (const IR::Declaration_Instance *di)
 
- Public Attributes inherited from P4::EBPF::EBPFTablePSA
std::vector< std::pair< cstring, EBPFCounterPSA * > > counters
 
EBPFTableImplementationPSAimplementation
 
std::vector< std::pair< cstring, EBPFMeterPSA * > > meters
 
- Public Attributes inherited from P4::EBPF::EBPFTable
const IR::ActionList * actionList
 
cstring defaultActionMapName
 
std::map< const IR::KeyElement *, cstringkeyFieldNames
 
const IR::Key * keyGenerator
 
std::map< const IR::KeyElement *, EBPFType * > keyTypes
 
const cstring prefixFieldName = "prefixlen"_cs
 
size_t size = 1024
 
const IR::TableBlock * table
 
- Public Attributes inherited from P4::EBPF::EBPFTableBase
CodeGenInspectorcodeGen
 
cstring dataMapName
 
cstring instanceName
 
cstring keyTypeName
 
const EBPFProgramprogram
 
cstring valueTypeName
 

Member Function Documentation

◆ emitAction()

void P4::TC::EBPFTablePNA::emitAction ( EBPF::CodeBuilder * builder,
cstring valueName,
cstring actionRunVariable )
overridevirtual

Reimplemented from P4::EBPF::EBPFTablePSA.

◆ emitInitializer()

void P4::TC::EBPFTablePNA::emitInitializer ( EBPF::CodeBuilder * builder)
overridevirtual

Reimplemented from P4::EBPF::EBPFTablePSA.

◆ emitKeyType()

void P4::TC::EBPFTablePNA::emitKeyType ( EBPF::CodeBuilder * builder)
overridevirtual

Reimplemented from P4::EBPF::EBPFTable.

◆ emitValueActionIDNames()

void P4::TC::EBPFTablePNA::emitValueActionIDNames ( EBPF::CodeBuilder * builder)
overridevirtual

Reimplemented from P4::EBPF::EBPFTable.

◆ emitValueStructStructure()

void P4::TC::EBPFTablePNA::emitValueStructStructure ( EBPF::CodeBuilder * builder)
overridevirtual

Reimplemented from P4::EBPF::EBPFTablePSA.

◆ emitValueType()

void P4::TC::EBPFTablePNA::emitValueType ( EBPF::CodeBuilder * builder)
overridevirtual

Reimplemented from P4::EBPF::EBPFTable.

◆ isMatchTypeSupported()

bool P4::TC::EBPFTablePNA::isMatchTypeSupported ( const IR::Declaration_ID * matchType)
inlineoverridevirtual

Reimplemented from P4::EBPF::EBPFTablePSA.

◆ validateKeys()

void P4::TC::EBPFTablePNA::validateKeys ( ) const
overrideprotectedvirtual

Performs the following validations:

  • Validates if LPM key is the last one from match keys in an LPM table (ignores selector fields).
  • Validates if match fields in ternary tables are sorted by size in descending order (ignores selector fields).

Reimplemented from P4::EBPF::EBPFTable.