Skip to content

tcp: preserve advertised rwnd accounting across receive-memory decisions

Wesley Atwell linux-api linux-doc linux-kselftest linux-trace-kernel lkml mptcp netdev 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest7 patches 5 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/7tcp: track advertise-time scaling basis for rcv_wndDocumentation/networking/net_cachelines/tcp_sock.rst include/linux/tcp.h include/net/tcp.h +1 more+76 -60 replies
2/7tcp: preserve rcv_wnd snapshot when updating advertised windowsnet/ipv4/tcp_minisocks.c net/ipv4/tcp_output.c+7 -30 replies
3/7tcp: honor advertised receive window in memory admission and clampinginclude/net/tcp.h net/ipv4/tcp_input.c net/ipv4/tcp_output.c+93 -80 replies
4/7tcp: extend TCP_REPAIR_WINDOW with receive-window scaling snapshotinclude/uapi/linux/tcp.h net/ipv4/tcp.c+29 -60 replies
5/7mptcp: refresh tcp rcv_wnd snapshot when syncing receive windowsnet/mptcp/options.c net/mptcp/protocol.h+19 -70 replies
6/7tcp: expose rmem and backlog accounting in rcvbuf_grow tracepointsinclude/trace/events/mptcp.h include/trace/events/tcp.h+14 -90 replies
7/7selftests: tcp_ao: cover legacy and extended TCP_REPAIR_WINDOW layoutstools/testing/selftests/net/packetdrill/tcp_rcv_toobig.pkt tools/testing/selftests/net/packetdrill/tcp_rcv_toobig_default.pkt tools/testing/selftests/net/tcp_ao/lib/aolib.h +2 more+244 -230 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCH net 0/7] tcp: preserve advertised rwnd accounting across receive-memory decisions

This series keeps sender-visible TCP receive-window accounting tied to the scaling basis that was in force when the window was advertised.

Problem
-------

tp->rcv_wnd is an advertised promise to the sender, but later receive-memory admission and clamping could reconstruct that promise through the mutable live scaling_ratio. After ratio drift, the stack could retain or advertise a receive window that no longer matched the local hard rmem budget.

Fix
---

- store the advertise-time scaling basis alongside tp->rcv_wnd
- refresh that pair at the TCP and MPTCP receive-window write sites
- consume the snapshot in receive-memory admission, clamping, and the scaled-window quantization path
- preserve the snapshot across TCP_REPAIR_WINDOW restore when userspace provides it, and fall back safely when legacy userspace cannot
- expose the accounting in tracepoints and cover the ABI/runtime contract in selftests

Series layout
-------------

1. track the receive-window snapshot state and helpers
2. refresh the snapshot when TCP advertises or initializes windows
3. use the snapshot in receive-memory admission and clamping
4. extend TCP_REPAIR_WINDOW for exact restore plus legacy compatibility
5. refresh the TCP shadow window snapshot in MPTCP
6. expose rmem/backlog state in rcvbuf_grow tracepoints
7. cover legacy and extended repair-window layouts in selftests

Testing
-------

- git diff --check origin/main..HEAD
- scripts/checkpatch.pl --strict --show-types on patches 1-7
- make -j8 headers
- make -j8 net/ipv4/tcp_input.o net/ipv4/tcp_output.o net/ipv4/tcp_minisocks.o net/ipv4/tcp.o
- make -j8 C=1 CF='-D__CHECK_ENDIAN__' W=1 net/ipv4/tcp_input.o net/ipv4/tcp_output.o net/ipv4/tcp_minisocks.o net/ipv4/tcp.o
- make SPHINXDIRS='networking/net_cachelines' htmldocs
- make -j8 vmlinux bzImage modules
- make -C tools/testing/selftests/net/tcp_ao -j8
- make -C tools/testing/selftests/net/mptcp -j8
- packetdrill --dry_run for tcp_rcv_toobig.pkt and
tcp_rcv_toobig_default.pkt
- virtme-run guest pass for both packetdrill tests
- feature-enabled guest pass for restore_ipv4, self-connect_ipv4, and
mptcp_sockopt.sh

Thanks,
Wesley

---
base-commit: 908c344d5cfa0ee6efb3226d22ea661e078ebfa0

Signature · 1 line
2.43.0