Skip to contentSkip to conversation

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

PATCH In review xin.guo 2 participants 2 messages Sep 23, 2024

Subsystems (3)
lore
Share & tools
lore

xin.guo

author
#0 lore raw

PATCH 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") introduce 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()

---
 net/ipv4/tcp_output.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
net/ipv4/tcp_output.c +1 -1
index 4fd746b..f255c7d 100644
@@ -4134,7 +4134,7 @@ int tcp_connect(struct sock *sk)
 	if (unlikely(!buff))
 		return -ENOBUFS;
 
-	tcp_init_nondata_skb(buff, tp->write_seq++, TCPHDR_SYN);
+	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
Quoted 18 lines · xin.guo

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

Commit 783237e8daf13("net-tcp: Fast Open client - sending SYN-data") introduce 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()

---
 net/ipv4/tcp_output.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
net/ipv4/tcp_output.c +0 -0
index 4fd746b..f255c7d 100644

net/ipv4/tcp_output.c int tcp_connect(struct sock *sk) · line 4140

Quoted 8 lines
net/ipv4/tcp_output.c +1 -1
@@ -4134,7 +4134,7 @@ int tcp_connect(struct sock *sk)
        if (unlikely(!buff))
                return -ENOBUFS;
 
-       tcp_init_nondata_skb(buff, tp->write_seq++, TCPHDR_SYN);
+       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);

This seems fine, but net-next is currently closed.

Documentation/process/maintainer-netdev.rst for the details.