Skip to contentSkip to conversation

tcp: remove obsolete RFC3517/RFC6675 code

PATCH Applied Neal Cardwell 3 participants 6 messages Jun 15, 2025 – Jun 17, 2025

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

v2 cover tcp: remove obsolete RFC3517/RFC6675 code

From: Neal Cardwell <[email protected]>

RACK-TLP loss detection has been enabled as the default loss detection algorithm for Linux TCP since 2018, in:

commit b38a51fec1c1 ("tcp: disable RFC6675 loss detection")

In case users ran into unexpected bugs or performance regressions, that commit allowed Linux system administrators to revert to using RFC3517/RFC6675 loss recovery by setting net.ipv4.tcp_recovery to 0.

In the seven years since 2018, our team has not heard reports of anyone reverting Linux TCP to use RFC3517/RFC6675 loss recovery, and we can't find any record in web searches of such a revert.

RACK-TLP was published as a standards-track RFC, RFC8985, in February 2021.

Several other major TCP implementations have default-enabled RACK-TLP at this point as well.

RACK-TLP offers several significant performance advantages over RFC3517/RFC6675 loss recovery, including much better performance in the common cases of tail drops, lost retransmissions, and reordering.

It is now time to remove the obsolete and unused RFC3517/RFC6675 loss recovery code. This will allow a substantial simplification of the Linux TCP code base, and removes 12 bytes of state in every tcp_sock for 64-bit machines (8 bytes on 32-bit machines).

To arrange the commits in reasonable sizes, this patch series is split into 3 commits:

(1) Removes the core RFC3517/RFC6675 logic.

(2) Removes the RFC3517/RFC6675 hint state and the first layer of logic that updates that state.

(3) Removes the emptied-out tcp_clear_retrans_hints_partial() helper function and all of its call sites.

v2: fix compiler warnings from unused variables

Neal Cardwell (3):
tcp: remove obsolete and unused RFC3517/RFC6675 loss recovery code
tcp: remove RFC3517/RFC6675 hint state: lost_skb_hint, lost_cnt_hint
tcp: remove RFC3517/RFC6675 tcp_clear_retrans_hints_partial()

 Documentation/networking/ip-sysctl.rst        |   8 +-
 .../networking/net_cachelines/tcp_sock.rst    |   2 -
 include/linux/tcp.h                           |   3 -
 include/net/tcp.h                             |   6 -
 net/ipv4/tcp.c                                |   3 +-
 net/ipv4/tcp_input.c                          | 158 ++----------------
 net/ipv4/tcp_output.c                         |   6 -
 7 files changed, 16 insertions(+), 170 deletions(-)
Signature · 1 line
2.50.0.rc1.591.g9c95f17f64-goog
#1 lore raw

PATCH v2 1/3 tcp: remove obsolete and unused RFC3517/RFC6675 loss recovery code

From: Neal Cardwell <[email protected]>

RACK-TLP loss detection has been enabled as the default loss detection algorithm for Linux TCP since 2018, in:

commit b38a51fec1c1 ("tcp: disable RFC6675 loss detection")

In case users ran into unexpected bugs or performance regressions, that commit allowed Linux system administrators to revert to using RFC3517/RFC6675 loss recovery by setting net.ipv4.tcp_recovery to 0.

In the seven years since 2018, our team has not heard reports of anyone reverting Linux TCP to use RFC3517/RFC6675 loss recovery, and we can't find any record in web searches of such a revert.

RACK-TLP was published as a standards-track RFC, RFC8985, in February 2021.

Several other major TCP implementations have default-enabled RACK-TLP at this point as well.

RACK-TLP offers several significant performance advantages over RFC3517/RFC6675 loss recovery, including much better performance in the common cases of tail drops, lost retransmissions, and reordering.

It is now time to remove the obsolete and unused RFC3517/RFC6675 loss recovery code. This will allow a substantial simplification of the Linux TCP code base, and removes 12 bytes of state in every tcp_sock for 64-bit machines (8 bytes on 32-bit machines).

To arrange the commits in reasonable sizes, this patch series is split into 3 commits. The following 2 commits remove bookkeeping state and code that is no longer needed after this removal of RFC3517/RFC6675 loss recovery.

---
 Documentation/networking/ip-sysctl.rst |   8 +-
 net/ipv4/tcp_input.c                   | 137 ++-----------------------
 2 files changed, 15 insertions(+), 130 deletions(-)
Documentation/networking/ip-sysctl.rst +5 -3
index 0f1251cce3149..b31c055f576fa 100644
@@ -645,9 +645,11 @@ tcp_recovery - INTEGER
 	features.
 
 	=========   =============================================================
-	RACK: 0x1   enables the RACK loss detection for fast detection of lost
-		    retransmissions and tail drops. It also subsumes and disables
-		    RFC6675 recovery for SACK connections.
+	RACK: 0x1   enables RACK loss detection, for fast detection of lost
+		    retransmissions and tail drops, and resilience to
+		    reordering. currrently, setting this bit to 0 has no
+		    effect, since RACK is the only supported loss detection
+		    algorithm.
 
 	RACK: 0x2   makes RACK's reordering window static (min_rtt/4).
 
net/ipv4/tcp_input.c +10 -127

213 lines not on this page · raw message

Signature · 1 line
2.50.0.rc1.591.g9c95f17f64-goog
maintainer
#2 lore raw

Re: [PATCH net-next v2 1/3] tcp: remove obsolete and unused RFC3517/RFC6675 loss recovery code

Documentation/networking/ip-sysctl.rst tcp_recovery - INTEGER · line 650

Quoted 3 lines · On Sat, 14 Jun 2025 20:14:33 -0400 Neal Cardwell wrote:
Documentation/networking/ip-sysctl.rst +3 -0
+	RACK: 0x1   enables RACK loss detection, for fast detection of lost
+		    retransmissions and tail drops, and resilience to
+		    reordering. currrently, setting this bit to 0 has no

currently ^

fixed when applying

Quoted 2 lines
Documentation/networking/ip-sysctl.rst +2 -0
+		    effect, since RACK is the only supported loss detection
+		    algorithm.
#3 lore raw

PATCH v2 2/3 tcp: remove RFC3517/RFC6675 hint state: lost_skb_hint, lost_cnt_hint

In reply to Neal Cardwell

From: Neal Cardwell <[email protected]>

Now that obsolete RFC3517/RFC6675 TCP loss detection has been removed, we can remove the somewhat complex and intrusive code to maintain its hint state: lost_skb_hint and lost_cnt_hint.

This commit makes tcp_clear_retrans_hints_partial() empty. We will remove tcp_clear_retrans_hints_partial() and its call sites in the next commit.

---
 .../networking/net_cachelines/tcp_sock.rst    |  2 --
 include/linux/tcp.h                           |  3 ---
 include/net/tcp.h                             |  1 -
 net/ipv4/tcp.c                                |  3 +--
 net/ipv4/tcp_input.c                          | 19 -------------------
 net/ipv4/tcp_output.c                         |  5 -----
 6 files changed, 1 insertion(+), 32 deletions(-)
Documentation/networking/net_cachelines/tcp_sock.rst +0 -2
index bc9b2131bf7ac..7bbda5944ee2f 100644
@@ -115,7 +115,6 @@ u32                           lost_out                read_mostly         read_m
 u32                           sacked_out              read_mostly         read_mostly         tcp_left_out(tx);tcp_packets_in_flight(tx/rx);tcp_clean_rtx_queue(rx)
 struct hrtimer                pacing_timer
 struct hrtimer                compressed_ack_timer
-struct sk_buff*               lost_skb_hint           read_mostly                             tcp_clean_rtx_queue
 struct sk_buff*               retransmit_skb_hint     read_mostly                             tcp_clean_rtx_queue
 struct rb_root                out_of_order_queue                          read_mostly         tcp_data_queue,tcp_fast_path_check
 struct sk_buff*               ooo_last_skb
@@ -123,7 +122,6 @@ struct tcp_sack_block[1]      duplicate_sack
 struct tcp_sack_block[4]      selective_acks
 struct tcp_sack_block[4]      recv_sack_cache
 struct sk_buff*               highest_sack            read_write                              tcp_event_new_data_sent
-int                           lost_cnt_hint
 u32                           prior_ssthresh
 u32                           high_seq
 u32                           retrans_stamp
include/linux/tcp.h +0 -3
index 29f59d50dc73f..1a5737b3753d0 100644
@@ -208,7 +208,6 @@ struct tcp_sock {
 	u32	notsent_lowat;	/* TCP_NOTSENT_LOWAT */
 	u16	gso_segs;	/* Max number of segs per GSO packet	*/
 	/* from STCP, retrans queue hinting */
-	struct sk_buff *lost_skb_hint;
 	struct sk_buff *retransmit_skb_hint;
 	__cacheline_group_end(tcp_sock_read_tx);
 
@@ -419,8 +418,6 @@ struct tcp_sock {
 
 	struct tcp_sack_block recv_sack_cache[4];
 
-	int     lost_cnt_hint;
-
 	u32	prior_ssthresh; /* ssthresh saved at recovery start	*/
 	u32	high_seq;	/* snd_nxt at onset of congestion	*/
 
include/net/tcp.h +0 -1
index 5078ad868feef..f57d121837949 100644
@@ -1813,7 +1813,6 @@ static inline void tcp_mib_init(struct net *net)
 /* from STCP */
 static inline void tcp_clear_retrans_hints_partial(struct tcp_sock *tp)
 {
-	tp->lost_skb_hint = NULL;
 }
 
 static inline void tcp_clear_all_retrans_hints(struct tcp_sock *tp)
net/ipv4/tcp.c +1 -2
index f64f8276a73cd..27d3ef83ce7b2 100644
@@ -5053,9 +5053,8 @@ static void __init tcp_struct_check(void)
 	CACHELINE_ASSERT_GROUP_MEMBER(struct tcp_sock, tcp_sock_read_tx, reordering);
 	CACHELINE_ASSERT_GROUP_MEMBER(struct tcp_sock, tcp_sock_read_tx, notsent_lowat);
 	CACHELINE_ASSERT_GROUP_MEMBER(struct tcp_sock, tcp_sock_read_tx, gso_segs);
-	CACHELINE_ASSERT_GROUP_MEMBER(struct tcp_sock, tcp_sock_read_tx, lost_skb_hint);
 	CACHELINE_ASSERT_GROUP_MEMBER(struct tcp_sock, tcp_sock_read_tx, retransmit_skb_hint);
-	CACHELINE_ASSERT_GROUP_SIZE(struct tcp_sock, tcp_sock_read_tx, 40);
+	CACHELINE_ASSERT_GROUP_SIZE(struct tcp_sock, tcp_sock_read_tx, 32);
 
 	/* TXRX read-mostly hotpath cache lines */
 	CACHELINE_ASSERT_GROUP_MEMBER(struct tcp_sock, tcp_sock_read_txrx, tsoffset);
net/ipv4/tcp_input.c +0 -19
index dc234d3854aa4..e8e130e946f14 100644
@@ -1451,11 +1451,6 @@ static u8 tcp_sacktag_one(struct sock *sk,
 		tp->sacked_out += pcount;
 		/* Out-of-order packets delivered */
 		state->sack_delivered += pcount;
-
-		/* Lost marker hint past SACKed? Tweak RFC3517 cnt */
-		if (tp->lost_skb_hint &&
-		    before(start_seq, TCP_SKB_CB(tp->lost_skb_hint)->seq))
-			tp->lost_cnt_hint += pcount;
 	}
 
 	/* D-SACK. We can detect redundant retransmission in S|R and plain R
@@ -1496,9 +1491,6 @@ static bool tcp_shifted_skb(struct sock *sk, struct sk_buff *prev,
 			tcp_skb_timestamp_us(skb));
 	tcp_rate_skb_delivered(sk, skb, state->rate);
 
-	if (skb == tp->lost_skb_hint)
-		tp->lost_cnt_hint += pcount;
-
 	TCP_SKB_CB(prev)->end_seq += shifted;
 	TCP_SKB_CB(skb)->seq += shifted;
 
@@ -1531,10 +1523,6 @@ static bool tcp_shifted_skb(struct sock *sk, struct sk_buff *prev,
 
 	if (skb == tp->retransmit_skb_hint)
 		tp->retransmit_skb_hint = prev;
-	if (skb == tp->lost_skb_hint) {
-		tp->lost_skb_hint = prev;
-		tp->lost_cnt_hint -= tcp_skb_pcount(prev);
-	}
 
 	TCP_SKB_CB(prev)->tcp_flags |= TCP_SKB_CB(skb)->tcp_flags;
 	TCP_SKB_CB(prev)->eor = TCP_SKB_CB(skb)->eor;
@@ -3318,8 +3306,6 @@ static int tcp_clean_rtx_queue(struct sock *sk, const struct sk_buff *ack_skb,
 		next = skb_rb_next(skb);
 		if (unlikely(skb == tp->retransmit_skb_hint))
 			tp->retransmit_skb_hint = NULL;
-		if (unlikely(skb == tp->lost_skb_hint))
-			tp->lost_skb_hint = NULL;
 		tcp_highest_sack_replace(sk, skb, next);
 		tcp_rtx_queue_unlink_and_free(skb, sk);
 	}
@@ -3377,14 +3363,9 @@ static int tcp_clean_rtx_queue(struct sock *sk, const struct sk_buff *ack_skb,
 			if (flag & FLAG_RETRANS_DATA_ACKED)
 				flag &= ~FLAG_ORIG_SACK_ACKED;
 		} else {
-			int delta;
-
 			/* Non-retransmitted hole got filled? That's reordering */
 			if (before(reord, prior_fack))
 				tcp_check_sack_reordering(sk, reord, 0);
-
-			delta = prior_sacked - tp->sacked_out;
-			tp->lost_cnt_hint -= min(tp->lost_cnt_hint, delta);
 		}
 	} else if (skb && rtt_update && sack_rtt_us >= 0 &&
 		   sack_rtt_us > tcp_stamp_us_delta(tp->tcp_mstamp,
net/ipv4/tcp_output.c +0 -5
index 3ac8d2d17e1ff..b0ffefe604b4c 100644
@@ -1554,11 +1554,6 @@ static void tcp_adjust_pcount(struct sock *sk, const struct sk_buff *skb, int de
 	if (tcp_is_reno(tp) && decr > 0)
 		tp->sacked_out -= min_t(u32, tp->sacked_out, decr);
 
-	if (tp->lost_skb_hint &&
-	    before(TCP_SKB_CB(skb)->seq, TCP_SKB_CB(tp->lost_skb_hint)->seq) &&
-	    (TCP_SKB_CB(skb)->sacked & TCPCB_SACKED_ACKED))
-		tp->lost_cnt_hint -= decr;
-
 	tcp_verify_left_out(tp);
 }
 
Signature · 1 line
2.50.0.rc1.591.g9c95f17f64-goog
#4 lore raw

PATCH v2 3/3 tcp: remove RFC3517/RFC6675 tcp_clear_retrans_hints_partial()

In reply to Neal Cardwell

From: Neal Cardwell <[email protected]>

Now that we have removed the RFC3517/RFC6675 hints, tcp_clear_retrans_hints_partial() is empty, and can be removed.

---
 include/net/tcp.h     | 5 -----
 net/ipv4/tcp_input.c  | 2 --
 net/ipv4/tcp_output.c | 1 -
 3 files changed, 8 deletions(-)
include/net/tcp.h +0 -5
index f57d121837949..9f852f5f8b95e 100644
@@ -1811,13 +1811,8 @@ static inline void tcp_mib_init(struct net *net)
 }
 
 /* from STCP */
-static inline void tcp_clear_retrans_hints_partial(struct tcp_sock *tp)
-{
-}
-
 static inline void tcp_clear_all_retrans_hints(struct tcp_sock *tp)
 {
-	tcp_clear_retrans_hints_partial(tp);
 	tp->retransmit_skb_hint = NULL;
 }
 
net/ipv4/tcp_input.c +0 -2
index e8e130e946f14..05b9571c9c925 100644
@@ -2769,8 +2769,6 @@ void tcp_simple_retransmit(struct sock *sk)
 			tcp_mark_skb_lost(sk, skb);
 	}
 
-	tcp_clear_retrans_hints_partial(tp);
-
 	if (!tp->lost_out)
 		return;
 
net/ipv4/tcp_output.c +0 -1
index b0ffefe604b4c..eb50746dc4820 100644
@@ -3247,7 +3247,6 @@ static bool tcp_collapse_retrans(struct sock *sk, struct sk_buff *skb)
 	TCP_SKB_CB(skb)->eor = TCP_SKB_CB(next_skb)->eor;
 
 	/* changed transmit queue under us so clear hints */
-	tcp_clear_retrans_hints_partial(tp);
 	if (next_skb == tp->retransmit_skb_hint)
 		tp->retransmit_skb_hint = skb;
 
Signature · 1 line
2.50.0.rc1.591.g9c95f17f64-goog
#5 lore raw
In reply to Neal Cardwell
This series was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:

Hello:

This series was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:

Quoted 8 lines · On Sat, 14 Jun 2025 20:14:32 -0400 you wrote:

From: Neal Cardwell <[email protected]>

RACK-TLP loss detection has been enabled as the default loss detection algorithm for Linux TCP since 2018, in:

commit b38a51fec1c1 ("tcp: disable RFC6675 loss detection")

[...]

Here is the summary with links:
- [net-next,v2,1/3] tcp: remove obsolete and unused RFC3517/RFC6675 loss recovery code

    https://git.kernel.org/netdev/net-next/c/1c120191dcec
  - [net-next,v2,2/3] tcp: remove RFC3517/RFC6675 hint state: lost_skb_hint, lost_cnt_hint
    https://git.kernel.org/netdev/net-next/c/ba4618885b23
  - [net-next,v2,3/3] tcp: remove RFC3517/RFC6675 tcp_clear_retrans_hints_partial()
    https://git.kernel.org/netdev/net-next/c/db16319efcc7

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html