tcp: remove obsolete RFC3517/RFC6675 code
Subsystems (4)
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
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
@@ -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
Jakub Kicinski
maintainerRe: [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.
PATCH v2 2/3 tcp: remove RFC3517/RFC6675 hint state: lost_skb_hint, lost_cnt_hint
In reply to Neal CardwellFrom: 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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -1554,11 +1554,6 @@ static void tcp_adjust_pcount(struct sock *sk, const struct sk_buff *skb, int deif (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
PATCH v2 3/3 tcp: remove RFC3517/RFC6675 tcp_clear_retrans_hints_partial()
In reply to Neal CardwellFrom: 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
@@ -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
@@ -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
@@ -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
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