From owner-p4-projects@FreeBSD.ORG Mon Aug 10 17:06:02 2009 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 85DDB106567A; Mon, 10 Aug 2009 17:06:02 +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 1DF4C1065673 for ; Mon, 10 Aug 2009 17:06:02 +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 0C5BA8FC35 for ; Mon, 10 Aug 2009 17:06:02 +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 n7AH612L064961 for ; Mon, 10 Aug 2009 17:06:01 GMT (envelope-from fangwang@FreeBSD.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.14.3/8.14.3/Submit) id n7AH61V7064959 for perforce@freebsd.org; Mon, 10 Aug 2009 17:06:01 GMT (envelope-from fangwang@FreeBSD.org) Date: Mon, 10 Aug 2009 17:06:01 GMT Message-Id: <200908101706.n7AH61V7064959@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 167179 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: Mon, 10 Aug 2009 17:06:03 -0000 http://perforce.freebsd.org/chv.cgi?CH=167179 Change 167179 by fangwang@fangwang_utobsd on 2009/08/10 17:05:59 Fix bug. Affected files ... .. //depot/projects/soc2009/tcputo/src/sys/netinet/tcp_timer.c#7 edit .. //depot/projects/soc2009/tcputo/src/sys/netinet/tcp_timer.h#6 edit .. //depot/projects/soc2009/tcputo/src/sys/netinet/tcp_usrreq.c#9 edit .. //depot/projects/soc2009/tcputo/src/sys/netinet/tcp_var.h#13 edit Differences ... ==== //depot/projects/soc2009/tcputo/src/sys/netinet/tcp_timer.c#7 (text+ko) ==== @@ -492,16 +492,7 @@ tcp_free_sackholes(tp); if (tp->t_rxtshift == 0) { - if (tp->uto_flags & TCPUTO_ENABLE && - tp->uto_flags & TCPUTO_RCVD && - tp->uto_flags & TCPUTO_CHANGEABLE) { - u_int utoval; - TCPT_UTOGET(utoval, tp->rcv_uto); - tp->t_uto_impl = min(tcp_uto_max, - max(tp->t_uto_adv, max(utoval, tcp_uto_min))); - tp->uto_flags &= ~TCPUTO_RCVD; - tp->uto_flags |= TCPUTO_IMPL; - } + TCPT_RESOLVE_UTO(tp); tp->t_uto_left = tp->t_uto_impl / hz; } /* ==== //depot/projects/soc2009/tcputo/src/sys/netinet/tcp_timer.h#6 (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 ( 511*hz) /* default user timeout */ +#define TCPTV_UTO_DEFAULT ( 447*hz) /* default user timeout */ /* * Minimum retransmit timer is 3 ticks, for algorithmic stability. @@ -143,16 +143,6 @@ (tv) = (tvmax); \ } while(0) -/* -* Get user timeout value(ticks). -*/ -#define TCPT_UTOGET(utoval, uto) do { \ - (utoval) = (uto) >> 1; \ - if ((uto) & 1) \ - (utoval) *= 60; \ - (utoval) *= hz; \ -} while(0) - #ifdef _KERNEL struct tcp_timer { ==== //depot/projects/soc2009/tcputo/src/sys/netinet/tcp_usrreq.c#9 (text+ko) ==== @@ -1211,7 +1211,8 @@ ti->tcpi_options |= TCPI_OPT_WSCALE; ti->tcpi_snd_wscale = tp->snd_scale; ti->tcpi_rcv_wscale = tp->rcv_scale; - } + } + TCPT_RESOLVE_UTO(tp); if (tp->uto_flags & TCPUTO_IMPL) { ti->tcpi_options |= TCPI_OPT_UTO; ti->tcpi_uto = tp->t_uto_impl / hz; @@ -1403,8 +1404,7 @@ tp->uto_flags &= ~TCPUTO_CHANGEABLE; tp->uto_flags |= TCPUTO_IMPL; } - } - else + } else error = EINVAL; } if ( tu.flags & ENABLE_CHANGE) @@ -1461,18 +1461,10 @@ tu.flags |= ENABLE_UTO; if (tp->uto_flags & TCPUTO_CHANGEABLE) tu.flags |= ENABLE_CHANGE; - if (tp->uto_flags & TCPUTO_ENABLE && - tp->uto_flags & TCPUTO_RCVD && - tp->uto_flags & TCPUTO_CHANGEABLE) { - TCPT_UTOGET(tp->t_uto_impl, tp->rcv_uto); - 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; - } + TCPT_RESOLVE_UTO(tp); if (tp->uto_flags & TCPUTO_IMPL) { tu.flags |= STORE_UTO; - tu.uto = tp->t_uto_impl; + tu.uto = tp->t_uto_impl / hz; } INP_WUNLOCK(inp); error = sooptcopyout(sopt, &tu, sizeof tu); ==== //depot/projects/soc2009/tcputo/src/sys/netinet/tcp_var.h#13 (text+ko) ==== @@ -251,6 +251,24 @@ #define TCPUTO_NEED 0x10 /* user timeout need to be sent */ #define TCPUTO_SENDING 0x20 /* user timeout is in the process of sending */ +/* +* 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; \ + } \ +} while(0) + #ifdef TCP_SIGNATURE /* * Defines which are needed by the xform_tcp module and tcp_[in|out]put