From owner-svn-src-user@FreeBSD.ORG Thu Mar 1 16:04:25 2012 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BCDCF106566C; Thu, 1 Mar 2012 16:04:25 +0000 (UTC) (envelope-from andre@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 9DAA08FC0C; Thu, 1 Mar 2012 16:04:25 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q21G4PJY085931; Thu, 1 Mar 2012 16:04:25 GMT (envelope-from andre@svn.freebsd.org) Received: (from andre@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q21G4PXj085927; Thu, 1 Mar 2012 16:04:25 GMT (envelope-from andre@svn.freebsd.org) Message-Id: <201203011604.q21G4PXj085927@svn.freebsd.org> From: Andre Oppermann Date: Thu, 1 Mar 2012 16:04:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r232344 - user/andre/tcp_workqueue/sys/netinet X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 01 Mar 2012 16:04:25 -0000 Author: andre Date: Thu Mar 1 16:04:25 2012 New Revision: 232344 URL: http://svn.freebsd.org/changeset/base/232344 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 initialization ordering. Modified: user/andre/tcp_workqueue/sys/netinet/tcp_input.c user/andre/tcp_workqueue/sys/netinet/tcp_syncache.c user/andre/tcp_workqueue/sys/netinet/tcp_timer.c Modified: user/andre/tcp_workqueue/sys/netinet/tcp_input.c ============================================================================== --- user/andre/tcp_workqueue/sys/netinet/tcp_input.c Thu Mar 1 15:51:19 2012 (r232343) +++ user/andre/tcp_workqueue/sys/netinet/tcp_input.c Thu Mar 1 16:04:25 2012 (r232344) @@ -341,10 +341,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: user/andre/tcp_workqueue/sys/netinet/tcp_syncache.c ============================================================================== --- user/andre/tcp_workqueue/sys/netinet/tcp_syncache.c Thu Mar 1 15:51:19 2012 (r232343) +++ user/andre/tcp_workqueue/sys/netinet/tcp_syncache.c Thu Mar 1 16:04:25 2012 (r232344) @@ -840,11 +840,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; /* * Copy and activate timers. Modified: user/andre/tcp_workqueue/sys/netinet/tcp_timer.c ============================================================================== --- user/andre/tcp_workqueue/sys/netinet/tcp_timer.c Thu Mar 1 15:51:19 2012 (r232343) +++ user/andre/tcp_workqueue/sys/netinet/tcp_timer.c Thu Mar 1 16:04:25 2012 (r232344) @@ -510,7 +510,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.