Repository navigation
Conversation
| @@ -0,0 +1,150 @@ | |||
| // Package ecn implements Explicit Congestion Notification (RFC 3168) as a | |||
There was a problem hiding this comment.
"Explicit Congestion Notification" sounds like it could be stored within congestion package, either as package(directory) or as a type?
There was a problem hiding this comment.
It's kind of an oddball imo, it's part of congestion control but also not an algorithm like cubic or bbr so I wasn't to sure if it fits there. If you'd rather have it moved I don't see an issue with it right now. I think there was also a circular import issue at some point in the old branch and I didn't look too deep into that again if it still applies after the reworks.
ee84d45 to
62b51f1
Compare
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #315 +/- ##
==========================================
+ Coverage 70.46% 70.70% +0.24%
==========================================
Files 154 155 +1
Lines 17634 17744 +110
==========================================
+ Hits 12425 12546 +121
+ Misses 4211 4202 -9
+ Partials 998 996 -2 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
memci size/alloc report
|
| target | flags | base | head | Δ | |
|---|---|---|---|---|---|
| Stack MWE | 4.05 MiB | 4.05 MiB | +4.67 KiB | +0.1% | |
| Stack MWE pico | -mem |
181.29 KiB | 181.40 KiB | +120 B | +0.1% |
-mem: counts only the loadable image and .bss, usually used for firmware images.
Breakdown by package
Stack MWE — +4.67 KiB
go build -o=mwe.elf -tags=noslog ./examples/min-working-example
| package | base | head | Δ | |
|---|---|---|---|---|
| [unattributed] | 2.67 MiB | 2.67 MiB | +3.02 KiB | +0.1% |
| github.com/soypat/lneto/tcp | 51.09 KiB | 52.56 KiB | +1.47 KiB | +2.9% |
| go:func | 201.62 KiB | 201.71 KiB | +88 B | +0.0% |
| go:itab | 3.02 KiB | 3.09 KiB | +64 B | +2.1% |
| runtime | 463.67 KiB | 463.70 KiB | +30 B | +0.0% |
Stack MWE pico — +120 B
tinygo build -o=mwe-pico.elf -target=pico -tags=noslog -panic=trap ./examples/min-working-example
| package | base | head | Δ | |
|---|---|---|---|---|
| github.com/soypat/lneto/tcp | 22.17 KiB | 22.29 KiB | +120 B | +0.5% |
|
FYI #316 has discussion regarding some parts of this PR which I'wd want to solve before continuing with this design |
|
Saw, that. I'm currently working on some Tamago BMC improvements this week so I'll be able to take another look for the open PRs and discussions on Monday 👍 |
GetIPECN and SetIPECN read and set the Explicit Congestion Notification codepoint of RFC 3168 §5 in an IPv4 or IPv6 header, where it is the low two bits of the Type of Service octet or of the Traffic Class, which in IPv6 starts four bits into the header. The bits around it are kept, and the IPv4 header checksum is left to the stack that computes it after. Implemented and validated with LLM assistance. Signed-off-by: Marvin Drees <marvin.drees@9elements.com>
Explicit Congestion Notification (RFC 3168) marks congestion in the IP header, which the Handler never sees. Handler.RecvECN takes a frame together with the codepoint of the packet carrying it, and SendECN returns the codepoint for the frame it just wrote, which the caller sets in the IP header before computing the IPv4 header checksum. Recv and Send are these with Not-ECT. The Conn reads the codepoint in Demux and writes it in Encapsulate. A Policy implementing the new ECNPolicy interface, alone or as a member of Policies, is handed each frame with its codepoint: PreRxECN right before PreRx and PostTxECN right after PostTx. No codepoint is carried between calls, so none can reach another frame or one rejected before PreRx. The Policy interface is unchanged, and Policies is no ECNPolicy itself whatever its members: the Handler reaches the ECN members and sends the codepoint of the first, also when it is Not-ECT. An ECN peer sets ECE on every segment while it echoes congestion, also on keepalives and Linux's zero-window probes, which were then no longer recognized and drew challenge ACKs until the connection aborted. Their checks now ignore ECE and CWR. Implemented and validated with LLM assistance. Signed-off-by: Marvin Drees <marvin.drees@9elements.com>
Package ecn implements RFC 3168 as a tcp.ECNPolicy, so a congested router can mark packets instead of dropping them. Its state lives in the Policy: PreRxECN takes each received frame with its codepoint, and PostTxECN sets the ECN flags of each sent frame and returns its codepoint. - The first SYN offers ECN with ECE and CWR, and retransmissions go without (§6.1.1.1). A SYN-ACK with ECE only answers an offer; one with both reflects it. Marks are then echoed if any SYN of ours offered ECN, and new data sent ECN-capable only if the latest did. A server answers with ECE only while every SYN it received, also those it drops as retransmissions, offered ECN (§6.1.1). - New data is sent ECT(0). SYNs, pure ACKs, resends and zero-window probes stay Not-ECT (§6.1.1, §6.1.5, §6.1.6). - A packet marked CE, also one held out of order, makes every segment carry ECE until the peer's CWR, unless that packet is marked again (§6.1.3). The peer's ECE puts CWR on the next segment of new data, once until the peer acknowledged it, since ECE before echoes the mark that CWR answered (§6.1.2). Reducing the window on ECE is up to the congestion controller. Implemented and validated with LLM assistance. Signed-off-by: Marvin Drees <marvin.drees@9elements.com>
With ECN the peer echoes a router's congestion mark with ECE, which RFC 3168 §6.1.2 asks the sender to treat like a loss, though nothing was lost. CUBIC now applies the multiplicative decrease on ECE without entering recovery, so nothing is resent. Until SND.UNA passes the data sent before, whose ACKs can still echo the same mark, the window does not grow, and neither further ECE nor a loss reduces it again; a loss still starts recovery, and a timeout ends the reduction. ECE is handled before the ACK carrying it can grow the window. Implemented and validated with LLM assistance. Signed-off-by: Marvin Drees <marvin.drees@9elements.com>
62b51f1 to
52cb64c
Compare
Last bigger piece from #187 now. As RFC 3168 (ECN) is a bit more invasive this is probably a bit more controversial code as it touches more that just a policy like CUBIC and BBR did for example but I still tried implementing via the Policy API which worked quite well with a couple caveats as you can see in the four commits here.