From owner-p4-projects@FreeBSD.ORG Thu Jul 1 14:59:40 2010 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id B0CBD1065670; Thu, 1 Jul 2010 14:59:40 +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 683AC106567A for ; Thu, 1 Jul 2010 14:59:40 +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 3C9798FC13 for ; Thu, 1 Jul 2010 14:59:40 +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 o61ExePm025736 for ; Thu, 1 Jul 2010 14:59:40 GMT (envelope-from andre@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.14.3/8.14.3/Submit) id o61Exev6025734 for perforce@freebsd.org; Thu, 1 Jul 2010 14:59:40 GMT (envelope-from andre@freebsd.org) Date: Thu, 1 Jul 2010 14:59:40 GMT Message-Id: <201007011459.o61Exev6025734@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 180387 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 14:59:41 -0000 http://p4web.freebsd.org/@@180387?ac=10 Change 180387 by andre@andre_t61 on 2010/07/01 14:59:16 Add tcp_do_recovery() to handle the loss recovery period. Affected files ... .. //depot/projects/tcp_new/netinet/tcp_input.c#18 edit Differences ... ==== //depot/projects/tcp_new/netinet/tcp_input.c#18 (text+ko) ==== @@ -1784,7 +1784,7 @@ if (tp->t_phase < TP_LOSSRECOV) { //tcp_cc_ack(tp, th, tiwin, acked, tlen, sacked); } else { - tcp_do_lossrecovery(tp); + tcp_do_lossrecovery(tp, th, tiwin, acked, tlen, sacked); } KASSERT(tp->snd_cwnd > tp->snd_mss, @@ -3035,9 +3035,51 @@ * Perform loss recovery. */ void -tcp_do_lossrecovery(struct tcpcb *tp) +tcp_do_lossrecovery(struct tcpcb *tp, struct tcphdr *th, tcp_win tiwin, + tcp_seq acked, int tlen, int sacked) { - + /* + * NewReno FastRecovery: + * + * 1a) ssthresh = max (FlightSize / 2, 2*SMSS) [input] + * recover = snd_nxt [input] + * + * 2) retransmit snd_una+mss [output] + * cwnd = ssthresh + 3*mss [input] + * + * 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] + */ + + if (tp->snd_dupack == 3) { + tp->snd_recover = tp->snd_nxt; + tp->snd_cwnd = tp->snd_ssthresh + 3 * tp->snd_mss; + if (tp->t_phase < TP_LOSSRECOV) + tp->t_phase = TP_LOSSRECOV; + } else if (tp->snd_dupack > 3) { + tp->snd_cwnd =+ tp->snd_mss; + } + + if (SEQ_GEQ(th->th_ack, tp->snd_recover)) { + tp->snd_cwnd = min(tp->snd_ssthresh, SEQ_DELTA(tp->snd_una, tp->snd_nxt) + tp->snd_mss); + tp->t_phase = TP_SENDING; + } else if (acked > 0) { + if (acked <= tp->snd_mss) + tp->snd_cwnd =- acked; + } } /*