Skip to contentSkip to conversation

tcp: remove unnecessary update for tp->write_seq in tcp_connect()

PATCH Applied xin.guo 2 participants 2 messages Oct 7, 2024 – Oct 10, 2024

Subsystems (3)
lore
Share & tools
lore

xin.guo

author
#0 lore raw

PATCH v3 1/1 tcp: remove unnecessary update for tp->write_seq in tcp_connect()

From: "xin.guo" <[email protected]>

Commit 783237e8daf13 ("net-tcp: Fast Open client - sending SYN-data") introduces tcp_connect_queue_skb() and it would overwrite tcp->write_seq, so it is no need to update tp->write_seq before invoking tcp_connect_queue_skb().

---
v3: Fix the style issue.
v2: Add comment to explain when to update write_seq.

---
 net/ipv4/tcp_output.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
net/ipv4/tcp_output.c +4 -1
index 4fd746b..ab4e03a 100644
@@ -4134,7 +4134,10 @@ int tcp_connect(struct sock *sk)
 	if (unlikely(!buff))
 		return -ENOBUFS;
 
-	tcp_init_nondata_skb(buff, tp->write_seq++, TCPHDR_SYN);
+	/* SYN eats a sequence byte, write_seq updated by
+	 * tcp_connect_queue_skb().
+	 */
+	tcp_init_nondata_skb(buff, tp->write_seq, TCPHDR_SYN);
 	tcp_mstamp_refresh(tp);
 	tp->retrans_stamp = tcp_time_stamp_ts(tp);
 	tcp_connect_queue_skb(sk, buff);
Signature · 1 line
1.8.3.1
#1 lore raw
This patch was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:

Hello:

This patch was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:

Quoted 8 lines · On Mon, 7 Oct 2024 16:25:44 +0800 you wrote:

From: "xin.guo" <[email protected]>

Commit 783237e8daf13 ("net-tcp: Fast Open client - sending SYN-data") introduces tcp_connect_queue_skb() and it would overwrite tcp->write_seq, so it is no need to update tp->write_seq before invoking tcp_connect_queue_skb().

[...]

Here is the summary with links:
- [net-next,v3] tcp: remove unnecessary update for tp->write_seq in tcp_connect()

    https://git.kernel.org/netdev/net-next/c/d35bd24cea94

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html