Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 21 Aug 2002 13:40:25 -0700 (PDT)
From:      Oleg Polyakov <opolyakov@yahoo.com>
To:        freebsd-net@FreeBSD.org
Subject:   Re: Initial congestion window increase
Message-ID:  <20020821204025.33297.qmail@web10408.mail.yahoo.com>
In-Reply-To: <0H1500FJLZIPYE@mta6.snfc21.pbi.net>

next in thread | previous in thread | raw e-mail | index | archive | help
--- Jeffrey Hsu <hsu@FreeBSD.org> wrote:
> Your copy of -current is a little out of date.  I removed that hideous
> INET6 #ifdef last week.

Here is updated diff.

--- tcp_input.c.orig	Mon Aug 19 19:47:11 2002
+++ tcp_input.c	Wed Aug 21 11:12:24 2002
@@ -114,6 +114,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,
@@ -2495,6 +2499,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.
  *
@@ -2686,7 +2691,9 @@
 	if ((isipv6 && in6_localaddr(&inp->in6p_faddr)) ||
 	    (!isipv6 && in_localaddr(inp->inp_faddr)))
 		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	Sat Aug 17 18:26:01 2002
+++ tcp_output.c	Wed Aug 21 11:12:24 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	Sat Aug 17 18:26:02 2002
+++ tcp_subr.c	Wed Aug 21 11:12:24 2002
@@ -1408,6 +1408,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	Sat Aug 17 18:26:02 2002
+++ tcp_var.h	Wed Aug 21 11:12:24 2002
@@ -442,6 +442,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?20020821204025.33297.qmail>