P4 Runtime Controller
DPL applications are deployed to the NVIDIA® BlueField® networking platform (DPU or SuperNIC) via the P4Runtime API.
Since DPL is derived from the P4-16 language, it is compatible with the P4Runtime specification, enabling standard runtime interaction with the compiled DPL pipeline.
The P4 Runtime shell (p4runtime_sh
) is an open-source CLI tool that provides an interface to the P4Runtime API. It is especially useful for:
Loading simple DPL programs
Testing match-action tables
Debugging pipeline behavior
The shell can be invoked using the launch script provided in the DPL Development container.
For detailed instructions, refer to Loading DPL Applications.
The following are example commands for using the p4runtime_sh P4 Controller after loading a program.
P4 info
Operation | Command |
Retrieves the content of |
|
P4 Table
Operation | Command |
Lists all P4 tables |
|
Displays information about a specific P4 table |
|
Working with P4 Table Entries
Operation | Command | ||||||||
Default Entry | |||||||||
Reads P4 table's default entry without counter's value |
| ||||||||
Reads P4 table's default entry with counter's value Note
Supported only if a direct counter is enabled on the P4 table. |
| ||||||||
Modifies P4 table's default entry action Note
A default entry cannot be removed or inserted. It can only be modified to perform a different P4 action. |
| ||||||||
Regular Entries | |||||||||
Note: In the following examples, some commands require specifying the match key of the desired regular P4 table key. The syntax for specifying a match key varies according to the defined match method for each key (per the DPL source code where the keys are defined on the P4 table).
For simplicity, the following examples are written using | |||||||||
Reading Entries | |||||||||
Reads a specific regular P4 table entry |
| ||||||||
Reads all regular entries from a P4 table |
| ||||||||
Reads all regular entries from all P4 tables in the P4 program |
| ||||||||
Adding Entries | |||||||||
Adds a regular P4 table entry |
| ||||||||
Deleting Entries | |||||||||
Deletes a specific regular P4 table entry |
| ||||||||
Deletes all regular entries from a P4 table |
|
Working with Direct Counters
This allows w orking with Direct Counter directly without getting the whole Table Entry info.
Operation | Command |
Lists all defined Direct Counters |
|
Default Entry | |
Reads counter data of a default entry in a Direct Counter |
|
Clears counter data of a default entry in a Direct Counter |
|
Regular Entries | |
Reads counter data of a a specific P4 table entry in a Direct Counter |
|
Reads all counter data of specific Direct Counter Info
This will also read the default entry counter data. |
|
Clears counter data of a a specific P4 table entry in a Direct Counter |
|
Clears all counter data of specific Direct Counter Note
This also clears the default entry counter data. |
|
Clears all direct counters from all table |
|
Working with Indirect Counters
Operation | Command |
Lists all defined Indirect Counters |
|
Shows info about a specific Indirect Counter |
|
Reads a specific value from a specific indirect counter |
|
Reads all values from a specific indirect counter |
|
Clears a specific value from a specific indirect counter |
|
Clears all values from a specific indirect counter |
|
P4 Actions
Operation | Command |
Lists all defined P4 actions |
|
Shows info about a specific P4 actions Info
This includes its parameters' names and sizes. |
|
Packet IO
To use packet IO, it must be enabled in the P4 program source code.
Operation | Command |
Packet In – For receiving packets sent from the DPL Runtime daemon to the P4 Controller (according to defined rules in the DPL program) | |
Captures packets for 10 second, then displays them |
|
Capturs packets for 10 second, then displays them parsed as well as their metadata info | This example command uses the
Then, from the
|
Packet Out – For sending a packet from the | |
Syntax of sending a packet |
Repeat the |
Example of building and sending a packet | Using
Then send it using the
|