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
44 changes: 22 additions & 22 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
1. Fix multiq total_bands detection.
2. Update service.sh timings to prevent some race conditions. [OnePlus devices]
3. Create post-fs-data.d directory if it doesn't exist.
4. Add support for local tc binary which supports all qdics.
5. Fix qdisc reset in following cases:
- Toggle Airplane Mode.
- Toggle WiFi / Cellular.
6. Add qdisc monitor to prevent netd from changing qdisc.
7. Simplify fq_codel leaf queue for htb.
8. Add bbr3 detection in post-fs stage.
9. Enable full screen mode to prevent navigation bar from interfering.
10. Add pfifo_head_drop, pie, fq_pie and cake full support.
11. Optimize sysctl parameters for low latency, high throughput and stability.
12. Add newly introduced PLB sysctl param support for optimisations.
13. Reduce initrwnd max value to 20 based on RFC 6928.
14. Set tcp_mem dynamically.
Note:
1. More qdisc tuning will be added in next version when I get more information from many users.
2. qdisc fine-tuning currently doesn't support custom mode. Might be added in future.
3. If your kernel supports bbr3, then please use fq / cake / fq_pie for best results.
4. Some kernels convert bbrv1 to bbrv3 and keep the name as bbr. Even in that case use fq / cake / fq_pie instead of other qdisc.
1. New Tools tab: Auto-Optimize (benchmarks every available congestion control, not a fixed whitelist), CC Duel A/B test, live BBR telemetry graph and a multi-server bufferbloat test.
2. New Results tab: every bufferbloat run is saved (connection type, cc, qdisc, signal, download, idle/loaded ping, grade) and survives upgrades.
3. Optional "Advanced TCP buffers" toggle: raise-only (never lowers ROM-tuned min/default values), bumps rmem/wmem ceilings to 16 MiB.
4. initcwnd/initrwnd and per-route congctl are now also applied to the per-interface route table — Android keeps the default route there, so the old main-table-only write never touched internet traffic.
5. Watchdog extended to a full drift guard: global cc, per-route congctl/initcwnd and buffer ceilings are guarded, not just the qdisc; re-asserts quietly (no ss -K) and logs what drifted. Root-anchored qdisc match — a foreign root with a matching leaf no longer passes.
6. Drift guard pauses while WebUI tests run, so Auto-Optimize / CC Duel probes are no longer reverted mid-measurement (pause is crash-safe, capped at 10 minutes).
7. Boot sysctl block made raise-only — no longer clobbers ROM-tuned tcp_rmem/tcp_wmem min/default; tcp_mtu_probing enabled.
8. Fix qdisc matching to use word boundaries (fq no longer false-matches fq_codel in apply checks and the watchdog).
9. Fix per-route congctl bbr/bbr3 prefix collision that left stale bbr3 pins on routes after switching to bbr.
10. Fix VoWiFi detection on OxygenOS/ColorOS (OPlus SystemUI pattern + AOSP fallback; previously every Wi-Fi join ate the full 20 s timeout).
11. Fix cellular signal reading: real dBm (RSRP/ssRsrp) from the active-data SIM's primary RAT instead of the dead CDMA level= that pinned dual-SIM devices at "poor".
12. Fix Manual Settings not applying on Wi-Fi (force-apply was gated behind the VoWiFi connect timer).
13. VPN-aware interface resolution: tun/ppp/wg map to the underlying wlan/rmnet interface.
14. Upgrades preserve all user state: markers, Advanced-buffers toggle, cake hints, active profile and test history.
15. Mount debugfs when absent (Android 11+) so bbr3 socket telemetry works.
16. Drop inert system.prop (set Android props nothing consumes; could contradict the live sysctls).
17. Fix Logs tab re-rendering every poll (visible flicker / scroll jump).
18. WebUI polish: themed dropdowns, animated nav pill, per-series lanes + 60 fps glide on the telemetry graph.

Note:
1. If your kernel supports bbr3, then please use fq / cake / fq_pie for best results.
2. Some kernels convert bbrv1 to bbrv3 and keep the name as bbr. Even in that case use fq / cake / fq_pie instead of other qdisc.
12 changes: 12 additions & 0 deletions module/customize.sh
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,18 @@ if check_exists_anywhere "initcwnd"; then
fi
fi

# Preserve the remaining per-user state across upgrades. The wlan_*/rmnet_data_*/
# kill_connections/initcwnd_initrwnd markers are carried over above, but the
# newer 2.7 state files were not, so every upgrade silently reset the Advanced
# TCP buffers toggle, the Smart-cake hints, the active profile label and wiped
# the whole Results-tab test history.
for m in adv_buffers cake_hint_wlan cake_hint_rmnet active_profile bench_results.jsonl; do
if [ -f "$MODULE_PATH/$m" ] && [ ! -f "$MODPATH/$m" ]; then
cp "$MODULE_PATH/$m" "$MODPATH/$m"
ui_print " [+] Preserved user state: $m"
fi
done

cp "$MODPATH/module.prop" "$MODPATH/module.prop.bak"

chmod +x "$MODPATH/bin/tc"
Expand Down
4 changes: 2 additions & 2 deletions module/module.prop
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
id=tcp_optimiser
name=TCP Optimiser
version=2.5
versionCode=17
version=2.7
versionCode=72
author=fatalcoder524
description=TCP Optimisations & update tcp_cong_algo based on interface
updateJson=https://raw.githubusercontent.com/fatalcoder524/TCP_Optimiser_Module/main/update.json
Expand Down
32 changes: 25 additions & 7 deletions module/post-fs-data.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@

sleep 2

# Mount debugfs (Android 11+ user builds leave it unmounted) so the WebUI
# telemetry card can read /sys/kernel/debug/tcp_bbr3/sockets. Idempotent.
mountpoint -q /sys/kernel/debug 2>/dev/null || \
mount -t debugfs debugfs /sys/kernel/debug 2>/dev/null

AVAIL_CC="$(cat /proc/sys/net/ipv4/tcp_available_congestion_control)"
# Check if BBR3 is available
if echo "$AVAIL_CC" | grep -qw bbr3; then
Expand All @@ -26,18 +31,31 @@ echo "fq_codel" > /proc/sys/net/core/default_qdisc 2>/dev/null
echo 120 > /proc/sys/net/ipv4/tcp_pacing_ca_ratio 2>/dev/null
echo 180 > /proc/sys/net/ipv4/tcp_pacing_ss_ratio 2>/dev/null
echo 1 > /proc/sys/net/ipv4/tcp_window_scaling 2>/dev/null
echo "4096 2097152 16777216" > /proc/sys/net/ipv4/tcp_rmem 2>/dev/null
echo "4096 2097152 16777216" > /proc/sys/net/ipv4/tcp_wmem 2>/dev/null
echo 16777216 > /proc/sys/net/core/rmem_max 2>/dev/null
echo 16777216 > /proc/sys/net/core/wmem_max 2>/dev/null

# Socket buffers: RAISE ONLY. The old code wrote a fixed "4096 2097152 16777216"
# over tcp_rmem/tcp_wmem, which replaces the ROM's tuned min & default (OxygenOS
# ships 524288 1048576 16777216) with a 2 MiB default on every socket. That is
# exactly what apply_tcp_buffers() in service.sh was written to avoid, so use the
# same raise-only rule here and let the "Advanced TCP buffers" toggle stay
# meaningful instead of being pre-empted by this block.
for f in /proc/sys/net/core/rmem_max /proc/sys/net/core/wmem_max; do
cur=$(cat "$f" 2>/dev/null)
[ -n "$cur" ] && [ "$cur" -lt 16777216 ] && echo 16777216 > "$f" 2>/dev/null
done
for f in /proc/sys/net/ipv4/tcp_rmem /proc/sys/net/ipv4/tcp_wmem \
/proc/sys/net/ipv6/tcp_rmem /proc/sys/net/ipv6/tcp_wmem; do
set -- $(cat "$f" 2>/dev/null)
[ -n "$3" ] && [ "$3" -lt 16777216 ] && echo "$1 $2 16777216" > "$f" 2>/dev/null
done

echo 4096 > /proc/sys/net/ipv4/tcp_max_syn_backlog 2>/dev/null
echo 0 > /proc/sys/net/ipv4/tcp_mtu_probing 2>/dev/null
# PMTU probing: OxygenOS already ships 1; writing 0 here downgraded the ROM on
# every boot (and fought apply_tcp_buffers, which sets 1).
echo 1 > /proc/sys/net/ipv4/tcp_mtu_probing 2>/dev/null
echo 16384 > /proc/sys/net/ipv4/tcp_notsent_lowat 2>/dev/null

# IPv6 TCP tuning
echo 1 > /proc/sys/net/ipv6/tcp_ecn 2>/dev/null
echo "4096 2097152 16777216" > /proc/sys/net/ipv6/tcp_rmem 2>/dev/null
echo "4096 2097152 16777216" > /proc/sys/net/ipv6/tcp_wmem 2>/dev/null

# Extra settings for optimal stability
echo 100000 > /proc/sys/net/core/netdev_max_backlog 2>/dev/null
Expand Down
Loading