Learn

Find what you are looking for at every stage of learning about P4 from beginner to expert. This page will help you navigate the available resources which are primarily located on GitHub and YouTube.

You also have the opportunity to learn by interacting with the P4 community on the P4 forum, slack, and email lists.

Educational Working Group

The education working group has put together a Getting Started page that curates the links for tutorials, hardware compatibility, videos, and code samples.

P4 Tutorials

A good starting point is our rich set of tutorials. The tutorials are developed as hands-on labs, and contain everything to get you experimenting in P4: an overview of the language, sets of exercises that increase in complexity, and a virtual machine pre-installed with all the software so you can jump directly into data plane programming.

Definitions

Discourse is an excellent place to learn P4 terminology. For example, see this thread on bmv2, v1model, and P4_16. The P4 Specification also has a useful section on terminology.

P4 Ecosystem

Information about training and consulting service providers in the P4 Ecosystem are found here.

Classes

Graduate classes in P4 are available at a number of universities, including Stanford, Cambridge, Karlstads, and Lisbon. Learn about these classes and view materials here. Professors – you are invited to add the classes you teach to this page.

P4 Blogs

Some of the blogs on this website provide learning opportunities for beginners (e.g., Getting Started page), while other topics and new applications will resonate with experienced P4 programmers.

GitHub

Please feel free to browse our github repositories. All our code is released under the Apache 2.0 license.
Here are some of the repositories you may be interested in:

  • p4c, a reference compiler that supports several backends and easily integrates into vendor-specific backends.
    • p4c-bmv2 – targets the behavioral model
    • p4c-ebpf – targets the Extended Berkeley Packet Framework
    • p4c-graphs – produces parser and table flow graph diagrams
    • p4test – a simple frontend verifier for P4 programs
  • behavioral-model, a simulation environment to run the P4 software switch, standalone or in Mininet.
  • p4runtime, a specification and Protobuf/gRPC interface definition for a runtime API to control data plane programs.
    • PI is a reference implementation for P4Runtime
    • p4runtime-shell is an interactive Python shell for P4Runtime based on IPython
  • ptf, a packet test framework that interfaces with P4Runtime to enable switch configuration and test creation.
  • p4app, a Docker container pre-packaged with a development environment to easily compile and deploy P4 programs using configuration rules.
  • pna, ongoing work that will lead to a published Portable NIC Architecture specification
  • p4app-switchML, accelerates the all-reduce communication primitive commonly used by distributed Machine Learning frameworks.

control ingress () {
     table routing {
          key = { hdr.ipv4.dstAddr : lpm; }
          actions = { drop; route; }
          size = 2048;
      }
      apply {
          routing.apply();
      }
}


Ready to try programming in P4?

Try it out in our P4 Sandbox!

Contact us

Fill out the form below, and we will be in touch shortly.