From owner-p4-projects@FreeBSD.ORG Wed Aug 17 08:18:47 2011 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id F2C871065673; Wed, 17 Aug 2011 08:18:46 +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 9747B1065670 for ; Wed, 17 Aug 2011 08:18:46 +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 8565B8FC0C for ; Wed, 17 Aug 2011 08:18:46 +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 p7H8Ikjk003925 for ; Wed, 17 Aug 2011 08:18:46 GMT (envelope-from cnicutar@freebsd.org) Received: (from perforce@localhost) by skunkworks.freebsd.org (8.14.4/8.14.4/Submit) id p7H8Ik5f003921 for perforce@freebsd.org; Wed, 17 Aug 2011 08:18:46 GMT (envelope-from cnicutar@freebsd.org) Date: Wed, 17 Aug 2011 08:18:46 GMT Message-Id: <201108170818.p7H8Ik5f003921@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 197759 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: Wed, 17 Aug 2011 08:18:47 -0000 http://p4web.freebsd.org/@@197759?ac=10 Change 197759 by cnicutar@cnicutar_cronos on 2011/08/17 08:18:09 Change the behavior of TCP_RCVUTO_TIMEOUT to allow the application to impose a per-connection maximum timeout. Affected files ... .. //depot/projects/soc2011/cnicutar_tcputo_9/src/sys/netinet/tcp_syncache.c#5 edit .. //depot/projects/soc2011/cnicutar_tcputo_9/src/sys/netinet/tcp_syncache.h#4 edit .. //depot/projects/soc2011/cnicutar_tcputo_9/src/sys/netinet/tcp_timer.c#4 edit .. //depot/projects/soc2011/cnicutar_tcputo_9/src/sys/netinet/tcp_usrreq.c#3 edit .. //depot/projects/soc2011/cnicutar_tcputo_9/src/sys/netinet/tcp_var.h#5 edit Differences ... ==== //depot/projects/soc2011/cnicutar_tcputo_9/src/sys/netinet/tcp_syncache.c#5 (text+ko) ==== @@ -835,6 +835,7 @@ tp->t_flags |= TF_RCV_UTO; /* Regardless of SCF_RCV_UTO. */ tp->rcv_uto = sc->sc_rcv_uto; + tp->max_uto = sc->sc_max_uto; } if (sc->sc_flags & SCF_ECN) @@ -1053,7 +1054,7 @@ * socket accept suggestions?). */ uint16_t rcv_uto_tf; - uint32_t rcv_uto = 0; + uint32_t rcv_uto = 0, max_uto = 0; INP_INFO_WLOCK_ASSERT(&V_tcbinfo); INP_WLOCK_ASSERT(inp); /* listen socket */ @@ -1089,6 +1090,7 @@ /* Remember received UTO regardless of disposition and clear it. */ rcv_uto_tf = (tp->t_flags & TF_RCV_UTO) ? SCF_RCV_UTO : 0; rcv_uto = tp->rcv_uto; + max_uto = tp->max_uto; tp->rcv_uto = 0; /* By the time we drop the lock these should no longer be used. */ @@ -1307,6 +1309,7 @@ /* Inherit received UTO, regardless of disposition. */ sc->sc_flags |= rcv_uto_tf; sc->sc_rcv_uto = rcv_uto; + sc->sc_max_uto = max_uto; if (V_tcp_syncookies) { syncookie_generate(sch, sc, &flowtmp); ==== //depot/projects/soc2011/cnicutar_tcputo_9/src/sys/netinet/tcp_syncache.h#4 (text+ko) ==== @@ -84,6 +84,7 @@ u_int32_t sc_snd_uto; /* Sent UTO (seconds) */ u_int32_t sc_rcv_uto; /* Received UTO (seconds) */ + u_int32_t sc_max_uto; /* Maximum UTO (seconds) */ }; /* ==== //depot/projects/soc2011/cnicutar_tcputo_9/src/sys/netinet/tcp_timer.c#4 (text+ko) ==== @@ -504,9 +504,9 @@ * compute how much time we've got left. */ uto_left = 0; - if (tp->t_flags & TF_RCV_UTO) + if (tp->t_flags & TF_RCV_UTO && tp->rcv_uto) /* Clamping the received value. */ - uto_left = min(V_uto_max_timeout, + uto_left = min(tp->max_uto, max(V_uto_min_timeout, tp->rcv_uto)); /* Taking the longer timeout. */ ==== //depot/projects/soc2011/cnicutar_tcputo_9/src/sys/netinet/tcp_usrreq.c#3 (text+ko) ==== @@ -1356,8 +1356,15 @@ if (optval <= 0) /* This connection will ignore suggestions. */ tp->t_flags &= ~TF_RCV_UTO; - else + else { tp->t_flags |= TF_RCV_UTO; + /* + * If optval > 1, we'll use it as the max + * acceptable suggestion. + */ + tp->max_uto = (optval > 1) ? + optval : V_uto_max_timeout; + } INP_WUNLOCK(inp); break; case TCP_NODELAY: ==== //depot/projects/soc2011/cnicutar_tcputo_9/src/sys/netinet/tcp_var.h#5 (text+ko) ==== @@ -203,12 +203,13 @@ struct cc_var *ccv; /* congestion control specific vars */ struct osd *osd; /* storage for Khelp module data */ - uint32_t t_ispare[9]; /* 4 keep timers, 2 UTO, 3 TBD */ + uint32_t t_ispare[8]; /* 4 keep timers, 1 UTO, 3 TBD */ void *t_pspare2[4]; /* 4 TBD */ uint64_t _pad[6]; /* 6 TBD (1-2 CC/RTT?) */ uint32_t snd_uto; /* sent timeout (seconds) */ uint32_t rcv_uto; /* received suggestion (seconds) */ + uint32_t max_uto; /* max received uto (seconds) */ int t_suto; /* uto starting time (ticks) */ };