P4 Language Support in DPL
This section outlines the P4-16 language features supported by the DOCA Pipeline Language (DPL) and notes any known deviations or limitations. All references are based on the P4 Language Specification version v1.2.4.
NVIDIA® BlueField® networking platforms (DPU or SuperNIC) are designed to accelerate data center workloads by offloading and isolating key infrastructure tasks, including networking, storage, and security. BlueField-3 combines ASIC performance with programmable flexibility, supporting up to 400G connectivity—ideal for AI and HPC environments.
To optimize for high-performance hardware, the P4 implementation on BlueField differs from generic software targets. As a result, DOCA Pipeline Language (DPL) selectively supports P4 features that align with its target architecture. This section details which P4 features are currently supported, restricted, or unsupported.
A feature labeled as “unsupported” is either not implemented or has not been validated. The compiler may reject such usage explicitly or accept it only if the feature is resolved at compile time (e.g., constant folding). However, acceptance does not imply support and should not be relied upon.
The DPL compiler implements a performance-oriented subset of P4-16, aligned with the capabilities of the BlueField hardware. Unsupported features are typically those that require runtime flexibility (e.g., dynamic parsing or general-purpose control logic) which are not efficient in ASIC-based systems. Developers should reference this section during development to ensure compatibility and portability of P4 programs targeting DPL.
Identifiers
Identifiers starting with
__
are reserved for internal compiler useAll other identifiers conform to P4 spec §6.4.1
Data Types
Type | Support Level | Notes |
| Supported | Fully supported |
Arbitrary-precision int | Limited | Only for literals (see spec §7.1.6.5) |
| Unsupported | |
String literals | Unsupported | Accepted, but no operations or validity checks (see spec §6.4.3.3). Only supported in annotations. |
Bit strings | Supported | Subject to hardware resource limits |
Refer to section "Operators" for support of operations on values with these types.
Derived Types
Type | Support Level | Notes |
| Supported | As per spec §7.2.1, with restrictions based on target-supported types |
| Supported | All field types except |
| Unsupported | |
| Supported | Must use only supported field types. See spec §7.2.5. |
| Unsupported | |
| Supported | As per spec §7.2.6 |
| Limited | Only the externs provided with the DPL compiler are allowed; no custom externs. See spec §7.2.9. |
Type specialization | Supported | As per spec §7.2.10 |
Statements and Expressions
Feature | Support Level | Notes |
| Limited | L-values are restricted. Cannot assign to method calls, |
| Supported | See operators and header field add/sub sections for details. |
| Limited | Only within control |
| Limited | Only within control Fall-through, default, and empty |
The following tables describe the compiler support for expressions using the built in header fields and standard metadata as L-values and R-values. Note, this is separate of header fields that can be used as match keys.
In the default hardware parser, some fields that are mutually exclusive are extracted to the same buffer location (referred to in the table as an alias). Assignments to and copy from these fields can use either of the aliased field names.
Fixed Header Fields | Assign | Copy | Add/Sub | Notes |
| ✔ | ✔ | ✘ | |
| ✔ | ✔ | ✘ | |
| ✘ | ✘ | ✘ |
Last extracted outer |
| ✘ | ✘ | ✘ |
|
| ✘ | ✘ | ✘ |
|
| ✔ | ✔ | ✘ | |
| ✘ | ✘ | ✘ |
Last extracted outer |
| ✘ | ✔ | ✘ | |
| ✘ | ✔ | ✘ | |
| ✘ | ✘ | ✘ |
Last extracted inner |
| ✘ | ✘ | ✘ |
|
| ✘ | ✘ | ✘ |
|
| ✘ | ✘ | ✘ |
|
| ✘ | ✘ | ✘ |
Last extracted inner |
Alias with headers.ipv6.version | ✘ | ✘ | ✘ |
|
| ✔ | ✔ | ✔ |
|
Alias with | ✘ | ✔ | ✔ | Can be set through |
Alias with | ✘ | ✔ | ✔ | Can be set through |
| ✔ | ✔ | ✔ | May be updated also by hardware |
| ✘ | ✘ | ✘ |
|
| ✘ | ✘ | ✘ |
|
| ✘ | ✘ | ✘ |
|
| ✔ | ✔ | ✔ | |
Alias with | ✘ | ✔ | ✘ |
Can be set through |
| ✘ | ✘ | ✘ | Value is write only by hardware |
| ✔ | ✔ | ✘ | |
| ✔ | ✔ | ✘ |
|
Alias with | ✘ | ✘ | ✘ |
|
| ✘ | ✘ | ✘ |
|
Alias with | ✘ | ✔ | ✘ | |
Alias with | ✘ | ✘ | ✘ |
|
| ✘ | ✘ | ✘ |
|
| ✘ | ✘ | ✘ |
|
| ✘ | ✘ | ✘ |
|
| ✘ | ✘ | ✘ |
|
| ✘ | ✔ | ✘ | |
Alias with | ✘ | ✘ | ✘ |
|
| ✘ | ✘ | ✘ |
|
| ✘ | ✔ | ✘ | |
| ✘ | ✔ | ✘ | |
| ✔ | ✔ | ✔ |
|
| ✔ | ✔ | ✔ |
|
| ✔ | ✔ | ✔ |
|
| ✔ | ✔ | ✘ | |
| ✔ | ✔ | ✘ | |
| ✘ | ✘ | ✘ |
|
| ✘ | ✔ | ✘ |
|
| ✘ | ✘ | ✘ |
|
| ✘ | ✔ | ✘ | |
| ✘ | ✔ | ✘ | |
| ✔ | ✔ | ✘ | |
| ✔ | ✔ | ✘ | |
| ✔ | ✔ | ✘ | |
| ✔ | ✔ | ✘ | |
| ✘ | ✔ | ✘ | |
| ✘ | ✔ | ✘ | |
| ✘ | ✔ | ✘ | |
| ✘ | ✔ | ✘ | |
| ✘ | ✘ | ✘ |
|
| ✘ | ✘ | ✘ |
|
| ✘ | ✘ | ✘ |
|
| ✘ | ✘ | ✘ |
|
| ✘ | ✘ | ✘ |
|
| ✘ | ✘ | ✘ |
|
| ✘ | ✘ | ✘ |
|
| ✘ | ✘ | ✘ |
|
| ✘ | ✘ | ✘ |
|
| ✘ | ✘ | ✘ |
|
| ✘ | ✘ | ✘ |
|
| ✘ | ✘ | ✘ |
|
| ✘ | ✘ | ✘ |
|
| ✘ | ✘ | ✘ |
|
| ✘ | ✘ | ✘ |
|
| ✘ | ✘ | ✘ |
|
| ✘ | ✘ | ✘ |
|
| ✘ | ✘ | ✘ |
|
| ✘ | ✘ | ✘ |
|
| ✘ | ✘ | ✘ |
|
Alias with | ✘ | ✔ | ✘ | Can be set through |
Alias with | ✘ | ✔ | ✘ | Can be set through |
| ✔ | ✔ | ✔ | |
| ✔ | ✔ | ✔ | |
| ✔ | ✔ | ✔ |
|
| ✘ | ✘ | ✘ |
|
| ✘ | ✘ | ✘ |
|
| ✔ | ✔ | ✘ | |
| ✔ | ✔ | ✘ | |
| ✘ | ✘ | ✘ |
|
| ✘ | ✘ | ✘ |
|
| ✘ | ✘ | ✘ |
|
Alias with | ✘ | ✔ | ✘ | |
Alias with | ✘ | ✔ | ✘ | |
| ✘ | ✘ | ✘ | |
| ✘ | ✘ | ✘ | |
| ✘ | ✘ | ✘ |
|
| ✘ | ✘ | ✘ |
|
| ✘ | ✘ | ✘ |
|
| ✘ | ✔ | ✘ | |
| ✘ | ✔ | ✘ | |
| ✘ | ✘ | ✘ |
|
| ✘ | ✘ | ✘ |
|
| ✘ | ✘ | ✘ |
|
| ✘ | ✘ | ✘ |
|
| ✘ | ✘ | ✘ |
|
| ✘ | ✘ | ✘ |
|
| ✘ | ✘ | ✘ |
|
| ✘ | ✘ | ✘ |
|
| ✘ | ✘ | ✘ |
|
| ✘ | ✘ | ✘ |
|
| ✘ | ✘ | ✘ |
|
| ✘ | ✘ | ✘ |
|
| ✘ | ✘ | ✘ |
|
| ✘ | ✘ | ✘ |
|
| ✘ | ✘ | ✘ |
|
| ✘ | ✘ | ✘ |
|
| ✘ | ✘ | ✘ |
|
| ✔ | ✔ | ✘ |
|
| ✔ | ✔ | ✘ |
|
| ✔ | ✔ | ✘ | Value set by hardware after decryption |
| ✘ | ✘ | ✘ | Value set by hardware after decryption |
| ✘ | ✘ | ✘ |
|
| ✘ | ✘ | ✘ |
|
| ✘ | ✘ | ✘ |
|
| ✘ | ✘ | ✘ |
|
| ✘ | ✘ | ✘ |
|
| ✘ | ✘ | ✘ |
|
| ✘ | ✘ | ✘ |
|
| ✘ | ✘ | ✘ |
|
| ✘ | ✘ | ✘ |
|
| ✘ | ✘ | ✘ |
|
| ✘ | ✘ | ✘ |
|
| ✘ | ✘ | ✘ |
|
| ✘ | ✘ | ✘ |
|
| ✘ | ✘ | ✘ |
|
| ✘ | ✘ | ✘ |
|
| ✔ | ✔ | ✘ | |
| ✘ | ✘ | ✘ |
|
| ✘ | ✘ | ✘ |
|
| ✘ | ✘ | ✘ |
|
| ✘ | ✘ | ✘ |
|
| ✘ | ✘ | ✘ |
|
| ✘ | ✘ | ✘ |
|
| ✔ | ✔ | ✘ | |
| ✘ | ✘ | ✘ |
|
| ✘ | ✘ | ✘ |
|
| ✘ | ✘ | ✘ |
|
| ✘ | ✘ | ✘ |
|
| ✘ | ✘ | ✘ |
|
| ✘ | ✘ | ✘ |
|
| ✘ | ✘ | ✘ |
|
| ✔ | ✔ | ✘ | |
| ✘ | ✘ | ✘ |
|
All the fields of BlueField standard metadata are read only. The following table outlines the current support for using a standard metadata field as an R-value in an expression.
Standard Metadata Fields | Copyable | Notes |
| ✘ |
|
| ✘ |
|
| ✘ |
|
| ✘ |
|
| ✔ | Last extracted value of etherType within ethernet header or VLAN tags |
| ✘ |
|
| ✘ |
|
| ✘ |
|
| ✘ |
|
| ✘ |
|
| ✘ |
|
| ✘ |
|
| ✘ |
|
| ✘ |
|
| ✘ |
|
| ✘ |
|
| ✘ | ROCE not currently supported |
| ✘ |
|
| ✘ | Valid only after hardware encrypt/decrypt |
| ✘ | Valid only after hardware encrypt/decrypt |
| ✘ |
|
| ✘ |
|
| ✔ | Last extracted value of etherType within inner ethernet header or VLAN tags |
| ✘ |
|
| ✘ |
|
| ✘ |
|
| ✘ |
|
| ✘ |
|
| ✘ |
|
| ✘ |
|
| ✘ |
|
| ✘ |
|
| ✘ |
|
| ✘ |
|
Operators
The P4-16 language specification lists a wide variety of operations that the language accepts for the supported data types (see Section 8). The table below lists the operators that are officially supported by the NVIDIA P4 compiler:
Operator | Compile-time value | P4Runtime value | Runtime value | Spec section |
Bool && Bool | ✔ | ✔ | ✔ | 8.5 |
Bool || Bool | ✔ | ✔ | ✔ | 8.5 |
Bool == Bool | ✔ | ✔ 1 | ✔ 1 | 8.5 |
Bool != Bool | ✔ | ✔ 1 | ✔ 1 | 8.5 |
Bit<W> == Bit<W> | ✔ | ✔ 1 | ✔ 1 | 8.6 |
Bit<W> != Bit<W> | ✔ | ✔ 1 | ✔ 1 | 8.6 |
Bit<W> << integer | ✔ 2 | ✔ 2 | ✔ 2 | 8.6 |
Bit<W> >> integer | ✔ 2 | ✔ 2 | ✔ 2 | 8.6 |
Bit<W>[H:L] | ✔ 3 | ✔ 3 | ✔ 3 | 8.6 |
All explicit casts between supported types | ✔ | ✔ | ✔ | 8.11.1 |
All implicit casts between supported types | ✔ | ✔ | ✔ | 8.11.2 |
Bit<W>..Bit<W> | ✔ 4 | ✔ 4 | ✘ | 8.15.4 |
Assignment to user struct fields | ✔ | ✔ | ✔ | 8.16 |
Assignment to packet-in struct fields | ✔ | ✔ | ✔ | 8.16 |
All operations on header fields | ✔ | ✔ | ✔ 5 | 8.17 |
Method calls | ✔ | ✔ | ✘ | 8.20 |
Function calls with positional args | ✔ | ✔ 6 | ✔ 6 | 8.20 |
Extern constructor invocations | ✔ | ✘ | ✘ | 8.21 |
Parser constructor invocations | ✔ | ✘ | ✘ | 8.21 |
Control constructor invocations | ✔ | ✘ | ✘ | 8.21 |
Package constructor invocations | ✔ | ✘ | ✘ | 8.21 |
Decrement (-=) | ✔ 7 | ✔ 7 | ✔ 7 | - |
Increment (+=) | ✔ 8 | ✔ 8 | ✔ 8 | - |
Variables
Variables are supported in accordance with the following spec items:
Constants (spec 11.1)
"Compile-time known values" are evaluated on a best-effort basis. It is possible that a compile-time known value may not be recognized by the compiler as such.
Variables (spec 11.2)
Instantiations (spec 11.3)
Instantiations with abstract methods (spec 11.3.1) are allowed in BlueField Target Architecture
Named arguments are not supported
Variables may be declared in any of the locations described in (spec 11.2) and follow the scope rules described there.
The compiler will emit errors for uninitialized values. In some cases where a struct is partially initialized, only a warning may be produced. In some cases there may be no error emitted when an uninitialized struct field is accessed. The accessed field will then contain an undefined value.
Control Apply Block
The following statements are supported in a control's apply block:
table.apply()
callsif
statementswitch
statementextern function and method calls
assignment statements with the supported operators
the empty statement
return
statements
The exit
statement is not supported. The for
loop is not supported.
All supported expressions are allowed within these statements, where applicable.
Table Apply
Calling the apply method on a table results in a return value two options:
bool hit
bool miss
Currently the field action_run is not supported.
Actions
Actions support the same statements as controls except for the following:
table.apply()
callsConditional statements -
if
andswitch
Actions support the same expressions as controls except for the following:
Boolean logical operators -
&&
,||
, ternary operatorComparisons (
==
,!=
, etc.)