An XDP program to reflect ethernet frames.
With MoonGen I achieved about 1.6 Mpps on an Intel 82599-based NIC. I'm not entirely sure yet if and how one can achieve the 14 Mpps that would max out the 10 Gbps throughput of the card.
Initialize the libbpf submodule with:
git submodule update --init
Then install the remaining dependencies with:
sudo apt install -y clang llvm libelf-dev libpcap-dev gcc-multilib build-essential linux-headers-$(uname -r)
For installation instructions for non-Debian systems see XDP tutorial's setup instructions
Just hit make
:
make
Due to the simplicity of this XDP program, it does not come with an extra
loader. You can simply use the ip
tool for this.
To attach the reflector to a device use:
sudo ip link set <DEV> xdpgeneric obj reflector.o sec xdp
And to remove it again use:
sudo ip link set <DEV> xdpgeneric off
This is quite a tiny and almost trivial project. I wrote it because I needed a fast reflector to take MoonGen measurements on non-PCI devices in QEMU guests. Apart from such usecases it can serve as a minimal sample project for XDP programs.
This project is similarly structured as the XDP tutorial, which is a great resource for learning XDP prorgamming.
This project is distributed under MIT license.