P4C
The P4 Compiler
 
Loading...
Searching...
No Matches
DPDK::UpdateActionForSwitch Class Reference
Inheritance diagram for DPDK::UpdateActionForSwitch:

Public Member Functions

 UpdateActionForSwitch (SwitchHandler &sw)
 
const IR::Node * postorder (IR::P4Action *action)
 

Detailed Description

For tables implementing action selector/profile, switch expressions using the table.apply().action_run needs to be split into two parts, one to enable conditional apply of group/member tables on base table hit and second to execute the statements within switch cases based on the action which is run. To enable this, we create a temporary switch expression which holds a number corresponding to each action which can be invoked by the table.

We use a map which holds the tuple for switch expression variable and constant for each action {<switch_var, constant_value>, <switch_var1, constant_value1>, ...}

There can be multiple switch statements using the same table apply expression but performing different functionality when the action is run, hence we use a vector of tuples having switch expression variable and the constant value to be assigned to it for a particular action.

This pass inserts the assignment statements for these switch expressions with the corresponding constant values for each action.