From owner-p4-projects@FreeBSD.ORG Fri Oct 14 20:02:19 2011 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id D61D91065676; Fri, 14 Oct 2011 20:02:18 +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 98A411065673 for ; Fri, 14 Oct 2011 20:02:18 +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 6CE038FC1B for ; Fri, 14 Oct 2011 20:02:18 +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 p9EK2IL9031295 for ; Fri, 14 Oct 2011 20:02:18 GMT (envelope-from cnicutar@freebsd.org) Received: (from perforce@localhost) by skunkworks.freebsd.org (8.14.4/8.14.4/Submit) id p9EK2IZv031291 for perforce@freebsd.org; Fri, 14 Oct 2011 20:02:18 GMT (envelope-from cnicutar@freebsd.org) Date: Fri, 14 Oct 2011 20:02:18 GMT Message-Id: <201110142002.p9EK2IZv031291@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 200208 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: Fri, 14 Oct 2011 20:02:19 -0000 http://p4web.freebsd.org/@@200208?ac=10 Change 200208 by cnicutar@cnicutar_cronos on 2011/10/14 20:02:16 Fix segment bumping introduced in 198632. (UTO sometimes caused a segment to be spilled by TCPOLEN_UTO bytes which meant splitting). Simplify TF_SND_UTO handling - set it from the retransmit handler. Affected files ... .. //depot/projects/soc2011/cnicutar_tcputo_9/src/sys/netinet/tcp_output.c#5 edit .. //depot/projects/soc2011/cnicutar_tcputo_9/src/sys/netinet/tcp_timer.c#5 edit Differences ... ==== //depot/projects/soc2011/cnicutar_tcputo_9/src/sys/netinet/tcp_output.c#5 (text+ko) ==== @@ -709,10 +709,12 @@ * UTO. The option is sent with the SYN and with the first * non-SYN segment. */ - if (tp->t_flags & TF_SND_UTO && (flags & TH_SYN || - FIRST_NON_SYN(tp))) { + if (tp->t_flags & TF_SND_UTO) { to.to_uto = tp->snd_uto; to.to_flags |= TOF_UTO; + + if (!(flags & TH_SYN)) + tp->t_flags &= ~TF_SND_UTO; } #ifdef TCP_SIGNATURE /* TCP-MD5 (RFC2385). */ @@ -747,6 +749,16 @@ if (len + optlen + ipoptlen > tp->t_maxopd) { flags &= ~TH_FIN; + /* + * When doing a retransmission that includes UTO, the extra + * TCPOLEN_UTO (4) bytes might cause the segment to spill. + */ + if (to.to_flags & TOF_UTO && len + optlen + ipoptlen - + TCPOLEN_UTO <= tp->t_maxopd) { + len -= TCPOLEN_UTO; + goto lenfixed; + } + if (tso) { KASSERT(ipoptlen == 0, ("%s: TSO can't do IP options", __func__)); @@ -787,6 +799,7 @@ } } else tso = 0; +lenfixed: KASSERT(len + hdrlen + ipoptlen <= IP_MAXPACKET, ("%s: len > IP_MAXPACKET", __func__)); ==== //depot/projects/soc2011/cnicutar_tcputo_9/src/sys/netinet/tcp_timer.c#5 (text+ko) ==== @@ -618,6 +618,11 @@ } tp->snd_nxt = tp->snd_una; tp->snd_recover = tp->snd_max; + + /* Check if we need to push UTO. */ + if (tp->snd_uto && FIRST_NON_SYN(tp)) + tp->t_flags |= TF_SND_UTO; + /* * Force a segment to be sent. */