linux-api.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jeremy Harris <jgh@exim.org>
To: netdev@vger.kernel.org
Cc: linux-api@vger.kernel.org, edumazet@google.com,
	ncardwell@google.com, Jeremy Harris <jgh@exim.org>
Subject: [PATCH net-next v3 5/6] tcp: fastopen: retransmit data when only the SYN of a synack-with-data is acked
Date: Mon,  9 Jun 2025 17:05:21 +0100	[thread overview]
Message-ID: <edf1680d5052a529e6dda11d36f49171e1af48eb.1749466540.git.jgh@exim.org> (raw)
In-Reply-To: <cover.1749466540.git.jgh@exim.org>

A corner-case for the 3rd-ack after a data-on-synack is for only
the SYN to be acked. Handle this by, in ack processing, when in
SYN_RECV state (the state is not yet updated to ESTABLISHED)
marking the retransmit-queue sk_buff as having been lost.

Signed-off-by: Jeremy Harris <jgh@exim.org>
---
 net/ipv4/tcp_input.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c
index 345a08baaf02..a53021edddd5 100644
--- a/net/ipv4/tcp_input.c
+++ b/net/ipv4/tcp_input.c
@@ -4069,6 +4069,18 @@ static int tcp_ack(struct sock *sk, const struct sk_buff *skb, int flag)
 				      &rexmit);
 	}
 
+	/* On receiving a 3rd-ack, if we never sent a packet via
+	 * the normal means (which counts them), yet there is data
+	 * remaining for retransmit, it was data-on-synack not acked;
+	 * mark the skb for retransmission.
+	 */
+	if (sk->sk_state == TCP_SYN_RECV && tp->segs_out == 0) {
+		struct sk_buff *skb = tcp_rtx_queue_head(sk);
+
+		if (skb)
+			tcp_mark_skb_lost(sk, skb);
+	}
+
 	/* If needed, reset TLP/RTO timer when RACK doesn't set. */
 	if (flag & FLAG_SET_XMIT_TIMER)
 		tcp_set_xmit_timer(sk);
-- 
2.49.0


  parent reply	other threads:[~2025-06-09 16:05 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-06-09 15:56 [PATCH net-next v3 0/6] tcp: support preloading data on a listening socket Jeremy Harris
2025-06-09 16:05 ` [PATCH net-next v3 1/6] tcp: support writing to a socket in listening state Jeremy Harris
2025-06-09 16:05 ` [PATCH net-next v3 2/6] tcp: copy write-data from listen socket to accept child socket Jeremy Harris
2025-06-09 16:26   ` Eric Dumazet
2025-06-09 16:05 ` [PATCH net-next v3 3/6] tcp: fastopen: add write-data to fastopen synack packet Jeremy Harris
2025-06-09 16:05 ` [PATCH net-next v3 4/6] tcp: transmit any pending data on receipt of 3rd-ack Jeremy Harris
2025-06-09 16:05 ` Jeremy Harris [this message]
2025-06-09 16:05 ` [PATCH net-next v3 6/6] tcp: fastopen: extend retransmit-queue trimming to handle linear sk_buff Jeremy Harris

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=edf1680d5052a529e6dda11d36f49171e1af48eb.1749466540.git.jgh@exim.org \
    --to=jgh@exim.org \
    --cc=edumazet@google.com \
    --cc=linux-api@vger.kernel.org \
    --cc=ncardwell@google.com \
    --cc=netdev@vger.kernel.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).