From owner-p4-projects@FreeBSD.ORG Thu Jul 14 07:11:08 2011 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 47EA21065670; Thu, 14 Jul 2011 07:11:08 +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 D6808106566B for ; Thu, 14 Jul 2011 07:11:07 +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 BD45E8FC08 for ; Thu, 14 Jul 2011 07:11:07 +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 p6E7B79O070439 for ; Thu, 14 Jul 2011 07:11:07 GMT (envelope-from cnicutar@freebsd.org) Received: (from perforce@localhost) by skunkworks.freebsd.org (8.14.4/8.14.4/Submit) id p6E7B77Y070434 for perforce@freebsd.org; Thu, 14 Jul 2011 07:11:07 GMT (envelope-from cnicutar@freebsd.org) Date: Thu, 14 Jul 2011 07:11:07 GMT Message-Id: <201107140711.p6E7B77Y070434@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 196134 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: Thu, 14 Jul 2011 07:11:08 -0000 http://p4web.freebsd.org/@@196134?ac=10 Change 196134 by cnicutar@cnicutar_cronos on 2011/07/14 07:10:33 Record the exact UTO value received, whether or not the user chose to accept it. The TF_RCV_UTO flag will later tell if ne need to use it or not. Affected files ... .. //depot/projects/soc2011/cnicutar_tcputo_8/src/sys/netinet/tcp_input.c#5 edit .. //depot/projects/soc2011/cnicutar_tcputo_8/src/sys/netinet/tcp_timer.c#7 edit Differences ... ==== //depot/projects/soc2011/cnicutar_tcputo_8/src/sys/netinet/tcp_input.c#5 (text+ko) ==== @@ -1091,14 +1091,12 @@ tcp_dooptions(&to, optp, optlen, TO_SYN); if (to.to_flags & TOF_UTO) { - if (tp->t_flags & TF_RCV_UTO) { - tp->rcv_uto = (to.to_uto & UTO_MINS) ? - (to.to_uto & ~(UTO_MINS)) * 60 : to.to_uto; - /* silently make it fit between min-max */ - tp->rcv_uto = min(V_uto_max_timeout, - max(V_uto_min_timeout, tp->rcv_uto)); - } - + /* + * Storing the value even if the user might not + * accept it. Also, not clamping it just yet. + */ + tp->rcv_uto = (to.to_uto & UTO_MINS) ? + (to.to_uto & ~(UTO_MINS)) * 60 : to.to_uto; /* * XXX-CN Using option both for send and receive. * Clear it for syncache. @@ -1288,13 +1286,16 @@ (th->th_off << 2) - sizeof(struct tcphdr), (thflags & TH_SYN) ? TO_SYN : 0); - /* Processing received UTO. */ - if ((to.to_flags & TOF_UTO) && (tp->t_flags & TF_RCV_UTO)) { - /* convert to seconds if granularity is set */ + /* + * Processing received UTO even if the user doesn't accept it + * yet. The user might wants to accept it later (perhaps after + * authentication ) but the peer need not send it again. + * The value is converter to seconds and not clamped (the user + * needs to know the real value received). + */ + if (to.to_flags & TOF_UTO) { tp->rcv_uto = (to.to_uto & UTO_MINS) ? (to.to_uto & ~(UTO_MINS)) * 60 : to.to_uto; - tp->rcv_uto = min(V_uto_max_timeout, - max(V_uto_min_timeout, tp->rcv_uto)); } /* ==== //depot/projects/soc2011/cnicutar_tcputo_8/src/sys/netinet/tcp_timer.c#7 (text+ko) ==== @@ -490,14 +490,23 @@ if (tp->t_rxtshift == 0) /* UTO starting again since it's the first retransmit. */ - tp->t_suto = 0; + tp->t_suto = 0; if (tp->snd_uto || ((tp->t_flags & TF_RCV_UTO) && tp->rcv_uto)) { /* * 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); + uto_left = 0; + if (tp->t_flags & TF_RCV_UTO) + /* Clamping the received value. */ + uto_left = min(V_uto_max_timeout, + max(V_uto_min_timeout, tp->rcv_uto)); + + /* Taking the longer timeout. */ + uto_left = max(tp->snd_uto, uto_left); + + /* Subtract time that has passed since the first retransmit. */ if (tp->t_suto) uto_left -= ticks_to_secs(ticks - tp->t_suto); @@ -560,7 +569,9 @@ rexmt = TCPTV_REXMTMAX; } /* We might want to wait less than an entire backoff. */ - rexmt = min(rexmt, uto_left * hz); + if (uto_left) + rexmt = min(rexmt, uto_left * hz); + TCPT_RANGESET(tp->t_rxtcur, rexmt, tp->t_rttmin, TCPTV_REXMTMAX); /*