From owner-p4-projects@FreeBSD.ORG Sat Aug 15 07:49:21 2009 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 94784106568D; Sat, 15 Aug 2009 07:49:21 +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 40B1B106568B for ; Sat, 15 Aug 2009 07:49:21 +0000 (UTC) (envelope-from fangwang@FreeBSD.org) Received: from repoman.freebsd.org (repoman.freebsd.org [IPv6:2001:4f8:fff6::29]) by mx1.freebsd.org (Postfix) with ESMTP id EEF9A8FC4D for ; Sat, 15 Aug 2009 07:49:20 +0000 (UTC) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.14.3/8.14.3) with ESMTP id n7F7nKu5020021 for ; Sat, 15 Aug 2009 07:49:20 GMT (envelope-from fangwang@FreeBSD.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.14.3/8.14.3/Submit) id n7F7nK6u020019 for perforce@freebsd.org; Sat, 15 Aug 2009 07:49:20 GMT (envelope-from fangwang@FreeBSD.org) Date: Sat, 15 Aug 2009 07:49:20 GMT Message-Id: <200908150749.n7F7nK6u020019@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to fangwang@FreeBSD.org using -f From: Fang Wang To: Perforce Change Reviews Cc: Subject: PERFORCE change 167352 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 15 Aug 2009 07:49:21 -0000 http://perforce.freebsd.org/chv.cgi?CH=167352 Change 167352 by fangwang@fangwang_utobsd on 2009/08/15 07:48:56 Fix style. Fix bug in decrease timeout value. Affected files ... .. //depot/projects/soc2009/tcputo/src/sys/netinet/tcp_timer.c#8 edit .. //depot/projects/soc2009/tcputo/src/sys/netinet/tcp_timer.h#7 edit .. //depot/projects/soc2009/tcputo/src/sys/netinet/tcp_var.h#14 edit Differences ... ==== //depot/projects/soc2009/tcputo/src/sys/netinet/tcp_timer.c#8 (text+ko) ==== @@ -494,6 +494,7 @@ if (tp->t_rxtshift == 0) { TCPT_RESOLVE_UTO(tp); tp->t_uto_left = tp->t_uto_impl / hz; + tp->t_uto_left -= tcp_backoff[0]; } /* * Retransmission timer went off. Message has not @@ -533,18 +534,26 @@ if (tp->t_state == TCPS_SYN_SENT) rexmt = TCP_REXMTVAL(tp) * tcp_syn_backoff[tp->t_rxtshift]; else - if ((tp->uto_flags & TCPUTO_IMPL) == 0) + if ((tp->uto_flags & TCPUTO_IMPL) == 0) { rexmt = TCP_REXMTVAL(tp) * tcp_backoff[tp->t_rxtshift]; - else { - int rxtshift; + TCPT_RANGESET(tp->t_rxtcur, rexmt, + tp->t_rttmin, TCPTV_REXMTMAX); + } else { + int rxtshift, interval; rxtshift = min(TCP_MAXRXTSHIFT, tp->t_rxtshift); - tp->t_uto_left -= min(tp->t_uto_left, - min(TCP_REXMTMAX, tcp_backoff[rxtshift])); + interval = min(TCP_REXMTMAX, tcp_backoff[rxtshift]); rexmt = TCP_REXMTVAL(tp) * tcp_backoff[rxtshift]; + TCPT_RANGESET(tp->t_rxtcur, rexmt, + tp->t_rttmin, TCPTV_REXMTMAX); + if (tp->t_uto_left < interval) { + tp->t_rxtcur = (tp->t_rxtcur * tp->t_uto_left) / interval; + /* Prevent t_rxtcur to be zero */ + TCPT_RANGESET(tp->t_rxtcur, tp->t_rxtcur, + tp->t_rttmin, TCPTV_REXMTMAX); + } + tp->t_uto_left -= min(tp->t_uto_left, interval); } - TCPT_RANGESET(tp->t_rxtcur, rexmt, - tp->t_rttmin, TCPTV_REXMTMAX); /* * Disable rfc1323 if we havn't got any response to * our third SYN to work-around some broken terminal servers ==== //depot/projects/soc2009/tcputo/src/sys/netinet/tcp_timer.h#7 (text+ko) ==== @@ -93,7 +93,7 @@ #define TCPTV_UTO_MIN ( 120*hz) /* min user timeout */ #define TCPTV_UTO_MAX (1020*hz) /* max user timeout */ -#define TCPTV_UTO_DEFAULT ( 447*hz) /* default user timeout */ +#define TCPTV_UTO_DEFAULT ( 511*hz) /* default user timeout */ /* * Minimum retransmit timer is 3 ticks, for algorithmic stability. ==== //depot/projects/soc2009/tcputo/src/sys/netinet/tcp_var.h#14 (text+ko) ==== @@ -254,19 +254,19 @@ /* * Resolve user timeout value(ticks). */ -#define TCPT_RESOLVE_UTO(tp) do { \ - if ((tp)->uto_flags & TCPUTO_ENABLE && \ - (tp)->uto_flags & TCPUTO_RCVD && \ - (tp)->uto_flags & TCPUTO_CHANGEABLE) { \ - (tp)->t_uto_impl = (tp)->rcv_uto >> 1; \ - if ((tp)->rcv_uto & 1) \ - (tp)->t_uto_impl *= 60; \ - (tp)->t_uto_impl *= hz; \ - (tp)->t_uto_impl = min(tcp_uto_max, \ - max((tp)->t_uto_adv, max((tp)->t_uto_impl, tcp_uto_min))); \ - (tp)->uto_flags &= ~TCPUTO_RCVD; \ - (tp)->uto_flags |= TCPUTO_IMPL; \ - } \ +#define TCPT_RESOLVE_UTO(tp) do { \ + if ((tp)->uto_flags & TCPUTO_ENABLE && \ + (tp)->uto_flags & TCPUTO_RCVD && \ + (tp)->uto_flags & TCPUTO_CHANGEABLE) { \ + (tp)->t_uto_impl = (tp)->rcv_uto >> 1; \ + if ((tp)->rcv_uto & 1) \ + (tp)->t_uto_impl *= 60; \ + (tp)->t_uto_impl *= hz; \ + (tp)->t_uto_impl = min(tcp_uto_max, \ + max((tp)->t_uto_adv, max((tp)->t_uto_impl, tcp_uto_min))); \ + (tp)->uto_flags &= ~TCPUTO_RCVD; \ + (tp)->uto_flags |= TCPUTO_IMPL; \ + } \ } while(0) #ifdef TCP_SIGNATURE