Date: Mon, 24 Oct 2016 22:04:26 -0700 From: Hiren Panchasara <hiren@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r307899 - in head/sys/netinet: . cc Message-ID: <20161025050426.GE18015@strugglingcoder.info> In-Reply-To: <201610250503.u9P53XjF096540@repo.freebsd.org> References: <201610250503.u9P53XjF096540@repo.freebsd.org>
next in thread | previous in thread | raw e-mail | index | archive | help
--ILuaRSyQpoVaJ1HG Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Sigh. I'll revert this and do it right. On 10/25/16 at 05:03P, Hiren Panchasara wrote: > Author: hiren > Date: Tue Oct 25 05:03:33 2016 > New Revision: 307899 > URL: https://svnweb.freebsd.org/changeset/base/307899 >=20 > Log: > In Collaboration with: Matt Macy <mmacy at nextbsd dot com> > Reviewed by: jtl > Sponsored by: Limelight Networks > Differential Revision: https://reviews.freebsd.org/D8225 >=20 > Modified: > head/sys/netinet/cc/cc_cdg.c > head/sys/netinet/cc/cc_chd.c > head/sys/netinet/cc/cc_cubic.c > head/sys/netinet/cc/cc_dctcp.c > head/sys/netinet/cc/cc_htcp.c > head/sys/netinet/cc/cc_newreno.c > head/sys/netinet/tcp_input.c >=20 > Modified: head/sys/netinet/cc/cc_cdg.c > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- head/sys/netinet/cc/cc_cdg.c Tue Oct 25 04:14:03 2016 (r307898) > +++ head/sys/netinet/cc/cc_cdg.c Tue Oct 25 05:03:33 2016 (r307899) > @@ -431,6 +431,11 @@ static void > cdg_cong_signal(struct cc_var *ccv, uint32_t signal_type) > { > struct cdg *cdg_data =3D ccv->cc_data; > + uint32_t cwin; > + u_int mss; > + > + cwin =3D CCV(ccv, snd_cwnd); > + mss =3D CCV(ccv, t_maxseg); > =20 > switch(signal_type) { > case CC_CDG_DELAY: > @@ -448,7 +453,7 @@ cdg_cong_signal(struct cc_var *ccv, uint > */ > if (IN_CONGRECOVERY(CCV(ccv, t_flags)) || > cdg_data->queue_state < CDG_Q_FULL) { > - CCV(ccv, snd_ssthresh) =3D CCV(ccv, snd_cwnd); > + CCV(ccv, snd_ssthresh) =3D cwin; > CCV(ccv, snd_recover) =3D CCV(ccv, snd_max); > } else { > /* > @@ -461,13 +466,17 @@ cdg_cong_signal(struct cc_var *ccv, uint > cdg_data->shadow_w, RENO_BETA); > =20 > CCV(ccv, snd_ssthresh) =3D max(cdg_data->shadow_w, > - cdg_window_decrease(ccv, CCV(ccv, snd_cwnd), > - V_cdg_beta_loss)); > + cdg_window_decrease(ccv, cwin, V_cdg_beta_loss)); > + CCV(ccv, snd_cwnd) =3D CCV(ccv, snd_ssthresh); > =20 > cdg_data->window_incr =3D cdg_data->rtt_count =3D 0; > } > ENTER_RECOVERY(CCV(ccv, t_flags)); > break; > + case CC_RTO: > + CCV(ccv, snd_ssthresh) =3D max(2*mss, cwin/2); > + CCV(ccv, snd_cwnd) =3D mss; > + break; > default: > newreno_cc_algo.cong_signal(ccv, signal_type); > break; >=20 > Modified: head/sys/netinet/cc/cc_chd.c > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- head/sys/netinet/cc/cc_chd.c Tue Oct 25 04:14:03 2016 (r307898) > +++ head/sys/netinet/cc/cc_chd.c Tue Oct 25 05:03:33 2016 (r307899) > @@ -330,10 +330,14 @@ chd_cong_signal(struct cc_var *ccv, uint > struct ertt *e_t; > struct chd *chd_data; > int qdly; > + uint32_t cwin; > + u_int mss; > =20 > e_t =3D khelp_get_osd(CCV(ccv, osd), ertt_id); > chd_data =3D ccv->cc_data; > qdly =3D imax(e_t->rtt, chd_data->maxrtt_in_rtt) - e_t->minrtt; > + cwin =3D CCV(ccv, snd_cwnd); > + mss =3D CCV(ccv, t_maxseg); > =20 > switch(signal_type) { > case CC_CHD_DELAY: > @@ -373,6 +377,10 @@ chd_cong_signal(struct cc_var *ccv, uint > } > ENTER_FASTRECOVERY(CCV(ccv, t_flags)); > break; > + case CC_RTO: > + CCV(ccv, snd_ssthresh) =3D max(2*mss, cwin/2); > + CCV(ccv, snd_cwnd) =3D mss; > + break; > =20 > default: > newreno_cc_algo.cong_signal(ccv, signal_type); >=20 > Modified: head/sys/netinet/cc/cc_cubic.c > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- head/sys/netinet/cc/cc_cubic.c Tue Oct 25 04:14:03 2016 (r307898) > +++ head/sys/netinet/cc/cc_cubic.c Tue Oct 25 05:03:33 2016 (r307899) > @@ -225,8 +225,12 @@ static void > cubic_cong_signal(struct cc_var *ccv, uint32_t type) > { > struct cubic *cubic_data; > + uint32_t cwin; > + u_int mss; > =20 > cubic_data =3D ccv->cc_data; > + cwin =3D CCV(ccv, snd_cwnd); > + mss =3D CCV(ccv, t_maxseg); > =20 > switch (type) { > case CC_NDUPACK: > @@ -235,7 +239,8 @@ cubic_cong_signal(struct cc_var *ccv, ui > cubic_ssthresh_update(ccv); > cubic_data->num_cong_events++; > cubic_data->prev_max_cwnd =3D cubic_data->max_cwnd; > - cubic_data->max_cwnd =3D CCV(ccv, snd_cwnd); > + cubic_data->max_cwnd =3D cwin; > + CCV(ccv, snd_cwnd) =3D CCV(ccv, snd_ssthresh); > } > ENTER_RECOVERY(CCV(ccv, t_flags)); > } > @@ -246,7 +251,7 @@ cubic_cong_signal(struct cc_var *ccv, ui > cubic_ssthresh_update(ccv); > cubic_data->num_cong_events++; > cubic_data->prev_max_cwnd =3D cubic_data->max_cwnd; > - cubic_data->max_cwnd =3D CCV(ccv, snd_cwnd); > + cubic_data->max_cwnd =3D cwin; > cubic_data->t_last_cong =3D ticks; > CCV(ccv, snd_cwnd) =3D CCV(ccv, snd_ssthresh); > ENTER_CONGRECOVERY(CCV(ccv, t_flags)); > @@ -261,9 +266,13 @@ cubic_cong_signal(struct cc_var *ccv, ui > * chance the first one is a false alarm and may not indicate > * congestion. > */ > - if (CCV(ccv, t_rxtshift) >=3D 2) > + if (CCV(ccv, t_rxtshift) >=3D 2) { > cubic_data->num_cong_events++; > cubic_data->t_last_cong =3D ticks; > + cubic_ssthresh_update(ccv); > + cubic_data->max_cwnd =3D cwin; > + CCV(ccv, snd_cwnd) =3D mss; > + } > break; > } > } >=20 > Modified: head/sys/netinet/cc/cc_dctcp.c > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- head/sys/netinet/cc/cc_dctcp.c Tue Oct 25 04:14:03 2016 (r307898) > +++ head/sys/netinet/cc/cc_dctcp.c Tue Oct 25 05:03:33 2016 (r307899) > @@ -230,10 +230,11 @@ static void > dctcp_cong_signal(struct cc_var *ccv, uint32_t type) > { > struct dctcp *dctcp_data; > - u_int win, mss; > + uint32_t cwin; > + u_int mss; > =20 > dctcp_data =3D ccv->cc_data; > - win =3D CCV(ccv, snd_cwnd); > + cwin =3D CCV(ccv, snd_cwnd); > mss =3D CCV(ccv, t_maxseg); > =20 > switch (type) { > @@ -241,16 +242,16 @@ dctcp_cong_signal(struct cc_var *ccv, ui > if (!IN_FASTRECOVERY(CCV(ccv, t_flags))) { > if (!IN_CONGRECOVERY(CCV(ccv, t_flags))) { > CCV(ccv, snd_ssthresh) =3D mss * > - max(win / 2 / mss, 2); > + max(cwin / 2 / mss, 2); > dctcp_data->num_cong_events++; > } else { > /* cwnd has already updated as congestion > * recovery. Reverse cwnd value using > * snd_cwnd_prev and recalculate snd_ssthresh > */ > - win =3D CCV(ccv, snd_cwnd_prev); > + cwin =3D CCV(ccv, snd_cwnd_prev); > CCV(ccv, snd_ssthresh) =3D > - max(win / 2 / mss, 2) * mss; > + max(cwin / 2 / mss, 2) * mss; > } > ENTER_RECOVERY(CCV(ccv, t_flags)); > } > @@ -260,18 +261,18 @@ dctcp_cong_signal(struct cc_var *ccv, ui > * Save current snd_cwnd when the host encounters both > * congestion recovery and fast recovery. > */ > - CCV(ccv, snd_cwnd_prev) =3D win; > + CCV(ccv, snd_cwnd_prev) =3D cwin; > if (!IN_CONGRECOVERY(CCV(ccv, t_flags))) { > if (V_dctcp_slowstart && > dctcp_data->num_cong_events++ =3D=3D 0) { > CCV(ccv, snd_ssthresh) =3D > - mss * max(win / 2 / mss, 2); > + mss * max(cwin / 2 / mss, 2); > dctcp_data->alpha =3D MAX_ALPHA_VALUE; > dctcp_data->bytes_ecn =3D 0; > dctcp_data->bytes_total =3D 0; > dctcp_data->save_sndnxt =3D CCV(ccv, snd_nxt); > } else > - CCV(ccv, snd_ssthresh) =3D max((win - ((win * > + CCV(ccv, snd_ssthresh) =3D max((cwin - ((cwin * > dctcp_data->alpha) >> 11)) / mss, 2) * mss; > CCV(ccv, snd_cwnd) =3D CCV(ccv, snd_ssthresh); > ENTER_CONGRECOVERY(CCV(ccv, t_flags)); > @@ -284,6 +285,8 @@ dctcp_cong_signal(struct cc_var *ccv, ui > dctcp_update_alpha(ccv); > dctcp_data->save_sndnxt +=3D CCV(ccv, t_maxseg); > dctcp_data->num_cong_events++; > + CCV(ccv, snd_ssthresh) =3D max(2 * mss, cwin / 2); > + CCV(ccv, snd_cwnd) =3D mss; > } > break; > } >=20 > Modified: head/sys/netinet/cc/cc_htcp.c > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- head/sys/netinet/cc/cc_htcp.c Tue Oct 25 04:14:03 2016 (r307898) > +++ head/sys/netinet/cc/cc_htcp.c Tue Oct 25 05:03:33 2016 (r307899) > @@ -271,8 +271,12 @@ static void > htcp_cong_signal(struct cc_var *ccv, uint32_t type) > { > struct htcp *htcp_data; > + uint32_t cwin; > + u_int mss; > =20 > htcp_data =3D ccv->cc_data; > + cwin =3D CCV(ccv, snd_cwnd); > + mss =3D CCV(ccv, t_maxseg); > =20 > switch (type) { > case CC_NDUPACK: > @@ -287,8 +291,9 @@ htcp_cong_signal(struct cc_var *ccv, uin > (htcp_data->maxrtt - htcp_data->minrtt) * > 95) / 100; > htcp_ssthresh_update(ccv); > + CCV(ccv, snd_cwnd) =3D CCV(ccv, snd_ssthresh); > htcp_data->t_last_cong =3D ticks; > - htcp_data->prev_cwnd =3D CCV(ccv, snd_cwnd); > + htcp_data->prev_cwnd =3D cwin; > } > ENTER_RECOVERY(CCV(ccv, t_flags)); > } > @@ -305,7 +310,7 @@ htcp_cong_signal(struct cc_var *ccv, uin > htcp_ssthresh_update(ccv); > CCV(ccv, snd_cwnd) =3D CCV(ccv, snd_ssthresh); > htcp_data->t_last_cong =3D ticks; > - htcp_data->prev_cwnd =3D CCV(ccv, snd_cwnd); > + htcp_data->prev_cwnd =3D cwin; > ENTER_CONGRECOVERY(CCV(ccv, t_flags)); > } > break; > @@ -320,6 +325,8 @@ htcp_cong_signal(struct cc_var *ccv, uin > */ > if (CCV(ccv, t_rxtshift) >=3D 2) > htcp_data->t_last_cong =3D ticks; > + CCV(ccv, snd_ssthresh) =3D max(2 * mss, cwin / 2); > + CCV(ccv, snd_cwnd) =3D mss; > break; > } > } >=20 > Modified: head/sys/netinet/cc/cc_newreno.c > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- head/sys/netinet/cc/cc_newreno.c Tue Oct 25 04:14:03 2016 (r307898) > +++ head/sys/netinet/cc/cc_newreno.c Tue Oct 25 05:03:33 2016 (r307899) > @@ -182,30 +182,39 @@ newreno_after_idle(struct cc_var *ccv) > static void > newreno_cong_signal(struct cc_var *ccv, uint32_t type) > { > - u_int win; > + uint32_t cwin; > + u_int mss; > + > + cwin =3D CCV(ccv, snd_cwnd); > + mss =3D CCV(ccv, t_maxseg); > =20 > /* Catch algos which mistakenly leak private signal types. */ > KASSERT((type & CC_SIGPRIVMASK) =3D=3D 0, > ("%s: congestion signal type 0x%08x is private\n", __func__, type)); > =20 > - win =3D max(CCV(ccv, snd_cwnd) / 2 / CCV(ccv, t_maxseg), 2) * > - CCV(ccv, t_maxseg); > + cwin =3D max(2*mss, cwin/2); > =20 > switch (type) { > case CC_NDUPACK: > if (!IN_FASTRECOVERY(CCV(ccv, t_flags))) { > - if (!IN_CONGRECOVERY(CCV(ccv, t_flags))) > - CCV(ccv, snd_ssthresh) =3D win; > + if (!IN_CONGRECOVERY(CCV(ccv, t_flags))) { > + CCV(ccv, snd_ssthresh) =3D cwin; > + CCV(ccv, snd_cwnd) =3D cwin; > + } > ENTER_RECOVERY(CCV(ccv, t_flags)); > } > break; > case CC_ECN: > if (!IN_CONGRECOVERY(CCV(ccv, t_flags))) { > - CCV(ccv, snd_ssthresh) =3D win; > - CCV(ccv, snd_cwnd) =3D win; > + CCV(ccv, snd_ssthresh) =3D cwin; > + CCV(ccv, snd_cwnd) =3D cwin; > ENTER_CONGRECOVERY(CCV(ccv, t_flags)); > } > break; > + case CC_RTO: > + CCV(ccv, snd_ssthresh) =3D cwin; > + CCV(ccv, snd_cwnd) =3D mss; > + break; > } > } > =20 >=20 > Modified: head/sys/netinet/tcp_input.c > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- head/sys/netinet/tcp_input.c Tue Oct 25 04:14:03 2016 (r307898) > +++ head/sys/netinet/tcp_input.c Tue Oct 25 05:03:33 2016 (r307899) > @@ -438,9 +438,15 @@ cc_cong_signal(struct tcpcb *tp, struct=20 > tp->t_dupacks =3D 0; > tp->t_bytes_acked =3D 0; > EXIT_RECOVERY(tp->t_flags); > - tp->snd_ssthresh =3D max(2, min(tp->snd_wnd, tp->snd_cwnd) / 2 / > - maxseg) * maxseg; > - tp->snd_cwnd =3D maxseg; > + if (CC_ALGO(tp)->cong_signal =3D=3D NULL) { > + /* > + * RFC5681 Section 3.1=20 > + * ssthresh =3D max (FlightSize / 2, 2*SMSS) eq (4) > + */ > + tp->snd_ssthresh =3D > + max((tp->snd_max - tp->snd_una) / 2, 2 * maxseg); > + tp->snd_cwnd =3D maxseg; > + } > break; > case CC_RTO_ERR: > TCPSTAT_INC(tcps_sndrexmitbad); > @@ -2613,6 +2619,15 @@ tcp_do_segment(struct mbuf *m, struct tc > =20 > if (awnd < tp->snd_ssthresh) { > tp->snd_cwnd +=3D maxseg; > + /* > + * RFC5681 Section 3.2 talks about cwnd > + * inflation on additional dupacks and > + * deflation on recovering from loss. > + * > + * We keep cwnd into check so that > + * we don't have to 'deflate' it when we > + * get out of recovery. > + */ > if (tp->snd_cwnd > tp->snd_ssthresh) > tp->snd_cwnd =3D tp->snd_ssthresh; > } > @@ -2652,19 +2667,22 @@ tcp_do_segment(struct mbuf *m, struct tc > TCPSTAT_INC( > tcps_sack_recovery_episode); > tp->sack_newdata =3D tp->snd_nxt; > - tp->snd_cwnd =3D maxseg; > + if (CC_ALGO(tp)->cong_signal =3D=3D NULL) > + tp->snd_cwnd =3D maxseg; > (void) tp->t_fb->tfb_tcp_output(tp); > goto drop; > } > tp->snd_nxt =3D th->th_ack; > - tp->snd_cwnd =3D maxseg; > + if (CC_ALGO(tp)->cong_signal =3D=3D NULL) > + tp->snd_cwnd =3D maxseg; > (void) tp->t_fb->tfb_tcp_output(tp); > KASSERT(tp->snd_limited <=3D 2, > ("%s: tp->snd_limited too big", > __func__)); > - tp->snd_cwnd =3D tp->snd_ssthresh + > - maxseg * > - (tp->t_dupacks - tp->snd_limited); > + if (CC_ALGO(tp)->cong_signal =3D=3D NULL) > + tp->snd_cwnd =3D tp->snd_ssthresh + > + maxseg * > + (tp->t_dupacks - tp->snd_limited); > if (SEQ_GT(onxt, tp->snd_nxt)) > tp->snd_nxt =3D onxt; > goto drop; >=20 --ILuaRSyQpoVaJ1HG Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQF8BAABCgBmBQJYDufXXxSAAAAAAC4AKGlzc3Vlci1mcHJAbm90YXRpb25zLm9w ZW5wZ3AuZmlmdGhob3JzZW1hbi5uZXRBNEUyMEZBMUQ4Nzg4RjNGMTdFNjZGMDI4 QjkyNTBFMTU2M0VERkU1AAoJEIuSUOFWPt/lT5QH/1HNZsJL3YglDEKXtFulhE2A xOsHGLPpWr3+qudZP8h9H0euOk1SfxqAatKpagJOZBcEz3wwuYUr+cGzxAZ8l6cQ 81n549mEx1n180Sr2jA8Hpq3sKGalnLSPNMwcomGaFvEa098XUyIjp9VAKmrPj0B kPUBwnNZbwgHiRJ+fOxf4zUiLAQH7XlHsMl2YikgtJLWn0vqhVbffrWvYMh9LMOm 0GQHIZiKveBtLlOSlyPI5u6sp9omKeE3weB8BFtpCAWxoOGxG//AubEyVUw3zE4p 2MtvEjlkMnIK/mYmbj70NCXY8HFA9E26rnKH2ZcRVGc2p59ZMo7JQiB7ZjksxAM= =oYl+ -----END PGP SIGNATURE----- --ILuaRSyQpoVaJ1HG--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20161025050426.GE18015>