Link test: per-socket pacing (SO_MAX_PACING_RATE) at 5 MB/s removes the NCM holds
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DDwfd6Ki8UfG4hK6W5YpJz
This commit is contained in:
@@ -16,6 +16,9 @@ traffic goes over WiFi), so the app drives the test and this end only serves:
|
||||
|
||||
Every TCP test also logs this end's TCP_INFO (retransmits, RTT), which the app
|
||||
cannot read. Run: python3 linktest_server.py [results.jsonl]
|
||||
|
||||
LINKTEST_PACE=<bytes/s> caps every download socket with SO_MAX_PACING_RATE, TCP's
|
||||
own pacing (no qdisc needed; the Tegra kernel ships without fq/tbf/htb).
|
||||
"""
|
||||
|
||||
import json
|
||||
@@ -26,6 +29,8 @@ import sys
|
||||
import threading
|
||||
import time
|
||||
|
||||
PACE = int(os.environ.get("LINKTEST_PACE", "0"))
|
||||
SO_MAX_PACING_RATE = 47
|
||||
RESULTS = os.path.expanduser(sys.argv[1] if len(sys.argv) > 1 else "~/linktest/results.jsonl")
|
||||
CHUNK = b"\0" * 65536
|
||||
lock = threading.Lock()
|
||||
@@ -58,6 +63,8 @@ def readline(conn):
|
||||
def down(conn, peer):
|
||||
test_id, *args = readline(conn).split()
|
||||
mode = args[0] if args[0] in ("burst", "paced") else "bulk"
|
||||
if PACE:
|
||||
conn.setsockopt(socket.SOL_SOCKET, SO_MAX_PACING_RATE, PACE)
|
||||
sent = 0
|
||||
try:
|
||||
if mode == "burst":
|
||||
@@ -85,7 +92,7 @@ def down(conn, peer):
|
||||
sent += conn.send(CHUNK)
|
||||
except OSError as e:
|
||||
log({"id": test_id, "kind": "tcp_down_orin", "mode": mode, "error": str(e)})
|
||||
log({"id": test_id, "kind": "tcp_down_orin", "mode": mode, "args": args, "peer": peer, "bytes": sent,
|
||||
log({"id": test_id, "kind": "tcp_down_orin", "mode": mode, "args": args, "pace": PACE, "peer": peer, "bytes": sent,
|
||||
**tcp_info(conn)})
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user