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 6/6] tcp: fastopen: extend retransmit-queue trimming to handle linear sk_buff
Date: Mon,  9 Jun 2025 17:05:22 +0100	[thread overview]
Message-ID: <5a10c22ceb84dfb72cd70a3d11f8371a68866dfc.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
some but not all of the data to be acked. Support this by
adding to the retransmit-queue trim routine to handle a
linear sk_buff.

Signed-off-by: Jeremy Harris <jgh@exim.org>
---
 net/ipv4/tcp_output.c | 18 ++++++++++++++++--
 1 file changed, 16 insertions(+), 2 deletions(-)

diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c
index c50553c1c795..bff5934ff04b 100644
--- a/net/ipv4/tcp_output.c
+++ b/net/ipv4/tcp_output.c
@@ -1708,8 +1708,22 @@ static int __pskb_trim_head(struct sk_buff *skb, int len)
 	struct skb_shared_info *shinfo;
 	int i, k, eat;
 
-	DEBUG_NET_WARN_ON_ONCE(skb_headlen(skb));
-	eat = len;
+	eat = skb_headlen(skb);
+	if (unlikely(eat)) {
+		if (len < eat)
+			eat = len;
+		skb->head += eat;
+		skb->len -= eat;
+		if (skb->data_len)
+			skb->data_len -= eat;
+
+		eat = len - eat;
+		if (eat == 0)
+			return len;
+	} else {
+		eat = len;
+	}
+
 	k = 0;
 	shinfo = skb_shinfo(skb);
 	for (i = 0; i < shinfo->nr_frags; i++) {
-- 
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 ` [PATCH net-next v3 5/6] tcp: fastopen: retransmit data when only the SYN of a synack-with-data is acked Jeremy Harris
2025-06-09 16:05 ` Jeremy Harris [this message]

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=5a10c22ceb84dfb72cd70a3d11f8371a68866dfc.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).