+ /*
+ * Send any SACK-generated retransmissions. If we're explicitly trying
+ * to send out new data (when sendalot is 1), bypass this function.
+ * If we retransmit in fast recovery mode, decrement snd_cwnd, since
+ * we're replacing a (future) new transmission with a retransmission
+ * now, and we previously incremented snd_cwnd in tcp_input().
+ */
+ /*
+ * Still in sack recovery , reset rxmit flag to zero.
+ */
+ sack_rxmit = 0;
+ sack_bytes_rxmt = 0;
+ len = 0;
+ p = NULL;
+ if (tp->sack_enable && IN_FASTRECOVERY(tp) &&
+ (p = tcp_sack_output(tp, &sack_bytes_rxmt))) {
+ long cwin;
+
+ cwin = min(tp->snd_wnd, tp->snd_cwnd) - sack_bytes_rxmt;
+ if (cwin < 0)
+ cwin = 0;
+ /* Do not retransmit SACK segments beyond snd_recover */
+ if (SEQ_GT(p->end, tp->snd_recover)) {
+ /*
+ * (At least) part of sack hole extends beyond
+ * snd_recover. Check to see if we can rexmit data
+ * for this hole.
+ */
+ if (SEQ_GEQ(p->rxmit, tp->snd_recover)) {
+ /*
+ * Can't rexmit any more data for this hole.
+ * That data will be rexmitted in the next
+ * sack recovery episode, when snd_recover
+ * moves past p->rxmit.
+ */
+ p = NULL;
+ goto after_sack_rexmit;
+ } else
+ /* Can rexmit part of the current hole */
+ len = ((long)ulmin(cwin,
+ tp->snd_recover - p->rxmit));
+ } else
+ len = ((long)ulmin(cwin, p->end - p->rxmit));
+ off = p->rxmit - tp->snd_una;
+ if (len > 0) {
+ sack_rxmit = 1;
+ sendalot = 1;
+ tcpstat.tcps_sack_rexmits++;
+ tcpstat.tcps_sack_rexmit_bytes +=
+ min(len, tp->t_maxseg);
+ }
+ }
+after_sack_rexmit: