Date: Tue, 21 Apr 2020 13:05:44 +0000 (UTC) From: Richard Scheffenegger <rscheff@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r360143 - in head/sys/netinet: . tcp_stacks Message-ID: <202004211305.03LD5im9045434@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: rscheff Date: Tue Apr 21 13:05:44 2020 New Revision: 360143 URL: https://svnweb.freebsd.org/changeset/base/360143 Log: Correctly set up the initial TCP congestion window in all cases, by adjust snd_una right after the connection initialization, to include the one byte in sequence space occupied by the SYN bit. This does not change the regular ACK processing, while making the BYTES_THIS_ACK macro to work properly. PR: 235256 Reviewed by: tuexen (mentor), rgrimes (mentor) Approved by: tuexen (mentor), rgrimes (mentor) MFC after: 2 weeks Sponsored by: NetApp, Inc. Differential Revision: https://reviews.freebsd.org/D19000 Modified: head/sys/netinet/tcp_input.c head/sys/netinet/tcp_stacks/bbr.c head/sys/netinet/tcp_stacks/rack.c Modified: head/sys/netinet/tcp_input.c ============================================================================== --- head/sys/netinet/tcp_input.c Tue Apr 21 05:00:35 2020 (r360142) +++ head/sys/netinet/tcp_input.c Tue Apr 21 13:05:44 2020 (r360143) @@ -2374,12 +2374,6 @@ tcp_do_segment(struct mbuf *m, struct tcphdr *th, stru if (IS_FASTOPEN(tp->t_flags) && tp->t_tfo_pending) { tcp_fastopen_decrement_counter(tp->t_tfo_pending); tp->t_tfo_pending = NULL; - - /* - * Account for the ACK of our SYN prior to - * regular ACK processing below. - */ - tp->snd_una++; } if (tp->t_flags & TF_NEEDFIN) { tcp_state_change(tp, TCPS_FIN_WAIT_1); @@ -2399,6 +2393,12 @@ tcp_do_segment(struct mbuf *m, struct tcphdr *th, stru cc_conn_init(tp); tcp_timer_activate(tp, TT_KEEP, TP_KEEPIDLE(tp)); } + if (SEQ_GT(th->th_ack, tp->snd_una)) + /* + * Account for the ACK of our SYN prior to + * regular ACK processing below. + */ + tp->snd_una++; /* * If segment contains data or ACK, will call tcp_reass() * later; if not, do so now to pass queued data to user. Modified: head/sys/netinet/tcp_stacks/bbr.c ============================================================================== --- head/sys/netinet/tcp_stacks/bbr.c Tue Apr 21 05:00:35 2020 (r360142) +++ head/sys/netinet/tcp_stacks/bbr.c Tue Apr 21 13:05:44 2020 (r360143) @@ -9325,11 +9325,6 @@ bbr_do_syn_recv(struct mbuf *m, struct tcphdr *th, str tcp_fastopen_decrement_counter(tp->t_tfo_pending); tp->t_tfo_pending = NULL; - /* - * Account for the ACK of our SYN prior to regular - * ACK processing below. - */ - tp->snd_una++; } /* * Make transitions: SYN-RECEIVED -> ESTABLISHED SYN-RECEIVED* -> @@ -9352,6 +9347,12 @@ bbr_do_syn_recv(struct mbuf *m, struct tcphdr *th, str if (!IS_FASTOPEN(tp->t_flags)) cc_conn_init(tp); } + if (SEQ_GT(th->th_ack, tp->snd_una)) + /* + * Account for the ACK of our SYN prior to + * regular ACK processing below. + */ + tp->snd_una++; /* * If segment contains data or ACK, will call tcp_reass() later; if * not, do so now to pass queued data to user. Modified: head/sys/netinet/tcp_stacks/rack.c ============================================================================== --- head/sys/netinet/tcp_stacks/rack.c Tue Apr 21 05:00:35 2020 (r360142) +++ head/sys/netinet/tcp_stacks/rack.c Tue Apr 21 13:05:44 2020 (r360143) @@ -6539,12 +6539,6 @@ rack_do_syn_recv(struct mbuf *m, struct tcphdr *th, st if (IS_FASTOPEN(tp->t_flags) && tp->t_tfo_pending) { tcp_fastopen_decrement_counter(tp->t_tfo_pending); tp->t_tfo_pending = NULL; - - /* - * Account for the ACK of our SYN prior to - * regular ACK processing below. - */ - tp->snd_una++; } if (tp->t_flags & TF_NEEDFIN) { tcp_state_change(tp, TCPS_FIN_WAIT_1); @@ -6562,6 +6556,12 @@ rack_do_syn_recv(struct mbuf *m, struct tcphdr *th, st if (!IS_FASTOPEN(tp->t_flags)) cc_conn_init(tp); } + if (SEQ_GT(th->th_ack, tp->snd_una)) + /* + * Account for the ACK of our SYN prior to + * regular ACK processing below. + */ + tp->snd_una++; /* * If segment contains data or ACK, will call tcp_reass() later; if * not, do so now to pass queued data to user.
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202004211305.03LD5im9045434>