Check in_sack firstly in tcp_match_skb_to_sack()
Subsystems (3)
PATCH 1/1 Check in_sack firstly in tcp_match_skb_to_sack()
This is because only when in_sack is equal to false the pkt_len can be greater than or equal to skb->len, so checking the in_sack firstly will make the logic more clear.
Signed-off-by Xin Guo <[email protected]>
--- net/ipv4/tcp_input.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/ipv4/tcp_input.c +1 -1
@@ -1375,7 +1375,7 @@ static int tcp_match_skb_to_sack(struct sock *sk, struct sk_buff *skb, pkt_len = new_len; } -if (pkt_len >= skb->len && !in_sack) +if (!in_sack && pkt_len >= skb->len)return 0 ; err = tcp_fragment(sk, TCP_FRAG_IN_RTX_QUEUE, skb,
Signature · 1 line
2.43.0
Jakub Kicinski
maintainerQuoted 4 lines · On Tue, 12 Aug 2025 23:23:22 +0800 Xin Guo wrote:
This is because only when
in_sackis equal to false thepkt_lencan be greater than or equal toskb->len, so checking thein_sackfirstly will make the logic more clear.
no acks/review tags seem to be forthcoming so not sure this is enough of an improvement to justify patching