+
+ if (SACK_ENABLED(tp) && tp->t_lossflightsize > 0) {
+ u_int32_t total_rxt_size = 0, ncwnd;
+ /*
+ * When SACK is enabled, the number of retransmitted bytes
+ * can be counted more accurately.
+ */
+ total_rxt_size = tcp_rxtseg_total_size(tp);
+ ncwnd = max(tp->t_pipeack, tp->t_lossflightsize);
+ if (total_rxt_size <= ncwnd) {
+ ncwnd = ncwnd - total_rxt_size;
+ }
+
+ /*
+ * To avoid sending a large burst at the end of recovery
+ * set a max limit on ncwnd
+ */
+ ncwnd = min(ncwnd, (tp->t_maxseg << 6));
+ ncwnd = ncwnd >> 1;
+ flight_size = max(ncwnd, flight_size);
+ }