All of lore.kernel.org
 help / color / mirror / Atom feed
From: Hui Peng <benquike@gmail.com>
To: edumazet@google.com, ncardwell@google.com, kuniyu@google.com,
	davem@davemloft.net, kuba@kernel.org, pabeni@redhat.com,
	horms@kernel.org
Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH] tcp: drain out_of_order_queue and update SACKs in tcp_send_rcvq()
Date: Sat, 19 Sep 2026 21:52:36 +0000	[thread overview]
Message-ID: <20260919215236.3470714-1-benquike@gmail.com> (raw)

When TCP_REPAIR injects data into the receive queue via tcp_send_rcvq() and
advances tp->copied_seq and tp->rcv_nxt, any segments already sitting in
tp->out_of_order_queue that are now covered or contiguous with rcv_nxt are
not coalesced or removed from tp->rx_opt.num_sacks. Drain
out_of_order_queue via tcp_ofo_queue(sk) and update SACK blocks via
tcp_sack_remove(tp) after advancing rcv_nxt in tcp_send_rcvq().

Fixes: 292e8d8c8538 ("tcp: Move rcvq sending to tcp_input.c")
Assisted-by: LLM
Signed-off-by: Hui Peng <benquike@gmail.com>
---
diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c
index 92bc60716f33..8a7c38a4b1ec 100644
--- a/net/ipv4/tcp_input.c
+++ b/net/ipv4/tcp_input.c
@@ -5589,6 +5589,11 @@ int tcp_send_rcvq(struct sock *sk, struct msghdr *msg, size_t size)
 		WARN_ON_ONCE(fragstolen); /* should not happen */
 		__kfree_skb(skb);
 	}
+	if (!RB_EMPTY_ROOT(&tcp_sk(sk)->out_of_order_queue)) {
+		tcp_ofo_queue(sk);
+		if (tcp_sk(sk)->rx_opt.num_sacks)
+			tcp_sack_remove(tcp_sk(sk));
+	}
 	return size;
 
 err_free:

             reply	other threads:[~2026-09-19 21:52 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-19 21:52 Hui Peng [this message]
2026-09-20 21:55 ` [PATCH] tcp: drain out_of_order_queue and update SACKs in tcp_send_rcvq() netdev-bot+sashiko
2026-09-21 12:53 ` Eric Dumazet

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260919215236.3470714-1-benquike@gmail.com \
    --to=benquike@gmail.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=horms@kernel.org \
    --cc=kuba@kernel.org \
    --cc=kuniyu@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=ncardwell@google.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.