Your Network Datapath Will Be P4 Scripted
Jamal Hadi Salim
Anjali Singhai Jain
P4 has gained industry-wide acceptance as a datapath language. NIC consumers are now requesting NIC vendors to allow prescription of a P4 program to define required xPU datapaths, example MS.
Running P4 on top of TC has been a subject of many many discussions in the community over the last few years, initially in physical and electronic hallways and eventually in physical formal meetings, see,,,,,.
The call-to-arms was made by at the Netdev 0x14 conference by Nick Mckeown in a keynote titled: “Creating an End-to-End Programming Model for Packet Forwarding” 
Due to the industry takeoff of P4 we are (finally in 2022) putting resources to make it real for the Linux kernel. We hope to make the first code release at the conference.
In this talk we will discuss:
- The overview of the P4TC Motivation and Goals and Requirements
- Design And Architecture Overview with a focus on “scriptability”
- The different P4TC objects and interaction between P4 and TC/kernel infra
- User space integration into iproute2::tc
- Integration into drivers
- And finally describe the P4TC Workflow for devs and ops as well as runtime control.
P4TC goals are: 1) Offloading entirely to P4-capable hardware with tc skip_sw flag.
2) Running entirely in software infrastructures (VMs, baremetal, containers) with skip_hw flag. Think this mode as the digital twin of #1.
3) Split setup - where some of the P4 program control and pipeline is in software and some is in hardware (using a mix of skip_sw and skip_hw).
4) Running multiple independent P4 programs across multiple independent hardware and/or software (using tc filter infrastructure).
5) Post P4TC upstreaming, independence from changing or compiling any kernel or user space code for any P4 program (achieved via “scriptability”). IOW, no loading of any binary blob into the kernel or user space. Imagine the developer and ops productivity boost for not having to play acrobatics with various versions of a library, a compiler or kernel just because they want to introduce some new datapath foo with bar header processing in the kernel with hardware offload. Imagine not having to change any iproute2 code either…
“Scriptability” as a concept has precedence in the kernel TC architecture in the u32 classifier, the pedit action, skbedit, etc. A P4 program when compiled using the P4C compiler generates tc scripts, which when executed, manifests into the functionally equivalent P4 program in the kernel. Alternatively, for simple programs, one could hand code the tc scripts to instantiate a P4 program.
P4TC takes advantage of the modularity of the TC architecture and makes very minimal changes to the TC core code while providing all the necessary objects to sufficiently abstract a P4 program.
A secondary goal for P4TC is to go beyond what P4 prescribes today where appropriate; IOW, while we strive to meet P4 spec we will also be pragmatic in marrying ideas from the kernel, and TC in particular, that we can feed back to the P4 community and general network programming world.
 Matty Kadosh, “P4 Offload”, TC Workshop, Netdev conference 2.2, 2017 https://legacy.netdevconf.info/2.2/slides/salim-tc-workshop04.pdf
 Prem Jonnalagadda, “Mapping tc to P4”, TC Workshop, Netdev conference 2.2, 2017 https://legacy.netdevconf.info/2.2/slides/salim-tc-workshop06.pdf
 Jamal Hadi Salim, “What P4 Can Learn From Linux Traffic Control”, proceedings of ONF 5th P4 Workshop, 2018 https://opennetworking.org/wp-content/uploads/2020/12/Jamal_Salim.pdf
 Many speakers, TC P4 workshop, Intel, Santa Clara, 2018 https://files.netdevconf.info/d/5aa8c0ca61ea4e96bb46/
 Antonin Bas and R. Krishnamoorthy. “Instrumenting P4 in the Kernel”, TC Workshop, Netdev conference 0x12, 2018 https://www.files.netdevconf.info/d/9535fba900604dcd9c93/files/?p=/Instrumenting%20P4%20in%20the%20Linux%20kernel.pdf
 Marian Pritsak and Matty Kadosh, “P4 Compiler Backend for TC”, Netdev conference 0x13, 2019 https://legacy.netdevconf.info/0x13/session.html?p4-compiler-backend-for-tc
 Nick Mckeown Netdev conference 0x14, 2020 “Creating an End-to-End Programming Model for Packet Forwarding” https://legacy.netdevconf.info/0x14/session.html?keynote-mckeown
 Jamal Hadi Salim et al “Demystifying The TC Ugly (or Universal) 32bit Key Packet Classifier”, Netdev conference 0x13, 2019 https://legacy.netdevconf.info/0x13/session.html?talk-tc-u-classifier
 Pedit source and man pages: https://elixir.bootlin.com/linux/latest/source/net/sched/act_pedit.c https://man7.org/linux/man-pages/man8/tc-pedit.8.html
 P4C compiler https://github.com/p4lang/p4c
 MS Azure DASH https://github.com/Azure/DASH/tree/main/documentation
Netdev 0x16 Day 1 - 5 videos released
[Wed, 18, Jan. 2023]
Netdev 0x16 Day 1 and 2 videos released
[Thu, 22, Dec. 2022]
Netdev 0x16 Schedule is up
[Tue, 04, Oct. 2022]
Registration for Netdev 0x16 is now OPEN!
[Wed, 21, Sep. 2022]
Bronze Sponsor, OpenVPN
[Sat, 10, Sep. 2022]
Bronze Sponsor, Jump Trading
[Fri, 09, Sep. 2022]
Bronze Sponsor, NVIDIA
[Thu, 08, Sep. 2022]
Bronze Sponsor, HAProxy
[Thu, 08, Sep. 2022]
Bronze Sponsor, ByteDance
[Sat, 27, Aug. 2022]
Bronze Sponsor, Gcore
[Thu, 25, Aug. 2022]
Gold Sponsor, Meta
[Wed, 17, Aug. 2022]
Bronze Sponsor, secunet
[Wed, 10, Aug. 2022]
Platinum Sponsor, Intel®
[Tue, 02, Aug. 2022]
Bronze Sponsor, ZEVENET
[Tue, 26, Jul. 2022]
Bronze Sponsor, Mojatatu
[Thu, 21, Jul. 2022]
Platinum Sponsor, Google
[Tue, 12, Jul. 2022]
Media Sponsor, LWN.net
[Fri, 08, Jul. 2022]
Platinum Sponsor, Juniper Networks
[Thu, 30, Jun. 2022]
Bronze Sponsor, Tempesta
[Fri, 24, Jun. 2022]
Silver Sponsor, AMD
[Wed, 15, Jun. 2022]
Netdev 0x16 Call for Submissions
[Tue, 07, Jun. 2022]
|Closing of CFS||Wed, Sept. 7, 2022|
|Notification by||Thu, Sept. 15, 2022|
|Conference dates||Oct 24th - 28th, 2022|