ixgbe Internals
SUSE Labs Taipei Technology Sharing Day 2018
Gary Lin
Software Engineer, SUSE Labs
glin@suse.com
ixgbe?
Intel 10 Gigabit PCI Express Linux Driver
Why ixgbe?
●
The first driver supporting XDP_REDIRECT in
Linux kernel mainline
●
Using a different memory model for XDP
●
Just For Fun™
Overview
NIC
driver
Application
Network Stack
QDISC
From Driver to AP
TX
RX
NAPI
TX – QDISC
... CPU 1
CPU 2
CPU n
TX Q 1
TX Q 2
TX Q n-1
TX Q n
CPU n-1
Ring Buffer
...
QDISC
netdev_pick_tx() +
ndo_start_xmit()
RX – NAPI
RAM
Network Card
DMA
poll poll poll poll
IRQ
RX Queue
... CPU 1
CPU 2
CPU n
napi_poll()
CPU Q 1
CPU Q 2
CPU Q n
...
enqueue_to_backlog()
RX Q 1
RX Q 2
RX Q n-1
RX Q n
CPU n-1 CPU Q n-1
CPU i
Ring Buffer
Ring Buffers in ixgbe
TX Ring
RX Ring
XDP Ring
RX Q 2
IRQ q_vector
RX Ring 2
TX Q 1
TX Ring 1
Legacy Interrupt
RX Q 1
TX Q 2
RX Ring 1
TX Ring 2
RX Q IRQ q_vector
RX Ring
TX Q IRQ q_vector
TX Ring
RX Q
IRQ q_vector
RX Ring
TX Q
TX Ring
MSI-X
...
Ring Buffer
buffer1
buffer2
buffer3
buffer4
next_to_use
TX Ring
ixgbe_tx_buffer
sk_buff
QDISCstruct sk_buff *skb
unsigned int bytescount
XDP Ring
ixgbe_tx_buffer
void *data
xdp_buff
XDP
unsigned int bytescount
void *data
TX Ring + XDP Ring
ixgbe_q_vector
struct ixgbe_ring_container tx
TX Ring 1
TX Ring 2
TX Ring n
XDP Ring 1
XDP Ring 2
XDP Ring n
RX Ring
ixgbe_rx_buffer
struct page *page
__u32 *page_offset
__u16 pagecnt_bias
page
dev_alloc_pages()
RX Ring
ixgbe_rx_buffer
struct page *page
__u32 *page_offset
__u16 pagecnt_bias
page
DMA
RX Ring
ixgbe_rx_buffer
struct page *page
__u32 *page_offset
__u16 pagecnt_bias
page
SKB
RX Ring
ixgbe_rx_buffer
struct page *page
__u32 *page_offset
__u16 pagecnt_bias
page
Flip
Flip: page_offset ^= page_size / 2
RX Ring
ixgbe_rx_buffer
struct page *page
__u32 *page_offset
__u16 pagecnt_bias
page
RX Ring – Recycle
ixgbe_rx_buffer
struct page *page
__u32 *page_offset
__u16 pagecnt_bias
page
Flip
RX Ring – Replace
ixgbe_rx_buffer
struct page *page
__u32 *page_offset
__u16 pagecnt_bias
page
page
Page Ref Count
●
Tracking the number of users of the page
●
The possible page ref count (ideally):
– 1: The whole page is available.
– 2: One half of the page is in use.
– 3: The whole page is in use.
Page Count Operations
static inline void set_page_count(struct page *page, int v)
{
atomic_set(&page->_refcount, v);
if (page_ref_tracepoint_active(__tracepoint_page_ref_set))
__page_ref_set(page, v);
}
static inline void page_ref_add(struct page *page, int nr)
{
atomic_add(nr, &page->_refcount);
if (page_ref_tracepoint_active(__tracepoint_page_ref_mod))
__page_ref_mod(page, nr);
}
static inline void page_ref_sub(struct page *page, int nr)
{
atomic_sub(nr, &page->_refcount);
if (page_ref_tracepoint_active(__tracepoint_page_ref_mod))
__page_ref_mod(page, -nr);
}
Atomic operations are
expensive!
Adjusted Ref Count (1/3)
●
A locally maintained pagecnt_bias for the RX
page
●
Initial value of pagecnt_bias: 1
●
adj_pagecnt = pagecnt – pagecnt_bias
– 0: The whole page is available.
– 1: One half of the page is in use.
– 2: The whole page is in use.
Adjusted Ref Count (2/3)
●
Harvesting a packet: pagecnt_bias--
●
Recycling the page: pagecnt_bias++
– The XDP program returns XDP_DROP or an error.
– The packet is small enough to be copied into the
allocated skb.
– The packet is failed to be packed into skb.
●
If pagecnt_bias == 0, set pagecnt_bias to
USHRT_MAX and add USHRT_MAX to pagecnt.
Adjusted Ref Count (3/3)
●
Packet consumed: pagecnt--
– The packet is consumed by the network stack.
– XDP_TX or XDP_REDIRECT is completed.
●
Releasing the page: pagecnt -= pagecnt_bias
– With the help of __page_frag_cache_drain()
XDP
TX Q
RX Q
Network
Stack
PASS
DROP
eBPF
Program
TX
NIC Driver
eXpress Data Path
REDIRECT
Other CPU or NIC
Page 1 Page 2 Page 3
Conventional RX Buffer
Page 1 Page 2 Page 3
One Packet Per Page
Memory Model Switch
XDP
NOTE: The driver other than ixgbe
For ixgbe, memory model switch is
not necessary!
XDP in ixgbe
eBPF
Program
XDP_PASS
Network
Stack
RX Ring
XDP Ring
XDP_DROP
XDP_TX
XDP_REDIRECT
Other CPU or NICXDP_REDIRECT
ixgbe_xdp_xmit()
xdp_do_redirect()
ixgbe_xmit_xdp_ring()
pagecnt_bias++
Incoming New Features
●
XDP for ixgbevf (linux-next)
– ixgbe blocks XDP if SR-IOV is enabled.
●
XDP redirect memory return API (net-next)
– Managing pages across drivers
– Adopted by ixgbe, i40e, mlx5, tuntap, and virtio_net
– Preparing for the AF_XDP zero-copy patch set
– ixgbe tweaked the page ref counting scheme for the
new API.
Question?
Thank You!
Ixgbe internals
References

Linux kernel v4.15
https://github.com/torvalds/linux/tree/v4.15/drivers/net/ethernet/intel/ixgb
e

[0/5] Enable XDP for ixgbevf
http://patchwork.ozlabs.org/cover/887197/

[net-next V11 PATCH 00/17] XDP redirect memory return API
https://www.spinics.net/lists/netdev/msg495995.html

ixgbe: tweak page counting for XDP_REDIRECT
https://patchwork.ozlabs.org/patch/889261/

Monitoring and Tuning the Linux Networking Stack: Sending Data
https://blog.packagecloud.io/eng/2017/02/06/monitoring-tuning-linux-net
working-stack-sending-data/

Monitoring and Tuning the Linux Networking Stack: Receiving Data
https://blog.packagecloud.io/eng/2016/06/22/monitoring-tuning-linux-net
working-stack-receiving-data/

More Related Content

PPTX
Linux Network Stack
PDF
Linux Networking Explained
PDF
Network Programming: Data Plane Development Kit (DPDK)
PDF
Performance Wins with eBPF: Getting Started (2021)
PDF
BPF / XDP 8월 세미나 KossLab
PDF
EBPF and Linux Networking
PDF
High-Performance Networking Using eBPF, XDP, and io_uring
PDF
BPF - in-kernel virtual machine
Linux Network Stack
Linux Networking Explained
Network Programming: Data Plane Development Kit (DPDK)
Performance Wins with eBPF: Getting Started (2021)
BPF / XDP 8월 세미나 KossLab
EBPF and Linux Networking
High-Performance Networking Using eBPF, XDP, and io_uring
BPF - in-kernel virtual machine

What's hot (20)

PDF
Linux Performance Analysis: New Tools and Old Secrets
PDF
The linux networking architecture
PDF
Linux BPF Superpowers
PPTX
Introduction to DPDK
PDF
eBPF/XDP
PDF
DPDK In Depth
PDF
eBPF Trace from Kernel to Userspace
PDF
LinuxCon 2015 Linux Kernel Networking Walkthrough
PDF
Intel DPDK Step by Step instructions
PDF
BPF Internals (eBPF)
PDF
DPDK & Layer 4 Packet Processing
PDF
Embedded linux network device driver development
PDF
Page cache in Linux kernel
PDF
Introduction to eBPF and XDP
PDF
Kernel Recipes 2017 - Understanding the Linux kernel via ftrace - Steven Rostedt
PDF
Tracing MariaDB server with bpftrace - MariaDB Server Fest 2021
PDF
Open vSwitch 패킷 처리 구조
PDF
The Linux Block Layer - Built for Fast Storage
PDF
Virtualization Support in ARMv8+
ODP
eBPF maps 101
Linux Performance Analysis: New Tools and Old Secrets
The linux networking architecture
Linux BPF Superpowers
Introduction to DPDK
eBPF/XDP
DPDK In Depth
eBPF Trace from Kernel to Userspace
LinuxCon 2015 Linux Kernel Networking Walkthrough
Intel DPDK Step by Step instructions
BPF Internals (eBPF)
DPDK & Layer 4 Packet Processing
Embedded linux network device driver development
Page cache in Linux kernel
Introduction to eBPF and XDP
Kernel Recipes 2017 - Understanding the Linux kernel via ftrace - Steven Rostedt
Tracing MariaDB server with bpftrace - MariaDB Server Fest 2021
Open vSwitch 패킷 처리 구조
The Linux Block Layer - Built for Fast Storage
Virtualization Support in ARMv8+
eBPF maps 101
Ad

Similar to Ixgbe internals (20)

PDF
Exploiting GPUs in Spark
PDF
PL/CUDA - Fusion of HPC Grade Power with In-Database Analytics
PDF
Gpu Join Presentation
PDF
SF Big Analytics 2019112: Uncovering performance regressions in the TCP SACK...
PDF
pgconfasia2016 plcuda en
PDF
20170602_OSSummit_an_intelligent_storage
PDF
Can FPGAs Compete with GPUs?
PDF
Xdp and ebpf_maps
PDF
20181212 - PGconfASIA - LT - English
PPTX
Gpu workshop cluster universe: scripting cuda
PPT
Vpu technology &gpgpu computing
PPT
Vpu technology &gpgpu computing
PPT
Vpu technology &gpgpu computing
PDF
Accelerating HPC Applications on NVIDIA GPUs with OpenACC
PDF
Experiences with Power 9 at A*STAR CRC
PPTX
Understanding DPDK
PPTX
Spark 计算模型
PPT
NVIDIA CUDA
PPTX
Lrz kurs: big data analysis
ODP
Linux kernel tracing superpowers in the cloud
Exploiting GPUs in Spark
PL/CUDA - Fusion of HPC Grade Power with In-Database Analytics
Gpu Join Presentation
SF Big Analytics 2019112: Uncovering performance regressions in the TCP SACK...
pgconfasia2016 plcuda en
20170602_OSSummit_an_intelligent_storage
Can FPGAs Compete with GPUs?
Xdp and ebpf_maps
20181212 - PGconfASIA - LT - English
Gpu workshop cluster universe: scripting cuda
Vpu technology &gpgpu computing
Vpu technology &gpgpu computing
Vpu technology &gpgpu computing
Accelerating HPC Applications on NVIDIA GPUs with OpenACC
Experiences with Power 9 at A*STAR CRC
Understanding DPDK
Spark 计算模型
NVIDIA CUDA
Lrz kurs: big data analysis
Linux kernel tracing superpowers in the cloud
Ad

More from SUSE Labs Taipei (20)

PDF
New things about SUSE shim, SUSE Labs Conference 2025, Brno
PDF
shim and things related to it, COSCUP 2025, Taipei
PDF
Locked down openSUSE Tumbleweed kernel
PDF
SUSE shim and things related to it
PDF
Multi-signed Kernel Module
PDF
ACPI Debugging from Linux Kernel
PDF
Profiling the ACPICA Namespace and Event Handing
PDF
Kernel debug log and console on openSUSE
PDF
The bright future of SUSE and openSUSE
PDF
EFI Secure Key
ODP
Convert your package to multibuild on Open Build Service
PDF
Linux Linux Traffic Control
ODP
Looking into trusted and encrypted keys
ODP
Use bonding driver with ethernet
ODP
Use build service API in your program
PDF
Hands-on ethernet driver
ODP
S4 sig-check-lpc-20130918
ODP
openSUSE12.2 Review
ODP
oS KDE Repos & MM
ODP
Develop and Maintain a Distro with Open Build Service
New things about SUSE shim, SUSE Labs Conference 2025, Brno
shim and things related to it, COSCUP 2025, Taipei
Locked down openSUSE Tumbleweed kernel
SUSE shim and things related to it
Multi-signed Kernel Module
ACPI Debugging from Linux Kernel
Profiling the ACPICA Namespace and Event Handing
Kernel debug log and console on openSUSE
The bright future of SUSE and openSUSE
EFI Secure Key
Convert your package to multibuild on Open Build Service
Linux Linux Traffic Control
Looking into trusted and encrypted keys
Use bonding driver with ethernet
Use build service API in your program
Hands-on ethernet driver
S4 sig-check-lpc-20130918
openSUSE12.2 Review
oS KDE Repos & MM
Develop and Maintain a Distro with Open Build Service

Recently uploaded (20)

PPTX
Empowering Asian Contributions: The Rise of Regional User Groups in Open Sour...
PPT
introduction of sql, sql commands(DD,DML,DCL))
PPTX
Post-Migration Optimization Playbook: Getting the Most Out of Your New Adobe ...
PPTX
Relevance Tuning with Genetic Algorithms
PPTX
Greedy best-first search algorithm always selects the path which appears best...
PDF
How to Set Realistic Project Milestones and Deadlines
PDF
Canva Desktop App With Crack Free Download 2025?
PDF
Coding with GPT-5- What’s New in GPT 5 That Benefits Developers.pdf
PDF
Multiverse AI Review 2025_ The Ultimate All-in-One AI Platform.pdf
PPTX
Advanced Heap Dump Analysis Techniques Webinar Deck
PPTX
oracle_ebs_12.2_project_cutoveroutage.pptx
PDF
IObit Driver Booster Pro Crack Latest Version Download
PDF
Streamlining Project Management in Microsoft Project, Planner, and Teams with...
PPTX
FLIGHT TICKET API | API INTEGRATION PLATFORM
PPTX
TRAVEL SUPPLIER API INTEGRATION | XML BOOKING ENGINE
PPTX
Beige and Black Minimalist Project Deck Presentation (1).pptx
PDF
DOWNLOAD—IOBit Uninstaller Pro Crack Download Free
PDF
C language slides for c programming book by ANSI
PDF
10 Mistakes Agile Project Managers Still Make
PDF
OpenColorIO Virtual Town Hall - August 2025
Empowering Asian Contributions: The Rise of Regional User Groups in Open Sour...
introduction of sql, sql commands(DD,DML,DCL))
Post-Migration Optimization Playbook: Getting the Most Out of Your New Adobe ...
Relevance Tuning with Genetic Algorithms
Greedy best-first search algorithm always selects the path which appears best...
How to Set Realistic Project Milestones and Deadlines
Canva Desktop App With Crack Free Download 2025?
Coding with GPT-5- What’s New in GPT 5 That Benefits Developers.pdf
Multiverse AI Review 2025_ The Ultimate All-in-One AI Platform.pdf
Advanced Heap Dump Analysis Techniques Webinar Deck
oracle_ebs_12.2_project_cutoveroutage.pptx
IObit Driver Booster Pro Crack Latest Version Download
Streamlining Project Management in Microsoft Project, Planner, and Teams with...
FLIGHT TICKET API | API INTEGRATION PLATFORM
TRAVEL SUPPLIER API INTEGRATION | XML BOOKING ENGINE
Beige and Black Minimalist Project Deck Presentation (1).pptx
DOWNLOAD—IOBit Uninstaller Pro Crack Download Free
C language slides for c programming book by ANSI
10 Mistakes Agile Project Managers Still Make
OpenColorIO Virtual Town Hall - August 2025

Ixgbe internals