eBPF Offload to Hardware: cls_bpf and XDP Motivation - Avoiding - - PowerPoint PPT Presentation
eBPF Offload to Hardware: cls_bpf and XDP Motivation - Avoiding - - PowerPoint PPT Presentation
eBPF Offload to Hardware: cls_bpf and XDP Motivation - Avoiding Whack-a-mole Motivation - Why eBPF? Target architecture (NFP based NIC) RX Path Flow of eBPF Packet The Flow Processing Core (Fully Programmable) Mapping eBPF -> NFP
Motivation - Avoiding Whack-a-mole
Motivation - Why eBPF?
Target architecture (NFP based NIC)
RX Path
Flow of eBPF Packet
The Flow Processing Core (Fully Programmable)
Mapping eBPF -> NFP
Programming Model
Kernel basics (before)
user space kernel space
BPF syscall
- program
- type (sk filter, kprobe, cls, xdp)
- license
- ...
verifier
fd host JIT
tc TC
cls_bpf modification
XDP ctrl
fd verification fd driver
RX TX XDP BPF prog
Kernel basics (flow no offload)
user space kernel space
BPF syscall
- program
- type (sk filter, kprobe, cls, xdp)
- license
- ...
verifier
fd host JIT
tc TC
cls_bpf modification
XDP ctrl
fd fd driver
RX TX XDP BPF prog s k b
verification
Kernel basics (after)
user space kernel space
BPF syscall
- program
- type (sk filter, kprobe, cls, xdp)
- license
- ...
verifier
fd host JIT
tc TC
cls_bpf modification
XDP ctrl
- ffload
- bject
fd, skip_* flags verification fd, skip_* flags driver
RX TX XDP
ndo setup tc
HW JIT / translator
stats & maps
BPF prog
Kernel basics (after)
user space kernel space
BPF syscall
- program
- type (sk filter, kprobe, cls, xdp)
- license
- ...
verifier
fd host JIT
tc TC
cls_bpf modification
XDP ctrl
- ffload
- bject
fd, skip_* flags fd, skip_* flags driver
RX TX XDP
ndo setup tc
HW JIT / translator
stats & maps
BPF prog
verification
Kernel basics (flow with offload)
user space kernel space
BPF syscall
- program
- type (sk filter, kprobe, cls, xdp)
- license
- ...
verifier
fd host JIT
tc TC
cls_bpf modification
XDP ctrl
- ffload
- bject
fd, skip_* flags fd, skip_* flags driver
RX TX XDP
ndo setup tc
HW JIT / translator
stats & maps
BPF prog
fallback
stats metadata
verification
Translation and loading
user space kernel space
BPF syscall
- program
- type (sk filter, kprobe, cls, xdp)
- license
- ...
verifier
fd host JIT
tc TC
cls_bpf modification
XDP ctrl
- ffload
- bject
fd, skip_* flags fd, skip_* flags driver
RX TX XDP
ndo setup tc
HW JIT / translator
stats & maps
BPF prog (1) Check HW capabilities and image parameters
verification
Translation and loading
user space kernel space
BPF syscall
- program
- type (sk filter, kprobe, cls, xdp)
- license
- ...
verifier
fd host JIT
tc TC
cls_bpf modification
XDP ctrl
- ffload
- bject
fd, skip_* flags fd, skip_* flags driver
RX TX XDP
ndo setup tc
HW JIT / translator
stats & maps
BPF prog (1) Check HW capabilities and image parameters (2) Re-run the verifier
verification
Translation and loading
user space kernel space
BPF syscall
- program
- type (sk filter, kprobe, cls, xdp)
- license
- ...
verifier
fd host JIT
tc TC
cls_bpf modification
XDP ctrl
- ffload
- bject
fd, skip_* flags fd, skip_* flags driver
RX TX XDP
ndo setup tc
HW JIT / translator
stats & maps
BPF prog (1) Check HW capabilities and image parameters (2) Re-run the verifier (3) Collect state/analyze
verification
Translation and loading
user space kernel space
BPF syscall
- program
- type (sk filter, kprobe, cls, xdp)
- license
- ...
verifier
fd host JIT
tc TC
cls_bpf modification
XDP ctrl
- ffload
- bject
fd, skip_* flags fd, skip_* flags driver
RX TX XDP
ndo setup tc
HW JIT / translator
stats & maps
BPF prog (1) Check HW capabilities and image parameters (2) Re-run the verifier (3) Collect state/analyze (4) Optimize (5) JIT/generate image (6) Load image
verification
Quick peek at the device path
device driver
RX TX XDP
ndo setup tc
HW JIT / translator
stats & maps kernel space
core core core core core core core Memory stats maps Data path core
packet data m descriptor ring bits in descriptors metadata in prepend
MAC0 MAC1 MAC2 MAC3
Operations and actions (done or near/mid term)
device driver
RX TX XDP
ndo setup tc
HW JIT / translator
stats & maps kernel space
core core core core core core core Memory stats maps core
packet data m descriptor ring bits in descriptors metadata in prepend
MAC0 MAC1 MAC2 MAC3 Data Path
Map plans and ideas
Use of map by offloaded program Map location Mechanism needed Read only Host + device copy update interception Read/write Device only update/read interception lock out map in kernel space Read + statistics gather update/read interception
- use verifier to check access types;
- add hooks in map code;
- add netdevice for binding the map to the device;
- read + statistics require further investigation;
- nly allow read/write offload for skip-sw programs.
Optimizations and verifier future work
Demo Links to eBPF Webinar Start of Webinar: https://www.youtube.com/watch?v=apU5sg0Ui5U Start of Demo: https://youtu.be/apU5sg0Ui5U?t=2003 Also Check out: http://open-nfp.org/the-classroom/
Summary
Kernel basics (after)
user space kernel space
BPF syscall
- program
- type (sk filter, kprobe, cls, xdp)
- license
- ...
verifier
fd host JIT
tc TC
cls_bpf
driver
modification
RX path TX path XDP XDP ctrl
ndo setup tc
- ffload
- bject
fd, skip_* flags
HW JIT / translator
translation verification fd, skip_* flags
BPF prog