4288 * By initializing tcp_cwnd_cnt to new tcp_cwnd and
4289 * decrementing it by 1 MSS for every ACKs, tcp_cwnd is
4290 * increased by 1 MSS for every RTTs.
4291 */
4292 if (tcp->tcp_cwnd_cnt <= 0) {
4293 tcp->tcp_cwnd_cnt = cwnd + add;
4294 } else {
4295 tcp->tcp_cwnd_cnt -= add;
4296 add = 0;
4297 }
4298 }
4299 tcp->tcp_cwnd = MIN(cwnd + add, tcp->tcp_cwnd_max);
4300 }
4301
4302 /* See if the latest urgent data has been acknowledged */
4303 if ((tcp->tcp_valid_bits & TCP_URG_VALID) &&
4304 SEQ_GT(seg_ack, tcp->tcp_urg))
4305 tcp->tcp_valid_bits &= ~TCP_URG_VALID;
4306
4307 /* Can we update the RTT estimates? */
4308 if (tcp->tcp_snd_ts_ok) {
4309 /* Ignore zero timestamp echo-reply. */
4310 if (tcpopt.tcp_opt_ts_ecr != 0) {
4311 tcp_set_rto(tcp, (int32_t)LBOLT_FASTPATH -
4312 (int32_t)tcpopt.tcp_opt_ts_ecr);
4313 }
4314
4315 /* If needed, restart the timer. */
4316 if (tcp->tcp_set_timer == 1) {
4317 TCP_TIMER_RESTART(tcp, tcp->tcp_rto);
4318 tcp->tcp_set_timer = 0;
4319 }
4320 /*
4321 * Update tcp_csuna in case the other side stops sending
4322 * us timestamps.
4323 */
4324 tcp->tcp_csuna = tcp->tcp_snxt;
4325 } else if (SEQ_GT(seg_ack, tcp->tcp_csuna)) {
4326 /*
4327 * An ACK sequence we haven't seen before, so get the RTT
4328 * and update the RTO. But first check if the timestamp is
4329 * valid to use.
4330 */
4331 if ((mp1->b_next != NULL) &&
4332 SEQ_GT(seg_ack, (uint32_t)(uintptr_t)(mp1->b_next)))
4333 tcp_set_rto(tcp, (int32_t)LBOLT_FASTPATH -
|
4288 * By initializing tcp_cwnd_cnt to new tcp_cwnd and
4289 * decrementing it by 1 MSS for every ACKs, tcp_cwnd is
4290 * increased by 1 MSS for every RTTs.
4291 */
4292 if (tcp->tcp_cwnd_cnt <= 0) {
4293 tcp->tcp_cwnd_cnt = cwnd + add;
4294 } else {
4295 tcp->tcp_cwnd_cnt -= add;
4296 add = 0;
4297 }
4298 }
4299 tcp->tcp_cwnd = MIN(cwnd + add, tcp->tcp_cwnd_max);
4300 }
4301
4302 /* See if the latest urgent data has been acknowledged */
4303 if ((tcp->tcp_valid_bits & TCP_URG_VALID) &&
4304 SEQ_GT(seg_ack, tcp->tcp_urg))
4305 tcp->tcp_valid_bits &= ~TCP_URG_VALID;
4306
4307 /* Can we update the RTT estimates? */
4308 if (tcp->tcp_snd_ts_ok && tcpopt.tcp_opt_ts_ecr != 0) {
4309 tcp_set_rto(tcp, (int32_t)LBOLT_FASTPATH -
4310 (int32_t)tcpopt.tcp_opt_ts_ecr);
4311
4312 /* If needed, restart the timer. */
4313 if (tcp->tcp_set_timer == 1) {
4314 TCP_TIMER_RESTART(tcp, tcp->tcp_rto);
4315 tcp->tcp_set_timer = 0;
4316 }
4317 /*
4318 * Update tcp_csuna in case the other side stops sending
4319 * us timestamps.
4320 */
4321 tcp->tcp_csuna = tcp->tcp_snxt;
4322 } else if (SEQ_GT(seg_ack, tcp->tcp_csuna)) {
4323 /*
4324 * An ACK sequence we haven't seen before, so get the RTT
4325 * and update the RTO. But first check if the timestamp is
4326 * valid to use.
4327 */
4328 if ((mp1->b_next != NULL) &&
4329 SEQ_GT(seg_ack, (uint32_t)(uintptr_t)(mp1->b_next)))
4330 tcp_set_rto(tcp, (int32_t)LBOLT_FASTPATH -
|