BPF meets UVM Michael Stolarchuk LISA 2001 Dec
BPF meets UVM Michael Stolarchuk LISA 2001 Dec 6, 2001 BPF meets UVM
Executive Summary • BPF can be improved • UVM can help BPF meets UVM
Current BPF Model Device Drivers MBUF BPF Device Drivers BPF meets UVM BPF buffers User Process
BPF Copies copies Device Drivers MBUF BPF Device Drivers BPF meets UVM BPF buffers User Process
BPF Copies • Mbufs into BPF buffer • User process copies by issuing read BPF meets UVM
1 Copy Model • Mbuf to BPF buffer copy • BPF buffer mapped into user address space – Mapped region READ-ONLY – Allow REASONABLE sized buffers BPF meets UVM
1 Copy Breaks Semantics • Packet Data Region Can’t be written – Checksum generation – Encryption • Read no longer returns packets – Returns state of active buffers BPF meets UVM
Multiple Buffers • New BPF allows multiple buffers • Of process configured sizes BPF meets UVM
State Changes • Each buffer has an associated state – Null, Empty, Data-Time-Out, Hold • Read returns when state transitions occur – Not all transitions awaken read – Ioctl’s control some of the read-wakeups – Ioctl’s manage user process release of buffers BPF meets UVM
Example Bpf filling hold 1 data mt hold 2 3 4 User process owns BPF meets UVM
More work to set up • Describes number of buffers, size of buffers • Requests memory mapping – Allows bpf to be backwards compatable • Requests features supported • Sets features desired BPF meets UVM
But WAIT… • Improve semantics – time-out – FIONREAD – packet loss – Select/Poll/Kqueue BPF meets UVM
Time Out • Starts when data appears in a Buffer • Provides – Non-blocking to co-exist with timeout – Simple threading implementations work BPF meets UVM
FIONREAD • Returns when data is available to read – Allows user process to check for data – Old version returns chars in buffer, but NOT whether a read would block BPF meets UVM
Packet Loss • Inline description of packet loss – No longer need to `poll’ to see if data is lost – Locates missing data in the data stream – Allows damaged sessions to be marked BPF meets UVM
Poll/Select/Kqueue • Implements Timeout BPF meets UVM
Bpf “Messages” • Compatable format improvement • Allows abstract information to be encoded – Device checksums – Packet loss – Capture counts – Filter counts BPF meets UVM
Next Improvements • Process `owned’ buffers • 0 -Copy BPF meets UVM
- Slides: 18