Session

eBPF Qdisc: a generic building block for traffic control

Speakers

Hsin-Wei (Amery) Hung
Cong Wang

Label

Nuts and Bolts

Session Type

Talk

Contents

Description

Packet scheduling in the Linux kernel is managed by queuing disciplines (Qdisc). Different Qdiscs implement different algorithms, which dictate how input packets from the network stack are arranged and when to output them to the driver queue to be consumed by the network interface controller (NIC). Developing and deploying Qdiscs are cumbersome. Adding a new packet scheduling algorithm requires implementing a Qdisc kernel module from scratch. Combining different packet scheduling algorithms is possible but usually requires a complicated Qdisc hierarchy. On top of Qdiscs, different classifiers and rules can be applied to packets as well, which further complicates the combination of choices. In this paper, we introduce eBPF Qdisc, a fully programmable Qdisc with eBPF. With the recent introduction of user-defined local objects (local kptr), BPF linked list and red-black tree, and the shared ownership of local kptr to the eBPF subsystem, we believe it is time to bring the programmability of eBPF to Qdisc. This will provide developers not only a more flexible and safer way to implement packet schedulers, but also orchestrating packets in coordination with other networking components. In this paper, we first show that eBPF Qdisc is capable of realizing a sophisticated Qdisc by implementing fair queueing (fq) Qdisc. Then, we evaluate the performance of the fq against the existing fq in the Linux kernel. Finally, we show how eBPF Qdisc can help developers implement Qdisc’s with diverse functionalities through two use cases. Firstly, we build a more robust earliest departure time (EDT) rate limiter by coordinating with a fq Qdisc through eBPF maps. Secondly, we show eBPF Qdisc as a flexible way to create network emulators.