SlideShare a Scribd company logo
1©2016 Open-NFP
Open-NFP Summer Webinar Series:
Session 4: P4, EBPF And Linux TC Offload
Dinan Gunawardena & Jakub Kicinski -
Netronome
August 24, 2016
2©2016 Open-NFP
Open-NFP www.open-nfp.org
Support and grow reusable research in accelerating dataplane network functions processing
Reduce/eliminate the cost and technology barriers to research in this space
•  Technologies:
–  P4, eBPF, SDN, OpenFlow, Open vSwitch (OVS) offload
•  Tools:
–  Discounted hardware, development tools, software, cloud access
•  Community:
–  Website (www.open-nfp.org): learning & training materials, active Google group
https://groups.google.com/d/forum/open-nfp, open project descriptions, code repository
•  Learning/Education/Research support:
–  Summer seminar series, P4DevCon conference, Tutorials (P4 Developer Day), research proposal support
for proposals to the NSF, state agencies
Summer seminar series to further progress to our objective. Present applied reusable research.
3©2016 Open-NFP
Universities Companies
P4DevCon Attendees/Open-NFP Projects*
*This	does	not	imply	that	these	organiza4ons	endorse	Open-NFP	or	Netronome
4©2016 Open-NFP
Session Agenda
1. Introduction
–  Objectives
2. Overview: The high level model for offload
-  What we are offloading – P4 / eBPF
-  Overall programmer model for transparent
offload
3. Linux Kernel Infrastructure
–  The Traffic Classifier (TC)
–  eXpress Data Path (XDP)
–  Current eBPF translation on X86/ARM64/PPC64
4. Hardware Intro to NFP (Network Flow
Processor) architecture
–  SmartNICs-Multi Core, Many Core
–  NUMA, Memory Hierarchy
5. Accelerating P4/eBPF in NFP :
Implementation
–  Kernel core infrastructure
–  Map handling in the kernel
–  Translating instructions
–  Basic Map Support
–  Optimizations
6. & 7. Demo; Summary
5©2016 Open-NFP
Session Objectives
6©2016 Open-NFP
Introduction: Objectives
Understanding how eBPF is relevant to P4
Understanding the support for offload and state of art in the Linux Kernel
The Code
– Understand the structure of a eBPF program
– Gain an insight into how this is translated and executed in hardware
Understanding how the NFP architecture on the Agilio CX enables high
performing, fully programmable network offload
– The Many Core architecture and its advantages
7©2016 Open-NFP
Overview: High level model for offload
•  What we are offloading – P4 / eBPF
•  Overall programmer model for
transparent offload
8©2016 Open-NFP
P4 and eBPF
What are P4 and eBPF?
Domain specific languages for specifying forwarding
behaviour of the data plane of network components
P4 - Programming Protocol-Independent Packet
Processors
•  Header format description
•  Parse Graphs (FSM)
•  Tables (<keys,actions>)
•  Actions manipulate packet header/metadata
•  Control flow – an imperative program, describing
sequence of data dependent match/actions
eBPF – Extended Berkley Packet Filters
•  Low level (machine code like) language
•  Code executed by a VM (restricted memory, no
sleeps/locks, limited API to kernel)in the Kernel (TC)
•  Code injected into netfilter hook points in kernel data
plane
•  Maps (<key, value> stores)
•  Chained filter functions
•  Match/action
•  Static verification of safety, guaranteed to terminate
9©2016 Open-NFP
Translating P4->eBPF
John Fastabend P4 to eBPF compiler
Why translate P4 to eBPF?
Table	and	diagrams	©	Mihai	Budiu
10©2016 Open-NFP
Model for Transparent Offload
Programmer / user is “unaware” that eBPF code is “offloaded”
Requirements
• Partial pipeline offload
• Fallback to software for any eBPF code block
• Transparent user mode / kernel mode access to tables
eBPF	
Program	2	
(HW	offload)	
eBPF	
Program	3	
Packet	
In	
eBPF	
Program	1	
(HW	offload)	
PCI-E	crossing
11©2016 Open-NFP
Linux Kernel Infrastucture
•  The Traffic Classifier (TC)
•  eXpress Data Path (XDP)
12©2016 Open-NFP
Linux Traffic Classifier (TC)
Component	 Linux	Component	
Shaping	 The	class	offers	shaping	capabili4es	
Scheduling	 A	qdisc	acts	as	a	scheduler	e.g.	FIFO	
Classifying	 The	filter	performs	classifica4on	through	a	classifier	
object.	
Policing	 A	policer	performs	policing	within	a	filter	
Dropping	 The	“drop”	ac4on	occurs	with	a	filter+policer	
Marking	 The	dsmark	qdisc	is	used	for	marking	
eBPF	
program	
TC	diagram	and	example	program	©	Jamal	Hadi	Salim
13©2016 Open-NFP
eXpress Data Path (XDP)
What
•  High performance,
programmable network
data path
Utility
•  Useful for packet processing
•  forwarding
•  load balancing
•  DOS mitigation
•  firewalls, etc.
XDP	architecture	diagram	©	Tom	Herbert
14©2016 Open-NFP
Hardware Intro to NFP (Network Flow
Processor) architecture
•  NUMA, Memory Hierarchy
•  Current eBPF translation on X86/ARM64/
PPC64
15©2016 Open-NFP
NUMA, Memory Hierarchy
Architecural Philosopies:
•  Bring the data close to where it needs to be processed
•  Facilitate highly concurrent access to memories
•  Mitigate branch costs and hide I/O & memory access
latencies
16©2016 Open-NFP
Current eBPF translation on X86/ARM64/PPC64
1) Write eBPF program as a simple
C Program
2) Compiled to eBPF byte code
3) Loaded into the Linux TC
4) Run through verifier
5) Cross compiled to X86/ARM64/PPC64
… Or now NFP Byte Code!
NFP	hardware	
offloaded	eBPF	
TC
17©2016 Open-NFP
Dataflow
User	Space	
Traffic	Classifier	(TC)	
Driver	(XDP)	
Firmware	&	Hardware	
PCI-E	
Network	
Kernel	
User	
NFP	
TCP	Stack	
Packet	+	Descriptor,	
Meta	data	
Packet	+	Sk_Buf
18©2016 Open-NFP
Supported Actions
User	Space	
Traffic	Classifier	(TC)	
Driver	(XDP)	
Firmware	&	Hardware	
PCI-E	
Network	
Kernel	
User	
NFP	
TCP	Stack	
Packet	+	Descriptor,	
Meta	data	
Packet	+	Sk_Buf	
Supported	Ac2ons	
•  Drop	
•  Mark	
•  Redirect	
Redirect	Drop	
Mark
19©2016 Open-NFP
Accelerating P4/eBPF in NFP :
Implementation
•  Kernel core infrastructure
•  Map handling in the kernel
•  eBPF to NFP
•  Map Support
•  Optimizations
20©2016 Open-NFP
Kernel core infrastructure
User	Space	
Traffic	Classifier	(TC)	
Driver	(XDP)	
NFP	Offload	
Control	
eBPF	Program	
+	Flags	
Firmware	&	Hardware	
PCI-E	
Network	
Kernel	
User	
NFP	
TCP	Stack	
skip_sw	|	skip_hw	
Offload	obj	
Stats
21©2016 Open-NFP
eBPF to NFP
eBPF	Registers	
10	x	
64bits	
MAP	
DRAM	
X	 X	
X	 X	
A	
B	
16	x		
	2	x	
32bits	
ME	Registers	
Translate	
Communica4on	
Registers	
NFP	
•  Non-linear mapping
•  32 bit translation
22©2016 Open-NFP
•  Write interception
•  Ownership
•  Associating with a device
•  Read-Only single-user maps
•  Read-Only multi-user maps
•  Write-Enabled single-user maps
•  Write-Enabled multi-user maps
Map Handling in Kernel & Map Write Reflection
User	
Space	
Network	
MAP	 Kernel	
Space	
NFP	MAP	
Write	Reflec4on	
PCI-E	
Control	
Applica4on
23©2016 Open-NFP
Optimizations
•  Dealing with different memory types
•  Peephole Optimizer
•  Dropping unnecessary jumps
•  Optimizing instructions with immediates
•  Fusing instructions
•  Full A/B register allocations
•  Liveness analysis with real state size tracking
24©2016 Open-NFP
Demo
25©2016 Open-NFP
Summary
•  Learnt the relationship between P4 and eBPF
•  Discovered the infrastructure in the Linux Kernel for eBPF
offload
•  Learnt about how the Netronome Smart NIC architecture is
optimised for network flow processing
•  Explored how we implemented the eBPF offload in hardware
26©2016 Open-NFP
QUESTIONS?
Dinan Gunawardena
dinan.gunawardena@netronome.com
Jakub Kicinski
Jakub.Kicinski@netronome.com
27©2016 Open-NFP
THANK YOU

More Related Content

PDF
ebpf and IO Visor: The What, how, and what next!
PDF
DockerCon 2017 - Cilium - Network and Application Security with BPF and XDP
PDF
Introduction to OFI
PDF
DPDK: Multi Architecture High Performance Packet Processing
PDF
eBPF/XDP
ODP
eBPF maps 101
PDF
eBPF - Rethinking the Linux Kernel
PDF
Linux Instrumentation
ebpf and IO Visor: The What, how, and what next!
DockerCon 2017 - Cilium - Network and Application Security with BPF and XDP
Introduction to OFI
DPDK: Multi Architecture High Performance Packet Processing
eBPF/XDP
eBPF maps 101
eBPF - Rethinking the Linux Kernel
Linux Instrumentation

What's hot (20)

PDF
EBPF and Linux Networking
PDF
DevConf 2014 Kernel Networking Walkthrough
PPTX
Packet flow on openstack
PDF
Fun with Network Interfaces
PPTX
eBPF Basics
PDF
Accelerating Envoy and Istio with Cilium and the Linux Kernel
PDF
Introduction to eBPF and XDP
PDF
TRex Traffic Generator - Hanoch Haim
PDF
Kubernetes Networking
PDF
LinuxCon 2015 Linux Kernel Networking Walkthrough
PDF
Kernel Recipes 2017 - EBPF and XDP - Eric Leblond
PPTX
DPDK KNI interface
PDF
Kubernetes - A Comprehensive Overview
PDF
DPDK & Layer 4 Packet Processing
PDF
[MeetUp][1st] 오리뎅이의_쿠버네티스_네트워킹
PDF
Network Programming: Data Plane Development Kit (DPDK)
PPTX
Docker and kubernetes_introduction
PPTX
The Next Linux Superpower: eBPF Primer
PPTX
Tutorial: Using GoBGP as an IXP connecting router
PDF
Linux 4.x Tracing: Performance Analysis with bcc/BPF
EBPF and Linux Networking
DevConf 2014 Kernel Networking Walkthrough
Packet flow on openstack
Fun with Network Interfaces
eBPF Basics
Accelerating Envoy and Istio with Cilium and the Linux Kernel
Introduction to eBPF and XDP
TRex Traffic Generator - Hanoch Haim
Kubernetes Networking
LinuxCon 2015 Linux Kernel Networking Walkthrough
Kernel Recipes 2017 - EBPF and XDP - Eric Leblond
DPDK KNI interface
Kubernetes - A Comprehensive Overview
DPDK & Layer 4 Packet Processing
[MeetUp][1st] 오리뎅이의_쿠버네티스_네트워킹
Network Programming: Data Plane Development Kit (DPDK)
Docker and kubernetes_introduction
The Next Linux Superpower: eBPF Primer
Tutorial: Using GoBGP as an IXP connecting router
Linux 4.x Tracing: Performance Analysis with bcc/BPF
Ad

Similar to P4, EPBF, and Linux TC Offload (20)

PDF
P4 for Custom Identification, Flow Tagging, Monitoring and Control
PPTX
High Performance Flow Matching Architecture for Openflow Data Plane
PDF
1. OPNFV Updates @ Tokyo Meetup#2
PDF
Programming the Network Data Plane
PDF
High-Performance and Scalable Designs of Programming Models for Exascale Systems
PPTX
P4+ONOS SRv6 tutorial.pptx
PDF
Stacks and Layers: Integrating P4, C, OVS and OpenStack
PDF
Data Plane and VNF Acceleration Mini Summit
PDF
Scalable and Distributed DNN Training on Modern HPC Systems
PPTX
Communication Frameworks for HPC and Big Data
PDF
How to Achieve High-Performance, Scalable and Distributed DNN Training on Mod...
PDF
Transparent eBPF Offload: Playing Nice with the Linux Kernel
PPTX
Making our networking stack truly extensible
PDF
Japan's post K Computer
PDF
P4_tutorial.pdf
PDF
OpenPOWER Acceleration of HPCC Systems
PDF
Panda scalable hpc_bestpractices_tue100418
PDF
Designing Scalable HPC, Deep Learning and Cloud Middleware for Exascale Systems
PPTX
2017 dagstuhl-nfv-rothenberg
PDF
"New Standards for Embedded Vision and Neural Networks," a Presentation from ...
P4 for Custom Identification, Flow Tagging, Monitoring and Control
High Performance Flow Matching Architecture for Openflow Data Plane
1. OPNFV Updates @ Tokyo Meetup#2
Programming the Network Data Plane
High-Performance and Scalable Designs of Programming Models for Exascale Systems
P4+ONOS SRv6 tutorial.pptx
Stacks and Layers: Integrating P4, C, OVS and OpenStack
Data Plane and VNF Acceleration Mini Summit
Scalable and Distributed DNN Training on Modern HPC Systems
Communication Frameworks for HPC and Big Data
How to Achieve High-Performance, Scalable and Distributed DNN Training on Mod...
Transparent eBPF Offload: Playing Nice with the Linux Kernel
Making our networking stack truly extensible
Japan's post K Computer
P4_tutorial.pdf
OpenPOWER Acceleration of HPCC Systems
Panda scalable hpc_bestpractices_tue100418
Designing Scalable HPC, Deep Learning and Cloud Middleware for Exascale Systems
2017 dagstuhl-nfv-rothenberg
"New Standards for Embedded Vision and Neural Networks," a Presentation from ...
Ad

More from Open-NFP (7)

PDF
Accelerating Networked Applications with Flexible Packet Processing
PDF
Network Measurement with P4 and C on Netronome Agilio
PDF
Measuring a 25 and 40Gb/s Data Plane
PDF
OpenContrail, Real Speed: Offloading vRouter
PDF
Protecting the Privacy of the Network – Using P4 to Prototype and Extend Netw...
PDF
P4-based VNF and Micro-VNF Chaining for Servers With Intelligent Server Adapters
PDF
Consensus as a Network Service
Accelerating Networked Applications with Flexible Packet Processing
Network Measurement with P4 and C on Netronome Agilio
Measuring a 25 and 40Gb/s Data Plane
OpenContrail, Real Speed: Offloading vRouter
Protecting the Privacy of the Network – Using P4 to Prototype and Extend Netw...
P4-based VNF and Micro-VNF Chaining for Servers With Intelligent Server Adapters
Consensus as a Network Service

Recently uploaded (20)

PPTX
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
PDF
NewMind AI Weekly Chronicles - August'25 Week I
PDF
KodekX | Application Modernization Development
PDF
Electronic commerce courselecture one. Pdf
PPTX
Digital-Transformation-Roadmap-for-Companies.pptx
PDF
Chapter 3 Spatial Domain Image Processing.pdf
PDF
Encapsulation theory and applications.pdf
PDF
cuic standard and advanced reporting.pdf
PDF
Shreyas Phanse Resume: Experienced Backend Engineer | Java • Spring Boot • Ka...
PDF
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
PDF
Encapsulation_ Review paper, used for researhc scholars
PDF
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
PDF
Machine learning based COVID-19 study performance prediction
PPTX
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
PPTX
PA Analog/Digital System: The Backbone of Modern Surveillance and Communication
PDF
Dropbox Q2 2025 Financial Results & Investor Presentation
PPTX
Cloud computing and distributed systems.
PDF
Per capita expenditure prediction using model stacking based on satellite ima...
PPTX
Big Data Technologies - Introduction.pptx
PDF
Advanced methodologies resolving dimensionality complications for autism neur...
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
NewMind AI Weekly Chronicles - August'25 Week I
KodekX | Application Modernization Development
Electronic commerce courselecture one. Pdf
Digital-Transformation-Roadmap-for-Companies.pptx
Chapter 3 Spatial Domain Image Processing.pdf
Encapsulation theory and applications.pdf
cuic standard and advanced reporting.pdf
Shreyas Phanse Resume: Experienced Backend Engineer | Java • Spring Boot • Ka...
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
Encapsulation_ Review paper, used for researhc scholars
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
Machine learning based COVID-19 study performance prediction
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
PA Analog/Digital System: The Backbone of Modern Surveillance and Communication
Dropbox Q2 2025 Financial Results & Investor Presentation
Cloud computing and distributed systems.
Per capita expenditure prediction using model stacking based on satellite ima...
Big Data Technologies - Introduction.pptx
Advanced methodologies resolving dimensionality complications for autism neur...

P4, EPBF, and Linux TC Offload

  • 1. 1©2016 Open-NFP Open-NFP Summer Webinar Series: Session 4: P4, EBPF And Linux TC Offload Dinan Gunawardena & Jakub Kicinski - Netronome August 24, 2016
  • 2. 2©2016 Open-NFP Open-NFP www.open-nfp.org Support and grow reusable research in accelerating dataplane network functions processing Reduce/eliminate the cost and technology barriers to research in this space •  Technologies: –  P4, eBPF, SDN, OpenFlow, Open vSwitch (OVS) offload •  Tools: –  Discounted hardware, development tools, software, cloud access •  Community: –  Website (www.open-nfp.org): learning & training materials, active Google group https://groups.google.com/d/forum/open-nfp, open project descriptions, code repository •  Learning/Education/Research support: –  Summer seminar series, P4DevCon conference, Tutorials (P4 Developer Day), research proposal support for proposals to the NSF, state agencies Summer seminar series to further progress to our objective. Present applied reusable research.
  • 3. 3©2016 Open-NFP Universities Companies P4DevCon Attendees/Open-NFP Projects* *This does not imply that these organiza4ons endorse Open-NFP or Netronome
  • 4. 4©2016 Open-NFP Session Agenda 1. Introduction –  Objectives 2. Overview: The high level model for offload -  What we are offloading – P4 / eBPF -  Overall programmer model for transparent offload 3. Linux Kernel Infrastructure –  The Traffic Classifier (TC) –  eXpress Data Path (XDP) –  Current eBPF translation on X86/ARM64/PPC64 4. Hardware Intro to NFP (Network Flow Processor) architecture –  SmartNICs-Multi Core, Many Core –  NUMA, Memory Hierarchy 5. Accelerating P4/eBPF in NFP : Implementation –  Kernel core infrastructure –  Map handling in the kernel –  Translating instructions –  Basic Map Support –  Optimizations 6. & 7. Demo; Summary
  • 6. 6©2016 Open-NFP Introduction: Objectives Understanding how eBPF is relevant to P4 Understanding the support for offload and state of art in the Linux Kernel The Code – Understand the structure of a eBPF program – Gain an insight into how this is translated and executed in hardware Understanding how the NFP architecture on the Agilio CX enables high performing, fully programmable network offload – The Many Core architecture and its advantages
  • 7. 7©2016 Open-NFP Overview: High level model for offload •  What we are offloading – P4 / eBPF •  Overall programmer model for transparent offload
  • 8. 8©2016 Open-NFP P4 and eBPF What are P4 and eBPF? Domain specific languages for specifying forwarding behaviour of the data plane of network components P4 - Programming Protocol-Independent Packet Processors •  Header format description •  Parse Graphs (FSM) •  Tables (<keys,actions>) •  Actions manipulate packet header/metadata •  Control flow – an imperative program, describing sequence of data dependent match/actions eBPF – Extended Berkley Packet Filters •  Low level (machine code like) language •  Code executed by a VM (restricted memory, no sleeps/locks, limited API to kernel)in the Kernel (TC) •  Code injected into netfilter hook points in kernel data plane •  Maps (<key, value> stores) •  Chained filter functions •  Match/action •  Static verification of safety, guaranteed to terminate
  • 9. 9©2016 Open-NFP Translating P4->eBPF John Fastabend P4 to eBPF compiler Why translate P4 to eBPF? Table and diagrams © Mihai Budiu
  • 10. 10©2016 Open-NFP Model for Transparent Offload Programmer / user is “unaware” that eBPF code is “offloaded” Requirements • Partial pipeline offload • Fallback to software for any eBPF code block • Transparent user mode / kernel mode access to tables eBPF Program 2 (HW offload) eBPF Program 3 Packet In eBPF Program 1 (HW offload) PCI-E crossing
  • 11. 11©2016 Open-NFP Linux Kernel Infrastucture •  The Traffic Classifier (TC) •  eXpress Data Path (XDP)
  • 12. 12©2016 Open-NFP Linux Traffic Classifier (TC) Component Linux Component Shaping The class offers shaping capabili4es Scheduling A qdisc acts as a scheduler e.g. FIFO Classifying The filter performs classifica4on through a classifier object. Policing A policer performs policing within a filter Dropping The “drop” ac4on occurs with a filter+policer Marking The dsmark qdisc is used for marking eBPF program TC diagram and example program © Jamal Hadi Salim
  • 13. 13©2016 Open-NFP eXpress Data Path (XDP) What •  High performance, programmable network data path Utility •  Useful for packet processing •  forwarding •  load balancing •  DOS mitigation •  firewalls, etc. XDP architecture diagram © Tom Herbert
  • 14. 14©2016 Open-NFP Hardware Intro to NFP (Network Flow Processor) architecture •  NUMA, Memory Hierarchy •  Current eBPF translation on X86/ARM64/ PPC64
  • 15. 15©2016 Open-NFP NUMA, Memory Hierarchy Architecural Philosopies: •  Bring the data close to where it needs to be processed •  Facilitate highly concurrent access to memories •  Mitigate branch costs and hide I/O & memory access latencies
  • 16. 16©2016 Open-NFP Current eBPF translation on X86/ARM64/PPC64 1) Write eBPF program as a simple C Program 2) Compiled to eBPF byte code 3) Loaded into the Linux TC 4) Run through verifier 5) Cross compiled to X86/ARM64/PPC64 … Or now NFP Byte Code! NFP hardware offloaded eBPF TC
  • 19. 19©2016 Open-NFP Accelerating P4/eBPF in NFP : Implementation •  Kernel core infrastructure •  Map handling in the kernel •  eBPF to NFP •  Map Support •  Optimizations
  • 20. 20©2016 Open-NFP Kernel core infrastructure User Space Traffic Classifier (TC) Driver (XDP) NFP Offload Control eBPF Program + Flags Firmware & Hardware PCI-E Network Kernel User NFP TCP Stack skip_sw | skip_hw Offload obj Stats
  • 21. 21©2016 Open-NFP eBPF to NFP eBPF Registers 10 x 64bits MAP DRAM X X X X A B 16 x 2 x 32bits ME Registers Translate Communica4on Registers NFP •  Non-linear mapping •  32 bit translation
  • 22. 22©2016 Open-NFP •  Write interception •  Ownership •  Associating with a device •  Read-Only single-user maps •  Read-Only multi-user maps •  Write-Enabled single-user maps •  Write-Enabled multi-user maps Map Handling in Kernel & Map Write Reflection User Space Network MAP Kernel Space NFP MAP Write Reflec4on PCI-E Control Applica4on
  • 23. 23©2016 Open-NFP Optimizations •  Dealing with different memory types •  Peephole Optimizer •  Dropping unnecessary jumps •  Optimizing instructions with immediates •  Fusing instructions •  Full A/B register allocations •  Liveness analysis with real state size tracking
  • 25. 25©2016 Open-NFP Summary •  Learnt the relationship between P4 and eBPF •  Discovered the infrastructure in the Linux Kernel for eBPF offload •  Learnt about how the Netronome Smart NIC architecture is optimised for network flow processing •  Explored how we implemented the eBPF offload in hardware