GitHunt
GI

gierens/xdp-reflector

An XDP program to reflect ethernet frames.

xdp-reflector

An XDP program to reflect ethernet frames.

Performance

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.

Dependencies

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

Building

Just hit make:

make

Deploying

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

Remarks

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.

License

This project is distributed under MIT license.

Languages

C100.0%

Contributors

MIT License
Created August 1, 2022
Updated October 22, 2022
gierens/xdp-reflector | GitHunt