SlideShare a Scribd company logo
1 of 10
Download to read offline
CETH for XDP
Common Ethernet Driver Framework
for faster network I/O
Yan Chen(Y.Chen@Huawei.com)
Yunsong Lu (Yunsong.Lu@Huawei.com)
Leveraging IO Visor
• Performance Tuning
• Tracing
• Networking for Container: Dynamic E2E Monitoring
• Cloud Native NFV: Micro Data Path Container(MDPC)
• http://www.slideshare.net/IOVisor/evolving-virtual-networking-with-
io-visor-openstack-summit-austin-april-2016
Express I/O for XDP
• Kernel Network I/O has been a performance bottleneck
• Netmap and DPDK claimed 10x performance advantage 
• Bypass is not low-hanging fruit
• Could rebuilding EVERYTHING in userspace really do better?
• Unless all bottlenecks are removed, it’s still a long way to go
• Kernel is the place for better driver/platform eco-system
• Multi-vendor NICs and accelerators
• X86, ARM, Power, SPARC, etc.
• Programmability of XDP will enable innovation in “Network
Functional Applications”
History of CETH (Common Ethernet Driver Framework)
Designed for Performance and Virtualization:
1. Improve kernel networking performance for
virtualization, particularly vSwitch and virtual I/O
2. Simplify NIC drivers by consolidate common
functions, particularly for “internal” new NICs
accelerators
3. Standalone module for various kernel versions
Supports:
• Huawei’s EVS(Elastic Virtual Switch)
• NICs:
• Intel ixgbe
• Intel i40e (40G)
• Broadcom bnx2x
• Mellanox mlnx-en
• Emulex be2net
• Accelerators:
• Huawei SNP-lite
• Broadcom XLP
• Ezchip Gx36
• Huawei VDR
• vNIC:
• ctap(tap+vhost)
• virtio-net
• ceth-pair
Design Considerations (before XDP)
1. Efficient Memory/Buffer Management
o Pre-allocated packet buffer pool
o Efficient buffer acquire/recycle mechanism
o Data Prefetching
o Batching packet process
o Optimized for efficient cache usage
o Locking reduction/avoidance
o High performance copy
o Reduction of DMA mapping
o Huge pages, etc.
2. Flexible TX/RX Scheduling
o Threaded_irq
o All-in-interrupt handling
o Optional R2C or Pipeline Threading models
o Feature-triggered mode switching
3. Customizable Meta-data structure
o Cache-friendly data structure
o Hardware/accelerator friendly
o Extensible Metadata format is customizable
o SKB compatible
4. Compatible with Kernel IP stack
o Hardware Offloading friendly
o Checksum, VLAN, etc.
o TSO/GSO, LRO/GRO
o Easy to port existing Linux device drivers
o Reuse most existing non-datapath functions
o Guild for easy driver porting
5. Tools for easy performance tuning
o “ceth” tool to tune all parameters
o sysfs interfaces
Simplified CETH for XDP
1. Efficient Memory/Buffer Management
o Pre-allocated packet buffer pool
o Efficient buffer acquire/recycle mechanism
o Data Prefetching
o Batching packet process
o Optimized for efficient cache usage
o Locking reduction/avoidance
o High performance copy
o Reduction of DMA mapping
o Huge pages, etc.
2. Flexible TX/RX Scheduling
o Threaded_irq
o All-in-interrupt handling
o Optional R2C or Pipeline Threading models
o Feature-triggered mode switching
3. Customizable Meta-data structure
o Cache-friendly data structure
o Hardware/accelerator friendly
o Extensible Metadata format is customizable
o SKB compatible
4. Compatible with Kernel IP stack
o Hardware Offloading friendly
o Checksum, VLAN, etc.
o TSO/GSO, LRO/GRO
o Easy to port existing Linux device drivers
o Easy driver porting: less than 200LOC/driver
5. Tools for easy performance tuning
o “ceth” tool to tune all parameters
o Sysfs interfaces
Simple interfaces for drivers
• New Functions (CETH module)
o ceth_pkt_aquire()
o ceth_pkt_recycle()
o ceth_pkt_to_skb()
• Kernel modification
o __kfree_skb()
• Driver modifications
• allocate buffers from CETH
• optional: use pkt_t by default
• optimize the driver! 
• Performance
 30% performance improvement for packet
switching (br, ovs)
 40% of pktgen performance
 100% improvement for XDP forwarding
 33Mpps XDP dropping rate with 2 CPU threads
 Scalable with multiple hardware queues
Patch available based on latest XDP kernel tree.
Preliminary Performance numbers:
https://docs.google.com/spreadsheets/d/1nT0DO25lfS1QpB
LQkdIMm4LJl1v_VMScZVSOcRgkQOI/edit#gid=0
NOTE: all numbers were internally tested for development
purpose only.
Memory and Buffer Management
• Separate memory
management layer for
various optimizations,
like huge page
• Per-CPU or per-queue
buffer pool mechanisms
• May use skb by default
(pkt_t as buffer data
structure only)
• Can use non-skb meta-
data cross all XDP
functions
Packet Management
for XDP and protocol stack
driver
Buffer ManagementMemory Management
RX queue
RX queue
RX queue
RX queue
RX queue
RX queue
per-CPU
ceth_pkt buffer pool
per-CPU
ceth_pkt buffer pool
per-CPU
ceth_pkt buffer pool
ceth_pkt batch
in-use
ceth_pkt free
ceth_pkt free
ceth_pkt in-use
ceth_pkt batch
in-use
ceth_pkt free
ceth_pkt free
ceth_pkt in-use
ceth_pkt batch
in-use
ceth_pkt free
ceth_pkt free
ceth_pkt in-use
ceth_pkt batch
in-use
ceth_pkt free
ceth_pkt free
ceth_pkt in-use
default
paged memory implementation
using buddy allocator
contiguous pages
of batch size
page
page
page
contiguous pages
of batch size
page
page
page
contiguous pages
of batch size
page
page
page
per-CPU / per device queue
ceth_pkt buffer pool
recycled batch list
free ceth_pkt batch
ceth_pkt
ceth_pkt
ceth_pkt
free ceth_pkt batch
ceth_pkt
ceth_pkt
ceth_pkt
TX queue
current ceth_pkt batch
ceth_pkt batch
in-use
desc ring
if current batch is used up
and recycled list is not empty
take the first batch in recycled list
ceth_pkt
ceth_pkt
ceth_pkt
ceth_pkt
RX queue
desc ring
ceth_pkt
ceth_pkt
ceth_pkt
ceth_pkt
host protocol stack
forwarding
ceth_pkt_acquire()
__kfree_skb(skb)
ceth_pkt_to_skb(pkt)
netif_receive_skb(skb)
ceth_pkt
ceth_pkt in-use
ceth_pkt in-use
ceth_pkt
ceth_pkt
ceth_pkt in-use
ceth_pkt
ceth_pkt
contiguous pages
of batch size
page
page
page
page
if recycled list is empty
alloc_pages()
if recycled list is too long
free the batch directly
if recycled list idled for too long
free all pkt batches in the list
free ceth_pkt batch
ceth_pkt
ceth_pkt
ceth_pkt
ceth_pkt
whoever frees the last in-use ceth_pkt in a batch
will push the batch to head of recycled list
while taking the recycle list lock
drop
ceth_pkt_recycle(pkt)
optional
huge-page implementation
for mapping to user space
contiguous pages
of batch size
page
page
page
contiguous pages
of batch size
page
page
page
contiguous pages
of batch size
page
page
page
contiguous memory
frags of batch size
frag
frag
frag
frag
XDP
CETH pkt_t Structure
• Use one page for one packet
• Customizable meta data (for XDP)
• Header room for overlay
• SKB data structure ready
• Easy conversion between pkt_t and skb_buff
(with cost)
• Reuse skb_shared_info for fragments
frags[17]
end
skb_shared_info
head room
128 (64x2)
data
skb
data
sk_buff
232x2+8(64x8)
320 (64x5)
128 (64x2)
2880(64x45)
4K (64*64)
sk_buff2
fclone_ref=2
sk_buff_fclones
head
data
end
head
data
end
handle
data_offset
signature
meda data
ceth_pkt
list head
ceth_pkt_buffer
Next Steps (w/ XDP)
• Ongoing
1. Port more mm/bm features
2. Measure performance with XDP
use cases
3. optimize performance with
drivers (need help from driver
developers! )
4. Measure perfoermance
improvement of virtio
5. Direct Socket Interface for
userspace applications
• Discussions on mailing lists
1. Meta-data format
2. Offloading features, like TSO
3. Acceleration API
4. Virtualization Supports

More Related Content

What's hot

How VXLAN works on Linux
How VXLAN works on LinuxHow VXLAN works on Linux
How VXLAN works on Linux
Etsuji Nakai
 
BPF: Tracing and more
BPF: Tracing and moreBPF: Tracing and more
BPF: Tracing and more
Brendan Gregg
 

What's hot (20)

AS45679 on FreeBSD
AS45679 on FreeBSDAS45679 on FreeBSD
AS45679 on FreeBSD
 
Blazing Performance with Flame Graphs
Blazing Performance with Flame GraphsBlazing Performance with Flame Graphs
Blazing Performance with Flame Graphs
 
Topology Managerについて / Kubernetes Meetup Tokyo 50
Topology Managerについて / Kubernetes Meetup Tokyo 50Topology Managerについて / Kubernetes Meetup Tokyo 50
Topology Managerについて / Kubernetes Meetup Tokyo 50
 
[Paris Container Day 2021] nerdctl: yet another Docker & Docker Compose imple...
[Paris Container Day 2021] nerdctl: yet another Docker & Docker Compose imple...[Paris Container Day 2021] nerdctl: yet another Docker & Docker Compose imple...
[Paris Container Day 2021] nerdctl: yet another Docker & Docker Compose imple...
 
Understanding DPDK
Understanding DPDKUnderstanding DPDK
Understanding DPDK
 
Linux kernel tracing
Linux kernel tracingLinux kernel tracing
Linux kernel tracing
 
Network Programming: Data Plane Development Kit (DPDK)
Network Programming: Data Plane Development Kit (DPDK)Network Programming: Data Plane Development Kit (DPDK)
Network Programming: Data Plane Development Kit (DPDK)
 
How VXLAN works on Linux
How VXLAN works on LinuxHow VXLAN works on Linux
How VXLAN works on Linux
 
XDP in Practice: DDoS Mitigation @Cloudflare
XDP in Practice: DDoS Mitigation @CloudflareXDP in Practice: DDoS Mitigation @Cloudflare
XDP in Practice: DDoS Mitigation @Cloudflare
 
UM2019 Extended BPF: A New Type of Software
UM2019 Extended BPF: A New Type of SoftwareUM2019 Extended BPF: A New Type of Software
UM2019 Extended BPF: A New Type of Software
 
eBPF Trace from Kernel to Userspace
eBPF Trace from Kernel to UserspaceeBPF Trace from Kernel to Userspace
eBPF Trace from Kernel to Userspace
 
YOW2021 Computing Performance
YOW2021 Computing PerformanceYOW2021 Computing Performance
YOW2021 Computing Performance
 
eBPF maps 101
eBPF maps 101eBPF maps 101
eBPF maps 101
 
DockerCon 2017 - Cilium - Network and Application Security with BPF and XDP
DockerCon 2017 - Cilium - Network and Application Security with BPF and XDPDockerCon 2017 - Cilium - Network and Application Security with BPF and XDP
DockerCon 2017 - Cilium - Network and Application Security with BPF and XDP
 
Ethernetの受信処理
Ethernetの受信処理Ethernetの受信処理
Ethernetの受信処理
 
Meet cute-between-ebpf-and-tracing
Meet cute-between-ebpf-and-tracingMeet cute-between-ebpf-and-tracing
Meet cute-between-ebpf-and-tracing
 
Understanding eBPF in a Hurry!
Understanding eBPF in a Hurry!Understanding eBPF in a Hurry!
Understanding eBPF in a Hurry!
 
CXL_説明_公開用.pdf
CXL_説明_公開用.pdfCXL_説明_公開用.pdf
CXL_説明_公開用.pdf
 
Dpdk performance
Dpdk performanceDpdk performance
Dpdk performance
 
BPF: Tracing and more
BPF: Tracing and moreBPF: Tracing and more
BPF: Tracing and more
 

Similar to CETH for XDP [Linux Meetup Santa Clara | July 2016]

DAOS - Scale-Out Software-Defined Storage for HPC/Big Data/AI Convergence
DAOS - Scale-Out Software-Defined Storage for HPC/Big Data/AI ConvergenceDAOS - Scale-Out Software-Defined Storage for HPC/Big Data/AI Convergence
DAOS - Scale-Out Software-Defined Storage for HPC/Big Data/AI Convergence
inside-BigData.com
 
Introduction to NVMe Over Fabrics-V3R
Introduction to NVMe Over Fabrics-V3RIntroduction to NVMe Over Fabrics-V3R
Introduction to NVMe Over Fabrics-V3R
Simon Huang
 
SOUG_GV_Flashgrid_V4
SOUG_GV_Flashgrid_V4SOUG_GV_Flashgrid_V4
SOUG_GV_Flashgrid_V4
UniFabric
 

Similar to CETH for XDP [Linux Meetup Santa Clara | July 2016] (20)

Ceph Day Beijing - Ceph all-flash array design based on NUMA architecture
Ceph Day Beijing - Ceph all-flash array design based on NUMA architectureCeph Day Beijing - Ceph all-flash array design based on NUMA architecture
Ceph Day Beijing - Ceph all-flash array design based on NUMA architecture
 
Ceph Day Beijing - Ceph All-Flash Array Design Based on NUMA Architecture
Ceph Day Beijing - Ceph All-Flash Array Design Based on NUMA ArchitectureCeph Day Beijing - Ceph All-Flash Array Design Based on NUMA Architecture
Ceph Day Beijing - Ceph All-Flash Array Design Based on NUMA Architecture
 
Dataplane networking acceleration with OpenDataplane / Максим Уваров (Linaro)
Dataplane networking acceleration with OpenDataplane / Максим Уваров (Linaro)Dataplane networking acceleration with OpenDataplane / Максим Уваров (Linaro)
Dataplane networking acceleration with OpenDataplane / Максим Уваров (Linaro)
 
DAOS - Scale-Out Software-Defined Storage for HPC/Big Data/AI Convergence
DAOS - Scale-Out Software-Defined Storage for HPC/Big Data/AI ConvergenceDAOS - Scale-Out Software-Defined Storage for HPC/Big Data/AI Convergence
DAOS - Scale-Out Software-Defined Storage for HPC/Big Data/AI Convergence
 
Ceph Day Seoul - AFCeph: SKT Scale Out Storage Ceph
Ceph Day Seoul - AFCeph: SKT Scale Out Storage Ceph Ceph Day Seoul - AFCeph: SKT Scale Out Storage Ceph
Ceph Day Seoul - AFCeph: SKT Scale Out Storage Ceph
 
Heterogeneous Computing : The Future of Systems
Heterogeneous Computing : The Future of SystemsHeterogeneous Computing : The Future of Systems
Heterogeneous Computing : The Future of Systems
 
From Rack scale computers to Warehouse scale computers
From Rack scale computers to Warehouse scale computersFrom Rack scale computers to Warehouse scale computers
From Rack scale computers to Warehouse scale computers
 
PROSE
PROSEPROSE
PROSE
 
Introduction to DPDK
Introduction to DPDKIntroduction to DPDK
Introduction to DPDK
 
Walk Through a Software Defined Everything PoC
Walk Through a Software Defined Everything PoCWalk Through a Software Defined Everything PoC
Walk Through a Software Defined Everything PoC
 
Data Policies for the Kafka-API with WebAssembly | Alexander Gallego, Vectorized
Data Policies for the Kafka-API with WebAssembly | Alexander Gallego, VectorizedData Policies for the Kafka-API with WebAssembly | Alexander Gallego, Vectorized
Data Policies for the Kafka-API with WebAssembly | Alexander Gallego, Vectorized
 
Introduction to NVMe Over Fabrics-V3R
Introduction to NVMe Over Fabrics-V3RIntroduction to NVMe Over Fabrics-V3R
Introduction to NVMe Over Fabrics-V3R
 
Ceph Day Melbourne - Walk Through a Software Defined Everything PoC
Ceph Day Melbourne - Walk Through a Software Defined Everything PoCCeph Day Melbourne - Walk Through a Software Defined Everything PoC
Ceph Day Melbourne - Walk Through a Software Defined Everything PoC
 
NWU and HPC
NWU and HPCNWU and HPC
NWU and HPC
 
DPDK Summit 2015 - Aspera - Charles Shiflett
DPDK Summit 2015 - Aspera - Charles ShiflettDPDK Summit 2015 - Aspera - Charles Shiflett
DPDK Summit 2015 - Aspera - Charles Shiflett
 
Ceph
CephCeph
Ceph
 
Ceph: Open Source Storage Software Optimizations on Intel® Architecture for C...
Ceph: Open Source Storage Software Optimizations on Intel® Architecture for C...Ceph: Open Source Storage Software Optimizations on Intel® Architecture for C...
Ceph: Open Source Storage Software Optimizations on Intel® Architecture for C...
 
SOUG_GV_Flashgrid_V4
SOUG_GV_Flashgrid_V4SOUG_GV_Flashgrid_V4
SOUG_GV_Flashgrid_V4
 
Ceph Community Talk on High-Performance Solid Sate Ceph
Ceph Community Talk on High-Performance Solid Sate Ceph Ceph Community Talk on High-Performance Solid Sate Ceph
Ceph Community Talk on High-Performance Solid Sate Ceph
 
April 2014 IBM announcement webcast
April 2014 IBM announcement webcastApril 2014 IBM announcement webcast
April 2014 IBM announcement webcast
 

Recently uploaded

+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
Health
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service provider
mohitmore19
 
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICECHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
9953056974 Low Rate Call Girls In Saket, Delhi NCR
 

Recently uploaded (20)

+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
 
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
 
Architecture decision records - How not to get lost in the past
Architecture decision records - How not to get lost in the pastArchitecture decision records - How not to get lost in the past
Architecture decision records - How not to get lost in the past
 
SHRMPro HRMS Software Solutions Presentation
SHRMPro HRMS Software Solutions PresentationSHRMPro HRMS Software Solutions Presentation
SHRMPro HRMS Software Solutions Presentation
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service provider
 
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
 
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
 
Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsRight Money Management App For Your Financial Goals
Right Money Management App For Your Financial Goals
 
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICECHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
 
Define the academic and professional writing..pdf
Define the academic and professional writing..pdfDefine the academic and professional writing..pdf
Define the academic and professional writing..pdf
 
VTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learnVTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learn
 
Exploring the Best Video Editing App.pdf
Exploring the Best Video Editing App.pdfExploring the Best Video Editing App.pdf
Exploring the Best Video Editing App.pdf
 
%in Lydenburg+277-882-255-28 abortion pills for sale in Lydenburg
%in Lydenburg+277-882-255-28 abortion pills for sale in Lydenburg%in Lydenburg+277-882-255-28 abortion pills for sale in Lydenburg
%in Lydenburg+277-882-255-28 abortion pills for sale in Lydenburg
 
Generic or specific? Making sensible software design decisions
Generic or specific? Making sensible software design decisionsGeneric or specific? Making sensible software design decisions
Generic or specific? Making sensible software design decisions
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
 
%+27788225528 love spells in Vancouver Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Vancouver Psychic Readings, Attraction spells,Br...%+27788225528 love spells in Vancouver Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Vancouver Psychic Readings, Attraction spells,Br...
 
8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech students8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech students
 
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
 
Announcing Codolex 2.0 from GDK Software
Announcing Codolex 2.0 from GDK SoftwareAnnouncing Codolex 2.0 from GDK Software
Announcing Codolex 2.0 from GDK Software
 

CETH for XDP [Linux Meetup Santa Clara | July 2016]

  • 1. CETH for XDP Common Ethernet Driver Framework for faster network I/O Yan Chen(Y.Chen@Huawei.com) Yunsong Lu (Yunsong.Lu@Huawei.com)
  • 2. Leveraging IO Visor • Performance Tuning • Tracing • Networking for Container: Dynamic E2E Monitoring • Cloud Native NFV: Micro Data Path Container(MDPC) • http://www.slideshare.net/IOVisor/evolving-virtual-networking-with- io-visor-openstack-summit-austin-april-2016
  • 3. Express I/O for XDP • Kernel Network I/O has been a performance bottleneck • Netmap and DPDK claimed 10x performance advantage  • Bypass is not low-hanging fruit • Could rebuilding EVERYTHING in userspace really do better? • Unless all bottlenecks are removed, it’s still a long way to go • Kernel is the place for better driver/platform eco-system • Multi-vendor NICs and accelerators • X86, ARM, Power, SPARC, etc. • Programmability of XDP will enable innovation in “Network Functional Applications”
  • 4. History of CETH (Common Ethernet Driver Framework) Designed for Performance and Virtualization: 1. Improve kernel networking performance for virtualization, particularly vSwitch and virtual I/O 2. Simplify NIC drivers by consolidate common functions, particularly for “internal” new NICs accelerators 3. Standalone module for various kernel versions Supports: • Huawei’s EVS(Elastic Virtual Switch) • NICs: • Intel ixgbe • Intel i40e (40G) • Broadcom bnx2x • Mellanox mlnx-en • Emulex be2net • Accelerators: • Huawei SNP-lite • Broadcom XLP • Ezchip Gx36 • Huawei VDR • vNIC: • ctap(tap+vhost) • virtio-net • ceth-pair
  • 5. Design Considerations (before XDP) 1. Efficient Memory/Buffer Management o Pre-allocated packet buffer pool o Efficient buffer acquire/recycle mechanism o Data Prefetching o Batching packet process o Optimized for efficient cache usage o Locking reduction/avoidance o High performance copy o Reduction of DMA mapping o Huge pages, etc. 2. Flexible TX/RX Scheduling o Threaded_irq o All-in-interrupt handling o Optional R2C or Pipeline Threading models o Feature-triggered mode switching 3. Customizable Meta-data structure o Cache-friendly data structure o Hardware/accelerator friendly o Extensible Metadata format is customizable o SKB compatible 4. Compatible with Kernel IP stack o Hardware Offloading friendly o Checksum, VLAN, etc. o TSO/GSO, LRO/GRO o Easy to port existing Linux device drivers o Reuse most existing non-datapath functions o Guild for easy driver porting 5. Tools for easy performance tuning o “ceth” tool to tune all parameters o sysfs interfaces
  • 6. Simplified CETH for XDP 1. Efficient Memory/Buffer Management o Pre-allocated packet buffer pool o Efficient buffer acquire/recycle mechanism o Data Prefetching o Batching packet process o Optimized for efficient cache usage o Locking reduction/avoidance o High performance copy o Reduction of DMA mapping o Huge pages, etc. 2. Flexible TX/RX Scheduling o Threaded_irq o All-in-interrupt handling o Optional R2C or Pipeline Threading models o Feature-triggered mode switching 3. Customizable Meta-data structure o Cache-friendly data structure o Hardware/accelerator friendly o Extensible Metadata format is customizable o SKB compatible 4. Compatible with Kernel IP stack o Hardware Offloading friendly o Checksum, VLAN, etc. o TSO/GSO, LRO/GRO o Easy to port existing Linux device drivers o Easy driver porting: less than 200LOC/driver 5. Tools for easy performance tuning o “ceth” tool to tune all parameters o Sysfs interfaces
  • 7. Simple interfaces for drivers • New Functions (CETH module) o ceth_pkt_aquire() o ceth_pkt_recycle() o ceth_pkt_to_skb() • Kernel modification o __kfree_skb() • Driver modifications • allocate buffers from CETH • optional: use pkt_t by default • optimize the driver!  • Performance  30% performance improvement for packet switching (br, ovs)  40% of pktgen performance  100% improvement for XDP forwarding  33Mpps XDP dropping rate with 2 CPU threads  Scalable with multiple hardware queues Patch available based on latest XDP kernel tree. Preliminary Performance numbers: https://docs.google.com/spreadsheets/d/1nT0DO25lfS1QpB LQkdIMm4LJl1v_VMScZVSOcRgkQOI/edit#gid=0 NOTE: all numbers were internally tested for development purpose only.
  • 8. Memory and Buffer Management • Separate memory management layer for various optimizations, like huge page • Per-CPU or per-queue buffer pool mechanisms • May use skb by default (pkt_t as buffer data structure only) • Can use non-skb meta- data cross all XDP functions Packet Management for XDP and protocol stack driver Buffer ManagementMemory Management RX queue RX queue RX queue RX queue RX queue RX queue per-CPU ceth_pkt buffer pool per-CPU ceth_pkt buffer pool per-CPU ceth_pkt buffer pool ceth_pkt batch in-use ceth_pkt free ceth_pkt free ceth_pkt in-use ceth_pkt batch in-use ceth_pkt free ceth_pkt free ceth_pkt in-use ceth_pkt batch in-use ceth_pkt free ceth_pkt free ceth_pkt in-use ceth_pkt batch in-use ceth_pkt free ceth_pkt free ceth_pkt in-use default paged memory implementation using buddy allocator contiguous pages of batch size page page page contiguous pages of batch size page page page contiguous pages of batch size page page page per-CPU / per device queue ceth_pkt buffer pool recycled batch list free ceth_pkt batch ceth_pkt ceth_pkt ceth_pkt free ceth_pkt batch ceth_pkt ceth_pkt ceth_pkt TX queue current ceth_pkt batch ceth_pkt batch in-use desc ring if current batch is used up and recycled list is not empty take the first batch in recycled list ceth_pkt ceth_pkt ceth_pkt ceth_pkt RX queue desc ring ceth_pkt ceth_pkt ceth_pkt ceth_pkt host protocol stack forwarding ceth_pkt_acquire() __kfree_skb(skb) ceth_pkt_to_skb(pkt) netif_receive_skb(skb) ceth_pkt ceth_pkt in-use ceth_pkt in-use ceth_pkt ceth_pkt ceth_pkt in-use ceth_pkt ceth_pkt contiguous pages of batch size page page page page if recycled list is empty alloc_pages() if recycled list is too long free the batch directly if recycled list idled for too long free all pkt batches in the list free ceth_pkt batch ceth_pkt ceth_pkt ceth_pkt ceth_pkt whoever frees the last in-use ceth_pkt in a batch will push the batch to head of recycled list while taking the recycle list lock drop ceth_pkt_recycle(pkt) optional huge-page implementation for mapping to user space contiguous pages of batch size page page page contiguous pages of batch size page page page contiguous pages of batch size page page page contiguous memory frags of batch size frag frag frag frag XDP
  • 9. CETH pkt_t Structure • Use one page for one packet • Customizable meta data (for XDP) • Header room for overlay • SKB data structure ready • Easy conversion between pkt_t and skb_buff (with cost) • Reuse skb_shared_info for fragments frags[17] end skb_shared_info head room 128 (64x2) data skb data sk_buff 232x2+8(64x8) 320 (64x5) 128 (64x2) 2880(64x45) 4K (64*64) sk_buff2 fclone_ref=2 sk_buff_fclones head data end head data end handle data_offset signature meda data ceth_pkt list head ceth_pkt_buffer
  • 10. Next Steps (w/ XDP) • Ongoing 1. Port more mm/bm features 2. Measure performance with XDP use cases 3. optimize performance with drivers (need help from driver developers! ) 4. Measure perfoermance improvement of virtio 5. Direct Socket Interface for userspace applications • Discussions on mailing lists 1. Meta-data format 2. Offloading features, like TSO 3. Acceleration API 4. Virtualization Supports