diff mbox series

[net-next,v2] tcp: remove unnecessary update for tp->write_seq in tcp_connect()

Message ID 1728143915-7777-1-git-send-email-guoxin0309@gmail.com (mailing list archive)
State Superseded
Delegated to: Netdev Maintainers
Headers show
Series [net-next,v2] tcp: remove unnecessary update for tp->write_seq in tcp_connect() | expand

Checks

Context Check Description
netdev/series_format success Single patches do not need cover letters
netdev/tree_selection success Clearly marked for net-next
netdev/ynl success Generated files up to date; no warnings/errors; no diff in generated;
netdev/fixes_present success Fixes tag not required for -next series
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 6 this patch: 6
netdev/build_tools success No tools touched, skip
netdev/cc_maintainers warning 3 maintainers not CCed: pabeni@redhat.com dsahern@kernel.org kuba@kernel.org
netdev/build_clang success Errors and warnings before: 8 this patch: 8
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/deprecated_api success None detected
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success No Fixes tag
netdev/build_allmodconfig_warn success Errors and warnings before: 5 this patch: 5
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 11 lines checked
netdev/build_clang_rust success No Rust files in patch. Skipping build
netdev/kdoc success Errors and warnings before: 1 this patch: 1
netdev/source_inline success Was 0 now: 0
netdev/contest success net-next-2024-10-06--15-00 (tests: 775)

Commit Message

xin.guo Oct. 5, 2024, 3:58 p.m. UTC
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(-)

Comments

Neal Cardwell Oct. 5, 2024, 5:40 p.m. UTC | #1
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
xin.guo Oct. 6, 2024, 2:31 p.m. UTC | #2
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
diff mbox series

Patch

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