]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
tcp: remove RFC3517/RFC6675 hint state: lost_skb_hint, lost_cnt_hint
authorNeal Cardwell <ncardwell@google.com>
Sun, 15 Jun 2025 00:14:34 +0000 (20:14 -0400)
committerJakub Kicinski <kuba@kernel.org>
Tue, 17 Jun 2025 23:19:04 +0000 (16:19 -0700)
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.

Suggested-by: Yuchung Cheng <ycheng@google.com>
Signed-off-by: Neal Cardwell <ncardwell@google.com>
Reviewed-by: Yuchung Cheng <ycheng@google.com>
Reviewed-by: Eric Dumazet <edumazet@google.com>
Link: https://patch.msgid.link/20250615001435.2390793-3-ncardwell.sw@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Documentation/networking/net_cachelines/tcp_sock.rst
include/linux/tcp.h
include/net/tcp.h
net/ipv4/tcp.c
net/ipv4/tcp_input.c
net/ipv4/tcp_output.c

index bc9b2131bf7acc888e8910b1c5926c83de48f9d6..7bbda5944ee2fe7205b3671e51f8406a9e0daafd 100644 (file)
@@ -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
index 29f59d50dc73f8c433865e6bc116cb1bac4eafb7..1a5737b3753d06165bc71e257a261bcd7a0085ce 100644 (file)
@@ -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       */
 
index 5078ad868feef8fd8f210f8c3c54cdf575742ff2..f57d121837949c11141807154565b883b1b29192 100644 (file)
@@ -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)
index f64f8276a73cdd14aafc4e9e16ae4267e24f1242..27d3ef83ce7b2bbf2cd51c65659e9f18cb004cd7 100644 (file)
@@ -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);
index dc234d3854aa4273fbc00cecac5e8a0f9aad6b74..e8e130e946f146c277d58064a76848611d997786 100644 (file)
@@ -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,
index 3ac8d2d17e1ff42aaeb9adf0a9e0c99c13d141a8..b0ffefe604b4c90284ae3c1dbcf649afd5cbc80a 100644 (file)
@@ -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);
 }