Lines Matching +full:static +full:- +full:beta

1 /*-
2 * SPDX-License-Identifier: BSD-3-Clause
4 * Copyright (c) 2001-2007, by Cisco Systems, Inc. All rights reserved.
5 * Copyright (c) 2008-2012, by Randall Stewart. All rights reserved.
6 * Copyright (c) 2008-2012, by Michael Tuexen. All rights reserved.
60 static void
63 if ((assoc->max_cwnd > 0) && in sctp_enforce_cwnd_limit()
64 (net->cwnd > assoc->max_cwnd) && in sctp_enforce_cwnd_limit()
65 (net->cwnd > (net->mtu - sizeof(struct sctphdr)))) { in sctp_enforce_cwnd_limit()
66 net->cwnd = assoc->max_cwnd; in sctp_enforce_cwnd_limit()
67 if (net->cwnd < (net->mtu - sizeof(struct sctphdr))) { in sctp_enforce_cwnd_limit()
68 net->cwnd = net->mtu - sizeof(struct sctphdr); in sctp_enforce_cwnd_limit()
73 static void
79 assoc = &stcb->asoc; in sctp_set_initial_cc_param()
83 net->cwnd = min((net->mtu * 4), max((2 * net->mtu), SCTP_INITIAL_CWND)); in sctp_set_initial_cc_param()
89 if ((assoc->max_burst > 0) && (cwnd_in_mtu > assoc->max_burst)) in sctp_set_initial_cc_param()
90 cwnd_in_mtu = assoc->max_burst; in sctp_set_initial_cc_param()
91 net->cwnd = (net->mtu - sizeof(struct sctphdr)) * cwnd_in_mtu; in sctp_set_initial_cc_param()
93 if ((stcb->asoc.sctp_cmt_on_off == SCTP_CMT_RPV1) || in sctp_set_initial_cc_param()
94 (stcb->asoc.sctp_cmt_on_off == SCTP_CMT_RPV2)) { in sctp_set_initial_cc_param()
96 net->cwnd /= assoc->numnets; in sctp_set_initial_cc_param()
97 if (net->cwnd < (net->mtu - sizeof(struct sctphdr))) { in sctp_set_initial_cc_param()
98 net->cwnd = net->mtu - sizeof(struct sctphdr); in sctp_set_initial_cc_param()
102 net->ssthresh = assoc->peers_rwnd; in sctp_set_initial_cc_param()
104 stcb->asoc.my_vtag, ((stcb->sctp_ep->sctp_lport << 16) | (stcb->rport)), net, in sctp_set_initial_cc_param()
105 0, net->cwnd); in sctp_set_initial_cc_param()
112 static void
124 if ((asoc->sctp_cmt_on_off == SCTP_CMT_RPV1) || in sctp_cwnd_update_after_fr()
125 (asoc->sctp_cmt_on_off == SCTP_CMT_RPV2)) { in sctp_cwnd_update_after_fr()
126 TAILQ_FOREACH(net, &asoc->nets, sctp_next) { in sctp_cwnd_update_after_fr()
127 t_ssthresh += net->ssthresh; in sctp_cwnd_update_after_fr()
128 t_cwnd += net->cwnd; in sctp_cwnd_update_after_fr()
129 if (net->lastsa > 0) { in sctp_cwnd_update_after_fr()
130 t_ucwnd_sbw += (uint64_t)net->cwnd / (uint64_t)net->lastsa; in sctp_cwnd_update_after_fr()
138 /*- in sctp_cwnd_update_after_fr()
140 * (net->fast_retran_loss_recovery == 0))) in sctp_cwnd_update_after_fr()
142 TAILQ_FOREACH(net, &asoc->nets, sctp_next) { in sctp_cwnd_update_after_fr()
143 if ((asoc->fast_retran_loss_recovery == 0) || in sctp_cwnd_update_after_fr()
144 (asoc->sctp_cmt_on_off > 0)) { in sctp_cwnd_update_after_fr()
146 if (net->net_ack > 0) { in sctp_cwnd_update_after_fr()
154 int old_cwnd = net->cwnd; in sctp_cwnd_update_after_fr()
156 if ((asoc->sctp_cmt_on_off == SCTP_CMT_RPV1) || in sctp_cwnd_update_after_fr()
157 (asoc->sctp_cmt_on_off == SCTP_CMT_RPV2)) { in sctp_cwnd_update_after_fr()
158 if (asoc->sctp_cmt_on_off == SCTP_CMT_RPV1) { in sctp_cwnd_update_after_fr()
159 net->ssthresh = (uint32_t)(((uint64_t)4 * in sctp_cwnd_update_after_fr()
160 (uint64_t)net->mtu * in sctp_cwnd_update_after_fr()
161 (uint64_t)net->ssthresh) / in sctp_cwnd_update_after_fr()
164 if (asoc->sctp_cmt_on_off == SCTP_CMT_RPV2) { in sctp_cwnd_update_after_fr()
167 srtt = net->lastsa; in sctp_cwnd_update_after_fr()
179 net->ssthresh = (uint32_t)(((uint64_t)4 * in sctp_cwnd_update_after_fr()
180 (uint64_t)net->mtu * in sctp_cwnd_update_after_fr()
181 (uint64_t)net->cwnd) / in sctp_cwnd_update_after_fr()
186 if ((net->cwnd > t_cwnd / 2) && in sctp_cwnd_update_after_fr()
187 (net->ssthresh < net->cwnd - t_cwnd / 2)) { in sctp_cwnd_update_after_fr()
188 net->ssthresh = net->cwnd - t_cwnd / 2; in sctp_cwnd_update_after_fr()
190 if (net->ssthresh < net->mtu) { in sctp_cwnd_update_after_fr()
191 net->ssthresh = net->mtu; in sctp_cwnd_update_after_fr()
194 net->ssthresh = net->cwnd / 2; in sctp_cwnd_update_after_fr()
195 if (net->ssthresh < (net->mtu * 2)) { in sctp_cwnd_update_after_fr()
196 net->ssthresh = 2 * net->mtu; in sctp_cwnd_update_after_fr()
199 net->cwnd = net->ssthresh; in sctp_cwnd_update_after_fr()
202 stcb->asoc.my_vtag, ((stcb->sctp_ep->sctp_lport << 16) | (stcb->rport)), net, in sctp_cwnd_update_after_fr()
203 old_cwnd, net->cwnd); in sctp_cwnd_update_after_fr()
205 sctp_log_cwnd(stcb, net, (net->cwnd - old_cwnd), in sctp_cwnd_update_after_fr()
208 lchk = TAILQ_FIRST(&asoc->send_queue); in sctp_cwnd_update_after_fr()
210 net->partial_bytes_acked = 0; in sctp_cwnd_update_after_fr()
212 asoc->fast_retran_loss_recovery = 1; in sctp_cwnd_update_after_fr()
215 asoc->fast_recovery_tsn = asoc->sending_seq - 1; in sctp_cwnd_update_after_fr()
217 asoc->fast_recovery_tsn = lchk->rec.data.tsn - 1; in sctp_cwnd_update_after_fr()
221 * CMT fast recovery -- per destination in sctp_cwnd_update_after_fr()
224 net->fast_retran_loss_recovery = 1; in sctp_cwnd_update_after_fr()
228 net->fast_recovery_tsn = asoc->sending_seq - 1; in sctp_cwnd_update_after_fr()
230 net->fast_recovery_tsn = lchk->rec.data.tsn - 1; in sctp_cwnd_update_after_fr()
234 stcb->sctp_ep, stcb, net, in sctp_cwnd_update_after_fr()
237 stcb->sctp_ep, stcb, net); in sctp_cwnd_update_after_fr()
239 } else if (net->net_ack > 0) { in sctp_cwnd_update_after_fr()
254 static int
260 probepoint = (((uint64_t)net->cwnd) << 32); in cc_bw_same()
261 if (net->rtt > net->cc_mod.rtcc.lbw_rtt + rtt_offset) { in cc_bw_same()
270 ((net->cc_mod.rtcc.lbw << 32) | nbw), in cc_bw_same()
271 ((net->cc_mod.rtcc.lbw_rtt << 32) | net->rtt), in cc_bw_same()
272 net->flight_size, in cc_bw_same()
274 if ((net->cc_mod.rtcc.steady_step) && (inst_ind != SCTP_INST_LOOSING)) { in cc_bw_same()
275 if (net->cc_mod.rtcc.last_step_state == 5) in cc_bw_same()
276 net->cc_mod.rtcc.step_cnt++; in cc_bw_same()
278 net->cc_mod.rtcc.step_cnt = 1; in cc_bw_same()
279 net->cc_mod.rtcc.last_step_state = 5; in cc_bw_same()
280 if ((net->cc_mod.rtcc.step_cnt == net->cc_mod.rtcc.steady_step) || in cc_bw_same()
281 ((net->cc_mod.rtcc.step_cnt > net->cc_mod.rtcc.steady_step) && in cc_bw_same()
282 ((net->cc_mod.rtcc.step_cnt % net->cc_mod.rtcc.steady_step) == 0))) { in cc_bw_same()
284 oth = net->cc_mod.rtcc.vol_reduce; in cc_bw_same()
286 oth |= net->cc_mod.rtcc.step_cnt; in cc_bw_same()
288 oth |= net->cc_mod.rtcc.last_step_state; in cc_bw_same()
291 ((net->cc_mod.rtcc.lbw << 32) | nbw), in cc_bw_same()
292 ((net->cc_mod.rtcc.lbw_rtt << 32) | net->rtt), in cc_bw_same()
295 if (net->cwnd > (4 * net->mtu)) { in cc_bw_same()
296 net->cwnd -= net->mtu; in cc_bw_same()
297 net->cc_mod.rtcc.vol_reduce++; in cc_bw_same()
299 net->cc_mod.rtcc.step_cnt = 0; in cc_bw_same()
305 if (net->rtt < net->cc_mod.rtcc.lbw_rtt - rtt_offset) { in cc_bw_same()
315 ((net->cc_mod.rtcc.lbw << 32) | nbw), in cc_bw_same()
316 ((net->cc_mod.rtcc.lbw_rtt << 32) | net->rtt), in cc_bw_same()
317 net->flight_size, in cc_bw_same()
319 if (net->cc_mod.rtcc.steady_step) { in cc_bw_same()
320 oth = net->cc_mod.rtcc.vol_reduce; in cc_bw_same()
322 oth |= net->cc_mod.rtcc.step_cnt; in cc_bw_same()
324 oth |= net->cc_mod.rtcc.last_step_state; in cc_bw_same()
327 ((net->cc_mod.rtcc.lbw << 32) | nbw), in cc_bw_same()
328 ((net->cc_mod.rtcc.lbw_rtt << 32) | net->rtt), in cc_bw_same()
331 if ((net->cc_mod.rtcc.last_step_state == 5) && in cc_bw_same()
332 (net->cc_mod.rtcc.step_cnt > net->cc_mod.rtcc.steady_step)) { in cc_bw_same()
334 net->cc_mod.rtcc.step_cnt = 0; in cc_bw_same()
337 net->cc_mod.rtcc.last_step_state = 6; in cc_bw_same()
338 net->cc_mod.rtcc.step_cnt = 0; in cc_bw_same()
341 net->cc_mod.rtcc.lbw = nbw; in cc_bw_same()
342 net->cc_mod.rtcc.lbw_rtt = net->rtt; in cc_bw_same()
343 net->cc_mod.rtcc.cwnd_at_bw_set = net->cwnd; in cc_bw_same()
355 probepoint |= ((7 << 16) | net->cc_mod.rtcc.ret_from_eq); in cc_bw_same()
358 ((net->cc_mod.rtcc.lbw << 32) | nbw), in cc_bw_same()
359 ((net->cc_mod.rtcc.lbw_rtt << 32) | net->rtt), in cc_bw_same()
360 net->flight_size, in cc_bw_same()
362 if ((net->cc_mod.rtcc.steady_step) && (inst_ind != SCTP_INST_LOOSING)) { in cc_bw_same()
363 if (net->cc_mod.rtcc.last_step_state == 5) in cc_bw_same()
364 net->cc_mod.rtcc.step_cnt++; in cc_bw_same()
366 net->cc_mod.rtcc.step_cnt = 1; in cc_bw_same()
367 net->cc_mod.rtcc.last_step_state = 5; in cc_bw_same()
368 if ((net->cc_mod.rtcc.step_cnt == net->cc_mod.rtcc.steady_step) || in cc_bw_same()
369 ((net->cc_mod.rtcc.step_cnt > net->cc_mod.rtcc.steady_step) && in cc_bw_same()
370 ((net->cc_mod.rtcc.step_cnt % net->cc_mod.rtcc.steady_step) == 0))) { in cc_bw_same()
372 if (net->cwnd > (4 * net->mtu)) { in cc_bw_same()
373 net->cwnd -= net->mtu; in cc_bw_same()
374 net->cc_mod.rtcc.vol_reduce++; in cc_bw_same()
377 net->cc_mod.rtcc.step_cnt = 0; in cc_bw_same()
386 return ((int)net->cc_mod.rtcc.ret_from_eq); in cc_bw_same()
389 static int
396 probepoint = (((uint64_t)net->cwnd) << 32); in cc_bw_decrease()
397 if (net->rtt > net->cc_mod.rtcc.lbw_rtt + rtt_offset) { in cc_bw_decrease()
400 if ((net->cwnd > net->cc_mod.rtcc.cwnd_at_bw_set) && in cc_bw_decrease()
407 ((net->cc_mod.rtcc.lbw << 32) | nbw), in cc_bw_decrease()
408 ((net->cc_mod.rtcc.lbw_rtt << 32) | net->rtt), in cc_bw_decrease()
409 net->flight_size, in cc_bw_decrease()
411 if (net->cc_mod.rtcc.ret_from_eq) { in cc_bw_decrease()
416 net->ssthresh = net->cwnd - 1; in cc_bw_decrease()
417 net->partial_bytes_acked = 0; in cc_bw_decrease()
425 ((net->cc_mod.rtcc.lbw << 32) | nbw), in cc_bw_decrease()
426 ((net->cc_mod.rtcc.lbw_rtt << 32) | net->rtt), in cc_bw_decrease()
427 net->flight_size, in cc_bw_decrease()
429 /* Someone else - fight for more? */ in cc_bw_decrease()
430 if (net->cc_mod.rtcc.steady_step) { in cc_bw_decrease()
431 oth = net->cc_mod.rtcc.vol_reduce; in cc_bw_decrease()
433 oth |= net->cc_mod.rtcc.step_cnt; in cc_bw_decrease()
435 oth |= net->cc_mod.rtcc.last_step_state; in cc_bw_decrease()
438 ((net->cc_mod.rtcc.lbw << 32) | nbw), in cc_bw_decrease()
439 ((net->cc_mod.rtcc.lbw_rtt << 32) | net->rtt), in cc_bw_decrease()
446 if ((net->cc_mod.rtcc.vol_reduce) && in cc_bw_decrease()
448 net->cwnd += net->mtu; in cc_bw_decrease()
449 sctp_enforce_cwnd_limit(&stcb->asoc, net); in cc_bw_decrease()
450 net->cc_mod.rtcc.vol_reduce--; in cc_bw_decrease()
452 net->cc_mod.rtcc.last_step_state = 2; in cc_bw_decrease()
453 net->cc_mod.rtcc.step_cnt = 0; in cc_bw_decrease()
456 } else if (net->rtt < net->cc_mod.rtcc.lbw_rtt - rtt_offset) { in cc_bw_decrease()
462 ((net->cc_mod.rtcc.lbw << 32) | nbw), in cc_bw_decrease()
463 ((net->cc_mod.rtcc.lbw_rtt << 32) | net->rtt), in cc_bw_decrease()
464 net->flight_size, in cc_bw_decrease()
466 if (net->cc_mod.rtcc.steady_step) { in cc_bw_decrease()
467 oth = net->cc_mod.rtcc.vol_reduce; in cc_bw_decrease()
469 oth |= net->cc_mod.rtcc.step_cnt; in cc_bw_decrease()
471 oth |= net->cc_mod.rtcc.last_step_state; in cc_bw_decrease()
474 ((net->cc_mod.rtcc.lbw << 32) | nbw), in cc_bw_decrease()
475 ((net->cc_mod.rtcc.lbw_rtt << 32) | net->rtt), in cc_bw_decrease()
478 if ((net->cc_mod.rtcc.vol_reduce) && in cc_bw_decrease()
480 net->cwnd += net->mtu; in cc_bw_decrease()
481 sctp_enforce_cwnd_limit(&stcb->asoc, net); in cc_bw_decrease()
482 net->cc_mod.rtcc.vol_reduce--; in cc_bw_decrease()
484 net->cc_mod.rtcc.last_step_state = 3; in cc_bw_decrease()
485 net->cc_mod.rtcc.step_cnt = 0; in cc_bw_decrease()
494 ((net->cc_mod.rtcc.lbw << 32) | nbw), in cc_bw_decrease()
495 ((net->cc_mod.rtcc.lbw_rtt << 32) | net->rtt), in cc_bw_decrease()
496 net->flight_size, in cc_bw_decrease()
498 if (net->cc_mod.rtcc.steady_step) { in cc_bw_decrease()
499 oth = net->cc_mod.rtcc.vol_reduce; in cc_bw_decrease()
501 oth |= net->cc_mod.rtcc.step_cnt; in cc_bw_decrease()
503 oth |= net->cc_mod.rtcc.last_step_state; in cc_bw_decrease()
506 ((net->cc_mod.rtcc.lbw << 32) | nbw), in cc_bw_decrease()
507 ((net->cc_mod.rtcc.lbw_rtt << 32) | net->rtt), in cc_bw_decrease()
510 if ((net->cc_mod.rtcc.vol_reduce) && in cc_bw_decrease()
512 net->cwnd += net->mtu; in cc_bw_decrease()
513 sctp_enforce_cwnd_limit(&stcb->asoc, net); in cc_bw_decrease()
514 net->cc_mod.rtcc.vol_reduce--; in cc_bw_decrease()
516 net->cc_mod.rtcc.last_step_state = 4; in cc_bw_decrease()
517 net->cc_mod.rtcc.step_cnt = 0; in cc_bw_decrease()
520 net->cc_mod.rtcc.lbw = nbw; in cc_bw_decrease()
521 net->cc_mod.rtcc.lbw_rtt = net->rtt; in cc_bw_decrease()
522 net->cc_mod.rtcc.cwnd_at_bw_set = net->cwnd; in cc_bw_decrease()
530 static int
541 probepoint = (((uint64_t)net->cwnd) << 32); in cc_bw_increase()
544 ((net->cc_mod.rtcc.lbw << 32) | nbw), in cc_bw_increase()
545 ((net->cc_mod.rtcc.lbw_rtt << 32) | net->rtt), in cc_bw_increase()
546 net->flight_size, in cc_bw_increase()
548 if (net->cc_mod.rtcc.steady_step) { in cc_bw_increase()
549 oth = net->cc_mod.rtcc.vol_reduce; in cc_bw_increase()
551 oth |= net->cc_mod.rtcc.step_cnt; in cc_bw_increase()
553 oth |= net->cc_mod.rtcc.last_step_state; in cc_bw_increase()
556 ((net->cc_mod.rtcc.lbw << 32) | nbw), in cc_bw_increase()
557 ((net->cc_mod.rtcc.lbw_rtt << 32) | net->rtt), in cc_bw_increase()
560 net->cc_mod.rtcc.last_step_state = 0; in cc_bw_increase()
561 net->cc_mod.rtcc.step_cnt = 0; in cc_bw_increase()
562 net->cc_mod.rtcc.vol_reduce = 0; in cc_bw_increase()
564 net->cc_mod.rtcc.lbw = nbw; in cc_bw_increase()
565 net->cc_mod.rtcc.lbw_rtt = net->rtt; in cc_bw_increase()
566 net->cc_mod.rtcc.cwnd_at_bw_set = net->cwnd; in cc_bw_increase()
573 static int
584 /*- in cc_bw_limit()
593 * ---------------------------------- in cc_bw_limit()
597 * ---------------------------------- in cc_bw_limit()
599 * ---------------------------------- in cc_bw_limit()
601 * ---------------------------------- in cc_bw_limit()
603 * ---------------------------------- in cc_bw_limit()
605 * ---------------------------------- in cc_bw_limit()
607 * ---------------------------------- in cc_bw_limit()
609 * ---------------------------------- in cc_bw_limit()
611 * ---------------------------------- in cc_bw_limit()
613 * ---------------------------------- in cc_bw_limit()
622 rtt = stcb->asoc.my_vtag; in cc_bw_limit()
623 vtag = (rtt << 32) | (((uint32_t)(stcb->sctp_ep->sctp_lport)) << 16) | (stcb->rport); in cc_bw_limit()
624 probepoint = (((uint64_t)net->cwnd) << 32); in cc_bw_limit()
625 rtt = net->rtt; in cc_bw_limit()
626 if (net->cc_mod.rtcc.rtt_set_this_sack) { in cc_bw_limit()
627 net->cc_mod.rtcc.rtt_set_this_sack = 0; in cc_bw_limit()
628 bytes_for_this_rtt = net->cc_mod.rtcc.bw_bytes - net->cc_mod.rtcc.bw_bytes_at_last_rttc; in cc_bw_limit()
629 net->cc_mod.rtcc.bw_bytes_at_last_rttc = net->cc_mod.rtcc.bw_bytes; in cc_bw_limit()
630 if (net->rtt) { in cc_bw_limit()
631 div = net->rtt / 1000; in cc_bw_limit()
643 inst_ind = net->cc_mod.rtcc.last_inst_ind; in cc_bw_limit()
644 inst_bw = bytes_for_this_rtt / (uint64_t)(net->rtt); in cc_bw_limit()
649 inst_ind = net->cc_mod.rtcc.last_inst_ind; in cc_bw_limit()
657 ((net->cc_mod.rtcc.lbw_rtt << 32) | rtt), in cc_bw_limit()
658 net->flight_size, in cc_bw_limit()
662 inst_ind = net->cc_mod.rtcc.last_inst_ind; in cc_bw_limit()
664 bw_offset = net->cc_mod.rtcc.lbw >> bw_shift; in cc_bw_limit()
665 if (nbw > net->cc_mod.rtcc.lbw + bw_offset) { in cc_bw_limit()
669 rtt_offset = net->cc_mod.rtcc.lbw_rtt >> SCTP_BASE_SYSCTL(sctp_rttvar_rtt); in cc_bw_limit()
670 if (nbw < net->cc_mod.rtcc.lbw - bw_offset) { in cc_bw_limit()
680 net->cc_mod.rtcc.last_inst_ind = inst_ind; in cc_bw_limit()
684 static void
703 if ((stcb->asoc.sctp_cmt_on_off == SCTP_CMT_RPV1) || in sctp_cwnd_update_after_sack_common()
704 (stcb->asoc.sctp_cmt_on_off == SCTP_CMT_RPV2) || in sctp_cwnd_update_after_sack_common()
705 (stcb->asoc.sctp_cmt_on_off == SCTP_CMT_MPTCP)) { in sctp_cwnd_update_after_sack_common()
707 TAILQ_FOREACH(net, &stcb->asoc.nets, sctp_next) { in sctp_cwnd_update_after_sack_common()
708 t_ssthresh += net->ssthresh; in sctp_cwnd_update_after_sack_common()
710 srtt = net->lastsa; in sctp_cwnd_update_after_sack_common()
714 t_ucwnd_sbw += (uint64_t)net->cwnd / (uint64_t)srtt; in sctp_cwnd_update_after_sack_common()
715 t_path_mptcp += (((uint64_t)net->cwnd) << SHIFT_MPTCP_MULTI_Z) / in sctp_cwnd_update_after_sack_common()
716 (((uint64_t)net->mtu) * (uint64_t)srtt); in sctp_cwnd_update_after_sack_common()
717 tmp = (((uint64_t)net->cwnd) << SHIFT_MPTCP_MULTI_N) / in sctp_cwnd_update_after_sack_common()
718 ((uint64_t)net->mtu * (uint64_t)(srtt * srtt)); in sctp_cwnd_update_after_sack_common()
739 TAILQ_FOREACH(net, &asoc->nets, sctp_next) { in sctp_cwnd_update_after_sack_common()
744 if (net->fast_retran_loss_recovery && net->new_pseudo_cumack) { in sctp_cwnd_update_after_sack_common()
745 if (SCTP_TSN_GE(asoc->last_acked_seq, net->fast_recovery_tsn) || in sctp_cwnd_update_after_sack_common()
746 SCTP_TSN_GE(net->pseudo_cumack, net->fast_recovery_tsn)) { in sctp_cwnd_update_after_sack_common()
747 net->will_exit_fast_recovery = 1; in sctp_cwnd_update_after_sack_common()
752 if (net->net_ack == 0) { in sctp_cwnd_update_after_sack_common()
763 * if (sctp_cmt_on_off > 0 && net->fast_retran_loss_recovery in sctp_cwnd_update_after_sack_common()
764 * && net->will_exit_fast_recovery == 0) { @@@ Do something in sctp_cwnd_update_after_sack_common()
766 * asoc->fast_retran_loss_recovery && will_exit == 0) { in sctp_cwnd_update_after_sack_common()
770 if (asoc->fast_retran_loss_recovery && in sctp_cwnd_update_after_sack_common()
772 (asoc->sctp_cmt_on_off == 0)) { in sctp_cwnd_update_after_sack_common()
782 if (use_rtcc && (net->cc_mod.rtcc.tls_needs_set > 0)) { in sctp_cwnd_update_after_sack_common()
792 if ((net->cc_mod.rtcc.new_tot_time / 1000) > 0) { in sctp_cwnd_update_after_sack_common()
793 nbw = net->cc_mod.rtcc.bw_bytes / (net->cc_mod.rtcc.new_tot_time / 1000); in sctp_cwnd_update_after_sack_common()
795 nbw = net->cc_mod.rtcc.bw_bytes; in sctp_cwnd_update_after_sack_common()
797 if (net->cc_mod.rtcc.lbw) { in sctp_cwnd_update_after_sack_common()
805 probepoint = (((uint64_t)net->cwnd) << 32); in sctp_cwnd_update_after_sack_common()
807 vtag = (net->rtt << 32) | in sctp_cwnd_update_after_sack_common()
808 (((uint32_t)(stcb->sctp_ep->sctp_lport)) << 16) | in sctp_cwnd_update_after_sack_common()
809 (stcb->rport); in sctp_cwnd_update_after_sack_common()
814 ((net->cc_mod.rtcc.lbw_rtt << 32) | net->rtt), in sctp_cwnd_update_after_sack_common()
815 net->flight_size, in sctp_cwnd_update_after_sack_common()
817 net->cc_mod.rtcc.lbw = nbw; in sctp_cwnd_update_after_sack_common()
818 net->cc_mod.rtcc.lbw_rtt = net->rtt; in sctp_cwnd_update_after_sack_common()
819 if (net->cc_mod.rtcc.rtt_set_this_sack) { in sctp_cwnd_update_after_sack_common()
820 net->cc_mod.rtcc.rtt_set_this_sack = 0; in sctp_cwnd_update_after_sack_common()
821 net->cc_mod.rtcc.bw_bytes_at_last_rttc = net->cc_mod.rtcc.bw_bytes; in sctp_cwnd_update_after_sack_common()
826 * CMT: CUC algorithm. Update cwnd if pseudo-cumack has in sctp_cwnd_update_after_sack_common()
830 ((asoc->sctp_cmt_on_off > 0) && net->new_pseudo_cumack)) { in sctp_cwnd_update_after_sack_common()
832 if (net->cwnd <= net->ssthresh) { in sctp_cwnd_update_after_sack_common()
834 if (net->flight_size + net->net_ack >= net->cwnd) { in sctp_cwnd_update_after_sack_common()
837 old_cwnd = net->cwnd; in sctp_cwnd_update_after_sack_common()
838 switch (asoc->sctp_cmt_on_off) { in sctp_cwnd_update_after_sack_common()
840 limit = (uint32_t)(((uint64_t)net->mtu * in sctp_cwnd_update_after_sack_common()
842 (uint64_t)net->ssthresh) / in sctp_cwnd_update_after_sack_common()
844 incr = (uint32_t)(((uint64_t)net->net_ack * in sctp_cwnd_update_after_sack_common()
845 (uint64_t)net->ssthresh) / in sctp_cwnd_update_after_sack_common()
859 srtt = net->lastsa; in sctp_cwnd_update_after_sack_common()
863 limit = (uint32_t)(((uint64_t)net->mtu * in sctp_cwnd_update_after_sack_common()
865 (uint64_t)net->cwnd) / in sctp_cwnd_update_after_sack_common()
868 incr = (uint32_t)(((uint64_t)net->net_ack * in sctp_cwnd_update_after_sack_common()
869 (uint64_t)net->cwnd) / in sctp_cwnd_update_after_sack_common()
880 limit = (uint32_t)(((uint64_t)net->mtu * in sctp_cwnd_update_after_sack_common()
884 incr = (uint32_t)(((uint64_t)net->net_ack * in sctp_cwnd_update_after_sack_common()
890 if (incr > net->net_ack) { in sctp_cwnd_update_after_sack_common()
891 incr = net->net_ack; in sctp_cwnd_update_after_sack_common()
893 if (incr > net->mtu) { in sctp_cwnd_update_after_sack_common()
894 incr = net->mtu; in sctp_cwnd_update_after_sack_common()
898 incr = net->net_ack; in sctp_cwnd_update_after_sack_common()
899 if (incr > net->mtu * SCTP_BASE_SYSCTL(sctp_L2_abc_variable)) { in sctp_cwnd_update_after_sack_common()
900 incr = net->mtu * SCTP_BASE_SYSCTL(sctp_L2_abc_variable); in sctp_cwnd_update_after_sack_common()
904 net->cwnd += incr; in sctp_cwnd_update_after_sack_common()
911 stcb->asoc.my_vtag, in sctp_cwnd_update_after_sack_common()
912 ((stcb->sctp_ep->sctp_lport << 16) | (stcb->rport)), in sctp_cwnd_update_after_sack_common()
914 old_cwnd, net->cwnd); in sctp_cwnd_update_after_sack_common()
917 sctp_log_cwnd(stcb, net, net->net_ack, in sctp_cwnd_update_after_sack_common()
926 net->partial_bytes_acked += net->net_ack; in sctp_cwnd_update_after_sack_common()
928 if ((net->flight_size + net->net_ack >= net->cwnd) && in sctp_cwnd_update_after_sack_common()
929 (net->partial_bytes_acked >= net->cwnd)) { in sctp_cwnd_update_after_sack_common()
930 net->partial_bytes_acked -= net->cwnd; in sctp_cwnd_update_after_sack_common()
931 old_cwnd = net->cwnd; in sctp_cwnd_update_after_sack_common()
932 switch (asoc->sctp_cmt_on_off) { in sctp_cwnd_update_after_sack_common()
934 incr = (uint32_t)(((uint64_t)net->mtu * in sctp_cwnd_update_after_sack_common()
935 (uint64_t)net->ssthresh) / in sctp_cwnd_update_after_sack_common()
946 srtt = net->lastsa; in sctp_cwnd_update_after_sack_common()
950 incr = (uint32_t)((uint64_t)net->mtu * in sctp_cwnd_update_after_sack_common()
951 (uint64_t)net->cwnd / in sctp_cwnd_update_after_sack_common()
961 (uint64_t)net->cwnd) >> in sctp_cwnd_update_after_sack_common()
963 if (incr > net->mtu) { in sctp_cwnd_update_after_sack_common()
964 incr = net->mtu; in sctp_cwnd_update_after_sack_common()
968 incr = net->mtu; in sctp_cwnd_update_after_sack_common()
971 net->cwnd += incr; in sctp_cwnd_update_after_sack_common()
974 stcb->asoc.my_vtag, in sctp_cwnd_update_after_sack_common()
975 ((stcb->sctp_ep->sctp_lport << 16) | (stcb->rport)), in sctp_cwnd_update_after_sack_common()
977 old_cwnd, net->cwnd); in sctp_cwnd_update_after_sack_common()
979 sctp_log_cwnd(stcb, net, net->mtu, in sctp_cwnd_update_after_sack_common()
984 sctp_log_cwnd(stcb, net, net->net_ack, in sctp_cwnd_update_after_sack_common()
991 sctp_log_cwnd(stcb, net, net->mtu, in sctp_cwnd_update_after_sack_common()
998 static void
1003 old_cwnd = net->cwnd; in sctp_cwnd_update_exit_pf_common()
1004 net->cwnd = net->mtu; in sctp_cwnd_update_exit_pf_common()
1006 stcb->asoc.my_vtag, ((stcb->sctp_ep->sctp_lport << 16) | (stcb->rport)), net, in sctp_cwnd_update_exit_pf_common()
1007 old_cwnd, net->cwnd); in sctp_cwnd_update_exit_pf_common()
1009 (void *)net, net->cwnd); in sctp_cwnd_update_exit_pf_common()
1012 static void
1015 int old_cwnd = net->cwnd; in sctp_cwnd_update_after_timeout()
1022 if ((stcb->asoc.sctp_cmt_on_off == SCTP_CMT_RPV1) || in sctp_cwnd_update_after_timeout()
1023 (stcb->asoc.sctp_cmt_on_off == SCTP_CMT_RPV2)) { in sctp_cwnd_update_after_timeout()
1028 TAILQ_FOREACH(lnet, &stcb->asoc.nets, sctp_next) { in sctp_cwnd_update_after_timeout()
1029 t_ssthresh += lnet->ssthresh; in sctp_cwnd_update_after_timeout()
1030 t_cwnd += lnet->cwnd; in sctp_cwnd_update_after_timeout()
1031 srtt = lnet->lastsa; in sctp_cwnd_update_after_timeout()
1034 t_ucwnd_sbw += (uint64_t)lnet->cwnd / (uint64_t)srtt; in sctp_cwnd_update_after_timeout()
1043 if (stcb->asoc.sctp_cmt_on_off == SCTP_CMT_RPV1) { in sctp_cwnd_update_after_timeout()
1044 net->ssthresh = (uint32_t)(((uint64_t)4 * in sctp_cwnd_update_after_timeout()
1045 (uint64_t)net->mtu * in sctp_cwnd_update_after_timeout()
1046 (uint64_t)net->ssthresh) / in sctp_cwnd_update_after_timeout()
1051 srtt = net->lastsa; in sctp_cwnd_update_after_timeout()
1058 net->ssthresh = (uint32_t)((uint64_t)t_cwnd - cc_delta); in sctp_cwnd_update_after_timeout()
1060 net->ssthresh = net->mtu; in sctp_cwnd_update_after_timeout()
1063 if ((net->cwnd > t_cwnd / 2) && in sctp_cwnd_update_after_timeout()
1064 (net->ssthresh < net->cwnd - t_cwnd / 2)) { in sctp_cwnd_update_after_timeout()
1065 net->ssthresh = net->cwnd - t_cwnd / 2; in sctp_cwnd_update_after_timeout()
1067 if (net->ssthresh < net->mtu) { in sctp_cwnd_update_after_timeout()
1068 net->ssthresh = net->mtu; in sctp_cwnd_update_after_timeout()
1071 net->ssthresh = max(net->cwnd / 2, 4 * net->mtu); in sctp_cwnd_update_after_timeout()
1073 net->cwnd = net->mtu; in sctp_cwnd_update_after_timeout()
1074 net->partial_bytes_acked = 0; in sctp_cwnd_update_after_timeout()
1076 stcb->asoc.my_vtag, in sctp_cwnd_update_after_timeout()
1077 ((stcb->sctp_ep->sctp_lport << 16) | (stcb->rport)), in sctp_cwnd_update_after_timeout()
1079 old_cwnd, net->cwnd); in sctp_cwnd_update_after_timeout()
1081 sctp_log_cwnd(stcb, net, net->cwnd - old_cwnd, SCTP_CWND_LOG_FROM_RTX); in sctp_cwnd_update_after_timeout()
1085 static void
1089 int old_cwnd = net->cwnd; in sctp_cwnd_update_after_ecn_echo_common()
1091 if ((use_rtcc) && (net->lan_type == SCTP_LAN_LOCAL) && (net->cc_mod.rtcc.use_dccc_ecn)) { in sctp_cwnd_update_after_ecn_echo_common()
1098 if (net->ecn_prev_cwnd < net->cwnd) { in sctp_cwnd_update_after_ecn_echo_common()
1100 net->cwnd = net->ecn_prev_cwnd - (net->mtu * num_pkt_lost); in sctp_cwnd_update_after_ecn_echo_common()
1103 net->cwnd /= 2; in sctp_cwnd_update_after_ecn_echo_common()
1106 net->ssthresh = net->cwnd - (num_pkt_lost * net->mtu); in sctp_cwnd_update_after_ecn_echo_common()
1108 sctp_log_cwnd(stcb, net, (net->cwnd - old_cwnd), SCTP_CWND_LOG_FROM_SAT); in sctp_cwnd_update_after_ecn_echo_common()
1115 net->ssthresh -= (net->mtu * num_pkt_lost); in sctp_cwnd_update_after_ecn_echo_common()
1116 net->cwnd -= (net->mtu * num_pkt_lost); in sctp_cwnd_update_after_ecn_echo_common()
1118 sctp_log_cwnd(stcb, net, (net->cwnd - old_cwnd), SCTP_CWND_LOG_FROM_SAT); in sctp_cwnd_update_after_ecn_echo_common()
1125 net->ssthresh = net->cwnd / 2; in sctp_cwnd_update_after_ecn_echo_common()
1126 if (net->ssthresh < net->mtu) { in sctp_cwnd_update_after_ecn_echo_common()
1127 net->ssthresh = net->mtu; in sctp_cwnd_update_after_ecn_echo_common()
1132 net->RTO <<= 1; in sctp_cwnd_update_after_ecn_echo_common()
1134 net->cwnd = net->ssthresh; in sctp_cwnd_update_after_ecn_echo_common()
1136 stcb->asoc.my_vtag, in sctp_cwnd_update_after_ecn_echo_common()
1137 ((stcb->sctp_ep->sctp_lport << 16) | (stcb->rport)), in sctp_cwnd_update_after_ecn_echo_common()
1139 old_cwnd, net->cwnd); in sctp_cwnd_update_after_ecn_echo_common()
1141 sctp_log_cwnd(stcb, net, (net->cwnd - old_cwnd), SCTP_CWND_LOG_FROM_SAT); in sctp_cwnd_update_after_ecn_echo_common()
1148 static void
1155 int old_cwnd = net->cwnd; in sctp_cwnd_update_after_packet_dropped()
1158 *bottle_bw = ntohl(cp->bottle_bw); in sctp_cwnd_update_after_packet_dropped()
1160 *on_queue = ntohl(cp->current_onq); in sctp_cwnd_update_after_packet_dropped()
1162 * adjust the on-queue if our flight is more it could be that the in sctp_cwnd_update_after_packet_dropped()
1163 * router has not yet gotten data "in-flight" to it in sctp_cwnd_update_after_packet_dropped()
1165 if (*on_queue < net->flight_size) { in sctp_cwnd_update_after_packet_dropped()
1166 *on_queue = net->flight_size; in sctp_cwnd_update_after_packet_dropped()
1169 bw_avail = (uint32_t)(((uint64_t)(*bottle_bw) * net->rtt) / (uint64_t)1000000); in sctp_cwnd_update_after_packet_dropped()
1188 net->partial_bytes_acked = 0; in sctp_cwnd_update_after_packet_dropped()
1190 incr = *on_queue - bw_avail; in sctp_cwnd_update_after_packet_dropped()
1191 if (stcb->asoc.seen_a_sack_this_pkt) { in sctp_cwnd_update_after_packet_dropped()
1196 net->cwnd = net->prev_cwnd; in sctp_cwnd_update_after_packet_dropped()
1199 seg_inflight = net->flight_size / net->mtu; in sctp_cwnd_update_after_packet_dropped()
1200 seg_onqueue = *on_queue / net->mtu; in sctp_cwnd_update_after_packet_dropped()
1204 if (net->cwnd > net->flight_size) { in sctp_cwnd_update_after_packet_dropped()
1212 diff_adj = net->cwnd - net->flight_size; in sctp_cwnd_update_after_packet_dropped()
1216 my_portion -= diff_adj; in sctp_cwnd_update_after_packet_dropped()
1223 net->cwnd -= my_portion; in sctp_cwnd_update_after_packet_dropped()
1226 if (net->cwnd <= net->mtu) { in sctp_cwnd_update_after_packet_dropped()
1227 net->cwnd = net->mtu; in sctp_cwnd_update_after_packet_dropped()
1230 net->ssthresh = net->cwnd - 1; in sctp_cwnd_update_after_packet_dropped()
1236 incr = (bw_avail - *on_queue) >> 2; in sctp_cwnd_update_after_packet_dropped()
1237 if ((stcb->asoc.max_burst > 0) && in sctp_cwnd_update_after_packet_dropped()
1238 (stcb->asoc.max_burst * net->mtu < incr)) { in sctp_cwnd_update_after_packet_dropped()
1239 incr = stcb->asoc.max_burst * net->mtu; in sctp_cwnd_update_after_packet_dropped()
1241 net->cwnd += incr; in sctp_cwnd_update_after_packet_dropped()
1243 if (net->cwnd > bw_avail) { in sctp_cwnd_update_after_packet_dropped()
1245 net->cwnd = bw_avail; in sctp_cwnd_update_after_packet_dropped()
1247 if (net->cwnd < net->mtu) { in sctp_cwnd_update_after_packet_dropped()
1249 net->cwnd = net->mtu; in sctp_cwnd_update_after_packet_dropped()
1251 sctp_enforce_cwnd_limit(&stcb->asoc, net); in sctp_cwnd_update_after_packet_dropped()
1252 if (net->cwnd - old_cwnd != 0) { in sctp_cwnd_update_after_packet_dropped()
1255 stcb->asoc.my_vtag, in sctp_cwnd_update_after_packet_dropped()
1256 ((stcb->sctp_ep->sctp_lport << 16) | (stcb->rport)), in sctp_cwnd_update_after_packet_dropped()
1258 old_cwnd, net->cwnd); in sctp_cwnd_update_after_packet_dropped()
1260 sctp_log_cwnd(stcb, net, (net->cwnd - old_cwnd), in sctp_cwnd_update_after_packet_dropped()
1266 static void
1270 int old_cwnd = net->cwnd; in sctp_cwnd_update_after_output()
1272 if (net->ssthresh < net->cwnd) in sctp_cwnd_update_after_output()
1273 net->ssthresh = net->cwnd; in sctp_cwnd_update_after_output()
1275 net->cwnd = (net->flight_size + (burst_limit * net->mtu)); in sctp_cwnd_update_after_output()
1276 sctp_enforce_cwnd_limit(&stcb->asoc, net); in sctp_cwnd_update_after_output()
1278 stcb->asoc.my_vtag, in sctp_cwnd_update_after_output()
1279 ((stcb->sctp_ep->sctp_lport << 16) | (stcb->rport)), in sctp_cwnd_update_after_output()
1281 old_cwnd, net->cwnd); in sctp_cwnd_update_after_output()
1283 sctp_log_cwnd(stcb, net, (net->cwnd - old_cwnd), SCTP_CWND_LOG_FROM_BRST); in sctp_cwnd_update_after_output()
1288 static void
1297 static void
1310 static void
1317 static void
1321 net->cc_mod.rtcc.bw_bytes += tp1->send_size; in sctp_cwnd_update_rtcc_tsn_acknowledged()
1324 static void
1328 if (net->cc_mod.rtcc.tls_needs_set > 0) { in sctp_cwnd_prepare_rtcc_net_for_sack()
1333 timevalsub(&ltls, &net->cc_mod.rtcc.tls); in sctp_cwnd_prepare_rtcc_net_for_sack()
1334 net->cc_mod.rtcc.new_tot_time = (ltls.tv_sec * 1000000) + ltls.tv_usec; in sctp_cwnd_prepare_rtcc_net_for_sack()
1338 static void
1344 if (net->cc_mod.rtcc.lbw) { in sctp_cwnd_new_rtcc_transmission_begins()
1345 /* Clear the old bw.. we went to 0 in-flight */ in sctp_cwnd_new_rtcc_transmission_begins()
1346 vtag = (net->rtt << 32) | (((uint32_t)(stcb->sctp_ep->sctp_lport)) << 16) | in sctp_cwnd_new_rtcc_transmission_begins()
1347 (stcb->rport); in sctp_cwnd_new_rtcc_transmission_begins()
1348 probepoint = (((uint64_t)net->cwnd) << 32); in sctp_cwnd_new_rtcc_transmission_begins()
1353 ((net->cc_mod.rtcc.lbw << 32) | 0), in sctp_cwnd_new_rtcc_transmission_begins()
1354 ((net->cc_mod.rtcc.lbw_rtt << 32) | net->rtt), in sctp_cwnd_new_rtcc_transmission_begins()
1355 net->flight_size, in sctp_cwnd_new_rtcc_transmission_begins()
1357 net->cc_mod.rtcc.lbw_rtt = 0; in sctp_cwnd_new_rtcc_transmission_begins()
1358 net->cc_mod.rtcc.cwnd_at_bw_set = 0; in sctp_cwnd_new_rtcc_transmission_begins()
1359 net->cc_mod.rtcc.lbw = 0; in sctp_cwnd_new_rtcc_transmission_begins()
1360 net->cc_mod.rtcc.bw_bytes_at_last_rttc = 0; in sctp_cwnd_new_rtcc_transmission_begins()
1361 net->cc_mod.rtcc.vol_reduce = 0; in sctp_cwnd_new_rtcc_transmission_begins()
1362 net->cc_mod.rtcc.bw_tot_time = 0; in sctp_cwnd_new_rtcc_transmission_begins()
1363 net->cc_mod.rtcc.bw_bytes = 0; in sctp_cwnd_new_rtcc_transmission_begins()
1364 net->cc_mod.rtcc.tls_needs_set = 0; in sctp_cwnd_new_rtcc_transmission_begins()
1365 if (net->cc_mod.rtcc.steady_step) { in sctp_cwnd_new_rtcc_transmission_begins()
1366 net->cc_mod.rtcc.vol_reduce = 0; in sctp_cwnd_new_rtcc_transmission_begins()
1367 net->cc_mod.rtcc.step_cnt = 0; in sctp_cwnd_new_rtcc_transmission_begins()
1368 net->cc_mod.rtcc.last_step_state = 0; in sctp_cwnd_new_rtcc_transmission_begins()
1370 if (net->cc_mod.rtcc.ret_from_eq) { in sctp_cwnd_new_rtcc_transmission_begins()
1371 /* less aggressive one - reset cwnd too */ in sctp_cwnd_new_rtcc_transmission_begins()
1380 cwnd = min((net->mtu * 4), max((2 * net->mtu), SCTP_INITIAL_CWND)); in sctp_cwnd_new_rtcc_transmission_begins()
1386 if ((stcb->asoc.max_burst > 0) && (cwnd_in_mtu > stcb->asoc.max_burst)) in sctp_cwnd_new_rtcc_transmission_begins()
1387 cwnd_in_mtu = stcb->asoc.max_burst; in sctp_cwnd_new_rtcc_transmission_begins()
1388 cwnd = (net->mtu - sizeof(struct sctphdr)) * cwnd_in_mtu; in sctp_cwnd_new_rtcc_transmission_begins()
1390 if (net->cwnd > cwnd) { in sctp_cwnd_new_rtcc_transmission_begins()
1395 net->cwnd = cwnd; in sctp_cwnd_new_rtcc_transmission_begins()
1401 static void
1408 stcb->asoc.use_precise_time = 1; in sctp_set_rtcc_initial_cc_param()
1409 probepoint = (((uint64_t)net->cwnd) << 32); in sctp_set_rtcc_initial_cc_param()
1411 vtag = (net->rtt << 32) | in sctp_set_rtcc_initial_cc_param()
1412 (((uint32_t)(stcb->sctp_ep->sctp_lport)) << 16) | in sctp_set_rtcc_initial_cc_param()
1413 (stcb->rport); in sctp_set_rtcc_initial_cc_param()
1420 net->cc_mod.rtcc.lbw_rtt = 0; in sctp_set_rtcc_initial_cc_param()
1421 net->cc_mod.rtcc.cwnd_at_bw_set = 0; in sctp_set_rtcc_initial_cc_param()
1422 net->cc_mod.rtcc.vol_reduce = 0; in sctp_set_rtcc_initial_cc_param()
1423 net->cc_mod.rtcc.lbw = 0; in sctp_set_rtcc_initial_cc_param()
1424 net->cc_mod.rtcc.vol_reduce = 0; in sctp_set_rtcc_initial_cc_param()
1425 net->cc_mod.rtcc.bw_bytes_at_last_rttc = 0; in sctp_set_rtcc_initial_cc_param()
1426 net->cc_mod.rtcc.bw_tot_time = 0; in sctp_set_rtcc_initial_cc_param()
1427 net->cc_mod.rtcc.bw_bytes = 0; in sctp_set_rtcc_initial_cc_param()
1428 net->cc_mod.rtcc.tls_needs_set = 0; in sctp_set_rtcc_initial_cc_param()
1429 net->cc_mod.rtcc.ret_from_eq = SCTP_BASE_SYSCTL(sctp_rttvar_eqret); in sctp_set_rtcc_initial_cc_param()
1430 net->cc_mod.rtcc.steady_step = SCTP_BASE_SYSCTL(sctp_steady_step); in sctp_set_rtcc_initial_cc_param()
1431 net->cc_mod.rtcc.use_dccc_ecn = SCTP_BASE_SYSCTL(sctp_use_dccc_ecn); in sctp_set_rtcc_initial_cc_param()
1432 net->cc_mod.rtcc.step_cnt = 0; in sctp_set_rtcc_initial_cc_param()
1433 net->cc_mod.rtcc.last_step_state = 0; in sctp_set_rtcc_initial_cc_param()
1436 static int
1444 if (cc_opt->option == SCTP_CC_OPT_RTCC_SETMODE) { in sctp_cwnd_rtcc_socket_option()
1445 if ((cc_opt->aid_value.assoc_value != 0) && in sctp_cwnd_rtcc_socket_option()
1446 (cc_opt->aid_value.assoc_value != 1)) { in sctp_cwnd_rtcc_socket_option()
1449 TAILQ_FOREACH(net, &stcb->asoc.nets, sctp_next) { in sctp_cwnd_rtcc_socket_option()
1450 net->cc_mod.rtcc.ret_from_eq = cc_opt->aid_value.assoc_value; in sctp_cwnd_rtcc_socket_option()
1452 } else if (cc_opt->option == SCTP_CC_OPT_USE_DCCC_ECN) { in sctp_cwnd_rtcc_socket_option()
1453 if ((cc_opt->aid_value.assoc_value != 0) && in sctp_cwnd_rtcc_socket_option()
1454 (cc_opt->aid_value.assoc_value != 1)) { in sctp_cwnd_rtcc_socket_option()
1457 TAILQ_FOREACH(net, &stcb->asoc.nets, sctp_next) { in sctp_cwnd_rtcc_socket_option()
1458 net->cc_mod.rtcc.use_dccc_ecn = cc_opt->aid_value.assoc_value; in sctp_cwnd_rtcc_socket_option()
1460 } else if (cc_opt->option == SCTP_CC_OPT_STEADY_STEP) { in sctp_cwnd_rtcc_socket_option()
1461 TAILQ_FOREACH(net, &stcb->asoc.nets, sctp_next) { in sctp_cwnd_rtcc_socket_option()
1462 net->cc_mod.rtcc.steady_step = cc_opt->aid_value.assoc_value; in sctp_cwnd_rtcc_socket_option()
1469 if (cc_opt->option == SCTP_CC_OPT_RTCC_SETMODE) { in sctp_cwnd_rtcc_socket_option()
1470 net = TAILQ_FIRST(&stcb->asoc.nets); in sctp_cwnd_rtcc_socket_option()
1474 cc_opt->aid_value.assoc_value = net->cc_mod.rtcc.ret_from_eq; in sctp_cwnd_rtcc_socket_option()
1475 } else if (cc_opt->option == SCTP_CC_OPT_USE_DCCC_ECN) { in sctp_cwnd_rtcc_socket_option()
1476 net = TAILQ_FIRST(&stcb->asoc.nets); in sctp_cwnd_rtcc_socket_option()
1480 cc_opt->aid_value.assoc_value = net->cc_mod.rtcc.use_dccc_ecn; in sctp_cwnd_rtcc_socket_option()
1481 } else if (cc_opt->option == SCTP_CC_OPT_STEADY_STEP) { in sctp_cwnd_rtcc_socket_option()
1482 net = TAILQ_FIRST(&stcb->asoc.nets); in sctp_cwnd_rtcc_socket_option()
1486 cc_opt->aid_value.assoc_value = net->cc_mod.rtcc.steady_step; in sctp_cwnd_rtcc_socket_option()
1494 static void
1498 if (net->cc_mod.rtcc.tls_needs_set == 0) { in sctp_cwnd_update_rtcc_packet_transmitted()
1499 SCTP_GETPTIME_TIMEVAL(&net->cc_mod.rtcc.tls); in sctp_cwnd_update_rtcc_packet_transmitted()
1500 net->cc_mod.rtcc.tls_needs_set = 2; in sctp_cwnd_update_rtcc_packet_transmitted()
1504 static void
1513 static void
1518 net->cc_mod.rtcc.rtt_set_this_sack = 1; in sctp_rtt_rtcc_calculated()
1521 /* Here starts Sally Floyds HS-TCP */
1531 static const struct sctp_hs_raise_drop sctp_cwnd_adjust[SCTP_HS_TABLE_SIZE] = {
1607 static void
1611 int old_cwnd = net->cwnd; in sctp_hs_cwnd_increase()
1613 cur_val = net->cwnd >> 10; in sctp_hs_cwnd_increase()
1614 indx = SCTP_HS_TABLE_SIZE - 1; in sctp_hs_cwnd_increase()
1618 if (net->net_ack > net->mtu) { in sctp_hs_cwnd_increase()
1619 net->cwnd += net->mtu; in sctp_hs_cwnd_increase()
1621 net->cwnd += net->net_ack; in sctp_hs_cwnd_increase()
1624 for (i = net->last_hs_used; i < SCTP_HS_TABLE_SIZE; i++) { in sctp_hs_cwnd_increase()
1630 net->last_hs_used = indx; in sctp_hs_cwnd_increase()
1632 net->cwnd += incr; in sctp_hs_cwnd_increase()
1634 sctp_enforce_cwnd_limit(&stcb->asoc, net); in sctp_hs_cwnd_increase()
1636 sctp_log_cwnd(stcb, net, (net->cwnd - old_cwnd), SCTP_CWND_LOG_FROM_SS); in sctp_hs_cwnd_increase()
1640 static void
1644 int old_cwnd = net->cwnd; in sctp_hs_cwnd_decrease()
1646 cur_val = net->cwnd >> 10; in sctp_hs_cwnd_decrease()
1649 net->ssthresh = net->cwnd / 2; in sctp_hs_cwnd_decrease()
1650 if (net->ssthresh < (net->mtu * 2)) { in sctp_hs_cwnd_decrease()
1651 net->ssthresh = 2 * net->mtu; in sctp_hs_cwnd_decrease()
1653 net->cwnd = net->ssthresh; in sctp_hs_cwnd_decrease()
1656 net->ssthresh = net->cwnd - (int)((net->cwnd / 100) * in sctp_hs_cwnd_decrease()
1657 (int32_t)sctp_cwnd_adjust[net->last_hs_used].drop_percent); in sctp_hs_cwnd_decrease()
1658 net->cwnd = net->ssthresh; in sctp_hs_cwnd_decrease()
1660 indx = net->last_hs_used; in sctp_hs_cwnd_decrease()
1661 cur_val = net->cwnd >> 10; in sctp_hs_cwnd_decrease()
1665 net->last_hs_used = 0; in sctp_hs_cwnd_decrease()
1667 for (i = indx; i >= 1; i--) { in sctp_hs_cwnd_decrease()
1668 if (cur_val > sctp_cwnd_adjust[i - 1].cwnd) { in sctp_hs_cwnd_decrease()
1672 net->last_hs_used = indx; in sctp_hs_cwnd_decrease()
1675 sctp_enforce_cwnd_limit(&stcb->asoc, net); in sctp_hs_cwnd_decrease()
1677 sctp_log_cwnd(stcb, net, (net->cwnd - old_cwnd), SCTP_CWND_LOG_FROM_FR); in sctp_hs_cwnd_decrease()
1681 static void
1689 * (net->fast_retran_loss_recovery == 0))) in sctp_hs_cwnd_update_after_fr()
1691 TAILQ_FOREACH(net, &asoc->nets, sctp_next) { in sctp_hs_cwnd_update_after_fr()
1692 if ((asoc->fast_retran_loss_recovery == 0) || in sctp_hs_cwnd_update_after_fr()
1693 (asoc->sctp_cmt_on_off > 0)) { in sctp_hs_cwnd_update_after_fr()
1695 if (net->net_ack > 0) { in sctp_hs_cwnd_update_after_fr()
1706 lchk = TAILQ_FIRST(&asoc->send_queue); in sctp_hs_cwnd_update_after_fr()
1708 net->partial_bytes_acked = 0; in sctp_hs_cwnd_update_after_fr()
1710 asoc->fast_retran_loss_recovery = 1; in sctp_hs_cwnd_update_after_fr()
1713 asoc->fast_recovery_tsn = asoc->sending_seq - 1; in sctp_hs_cwnd_update_after_fr()
1715 asoc->fast_recovery_tsn = lchk->rec.data.tsn - 1; in sctp_hs_cwnd_update_after_fr()
1719 * CMT fast recovery -- per destination in sctp_hs_cwnd_update_after_fr()
1722 net->fast_retran_loss_recovery = 1; in sctp_hs_cwnd_update_after_fr()
1726 net->fast_recovery_tsn = asoc->sending_seq - 1; in sctp_hs_cwnd_update_after_fr()
1728 net->fast_recovery_tsn = lchk->rec.data.tsn - 1; in sctp_hs_cwnd_update_after_fr()
1732 stcb->sctp_ep, stcb, net, in sctp_hs_cwnd_update_after_fr()
1735 stcb->sctp_ep, stcb, net); in sctp_hs_cwnd_update_after_fr()
1737 } else if (net->net_ack > 0) { in sctp_hs_cwnd_update_after_fr()
1747 static void
1757 TAILQ_FOREACH(net, &asoc->nets, sctp_next) { in sctp_hs_cwnd_update_after_sack()
1762 if (net->fast_retran_loss_recovery && net->new_pseudo_cumack) { in sctp_hs_cwnd_update_after_sack()
1763 if (SCTP_TSN_GE(asoc->last_acked_seq, net->fast_recovery_tsn) || in sctp_hs_cwnd_update_after_sack()
1764 SCTP_TSN_GE(net->pseudo_cumack, net->fast_recovery_tsn)) { in sctp_hs_cwnd_update_after_sack()
1765 net->will_exit_fast_recovery = 1; in sctp_hs_cwnd_update_after_sack()
1770 if (net->net_ack == 0) { in sctp_hs_cwnd_update_after_sack()
1781 * if (sctp_cmt_on_off > 0 && net->fast_retran_loss_recovery in sctp_hs_cwnd_update_after_sack()
1782 * && net->will_exit_fast_recovery == 0) { @@@ Do something in sctp_hs_cwnd_update_after_sack()
1784 * asoc->fast_retran_loss_recovery && will_exit == 0) { in sctp_hs_cwnd_update_after_sack()
1788 if (asoc->fast_retran_loss_recovery && in sctp_hs_cwnd_update_after_sack()
1790 (asoc->sctp_cmt_on_off == 0)) { in sctp_hs_cwnd_update_after_sack()
1798 * CMT: CUC algorithm. Update cwnd if pseudo-cumack has in sctp_hs_cwnd_update_after_sack()
1802 ((asoc->sctp_cmt_on_off > 0) && net->new_pseudo_cumack)) { in sctp_hs_cwnd_update_after_sack()
1804 if (net->cwnd <= net->ssthresh) { in sctp_hs_cwnd_update_after_sack()
1806 if (net->flight_size + net->net_ack >= net->cwnd) { in sctp_hs_cwnd_update_after_sack()
1810 sctp_log_cwnd(stcb, net, net->net_ack, in sctp_hs_cwnd_update_after_sack()
1816 net->partial_bytes_acked += net->net_ack; in sctp_hs_cwnd_update_after_sack()
1817 if ((net->flight_size + net->net_ack >= net->cwnd) && in sctp_hs_cwnd_update_after_sack()
1818 (net->partial_bytes_acked >= net->cwnd)) { in sctp_hs_cwnd_update_after_sack()
1819 net->partial_bytes_acked -= net->cwnd; in sctp_hs_cwnd_update_after_sack()
1820 net->cwnd += net->mtu; in sctp_hs_cwnd_update_after_sack()
1823 sctp_log_cwnd(stcb, net, net->mtu, in sctp_hs_cwnd_update_after_sack()
1828 sctp_log_cwnd(stcb, net, net->net_ack, in sctp_hs_cwnd_update_after_sack()
1835 sctp_log_cwnd(stcb, net, net->mtu, in sctp_hs_cwnd_update_after_sack()
1843 * H-TCP congestion control. The algorithm is detailed in:
1845 * "H-TCP: TCP for high-speed and long-distance networks"
1850 static int use_rtt_scaling = 1;
1851 static int use_bandwidth_switch = 1;
1853 static inline int
1856 return (seq3 - seq2 >= seq1 - seq2); in between()
1859 static inline uint32_t
1862 return (sctp_get_tick_count() - ca->last_cong); in htcp_cong_time()
1865 static inline uint32_t
1868 return (ca->minRTT == 0 ? htcp_cong_time(ca) : htcp_cong_time(ca) / ca->minRTT); in htcp_ccount()
1871 static inline void
1874 ca->undo_last_cong = ca->last_cong; in htcp_reset()
1875 ca->undo_maxRTT = ca->maxRTT; in htcp_reset()
1876 ca->undo_old_maxB = ca->old_maxB; in htcp_reset()
1877 ca->last_cong = sctp_get_tick_count(); in htcp_reset()
1882 static uint32_t
1885 net->cc_mod.htcp_ca.last_cong = net->cc_mod.htcp_ca.undo_last_cong; in htcp_cwnd_undo()
1886 net->cc_mod.htcp_ca.maxRTT = net->cc_mod.htcp_ca.undo_maxRTT; in htcp_cwnd_undo()
1887 net->cc_mod.htcp_ca.old_maxB = net->cc_mod.htcp_ca.undo_old_maxB; in htcp_cwnd_undo()
1888 return (max(net->cwnd, ((net->ssthresh / net->mtu << 7) / net->cc_mod.htcp_ca.beta) * net->mtu)); in htcp_cwnd_undo()
1893 static inline void
1896 uint32_t srtt = net->lastsa >> SCTP_RTT_SHIFT; in measure_rtt()
1899 if (net->cc_mod.htcp_ca.minRTT > srtt || !net->cc_mod.htcp_ca.minRTT) in measure_rtt()
1900 net->cc_mod.htcp_ca.minRTT = srtt; in measure_rtt()
1903 if (net->fast_retran_ip == 0 && net->ssthresh < 0xFFFF && htcp_ccount(&net->cc_mod.htcp_ca) > 3) { in measure_rtt()
1904 if (net->cc_mod.htcp_ca.maxRTT < net->cc_mod.htcp_ca.minRTT) in measure_rtt()
1905 net->cc_mod.htcp_ca.maxRTT = net->cc_mod.htcp_ca.minRTT; in measure_rtt()
1906 …if (net->cc_mod.htcp_ca.maxRTT < srtt && srtt <= net->cc_mod.htcp_ca.maxRTT + sctp_msecs_to_ticks(… in measure_rtt()
1907 net->cc_mod.htcp_ca.maxRTT = srtt; in measure_rtt()
1911 static void
1916 if (net->fast_retran_ip == 0) in measure_achieved_throughput()
1917 net->cc_mod.htcp_ca.bytes_acked = net->net_ack; in measure_achieved_throughput()
1923 /* JRS - not 100% sure of this statement */ in measure_achieved_throughput()
1924 if (net->fast_retran_ip == 1) { in measure_achieved_throughput()
1925 net->cc_mod.htcp_ca.bytecount = 0; in measure_achieved_throughput()
1926 net->cc_mod.htcp_ca.lasttime = now; in measure_achieved_throughput()
1930 net->cc_mod.htcp_ca.bytecount += net->net_ack; in measure_achieved_throughput()
1931 …if ((net->cc_mod.htcp_ca.bytecount >= net->cwnd - (((net->cc_mod.htcp_ca.alpha >> 7) ? (net->cc_mo… in measure_achieved_throughput()
1932 (now - net->cc_mod.htcp_ca.lasttime >= net->cc_mod.htcp_ca.minRTT) && in measure_achieved_throughput()
1933 (net->cc_mod.htcp_ca.minRTT > 0)) { in measure_achieved_throughput()
1934 …uint32_t cur_Bi = net->cc_mod.htcp_ca.bytecount / net->mtu * hz / (now - net->cc_mod.htcp_ca.lastt… in measure_achieved_throughput()
1936 if (htcp_ccount(&net->cc_mod.htcp_ca) <= 3) { in measure_achieved_throughput()
1938 net->cc_mod.htcp_ca.minB = net->cc_mod.htcp_ca.maxB = net->cc_mod.htcp_ca.Bi = cur_Bi; in measure_achieved_throughput()
1940 net->cc_mod.htcp_ca.Bi = (3 * net->cc_mod.htcp_ca.Bi + cur_Bi) / 4; in measure_achieved_throughput()
1941 if (net->cc_mod.htcp_ca.Bi > net->cc_mod.htcp_ca.maxB) in measure_achieved_throughput()
1942 net->cc_mod.htcp_ca.maxB = net->cc_mod.htcp_ca.Bi; in measure_achieved_throughput()
1943 if (net->cc_mod.htcp_ca.minB > net->cc_mod.htcp_ca.maxB) in measure_achieved_throughput()
1944 net->cc_mod.htcp_ca.minB = net->cc_mod.htcp_ca.maxB; in measure_achieved_throughput()
1946 net->cc_mod.htcp_ca.bytecount = 0; in measure_achieved_throughput()
1947 net->cc_mod.htcp_ca.lasttime = now; in measure_achieved_throughput()
1951 static inline void
1955 uint32_t maxB = ca->maxB; in htcp_beta_update()
1956 uint32_t old_maxB = ca->old_maxB; in htcp_beta_update()
1958 ca->old_maxB = ca->maxB; in htcp_beta_update()
1961 ca->beta = BETA_MIN; in htcp_beta_update()
1962 ca->modeswitch = 0; in htcp_beta_update()
1967 if (ca->modeswitch && minRTT > sctp_msecs_to_ticks(10) && maxRTT) { in htcp_beta_update()
1968 ca->beta = (minRTT << 7) / maxRTT; in htcp_beta_update()
1969 if (ca->beta < BETA_MIN) in htcp_beta_update()
1970 ca->beta = BETA_MIN; in htcp_beta_update()
1971 else if (ca->beta > BETA_MAX) in htcp_beta_update()
1972 ca->beta = BETA_MAX; in htcp_beta_update()
1974 ca->beta = BETA_MIN; in htcp_beta_update()
1975 ca->modeswitch = 1; in htcp_beta_update()
1979 static inline void
1982 uint32_t minRTT = ca->minRTT; in htcp_alpha_update()
1987 diff -= hz; in htcp_alpha_update()
2001 ca->alpha = 2 * factor * ((1 << 7) - ca->beta); in htcp_alpha_update()
2002 if (ca->alpha != 0) in htcp_alpha_update()
2003 ca->alpha = ALPHA_BASE; in htcp_alpha_update()
2006 /* After we have the rtt data to calculate beta, we'd still prefer to wait one
2007 * rtt before we adjust our beta to ensure we are working from a consistent
2014 static void
2017 uint32_t minRTT = net->cc_mod.htcp_ca.minRTT; in htcp_param_update()
2018 uint32_t maxRTT = net->cc_mod.htcp_ca.maxRTT; in htcp_param_update()
2020 htcp_beta_update(&net->cc_mod.htcp_ca, minRTT, maxRTT); in htcp_param_update()
2021 htcp_alpha_update(&net->cc_mod.htcp_ca); in htcp_param_update()
2028 net->cc_mod.htcp_ca.maxRTT = minRTT + ((maxRTT - minRTT) * 95) / 100; in htcp_param_update()
2031 static uint32_t
2035 return (max(((net->cwnd / net->mtu * net->cc_mod.htcp_ca.beta) >> 7) * net->mtu, 2U * net->mtu)); in htcp_recalc_ssthresh()
2038 static void
2041 /*- in htcp_cong_avoid()
2043 * if (!tcp_is_cwnd_limited(sk, in_flight)) RRS - good question. in htcp_cong_avoid()
2046 if (net->cwnd <= net->ssthresh) { in htcp_cong_avoid()
2048 if (net->flight_size + net->net_ack >= net->cwnd) { in htcp_cong_avoid()
2049 if (net->net_ack > (net->mtu * SCTP_BASE_SYSCTL(sctp_L2_abc_variable))) { in htcp_cong_avoid()
2050 net->cwnd += (net->mtu * SCTP_BASE_SYSCTL(sctp_L2_abc_variable)); in htcp_cong_avoid()
2052 sctp_log_cwnd(stcb, net, net->mtu, in htcp_cong_avoid()
2057 net->cwnd += net->net_ack; in htcp_cong_avoid()
2059 sctp_log_cwnd(stcb, net, net->net_ack, in htcp_cong_avoid()
2063 sctp_enforce_cwnd_limit(&stcb->asoc, net); in htcp_cong_avoid()
2066 sctp_log_cwnd(stcb, net, net->net_ack, in htcp_cong_avoid()
2075 * net->cwnd += alpha / net->cwnd in htcp_cong_avoid()
2078 …if (((net->partial_bytes_acked / net->mtu * net->cc_mod.htcp_ca.alpha) >> 7) * net->mtu >= net->cw… in htcp_cong_avoid()
2079 /*- in htcp_cong_avoid()
2081 * if (net->snd_cwnd < net->snd_cwnd_clamp) - Nope (RRS). in htcp_cong_avoid()
2083 net->cwnd += net->mtu; in htcp_cong_avoid()
2084 net->partial_bytes_acked = 0; in htcp_cong_avoid()
2085 sctp_enforce_cwnd_limit(&stcb->asoc, net); in htcp_cong_avoid()
2086 htcp_alpha_update(&net->cc_mod.htcp_ca); in htcp_cong_avoid()
2088 sctp_log_cwnd(stcb, net, net->mtu, in htcp_cong_avoid()
2092 net->partial_bytes_acked += net->net_ack; in htcp_cong_avoid()
2094 sctp_log_cwnd(stcb, net, net->net_ack, in htcp_cong_avoid()
2099 net->cc_mod.htcp_ca.bytes_acked = net->mtu; in htcp_cong_avoid()
2105 static uint32_t
2108 return (net->ssthresh); in htcp_min_cwnd()
2112 static void
2115 memset(&net->cc_mod.htcp_ca, 0, sizeof(struct htcp)); in htcp_init()
2116 net->cc_mod.htcp_ca.alpha = ALPHA_BASE; in htcp_init()
2117 net->cc_mod.htcp_ca.beta = BETA_MIN; in htcp_init()
2118 net->cc_mod.htcp_ca.bytes_acked = net->mtu; in htcp_init()
2119 net->cc_mod.htcp_ca.last_cong = sctp_get_tick_count(); in htcp_init()
2122 static void
2129 net->cwnd = min((net->mtu * 4), max((2 * net->mtu), SCTP_INITIAL_CWND)); in sctp_htcp_set_initial_cc_param()
2130 net->ssthresh = stcb->asoc.peers_rwnd; in sctp_htcp_set_initial_cc_param()
2131 sctp_enforce_cwnd_limit(&stcb->asoc, net); in sctp_htcp_set_initial_cc_param()
2139 static void
2149 TAILQ_FOREACH(net, &asoc->nets, sctp_next) { in sctp_htcp_cwnd_update_after_sack()
2154 if (net->fast_retran_loss_recovery && net->new_pseudo_cumack) { in sctp_htcp_cwnd_update_after_sack()
2155 if (SCTP_TSN_GE(asoc->last_acked_seq, net->fast_recovery_tsn) || in sctp_htcp_cwnd_update_after_sack()
2156 SCTP_TSN_GE(net->pseudo_cumack, net->fast_recovery_tsn)) { in sctp_htcp_cwnd_update_after_sack()
2157 net->will_exit_fast_recovery = 1; in sctp_htcp_cwnd_update_after_sack()
2162 if (net->net_ack == 0) { in sctp_htcp_cwnd_update_after_sack()
2173 * if (sctp_cmt_on_off > 0 && net->fast_retran_loss_recovery in sctp_htcp_cwnd_update_after_sack()
2174 * && net->will_exit_fast_recovery == 0) { @@@ Do something in sctp_htcp_cwnd_update_after_sack()
2176 * asoc->fast_retran_loss_recovery && will_exit == 0) { in sctp_htcp_cwnd_update_after_sack()
2180 if (asoc->fast_retran_loss_recovery && in sctp_htcp_cwnd_update_after_sack()
2182 (asoc->sctp_cmt_on_off == 0)) { in sctp_htcp_cwnd_update_after_sack()
2190 * CMT: CUC algorithm. Update cwnd if pseudo-cumack has in sctp_htcp_cwnd_update_after_sack()
2194 ((asoc->sctp_cmt_on_off > 0) && net->new_pseudo_cumack)) { in sctp_htcp_cwnd_update_after_sack()
2199 sctp_log_cwnd(stcb, net, net->mtu, in sctp_htcp_cwnd_update_after_sack()
2206 static void
2214 * (net->fast_retran_loss_recovery == 0))) in sctp_htcp_cwnd_update_after_fr()
2216 TAILQ_FOREACH(net, &asoc->nets, sctp_next) { in sctp_htcp_cwnd_update_after_fr()
2217 if ((asoc->fast_retran_loss_recovery == 0) || in sctp_htcp_cwnd_update_after_fr()
2218 (asoc->sctp_cmt_on_off > 0)) { in sctp_htcp_cwnd_update_after_fr()
2220 if (net->net_ack > 0) { in sctp_htcp_cwnd_update_after_fr()
2228 int old_cwnd = net->cwnd; in sctp_htcp_cwnd_update_after_fr()
2230 /* JRS - reset as if state were changed */ in sctp_htcp_cwnd_update_after_fr()
2231 htcp_reset(&net->cc_mod.htcp_ca); in sctp_htcp_cwnd_update_after_fr()
2232 net->ssthresh = htcp_recalc_ssthresh(net); in sctp_htcp_cwnd_update_after_fr()
2233 net->cwnd = net->ssthresh; in sctp_htcp_cwnd_update_after_fr()
2236 sctp_log_cwnd(stcb, net, (net->cwnd - old_cwnd), in sctp_htcp_cwnd_update_after_fr()
2239 lchk = TAILQ_FIRST(&asoc->send_queue); in sctp_htcp_cwnd_update_after_fr()
2241 net->partial_bytes_acked = 0; in sctp_htcp_cwnd_update_after_fr()
2243 asoc->fast_retran_loss_recovery = 1; in sctp_htcp_cwnd_update_after_fr()
2246 asoc->fast_recovery_tsn = asoc->sending_seq - 1; in sctp_htcp_cwnd_update_after_fr()
2248 asoc->fast_recovery_tsn = lchk->rec.data.tsn - 1; in sctp_htcp_cwnd_update_after_fr()
2252 * CMT fast recovery -- per destination in sctp_htcp_cwnd_update_after_fr()
2255 net->fast_retran_loss_recovery = 1; in sctp_htcp_cwnd_update_after_fr()
2259 net->fast_recovery_tsn = asoc->sending_seq - 1; in sctp_htcp_cwnd_update_after_fr()
2261 net->fast_recovery_tsn = lchk->rec.data.tsn - 1; in sctp_htcp_cwnd_update_after_fr()
2265 stcb->sctp_ep, stcb, net, in sctp_htcp_cwnd_update_after_fr()
2268 stcb->sctp_ep, stcb, net); in sctp_htcp_cwnd_update_after_fr()
2270 } else if (net->net_ack > 0) { in sctp_htcp_cwnd_update_after_fr()
2280 static void
2284 int old_cwnd = net->cwnd; in sctp_htcp_cwnd_update_after_timeout()
2286 /* JRS - reset as if the state were being changed to timeout */ in sctp_htcp_cwnd_update_after_timeout()
2287 htcp_reset(&net->cc_mod.htcp_ca); in sctp_htcp_cwnd_update_after_timeout()
2288 net->ssthresh = htcp_recalc_ssthresh(net); in sctp_htcp_cwnd_update_after_timeout()
2289 net->cwnd = net->mtu; in sctp_htcp_cwnd_update_after_timeout()
2290 net->partial_bytes_acked = 0; in sctp_htcp_cwnd_update_after_timeout()
2292 sctp_log_cwnd(stcb, net, net->cwnd - old_cwnd, SCTP_CWND_LOG_FROM_RTX); in sctp_htcp_cwnd_update_after_timeout()
2296 static void
2302 old_cwnd = net->cwnd; in sctp_htcp_cwnd_update_after_ecn_echo()
2304 /* JRS - reset hctp as if state changed */ in sctp_htcp_cwnd_update_after_ecn_echo()
2306 htcp_reset(&net->cc_mod.htcp_ca); in sctp_htcp_cwnd_update_after_ecn_echo()
2308 net->ssthresh = htcp_recalc_ssthresh(net); in sctp_htcp_cwnd_update_after_ecn_echo()
2309 if (net->ssthresh < net->mtu) { in sctp_htcp_cwnd_update_after_ecn_echo()
2310 net->ssthresh = net->mtu; in sctp_htcp_cwnd_update_after_ecn_echo()
2312 net->RTO <<= 1; in sctp_htcp_cwnd_update_after_ecn_echo()
2314 net->cwnd = net->ssthresh; in sctp_htcp_cwnd_update_after_ecn_echo()
2315 sctp_enforce_cwnd_limit(&stcb->asoc, net); in sctp_htcp_cwnd_update_after_ecn_echo()
2317 sctp_log_cwnd(stcb, net, (net->cwnd - old_cwnd), SCTP_CWND_LOG_FROM_SAT); in sctp_htcp_cwnd_update_after_ecn_echo()