NVIDIA P4

Programming Protocol-Independent Packet Processors, or P4, is a domain specific open-source language (DSL) for programming the data plane of network devices. It provides programmable packet processing pipeline stages, packet parsing and de-parsing, and access control list (ACL) rules that match on packet fields or packet metadata. With a P4 compiler (p4c), the network data plane is automatically generated, along with a control plane interface that serves as a contract between the data plane and the control plane.

The P4 compiler reduces complexity by making optimized device-level decisions which take advantage of the underlying hardware architecture.

The NVIDIA P4 Solution offers a unified model for both DPU- and Switch-based systems, P4 for DPU is in planning, P4 for Switch is an early sample.




NVIDIA P4 Solution

The NVIDIA P4 Solution offers a unified model for both DPU- and Switch-based systems, enabling evolvable systems with seamless transitions between Switch, NIC and DPU.

Users can develop and compile their P4 program off-box, on the NVIDIA P4 Build Docker image. Once completed, the image is deployed to the network device.

The following illustration demonstrates the flow.


p4 solution

The NVIDIA P4 Solution is based on the P4-16 standard. The compiler accepts a P4 program as input and generates P4 Application Programming Interfaces (APIs) targeted to NVIDIA SDK if the target is an NVIDIA Ethernet Switch, or to DPDK if the target is an NVIDIA DPU.


NVIDIA P4 - Making Data Plane Programming Easy

  • Gain Productivity via an Improved Abstraction
  • Compile-Time Checks for Feasibility
  • Fast Iterations and Deterministic Runtime Behaviors
  • Isolate Users from Explicit Resource Allocation
  • Target-based Optimizations and Allocation Strategies
  • Enable Evolvable Systems with seamless transitions between Switch, NIC and DPU

NVIDIA Ethernet Switch P4

P4 for NVIDIA Ethernet switches allows Server and Networking OEMs to program and control the advanced networking features built into the Switch ICs. P4 enables these OEMs and application vendors to build flexible, innovative, and cost-optimized switching solutions.

The Ethernet switch silicon family offers advanced networking capabilities and cutting-edge real-time streaming telemetry and security features.

The switch ASIC brings sophisticated programmability without compromising performance capabilities like packet rate, bandwidth, or latency.

With the growing demand for customization and feature richness in the Cloud, Edge, HPC, AI, Ethernet Storage Fabrics and Enterprise Data Centers, P4 provides the flexibility to implement any switching and routing functionality via a modern, well-defined and well-documented set of APIs.



Apply for access to NVIDIA Ethernet Switch P4 documentation and code. Please log in or create an account using a business email address. Applications using personal accounts (e.g., @gmail, @yahoo) won’t be accepted. An NVIDIA representative may reach out to you through Email to be accepted to participate in this program


P4 Ethernet Switch Hybrid Model

P4-16 allows an end user to define the packet processing pipeline. The NVIDIA switch programmable pipeline is a hybrid model. Standard network functions such as L2 bridging, L3 routing, and tunnels are represented as fixed functional blocks, implemented natively in the hardware. In between these blocks are a set of hook-in points that allow programmability to be added on top of the base switch pipeline:


p4 switch hybrid model

The pipeline begins with a hybrid parser, which supports a default standard fixed parse graph. The P4 user can extend this parser by adding custom headers and transitions. Next is a series of Match-Action blocks, interspersed between the standard bridging and routing functions. Then at the end, the packet is modified by the de-parser before it gets transmitted out the egress port.


P4 Ethernet Switch for SONiC

NVIDIA P4 Ethernet Switch supports a hybrid management model for Software for Open Networking in the Cloud, or SONiC.

SONiC controls the fixed function data plane blocks, such as L2 bridging and L3 routing, and the P4 Application controls the programmable elements, adding capabilities that are not supported natively in SONiC.

The P4 for SONiC model utilizes the SONiC Application Extension framework to run P4 applications in parallel to the SONiC base OS and leverage SONiC infrastructure, such as SONiC CLI, and warm boot.


p4 ethernet programambillity hybrid


P4 for SONiC - User Workflow

Users compile their P4 code with the nvp4c, NVIDIA P4 Compiler, using the NVIDIA P4 Build as an off-box compilation environment.

The P4 compilation output is the P4 auto-generated SDK libs (P4 SDK libs).

Next, users develop and build their own P4 SONiC Application and use the P4 SDK libraries to configure the programmable data plane.

Finally, the user deploys and runs their P4 Application on their SONiC Switch.

The following figure is an illustration of this workflow:

p4 ethernet programambillity hybrid

SONiC application extension

SONiC application extension allows seamless integration of a P4 containerized application while other applications run in parallel

  • A SONiC framework for integrating 3rd party applications to SONiC base OS
  • No need to build and install an entire SONiC image to add a new application
  • Extend and use SONiC native infrastructure: Redis DB, CLI, logging, warm and fast restarts, and more
  • Extend and natively integrate with the SONiC CLI
p4 ethernet sonic userflow

P4 Ethernet Switch Toolkit

NVIDIA provides the following toolkit

  • NVIDIA P4 build docker container, the P4 build environment, which includes the P4 compiler, P4 developer tool (p4nspect) and the associated SDK libraries.
  • P4 example application for SONiC which is used as a reference for how to develop and build a P4 application extension. It includes the application source code, p4nspect, and the associated SDK libraries.
p4 ethernet switch toolkit

p4nspect – NVIDIA P4 Developer Tool ethernet-p4-search-icon.png

A one-stop-shop tool for inspecting the data plane state throughout the program lifecycle, for troubleshooting and debugging:

  • Design stage (Build Env) - Evaluate code correctness and performance
  • Runtime (on target hardware) - Inspect P4 data and underlying HW state
  • Post-mortem - Inspect dump files content

Key Features:

  • Display P4 objects with correlated device low-level representation and resources
  • CLI tool for native environment and agile development
  • Visualize control graphs
  • Single flow for online and offline scenarios (post-mortem analysis)

Key Features

  • Hybrid Target Architecture Model
  • Flex Parser
  • Match Action Tables
  • High scale counters support
  • P4 Build Docker Image as the Build Environment
  • p4nspect - P4 Developer Tool
  • P4 SONiC Example Application