Lines Matching full:net

62 sctp_enforce_cwnd_limit(struct sctp_association *assoc, struct sctp_nets *net)  in sctp_enforce_cwnd_limit()  argument
65 (net->cwnd > assoc->max_cwnd) && in sctp_enforce_cwnd_limit()
66 (net->cwnd > (net->mtu - sizeof(struct sctphdr)))) { in sctp_enforce_cwnd_limit()
67 net->cwnd = assoc->max_cwnd ; in sctp_enforce_cwnd_limit()
68 if (net->cwnd < (net->mtu - sizeof(struct sctphdr))) { in sctp_enforce_cwnd_limit()
69 net->cwnd = net->mtu - sizeof(struct sctphdr); in sctp_enforce_cwnd_limit()
75 sctp_set_initial_cc_param(struct sctp_tcb *stcb, struct sctp_nets *net) in sctp_set_initial_cc_param() argument
84 net->cwnd = min((net->mtu * 4), max((2 * net->mtu), SCTP_INITIAL_CWND)); in sctp_set_initial_cc_param()
92 net->cwnd = (net->mtu - sizeof(struct sctphdr)) * cwnd_in_mtu; in sctp_set_initial_cc_param()
97 net->cwnd /= assoc->numnets; in sctp_set_initial_cc_param()
98 if (net->cwnd < (net->mtu - sizeof(struct sctphdr))) { in sctp_set_initial_cc_param()
99 net->cwnd = net->mtu - sizeof(struct sctphdr); in sctp_set_initial_cc_param()
102 sctp_enforce_cwnd_limit(assoc, net); in sctp_set_initial_cc_param()
103 net->ssthresh = assoc->peers_rwnd; in sctp_set_initial_cc_param()
105 SDT_PROBE5(sctp, cwnd, net, init, in sctp_set_initial_cc_param()
106 stcb->asoc.my_vtag, ((stcb->sctp_ep->sctp_lport << 16) | (stcb->rport)), net, in sctp_set_initial_cc_param()
107 0, net->cwnd); in sctp_set_initial_cc_param()
111 sctp_log_cwnd(stcb, net, 0, SCTP_CWND_INITIALIZATION); in sctp_set_initial_cc_param()
119 struct sctp_nets *net; in sctp_cwnd_update_after_fr() local
129 TAILQ_FOREACH(net, &asoc->nets, sctp_next) { in sctp_cwnd_update_after_fr()
130 t_ssthresh += net->ssthresh; in sctp_cwnd_update_after_fr()
131 t_cwnd += net->cwnd; in sctp_cwnd_update_after_fr()
132 if (net->lastsa > 0) { in sctp_cwnd_update_after_fr()
133 t_ucwnd_sbw += (uint64_t)net->cwnd / (uint64_t)net->lastsa; in sctp_cwnd_update_after_fr()
143 * (net->fast_retran_loss_recovery == 0))) in sctp_cwnd_update_after_fr()
145 TAILQ_FOREACH(net, &asoc->nets, sctp_next) { in sctp_cwnd_update_after_fr()
149 if (net->net_ack > 0) { in sctp_cwnd_update_after_fr()
157 int old_cwnd = net->cwnd; in sctp_cwnd_update_after_fr()
162 net->ssthresh = (uint32_t)(((uint64_t)4 * in sctp_cwnd_update_after_fr()
163 (uint64_t)net->mtu * in sctp_cwnd_update_after_fr()
164 (uint64_t)net->ssthresh) / in sctp_cwnd_update_after_fr()
171 srtt = net->lastsa; in sctp_cwnd_update_after_fr()
177 net->ssthresh = (uint32_t) (((uint64_t)4 * in sctp_cwnd_update_after_fr()
178 (uint64_t)net->mtu * in sctp_cwnd_update_after_fr()
179 (uint64_t)net->cwnd) / in sctp_cwnd_update_after_fr()
184 if ((net->cwnd > t_cwnd / 2) && in sctp_cwnd_update_after_fr()
185 (net->ssthresh < net->cwnd - t_cwnd / 2)) { in sctp_cwnd_update_after_fr()
186 net->ssthresh = net->cwnd - t_cwnd / 2; in sctp_cwnd_update_after_fr()
188 if (net->ssthresh < net->mtu) { in sctp_cwnd_update_after_fr()
189 net->ssthresh = net->mtu; in sctp_cwnd_update_after_fr()
192 net->ssthresh = net->cwnd / 2; in sctp_cwnd_update_after_fr()
193 if (net->ssthresh < (net->mtu * 2)) { in sctp_cwnd_update_after_fr()
194 net->ssthresh = 2 * net->mtu; in sctp_cwnd_update_after_fr()
197 net->cwnd = net->ssthresh; in sctp_cwnd_update_after_fr()
198 sctp_enforce_cwnd_limit(asoc, net); in sctp_cwnd_update_after_fr()
200 SDT_PROBE5(sctp, cwnd, net, fr, in sctp_cwnd_update_after_fr()
201 stcb->asoc.my_vtag, ((stcb->sctp_ep->sctp_lport << 16) | (stcb->rport)), net, in sctp_cwnd_update_after_fr()
202 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()
210 net->partial_bytes_acked = 0; 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()
257 cc_bw_same(struct sctp_tcb *stcb, struct sctp_nets *net, uint64_t nbw, in cc_bw_same() argument
261 cc_bw_same(struct sctp_tcb *stcb SCTP_UNUSED, struct sctp_nets *net, uint64_t nbw, in cc_bw_same()
270 probepoint = (((uint64_t)net->cwnd) << 32); in cc_bw_same()
272 if (net->rtt > net->cc_mod.rtcc.lbw_rtt + rtt_offset) { in cc_bw_same()
281 SDT_PROBE5(sctp, cwnd, net, rttvar, in cc_bw_same()
283 ((net->cc_mod.rtcc.lbw << 32) | nbw), in cc_bw_same()
284 ((net->cc_mod.rtcc.lbw_rtt << 32) | net->rtt), in cc_bw_same()
285 net->flight_size, in cc_bw_same()
288 if ((net->cc_mod.rtcc.steady_step) && (inst_ind != SCTP_INST_LOOSING)) { in cc_bw_same()
289 if (net->cc_mod.rtcc.last_step_state == 5) in cc_bw_same()
290 net->cc_mod.rtcc.step_cnt++; in cc_bw_same()
292 net->cc_mod.rtcc.step_cnt = 1; in cc_bw_same()
293 net->cc_mod.rtcc.last_step_state = 5; in cc_bw_same()
294 if ((net->cc_mod.rtcc.step_cnt == net->cc_mod.rtcc.steady_step) || in cc_bw_same()
295 ((net->cc_mod.rtcc.step_cnt > net->cc_mod.rtcc.steady_step) && in cc_bw_same()
296 ((net->cc_mod.rtcc.step_cnt % net->cc_mod.rtcc.steady_step) == 0))) { in cc_bw_same()
299 oth = net->cc_mod.rtcc.vol_reduce; in cc_bw_same()
301 oth |= net->cc_mod.rtcc.step_cnt; in cc_bw_same()
303 oth |= net->cc_mod.rtcc.last_step_state; in cc_bw_same()
304 SDT_PROBE5(sctp, cwnd, net, rttstep, in cc_bw_same()
306 ((net->cc_mod.rtcc.lbw << 32) | nbw), in cc_bw_same()
307 ((net->cc_mod.rtcc.lbw_rtt << 32) | net->rtt), in cc_bw_same()
311 if (net->cwnd > (4 * net->mtu)) { in cc_bw_same()
312 net->cwnd -= net->mtu; in cc_bw_same()
313 net->cc_mod.rtcc.vol_reduce++; in cc_bw_same()
315 net->cc_mod.rtcc.step_cnt = 0; in cc_bw_same()
321 if (net->rtt < net->cc_mod.rtcc.lbw_rtt-rtt_offset) { in cc_bw_same()
330 SDT_PROBE5(sctp, cwnd, net, rttvar, in cc_bw_same()
332 ((net->cc_mod.rtcc.lbw << 32) | nbw), in cc_bw_same()
333 ((net->cc_mod.rtcc.lbw_rtt << 32) | net->rtt), in cc_bw_same()
334 net->flight_size, in cc_bw_same()
337 if (net->cc_mod.rtcc.steady_step) { in cc_bw_same()
339 oth = net->cc_mod.rtcc.vol_reduce; in cc_bw_same()
341 oth |= net->cc_mod.rtcc.step_cnt; in cc_bw_same()
343 oth |= net->cc_mod.rtcc.last_step_state; in cc_bw_same()
344 SDT_PROBE5(sctp, cwnd, net, rttstep, in cc_bw_same()
346 ((net->cc_mod.rtcc.lbw << 32) | nbw), in cc_bw_same()
347 ((net->cc_mod.rtcc.lbw_rtt << 32) | net->rtt), in cc_bw_same()
351 if ((net->cc_mod.rtcc.last_step_state == 5) && in cc_bw_same()
352 (net->cc_mod.rtcc.step_cnt > net->cc_mod.rtcc.steady_step)) { in cc_bw_same()
354 net->cc_mod.rtcc.step_cnt = 0; in cc_bw_same()
357 net->cc_mod.rtcc.last_step_state = 6; in cc_bw_same()
358 net->cc_mod.rtcc.step_cnt = 0; in cc_bw_same()
361 net->cc_mod.rtcc.lbw = nbw; in cc_bw_same()
362 net->cc_mod.rtcc.lbw_rtt = net->rtt; in cc_bw_same()
363 net->cc_mod.rtcc.cwnd_at_bw_set = net->cwnd; in cc_bw_same()
375 probepoint |= ((7 << 16) | net->cc_mod.rtcc.ret_from_eq); in cc_bw_same()
376 SDT_PROBE5(sctp, cwnd, net, rttvar, in cc_bw_same()
378 ((net->cc_mod.rtcc.lbw << 32) | nbw), in cc_bw_same()
379 ((net->cc_mod.rtcc.lbw_rtt << 32) | net->rtt), in cc_bw_same()
380 net->flight_size, in cc_bw_same()
383 if ((net->cc_mod.rtcc.steady_step) && (inst_ind != SCTP_INST_LOOSING)) { in cc_bw_same()
384 if (net->cc_mod.rtcc.last_step_state == 5) in cc_bw_same()
385 net->cc_mod.rtcc.step_cnt++; in cc_bw_same()
387 net->cc_mod.rtcc.step_cnt = 1; in cc_bw_same()
388 net->cc_mod.rtcc.last_step_state = 5; in cc_bw_same()
389 if ((net->cc_mod.rtcc.step_cnt == net->cc_mod.rtcc.steady_step) || in cc_bw_same()
390 ((net->cc_mod.rtcc.step_cnt > net->cc_mod.rtcc.steady_step) && in cc_bw_same()
391 ((net->cc_mod.rtcc.step_cnt % net->cc_mod.rtcc.steady_step) == 0))) { in cc_bw_same()
393 if (net->cwnd > (4 * net->mtu)) { in cc_bw_same()
394 net->cwnd -= net->mtu; in cc_bw_same()
395 net->cc_mod.rtcc.vol_reduce++; in cc_bw_same()
398 net->cc_mod.rtcc.step_cnt = 0; in cc_bw_same()
407 return ((int)net->cc_mod.rtcc.ret_from_eq); in cc_bw_same()
412 cc_bw_decrease(struct sctp_tcb *stcb, struct sctp_nets *net, uint64_t nbw, uint64_t rtt_offset, in cc_bw_decrease() argument
416 cc_bw_decrease(struct sctp_tcb *stcb SCTP_UNUSED, struct sctp_nets *net, uint64_t nbw, uint64_t rtt… in cc_bw_decrease()
426 probepoint = (((uint64_t)net->cwnd) << 32); in cc_bw_decrease()
428 if (net->rtt > net->cc_mod.rtcc.lbw_rtt+rtt_offset) { in cc_bw_decrease()
431 if ((net->cwnd > net->cc_mod.rtcc.cwnd_at_bw_set) && in cc_bw_decrease()
437 SDT_PROBE5(sctp, cwnd, net, rttvar, in cc_bw_decrease()
439 ((net->cc_mod.rtcc.lbw << 32) | nbw), in cc_bw_decrease()
440 ((net->cc_mod.rtcc.lbw_rtt << 32) | net->rtt), in cc_bw_decrease()
441 net->flight_size, in cc_bw_decrease()
444 if (net->cc_mod.rtcc.ret_from_eq) { in cc_bw_decrease()
446 net->ssthresh = net->cwnd-1; in cc_bw_decrease()
447 net->partial_bytes_acked = 0; in cc_bw_decrease()
454 SDT_PROBE5(sctp, cwnd, net, rttvar, in cc_bw_decrease()
456 ((net->cc_mod.rtcc.lbw << 32) | nbw), in cc_bw_decrease()
457 ((net->cc_mod.rtcc.lbw_rtt << 32) | net->rtt), in cc_bw_decrease()
458 net->flight_size, in cc_bw_decrease()
462 if (net->cc_mod.rtcc.steady_step) { in cc_bw_decrease()
464 oth = net->cc_mod.rtcc.vol_reduce; in cc_bw_decrease()
466 oth |= net->cc_mod.rtcc.step_cnt; in cc_bw_decrease()
468 oth |= net->cc_mod.rtcc.last_step_state; in cc_bw_decrease()
469 SDT_PROBE5(sctp, cwnd, net, rttstep, in cc_bw_decrease()
471 ((net->cc_mod.rtcc.lbw << 32) | nbw), in cc_bw_decrease()
472 ((net->cc_mod.rtcc.lbw_rtt << 32) | net->rtt), in cc_bw_decrease()
479 if ((net->cc_mod.rtcc.vol_reduce) && in cc_bw_decrease()
481 net->cwnd += net->mtu; in cc_bw_decrease()
482 sctp_enforce_cwnd_limit(&stcb->asoc, net); in cc_bw_decrease()
483 net->cc_mod.rtcc.vol_reduce--; in cc_bw_decrease()
485 net->cc_mod.rtcc.last_step_state = 2; in cc_bw_decrease()
486 net->cc_mod.rtcc.step_cnt = 0; in cc_bw_decrease()
489 } else if (net->rtt < net->cc_mod.rtcc.lbw_rtt-rtt_offset) { in cc_bw_decrease()
494 SDT_PROBE5(sctp, cwnd, net, rttvar, in cc_bw_decrease()
496 ((net->cc_mod.rtcc.lbw << 32) | nbw), in cc_bw_decrease()
497 ((net->cc_mod.rtcc.lbw_rtt << 32) | net->rtt), in cc_bw_decrease()
498 net->flight_size, in cc_bw_decrease()
501 if (net->cc_mod.rtcc.steady_step) { in cc_bw_decrease()
503 oth = net->cc_mod.rtcc.vol_reduce; in cc_bw_decrease()
505 oth |= net->cc_mod.rtcc.step_cnt; in cc_bw_decrease()
507 oth |= net->cc_mod.rtcc.last_step_state; in cc_bw_decrease()
508 SDT_PROBE5(sctp, cwnd, net, rttstep, in cc_bw_decrease()
510 ((net->cc_mod.rtcc.lbw << 32) | nbw), in cc_bw_decrease()
511 ((net->cc_mod.rtcc.lbw_rtt << 32) | net->rtt), in cc_bw_decrease()
515 if ((net->cc_mod.rtcc.vol_reduce) && in cc_bw_decrease()
517 net->cwnd += net->mtu; in cc_bw_decrease()
518 sctp_enforce_cwnd_limit(&stcb->asoc, net); in cc_bw_decrease()
519 net->cc_mod.rtcc.vol_reduce--; in cc_bw_decrease()
521 net->cc_mod.rtcc.last_step_state = 3; in cc_bw_decrease()
522 net->cc_mod.rtcc.step_cnt = 0; in cc_bw_decrease()
530 SDT_PROBE5(sctp, cwnd, net, rttvar, in cc_bw_decrease()
532 ((net->cc_mod.rtcc.lbw << 32) | nbw), in cc_bw_decrease()
533 ((net->cc_mod.rtcc.lbw_rtt << 32) | net->rtt), in cc_bw_decrease()
534 net->flight_size, in cc_bw_decrease()
537 if (net->cc_mod.rtcc.steady_step) { in cc_bw_decrease()
539 oth = net->cc_mod.rtcc.vol_reduce; in cc_bw_decrease()
541 oth |= net->cc_mod.rtcc.step_cnt; in cc_bw_decrease()
543 oth |= net->cc_mod.rtcc.last_step_state; in cc_bw_decrease()
544 SDT_PROBE5(sctp, cwnd, net, rttstep, in cc_bw_decrease()
546 ((net->cc_mod.rtcc.lbw << 32) | nbw), in cc_bw_decrease()
547 ((net->cc_mod.rtcc.lbw_rtt << 32) | net->rtt), in cc_bw_decrease()
551 if ((net->cc_mod.rtcc.vol_reduce) && in cc_bw_decrease()
553 net->cwnd += net->mtu; in cc_bw_decrease()
554 sctp_enforce_cwnd_limit(&stcb->asoc, net); in cc_bw_decrease()
555 net->cc_mod.rtcc.vol_reduce--; in cc_bw_decrease()
557 net->cc_mod.rtcc.last_step_state = 4; in cc_bw_decrease()
558 net->cc_mod.rtcc.step_cnt = 0; in cc_bw_decrease()
561 net->cc_mod.rtcc.lbw = nbw; in cc_bw_decrease()
562 net->cc_mod.rtcc.lbw_rtt = net->rtt; in cc_bw_decrease()
563 net->cc_mod.rtcc.cwnd_at_bw_set = net->cwnd; in cc_bw_decrease()
573 cc_bw_increase(struct sctp_tcb *stcb, struct sctp_nets *net, uint64_t nbw, uint64_t vtag) in cc_bw_increase() argument
576 cc_bw_increase(struct sctp_tcb *stcb SCTP_UNUSED, struct sctp_nets *net, uint64_t nbw) in cc_bw_increase()
591 probepoint = (((uint64_t)net->cwnd) << 32); in cc_bw_increase()
592 SDT_PROBE5(sctp, cwnd, net, rttvar, in cc_bw_increase()
594 ((net->cc_mod.rtcc.lbw << 32) | nbw), in cc_bw_increase()
595 ((net->cc_mod.rtcc.lbw_rtt << 32) | net->rtt), in cc_bw_increase()
596 net->flight_size, in cc_bw_increase()
599 if (net->cc_mod.rtcc.steady_step) { in cc_bw_increase()
601 oth = net->cc_mod.rtcc.vol_reduce; in cc_bw_increase()
603 oth |= net->cc_mod.rtcc.step_cnt; in cc_bw_increase()
605 oth |= net->cc_mod.rtcc.last_step_state; in cc_bw_increase()
606 SDT_PROBE5(sctp, cwnd, net, rttstep, in cc_bw_increase()
608 ((net->cc_mod.rtcc.lbw << 32) | nbw), in cc_bw_increase()
609 ((net->cc_mod.rtcc.lbw_rtt << 32) | net->rtt), in cc_bw_increase()
613 net->cc_mod.rtcc.last_step_state = 0; in cc_bw_increase()
614 net->cc_mod.rtcc.step_cnt = 0; in cc_bw_increase()
615 net->cc_mod.rtcc.vol_reduce = 0; in cc_bw_increase()
617 net->cc_mod.rtcc.lbw = nbw; in cc_bw_increase()
618 net->cc_mod.rtcc.lbw_rtt = net->rtt; in cc_bw_increase()
619 net->cc_mod.rtcc.cwnd_at_bw_set = net->cwnd; in cc_bw_increase()
627 cc_bw_limit(struct sctp_tcb *stcb, struct sctp_nets *net, uint64_t nbw) in cc_bw_limit() argument
679 probepoint = (((uint64_t)net->cwnd) << 32); in cc_bw_limit()
680 rtt = net->rtt; in cc_bw_limit()
682 if (net->cc_mod.rtcc.rtt_set_this_sack) { in cc_bw_limit()
683 net->cc_mod.rtcc.rtt_set_this_sack = 0; in cc_bw_limit()
684 bytes_for_this_rtt = net->cc_mod.rtcc.bw_bytes - net->cc_mod.rtcc.bw_bytes_at_last_rttc; in cc_bw_limit()
685 net->cc_mod.rtcc.bw_bytes_at_last_rttc = net->cc_mod.rtcc.bw_bytes; in cc_bw_limit()
686 if (net->rtt) { in cc_bw_limit()
687 div = net->rtt / 1000; in cc_bw_limit()
701 inst_ind = net->cc_mod.rtcc.last_inst_ind; in cc_bw_limit()
703 inst_bw = bytes_for_this_rtt / (uint64_t)(net->rtt); in cc_bw_limit()
709 inst_ind = net->cc_mod.rtcc.last_inst_ind; in cc_bw_limit()
717 SDT_PROBE5(sctp, cwnd, net, rttvar, in cc_bw_limit()
720 ((net->cc_mod.rtcc.lbw_rtt << 32) | rtt), in cc_bw_limit()
721 net->flight_size, in cc_bw_limit()
726 inst_ind = net->cc_mod.rtcc.last_inst_ind; in cc_bw_limit()
728 bw_offset = net->cc_mod.rtcc.lbw >> bw_shift; in cc_bw_limit()
729 if (nbw > net->cc_mod.rtcc.lbw + bw_offset) { in cc_bw_limit()
731 ret = cc_bw_increase(stcb, net, nbw, vtag); in cc_bw_limit()
733 ret = cc_bw_increase(stcb, net, nbw); in cc_bw_limit()
737 rtt_offset = net->cc_mod.rtcc.lbw_rtt >> SCTP_BASE_SYSCTL(sctp_rttvar_rtt); in cc_bw_limit()
738 if (nbw < net->cc_mod.rtcc.lbw - bw_offset) { in cc_bw_limit()
740 ret = cc_bw_decrease(stcb, net, nbw, rtt_offset, vtag, inst_ind); in cc_bw_limit()
742 ret = cc_bw_decrease(stcb, net, nbw, rtt_offset, inst_ind); in cc_bw_limit()
751 ret = cc_bw_same(stcb, net, nbw, rtt_offset, vtag, inst_ind); in cc_bw_limit()
753 ret = cc_bw_same(stcb, net, nbw, rtt_offset, inst_ind); in cc_bw_limit()
756 net->cc_mod.rtcc.last_inst_ind = inst_ind; in cc_bw_limit()
765 struct sctp_nets *net; in sctp_cwnd_update_after_sack_common() local
786 TAILQ_FOREACH(net, &stcb->asoc.nets, sctp_next) { in sctp_cwnd_update_after_sack_common()
787 t_ssthresh += net->ssthresh; in sctp_cwnd_update_after_sack_common()
788 t_cwnd += net->cwnd; in sctp_cwnd_update_after_sack_common()
790 srtt = net->lastsa; in sctp_cwnd_update_after_sack_common()
794 t_ucwnd_sbw += (uint64_t)net->cwnd / (uint64_t)srtt; in sctp_cwnd_update_after_sack_common()
795 t_path_mptcp += (((uint64_t)net->cwnd) << SHIFT_MPTCP_MULTI_Z) / in sctp_cwnd_update_after_sack_common()
796 (((uint64_t)net->mtu) * (uint64_t)srtt); in sctp_cwnd_update_after_sack_common()
797 tmp = (((uint64_t)net->cwnd) << SHIFT_MPTCP_MULTI_N) / in sctp_cwnd_update_after_sack_common()
798 ((uint64_t)net->mtu * (uint64_t)(srtt * srtt)); in sctp_cwnd_update_after_sack_common()
819 TAILQ_FOREACH(net, &asoc->nets, sctp_next) { in sctp_cwnd_update_after_sack_common()
825 if (net->fast_retran_loss_recovery && net->new_pseudo_cumack) { in sctp_cwnd_update_after_sack_common()
826 if (SCTP_TSN_GE(asoc->last_acked_seq, net->fast_recovery_tsn) || in sctp_cwnd_update_after_sack_common()
827 SCTP_TSN_GE(net->pseudo_cumack,net->fast_recovery_tsn)) { in sctp_cwnd_update_after_sack_common()
828 net->will_exit_fast_recovery = 1; in sctp_cwnd_update_after_sack_common()
833 if (net->net_ack == 0) { in sctp_cwnd_update_after_sack_common()
835 sctp_log_cwnd(stcb, net, 0, SCTP_CWND_LOG_FROM_SACK); in sctp_cwnd_update_after_sack_common()
843 … if (sctp_cmt_on_off > 0 && net->fast_retran_loss_recovery && net->will_exit_fast_recovery == 0) { in sctp_cwnd_update_after_sack_common()
862 if (use_rtcc && (net->cc_mod.rtcc.tls_needs_set > 0)) { in sctp_cwnd_update_after_sack_common()
871 if ((net->cc_mod.rtcc.new_tot_time/1000) > 0) { in sctp_cwnd_update_after_sack_common()
872 nbw = net->cc_mod.rtcc.bw_bytes/(net->cc_mod.rtcc.new_tot_time/1000); in sctp_cwnd_update_after_sack_common()
874 nbw = net->cc_mod.rtcc.bw_bytes; in sctp_cwnd_update_after_sack_common()
876 if (net->cc_mod.rtcc.lbw) { in sctp_cwnd_update_after_sack_common()
877 if (cc_bw_limit(stcb, net, nbw)) { in sctp_cwnd_update_after_sack_common()
885 probepoint = (((uint64_t)net->cwnd) << 32); in sctp_cwnd_update_after_sack_common()
887 vtag = (net->rtt << 32) | in sctp_cwnd_update_after_sack_common()
891 SDT_PROBE5(sctp, cwnd, net, rttvar, in sctp_cwnd_update_after_sack_common()
894 ((net->cc_mod.rtcc.lbw_rtt << 32) | net->rtt), in sctp_cwnd_update_after_sack_common()
895 net->flight_size, in sctp_cwnd_update_after_sack_common()
898 net->cc_mod.rtcc.lbw = nbw; in sctp_cwnd_update_after_sack_common()
899 net->cc_mod.rtcc.lbw_rtt = net->rtt; in sctp_cwnd_update_after_sack_common()
900 if (net->cc_mod.rtcc.rtt_set_this_sack) { in sctp_cwnd_update_after_sack_common()
901 net->cc_mod.rtcc.rtt_set_this_sack = 0; in sctp_cwnd_update_after_sack_common()
902 net->cc_mod.rtcc.bw_bytes_at_last_rttc = net->cc_mod.rtcc.bw_bytes; in sctp_cwnd_update_after_sack_common()
911 ((asoc->sctp_cmt_on_off > 0) && net->new_pseudo_cumack)) { in sctp_cwnd_update_after_sack_common()
913 if (net->cwnd <= net->ssthresh) { in sctp_cwnd_update_after_sack_common()
915 if (net->flight_size + net->net_ack >= net->cwnd) { in sctp_cwnd_update_after_sack_common()
919 old_cwnd = net->cwnd; in sctp_cwnd_update_after_sack_common()
923 limit = (uint32_t)(((uint64_t)net->mtu * in sctp_cwnd_update_after_sack_common()
925 (uint64_t)net->ssthresh) / in sctp_cwnd_update_after_sack_common()
927 incr = (uint32_t)(((uint64_t)net->net_ack * in sctp_cwnd_update_after_sack_common()
928 (uint64_t)net->ssthresh) / in sctp_cwnd_update_after_sack_common()
939 srtt = net->lastsa; in sctp_cwnd_update_after_sack_common()
943 limit = (uint32_t)(((uint64_t)net->mtu * in sctp_cwnd_update_after_sack_common()
945 (uint64_t)net->cwnd) / in sctp_cwnd_update_after_sack_common()
948 incr = (uint32_t)(((uint64_t)net->net_ack * in sctp_cwnd_update_after_sack_common()
949 (uint64_t)net->cwnd) / in sctp_cwnd_update_after_sack_common()
960 limit = (uint32_t)(((uint64_t)net->mtu * in sctp_cwnd_update_after_sack_common()
964 incr = (uint32_t)(((uint64_t)net->net_ack * in sctp_cwnd_update_after_sack_common()
970 if (incr > net->net_ack) { in sctp_cwnd_update_after_sack_common()
971 incr = net->net_ack; in sctp_cwnd_update_after_sack_common()
973 if (incr > net->mtu) { in sctp_cwnd_update_after_sack_common()
974 incr = net->mtu; in sctp_cwnd_update_after_sack_common()
978 incr = net->net_ack; in sctp_cwnd_update_after_sack_common()
979 if (incr > net->mtu * SCTP_BASE_SYSCTL(sctp_L2_abc_variable)) { in sctp_cwnd_update_after_sack_common()
980 incr = net->mtu * SCTP_BASE_SYSCTL(sctp_L2_abc_variable); in sctp_cwnd_update_after_sack_common()
984 net->cwnd += incr; in sctp_cwnd_update_after_sack_common()
985 sctp_enforce_cwnd_limit(asoc, net); in sctp_cwnd_update_after_sack_common()
987 sctp_log_cwnd(stcb, net, incr, in sctp_cwnd_update_after_sack_common()
991 SDT_PROBE5(sctp, cwnd, net, ack, in sctp_cwnd_update_after_sack_common()
994 net, in sctp_cwnd_update_after_sack_common()
995 old_cwnd, net->cwnd); in sctp_cwnd_update_after_sack_common()
999 sctp_log_cwnd(stcb, net, net->net_ack, in sctp_cwnd_update_after_sack_common()
1008 net->partial_bytes_acked += net->net_ack; in sctp_cwnd_update_after_sack_common()
1010 if ((net->flight_size + net->net_ack >= net->cwnd) && in sctp_cwnd_update_after_sack_common()
1011 (net->partial_bytes_acked >= net->cwnd)) { in sctp_cwnd_update_after_sack_common()
1012 net->partial_bytes_acked -= net->cwnd; in sctp_cwnd_update_after_sack_common()
1014 old_cwnd = net->cwnd; in sctp_cwnd_update_after_sack_common()
1018 incr = (uint32_t)(((uint64_t)net->mtu * in sctp_cwnd_update_after_sack_common()
1019 (uint64_t)net->ssthresh) / in sctp_cwnd_update_after_sack_common()
1027 srtt = net->lastsa; in sctp_cwnd_update_after_sack_common()
1031 incr = (uint32_t)((uint64_t)net->mtu * in sctp_cwnd_update_after_sack_common()
1032 (uint64_t)net->cwnd / in sctp_cwnd_update_after_sack_common()
1042 (uint64_t) net->cwnd) >> in sctp_cwnd_update_after_sack_common()
1044 if (incr > net->mtu) { in sctp_cwnd_update_after_sack_common()
1045 incr = net->mtu; in sctp_cwnd_update_after_sack_common()
1049 incr = net->mtu; in sctp_cwnd_update_after_sack_common()
1052 net->cwnd += incr; in sctp_cwnd_update_after_sack_common()
1053 sctp_enforce_cwnd_limit(asoc, net); in sctp_cwnd_update_after_sack_common()
1055 SDT_PROBE5(sctp, cwnd, net, ack, in sctp_cwnd_update_after_sack_common()
1058 net, in sctp_cwnd_update_after_sack_common()
1059 old_cwnd, net->cwnd); in sctp_cwnd_update_after_sack_common()
1062 sctp_log_cwnd(stcb, net, net->mtu, in sctp_cwnd_update_after_sack_common()
1067 sctp_log_cwnd(stcb, net, net->net_ack, in sctp_cwnd_update_after_sack_common()
1074 sctp_log_cwnd(stcb, net, net->mtu, in sctp_cwnd_update_after_sack_common()
1083 sctp_cwnd_update_exit_pf_common(struct sctp_tcb *stcb, struct sctp_nets *net) in sctp_cwnd_update_exit_pf_common() argument
1086 sctp_cwnd_update_exit_pf_common(struct sctp_tcb *stcb SCTP_UNUSED, struct sctp_nets *net) in sctp_cwnd_update_exit_pf_common()
1092 old_cwnd = net->cwnd; in sctp_cwnd_update_exit_pf_common()
1094 net->cwnd = net->mtu; in sctp_cwnd_update_exit_pf_common()
1096 SDT_PROBE5(sctp, cwnd, net, ack, in sctp_cwnd_update_exit_pf_common()
1097 stcb->asoc.my_vtag, ((stcb->sctp_ep->sctp_lport << 16) | (stcb->rport)), net, in sctp_cwnd_update_exit_pf_common()
1098 old_cwnd, net->cwnd); in sctp_cwnd_update_exit_pf_common()
1101 (void *)net, net->cwnd); in sctp_cwnd_update_exit_pf_common()
1106 sctp_cwnd_update_after_timeout(struct sctp_tcb *stcb, struct sctp_nets *net) in sctp_cwnd_update_after_timeout() argument
1108 int old_cwnd = net->cwnd; in sctp_cwnd_update_after_timeout()
1137 net->ssthresh = (uint32_t)(((uint64_t)4 * in sctp_cwnd_update_after_timeout()
1138 (uint64_t)net->mtu * in sctp_cwnd_update_after_timeout()
1139 (uint64_t)net->ssthresh) / in sctp_cwnd_update_after_timeout()
1144 srtt = net->lastsa; in sctp_cwnd_update_after_timeout()
1151 net->ssthresh = (uint32_t)((uint64_t)t_cwnd - cc_delta); in sctp_cwnd_update_after_timeout()
1153 net->ssthresh = net->mtu; in sctp_cwnd_update_after_timeout()
1156 if ((net->cwnd > t_cwnd / 2) && in sctp_cwnd_update_after_timeout()
1157 (net->ssthresh < net->cwnd - t_cwnd / 2)) { in sctp_cwnd_update_after_timeout()
1158 net->ssthresh = net->cwnd - t_cwnd / 2; in sctp_cwnd_update_after_timeout()
1160 if (net->ssthresh < net->mtu) { in sctp_cwnd_update_after_timeout()
1161 net->ssthresh = net->mtu; in sctp_cwnd_update_after_timeout()
1164 net->ssthresh = max(net->cwnd / 2, 4 * net->mtu); in sctp_cwnd_update_after_timeout()
1166 net->cwnd = net->mtu; in sctp_cwnd_update_after_timeout()
1167 net->partial_bytes_acked = 0; in sctp_cwnd_update_after_timeout()
1169 SDT_PROBE5(sctp, cwnd, net, to, in sctp_cwnd_update_after_timeout()
1172 net, in sctp_cwnd_update_after_timeout()
1173 old_cwnd, net->cwnd); in sctp_cwnd_update_after_timeout()
1176 sctp_log_cwnd(stcb, net, net->cwnd - old_cwnd, SCTP_CWND_LOG_FROM_RTX); in sctp_cwnd_update_after_timeout()
1181 sctp_cwnd_update_after_ecn_echo_common(struct sctp_tcb *stcb, struct sctp_nets *net, in sctp_cwnd_update_after_ecn_echo_common() argument
1184 int old_cwnd = net->cwnd; in sctp_cwnd_update_after_ecn_echo_common()
1185 if ((use_rtcc) && (net->lan_type == SCTP_LAN_LOCAL) && (net->cc_mod.rtcc.use_dccc_ecn)) { in sctp_cwnd_update_after_ecn_echo_common()
1191 if (net->ecn_prev_cwnd < net->cwnd) { in sctp_cwnd_update_after_ecn_echo_common()
1193 net->cwnd = net->ecn_prev_cwnd - (net->mtu * num_pkt_lost); in sctp_cwnd_update_after_ecn_echo_common()
1196 net->cwnd /= 2; in sctp_cwnd_update_after_ecn_echo_common()
1199 net->ssthresh = net->cwnd - (num_pkt_lost * net->mtu); in sctp_cwnd_update_after_ecn_echo_common()
1201 sctp_log_cwnd(stcb, net, (net->cwnd - old_cwnd), SCTP_CWND_LOG_FROM_SAT); in sctp_cwnd_update_after_ecn_echo_common()
1205 net->ssthresh -= (net->mtu * num_pkt_lost); in sctp_cwnd_update_after_ecn_echo_common()
1206 net->cwnd -= (net->mtu * num_pkt_lost); in sctp_cwnd_update_after_ecn_echo_common()
1208 sctp_log_cwnd(stcb, net, (net->cwnd - old_cwnd), SCTP_CWND_LOG_FROM_SAT); in sctp_cwnd_update_after_ecn_echo_common()
1216 net->ssthresh = net->cwnd / 2; in sctp_cwnd_update_after_ecn_echo_common()
1217 if (net->ssthresh < net->mtu) { in sctp_cwnd_update_after_ecn_echo_common()
1218 net->ssthresh = net->mtu; in sctp_cwnd_update_after_ecn_echo_common()
1220 net->RTO <<= 1; in sctp_cwnd_update_after_ecn_echo_common()
1222 net->cwnd = net->ssthresh; in sctp_cwnd_update_after_ecn_echo_common()
1224 SDT_PROBE5(sctp, cwnd, net, ecn, in sctp_cwnd_update_after_ecn_echo_common()
1227 net, in sctp_cwnd_update_after_ecn_echo_common()
1228 old_cwnd, net->cwnd); in sctp_cwnd_update_after_ecn_echo_common()
1231 sctp_log_cwnd(stcb, net, (net->cwnd - old_cwnd), SCTP_CWND_LOG_FROM_SAT); in sctp_cwnd_update_after_ecn_echo_common()
1240 struct sctp_nets *net, struct sctp_pktdrop_chunk *cp, in sctp_cwnd_update_after_packet_dropped() argument
1245 int old_cwnd = net->cwnd; in sctp_cwnd_update_after_packet_dropped()
1255 if (*on_queue < net->flight_size) { in sctp_cwnd_update_after_packet_dropped()
1256 *on_queue = net->flight_size; in sctp_cwnd_update_after_packet_dropped()
1259 bw_avail = (uint32_t)(((uint64_t)(*bottle_bw) * net->rtt) / (uint64_t)1000000); in sctp_cwnd_update_after_packet_dropped()
1278 net->partial_bytes_acked = 0; in sctp_cwnd_update_after_packet_dropped()
1286 net->cwnd = net->prev_cwnd; in sctp_cwnd_update_after_packet_dropped()
1289 seg_inflight = net->flight_size / net->mtu; in sctp_cwnd_update_after_packet_dropped()
1290 seg_onqueue = *on_queue / net->mtu; in sctp_cwnd_update_after_packet_dropped()
1294 if (net->cwnd > net->flight_size) { in sctp_cwnd_update_after_packet_dropped()
1302 diff_adj = net->cwnd - net->flight_size; in sctp_cwnd_update_after_packet_dropped()
1313 net->cwnd -= my_portion; in sctp_cwnd_update_after_packet_dropped()
1316 if (net->cwnd <= net->mtu) { in sctp_cwnd_update_after_packet_dropped()
1317 net->cwnd = net->mtu; in sctp_cwnd_update_after_packet_dropped()
1320 net->ssthresh = net->cwnd - 1; in sctp_cwnd_update_after_packet_dropped()
1328 (stcb->asoc.max_burst * net->mtu < incr)) { in sctp_cwnd_update_after_packet_dropped()
1329 incr = stcb->asoc.max_burst * net->mtu; in sctp_cwnd_update_after_packet_dropped()
1331 net->cwnd += incr; in sctp_cwnd_update_after_packet_dropped()
1333 if (net->cwnd > bw_avail) { in sctp_cwnd_update_after_packet_dropped()
1335 net->cwnd = bw_avail; in sctp_cwnd_update_after_packet_dropped()
1337 if (net->cwnd < net->mtu) { in sctp_cwnd_update_after_packet_dropped()
1339 net->cwnd = net->mtu; in sctp_cwnd_update_after_packet_dropped()
1341 sctp_enforce_cwnd_limit(&stcb->asoc, net); in sctp_cwnd_update_after_packet_dropped()
1342 if (net->cwnd - old_cwnd != 0) { in sctp_cwnd_update_after_packet_dropped()
1345 SDT_PROBE5(sctp, cwnd, net, pd, in sctp_cwnd_update_after_packet_dropped()
1348 net, in sctp_cwnd_update_after_packet_dropped()
1349 old_cwnd, net->cwnd); in sctp_cwnd_update_after_packet_dropped()
1352 sctp_log_cwnd(stcb, net, (net->cwnd - old_cwnd), in sctp_cwnd_update_after_packet_dropped()
1360 struct sctp_nets *net, int burst_limit) in sctp_cwnd_update_after_output() argument
1362 int old_cwnd = net->cwnd; in sctp_cwnd_update_after_output()
1364 if (net->ssthresh < net->cwnd) in sctp_cwnd_update_after_output()
1365 net->ssthresh = net->cwnd; in sctp_cwnd_update_after_output()
1367 net->cwnd = (net->flight_size + (burst_limit * net->mtu)); in sctp_cwnd_update_after_output()
1368 sctp_enforce_cwnd_limit(&stcb->asoc, net); in sctp_cwnd_update_after_output()
1370 SDT_PROBE5(sctp, cwnd, net, bl, in sctp_cwnd_update_after_output()
1373 net, in sctp_cwnd_update_after_output()
1374 old_cwnd, net->cwnd); in sctp_cwnd_update_after_output()
1377 sctp_log_cwnd(stcb, net, (net->cwnd - old_cwnd), SCTP_CWND_LOG_FROM_BRST); in sctp_cwnd_update_after_output()
1392 sctp_cwnd_update_after_ecn_echo(struct sctp_tcb *stcb, struct sctp_nets *net, in sctp_cwnd_update_after_ecn_echo() argument
1396 sctp_cwnd_update_after_ecn_echo_common(stcb, net, in_window, num_pkt_lost, 0); in sctp_cwnd_update_after_ecn_echo()
1405 sctp_cwnd_update_rtcc_after_ecn_echo(struct sctp_tcb *stcb, struct sctp_nets *net, in sctp_cwnd_update_rtcc_after_ecn_echo() argument
1408 sctp_cwnd_update_after_ecn_echo_common(stcb, net, in_window, num_pkt_lost, 1); in sctp_cwnd_update_rtcc_after_ecn_echo()
1413 void sctp_cwnd_update_rtcc_tsn_acknowledged(struct sctp_nets *net, in sctp_cwnd_update_rtcc_tsn_acknowledged() argument
1416 net->cc_mod.rtcc.bw_bytes += tp1->send_size; in sctp_cwnd_update_rtcc_tsn_acknowledged()
1421 struct sctp_nets *net) in sctp_cwnd_prepare_rtcc_net_for_sack() argument
1423 if (net->cc_mod.rtcc.tls_needs_set > 0) { in sctp_cwnd_prepare_rtcc_net_for_sack()
1427 timevalsub(&ltls, &net->cc_mod.rtcc.tls); in sctp_cwnd_prepare_rtcc_net_for_sack()
1428 net->cc_mod.rtcc.new_tot_time = (ltls.tv_sec * 1000000) + ltls.tv_usec; in sctp_cwnd_prepare_rtcc_net_for_sack()
1434 struct sctp_nets *net) in sctp_cwnd_new_rtcc_transmission_begins() argument
1440 if (net->cc_mod.rtcc.lbw) { in sctp_cwnd_new_rtcc_transmission_begins()
1443 vtag = (net->rtt << 32) | (((uint32_t)(stcb->sctp_ep->sctp_lport)) << 16) | in sctp_cwnd_new_rtcc_transmission_begins()
1445 probepoint = (((uint64_t)net->cwnd) << 32); in sctp_cwnd_new_rtcc_transmission_begins()
1448 SDT_PROBE5(sctp, cwnd, net, rttvar, in sctp_cwnd_new_rtcc_transmission_begins()
1450 ((net->cc_mod.rtcc.lbw << 32) | 0), in sctp_cwnd_new_rtcc_transmission_begins()
1451 ((net->cc_mod.rtcc.lbw_rtt << 32) | net->rtt), in sctp_cwnd_new_rtcc_transmission_begins()
1452 net->flight_size, in sctp_cwnd_new_rtcc_transmission_begins()
1455 net->cc_mod.rtcc.lbw_rtt = 0; in sctp_cwnd_new_rtcc_transmission_begins()
1456 net->cc_mod.rtcc.cwnd_at_bw_set = 0; in sctp_cwnd_new_rtcc_transmission_begins()
1457 net->cc_mod.rtcc.lbw = 0; in sctp_cwnd_new_rtcc_transmission_begins()
1458 net->cc_mod.rtcc.bw_bytes_at_last_rttc = 0; in sctp_cwnd_new_rtcc_transmission_begins()
1459 net->cc_mod.rtcc.vol_reduce = 0; in sctp_cwnd_new_rtcc_transmission_begins()
1460 net->cc_mod.rtcc.bw_tot_time = 0; in sctp_cwnd_new_rtcc_transmission_begins()
1461 net->cc_mod.rtcc.bw_bytes = 0; in sctp_cwnd_new_rtcc_transmission_begins()
1462 net->cc_mod.rtcc.tls_needs_set = 0; in sctp_cwnd_new_rtcc_transmission_begins()
1463 if (net->cc_mod.rtcc.steady_step) { in sctp_cwnd_new_rtcc_transmission_begins()
1464 net->cc_mod.rtcc.vol_reduce = 0; in sctp_cwnd_new_rtcc_transmission_begins()
1465 net->cc_mod.rtcc.step_cnt = 0; in sctp_cwnd_new_rtcc_transmission_begins()
1466 net->cc_mod.rtcc.last_step_state = 0; in sctp_cwnd_new_rtcc_transmission_begins()
1468 if (net->cc_mod.rtcc.ret_from_eq) { in sctp_cwnd_new_rtcc_transmission_begins()
1475 cwnd = min((net->mtu * 4), max((2 * net->mtu), SCTP_INITIAL_CWND)); in sctp_cwnd_new_rtcc_transmission_begins()
1483 cwnd = (net->mtu - sizeof(struct sctphdr)) * cwnd_in_mtu; in sctp_cwnd_new_rtcc_transmission_begins()
1485 if (net->cwnd > cwnd) { in sctp_cwnd_new_rtcc_transmission_begins()
1487 net->cwnd = cwnd; in sctp_cwnd_new_rtcc_transmission_begins()
1495 struct sctp_nets *net) in sctp_set_rtcc_initial_cc_param() argument
1501 sctp_set_initial_cc_param(stcb, net); in sctp_set_rtcc_initial_cc_param()
1504 probepoint = (((uint64_t)net->cwnd) << 32); in sctp_set_rtcc_initial_cc_param()
1506 vtag = (net->rtt << 32) | in sctp_set_rtcc_initial_cc_param()
1509 SDT_PROBE5(sctp, cwnd, net, rttvar, in sctp_set_rtcc_initial_cc_param()
1516 net->cc_mod.rtcc.lbw_rtt = 0; in sctp_set_rtcc_initial_cc_param()
1517 net->cc_mod.rtcc.cwnd_at_bw_set = 0; in sctp_set_rtcc_initial_cc_param()
1518 net->cc_mod.rtcc.vol_reduce = 0; in sctp_set_rtcc_initial_cc_param()
1519 net->cc_mod.rtcc.lbw = 0; in sctp_set_rtcc_initial_cc_param()
1520 net->cc_mod.rtcc.vol_reduce = 0; in sctp_set_rtcc_initial_cc_param()
1521 net->cc_mod.rtcc.bw_bytes_at_last_rttc = 0; in sctp_set_rtcc_initial_cc_param()
1522 net->cc_mod.rtcc.bw_tot_time = 0; in sctp_set_rtcc_initial_cc_param()
1523 net->cc_mod.rtcc.bw_bytes = 0; in sctp_set_rtcc_initial_cc_param()
1524 net->cc_mod.rtcc.tls_needs_set = 0; in sctp_set_rtcc_initial_cc_param()
1525 net->cc_mod.rtcc.ret_from_eq = SCTP_BASE_SYSCTL(sctp_rttvar_eqret); in sctp_set_rtcc_initial_cc_param()
1526 net->cc_mod.rtcc.steady_step = SCTP_BASE_SYSCTL(sctp_steady_step); in sctp_set_rtcc_initial_cc_param()
1527 net->cc_mod.rtcc.use_dccc_ecn = SCTP_BASE_SYSCTL(sctp_use_dccc_ecn); in sctp_set_rtcc_initial_cc_param()
1528 net->cc_mod.rtcc.step_cnt = 0; in sctp_set_rtcc_initial_cc_param()
1529 net->cc_mod.rtcc.last_step_state = 0; in sctp_set_rtcc_initial_cc_param()
1538 struct sctp_nets *net; in sctp_cwnd_rtcc_socket_option() local
1546 TAILQ_FOREACH(net, &stcb->asoc.nets, sctp_next) { in sctp_cwnd_rtcc_socket_option()
1547 net->cc_mod.rtcc.ret_from_eq = cc_opt->aid_value.assoc_value; in sctp_cwnd_rtcc_socket_option()
1554 TAILQ_FOREACH(net, &stcb->asoc.nets, sctp_next) { in sctp_cwnd_rtcc_socket_option()
1555 net->cc_mod.rtcc.use_dccc_ecn = cc_opt->aid_value.assoc_value; in sctp_cwnd_rtcc_socket_option()
1558 TAILQ_FOREACH(net, &stcb->asoc.nets, sctp_next) { in sctp_cwnd_rtcc_socket_option()
1559 net->cc_mod.rtcc.steady_step = cc_opt->aid_value.assoc_value; in sctp_cwnd_rtcc_socket_option()
1567 net = TAILQ_FIRST(&stcb->asoc.nets); in sctp_cwnd_rtcc_socket_option()
1568 if (net == NULL) { in sctp_cwnd_rtcc_socket_option()
1571 cc_opt->aid_value.assoc_value = net->cc_mod.rtcc.ret_from_eq; in sctp_cwnd_rtcc_socket_option()
1573 net = TAILQ_FIRST(&stcb->asoc.nets); in sctp_cwnd_rtcc_socket_option()
1574 if (net == NULL) { in sctp_cwnd_rtcc_socket_option()
1577 cc_opt->aid_value.assoc_value = net->cc_mod.rtcc.use_dccc_ecn; in sctp_cwnd_rtcc_socket_option()
1579 net = TAILQ_FIRST(&stcb->asoc.nets); in sctp_cwnd_rtcc_socket_option()
1580 if (net == NULL) { in sctp_cwnd_rtcc_socket_option()
1583 cc_opt->aid_value.assoc_value = net->cc_mod.rtcc.steady_step; in sctp_cwnd_rtcc_socket_option()
1593 struct sctp_nets *net) in sctp_cwnd_update_rtcc_packet_transmitted() argument
1595 if (net->cc_mod.rtcc.tls_needs_set == 0) { in sctp_cwnd_update_rtcc_packet_transmitted()
1596 SCTP_GETPTIME_TIMEVAL(&net->cc_mod.rtcc.tls); in sctp_cwnd_update_rtcc_packet_transmitted()
1597 net->cc_mod.rtcc.tls_needs_set = 2; in sctp_cwnd_update_rtcc_packet_transmitted()
1612 struct sctp_nets *net, in sctp_rtt_rtcc_calculated() argument
1615 net->cc_mod.rtcc.rtt_set_this_sack = 1; in sctp_rtt_rtcc_calculated()
1705 sctp_hs_cwnd_increase(struct sctp_tcb *stcb, struct sctp_nets *net) in sctp_hs_cwnd_increase() argument
1708 int old_cwnd = net->cwnd; in sctp_hs_cwnd_increase()
1710 cur_val = net->cwnd >> 10; in sctp_hs_cwnd_increase()
1715 if (net->net_ack > net->mtu) { in sctp_hs_cwnd_increase()
1716 net->cwnd += net->mtu; in sctp_hs_cwnd_increase()
1718 net->cwnd += net->net_ack; in sctp_hs_cwnd_increase()
1721 for (i = net->last_hs_used; i < SCTP_HS_TABLE_SIZE; i++) { in sctp_hs_cwnd_increase()
1727 net->last_hs_used = indx; in sctp_hs_cwnd_increase()
1729 net->cwnd += incr; in sctp_hs_cwnd_increase()
1731 sctp_enforce_cwnd_limit(&stcb->asoc, net); in sctp_hs_cwnd_increase()
1733 sctp_log_cwnd(stcb, net, (net->cwnd - old_cwnd), SCTP_CWND_LOG_FROM_SS); in sctp_hs_cwnd_increase()
1738 sctp_hs_cwnd_decrease(struct sctp_tcb *stcb, struct sctp_nets *net) in sctp_hs_cwnd_decrease() argument
1741 int old_cwnd = net->cwnd; in sctp_hs_cwnd_decrease()
1743 cur_val = net->cwnd >> 10; in sctp_hs_cwnd_decrease()
1746 net->ssthresh = net->cwnd / 2; in sctp_hs_cwnd_decrease()
1747 if (net->ssthresh < (net->mtu * 2)) { in sctp_hs_cwnd_decrease()
1748 net->ssthresh = 2 * net->mtu; in sctp_hs_cwnd_decrease()
1750 net->cwnd = net->ssthresh; in sctp_hs_cwnd_decrease()
1753 net->ssthresh = net->cwnd - (int)((net->cwnd / 100) * in sctp_hs_cwnd_decrease()
1754 (int32_t)sctp_cwnd_adjust[net->last_hs_used].drop_percent); in sctp_hs_cwnd_decrease()
1755 net->cwnd = net->ssthresh; in sctp_hs_cwnd_decrease()
1757 indx = net->last_hs_used; in sctp_hs_cwnd_decrease()
1758 cur_val = net->cwnd >> 10; in sctp_hs_cwnd_decrease()
1762 net->last_hs_used = 0; in sctp_hs_cwnd_decrease()
1769 net->last_hs_used = indx; in sctp_hs_cwnd_decrease()
1772 sctp_enforce_cwnd_limit(&stcb->asoc, net); in sctp_hs_cwnd_decrease()
1774 sctp_log_cwnd(stcb, net, (net->cwnd - old_cwnd), SCTP_CWND_LOG_FROM_FR); in sctp_hs_cwnd_decrease()
1782 struct sctp_nets *net; in sctp_hs_cwnd_update_after_fr() local
1785 * (net->fast_retran_loss_recovery == 0))) in sctp_hs_cwnd_update_after_fr()
1787 TAILQ_FOREACH(net, &asoc->nets, sctp_next) { in sctp_hs_cwnd_update_after_fr()
1791 if (net->net_ack > 0) { in sctp_hs_cwnd_update_after_fr()
1800 sctp_hs_cwnd_decrease(stcb, net); in sctp_hs_cwnd_update_after_fr()
1804 net->partial_bytes_acked = 0; in sctp_hs_cwnd_update_after_fr()
1818 net->fast_retran_loss_recovery = 1; in sctp_hs_cwnd_update_after_fr()
1822 net->fast_recovery_tsn = asoc->sending_seq - 1; in sctp_hs_cwnd_update_after_fr()
1824 net->fast_recovery_tsn = lchk->rec.data.tsn - 1; in sctp_hs_cwnd_update_after_fr()
1828 stcb->sctp_ep, stcb, net, in sctp_hs_cwnd_update_after_fr()
1831 stcb->sctp_ep, stcb, net); in sctp_hs_cwnd_update_after_fr()
1833 } else if (net->net_ack > 0) { in sctp_hs_cwnd_update_after_fr()
1848 struct sctp_nets *net; in sctp_hs_cwnd_update_after_sack() local
1852 TAILQ_FOREACH(net, &asoc->nets, sctp_next) { in sctp_hs_cwnd_update_after_sack()
1858 if (net->fast_retran_loss_recovery && net->new_pseudo_cumack) { in sctp_hs_cwnd_update_after_sack()
1859 if (SCTP_TSN_GE(asoc->last_acked_seq, net->fast_recovery_tsn) || in sctp_hs_cwnd_update_after_sack()
1860 SCTP_TSN_GE(net->pseudo_cumack,net->fast_recovery_tsn)) { in sctp_hs_cwnd_update_after_sack()
1861 net->will_exit_fast_recovery = 1; in sctp_hs_cwnd_update_after_sack()
1866 if (net->net_ack == 0) { in sctp_hs_cwnd_update_after_sack()
1868 sctp_log_cwnd(stcb, net, 0, SCTP_CWND_LOG_FROM_SACK); in sctp_hs_cwnd_update_after_sack()
1876 if (sctp_cmt_on_off > 0 && net->fast_retran_loss_recovery && net->will_exit_fast_recovery == 0) { in sctp_hs_cwnd_update_after_sack()
1897 ((asoc->sctp_cmt_on_off > 0) && net->new_pseudo_cumack)) { in sctp_hs_cwnd_update_after_sack()
1899 if (net->cwnd <= net->ssthresh) { in sctp_hs_cwnd_update_after_sack()
1901 if (net->flight_size + net->net_ack >= net->cwnd) { in sctp_hs_cwnd_update_after_sack()
1902 sctp_hs_cwnd_increase(stcb, net); in sctp_hs_cwnd_update_after_sack()
1905 sctp_log_cwnd(stcb, net, net->net_ack, in sctp_hs_cwnd_update_after_sack()
1911 net->partial_bytes_acked += net->net_ack; in sctp_hs_cwnd_update_after_sack()
1912 if ((net->flight_size + net->net_ack >= net->cwnd) && in sctp_hs_cwnd_update_after_sack()
1913 (net->partial_bytes_acked >= net->cwnd)) { in sctp_hs_cwnd_update_after_sack()
1914 net->partial_bytes_acked -= net->cwnd; in sctp_hs_cwnd_update_after_sack()
1915 net->cwnd += net->mtu; in sctp_hs_cwnd_update_after_sack()
1916 sctp_enforce_cwnd_limit(asoc, net); in sctp_hs_cwnd_update_after_sack()
1918 sctp_log_cwnd(stcb, net, net->mtu, in sctp_hs_cwnd_update_after_sack()
1923 sctp_log_cwnd(stcb, net, net->net_ack, in sctp_hs_cwnd_update_after_sack()
1930 sctp_log_cwnd(stcb, net, net->mtu, in sctp_hs_cwnd_update_after_sack()
1943 * http://www.hamilton.ie/net/htcp3.pdf
1980 htcp_cwnd_undo(struct sctp_tcb *stcb, struct sctp_nets *net) in htcp_cwnd_undo() argument
1982 net->cc_mod.htcp_ca.last_cong = net->cc_mod.htcp_ca.undo_last_cong; in htcp_cwnd_undo()
1983 net->cc_mod.htcp_ca.maxRTT = net->cc_mod.htcp_ca.undo_maxRTT; in htcp_cwnd_undo()
1984 net->cc_mod.htcp_ca.old_maxB = net->cc_mod.htcp_ca.undo_old_maxB; in htcp_cwnd_undo()
1985 return (max(net->cwnd, ((net->ssthresh/net->mtu<<7)/net->cc_mod.htcp_ca.beta)*net->mtu)); in htcp_cwnd_undo()
1991 measure_rtt(struct sctp_nets *net) in measure_rtt() argument
1993 uint32_t srtt = net->lastsa>>SCTP_RTT_SHIFT; in measure_rtt()
1996 if (net->cc_mod.htcp_ca.minRTT > srtt || !net->cc_mod.htcp_ca.minRTT) in measure_rtt()
1997 net->cc_mod.htcp_ca.minRTT = srtt; in measure_rtt()
2000 if (net->fast_retran_ip == 0 && net->ssthresh < 0xFFFF && htcp_ccount(&net->cc_mod.htcp_ca) > 3) { in measure_rtt()
2001 if (net->cc_mod.htcp_ca.maxRTT < net->cc_mod.htcp_ca.minRTT) in measure_rtt()
2002 net->cc_mod.htcp_ca.maxRTT = net->cc_mod.htcp_ca.minRTT; in measure_rtt()
2003 …if (net->cc_mod.htcp_ca.maxRTT < srtt && srtt <= net->cc_mod.htcp_ca.maxRTT+sctp_msecs_to_ticks(20… in measure_rtt()
2004 net->cc_mod.htcp_ca.maxRTT = srtt; in measure_rtt()
2009 measure_achieved_throughput(struct sctp_nets *net) in measure_achieved_throughput() argument
2013 if (net->fast_retran_ip == 0) in measure_achieved_throughput()
2014 net->cc_mod.htcp_ca.bytes_acked = net->net_ack; in measure_achieved_throughput()
2021 if (net->fast_retran_ip == 1) { in measure_achieved_throughput()
2022 net->cc_mod.htcp_ca.bytecount = 0; in measure_achieved_throughput()
2023 net->cc_mod.htcp_ca.lasttime = now; in measure_achieved_throughput()
2027 net->cc_mod.htcp_ca.bytecount += net->net_ack; in measure_achieved_throughput()
2028 …if ((net->cc_mod.htcp_ca.bytecount >= net->cwnd - (((net->cc_mod.htcp_ca.alpha >> 7) ? (net->cc_mo… in measure_achieved_throughput()
2029 (now - net->cc_mod.htcp_ca.lasttime >= net->cc_mod.htcp_ca.minRTT) && in measure_achieved_throughput()
2030 (net->cc_mod.htcp_ca.minRTT > 0)) { in measure_achieved_throughput()
2031 uint32_t cur_Bi = net->cc_mod.htcp_ca.bytecount/net->mtu*hz/(now - net->cc_mod.htcp_ca.lasttime); in measure_achieved_throughput()
2033 if (htcp_ccount(&net->cc_mod.htcp_ca) <= 3) { in measure_achieved_throughput()
2035 net->cc_mod.htcp_ca.minB = net->cc_mod.htcp_ca.maxB = net->cc_mod.htcp_ca.Bi = cur_Bi; in measure_achieved_throughput()
2037 net->cc_mod.htcp_ca.Bi = (3*net->cc_mod.htcp_ca.Bi + cur_Bi)/4; in measure_achieved_throughput()
2038 if (net->cc_mod.htcp_ca.Bi > net->cc_mod.htcp_ca.maxB) in measure_achieved_throughput()
2039 net->cc_mod.htcp_ca.maxB = net->cc_mod.htcp_ca.Bi; in measure_achieved_throughput()
2040 if (net->cc_mod.htcp_ca.minB > net->cc_mod.htcp_ca.maxB) in measure_achieved_throughput()
2041 net->cc_mod.htcp_ca.minB = net->cc_mod.htcp_ca.maxB; in measure_achieved_throughput()
2043 net->cc_mod.htcp_ca.bytecount = 0; in measure_achieved_throughput()
2044 net->cc_mod.htcp_ca.lasttime = now; in measure_achieved_throughput()
2109 htcp_param_update(struct sctp_nets *net) in htcp_param_update() argument
2111 uint32_t minRTT = net->cc_mod.htcp_ca.minRTT; in htcp_param_update()
2112 uint32_t maxRTT = net->cc_mod.htcp_ca.maxRTT; in htcp_param_update()
2114 htcp_beta_update(&net->cc_mod.htcp_ca, minRTT, maxRTT); in htcp_param_update()
2115 htcp_alpha_update(&net->cc_mod.htcp_ca); in htcp_param_update()
2119 net->cc_mod.htcp_ca.maxRTT = minRTT + ((maxRTT-minRTT)*95)/100; in htcp_param_update()
2123 htcp_recalc_ssthresh(struct sctp_nets *net) in htcp_recalc_ssthresh() argument
2125 htcp_param_update(net); in htcp_recalc_ssthresh()
2126 return (max(((net->cwnd/net->mtu * net->cc_mod.htcp_ca.beta) >> 7)*net->mtu, 2U*net->mtu)); in htcp_recalc_ssthresh()
2130 htcp_cong_avoid(struct sctp_tcb *stcb, struct sctp_nets *net) in htcp_cong_avoid() argument
2137 if (net->cwnd <= net->ssthresh) { in htcp_cong_avoid()
2139 if (net->flight_size + net->net_ack >= net->cwnd) { in htcp_cong_avoid()
2140 if (net->net_ack > (net->mtu * SCTP_BASE_SYSCTL(sctp_L2_abc_variable))) { in htcp_cong_avoid()
2141 net->cwnd += (net->mtu * SCTP_BASE_SYSCTL(sctp_L2_abc_variable)); in htcp_cong_avoid()
2143 sctp_log_cwnd(stcb, net, net->mtu, in htcp_cong_avoid()
2148 net->cwnd += net->net_ack; in htcp_cong_avoid()
2150 sctp_log_cwnd(stcb, net, net->net_ack, in htcp_cong_avoid()
2155 sctp_enforce_cwnd_limit(&stcb->asoc, net); in htcp_cong_avoid()
2158 sctp_log_cwnd(stcb, net, net->net_ack, in htcp_cong_avoid()
2163 measure_rtt(net); in htcp_cong_avoid()
2166 * In theory this is net->cwnd += alpha / net->cwnd in htcp_cong_avoid()
2169 …if (((net->partial_bytes_acked/net->mtu * net->cc_mod.htcp_ca.alpha) >> 7)*net->mtu >= net->cwnd) { in htcp_cong_avoid()
2172 * if (net->snd_cwnd < net->snd_cwnd_clamp) - Nope (RRS). in htcp_cong_avoid()
2174 net->cwnd += net->mtu; in htcp_cong_avoid()
2175 net->partial_bytes_acked = 0; in htcp_cong_avoid()
2176 sctp_enforce_cwnd_limit(&stcb->asoc, net); in htcp_cong_avoid()
2177 htcp_alpha_update(&net->cc_mod.htcp_ca); in htcp_cong_avoid()
2179 sctp_log_cwnd(stcb, net, net->mtu, in htcp_cong_avoid()
2183 net->partial_bytes_acked += net->net_ack; in htcp_cong_avoid()
2185 sctp_log_cwnd(stcb, net, net->net_ack, in htcp_cong_avoid()
2190 net->cc_mod.htcp_ca.bytes_acked = net->mtu; in htcp_cong_avoid()
2197 htcp_min_cwnd(struct sctp_tcb *stcb, struct sctp_nets *net) in htcp_min_cwnd() argument
2199 return (net->ssthresh); in htcp_min_cwnd()
2204 htcp_init(struct sctp_nets *net) in htcp_init() argument
2206 memset(&net->cc_mod.htcp_ca, 0, sizeof(struct htcp)); in htcp_init()
2207 net->cc_mod.htcp_ca.alpha = ALPHA_BASE; in htcp_init()
2208 net->cc_mod.htcp_ca.beta = BETA_MIN; in htcp_init()
2209 net->cc_mod.htcp_ca.bytes_acked = net->mtu; in htcp_init()
2210 net->cc_mod.htcp_ca.last_cong = sctp_get_tick_count(); in htcp_init()
2214 sctp_htcp_set_initial_cc_param(struct sctp_tcb *stcb, struct sctp_nets *net) in sctp_htcp_set_initial_cc_param() argument
2220 net->cwnd = min((net->mtu * 4), max((2 * net->mtu), SCTP_INITIAL_CWND)); in sctp_htcp_set_initial_cc_param()
2221 net->ssthresh = stcb->asoc.peers_rwnd; in sctp_htcp_set_initial_cc_param()
2222 sctp_enforce_cwnd_limit(&stcb->asoc, net); in sctp_htcp_set_initial_cc_param()
2223 htcp_init(net); in sctp_htcp_set_initial_cc_param()
2226 sctp_log_cwnd(stcb, net, 0, SCTP_CWND_INITIALIZATION); in sctp_htcp_set_initial_cc_param()
2235 struct sctp_nets *net; in sctp_htcp_cwnd_update_after_sack() local
2240 TAILQ_FOREACH(net, &asoc->nets, sctp_next) { in sctp_htcp_cwnd_update_after_sack()
2246 if (net->fast_retran_loss_recovery && net->new_pseudo_cumack) { in sctp_htcp_cwnd_update_after_sack()
2247 if (SCTP_TSN_GE(asoc->last_acked_seq, net->fast_recovery_tsn) || in sctp_htcp_cwnd_update_after_sack()
2248 SCTP_TSN_GE(net->pseudo_cumack,net->fast_recovery_tsn)) { in sctp_htcp_cwnd_update_after_sack()
2249 net->will_exit_fast_recovery = 1; in sctp_htcp_cwnd_update_after_sack()
2254 if (net->net_ack == 0) { in sctp_htcp_cwnd_update_after_sack()
2256 sctp_log_cwnd(stcb, net, 0, SCTP_CWND_LOG_FROM_SACK); in sctp_htcp_cwnd_update_after_sack()
2264 if (sctp_cmt_on_off > 0 && net->fast_retran_loss_recovery && net->will_exit_fast_recovery == 0) { in sctp_htcp_cwnd_update_after_sack()
2285 ((asoc->sctp_cmt_on_off > 0) && net->new_pseudo_cumack)) { in sctp_htcp_cwnd_update_after_sack()
2286 htcp_cong_avoid(stcb, net); in sctp_htcp_cwnd_update_after_sack()
2287 measure_achieved_throughput(net); in sctp_htcp_cwnd_update_after_sack()
2290 sctp_log_cwnd(stcb, net, net->mtu, in sctp_htcp_cwnd_update_after_sack()
2301 struct sctp_nets *net; in sctp_htcp_cwnd_update_after_fr() local
2304 * (net->fast_retran_loss_recovery == 0))) in sctp_htcp_cwnd_update_after_fr()
2306 TAILQ_FOREACH(net, &asoc->nets, sctp_next) { in sctp_htcp_cwnd_update_after_fr()
2310 if (net->net_ack > 0) { in sctp_htcp_cwnd_update_after_fr()
2318 int old_cwnd = net->cwnd; in sctp_htcp_cwnd_update_after_fr()
2321 htcp_reset(&net->cc_mod.htcp_ca); in sctp_htcp_cwnd_update_after_fr()
2322 net->ssthresh = htcp_recalc_ssthresh(net); in sctp_htcp_cwnd_update_after_fr()
2323 net->cwnd = net->ssthresh; in sctp_htcp_cwnd_update_after_fr()
2324 sctp_enforce_cwnd_limit(asoc, net); in sctp_htcp_cwnd_update_after_fr()
2326 sctp_log_cwnd(stcb, net, (net->cwnd - old_cwnd), in sctp_htcp_cwnd_update_after_fr()
2331 net->partial_bytes_acked = 0; in sctp_htcp_cwnd_update_after_fr()
2345 net->fast_retran_loss_recovery = 1; in sctp_htcp_cwnd_update_after_fr()
2349 net->fast_recovery_tsn = asoc->sending_seq - 1; in sctp_htcp_cwnd_update_after_fr()
2351 net->fast_recovery_tsn = lchk->rec.data.tsn - 1; in sctp_htcp_cwnd_update_after_fr()
2355 stcb->sctp_ep, stcb, net, in sctp_htcp_cwnd_update_after_fr()
2358 stcb->sctp_ep, stcb, net); in sctp_htcp_cwnd_update_after_fr()
2360 } else if (net->net_ack > 0) { in sctp_htcp_cwnd_update_after_fr()
2372 struct sctp_nets *net) in sctp_htcp_cwnd_update_after_timeout() argument
2374 int old_cwnd = net->cwnd; in sctp_htcp_cwnd_update_after_timeout()
2377 htcp_reset(&net->cc_mod.htcp_ca); in sctp_htcp_cwnd_update_after_timeout()
2378 net->ssthresh = htcp_recalc_ssthresh(net); in sctp_htcp_cwnd_update_after_timeout()
2379 net->cwnd = net->mtu; in sctp_htcp_cwnd_update_after_timeout()
2380 net->partial_bytes_acked = 0; in sctp_htcp_cwnd_update_after_timeout()
2382 sctp_log_cwnd(stcb, net, net->cwnd - old_cwnd, SCTP_CWND_LOG_FROM_RTX); in sctp_htcp_cwnd_update_after_timeout()
2388 struct sctp_nets *net, int in_window, int num_pkt_lost SCTP_UNUSED) in sctp_htcp_cwnd_update_after_ecn_echo() argument
2391 old_cwnd = net->cwnd; in sctp_htcp_cwnd_update_after_ecn_echo()
2395 htcp_reset(&net->cc_mod.htcp_ca); in sctp_htcp_cwnd_update_after_ecn_echo()
2397 net->ssthresh = htcp_recalc_ssthresh(net); in sctp_htcp_cwnd_update_after_ecn_echo()
2398 if (net->ssthresh < net->mtu) { in sctp_htcp_cwnd_update_after_ecn_echo()
2399 net->ssthresh = net->mtu; in sctp_htcp_cwnd_update_after_ecn_echo()
2401 net->RTO <<= 1; in sctp_htcp_cwnd_update_after_ecn_echo()
2403 net->cwnd = net->ssthresh; in sctp_htcp_cwnd_update_after_ecn_echo()
2404 sctp_enforce_cwnd_limit(&stcb->asoc, net); in sctp_htcp_cwnd_update_after_ecn_echo()
2406 sctp_log_cwnd(stcb, net, (net->cwnd - old_cwnd), SCTP_CWND_LOG_FROM_SAT); in sctp_htcp_cwnd_update_after_ecn_echo()