Page MenuHomeFreeBSD

Basic Lost Retransmission Detection (LRD)

Authored by rscheff on Feb 25 2021, 10:41 PM.
Referenced Files
Unknown Object (File)
Sat, Jul 13, 6:43 AM
Unknown Object (File)
Fri, Jul 12, 9:07 AM
Unknown Object (File)
Fri, Jul 12, 6:05 AM
Unknown Object (File)
Wed, Jul 10, 7:18 PM
Unknown Object (File)
Mon, Jul 8, 12:42 PM
Unknown Object (File)
Mon, Jul 8, 8:02 AM
Unknown Object (File)
Mon, Jul 8, 3:15 AM
Unknown Object (File)
Sat, Jul 6, 7:22 AM



The loss of a retransmission during loss-recovery is currently an
event, that can only be recovered from in the base stack, by waiting
for a lengthy RTO, and then picking up from there with slow-start

The theory of operation of this variant - which only works in
conjunction with SACK - is to remeber the snd_recover point
at the time, the last segment of a scoreboard hole is sent out.

Once snd_fack (the topmost right edge of a returned SACK block)
acknowledges the recovery point (snd_recover) - that is, a SACK
for a segment beyond snd_nxt at the time of entering loss-recovery,
the first window of loss recovery is over. Without additional loss,
all holes in the SACK scoreboard should have closed by that time
with successful retransmissions. Thus any remaining holes are
likely to be due to lost retransmissions.


  • Extremely severe reordering of original and retransmitted packets

may cause similar observable SACK patterns.

  • When the sender has no data to send beyond recovery point, which

is a not uncommon in request-response IO type exchanges, where TCP
often is application limited, the above heuristic will never trigger.
A more agressive variant of LRD could simply check when an octet
dupthresh*SMSS beyond the current hole is acknowledges (or the highest
outstanding, not-yet-acked octet, if no additional data is available
for sending), and restart the retransmission from the leftmost hole
at that point.

  • This is work in progress
  • The patch has been revived from code written against 8.0
Test Plan

Extensive Unit testing will be necessary, to validate no unexpected
or damaging behavior under severe reordering, extensive loss, ack thinning,
application limiting etc.

Diff Detail

rG FreeBSD src repository
Lint Not Applicable
Tests Not Applicable

Event Timeline

  • revive basic LRD
  • add tcp_input() logging for prr
  • add cc_cong_signal to LRD trigger condition.
  • make the compiler happy
  • add tunable for LRD
  • track prr sent bytes from prior window for LRD
  • move LRD into dedicated function to reduce clutter
  • nicify comments
  • rebase to main
  • simplify processing for 2nd round of PRR/SACK reduction

transport call: fence this new functionality behind a sysctl until stability has been demonstrated

  • add man page for net.inet.tcp.do_lrd
gbe added a subscriber: gbe.

OK for the man page part.

  • add statisticts to see when lrd triggered
  • add sockopt TCP_LRD for a/B testing

The socket option (and TF_LRD) would be expected to get removed,
once A/B testing is completed.

This revision is now accepted and ready to land.May 10 2021, 3:46 PM

You might want to put += at the end of the line before.

Except for the nit, I'm happy.