Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 28 Oct 2012 17:25:09 +0000 (UTC)
From:      Andre Oppermann <andre@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r242250 - head/sys/netinet
Message-ID:  <201210281725.q9SHP9Sw061865@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: andre
Date: Sun Oct 28 17:25:08 2012
New Revision: 242250
URL: http://svn.freebsd.org/changeset/base/242250

Log:
  When SYN or SYN/ACK had to be retransmitted RFC5681 requires us to
  reduce the initial CWND to one segment.  This reduction got lost
  some time ago due to a change in initialization ordering.
  
  Additionally in tcp_timer_rexmt() avoid entering fast recovery when
  we're still in TCPS_SYN_SENT state.
  
  MFC after:	2 weeks

Modified:
  head/sys/netinet/tcp_input.c
  head/sys/netinet/tcp_syncache.c
  head/sys/netinet/tcp_timer.c

Modified: head/sys/netinet/tcp_input.c
==============================================================================
--- head/sys/netinet/tcp_input.c	Sun Oct 28 17:16:09 2012	(r242249)
+++ head/sys/netinet/tcp_input.c	Sun Oct 28 17:25:08 2012	(r242250)
@@ -345,10 +345,16 @@ cc_conn_init(struct tcpcb *tp)
 	/*
 	 * Set the initial slow-start flight size.
 	 *
-	 * RFC3390 says only do this if SYN or SYN/ACK didn't got lost.
-	 * XXX: We currently check only in syncache_socket for that.
-	 */
-	if (V_tcp_do_rfc3390)
+	 * RFC5681 Section 3.1 specifies the default conservative values.
+	 * RFC3390 specifies slightly more aggressive values.
+	 *
+	 * If a SYN or SYN/ACK was lost and retransmitted, we have to
+	 * reduce the initial CWND to one segment as congestion is likely
+	 * requiring us to be cautious.
+	 */
+	if (tp->snd_cwnd == 1)
+		tp->snd_cwnd = tp->t_maxseg;		/* SYN(-ACK) lost */
+	else if (V_tcp_do_rfc3390)
 		tp->snd_cwnd = min(4 * tp->t_maxseg,
 		    max(2 * tp->t_maxseg, 4380));
 	else {

Modified: head/sys/netinet/tcp_syncache.c
==============================================================================
--- head/sys/netinet/tcp_syncache.c	Sun Oct 28 17:16:09 2012	(r242249)
+++ head/sys/netinet/tcp_syncache.c	Sun Oct 28 17:25:08 2012	(r242250)
@@ -852,11 +852,12 @@ syncache_socket(struct syncache *sc, str
 	tcp_mss(tp, sc->sc_peer_mss);
 
 	/*
-	 * If the SYN,ACK was retransmitted, reset cwnd to 1 segment.
+	 * If the SYN,ACK was retransmitted, indicate that CWND to be
+	 * limited to one segment in cc_conn_init().
 	 * NB: sc_rxmits counts all SYN,ACK transmits, not just retransmits.
 	 */
 	if (sc->sc_rxmits > 1)
-		tp->snd_cwnd = tp->t_maxseg;
+		tp->snd_cwnd = 1;
 
 #ifdef TCP_OFFLOAD
 	/*

Modified: head/sys/netinet/tcp_timer.c
==============================================================================
--- head/sys/netinet/tcp_timer.c	Sun Oct 28 17:16:09 2012	(r242249)
+++ head/sys/netinet/tcp_timer.c	Sun Oct 28 17:25:08 2012	(r242250)
@@ -539,7 +539,13 @@ tcp_timer_rexmt(void * xtp)
 	}
 	INP_INFO_RUNLOCK(&V_tcbinfo);
 	headlocked = 0;
-	if (tp->t_rxtshift == 1) {
+	if (tp->t_state == TCPS_SYN_SENT) {
+		/*
+		 * If the SYN was retransmitted, indicate CWND to be
+		 * limited to 1 segment in cc_conn_init().
+		 */
+		tp->snd_cwnd = 1;
+	} else if (tp->t_rxtshift == 1) {
 		/*
 		 * first retransmit; record ssthresh and cwnd so they can
 		 * be recovered if this turns out to be a "bad" retransmit.



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