Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,8 @@ The key components are
containers also. See [bpftune-netns (8)](./docs/bpftune-netns.rst)
- UDP buffer tuner: auto-tune buffers relating to UDP. See
[bpftune-udp-buffer (8)](./docs/bpftune-udp-buffer.rst)
- Gaming tuner: detects sustained low-latency UDP activity and applies
per-profile network tweaks for gaming workloads.

## Code organization

Expand Down
26 changes: 26 additions & 0 deletions docs/bpftune-gaming.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Gaming tuner profile guide

The gaming tuner watches outgoing UDP traffic (≤1500 byte payloads) and
counts packets-per-second. If traffic stays above ~25 PPS for two sampling
windows with stable variance, the tuner classifies the session and applies
one of three profiles:

- **CASUAL** – Keeps socket defaults at 262 KB, backlog at 5 K, budgets modest,
and busy-read/busy-poll around 25 µs. Suitable for lighter multiplayer or
machines where background work still matters.
- **COMPETITIVE** – Raises rmem/wmem limits to 16 MB, bumps NAPI budgets, and
shortens interrupt coalescing for twitch shooters or MOBAs on mainstream
hardware.
- **INTENSE** – Pushes UDP/TCP caps to ~33 MB, maximizes NAPI budgets, and
keeps NIC interrupts as immediate as the driver allows. Use for VR streaming,
LAN events, or when squeezing the absolute lowest latency from a well-sized
system.

When traffic quiets for ~10 s the tuner rolls every sysctl back to its cached
baseline and logs the restoration. If a system feels resource constrained,
drop down one profile tier or adjust the busy poll/read tunables to ~15–25 µs
before rebuilding the gaming tuner shared object.

The detection thresholds live in `src/gaming_tuner.h` (`GAMING_TUNER_UDP_MAX_SIZE`
and `GAMING_TUNER_UDP_MIN_PPS`). They can be tuned and rebuilt if a title has
unusual packet sizing or pacing requirements.
11 changes: 11 additions & 0 deletions include/bpftune/bpftune.h
Original file line number Diff line number Diff line change
Expand Up @@ -80,12 +80,23 @@ enum bpftune_state {
BPFTUNE_GONE, /* resource gone */
};

enum bpftunable_scenario_flags {
BPFTUNABLE_SCENARIO_QUIET = 0x1,
};

struct bpftunable_scenario {
unsigned int id;
const char *name;
const char *description;
unsigned int flags;
};

#define BPFTUNABLE_SCENARIO(_id, _name, _description) \
{ (_id), (_name), (_description), 0 }

#define BPFTUNABLE_SCENARIO_FLAGS(_id, _name, _description, _flags) \
{ (_id), (_name), (_description), (_flags) }

/* some tunables are defined as triples */

#define BPFTUNE_MAX_VALUES 3
Expand Down
2 changes: 1 addition & 1 deletion src/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ endif

TUNERS = tcp_buffer_tuner route_table_tuner neigh_table_tuner sysctl_tuner \
tcp_conn_tuner netns_tuner net_buffer_tuner ip_frag_tuner \
udp_buffer_tuner
udp_buffer_tuner gaming_tuner

TUNER_OBJS = $(patsubst %,%.o,$(TUNERS))
TUNER_SRCS = $(patsubst %,%.c,$(TUNERS))
Expand Down
Loading