tcp: remove unnecessary update for tp->write_seq in tcp_connect()
Subsystems (3)
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
@@ -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
Quoted 27 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 overwritetcp->write_seq, so it is no need to updatetp->write_seqbefore invokingtcp_connect_queue_skb()Signed-off-by xin.guo <[email protected]>--- net/ipv4/tcp_output.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)net/ipv4/tcp_output.c +1
-2@@ -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); --
Quoted 2 lines
1.8.3.1
At line 3616, there is this comment :
/* FIN eats a sequence byte, write_seq advanced by tcp_queue_skb(). */
I think you need to add a similar one. Future readers will thank you.
net/ipv4/tcp_output.c +0 -0
100644
net/ipv4/tcp_output.c +4 -1
@@ -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);
Thanks Eric, I will send v2 for this patch.
Quoted 55 lines · Eric Dumazet
Quoted 27 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 overwritetcp->write_seq, so it is no need to updatetp->write_seqbefore invokingtcp_connect_queue_skb()Signed-off-by xin.guo <[email protected]>--- net/ipv4/tcp_output.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)net/ipv4/tcp_output.c +1
-2@@ -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); --Quoted 2 lines
1.8.3.1
At line 3616, there is this comment :
/* FIN eats a sequence byte,
write_seqadvanced bytcp_queue_skb(). */I think you need to add a similar one. Future readers will thank you.
net/ipv4/tcp_output.c +0
-0100644
net/ipv4/tcp_output.c +4
-1@@ -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);