Skip to content

Commit c57e167

Browse files
committed
add socket tuning make
1 parent 65e4157 commit c57e167

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

makefiles/net.mk

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,31 @@
11
IFACE ?= lo
22

33
.PHONY: all help \
4+
net-tune \
45
net-apply net-clear net-status net-verify \
56
net-good-home-wifi net-congested-wifi net-stable-mobile net-lte-1bar \
67
net-cross-continent net-unusable
78

89
all: help
910

11+
net-tune:
12+
@echo "Applying socket tuning for interface $(NIC)..."
13+
@sudo sysctl -w net.core.wmem_max=134217728
14+
@sudo sysctl -w net.core.rmem_max=134217728
15+
# Enable hardware GRO (or hypervisor-assisted)
16+
@sudo ethtool -K $(NIC) rx-gro-hw on || true
17+
# Enable software GRO as fallback
18+
@sudo ethtool -K $(NIC) gro on || true
19+
# Use fragment-based skbs (lower latency, safer in virtio/cloud)
20+
@sudo ethtool -K $(NIC) rx-gro-list off || true
21+
@sudo ethtool -K $(NIC) rx-udp-gro-forwarding on || true
22+
# Enable generic segmentation offload for TCP/UDP GSO
23+
@sudo ethtool -K $(NIC) gso on || true
24+
@sudo ethtool -K $(NIC) tx-gso-partial on || true
25+
@echo "Current GRO/GSO settings for $(NIC):"
26+
@ethtool -k $(NIC) | grep -E "gro|gso|segmentation|scatter"
27+
@echo "✅ Socket tuning applied successfully."
28+
1029
# net-apply: Applies network simulation with AUTOMATIC handling of localhost double-counting
1130
# Presets should specify TARGET_RTT and jitter as if measuring end-to-end
1231
# This function divides by 2 automatically for localhost since packets traverse rules twice

0 commit comments

Comments
 (0)