From owner-p4-projects@FreeBSD.ORG Sun Jul 3 19:27:06 2011 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id C02181065672; Sun, 3 Jul 2011 19:27:06 +0000 (UTC) Delivered-To: perforce@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6A7A0106564A for ; Sun, 3 Jul 2011 19:27:06 +0000 (UTC) (envelope-from cnicutar@freebsd.org) Received: from skunkworks.freebsd.org (skunkworks.freebsd.org [IPv6:2001:4f8:fff6::2d]) by mx1.freebsd.org (Postfix) with ESMTP id 50C878FC1D for ; Sun, 3 Jul 2011 19:27:06 +0000 (UTC) Received: from skunkworks.freebsd.org (localhost [127.0.0.1]) by skunkworks.freebsd.org (8.14.4/8.14.4) with ESMTP id p63JR5kd091170 for ; Sun, 3 Jul 2011 19:27:05 GMT (envelope-from cnicutar@freebsd.org) Received: (from perforce@localhost) by skunkworks.freebsd.org (8.14.4/8.14.4/Submit) id p63JR5XI091167 for perforce@freebsd.org; Sun, 3 Jul 2011 19:27:05 GMT (envelope-from cnicutar@freebsd.org) Date: Sun, 3 Jul 2011 19:27:05 GMT Message-Id: <201107031927.p63JR5XI091167@skunkworks.freebsd.org> X-Authentication-Warning: skunkworks.freebsd.org: perforce set sender to cnicutar@freebsd.org using -f From: Catalin Nicutar To: Perforce Change Reviews Precedence: bulk Cc: Subject: PERFORCE change 195682 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 03 Jul 2011 19:27:07 -0000 http://p4web.freebsd.org/@@195682?ac=10 Change 195682 by cnicutar@cnicutar_cronos on 2011/07/03 19:26:51 Keep retransmitting after TCP_MAXRXTSHIFT retransmits at a fixed rate (TCPTV_REXMTMAX). In the future all retransmits could possibly be stretched over the entire UTO period. Affected files ... .. //depot/projects/soc2011/cnicutar_tcputo_8/src/sys/netinet/tcp_timer.c#4 edit Differences ... ==== //depot/projects/soc2011/cnicutar_tcputo_8/src/sys/netinet/tcp_timer.c#4 (text+ko) ==== @@ -490,21 +490,24 @@ tcp_free_sackholes(tp); if (tp->t_rxtshift == 0) - tp->t_suto = 0; + /* UTO starting again since it's the first retransmit. */ + tp->t_suto = 0; if ((tp->t_flags & TF_SND_UTO) || ((tp->t_flags & TF_RCV_UTO) && tp->rcv_uto)) { - /* Using UTO for this connection. */ + /* + * Since we're using UTO for this connection we need to + * compute how much time we've got left. + */ uto_left = max(tp->snd_uto, tp->rcv_uto); - if (tp->t_suto) { + if (tp->t_suto) uto_left -= ticks_to_secs(ticks - tp->t_suto); - } /* * The user may choose a value that's less than TCP_MAXRXTSHIFT * retransmits. */ - if (tp->t_rxtshift > TCP_MAXRXTSHIFT || uto_left <= 0) { + if (uto_left <= 0) { /* Before or after the retransmits, UTO was exceeded. */ TCPSTAT_INC(tcps_timeoutdrop); tp = tcp_drop(tp, ETIMEDOUT); @@ -516,21 +519,14 @@ * Retransmission timer went off. Message has not * been acked within retransmit interval. Back off * to a longer retransmit interval and retransmit one segment. + * If using UTO, don't drop. t_rxtshift will hint it's not a + * normal retransmit. */ - if (++tp->t_rxtshift > TCP_MAXRXTSHIFT) { - if (uto_left > 0) { - /* - * Reset the timer for UTO; t_rxtshift will hint - * that it's not a normal retransmit. - */ - callout_reset(&tp->t_timers->tt_rexmt, hz * uto_left, - tcp_timer_rexmt, tp); - } else { - tp->t_rxtshift = TCP_MAXRXTSHIFT; - TCPSTAT_INC(tcps_timeoutdrop); - tp = tcp_drop(tp, tp->t_softerror ? - tp->t_softerror : ETIMEDOUT); - } + if (++tp->t_rxtshift > TCP_MAXRXTSHIFT && uto_left <= 0) { + tp->t_rxtshift = TCP_MAXRXTSHIFT; + TCPSTAT_INC(tcps_timeoutdrop); + tp = tcp_drop(tp, tp->t_softerror ? + tp->t_softerror : ETIMEDOUT); goto out; } INP_INFO_WUNLOCK(&V_tcbinfo); @@ -558,13 +554,15 @@ TCPSTAT_INC(tcps_rexmttimeo); if (tp->t_state == TCPS_SYN_SENT) rexmt = TCP_REXMTVAL(tp) * tcp_syn_backoff[tp->t_rxtshift]; - else - rexmt = TCP_REXMTVAL(tp) * tcp_backoff[tp->t_rxtshift]; + else { + if (tp->t_rxtshift <= TCP_MAXRXTSHIFT) + rexmt = TCP_REXMTVAL(tp) * tcp_backoff[tp->t_rxtshift]; + else + /* We're in UTO, back off as much as we can. */ + rexmt = min(TCPTV_REXMTMAX, uto_left * hz); + } TCPT_RANGESET(tp->t_rxtcur, rexmt, tp->t_rttmin, TCPTV_REXMTMAX); - if (uto_left) { - tp->t_rxtcur = min(tp->t_rxtcur, hz * uto_left); - } /* * Disable rfc1323 if we haven't got any response to * our third SYN to work-around some broken terminal servers