Skip to content

bpftune: add new package - #30446

Open
fluffball3 wants to merge 1 commit into
openwrt:masterfrom
fluffball3:bpftune
Open

fluffball3 wants to merge 1 commit into
openwrt:masterfrom
fluffball3:bpftune

Conversation

@fluffball3

@fluffball3 fluffball3 commented Sep 4, 2026

Copy link
Copy Markdown

📦 Package Details

Maintainer: @fluffball3

Description:
bpftune aims to provide lightweight, always-on auto-tuning of system behaviour. By using BPF observability features, we can continuously monitor and adjust system behaviour at a fine grain. Includes gaming tuner from bpftune fork.

Packaged version:
0.4-2-f562f77

Upstream project:
https://github.com/KyleGospo/bpftune

The package includes:

  • the bpftune binary
  • an OpenWrt procd init script
  • persistent configuration via /etc/config/bpftune
  • The service is enabled by default and can be disabled through the supplied init script.

Additional kconfigs required:

  • KERNEL_BPF_EVENTS
  • KERNEL_CGROUPS
  • KERNEL_CGROUP_BPF

Kconfigs required for running bpftune:

  • PACKAGE_kmod-tcp-bbr
  • TCP_CONG_HTCP
  • TCP_CONG_DCTCP

Optional ones:

  • KERNEL_NAMESPACES
  • KERNEL_NET_NS
  • KERNEL_DEBUG_INFO
  • KERNEL_DEBUG_INFO_BTF

🧪 Run Testing Details

  • OpenWrt Version: 25.12.5 and snapshot
  • OpenWrt Target/Subtarget: ramips/mt76x8
  • OpenWrt Device: MiWifi 3C

Tested and confirmed legacy and no-BTF modes working using bpftune -dS but couldn't achieve full support as mentioned here atleast on my device.


Things needing to be fixed:

  • The vmlinux.h that is being used for compilation is the aarch64 one provided in the upstream project itself because I couldn't figure out how to use the generated one during kernel compilation and so even though it seems to be covering the majority of wanted symbols it could have mismatches.
  • Full functionality has not been confirmed partly because of no per-netns policy (via netns cookie)
  • bpftune-full package might not pull necessary kconfig dependency automatically (KERNEL_DEBUG_INFO_BTF ) since it depends on !KERNEL_DEBUG_INFO_REDUCED.
  • Gaming tuner not tested.

Legacy mode working:

root@OpenWrt:~# bpftune -dS
bpftune: set caps (count 1)
bpftune: set caps (count 2)
bpftune: drop caps (count 1)
bpftune: set caps (count 2)
bpftune: libbpf: loading object 'probe_bpf' from buffer
bpftune: libbpf: elf: section(3) fentry/setup_net, size 88, link 0, flags 6, type=1
bpftune: libbpf: sec 'fentry/setup_net': found program 'entry__setup_net' at insn offset 0 (0 bytes), code size 11 insns (88 bytes)
bpftune: libbpf: elf: section(4) iter/tcp, size 128, link 0, flags 6, type=1
bpftune: libbpf: sec 'iter/tcp': found program 'probe_cong_iter' at insn offset 0 (0 bytes), code size 16 insns (128 bytes)
bpftune: libbpf: elf: section(5) tp_btf/neigh_create, size 16, link 0, flags 6, type=1
bpftune: libbpf: sec 'tp_btf/neigh_create': found program 'bpftune_neigh_create' at insn offset 0 (0 bytes), code size 2 insns (16 bytes)
bpftune: libbpf: elf: section(6) cgroup/sysctl, size 16, link 0, flags 6, type=1
bpftune: libbpf: sec 'cgroup/sysctl': found program 'sysctl_write' at insn offset 0 (0 bytes), code size 2 insns (16 bytes)
bpftune: libbpf: elf: section(7) .data, size 4, link 0, flags 3, type=1
bpftune: libbpf: elf: section(8) license, size 7, link 0, flags 3, type=1
bpftune: libbpf: license of probe_bpf is GPL v2
bpftune: libbpf: elf: section(9) .rodata, size 24, link 0, flags 2, type=1
bpftune: libbpf: elf: section(10) .bss, size 25, link 0, flags 3, type=8
bpftune: libbpf: elf: section(11) .maps, size 168, link 0, flags 3, type=1
bpftune: libbpf: elf: section(12) .BTF, size 63905, link 0, flags 0, type=1
bpftune: libbpf: elf: section(14) .BTF.ext, size 428, link 0, flags 0, type=1
bpftune: libbpf: elf: section(17) .symtab, size 552, link 1, flags 0, type=2
bpftune: libbpf: looking for externs among 23 symbols...
bpftune: libbpf: collected 0 externs total
bpftune: libbpf: map 'ring_buffer_map': at sec_idx 11, offset 0.
bpftune: libbpf: map 'ring_buffer_map': found type = 27.
bpftune: libbpf: map 'ring_buffer_map': found max_entries = 131072.
bpftune: libbpf: map 'netns_map': at sec_idx 11, offset 16.
bpftune: libbpf: map 'netns_map': found type = 1.
bpftune: libbpf: map 'netns_map': found key [12], sz = 8.
bpftune: libbpf: map 'netns_map': found value [12], sz = 8.
bpftune: libbpf: map 'netns_map': found max_entries = 65536.
bpftune: libbpf: map 'netns_map': found map_flags = 0x0.
bpftune: libbpf: map 'corr_map': at sec_idx 11, offset 56.
bpftune: libbpf: map 'corr_map': found type = 1.
bpftune: libbpf: map 'corr_map': found key [21], sz = 16.
bpftune: libbpf: map 'corr_map': found value [24], sz = 48.
bpftune: libbpf: map 'corr_map': found max_entries = 1024.
bpftune: libbpf: map 'corr_map': found map_flags = 0x0.
bpftune: libbpf: map 'last_event_map': at sec_idx 11, offset 96.
bpftune: libbpf: map 'last_event_map': found type = 1.
bpftune: libbpf: map 'last_event_map': found key [12], sz = 8.
bpftune: libbpf: map 'last_event_map': found value [12], sz = 8.
bpftune: libbpf: map 'last_event_map': found max_entries = 65536.
bpftune: libbpf: map 'probe_hash_map': at sec_idx 11, offset 128.
bpftune: libbpf: map 'probe_hash_map': found type = 1.
bpftune: libbpf: map 'probe_hash_map': found key [12], sz = 8.
bpftune: libbpf: map 'probe_hash_map': found value [12], sz = 8.
bpftune: libbpf: map 'probe_hash_map': found max_entries = 65536.
bpftune: libbpf: map 'probe_hash_map': found map_flags = 0x0.
bpftune: libbpf: map 'probe_bp.data' (global data): at sec_idx 7, offset 0, flags 400.
bpftune: libbpf: map 5 is "probe_bp.data"
bpftune: libbpf: map 'probe_bp.rodata' (global data): at sec_idx 9, offset 0, flags 480.
bpftune: libbpf: map 6 is "probe_bp.rodata"
bpftune: libbpf: map 'probe_bp.bss' (global data): at sec_idx 10, offset 0, flags 400.
bpftune: libbpf: map 7 is "probe_bp.bss"
bpftune: libbpf: object 'probe_bpf': failed (-1) to create BPF token from '/sys/fs/bpf', skipping optional step...
bpftune: libbpf: loaded kernel BTF from '/sys/kernel/btf/vmlinux'
bpftune: libbpf: sec 'fentry/setup_net': found 2 CO-RE relocations
bpftune: libbpf: CO-RE relocating [36] struct net: found target candidate [1463] struct net in [vmlinux]
bpftune: libbpf: prog 'entry__setup_net': relo #0: <field_exists> [36] struct net.net_cookie (0:48 @ offset 4352)
bpftune: libbpf: prog 'entry__setup_net': relo #0: matching candidate #0 <field_exists> [1463] struct net.net_cookie (0:43 @ offset 1640)
bpftune: libbpf: prog 'entry__setup_net': relo #0: patched insn #0 (ALU/ALU64) imm 1 -> 1
bpftune: libbpf: prog 'entry__setup_net': relo #1: <byte_off> [36] struct net.net_cookie (0:48 @ offset 4352)
bpftune: libbpf: prog 'entry__setup_net': relo #1: matching candidate #0 <byte_off> [1463] struct net.net_cookie (0:43 @ offset 1640)
bpftune: libbpf: prog 'entry__setup_net': relo #1: patched insn #2 (ALU/ALU64) imm 4352 -> 1640
bpftune: libbpf: sec 'iter/tcp': found 1 CO-RE relocations
bpftune: libbpf: CO-RE relocating [800] struct bpf_iter__tcp: found target candidate [19872] struct bpf_iter__tcp in [vmlinux]
bpftune: libbpf: prog 'probe_cong_iter': relo #0: <byte_off> [800] struct bpf_iter__tcp.sk_common (0:1:0 @ offset 8)
bpftune: libbpf: prog 'probe_cong_iter': relo #0: matching candidate #0 <byte_off> [19872] struct bpf_iter__tcp.sk_common (0:1:0 @ offset 8)
bpftune: libbpf: prog 'probe_cong_iter': relo #0: patched insn #0 (LDX/ST/STX) off 8 -> 8
bpftune: libbpf: prog 'probe_cong_iter': relo #0: patched insn #0 (LDX/ST/STX) mem_sz 8 -> 4
bpftune: libbpf: map 'ring_buffer_map': created successfully, fd=4
bpftune: libbpf: map 'netns_map': created successfully, fd=5
bpftune: libbpf: map 'corr_map': created successfully, fd=6
bpftune: libbpf: map 'last_event_map': created successfully, fd=7
bpftune: libbpf: map 'probe_hash_map': created successfully, fd=8
bpftune: libbpf: map 'probe_bp.data': created successfully, fd=9
bpftune: libbpf: map 'probe_bp.rodata': created successfully, fd=10
bpftune: libbpf: map 'probe_bp.bss': created successfully, fd=11
bpftune: libbpf: prog 'probe_cong_iter': BPF program load failed: -EACCES
bpftune: libbpf: prog 'probe_cong_iter': -- BEGIN PROG LOAD LOG --
0: R1=ctx() R10=fp0
; struct sock_common *skc = ctx->sk_common; @ probe.bpf.c:38
0: (61) r1 = *(u32 *)(r1 +8)
func 'bpf_iter_tcp' size 4 must be 8
invalid bpf_context access off=8 size=4
processed 1 insns (limit 1000000) max_states_per_insn 0 total_states 0 peak_states 0 mark_read 0
-- END PROG LOAD LOG --
bpftune: libbpf: prog 'probe_cong_iter': failed to load: -EACCES
bpftune: libbpf: failed to load object 'probe_bpf'
bpftune: libbpf: failed to load BPF skeleton 'probe_bpf': -EACCES
bpftune: full bpftune support not available: No error information
bpftune: libbpf: loading object 'probe_bpf_legacy' from buffer
bpftune: libbpf: elf: section(3) kprobe/setup_net, size 88, link 0, flags 6, type=1
bpftune: libbpf: sec 'kprobe/setup_net': found program 'entry__setup_net' at insn offset 0 (0 bytes), code size 11 insns (88 bytes)
bpftune: libbpf: elf: section(4) raw_tracepoint/neigh_create, size 16, link 0, flags 6, type=1
bpftune: libbpf: sec 'raw_tracepoint/neigh_create': found program 'bpftune_neigh_create' at insn offset 0 (0 bytes), code size 2 insns (16 bytes)
bpftune: libbpf: elf: section(5) cgroup/sysctl, size 16, link 0, flags 6, type=1
bpftune: libbpf: sec 'cgroup/sysctl': found program 'sysctl_write' at insn offset 0 (0 bytes), code size 2 insns (16 bytes)
bpftune: libbpf: elf: section(6) .data, size 4, link 0, flags 3, type=1
bpftune: libbpf: elf: section(7) license, size 7, link 0, flags 3, type=1
bpftune: libbpf: license of probe_bpf_legacy is GPL v2
bpftune: libbpf: elf: section(8) .rodata, size 24, link 0, flags 2, type=1
bpftune: libbpf: elf: section(9) .bss, size 25, link 0, flags 3, type=8
bpftune: libbpf: elf: section(10) .maps, size 168, link 0, flags 3, type=1
bpftune: libbpf: elf: section(11) .BTF, size 64024, link 0, flags 0, type=1
bpftune: libbpf: elf: section(13) .BTF.ext, size 284, link 0, flags 0, type=1
bpftune: libbpf: elf: section(16) .symtab, size 504, link 1, flags 0, type=2
bpftune: libbpf: looking for externs among 21 symbols...
bpftune: libbpf: collected 0 externs total
bpftune: libbpf: map 'ring_buffer_map': at sec_idx 10, offset 0.
bpftune: libbpf: map 'ring_buffer_map': found type = 27.
bpftune: libbpf: map 'ring_buffer_map': found max_entries = 131072.
bpftune: libbpf: map 'netns_map': at sec_idx 10, offset 16.
bpftune: libbpf: map 'netns_map': found type = 1.
bpftune: libbpf: map 'netns_map': found key [12], sz = 8.
bpftune: libbpf: map 'netns_map': found value [12], sz = 8.
bpftune: libbpf: map 'netns_map': found max_entries = 65536.
bpftune: libbpf: map 'netns_map': found map_flags = 0x0.
bpftune: libbpf: map 'corr_map': at sec_idx 10, offset 56.
bpftune: libbpf: map 'corr_map': found type = 1.
bpftune: libbpf: map 'corr_map': found key [21], sz = 16.
bpftune: libbpf: map 'corr_map': found value [24], sz = 48.
bpftune: libbpf: map 'corr_map': found max_entries = 1024.
bpftune: libbpf: map 'corr_map': found map_flags = 0x0.
bpftune: libbpf: map 'last_event_map': at sec_idx 10, offset 96.
bpftune: libbpf: map 'last_event_map': found type = 1.
bpftune: libbpf: map 'last_event_map': found key [12], sz = 8.
bpftune: libbpf: map 'last_event_map': found value [12], sz = 8.
bpftune: libbpf: map 'last_event_map': found max_entries = 65536.
bpftune: libbpf: map 'probe_hash_map': at sec_idx 10, offset 128.
bpftune: libbpf: map 'probe_hash_map': found type = 1.
bpftune: libbpf: map 'probe_hash_map': found key [12], sz = 8.
bpftune: libbpf: map 'probe_hash_map': found value [12], sz = 8.
bpftune: libbpf: map 'probe_hash_map': found max_entries = 65536.
bpftune: libbpf: map 'probe_hash_map': found map_flags = 0x0.
bpftune: libbpf: map 'probe_bp.data' (global data): at sec_idx 6, offset 0, flags 400.
bpftune: libbpf: map 5 is "probe_bp.data"
bpftune: libbpf: map 'probe_bp.rodata' (global data): at sec_idx 8, offset 0, flags 480.
bpftune: libbpf: map 6 is "probe_bp.rodata"
bpftune: libbpf: map 'probe_bp.bss' (global data): at sec_idx 9, offset 0, flags 400.
bpftune: libbpf: map 7 is "probe_bp.bss"
bpftune: libbpf: object 'probe_bpf_legac': failed (-1) to create BPF token from '/sys/fs/bpf', skipping optional step...
bpftune: libbpf: loaded kernel BTF from '/sys/kernel/btf/vmlinux'
bpftune: libbpf: sec 'kprobe/setup_net': found 3 CO-RE relocations
bpftune: libbpf: CO-RE relocating [50] struct net: found target candidate [1463] struct net in [vmlinux]
bpftune: libbpf: prog 'entry__setup_net': relo #0: <field_exists> [50] struct net.net_cookie (0:48 @ offset 4352)
bpftune: libbpf: prog 'entry__setup_net': relo #0: matching candidate #0 <field_exists> [1463] struct net.net_cookie (0:43 @ offset 1640)
bpftune: libbpf: prog 'entry__setup_net': relo #0: patched insn #0 (ALU/ALU64) imm 1 -> 1
bpftune: libbpf: prog 'entry__setup_net': relo #1: <byte_off> [50] struct net.net_cookie (0:48 @ offset 4352)
bpftune: libbpf: prog 'entry__setup_net': relo #1: matching candidate #0 <byte_off> [1463] struct net.net_cookie (0:43 @ offset 1640)
bpftune: libbpf: prog 'entry__setup_net': relo #1: patched insn #2 (ALU/ALU64) imm 4352 -> 1640
bpftune: libbpf: CO-RE relocating [34] struct pt_regs: found target candidate [203] struct pt_regs in [vmlinux]
bpftune: libbpf: prog 'entry__setup_net': relo #2: <byte_off> [34] struct pt_regs.regs[4] (0:0:1:0:4 @ offset 32)
bpftune: libbpf: prog 'entry__setup_net': relo #2: matching candidate #0 <byte_off> [203] struct pt_regs.regs[4] (0:1:4 @ offset 48)
bpftune: libbpf: prog 'entry__setup_net': relo #2: patched insn #3 (LDX/ST/STX) off 32 -> 48
bpftune: libbpf: prog 'entry__setup_net': relo #2: patched insn #3 (LDX/ST/STX) mem_sz 8 -> 4
bpftune: libbpf: map 'ring_buffer_map': created successfully, fd=4
bpftune: libbpf: map 'netns_map': created successfully, fd=5
bpftune: libbpf: map 'corr_map': created successfully, fd=6
bpftune: libbpf: map 'last_event_map': created successfully, fd=7
bpftune: libbpf: map 'probe_hash_map': created successfully, fd=8
bpftune: libbpf: map 'probe_bp.data': created successfully, fd=9
bpftune: libbpf: map 'probe_bp.rodata': created successfully, fd=10
bpftune: libbpf: map 'probe_bp.bss': created successfully, fd=11
bpftune: netns cookie not supported, cannot monitor per-netns events
bpftune: netns cookie not supported
bpftune: drop caps (count 1)
bpftune: bpftune works in legacy mode
bpftune: netns cookie not supported, cannot monitor per-netns events
bpftune: bpftune does not support per-netns policy (via netns cookie)
bpftune: set caps (count 2)
bpftune: drop caps (count 1)
root@OpenWrt:~#

@openwrt-ai openwrt-ai left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed 1 new commit.


Generated by Claude Code

Comment thread net/bpftune/Makefile Outdated
define Package/bpftune
$(call Package/bpftune/default)
TITLE:=BPF driven auto-tuning (no-BTF by default)
DEPENDS:=+@KERNEL_BPF_EVENTS +@KERNEL_CGROUPS +@KERNEL_CGROUP_BPF +@KERNEL_NAMESPACES +@KERNEL_NET_NS +libnl-route +libcap +libbpf

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Including bpf.mk without adding $(BPF_DEPENDS) (@HAS_BPF_TOOLCHAIN +@NEED_BPF_TOOLCHAIN) lets the package be selected on configs with no LLVM/BPF toolchain. The two other bpf.mk consumers in this feed both carry it — net/tcp-in-udp/Makefile:27 and net/uspot/Makefile:31.

Suggested change
DEPENDS:=+@KERNEL_BPF_EVENTS +@KERNEL_CGROUPS +@KERNEL_CGROUP_BPF +@KERNEL_NAMESPACES +@KERNEL_NET_NS +libnl-route +libcap +libbpf
DEPENDS:=+@KERNEL_BPF_EVENTS +@KERNEL_CGROUPS +@KERNEL_CGROUP_BPF +@KERNEL_NAMESPACES +@KERNEL_NET_NS +libnl-route +libcap +libbpf $(BPF_DEPENDS)

Generated by Claude Code

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed, thanks


Generated by Claude Code

Comment thread net/bpftune/Makefile Outdated
Comment on lines +58 to +60
CFLAGS += -DBPFTUNE_VERSION='"$(PKG_VERSION)-$(PKG_RELEASE)"'

MAKE_FLAGS += BPF_KARCH="$(BPF_KARCH)"

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Two values the patched src/Makefile needs never reach the sub-make:

  • CFLAGS is in neither MAKE_VARS nor MAKE_FLAGS as a package-level variable, and src/Makefile hard-assigns CFLAGS = -fPIC -Wall -Wextra -g -std=c99, which also overrides the environment CFLAGS carrying TARGET_CFLAGS. So this -DBPFTUNE_VERSION is dead and the binary reports an empty version, which will also trip CI's generic version check unless a test-version.sh is added.
  • CLANG ?= clang and LLVM_STRIP ?= llvm-strip in src/Makefile are never overridden, so the BPF objects are built with whatever clang is on PATH rather than the toolchain bpf.mk resolves.
Suggested change
CFLAGS += -DBPFTUNE_VERSION='"$(PKG_VERSION)-$(PKG_RELEASE)"'
MAKE_FLAGS += BPF_KARCH="$(BPF_KARCH)"
MAKE_FLAGS += \
BPFTUNE_VERSION="$(PKG_VERSION)-$(PKG_RELEASE)" \
BPF_KARCH="$(BPF_KARCH)" \
CLANG="$(CLANG)" \
LLVM_STRIP="$(LLVM_STRIP)"

Generated by Claude Code

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed, thanks


Generated by Claude Code

Comment thread net/bpftune/Makefile Outdated
$(INSTALL_BIN) $(PKG_BUILD_DIR)/src/bpftune $(1)/usr/sbin/bpftune
$(INSTALL_DIR) $(1)/usr/lib
$(INSTALL_BIN) $(PKG_BUILD_DIR)/src/libbpftune.so.0.4.2 $(1)/usr/lib/libbpftune.so.0.4.2
$(LN) $(1)/usr/lib/libbpftune.so.0.4.2 $(1)/usr/lib/libbpftune.so

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This records the absolute build-host path ($(1) = the ipkg staging dir) as the symlink target, so /usr/lib/libbpftune.so dangles on the device. Use a relative target, as e.g. libs/libjwt/Makefile:43 does.

Suggested change
$(LN) $(1)/usr/lib/libbpftune.so.0.4.2 $(1)/usr/lib/libbpftune.so
$(LN) libbpftune.so.0.4.2 $(1)/usr/lib/libbpftune.so

Generated by Claude Code

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed, thanks


Generated by Claude Code

Comment thread net/bpftune/Makefile Outdated
Comment on lines +97 to +99
define Package/bpftune-full/install
$(call Package/bpftune/install)
endef

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

bpftune-full depends on bpftune and installs the byte-identical file list, so both packages own /usr/sbin/bpftune, /usr/lib/libbpftune.so*, the tuner plugins and the init script and cannot be co-installed. Since the split is purely about kernel config symbols, drop this block entirely — package-pack.mk guards on ifdef Package/$(1)/install, so an undefined install yields the intended empty meta-package — and drop the duplicated Package/bpftune-full/conffiles block on lines 67-70 with it.


Generated by Claude Code

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed, thanks


Generated by Claude Code

Comment thread net/bpftune/files/bpftune.confd Outdated
@@ -0,0 +1,2 @@
# Optional: Override arguments passed to bpftune.
#command_args="-R -c /sys/fs/cgroup -d"

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nothing on OpenWrt sources /etc/conf.d/*/etc/rc.common does not, and no other package in this feed installs there — so command_args set here is never read and the init script always uses its built-in default. The PR description says the package ships "a UCI configuration file"; making that true (a /etc/config/bpftune read with config_load/config_get in start_service) would both match the description and actually take effect.


Generated by Claude Code

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

solved by turning the file into a real UCI config read with config_get, thanks


Generated by Claude Code

Comment thread net/bpftune/files/bpftune.initd Outdated
Comment on lines +21 to +27
start_pre() {
checkconf > /dev/null 2>&1
}

start_service()
{
start_pre

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does bpftune -S exit on its own? The transcript in the PR description shows bpftune -dS staying in the foreground after "bpftune works in legacy mode", and if that is what -S does then start_pre blocks /etc/init.d/bpftune start forever — including the "$i" start that default_postinst runs at install time. Separately, start_pre is not an rc.common hook and its exit status is discarded here, so a failed check does not prevent the daemon from starting.


Generated by Claude Code

@fluffball3 fluffball3 Sep 5, 2026

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

bpftune -S is just a compatibility check that's all. It does exit after that I didn't include the part where it shows terminal again. I think even if it does fail then bpftune just doesn't start. I added the check just incase anyway.


USE_PROCD=1

START=81

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: the PR description says the service is disabled by default, but default_postinst runs enable and start for every script in /etc/init.d/, so bpftune runs from install. If opt-in is intended it has to be arranged explicitly; otherwise the description should be corrected.


Generated by Claude Code

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

solved by correcting the PR description, thanks


Generated by Claude Code

Comment thread net/bpftune/patches/fix-makefile.patch Outdated
$(BPF_OBJS): $(patsubst %.o,%.c,$(BPF_OBJS)) ../include/bpftune/bpftune.bpf.h
- $(CLANG) $(BPF_CFLAGS) -D__TARGET_ARCH_$(SRCARCH) -O2 -target bpf \
- $(INCLUDES) -c $(patsubst %.o,%.c,$(@)) -o $(@)
+ $(CLANG) $(BPF_CFLAGS) -D__TARGET_ARCH_$(BPF_KARCH) -O2 -target bpf$(if $(CONFIG_BIG_ENDIAN),eb,el) \

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Neither variable resolves the way this assumes: BPF_KARCH is hardcoded to mips for every target, and CONFIG_BIG_ENDIAN is a .config variable that is not exported into the sub-make, so this expands to -D__TARGET_ARCH_mips ... -target bpfel on every target. That means big-endian targets (ath79, mpc85xx, …) get little-endian BPF objects, and vmlinux-fallback.patch's #if defined(__TARGET_ARCH_x86) can never match, so even x86 builds pull in vmlinux_aarch64.h. Pass BPF_TARGET/BPF_ARCH from bpf.mk through MAKE_FLAGS and use those here instead. Same on lines 88 and 96.


Generated by Claude Code

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed, thanks


Generated by Claude Code

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Patches in this feed carry a numeric prefix that pins apply order (010-, 100-, 500-, …); all four files here are unprefixed. Also give fix-libbpftune.patch a descriptive subject and a Signed-off-by: — the sigval_tunion sigval and struct sockaddr cast changes are musl/portability fixes with a real upstream to send them to, unlike the OpenWrt-only build hacks in the other three.


Generated by Claude Code

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK I'll look into it. Thanks for the advice.

Comment thread net/bpftune/Makefile Outdated
include $(TOPDIR)/rules.mk

PKG_NAME:=bpftune
PKG_VERSION:=0.4

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: PKG_VERSION is 0.4 while everything actually shipped is 0.4-2 / soname 0.4.2 — the tarball, the PKG_BUILD_DIR override and the installed library all disagree with it. PKG_VERSION:=0.4.2 (keeping 0.4-2 in PKG_SOURCE/PKG_SOURCE_URL and PKG_BUILD_DIR) makes the package version match what is installed.


Generated by Claude Code

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed, thanks


Generated by Claude Code

@openwrt-ai openwrt-ai left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed 1 new commit.


Generated by Claude Code

Comment thread net/bpftune/Makefile Outdated
$(call Package/bpftune/default)
TITLE:=BPF driven auto-tuning (no-BTF by default)
DEPENDS:=+@KERNEL_BPF_EVENTS +@KERNEL_CGROUPS +@KERNEL_CGROUP_BPF \
+@KERNEL_NAMESPACES +@KERNEL_NET_NS +@TCP_CONG_HTCP +@TCP_CONG_DCTCP \

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TCP_CONG_HTCP and TCP_CONG_DCTCP are not OpenWrt Kconfig symbols — they exist only as # CONFIG_… is not set lines in target/linux/generic/config-6.12:6650-6652, with nothing in config/Config-kernel.in exposing them. +@FOO is emitted as select FOO in the generated Config.in, so kconfig warns about an undefined symbol and neither congestion algorithm is actually enabled. Either drop them (documenting them as manual prerequisites, like the other kernel options in the PR description) or land KERNEL_TCP_CONG_* symbols in openwrt first.


Generated by Claude Code

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

solved by dropping them and documenting them as manual prerequisites, thanks


Generated by Claude Code

Comment thread net/bpftune/Makefile Outdated
Comment on lines +61 to +73
go_arch=$(subst \
aarch64,arm64,$(subst \
i386,x86,$(subst \
loongarch64,loongarch,$(subst \
mipsel,mips,$(subst \
mips64,mips,$(subst \
mips64el,mips,$(1)))))))

GO_ARCH:=$(call go_arch,$(ARCH))

MAKE_FLAGS += \
BPFTUNE_VERSION="$(PKG_VERSION)-$(PKG_RELEASE)" \
SRCARCH="$(GO_ARCH)" \

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nothing maps x86_64, so on x86/64 SRCARCH stays x86_64 and -D__TARGET_ARCH_x86_64 never satisfies #if defined(__TARGET_ARCH_x86) in vmlinux-fallback.patch — x86 builds silently take the vmlinux_aarch64.h branch. armeb (ixp4xx) and powerpc64 (qoriq) are unmapped too. go_arch/GO_ARCH is a Go-toolchain name lifted from Go packaging, while this value is a kernel __TARGET_ARCH_* suffix.

Suggested change
go_arch=$(subst \
aarch64,arm64,$(subst \
i386,x86,$(subst \
loongarch64,loongarch,$(subst \
mipsel,mips,$(subst \
mips64,mips,$(subst \
mips64el,mips,$(1)))))))
GO_ARCH:=$(call go_arch,$(ARCH))
MAKE_FLAGS += \
BPFTUNE_VERSION="$(PKG_VERSION)-$(PKG_RELEASE)" \
SRCARCH="$(GO_ARCH)" \
bpf_srcarch=$(subst \
aarch64,arm64,$(subst \
armeb,arm,$(subst \
i386,x86,$(subst \
x86_64,x86,$(subst \
loongarch64,loongarch,$(subst \
mipsel,mips,$(subst \
mips64,mips,$(subst \
powerpc64,powerpc,$(1))))))))
BPF_SRCARCH:=$(call bpf_srcarch,$(ARCH))
MAKE_FLAGS += \
BPFTUNE_VERSION="$(PKG_VERSION)-$(PKG_RELEASE)" \
SRCARCH="$(BPF_SRCARCH)" \

Generated by Claude Code

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed, thanks


Generated by Claude Code

Comment thread net/bpftune/files/bpftune.initd Outdated

procd_open_instance
procd_set_param file $CONFIGFILE
config_load 'bpftune'

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

config_load populates the UCI context but nothing reads it back — there is no config_get, so command_args still always comes from the default on line 13. And files/bpftune.confd, now installed as /etc/config/bpftune, is shell syntax (command_args="…"), not UCI config/option stanzas, so it could not supply a value even with a config_get here. Either convert the file to a UCI section and read it (config_get command_args <section> args '-R -c /sys/fs/cgroup'), or drop config_load and CONFIGFILE.


Generated by Claude Code

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed, thanks


Generated by Claude Code

Comment thread net/bpftune/patches/fix-Makefile.patch Outdated
VERSION_SCRIPT := libbpftune.map

-CFLAGS = -fPIC -Wall -Wextra -g -I../include -std=c99
+CFLAGS = -fPIC -Wall -Wextra -g -std=c99

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A plain CFLAGS = in the makefile beats the environment, so the TARGET_CFLAGS/TARGET_CPPFLAGS that MAKE_VARS exports never reach the compiler — bpftune and the tuner .sos are built without the target's optimisation, -fhonour-copts and hardening flags. Use += so the upstream flags append instead.

Suggested change
+CFLAGS = -fPIC -Wall -Wextra -g -std=c99
+CFLAGS += -fPIC -Wall -Wextra -g -std=c99

Generated by Claude Code

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed, thanks


Generated by Claude Code

Comment thread net/bpftune/patches/fix-Makefile.patch Outdated
Comment on lines +64 to +65
+ifeq ($(VMLINUX_H),)
+VMLINUX_H_FILE := $(wildcard $(PKG_BUILD_DIR)/vmlinux.h)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PKG_BUILD_DIR is a package-Makefile variable that is neither exported (rules.mk exports only STAGING_DIR*) nor passed via MAKE_FLAGS, so it is empty inside this sub-make: the wildcard can never match, and -I$(PKG_BUILD_DIR) on line 71 would expand to a bare -I if it ever did. The condition is also inverted — ifeq ($(VMLINUX_H),) skips the lookup exactly when a VMLINUX_H has been supplied. Passing PKG_BUILD_DIR="$(PKG_BUILD_DIR)" in MAKE_FLAGS and testing ifneq ($(VMLINUX_H),) would make this block reachable.


Generated by Claude Code

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed, thanks


Generated by Claude Code

@fluffball3
fluffball3 force-pushed the bpftune branch 3 times, most recently from 00cc97d to 6418aec Compare September 5, 2026 21:47

@openwrt-ai openwrt-ai left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed 1 new commit.


Generated by Claude Code

Comment thread net/bpftune/patches/fix-Makefile.patch Outdated
Comment on lines +64 to +67
+# Try to reach generated vmlinux.h if it exists
+ifneq ($(VMLINUX_H),)
+VMLINUX_H_FILE := $(wildcard $(PKG_BUILD_DIR)/vmlinux.h)
+endif

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

VMLINUX_H is never set anywhere — not in MAKE_FLAGS, not exported by the build system, not assigned in src/Makefile — so the guard is always false, VMLINUX_H_FILE stays empty and -DVMLINUX_H is never added; passing PKG_BUILD_DIR through MAKE_FLAGS does not help while the block is unreachable. Nothing in the package generates $(PKG_BUILD_DIR)/vmlinux.h either, so the wildcard would not match today even without the guard. Drop the ifneq/endif (or set VMLINUX_H in MAKE_FLAGS) and regenerate the patch with make package/bpftune/refresh so the hunk header matches.


Generated by Claude Code

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed, thanks


Generated by Claude Code

Comment thread net/bpftune/Makefile
$(INSTALL_DIR) $(1)/etc
$(INSTALL_DIR) $(1)/etc/config
$(INSTALL_DIR) $(1)/etc/init.d
$(INSTALL_DATA) ./files/bpftune.confd $(1)/etc/config/bpftune

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With config_load now gone from the init script, nothing reads this file, so the command_args override it advertises has no effect — and it is shell syntax sitting in the UCI directory, which is not what /etc/config/ is for. Either make it a real UCI section and read it with config_get in start_service, or drop the file together with its conffiles entry and the /etc/config INSTALL_DIR on line 105.


Generated by Claude Code

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

solved by converting it to a UCI section read with config_get, thanks


Generated by Claude Code

Comment thread net/bpftune/Makefile Outdated
bpftune aims to provide lightweight, always-on auto-tuning of system
behaviour. By using BPF observability features, we can continuously
monitor and adjust system behaviour at a fine grain. (Needs TCP_CONG_HTCP
and TCP_CONG_DCTCP from target/linux/generated/config.* manually enabled

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: there is no target/linux/generated/ in openwrt — these live in target/linux/generic/config-6.12:6650-6652. Same wording on line 59.

Suggested change
and TCP_CONG_DCTCP from target/linux/generated/config.* manually enabled
and TCP_CONG_DCTCP from target/linux/generic/config-<version> manually enabled

Generated by Claude Code

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed, thanks


Generated by Claude Code

Comment thread net/bpftune/Makefile Outdated
Comment on lines +64 to +72
bpf_srcarch=$(subst \
aarch64,arm64,$(subst \
armeb,arm,$(subst \
i386,x86,$(subst \
x86_64,x86,$(subst \
loongarch64,loongarch,$(subst \
mipsel,mips,$(subst \
mips64,mips,$(subst \
powerpc64,powerpc,$(1)))))))))

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: riscv64 is the one remaining OpenWrt ARCH value left unmapped here, so riscv targets get -D__TARGET_ARCH_riscv64 while libbpf's bpf_tracing.h matches on __TARGET_ARCH_riscv. Intentional, or worth adding next to armeb/powerpc64?

Suggested change
bpf_srcarch=$(subst \
aarch64,arm64,$(subst \
armeb,arm,$(subst \
i386,x86,$(subst \
x86_64,x86,$(subst \
loongarch64,loongarch,$(subst \
mipsel,mips,$(subst \
mips64,mips,$(subst \
powerpc64,powerpc,$(1)))))))))
bpf_srcarch=$(subst \
aarch64,arm64,$(subst \
armeb,arm,$(subst \
i386,x86,$(subst \
x86_64,x86,$(subst \
loongarch64,loongarch,$(subst \
mipsel,mips,$(subst \
mips64,mips,$(subst \
powerpc64,powerpc,$(subst \
riscv64,riscv,$(1))))))))))

Generated by Claude Code

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed, thanks


Generated by Claude Code

@openwrt-ai openwrt-ai left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed 1 new commit.


Generated by Claude Code

Comment thread net/bpftune/files/bpftune.confd Outdated
@@ -0,0 +1,2 @@
config defaults

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is an anonymous section, so config_load names it cfg1 (functions.sh:112) and the config_get ARGS defaults command_args in the init script matches nothing. The net effect is worse than the option being ignored: config_get assigns unconditionally, so ARGS ends up empty and bpftune is started with no arguments at all. Name the section.

Suggested change
config defaults
config defaults 'defaults'

Generated by Claude Code

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed, thanks


Generated by Claude Code

Comment thread net/bpftune/files/bpftune.initd Outdated

checkconf() {
config_load 'bpftune'
config_get ARGS defaults command_args

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Without a fourth argument config_get expands to ${CONFIG_defaults_command_args:-}, so a commented-out or removed command_args clears ARGS instead of leaving the default from line 13 in place. Pass the fallback explicitly.

Suggested change
config_get ARGS defaults command_args
config_get ARGS defaults command_args "$ARGS"

Generated by Claude Code

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed, thanks


Generated by Claude Code

Comment thread net/bpftune/Makefile
define Package/bpftune-full
$(call Package/bpftune/default)
TITLE:=bpftune with BTF support (might cause crashloops on limited hardware).
DEPENDS:=+bpftune +@KERNEL_DEBUG_INFO +@KERNEL_DEBUG_INFO_BTF \

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+@KERNEL_DEBUG_INFO_BTF becomes a select, but that symbol depends on !KERNEL_DEBUG_INFO_REDUCED and KERNEL_DEBUG_INFO_REDUCED is default y as soon as KERNEL_DEBUG_INFO is on — which this same line selects. So kconfig reports an unmet direct dependency and bpftune-full ships without the BTF it exists to provide; a DEPENDS cannot deselect a symbol, so KERNEL_DEBUG_INFO_REDUCED=n needs listing as a manual prerequisite in the description next to TCP_CONG_HTCP/TCP_CONG_DCTCP.


Generated by Claude Code

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

solved by documenting KERNEL_DEBUG_INFO_REDUCED=n as a manual prerequisite in the package description, thanks


Generated by Claude Code

@fluffball3
fluffball3 force-pushed the bpftune branch 2 times, most recently from 0323719 to 25c4ae7 Compare September 7, 2026 05:57

@openwrt-ai openwrt-ai left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed 1 new commit; no new issues found.


Generated by Claude Code

@openwrt-ai openwrt-ai left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed 1 new commit; no new issues found.


Generated by Claude Code

@openwrt

openwrt Bot commented Sep 21, 2026

Copy link
Copy Markdown

Formality Check: Suggestions Available

We checked this pull request against the contribution guidelines. Here is what needs your attention:

⚠️ STYLISTIC WARNINGS & SUGGESTIONS

Commit 4356c5d - bpftune: add new package:
PKG_LICENSE value 'GPL-2.0-WITH-Linux-syscall-note' is not a known SPDX identifier. Pick the matching identifier from https://spdx.org/licenses/, or write it as LicenseRef-<name> if this license is not on the SPDX list.


Something broken? Consider reporting an issue.
Running version 26ec621 deployed on 2026-09-20 09:46:35 CEST

@fluffball3

fluffball3 commented Sep 21, 2026

Copy link
Copy Markdown
Author

Added bpftune-gaming packages based on this fork: https://github.com/KyleGospo/bpftune

@openwrt-ai openwrt-ai left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed 1 new commit.


Generated by Claude Code

Comment thread net/bpftune/Makefile Outdated
PKG_SOURCE_DATE:=2026-08-26
PKG_SOURCE_VERSION:=f562f776aac16478a2eeae1bf4871a66dd0070c3
PKG_MIRROR_HASH:=fb49aaad19ee711226b8bf62ded281e7346750c4e4d08909b2a37ac58765438c
PKG_BUILD_DIR:=$(BUILD_DIR)/bpftune-$(PKG_VERSION)$(if $(BUILD_VARIANT),-$(BUILD_VARIANT))

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The unpack extracts the tarball's own top-level directory — $(PKG_NAME)-$(PKG_VERSION), i.e. bpftune-0.4.2-f562f77 (download.mk:15-16) — into $(PKG_BUILD_DIR)/.. (unpack.mk:6). With -gaming appended to the leaf name the sources land in $(BUILD_DIR)/bpftune-0.4.2-f562f77 and the gaming build dir stays empty, so both gaming variants fail to build. Put the variant in a parent directory, as package.mk:11 and e.g. net/openssh/Makefile:19 do.

Suggested change
PKG_BUILD_DIR:=$(BUILD_DIR)/bpftune-$(PKG_VERSION)$(if $(BUILD_VARIANT),-$(BUILD_VARIANT))
PKG_BUILD_DIR:=$(BUILD_DIR)/$(if $(BUILD_VARIANT),bpftune-$(BUILD_VARIANT)/)bpftune-$(PKG_VERSION)

Generated by Claude Code

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed, thanks


Generated by Claude Code

Comment thread net/bpftune/Makefile Outdated
Comment on lines +150 to +152
define Package/bpftune-full/install
$(call Package/bpftune/install)
endef

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

bpftune-full sets no VARIANT, so it builds from the same tree as bpftune and now ships a byte-identical file list — both own /usr/sbin/bpftune, /usr/lib/libbpftune.so*, the tuner plugins and the init script, and cannot be co-installed. Since the split is purely about kernel config symbols, drop this block — package-pack.mk:350 guards on ifdef Package/$(1)/install, so an undefined install yields the intended empty meta-package — and put +bpftune back into its DEPENDS on line 46.


Generated by Claude Code

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed, thanks


Generated by Claude Code

Comment thread net/bpftune/Makefile
Comment on lines +50 to +55
define Package/bpftune-gaming
$(call Package/bpftune/default)
URL:=https://github.com/KyleGospo/bpftune
TITLE:=Fork of bpftune with gaming tuner without BTF support (needs TCP_CONG_HTCP and TCP_CONG_DCTCP)
VARIANT:=gaming
endef

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

bpftune-gaming installs the same paths as bpftune (/usr/sbin/bpftune, /usr/lib/libbpftune.so*, the tuner plugins, /etc/init.d/bpftune, /etc/config/bpftune) but nothing declares the clash, so both can be selected and the second install overwrites the first. Add a CONFLICTS here and the matching entries to the other three packages.

Suggested change
define Package/bpftune-gaming
$(call Package/bpftune/default)
URL:=https://github.com/KyleGospo/bpftune
TITLE:=Fork of bpftune with gaming tuner without BTF support (needs TCP_CONG_HTCP and TCP_CONG_DCTCP)
VARIANT:=gaming
endef
define Package/bpftune-gaming
$(call Package/bpftune/default)
URL:=https://github.com/KyleGospo/bpftune
TITLE:=Fork of bpftune with gaming tuner without BTF support (needs TCP_CONG_HTCP and TCP_CONG_DCTCP)
VARIANT:=gaming
CONFLICTS:=bpftune
endef

Generated by Claude Code

Comment thread net/bpftune/Makefile
Comment on lines +118 to +120
define Package/bpftune/conffiles
/etc/config/bpftune
endef

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

conffiles is read per package (package-pack.mk:383), so bpftune-full, bpftune-gaming and bpftune-gaming-full ship /etc/config/bpftune through the shared install block with nothing marking it as a config file — user edits are lost on upgrade for those three.

Suggested change
define Package/bpftune/conffiles
/etc/config/bpftune
endef
define Package/bpftune/conffiles
/etc/config/bpftune
endef
define Package/bpftune-full/conffiles
/etc/config/bpftune
endef
define Package/bpftune-gaming/conffiles
/etc/config/bpftune
endef
define Package/bpftune-gaming-full/conffiles
/etc/config/bpftune
endef

Generated by Claude Code

Comment thread net/bpftune/Makefile
Comment on lines +12 to +13
PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL:=https://github.com/KyleGospo/bpftune.git

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: two things about the move to the fork's git tree:

  • PKG_SOURCE_PROTO:=git is a last resort in this feed when a release tarball exists; the previous revision fetched a codeload tarball, and that form works against a fork commit too.
  • bpftune and bpftune-full are now built from this fork as well, yet still advertise URL:=https://github.com/oracle/bpftune on lines 38 and 44. Is the non-gaming build meant to track oracle instead?

Generated by Claude Code

Comment thread net/bpftune/Makefile
PKG_MIRROR_HASH:=fb49aaad19ee711226b8bf62ded281e7346750c4e4d08909b2a37ac58765438c
PKG_BUILD_DIR:=$(BUILD_DIR)/bpftune-$(PKG_VERSION)$(if $(BUILD_VARIANT),-$(BUILD_VARIANT))

PKG_LICENSE:=GPL-2.0-WITH-Linux-syscall-note

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: this changed from GPL-2.0-or-later while PKG_LICENSE_FILES still points at the same COPYING, and the commit message says nothing about it. The Linux-syscall-note exception normally covers kernel UAPI headers rather than a userspace project — what in the fork's licensing prompted the switch?


Generated by Claude Code

bpftune aims to provide lightweight, always-on auto-tuning of system behaviour.
Adapts the bpftune-gaming fork by KyleGospo for openwrt.
https://github.com/KyleGospo/bpftune

Signed-off-by: Shon Sebastian <fluffball3@proton.me>

@openwrt-ai openwrt-ai left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed 1 new commit.


Generated by Claude Code

Comment thread net/bpftune/Makefile
Comment on lines +64 to +65
DEPENDS:=+bpftune +@KERNEL_DEBUG_INFO +@KERNEL_DEBUG_INFO_BTF \
+@KERNEL_NAMESPACES +@KERNEL_NET_NS

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This pulls in the plain bpftune build, not the gaming one, and bpftune-gaming declares CONFLICTS:=bpftune on line 55 — so the BTF-enabled gaming package either ships the non-gaming binary or cannot be co-installed with the variant it is named after.

Suggested change
DEPENDS:=+bpftune +@KERNEL_DEBUG_INFO +@KERNEL_DEBUG_INFO_BTF \
+@KERNEL_NAMESPACES +@KERNEL_NET_NS
DEPENDS:=+bpftune-gaming +@KERNEL_DEBUG_INFO +@KERNEL_DEBUG_INFO_BTF \
+@KERNEL_NAMESPACES +@KERNEL_NET_NS

Generated by Claude Code

Comment thread net/bpftune/Makefile
Comment on lines +161 to +163
define Package/bpftune-gaming-full/install
$(call Package/bpftune-gaming/install)
endef

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the same duplication just dropped from bpftune-full: the package installs the whole file list of the package it depends on, so both own /usr/sbin/bpftune, /usr/lib/libbpftune.so*, the tuners and the init script. Drop the block so bpftune-gaming-full is an empty meta-package too.


Generated by Claude Code

Comment thread net/bpftune/Makefile
Comment on lines +123 to +125
define Package/bpftune-full/conffiles
/etc/config/bpftune
endef

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: bpftune-full no longer has an install block, so it ships no /etc/config/bpftune to protect and this registers a conffile the package does not contain. Drop it — and lines 129-131 with it, if Package/bpftune-gaming-full/install goes away.


Generated by Claude Code

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants