From owner-p4-projects@FreeBSD.ORG Thu Mar 11 17:14:43 2010 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 50437106568B; Thu, 11 Mar 2010 17:14:43 +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 EBC0B1065677 for ; Thu, 11 Mar 2010 17:14:42 +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 CF3458FC3F for ; Thu, 11 Mar 2010 17:14:42 +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 o2BHEgcE094191 for ; Thu, 11 Mar 2010 17:14:42 GMT (envelope-from andre@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.14.3/8.14.3/Submit) id o2BHEgoJ094189 for perforce@freebsd.org; Thu, 11 Mar 2010 17:14:42 GMT (envelope-from andre@freebsd.org) Date: Thu, 11 Mar 2010 17:14:42 GMT Message-Id: <201003111714.o2BHEgoJ094189@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 175592 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, 11 Mar 2010 17:14:43 -0000 http://p4web.freebsd.org/chv.cgi?CH=175592 Change 175592 by andre@andre_t61 on 2010/03/11 17:14:33 Update and improve some comments. Add error handling skeleton to tcp_retransmit(). Affected files ... .. //depot/projects/tcp_new/netinet/tcp_output.c#16 edit Differences ... ==== //depot/projects/tcp_new/netinet/tcp_output.c#16 (text+ko) ==== @@ -216,6 +216,7 @@ /* * Conservative approximation of data still travelling in the network. + * XXXAO: Alternative version w/o SACK. */ inflight = duna - tp->snd_sacked; @@ -230,7 +231,7 @@ rwin = tcp_rcv_wnd(tp, so); /* - * Act based on the phase we are in. + * Act based on the send phase we are in. */ switch (tp->t_phase) { case TP_IDLE: @@ -411,7 +412,7 @@ goto send; /* - * Always send if NODELAY is enabled. This gives at least + * Always send if NODELAY is enabled. This causes at least * one segment per application write no matter how small * the amount of data. */ @@ -555,6 +556,8 @@ /* * NB: len > 0 means we sent this much data w/o error. * error == 0 means we sent everything w/o error. + * NB: The difference between the three cases is subtle + * but important. * * XXXAO: Avoid unconditional writes to the tcpcb. */ @@ -783,15 +786,10 @@ * Do not retransmit too many times. * Limit the amount of data that is inflight. * Retransmit only the stuff that was not SACK'ed. - */ - /* - * The moment we receive a duplicate ACK everything freezes. - * No more new data is sent except for those allowed by limited - * transmit. + * * The fast recovery algorithms start their work by the third * duplicate ACK. - */ - /* + * * We have the following mechanisms: * 1. Fast recovery: After we get three duplicate ACKs RFC2581 * 2. NewReno RFC3782 @@ -868,6 +866,54 @@ } while (error == 0); + if (rlen > 0) { + } + + if (error == 0) { + } + + if (rlen > 0 || error == 0) { + /* + * Update last send timestamp. + */ + if ((tp->t_flags & TF_TIMESTAMP) && tp->snd_tslast != to->to_tsval) + tp->snd_tslast = to->to_tsval; + + /* + * Last ACK we sent. + */ + if (tp->snd_lastack != th->th_ack) + tp->snd_lastack = th->th_ack; + } + + if (rlen > 0 && error == 0) { + } + + switch (error) { + case EPERM: + case EACCES: + break; + case ENOBUFS: + case ENOMEM: + break; + case EMSGSIZE: + break; + case ENETDOWN: + case ENETUNREACH: + case EHOSTDOWN: + case EHOSTUNREACH: + break; + case 0: + /* + * No error. + */ + break; + + default: + KASSERT(0 == 1, + ("%s: unkown error %i", __func__, error)); + } + return (error); } @@ -1256,8 +1302,9 @@ /* * Report shrunk socket buffers. */ - if (delta < 0) + if (delta < 0) { /*tcp_log("our receive socket buffer was shrunk")*/; + } /* * Our current open receive window to be advertized is @@ -1288,7 +1335,7 @@ /* * Compute options for segment. - * We only have to care about SYN and established connection + * We only have to care about SYN-SENT and established connection * segments. Options for SYN-ACK segments are handled in TCP * syncache. Before ESTABLISHED, force sending of initial options * unless TCP set not to do any options.