Date: Thu, 11 Mar 2010 17:14:42 GMT From: Andre Oppermann <andre@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 175592 for review Message-ID: <201003111714.o2BHEgoJ094189@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
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.
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201003111714.o2BHEgoJ094189>