mtk-bwmod v1.9
Architecture
v1.9 uses a 4-layer system. Each layer runs at a different point in the boot process:
┌─────────────────────────────────────────────────────┐
│ LAYER 1 — Android Init (pre-userspace) │
│ system/etc/init/mtk-bwmod.rc │
│ system/etc/sysctl.d/99-mtk-bwmod.conf │
│ system/etc/dhcpcd/dhcpcd.conf │
│ system/etc/resolv.conf │
├─────────────────────────────────────────────────────┤
│ LAYER 2 — Android Properties (HAL-required only) │
│ system.prop (~155 props, lean) │
├─────────────────────────────────────────────────────┤
│ LAYER 3 — Magisk Boot Service │
│ service.sh (22 sections, radio/WiFi/TC/IRQ) │
├─────────────────────────────────────────────────────┤
│ LAYER 4 — Runtime Profile Switcher │
│ action.sh (Performance / Balanced / Battery) │
└─────────────────────────────────────────────────────┘
System Files (Layer 1)
system/etc/init/mtk-bwmod.rc
Android init script. Processed by init daemon before Magisk service.sh.
| Trigger | What runs |
|---|---|
on post-fs-data |
TCP core, UDP, socket params, routing — no module dependency |
on boot_completed |
BBR (tcp_bbr.ko), 64MB buffers, conntrack 2M |
system/etc/sysctl.d/99-mtk-bwmod.conf
sysctl.d fallback. Applied by sysctl --system during init on supported ROMs.
Mirrors init.rc params — ensures coverage on ROMs with varying init behavior.
Covers: TCP (fastopen, ECN, keepalive, notsent_lowat), UDP, 64MB buffers, conntrack 2M, routing, IPv6.
system/etc/dhcpcd/dhcpcd.conf
DHCP client optimization. Applied by dhcpcd daemon when connecting to WiFi/LAN.
| Setting | Value | Effect |
|---|---|---|
rapid_commit |
on | 1 round-trip DHCP vs 4 — faster WiFi connect |
timeout |
10s | Faster failure detection |
static dns |
1.1.1.1 1.0.0.1 | DNS override via DHCP layer |
noarp |
on | Skip ARP probe — saves ~1-2s per connect |
system/etc/resolv.conf
DNS resolver fallback. Points to Cloudflare 1.1.1.1 for processes that bypass Android's netd.
Properties (Layer 2)
~155 essential props only. All kernel/network params moved to system files.
| # | Section | Count | Purpose |
|---|---|---|---|
| 1 | LTE Carrier Aggregation | 13 | Force CA, UL/DL bands, component limit |
| 2 | MTK Baseband | 14 | RIL optimization, HSDPA/HSUPA tuning |
| 3 | Fast Dormancy Disabled | 3 | Lower ping, disable modem idle sleep |
| 4 | WiFi HAL | 23 | Power save off, band steering, WiFi 6/6E |
| 5 | Logging Off | 7 | Disable WiFi/BT/modem debug logs |
| 6 | DNS | 6 | Cloudflare on rmnet0/rmnet1 |
| 7 | NR / 5G | 12 | SA+NSA, all global bands, NR force |
| 8 | MTK ConnSys / IMS / DSDS | 21 | Balanced BT coex, full IMS stack, DSDS |
| 9 | LTE-A + NR Extended | 20 | EN-DC, MIMO, 256QAM, PDCP, BWP |
| 10 | VoLTE / VoNR | 6 | HD Voice, 5G calling, WFC |
| 11 | Antenna / Diversity | 10 | 4RX diversity, UL MCS boost |
| 12 | ConnAC WiFi Chip | 26 | A-MPDU/A-MSDU, OFDMA, BF, 802.11k/v/r |
| 13 | IMS Stack Extended | 9 | AMR-WB, EVS, Opus, SRVCC |
| 14 | Network Search + Modem | 9 | Fast camp, NR priority, PSM off |
| 15 | Settings UI Unlock | 15 | 5G/VoLTE/WFC/APN in Settings (all ROMs) |
Boot Service (Layer 3)
service.sh — runs via Magisk late_start, 22 sections, 416 lines.
| # | Section | Method |
|---|---|---|
| 1–2 | Radio + IMS props | setprop after modem init |
| 3 | TCP/BBR | sysctl (confirms init.rc values) |
| 4 | UDP/QUIC buffers | sysctl |
| 5 | WiFi runtime | setprop |
| 6 | DNS all interfaces | setprop per interface |
| 7 | Network IRQ affinity | /proc/irq/*/smp_affinity → big cores |
| 8 | Data stall recovery | setprop keepalive |
| 9 | txqueuelen + RPS | ip link, /sys/class/net/ |
| 10 | Settings UI unlock | setprop |
| 11 | CCCI + Antenna + CA | setprop |
| 12 | Signal + Network search | setprop |
| 13 | WiFi AP QoS (802.11k/v/r) | setprop |
| 14 | tc qdisc → fq | tc qdisc (skips AP interfaces) |
| 15 | HW offloading GRO/GSO/TSO | ethtool -K + sysfs |
| 16 | XPS TX steering | /sys/class/net/*/queues/tx-*/xps_cpus |
| 17 | NAPI budget | sysctl netdev_budget=600 |
| 18 | schedutil hint | /sys/devices/system/cpu/*/cpufreq/schedutil/ |
| 19 | RPS flow table | sysctl rps_sock_flow_entries=32768 |
| 20 | IRQ coalescing | ethtool -C rx-usecs=50 rx-frames=32 |
| 21 | TCP overhead strip | timestamps=0, mtu_probing=2 |
| 22 | Conntrack scaling | nf_conntrack_max=2M |
Profile Switcher (Layer 4)
action.sh — trigger via Magisk App → Module → Action button.
Vol↑ = Next profile
Vol↓ = Prev profile
Power = Apply
| ⚡ Performance | ⚖️ Balanced | 🔋 Battery Saver | |
|---|---|---|---|
| TCP Buffers | 64MB | 32MB | 16MB |
| CC | BBR | BBR | Cubic |
| qdisc | fq | fq_codel | fq_codel |
| IRQ Coalesce | 50µs / 32f | 100µs / 16f | 200µs / 8f |
| Conntrack | 2,000,000 | 500,000 | 65,536 |
| schedutil | 0µs (instant) | 200µs | 500µs |
| NAPI | 600 | 400 | 300 |
| WiFi PS | OFF | Light | ON |
| Fast Dormancy | OFF | Soft | ON |
Profile persists across reboots: /data/local/tmp/mtk_bwmod_profile