mirror of
https://github.com/xdp-project/bpf-examples.git
synced 2024-05-06 15:54:53 +00:00
149e2c6d9031e666d1f7db41e43b88a451817be1
Instead of specifying the map size directly in the map definitions, add them as defines at the top of the file to make them easier to change (don't have to find the correct map among the map definitions). This pattern will also simplify future additions of maps, where multiple maps may share the same size. While at it, increase the default packet_ts to 131072 (2^17) entries, as the previous value of 16384 (2^14) which, especially for the packet_ts map, was fairly underdimensioned. If only half of the timestamps are echoed back (due to ex. delayed ACK), it would in theory be enough with just 16k / (500 * 1) = 32 concurrent flows to fill it up with stale entries (assuming default cleanout interval of 1s). Increasing the size of these maps will increase the corresponding memory cost from 2^14 * (48 + 4) = 832 KiB and 2^14 * (44 + 144) = 2.94 MiB to 2^17 * (48 + 4) = 6.5 MiB and 2^17 * (44 + 144) = 23.5 MiB, respectively, which should generally not be too problematic. Signed-off-by: Simon Sundberg <simon.sundberg@kau.se>
Practical BPF examples
This git repository contains a diverse set of practical BPF examples that solve (or demonstrate) a specific use-case using BPF.
It is meant to ease doing rapid prototyping and development, writing C-code BPF programs using libbpf. The goal is to make it easier for developers to get started coding.
Many developers struggle to get a working BPF build environment. The repo enviroment makes it easy to build/compile BPF programs by doing the necessary libbpf setup transparently and detect missing compile dependencies (via the configure script). It is a declared goal to make BPF programming more consumable by detecting and reporting issues (when possible).
Description
Languages
C
93.6%
Shell
4.7%
Makefile
1.6%