P4C
The P4 Compiler
Loading...
Searching...
No Matches
P4::DPDK Namespace Reference

Classes

struct  actionAttributes
 
class  AddFieldsToPseudoHeader
 This pass finally adds all the collected fields to pseudo header add collected pseudo header fields into dpdk_pseudo_header_t. More...
 
class  AlignHdrMetaField
 
class  BranchingInstructionGeneration
 
class  BreakLogicalExpressionParenthesis
 
struct  ByteAlignment
 
class  CheckExternInvocation
 Class which chooses the correct class for checking the constraints for invocations. of extern methods and functions depending on the architecture. More...
 
class  CheckPNAExternInvocation
 Class for checking constraints for invocations of PNA architecture extern methods and functions. More...
 
class  CollectActionUses
 
class  CollectAddOnMissTable
 
class  CollectDirectCounterMeter
 
class  CollectErrors
 
class  CollectExternDeclaration
 
class  CollectInternetChecksumInstance
 
class  CollectIPSecInfo
 
class  CollectLocalStructAndFlatten
 
class  CollectLocalVariables
 
class  CollectMetadataHeaderInfo
 
class  CollectProgramStructure
 
class  CollectStructLocalVariables
 
class  CollectTableInfo
 
class  CollectUseDefInfo
 
class  CollectUsedMetadataField
 This pass Collects all metadata struct member used in program. More...
 
class  ConvertActionSelectorAndProfile
 
class  ConvertBinaryOperationTo2Params
 
class  ConvertInternetChecksum
 
class  ConvertLogicalExpression
 
struct  ConvertLookahead
 
class  ConvertStatementToDpdk
 
class  ConvertToDpdkArch
 
class  ConvertToDpdkControl
 
class  ConvertToDpdkParser
 
class  ConvertToDpdkProgram
 
class  ConvertToString
 
class  CopyMatchKeysToSingleStruct
 
class  CopyPropagationAndElimination
 This pass identifies redundant copies/moves and eliminates them. More...
 
class  DeclarationInjector
 
class  DefActionValue
 
class  DirectionToRegRead
 
class  DismantleMuxExpressions
 
struct  DpdkAddPseudoHeader
 
class  DpdkAddPseudoHeaderDecl
 This pass adds a pseudo header declaration, it will be used as container of operands where dpdk instructions require it's operand to be in a header. It adds a type decl like below @__pseudo_header__ header dpdk_pseudo_header_t { }. More...
 
class  DpdkArchFirst
 
class  DpdkArchLast
 
class  DpdkAsmOptimization
 
class  DpdkBackend
 
class  DpdkContextGenerator
 This pass generates context JSON into user specified file. More...
 
struct  DpdkHandleIPSec
 
class  DpdkMidEnd
 
class  DpdkOptions
 
class  ElimHeaderCopy
 
class  EliminateHeaderCopy
 
class  EliminateUnusedAction
 
class  ElimUnusedActions
 
class  EmitDpdkTableConfig
 
class  EnumOn32Bits
 
class  ErrorWidth
 
class  ExpressionUnroll
 
struct  externAttributes
 
struct  fieldInfo
 
class  HaveNonHeaderChecksumArgs
 
class  HaveNonHeaderLargeOperandAssignment
 This pass checks whether an assignment statement has large operands (>64-bit). More...
 
class  IfStatementUnroll
 
class  InjectFixedMetadataField
 
class  InjectInternetChecksumIntermediateValue
 
class  InjectJumboStruct
 
class  InsertReqDeclForIPSec
 
class  IsDirectionMetadataUsed
 
struct  keyElementInfo
 
struct  keyInfo
 
class  LogicalExpressionUnroll
 
class  MoveCollectedStructLocalVariableToMetadata
 
class  MoveNonHeaderFieldsToPseudoHeader
 This pass identifies and collects statement which requires it's operand to be in a header and also initialize added header fields with original operand. i.e. csum_0.add<tuple_0>((tuple_0){f0 = m.Ingress_tmp_1,f1 = m.Ingress_tmp_2, f2 = m.Ingress_tmp_3,f3 = m.Ingress_tmp_4,f4 = m.Ingress_tmp_5}); transformed into h.dpdk_pseudo_header.pseudo = (bit<16>)m.Ingress_tmp_1; h.dpdk_pseudo_header.pseudo_0 = (bit<16>)m.Ingress_tmp_2; h.dpdk_pseudo_header.pseudo_1 = (bit<8>)m.Ingress_tmp_3; h.dpdk_pseudo_header.pseudo_2 = (bit<32>)m.Ingress_tmp_4; h.dpdk_pseudo_header.pseudo_3 = (bit<32>)m.Ingress_tmp_5; csum_0.add<tuple_1>((tuple_1){f0 = h.dpdk_pseudo_header.pseudo, f1 = h.dpdk_pseudo_header.pseudo_0,f2 = h.dpdk_pseudo_header.pseudo_1, f3 = h.dpdk_pseudo_header.pseudo_2,f4 = h.dpdk_pseudo_header.pseudo_3});. More...
 
class  PrependPassRecircId
 
class  PrependPDotToActionArgs
 
class  ProcessControls
 Only simplify complex expression in ingress/egress. More...
 
class  RemoveConsecutiveJmpAndLabel
 
class  RemoveLabelAfterLabel
 
class  RemoveRedundantLabel
 This pass removes label that no jmps jump to. More...
 
class  RemoveUnusedMetadataFields
 This pass removes all unused fields from metadata struct. More...
 
class  ReplaceHdrMetaField
 
struct  SelectionTable
 Selection table attributes. More...
 
class  ShortenTokenLength
 This pass shorten the Identifier length. More...
 
class  SplitActionProfileTable
 
class  SplitActionSelectorTable
 
class  SplitP4TableCommon
 
class  StatementUnroll
 
class  SwapSimpleExpressionToFrontOfLogicalExpression
 
class  SwitchHandler
 
struct  TableAttributes
 
class  TdiBfrtConf
 
class  ThreadJumps
 
struct  TopLevelCtxt
 Program level information for context json. More...
 
class  TypeWidthValidator
 
class  UpdateActionForSwitch
 
class  ValidateAddOnMissExterns
 
class  ValidateDirectCounterMeter
 
class  ValidateOperandSize
 

Typedefs

using DpdkContext = P4CContextWithOptions<DpdkOptions>
 
using UserMeta = std::set<cstring>
 

Functions

IR::Declaration_Instance * createRegDeclarationInstance (cstring instanceName, int regSize, int indexBitWidth, int initValBitWidth)
 Creates Register extern declaration for holding persistent information.
 
void expressionUnrollSanityCheck (const IR::Expression *e)
 
const IR::Type_Bits * getEightBitAlignedType (const IR::Type_Bits *tb)
 
int getMetadataFieldWidth (int width)
 Update bitwidth of Metadata fields to 32 or 64 bits if it 8-bit aligned.
 
bool isCommutativeBinaryOperation (const IR::Operation_Binary *bin)
 
bool isDirection (const IR::Member *m)
 
bool isEightBitAligned (const IR::Expression *e)
 
bool isHeadersStruct (const IR::Type_Struct *st)
 
bool isInsideHeader (const IR::Expression *expr)
 
bool isLargeFieldOperand (const IR::Expression *e)
 
bool isMetadataField (const IR::Expression *e)
 
bool isMetadataStruct (const IR::Type_Struct *st)
 
bool isNonConstantSimpleExpression (const IR::Expression *e)
 
bool isSimpleExpression (const IR::Expression *e)
 
bool isStandardMetadata (cstring name)
 
bool isValidCall (const IR::MethodCallExpression *m)
 
bool isValidMemberField (const IR::Member *mem)
 
bool reservedNames (P4::ReferenceMap *refMap, const std::vector< cstring > &names, cstring &resName)
 Check for reserved names for DPDK target.
 
cstring toStr (const IR::Node *const n)
 
cstring TypeStruct2Name (const cstring *s)
 
cstring TypeStruct2Name (const cstring s)
 

Variables

const char DirectResourceTableEntryIndex [] = "table_entry_index"
 
const char PnaMainOutputMetadataOutputPortName [] = "pna_main_output_metadata_output_port"
 Name of the metadata used as output port.
 

Detailed Description

DPDK architecture assume the following control block signature.

control ingress(header h, metadata m); control egress(header h, metadata m); We need to convert psa control blocks to this form.

Passes defined in this file are used for generating Context JSON output for DPDK Context JSON is a JSON file used by the control plane software for manipulating tables and actions. It contains all relevant information regarding the tables and actions. The context JSON is based on the JSON Schema defined in DPDK_context_schema.json.


Class Documentation

◆ P4::DPDK::actionAttributes

struct P4::DPDK::actionAttributes

This structure holds action attributes required for context JSON which are not part of P4Action.

Class Members
unsigned actionHandle
bool allowed_as_default_action
bool allowed_as_hit_action
bool constant_default_action
cstring externalName
bool is_compiler_added_action
IndexedVector< Parameter > * params

◆ P4::DPDK::externAttributes

struct P4::DPDK::externAttributes
Class Members
cstring counterType
cstring externalName
cstring externType
unsigned table_id

◆ P4::DPDK::keyElementInfo

struct P4::DPDK::keyElementInfo
Class Members
int offsetInMetadata
int size

◆ P4::DPDK::keyInfo

struct P4::DPDK::keyInfo
Class Members
vector< struct keyElementInfo * > elements
bool isExact
bool isLearner
int numElements
int numExistingMetaFields
int size

◆ P4::DPDK::TableAttributes

struct P4::DPDK::TableAttributes

This structure holds table attributes required for context JSON which are not part of P4Table.

Class Members
cstring controlName
unsigned default_action_handle
cstring direction Direction of the table, can be ["ingress","egress"].
cstring externalName
bool idle_timeout_with_auto_delete
bool is_add_on_miss
bool isHidden
unsigned size
unsigned tableHandle Unique ID for the table.
vector< pair< cstring, cstring > > tableKeys
cstring tableType

Table type can one of "match", "selection" and "action Match table is a regular P4 table, selection table and action tables are compiler generated tables when psa_implementation is action_selector or action_profile.

Function Documentation

◆ expressionUnrollSanityCheck()

void P4::DPDK::expressionUnrollSanityCheck ( const IR::Expression * e)

This function is a sanity to check whether the component of a Expression falls into following classes, if not, it means we haven't implemented a handle for that class.

◆ toStr()

cstring P4::DPDK::toStr ( const IR::Node * const )

This function translates nodes of different subclass of Expression, Type and PropertyValue in desired format. For example, for PathExpression, it returns PathExpression->path->name For Member, it returns toStr(Member->expr).Member->member etc.

Variable Documentation

◆ PnaMainOutputMetadataOutputPortName

const char P4::DPDK::PnaMainOutputMetadataOutputPortName[] = "pna_main_output_metadata_output_port"

Name of the metadata used as output port.

PNA specification does not contain standard metadata for specifying output port. rte_swx_pipeline in DPDK uses instruction 'tx' to specify the output port for a packet. To send a packet to a specific port, we need to do the following:

  • add definition of new metadata field to main metadata structure for rte_swx_pipeline
  • use the same name of this newly defined metadata field when assigning value of output port
  • use this metadata field with 'tx' instruction.