P4C
The P4 Compiler
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
 
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
 
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
 
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
 
class  RemoveConsecutiveJmpAndLabel
 
class  RemoveLabelAfterLabel
 
class  RemoveRedundantLabel
 
class  RemoveUnusedMetadataFields
 
class  ReplaceHdrMetaField
 
struct  SelectionTable
 
class  ShortenTokenLength
 
class  SplitActionProfileTable
 
class  SplitActionSelectorTable
 
class  SplitP4TableCommon
 
class  StatementUnroll
 
class  SwapSimpleExpressionToFrontOfLogicalExpression
 
class  SwitchHandler
 
struct  TableAttributes
 
class  TdiBfrtConf
 
class  ThreadJumps
 
struct  TopLevelCtxt
 
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)
 
void expressionUnrollSanityCheck (const IR::Expression *e)
 
const IR::Type_Bits * getEightBitAlignedType (const IR::Type_Bits *tb)
 
int getMetadataFieldWidth (int width)
 
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, std::vector< cstring > names, cstring &resName)
 
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. More...
 

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

◆ DPDK::actionAttributes

struct DPDK::actionAttributes
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

◆ DPDK::externAttributes

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

◆ DPDK::keyElementInfo

struct DPDK::keyElementInfo
Class Members
int offsetInMetadata
int size

◆ DPDK::keyInfo

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

◆ DPDK::TableAttributes

struct DPDK::TableAttributes
Class Members
cstring controlName
unsigned default_action_handle
cstring direction
cstring externalName
bool idle_timeout_with_auto_delete
bool is_add_on_miss
bool isHidden
unsigned size
unsigned tableHandle
vector< pair< cstring, cstring > > tableKeys
cstring tableType

Variable Documentation

◆ PnaMainOutputMetadataOutputPortName

const char 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