Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 20 Aug 2002 14:28:05 -0700 (PDT)
From:      Oleg Polyakov <opolyakov@yahoo.com>
To:        freebsd-net@freebsd.org
Subject:   Re: Initial congestion window increase
Message-ID:  <20020820212805.58712.qmail@web10408.mail.yahoo.com>

next in thread | raw e-mail | index | archive | help
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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20020820212805.58712.qmail>