From owner-freebsd-net Tue Aug 20 14:28:15 2002 Delivered-To: freebsd-net@freebsd.org Received: from mx1.FreeBSD.org (mx1.FreeBSD.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 3F0C137B407 for ; Tue, 20 Aug 2002 14:28:06 -0700 (PDT) Received: from web10408.mail.yahoo.com (web10408.mail.yahoo.com [216.136.130.110]) by mx1.FreeBSD.org (Postfix) with SMTP id 0798D43E42 for ; Tue, 20 Aug 2002 14:28:06 -0700 (PDT) (envelope-from opolyakov@yahoo.com) Message-ID: <20020820212805.58712.qmail@web10408.mail.yahoo.com> Received: from [67.112.212.200] by web10408.mail.yahoo.com via HTTP; Tue, 20 Aug 2002 14:28:05 PDT Date: Tue, 20 Aug 2002 14:28:05 -0700 (PDT) From: Oleg Polyakov Subject: Re: Initial congestion window increase To: freebsd-net@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Sender: owner-freebsd-net@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org Attached below revamped patches to introduce RFC 2414 - 'Increasing TCP's Initial Window' to FreeBSD. Patches add sysctl variable - net.inet.tcp.increased_initial_window which is turned off by now. They also change initial and restart congestion windows in accordance with RFC. The restart window value set to minimum between initial window and current congestion window. The change in tcp_subr.c for cwnd decreasing in case of MTU discovery lowering mss is about the same as in OpenBSD, which as far as I can tell implementing only that part of RFC 2414. Suggestions and opinions are appreciated. ---- Oleg --- tcp_input.c.orig Wed Jul 31 19:06:49 2002 +++ tcp_input.c Thu Aug 15 13:59:19 2002 @@ -121,6 +121,10 @@ &tcp_delack_enabled, 0, "Delay ACK to try and piggyback it onto a data packet"); +int inc_init_win = 0; +SYSCTL_INT(_net_inet_tcp, OID_AUTO, increased_initial_window, CTLFLAG_RW, + &inc_init_win, 1, "Increased initial window"); + #ifdef TCP_DROP_SYNFIN static int drop_synfin = 0; SYSCTL_INT(_net_inet_tcp, OID_AUTO, drop_synfin, CTLFLAG_RW, @@ -2492,6 +2496,7 @@ * of the interface), as we can't discover anything about intervening * gateways or networks. We also initialize the congestion/slow start * window to be a single segment if the destination isn't local. + * We may increase the congestion/slow start window in accordance with RFC2414. * While looking at the routing entry, we also initialize other path-dependent * parameters from pre-set or cached values in the routing entry. * @@ -2710,7 +2715,9 @@ #endif ) tp->snd_cwnd = mss * ss_fltsz_local; - else + else if (inc_init_win) + tp->snd_cwnd = min(4*mss, max(2*mss,4380)); + else tp->snd_cwnd = mss * ss_fltsz; if (rt->rt_rmx.rmx_ssthresh) { --- tcp_output.c.orig Thu Aug 15 13:55:52 2002 +++ tcp_output.c Fri Aug 16 13:24:40 2002 @@ -146,16 +146,22 @@ * Set the slow-start flight size depending on whether * this is a local network or not. */ - int ss = ss_fltsz; + if ( #ifdef INET6 - if (isipv6) { - if (in6_localaddr(&tp->t_inpcb->in6p_faddr)) - ss = ss_fltsz_local; - } else + (isipv6 && in6_localaddr(&tp->t_inpcb->in6p_faddr)) || + (!isipv6 && #endif /* INET6 */ - if (in_localaddr(tp->t_inpcb->inp_faddr)) - ss = ss_fltsz_local; - tp->snd_cwnd = tp->t_maxseg * ss; + in_localaddr(tp->t_inpcb->inp_faddr) +#ifdef INET6 + ) +#endif /* INET6 */ + ) + tp->snd_cwnd = tp->t_maxseg * ss_fltsz_local; + else if (inc_init_win) + tp->snd_cwnd = min(tp->snd_cwnd,min(4*tp->t_maxseg, + max(2*tp->t_maxseg,4380))); + else + tp->snd_cwnd = tp->t_maxseg * ss_fltsz; } tp->t_flags &= ~TF_LASTIDLE; if (idle) { --- tcp_subr.c.orig Thu Aug 1 03:54:43 2002 +++ tcp_subr.c Fri Aug 16 14:52:16 2002 @@ -1385,6 +1385,14 @@ #endif if (so->so_snd.sb_hiwat < mss) mss = so->so_snd.sb_hiwat; + /* + * Follow suggestion in RFC 2414 to reduce the congestion + * window by the ratio of the old segment size to the new + * segment size. + */ + if (mss < tp->t_maxseg) + tp->snd_cwnd = max((tp->snd_cwnd / tp->t_maxseg) * + mss, mss); tp->t_maxseg = mss; --- tcp_var.h.orig Mon Aug 12 15:53:19 2002 +++ tcp_var.h Fri Aug 16 15:44:57 2002 @@ -436,6 +436,7 @@ extern int path_mtu_discovery; extern int ss_fltsz; extern int ss_fltsz_local; +extern int inc_init_win; void tcp_canceltimers(struct tcpcb *); struct tcpcb * __________________________________________________ Do You Yahoo!? HotJobs - Search Thousands of New Jobs http://www.hotjobs.com To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-net" in the body of the message