PERFORCE change 180388 for review
Andre Oppermann
andre at FreeBSD.org
Thu Jul 1 15:00:42 UTC 2010
http://p4web.freebsd.org/@@180388?ac=10
Change 180388 by andre at 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;
More information about the p4-projects
mailing list