tcp: remove unnecessary update for tp->write_seq in tcp_connect()
authorxin.guo <guoxin0309@gmail.com>
Mon, 7 Oct 2024 08:25:44 +0000 (16:25 +0800)
committerJakub Kicinski <kuba@kernel.org>
Thu, 10 Oct 2024 00:58:49 +0000 (17:58 -0700)
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().

Signed-off-by: xin.guo <guoxin0309@gmail.com>
Link: https://patch.msgid.link/1728289544-4611-1-git-send-email-guoxin0309@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
net/ipv4/tcp_output.c

index 08772395690d13a0c3309a273543a51aa0dd3fdc..1251510f0e58da6b6403d2097b498f3e4cb6d255 100644 (file)
@@ -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);