netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next v2] tcp: remove unnecessary update for tp->write_seq in tcp_connect()
@ 2024-10-05 15:58 xin.guo
  2024-10-05 17:40 ` Neal Cardwell
  0 siblings, 1 reply; 3+ messages in thread
From: xin.guo @ 2024-10-05 15:58 UTC (permalink / raw)
  To: edumazet; +Cc: netdev, xin.guo

From: "xin.guo" <guoxin0309@gmail.com>

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>
---
 net/ipv4/tcp_output.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c
index 4fd746b..ee8ab9a 100644
--- a/net/ipv4/tcp_output.c
+++ b/net/ipv4/tcp_output.c
@@ -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);
-- 
1.8.3.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH net-next v2] tcp: remove unnecessary update for tp->write_seq in tcp_connect()
  2024-10-05 15:58 [PATCH net-next v2] tcp: remove unnecessary update for tp->write_seq in tcp_connect() xin.guo
@ 2024-10-05 17:40 ` Neal Cardwell
  2024-10-06 14:31   ` Xin Guo
  0 siblings, 1 reply; 3+ messages in thread
From: Neal Cardwell @ 2024-10-05 17:40 UTC (permalink / raw)
  To: xin.guo; +Cc: edumazet, netdev

On Sat, Oct 5, 2024 at 11:58 AM xin.guo <guoxin0309@gmail.com> wrote:
>
> From: "xin.guo" <guoxin0309@gmail.com>
>
> Commit 783237e8daf13("net-tcp: Fast Open client - sending SYN-data")

To match Linux commit message style, please insert a space between the
SHA1 and the patch title, like so:

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>
> ---
>  net/ipv4/tcp_output.c | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c
> index 4fd746b..ee8ab9a 100644
> --- a/net/ipv4/tcp_output.c
> +++ b/net/ipv4/tcp_output.c
> @@ -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);
> --

As in the example provided by Eric, please use Linux kernel C comment
style, which places a space character between the * and the first
character of the comment text on each line. For example:

/* SYN eats a sequence byte, write_seq is updated by
 * tcp_connect_queue_skb().
 */

For more information, see:

https://www.kernel.org/doc/html/v6.11/process/coding-style.html#commenting

thanks,
neal

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH net-next v2] tcp: remove unnecessary update for tp->write_seq in tcp_connect()
  2024-10-05 17:40 ` Neal Cardwell
@ 2024-10-06 14:31   ` Xin Guo
  0 siblings, 0 replies; 3+ messages in thread
From: Xin Guo @ 2024-10-06 14:31 UTC (permalink / raw)
  To: Neal Cardwell; +Cc: edumazet, netdev

Thanks neal, my bad,
I will read the document and post v3 for this patch

On Sun, Oct 6, 2024 at 1:40 AM Neal Cardwell <ncardwell@google.com> wrote:
>
> On Sat, Oct 5, 2024 at 11:58 AM xin.guo <guoxin0309@gmail.com> wrote:
> >
> > From: "xin.guo" <guoxin0309@gmail.com>
> >
> > Commit 783237e8daf13("net-tcp: Fast Open client - sending SYN-data")
>
> To match Linux commit message style, please insert a space between the
> SHA1 and the patch title, like so:
>
> 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>
> > ---
> >  net/ipv4/tcp_output.c | 5 ++++-
> >  1 file changed, 4 insertions(+), 1 deletion(-)
> >
> > diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c
> > index 4fd746b..ee8ab9a 100644
> > --- a/net/ipv4/tcp_output.c
> > +++ b/net/ipv4/tcp_output.c
> > @@ -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);
> > --
>
> As in the example provided by Eric, please use Linux kernel C comment
> style, which places a space character between the * and the first
> character of the comment text on each line. For example:
>
> /* SYN eats a sequence byte, write_seq is updated by
>  * tcp_connect_queue_skb().
>  */
>
> For more information, see:
>
> https://www.kernel.org/doc/html/v6.11/process/coding-style.html#commenting
>
> thanks,
> neal

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-10-06 14:31 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-10-05 15:58 [PATCH net-next v2] tcp: remove unnecessary update for tp->write_seq in tcp_connect() xin.guo
2024-10-05 17:40 ` Neal Cardwell
2024-10-06 14:31   ` Xin Guo

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).