From owner-p4-projects@FreeBSD.ORG Thu Jul 1 15:00:42 2010 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id DB7D71065672; Thu, 1 Jul 2010 15:00:41 +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 9FF68106564A for ; Thu, 1 Jul 2010 15:00:41 +0000 (UTC) (envelope-from andre@freebsd.org) Received: from repoman.freebsd.org (repoman.freebsd.org [IPv6:2001:4f8:fff6::29]) by mx1.freebsd.org (Postfix) with ESMTP id 743A28FC14 for ; Thu, 1 Jul 2010 15:00:41 +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 o61F0fsi025866 for ; Thu, 1 Jul 2010 15:00:41 GMT (envelope-from andre@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.14.3/8.14.3/Submit) id o61F0fAA025864 for perforce@freebsd.org; Thu, 1 Jul 2010 15:00:41 GMT (envelope-from andre@freebsd.org) Date: Thu, 1 Jul 2010 15:00:41 GMT Message-Id: <201007011500.o61F0fAA025864@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to andre@freebsd.org using -f From: Andre Oppermann To: Perforce Change Reviews Precedence: bulk Cc: Subject: PERFORCE change 180388 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, 01 Jul 2010 15:00:42 -0000 http://p4web.freebsd.org/@@180388?ac=10 Change 180388 by andre@andre_t61 on 2010/07/01 15:00:30 More comments and improvements to tcp_retransmit(). Affected files ... .. //depot/projects/tcp_new/netinet/tcp_output.c#19 edit Differences ... ==== //depot/projects/tcp_new/netinet/tcp_output.c#19 (text+ko) ==== @@ -264,8 +264,17 @@ break; case TP_LOSSRECOV: case TP_REXMT: + /* + * Retransmit is going to send segments so we need + * the options early. + */ optlen = tcp_options(tp, so, &to, &opt[0], flags); - if (tp->t_flags & TF_SACKOK) + /* + * Retransmit should only be entered when tcp_output() + * was called from tcp_input() or from the RTO timer, + * not when the application did a write. + */ + if (tp->t_flags & TF_SACKPERMIT) error = tcp_retransmit_sack(tp, so, &to, &opt[0], optlen, &len, rwin, duna, dlen, slen, len, flags); else error = tcp_retransmit(tp, so, &to, &opt[0], optlen, &len, rwin, dlen, slen, flags); @@ -812,20 +821,36 @@ * 3) on dupack > 3: cwnd =+ mss [input] * * 4) transmit new segment if cwnd allows [output] + * + * 5a) full ack + * cwnd = min(ssthresh, FlightSize + SMSS) [input] + * exit fastrecovery and reset dupack [input] + * + * 5b) partial ack + * deflate/inflate cwnd [input] + * retransmit new snd_una+mss [output] + * transmit new segment if cwnd allows [output] + * + * 5c) dupack again + * transmit new segment if cwnd allows [output] */ - /* Retransmit one mss or the unacknowledged amount of data. */ - rlen = min(tp->snd_mss, duna); - - /* Transmit one more new data. */ + /* Transmit one more new data if available. */ if (len > 0 && (len >= tp->snd_mss || dlen == len)) *lenp = len; else *lenp = 0; + /* Do not retransmit if ack didn't move. */ + if (tp->snd_dupack != 3 || tp->snd_dupack != 0) + return (0); + + /* Retransmit one mss or the unacknowledged amount of data. */ + rlen = min(tp->snd_mss, duna); + /* Fill in headers. */ th->th_win = (u_short)rwin; - th->th_seq = tp->snd_nxt; + th->th_seq = tp->snd_una; th->th_flags = flags; th->th_ack = tp->rcv_nxt;