1This is the BPF program used to implement Receive Side Scaling (RSS) 2across multiple queues if required by a flow action. The program is 3loaded into the kernel when first RSS flow rule is created and is never unloaded. 4 5When flow rules with the TAP device, packets are first handled by the 6ingress queue discipline that then runs a series of classifier filter rules. 7The first stage is the flow based classifier (flower); for RSS queue 8action the second stage is an the kernel skbedit action which sets 9the skb mark to a key based on the flow id; the final stage 10is this BPF program which then maps flow id and packet header 11into a queue id. 12 13This version is built the BPF Compile Once — Run Everywhere (CO-RE) 14framework and uses libbpf and bpftool. 15 16Limitations 17----------- 18- requires libbpf to run 19 20- rebuilding the BPF requires the clang compiler with bpf available 21 as a target architecture and bpftool to convert object to headers. 22 23 Some older versions of Ubuntu do not have a working bpftool package. 24 25- only standard Toeplitz hash with standard 40 byte key is supported. 26 27- the number of flow rules using RSS is limited to 32. 28 29Building 30-------- 31During the DPDK build process the meson build file checks that 32libbpf, bpftool, and clang are available. If everything works then 33BPF RSS is enabled. 34 35The steps are: 36 371. Uses clang to compile tap_rss.c to produce tap_rss.bpf.o 38 392. Uses bpftool generate a skeleton header file tap_rss.skel.h 40 from tap_rss.bpf.o. This header contains wrapper functions for 41 managing the BPF and the actual BPF code as a large byte array. 42 433. The header file is include in tap_flow.c so that it can load 44 the BPF code (via libbpf). 45 46References 47---------- 48BPF and XDP reference guide 49https://docs.cilium.io/en/latest/bpf/progtypes/ 50