Date: Mon, 10 Aug 2009 17:06:01 GMT From: Fang Wang <fangwang@FreeBSD.org> To: Perforce Change Reviews <perforce@FreeBSD.org> Subject: PERFORCE change 167179 for review Message-ID: <200908101706.n7AH61V7064959@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200908101706.n7AH61V7064959>