Lines Matching refs:net
58 sctp_enforce_cwnd_limit(struct sctp_association *assoc, struct sctp_nets *net) in sctp_enforce_cwnd_limit() argument
61 (net->cwnd > assoc->max_cwnd) && in sctp_enforce_cwnd_limit()
62 (net->cwnd > (net->mtu - sizeof(struct sctphdr)))) { in sctp_enforce_cwnd_limit()
63 net->cwnd = assoc->max_cwnd; in sctp_enforce_cwnd_limit()
64 if (net->cwnd < (net->mtu - sizeof(struct sctphdr))) { in sctp_enforce_cwnd_limit()
65 net->cwnd = net->mtu - sizeof(struct sctphdr); in sctp_enforce_cwnd_limit()
71 sctp_set_initial_cc_param(struct sctp_tcb *stcb, struct sctp_nets *net) in sctp_set_initial_cc_param() argument
80 net->cwnd = min((net->mtu * 4), max((2 * net->mtu), SCTP_INITIAL_CWND)); in sctp_set_initial_cc_param()
88 net->cwnd = (net->mtu - sizeof(struct sctphdr)) * cwnd_in_mtu; in sctp_set_initial_cc_param()
93 net->cwnd /= assoc->numnets; in sctp_set_initial_cc_param()
94 if (net->cwnd < (net->mtu - sizeof(struct sctphdr))) { in sctp_set_initial_cc_param()
95 net->cwnd = net->mtu - sizeof(struct sctphdr); in sctp_set_initial_cc_param()
98 sctp_enforce_cwnd_limit(assoc, net); in sctp_set_initial_cc_param()
99 net->ssthresh = assoc->peers_rwnd; in sctp_set_initial_cc_param()
100 SDT_PROBE5(sctp, cwnd, net, init, in sctp_set_initial_cc_param()
101 stcb->asoc.my_vtag, ((stcb->sctp_ep->sctp_lport << 16) | (stcb->rport)), net, in sctp_set_initial_cc_param()
102 0, net->cwnd); in sctp_set_initial_cc_param()
105 sctp_log_cwnd(stcb, net, 0, SCTP_CWND_INITIALIZATION); in sctp_set_initial_cc_param()
113 struct sctp_nets *net; in sctp_cwnd_update_after_fr() local
123 TAILQ_FOREACH(net, &asoc->nets, sctp_next) { in sctp_cwnd_update_after_fr()
124 t_ssthresh += net->ssthresh; in sctp_cwnd_update_after_fr()
125 t_cwnd += net->cwnd; in sctp_cwnd_update_after_fr()
126 if (net->lastsa > 0) { in sctp_cwnd_update_after_fr()
127 t_ucwnd_sbw += (uint64_t)net->cwnd / (uint64_t)net->lastsa; in sctp_cwnd_update_after_fr()
139 TAILQ_FOREACH(net, &asoc->nets, sctp_next) { in sctp_cwnd_update_after_fr()
143 if (net->net_ack > 0) { in sctp_cwnd_update_after_fr()
151 int old_cwnd = net->cwnd; in sctp_cwnd_update_after_fr()
156 net->ssthresh = (uint32_t)(((uint64_t)4 * in sctp_cwnd_update_after_fr()
157 (uint64_t)net->mtu * in sctp_cwnd_update_after_fr()
158 (uint64_t)net->ssthresh) / in sctp_cwnd_update_after_fr()
165 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()
199 SDT_PROBE5(sctp, cwnd, net, fr, in sctp_cwnd_update_after_fr()
200 stcb->asoc.my_vtag, ((stcb->sctp_ep->sctp_lport << 16) | (stcb->rport)), net, in sctp_cwnd_update_after_fr()
201 old_cwnd, net->cwnd); in sctp_cwnd_update_after_fr()
203 sctp_log_cwnd(stcb, net, (net->cwnd - old_cwnd), in sctp_cwnd_update_after_fr()
208 net->partial_bytes_acked = 0; in sctp_cwnd_update_after_fr()
222 net->fast_retran_loss_recovery = 1; in sctp_cwnd_update_after_fr()
226 net->fast_recovery_tsn = asoc->sending_seq - 1; in sctp_cwnd_update_after_fr()
228 net->fast_recovery_tsn = lchk->rec.data.tsn - 1; in sctp_cwnd_update_after_fr()
232 stcb->sctp_ep, stcb, net, in sctp_cwnd_update_after_fr()
235 stcb->sctp_ep, stcb, net); in sctp_cwnd_update_after_fr()
237 } else if (net->net_ack > 0) { in sctp_cwnd_update_after_fr()
254 cc_bw_same(struct sctp_tcb *stcb, struct sctp_nets *net, uint64_t nbw, in cc_bw_same() argument
259 probepoint = (((uint64_t)net->cwnd) << 32); in cc_bw_same()
260 if (net->rtt > net->cc_mod.rtcc.lbw_rtt + rtt_offset) { in cc_bw_same()
267 SDT_PROBE5(sctp, cwnd, net, rttvar, in cc_bw_same()
269 ((net->cc_mod.rtcc.lbw << 32) | nbw), in cc_bw_same()
270 ((net->cc_mod.rtcc.lbw_rtt << 32) | net->rtt), in cc_bw_same()
271 net->flight_size, in cc_bw_same()
273 if ((net->cc_mod.rtcc.steady_step) && (inst_ind != SCTP_INST_LOOSING)) { in cc_bw_same()
274 if (net->cc_mod.rtcc.last_step_state == 5) in cc_bw_same()
275 net->cc_mod.rtcc.step_cnt++; in cc_bw_same()
277 net->cc_mod.rtcc.step_cnt = 1; in cc_bw_same()
278 net->cc_mod.rtcc.last_step_state = 5; in cc_bw_same()
279 if ((net->cc_mod.rtcc.step_cnt == net->cc_mod.rtcc.steady_step) || in cc_bw_same()
280 ((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) == 0))) { in cc_bw_same()
283 oth = net->cc_mod.rtcc.vol_reduce; in cc_bw_same()
285 oth |= net->cc_mod.rtcc.step_cnt; in cc_bw_same()
287 oth |= net->cc_mod.rtcc.last_step_state; in cc_bw_same()
288 SDT_PROBE5(sctp, cwnd, net, rttstep, in cc_bw_same()
290 ((net->cc_mod.rtcc.lbw << 32) | nbw), in cc_bw_same()
291 ((net->cc_mod.rtcc.lbw_rtt << 32) | net->rtt), in cc_bw_same()
294 if (net->cwnd > (4 * net->mtu)) { in cc_bw_same()
295 net->cwnd -= net->mtu; in cc_bw_same()
296 net->cc_mod.rtcc.vol_reduce++; in cc_bw_same()
298 net->cc_mod.rtcc.step_cnt = 0; in cc_bw_same()
304 if (net->rtt < net->cc_mod.rtcc.lbw_rtt - rtt_offset) { in cc_bw_same()
312 SDT_PROBE5(sctp, cwnd, net, rttvar, in cc_bw_same()
314 ((net->cc_mod.rtcc.lbw << 32) | nbw), in cc_bw_same()
315 ((net->cc_mod.rtcc.lbw_rtt << 32) | net->rtt), in cc_bw_same()
316 net->flight_size, in cc_bw_same()
318 if (net->cc_mod.rtcc.steady_step) { in cc_bw_same()
319 oth = net->cc_mod.rtcc.vol_reduce; in cc_bw_same()
321 oth |= net->cc_mod.rtcc.step_cnt; in cc_bw_same()
323 oth |= net->cc_mod.rtcc.last_step_state; in cc_bw_same()
324 SDT_PROBE5(sctp, cwnd, net, rttstep, in cc_bw_same()
326 ((net->cc_mod.rtcc.lbw << 32) | nbw), in cc_bw_same()
327 ((net->cc_mod.rtcc.lbw_rtt << 32) | net->rtt), in cc_bw_same()
330 if ((net->cc_mod.rtcc.last_step_state == 5) && in cc_bw_same()
331 (net->cc_mod.rtcc.step_cnt > net->cc_mod.rtcc.steady_step)) { in cc_bw_same()
333 net->cc_mod.rtcc.step_cnt = 0; in cc_bw_same()
336 net->cc_mod.rtcc.last_step_state = 6; in cc_bw_same()
337 net->cc_mod.rtcc.step_cnt = 0; in cc_bw_same()
340 net->cc_mod.rtcc.lbw = nbw; in cc_bw_same()
341 net->cc_mod.rtcc.lbw_rtt = net->rtt; in cc_bw_same()
342 net->cc_mod.rtcc.cwnd_at_bw_set = net->cwnd; in cc_bw_same()
354 probepoint |= ((7 << 16) | net->cc_mod.rtcc.ret_from_eq); in cc_bw_same()
355 SDT_PROBE5(sctp, cwnd, net, rttvar, in cc_bw_same()
357 ((net->cc_mod.rtcc.lbw << 32) | nbw), in cc_bw_same()
358 ((net->cc_mod.rtcc.lbw_rtt << 32) | net->rtt), in cc_bw_same()
359 net->flight_size, in cc_bw_same()
361 if ((net->cc_mod.rtcc.steady_step) && (inst_ind != SCTP_INST_LOOSING)) { in cc_bw_same()
362 if (net->cc_mod.rtcc.last_step_state == 5) in cc_bw_same()
363 net->cc_mod.rtcc.step_cnt++; in cc_bw_same()
365 net->cc_mod.rtcc.step_cnt = 1; in cc_bw_same()
366 net->cc_mod.rtcc.last_step_state = 5; in cc_bw_same()
367 if ((net->cc_mod.rtcc.step_cnt == net->cc_mod.rtcc.steady_step) || in cc_bw_same()
368 ((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) == 0))) { in cc_bw_same()
371 if (net->cwnd > (4 * net->mtu)) { in cc_bw_same()
372 net->cwnd -= net->mtu; in cc_bw_same()
373 net->cc_mod.rtcc.vol_reduce++; in cc_bw_same()
376 net->cc_mod.rtcc.step_cnt = 0; in cc_bw_same()
385 return ((int)net->cc_mod.rtcc.ret_from_eq); in cc_bw_same()
389 cc_bw_decrease(struct sctp_tcb *stcb, struct sctp_nets *net, uint64_t nbw, uint64_t rtt_offset, in cc_bw_decrease() argument
395 probepoint = (((uint64_t)net->cwnd) << 32); in cc_bw_decrease()
396 if (net->rtt > net->cc_mod.rtcc.lbw_rtt + rtt_offset) { in cc_bw_decrease()
399 if ((net->cwnd > net->cc_mod.rtcc.cwnd_at_bw_set) && in cc_bw_decrease()
404 SDT_PROBE5(sctp, cwnd, net, rttvar, in cc_bw_decrease()
406 ((net->cc_mod.rtcc.lbw << 32) | nbw), in cc_bw_decrease()
407 ((net->cc_mod.rtcc.lbw_rtt << 32) | net->rtt), in cc_bw_decrease()
408 net->flight_size, in cc_bw_decrease()
410 if (net->cc_mod.rtcc.ret_from_eq) { in cc_bw_decrease()
415 net->ssthresh = net->cwnd - 1; in cc_bw_decrease()
416 net->partial_bytes_acked = 0; in cc_bw_decrease()
422 SDT_PROBE5(sctp, cwnd, net, rttvar, in cc_bw_decrease()
424 ((net->cc_mod.rtcc.lbw << 32) | nbw), in cc_bw_decrease()
425 ((net->cc_mod.rtcc.lbw_rtt << 32) | net->rtt), in cc_bw_decrease()
426 net->flight_size, in cc_bw_decrease()
429 if (net->cc_mod.rtcc.steady_step) { in cc_bw_decrease()
430 oth = net->cc_mod.rtcc.vol_reduce; in cc_bw_decrease()
432 oth |= net->cc_mod.rtcc.step_cnt; in cc_bw_decrease()
434 oth |= net->cc_mod.rtcc.last_step_state; in cc_bw_decrease()
435 SDT_PROBE5(sctp, cwnd, net, rttstep, in cc_bw_decrease()
437 ((net->cc_mod.rtcc.lbw << 32) | nbw), in cc_bw_decrease()
438 ((net->cc_mod.rtcc.lbw_rtt << 32) | net->rtt), in cc_bw_decrease()
445 if ((net->cc_mod.rtcc.vol_reduce) && in cc_bw_decrease()
447 net->cwnd += net->mtu; in cc_bw_decrease()
448 sctp_enforce_cwnd_limit(&stcb->asoc, net); in cc_bw_decrease()
449 net->cc_mod.rtcc.vol_reduce--; in cc_bw_decrease()
451 net->cc_mod.rtcc.last_step_state = 2; in cc_bw_decrease()
452 net->cc_mod.rtcc.step_cnt = 0; in cc_bw_decrease()
455 } else if (net->rtt < net->cc_mod.rtcc.lbw_rtt - rtt_offset) { in cc_bw_decrease()
459 SDT_PROBE5(sctp, cwnd, net, rttvar, in cc_bw_decrease()
461 ((net->cc_mod.rtcc.lbw << 32) | nbw), in cc_bw_decrease()
462 ((net->cc_mod.rtcc.lbw_rtt << 32) | net->rtt), in cc_bw_decrease()
463 net->flight_size, in cc_bw_decrease()
465 if (net->cc_mod.rtcc.steady_step) { in cc_bw_decrease()
466 oth = net->cc_mod.rtcc.vol_reduce; in cc_bw_decrease()
468 oth |= net->cc_mod.rtcc.step_cnt; in cc_bw_decrease()
470 oth |= net->cc_mod.rtcc.last_step_state; in cc_bw_decrease()
471 SDT_PROBE5(sctp, cwnd, net, rttstep, in cc_bw_decrease()
473 ((net->cc_mod.rtcc.lbw << 32) | nbw), in cc_bw_decrease()
474 ((net->cc_mod.rtcc.lbw_rtt << 32) | net->rtt), in cc_bw_decrease()
477 if ((net->cc_mod.rtcc.vol_reduce) && in cc_bw_decrease()
479 net->cwnd += net->mtu; in cc_bw_decrease()
480 sctp_enforce_cwnd_limit(&stcb->asoc, net); in cc_bw_decrease()
481 net->cc_mod.rtcc.vol_reduce--; in cc_bw_decrease()
483 net->cc_mod.rtcc.last_step_state = 3; in cc_bw_decrease()
484 net->cc_mod.rtcc.step_cnt = 0; in cc_bw_decrease()
491 SDT_PROBE5(sctp, cwnd, net, rttvar, in cc_bw_decrease()
493 ((net->cc_mod.rtcc.lbw << 32) | nbw), in cc_bw_decrease()
494 ((net->cc_mod.rtcc.lbw_rtt << 32) | net->rtt), in cc_bw_decrease()
495 net->flight_size, in cc_bw_decrease()
497 if (net->cc_mod.rtcc.steady_step) { in cc_bw_decrease()
498 oth = net->cc_mod.rtcc.vol_reduce; in cc_bw_decrease()
500 oth |= net->cc_mod.rtcc.step_cnt; in cc_bw_decrease()
502 oth |= net->cc_mod.rtcc.last_step_state; in cc_bw_decrease()
503 SDT_PROBE5(sctp, cwnd, net, rttstep, in cc_bw_decrease()
505 ((net->cc_mod.rtcc.lbw << 32) | nbw), in cc_bw_decrease()
506 ((net->cc_mod.rtcc.lbw_rtt << 32) | net->rtt), in cc_bw_decrease()
509 if ((net->cc_mod.rtcc.vol_reduce) && in cc_bw_decrease()
511 net->cwnd += net->mtu; in cc_bw_decrease()
512 sctp_enforce_cwnd_limit(&stcb->asoc, net); in cc_bw_decrease()
513 net->cc_mod.rtcc.vol_reduce--; in cc_bw_decrease()
515 net->cc_mod.rtcc.last_step_state = 4; in cc_bw_decrease()
516 net->cc_mod.rtcc.step_cnt = 0; in cc_bw_decrease()
519 net->cc_mod.rtcc.lbw = nbw; in cc_bw_decrease()
520 net->cc_mod.rtcc.lbw_rtt = net->rtt; in cc_bw_decrease()
521 net->cc_mod.rtcc.cwnd_at_bw_set = net->cwnd; in cc_bw_decrease()
530 cc_bw_increase(struct sctp_tcb *stcb, struct sctp_nets *net, uint64_t nbw, uint64_t vtag) in cc_bw_increase() argument
540 probepoint = (((uint64_t)net->cwnd) << 32); in cc_bw_increase()
541 SDT_PROBE5(sctp, cwnd, net, rttvar, in cc_bw_increase()
543 ((net->cc_mod.rtcc.lbw << 32) | nbw), in cc_bw_increase()
544 ((net->cc_mod.rtcc.lbw_rtt << 32) | net->rtt), in cc_bw_increase()
545 net->flight_size, in cc_bw_increase()
547 if (net->cc_mod.rtcc.steady_step) { in cc_bw_increase()
548 oth = net->cc_mod.rtcc.vol_reduce; in cc_bw_increase()
550 oth |= net->cc_mod.rtcc.step_cnt; in cc_bw_increase()
552 oth |= net->cc_mod.rtcc.last_step_state; in cc_bw_increase()
553 SDT_PROBE5(sctp, cwnd, net, rttstep, in cc_bw_increase()
555 ((net->cc_mod.rtcc.lbw << 32) | nbw), in cc_bw_increase()
556 ((net->cc_mod.rtcc.lbw_rtt << 32) | net->rtt), in cc_bw_increase()
559 net->cc_mod.rtcc.last_step_state = 0; in cc_bw_increase()
560 net->cc_mod.rtcc.step_cnt = 0; in cc_bw_increase()
561 net->cc_mod.rtcc.vol_reduce = 0; in cc_bw_increase()
563 net->cc_mod.rtcc.lbw = nbw; in cc_bw_increase()
564 net->cc_mod.rtcc.lbw_rtt = net->rtt; in cc_bw_increase()
565 net->cc_mod.rtcc.cwnd_at_bw_set = net->cwnd; in cc_bw_increase()
573 cc_bw_limit(struct sctp_tcb *stcb, struct sctp_nets *net, uint64_t nbw) in cc_bw_limit() argument
623 probepoint = (((uint64_t)net->cwnd) << 32); in cc_bw_limit()
624 rtt = net->rtt; in cc_bw_limit()
625 if (net->cc_mod.rtcc.rtt_set_this_sack) { in cc_bw_limit()
626 net->cc_mod.rtcc.rtt_set_this_sack = 0; in cc_bw_limit()
627 bytes_for_this_rtt = net->cc_mod.rtcc.bw_bytes - net->cc_mod.rtcc.bw_bytes_at_last_rttc; in cc_bw_limit()
628 net->cc_mod.rtcc.bw_bytes_at_last_rttc = net->cc_mod.rtcc.bw_bytes; in cc_bw_limit()
629 if (net->rtt) { in cc_bw_limit()
630 div = net->rtt / 1000; in cc_bw_limit()
642 inst_ind = net->cc_mod.rtcc.last_inst_ind; in cc_bw_limit()
643 inst_bw = bytes_for_this_rtt / (uint64_t)(net->rtt); in cc_bw_limit()
648 inst_ind = net->cc_mod.rtcc.last_inst_ind; in cc_bw_limit()
653 SDT_PROBE5(sctp, cwnd, net, rttvar, in cc_bw_limit()
656 ((net->cc_mod.rtcc.lbw_rtt << 32) | rtt), in cc_bw_limit()
657 net->flight_size, in cc_bw_limit()
661 inst_ind = net->cc_mod.rtcc.last_inst_ind; in cc_bw_limit()
663 bw_offset = net->cc_mod.rtcc.lbw >> bw_shift; in cc_bw_limit()
664 if (nbw > net->cc_mod.rtcc.lbw + bw_offset) { in cc_bw_limit()
665 ret = cc_bw_increase(stcb, net, nbw, vtag); in cc_bw_limit()
668 rtt_offset = net->cc_mod.rtcc.lbw_rtt >> SCTP_BASE_SYSCTL(sctp_rttvar_rtt); in cc_bw_limit()
669 if (nbw < net->cc_mod.rtcc.lbw - bw_offset) { in cc_bw_limit()
670 ret = cc_bw_decrease(stcb, net, nbw, rtt_offset, vtag, inst_ind); in cc_bw_limit()
677 ret = cc_bw_same(stcb, net, nbw, rtt_offset, vtag, inst_ind); in cc_bw_limit()
679 net->cc_mod.rtcc.last_inst_ind = inst_ind; in cc_bw_limit()
688 struct sctp_nets *net; in sctp_cwnd_update_after_sack_common() local
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()
709 t_cwnd += net->cwnd; in sctp_cwnd_update_after_sack_common()
711 srtt = net->lastsa; in sctp_cwnd_update_after_sack_common()
715 t_ucwnd_sbw += (uint64_t)net->cwnd / (uint64_t)srtt; in sctp_cwnd_update_after_sack_common()
716 t_path_mptcp += (((uint64_t)net->cwnd) << SHIFT_MPTCP_MULTI_Z) / in sctp_cwnd_update_after_sack_common()
717 (((uint64_t)net->mtu) * (uint64_t)srtt); in sctp_cwnd_update_after_sack_common()
718 tmp = (((uint64_t)net->cwnd) << SHIFT_MPTCP_MULTI_N) / in sctp_cwnd_update_after_sack_common()
719 ((uint64_t)net->mtu * (uint64_t)(srtt * srtt)); in sctp_cwnd_update_after_sack_common()
740 TAILQ_FOREACH(net, &asoc->nets, sctp_next) { in sctp_cwnd_update_after_sack_common()
746 if (net->fast_retran_loss_recovery && net->new_pseudo_cumack) { in sctp_cwnd_update_after_sack_common()
747 if (SCTP_TSN_GE(asoc->last_acked_seq, net->fast_recovery_tsn) || in sctp_cwnd_update_after_sack_common()
748 SCTP_TSN_GE(net->pseudo_cumack, net->fast_recovery_tsn)) { in sctp_cwnd_update_after_sack_common()
749 net->will_exit_fast_recovery = 1; in sctp_cwnd_update_after_sack_common()
754 if (net->net_ack == 0) { in sctp_cwnd_update_after_sack_common()
756 sctp_log_cwnd(stcb, net, 0, SCTP_CWND_LOG_FROM_SACK); in sctp_cwnd_update_after_sack_common()
784 if (use_rtcc && (net->cc_mod.rtcc.tls_needs_set > 0)) { in sctp_cwnd_update_after_sack_common()
794 if ((net->cc_mod.rtcc.new_tot_time / 1000) > 0) { in sctp_cwnd_update_after_sack_common()
795 nbw = net->cc_mod.rtcc.bw_bytes / (net->cc_mod.rtcc.new_tot_time / 1000); in sctp_cwnd_update_after_sack_common()
797 nbw = net->cc_mod.rtcc.bw_bytes; in sctp_cwnd_update_after_sack_common()
799 if (net->cc_mod.rtcc.lbw) { in sctp_cwnd_update_after_sack_common()
800 if (cc_bw_limit(stcb, net, nbw)) { in sctp_cwnd_update_after_sack_common()
807 probepoint = (((uint64_t)net->cwnd) << 32); in sctp_cwnd_update_after_sack_common()
809 vtag = (net->rtt << 32) | in sctp_cwnd_update_after_sack_common()
813 SDT_PROBE5(sctp, cwnd, net, rttvar, in sctp_cwnd_update_after_sack_common()
816 ((net->cc_mod.rtcc.lbw_rtt << 32) | net->rtt), in sctp_cwnd_update_after_sack_common()
817 net->flight_size, in sctp_cwnd_update_after_sack_common()
819 net->cc_mod.rtcc.lbw = nbw; in sctp_cwnd_update_after_sack_common()
820 net->cc_mod.rtcc.lbw_rtt = net->rtt; in sctp_cwnd_update_after_sack_common()
821 if (net->cc_mod.rtcc.rtt_set_this_sack) { in sctp_cwnd_update_after_sack_common()
822 net->cc_mod.rtcc.rtt_set_this_sack = 0; in sctp_cwnd_update_after_sack_common()
823 net->cc_mod.rtcc.bw_bytes_at_last_rttc = net->cc_mod.rtcc.bw_bytes; in sctp_cwnd_update_after_sack_common()
832 ((asoc->sctp_cmt_on_off > 0) && net->new_pseudo_cumack)) { in sctp_cwnd_update_after_sack_common()
834 if (net->cwnd <= net->ssthresh) { in sctp_cwnd_update_after_sack_common()
836 if (net->flight_size + net->net_ack >= net->cwnd) { in sctp_cwnd_update_after_sack_common()
839 old_cwnd = net->cwnd; in sctp_cwnd_update_after_sack_common()
842 limit = (uint32_t)(((uint64_t)net->mtu * in sctp_cwnd_update_after_sack_common()
844 (uint64_t)net->ssthresh) / in sctp_cwnd_update_after_sack_common()
846 incr = (uint32_t)(((uint64_t)net->net_ack * in sctp_cwnd_update_after_sack_common()
847 (uint64_t)net->ssthresh) / in sctp_cwnd_update_after_sack_common()
861 srtt = net->lastsa; in sctp_cwnd_update_after_sack_common()
865 limit = (uint32_t)(((uint64_t)net->mtu * in sctp_cwnd_update_after_sack_common()
867 (uint64_t)net->cwnd) / in sctp_cwnd_update_after_sack_common()
870 incr = (uint32_t)(((uint64_t)net->net_ack * in sctp_cwnd_update_after_sack_common()
871 (uint64_t)net->cwnd) / in sctp_cwnd_update_after_sack_common()
882 limit = (uint32_t)(((uint64_t)net->mtu * in sctp_cwnd_update_after_sack_common()
886 incr = (uint32_t)(((uint64_t)net->net_ack * in sctp_cwnd_update_after_sack_common()
892 if (incr > net->net_ack) { in sctp_cwnd_update_after_sack_common()
893 incr = net->net_ack; in sctp_cwnd_update_after_sack_common()
895 if (incr > net->mtu) { in sctp_cwnd_update_after_sack_common()
896 incr = net->mtu; in sctp_cwnd_update_after_sack_common()
900 incr = net->net_ack; in sctp_cwnd_update_after_sack_common()
901 if (incr > net->mtu * SCTP_BASE_SYSCTL(sctp_L2_abc_variable)) { in sctp_cwnd_update_after_sack_common()
902 incr = net->mtu * SCTP_BASE_SYSCTL(sctp_L2_abc_variable); in sctp_cwnd_update_after_sack_common()
906 net->cwnd += incr; in sctp_cwnd_update_after_sack_common()
907 sctp_enforce_cwnd_limit(asoc, net); in sctp_cwnd_update_after_sack_common()
909 sctp_log_cwnd(stcb, net, incr, in sctp_cwnd_update_after_sack_common()
912 SDT_PROBE5(sctp, cwnd, net, ack, in sctp_cwnd_update_after_sack_common()
915 net, in sctp_cwnd_update_after_sack_common()
916 old_cwnd, net->cwnd); in sctp_cwnd_update_after_sack_common()
919 sctp_log_cwnd(stcb, net, net->net_ack, in sctp_cwnd_update_after_sack_common()
928 net->partial_bytes_acked += net->net_ack; in sctp_cwnd_update_after_sack_common()
930 if ((net->flight_size + net->net_ack >= net->cwnd) && in sctp_cwnd_update_after_sack_common()
931 (net->partial_bytes_acked >= net->cwnd)) { in sctp_cwnd_update_after_sack_common()
932 net->partial_bytes_acked -= net->cwnd; in sctp_cwnd_update_after_sack_common()
933 old_cwnd = net->cwnd; in sctp_cwnd_update_after_sack_common()
936 incr = (uint32_t)(((uint64_t)net->mtu * in sctp_cwnd_update_after_sack_common()
937 (uint64_t)net->ssthresh) / in sctp_cwnd_update_after_sack_common()
948 srtt = net->lastsa; in sctp_cwnd_update_after_sack_common()
952 incr = (uint32_t)((uint64_t)net->mtu * in sctp_cwnd_update_after_sack_common()
953 (uint64_t)net->cwnd / in sctp_cwnd_update_after_sack_common()
963 (uint64_t)net->cwnd) >> in sctp_cwnd_update_after_sack_common()
965 if (incr > net->mtu) { in sctp_cwnd_update_after_sack_common()
966 incr = net->mtu; in sctp_cwnd_update_after_sack_common()
970 incr = net->mtu; in sctp_cwnd_update_after_sack_common()
973 net->cwnd += incr; in sctp_cwnd_update_after_sack_common()
974 sctp_enforce_cwnd_limit(asoc, net); in sctp_cwnd_update_after_sack_common()
975 SDT_PROBE5(sctp, cwnd, net, ack, in sctp_cwnd_update_after_sack_common()
978 net, in sctp_cwnd_update_after_sack_common()
979 old_cwnd, net->cwnd); in sctp_cwnd_update_after_sack_common()
981 sctp_log_cwnd(stcb, net, net->mtu, in sctp_cwnd_update_after_sack_common()
986 sctp_log_cwnd(stcb, net, net->net_ack, in sctp_cwnd_update_after_sack_common()
993 sctp_log_cwnd(stcb, net, net->mtu, in sctp_cwnd_update_after_sack_common()
1001 sctp_cwnd_update_exit_pf_common(struct sctp_tcb *stcb, struct sctp_nets *net) in sctp_cwnd_update_exit_pf_common() argument
1005 old_cwnd = net->cwnd; in sctp_cwnd_update_exit_pf_common()
1006 net->cwnd = net->mtu; in sctp_cwnd_update_exit_pf_common()
1007 SDT_PROBE5(sctp, cwnd, net, ack, in sctp_cwnd_update_exit_pf_common()
1008 stcb->asoc.my_vtag, ((stcb->sctp_ep->sctp_lport << 16) | (stcb->rport)), net, in sctp_cwnd_update_exit_pf_common()
1009 old_cwnd, net->cwnd); in sctp_cwnd_update_exit_pf_common()
1011 (void *)net, net->cwnd); in sctp_cwnd_update_exit_pf_common()
1016 sctp_cwnd_update_after_timeout(struct sctp_tcb *stcb, struct sctp_nets *net) in sctp_cwnd_update_after_timeout() argument
1018 int old_cwnd = net->cwnd; in sctp_cwnd_update_after_timeout()
1047 net->ssthresh = (uint32_t)(((uint64_t)4 * in sctp_cwnd_update_after_timeout()
1048 (uint64_t)net->mtu * in sctp_cwnd_update_after_timeout()
1049 (uint64_t)net->ssthresh) / in sctp_cwnd_update_after_timeout()
1054 srtt = net->lastsa; in sctp_cwnd_update_after_timeout()
1061 net->ssthresh = (uint32_t)((uint64_t)t_cwnd - cc_delta); in sctp_cwnd_update_after_timeout()
1063 net->ssthresh = net->mtu; in sctp_cwnd_update_after_timeout()
1066 if ((net->cwnd > t_cwnd / 2) && in sctp_cwnd_update_after_timeout()
1067 (net->ssthresh < net->cwnd - t_cwnd / 2)) { in sctp_cwnd_update_after_timeout()
1068 net->ssthresh = net->cwnd - t_cwnd / 2; in sctp_cwnd_update_after_timeout()
1070 if (net->ssthresh < net->mtu) { in sctp_cwnd_update_after_timeout()
1071 net->ssthresh = net->mtu; in sctp_cwnd_update_after_timeout()
1074 net->ssthresh = max(net->cwnd / 2, 4 * net->mtu); in sctp_cwnd_update_after_timeout()
1076 net->cwnd = net->mtu; in sctp_cwnd_update_after_timeout()
1077 net->partial_bytes_acked = 0; in sctp_cwnd_update_after_timeout()
1078 SDT_PROBE5(sctp, cwnd, net, to, in sctp_cwnd_update_after_timeout()
1081 net, in sctp_cwnd_update_after_timeout()
1082 old_cwnd, net->cwnd); in sctp_cwnd_update_after_timeout()
1084 sctp_log_cwnd(stcb, net, net->cwnd - old_cwnd, SCTP_CWND_LOG_FROM_RTX); in sctp_cwnd_update_after_timeout()
1089 sctp_cwnd_update_after_ecn_echo_common(struct sctp_tcb *stcb, struct sctp_nets *net, in sctp_cwnd_update_after_ecn_echo_common() argument
1092 int old_cwnd = net->cwnd; in sctp_cwnd_update_after_ecn_echo_common()
1094 if ((use_rtcc) && (net->lan_type == SCTP_LAN_LOCAL) && (net->cc_mod.rtcc.use_dccc_ecn)) { in sctp_cwnd_update_after_ecn_echo_common()
1101 if (net->ecn_prev_cwnd < net->cwnd) { in sctp_cwnd_update_after_ecn_echo_common()
1103 net->cwnd = net->ecn_prev_cwnd - (net->mtu * num_pkt_lost); in sctp_cwnd_update_after_ecn_echo_common()
1106 net->cwnd /= 2; in sctp_cwnd_update_after_ecn_echo_common()
1109 net->ssthresh = net->cwnd - (num_pkt_lost * net->mtu); in sctp_cwnd_update_after_ecn_echo_common()
1111 sctp_log_cwnd(stcb, net, (net->cwnd - old_cwnd), SCTP_CWND_LOG_FROM_SAT); in sctp_cwnd_update_after_ecn_echo_common()
1118 net->ssthresh -= (net->mtu * num_pkt_lost); in sctp_cwnd_update_after_ecn_echo_common()
1119 net->cwnd -= (net->mtu * num_pkt_lost); in sctp_cwnd_update_after_ecn_echo_common()
1121 sctp_log_cwnd(stcb, net, (net->cwnd - old_cwnd), SCTP_CWND_LOG_FROM_SAT); in sctp_cwnd_update_after_ecn_echo_common()
1129 net->ssthresh = net->cwnd / 2; in sctp_cwnd_update_after_ecn_echo_common()
1130 if (net->ssthresh < net->mtu) { in sctp_cwnd_update_after_ecn_echo_common()
1131 net->ssthresh = net->mtu; in sctp_cwnd_update_after_ecn_echo_common()
1136 net->RTO <<= 1; in sctp_cwnd_update_after_ecn_echo_common()
1138 net->cwnd = net->ssthresh; in sctp_cwnd_update_after_ecn_echo_common()
1139 SDT_PROBE5(sctp, cwnd, net, ecn, in sctp_cwnd_update_after_ecn_echo_common()
1142 net, in sctp_cwnd_update_after_ecn_echo_common()
1143 old_cwnd, net->cwnd); in sctp_cwnd_update_after_ecn_echo_common()
1145 sctp_log_cwnd(stcb, net, (net->cwnd - old_cwnd), SCTP_CWND_LOG_FROM_SAT); in sctp_cwnd_update_after_ecn_echo_common()
1154 struct sctp_nets *net, struct sctp_pktdrop_chunk *cp, in sctp_cwnd_update_after_packet_dropped() argument
1159 int old_cwnd = net->cwnd; in sctp_cwnd_update_after_packet_dropped()
1169 if (*on_queue < net->flight_size) { in sctp_cwnd_update_after_packet_dropped()
1170 *on_queue = net->flight_size; in sctp_cwnd_update_after_packet_dropped()
1173 bw_avail = (uint32_t)(((uint64_t)(*bottle_bw) * net->rtt) / (uint64_t)1000000); in sctp_cwnd_update_after_packet_dropped()
1192 net->partial_bytes_acked = 0; in sctp_cwnd_update_after_packet_dropped()
1200 net->cwnd = net->prev_cwnd; in sctp_cwnd_update_after_packet_dropped()
1203 seg_inflight = net->flight_size / net->mtu; in sctp_cwnd_update_after_packet_dropped()
1204 seg_onqueue = *on_queue / net->mtu; in sctp_cwnd_update_after_packet_dropped()
1208 if (net->cwnd > net->flight_size) { in sctp_cwnd_update_after_packet_dropped()
1216 diff_adj = net->cwnd - net->flight_size; in sctp_cwnd_update_after_packet_dropped()
1227 net->cwnd -= my_portion; in sctp_cwnd_update_after_packet_dropped()
1230 if (net->cwnd <= net->mtu) { in sctp_cwnd_update_after_packet_dropped()
1231 net->cwnd = net->mtu; in sctp_cwnd_update_after_packet_dropped()
1234 net->ssthresh = net->cwnd - 1; in sctp_cwnd_update_after_packet_dropped()
1242 (stcb->asoc.max_burst * net->mtu < incr)) { in sctp_cwnd_update_after_packet_dropped()
1243 incr = stcb->asoc.max_burst * net->mtu; in sctp_cwnd_update_after_packet_dropped()
1245 net->cwnd += incr; in sctp_cwnd_update_after_packet_dropped()
1247 if (net->cwnd > bw_avail) { in sctp_cwnd_update_after_packet_dropped()
1249 net->cwnd = bw_avail; in sctp_cwnd_update_after_packet_dropped()
1251 if (net->cwnd < net->mtu) { in sctp_cwnd_update_after_packet_dropped()
1253 net->cwnd = net->mtu; in sctp_cwnd_update_after_packet_dropped()
1255 sctp_enforce_cwnd_limit(&stcb->asoc, net); in sctp_cwnd_update_after_packet_dropped()
1256 if (net->cwnd - old_cwnd != 0) { in sctp_cwnd_update_after_packet_dropped()
1258 SDT_PROBE5(sctp, cwnd, net, pd, in sctp_cwnd_update_after_packet_dropped()
1261 net, in sctp_cwnd_update_after_packet_dropped()
1262 old_cwnd, net->cwnd); in sctp_cwnd_update_after_packet_dropped()
1264 sctp_log_cwnd(stcb, net, (net->cwnd - old_cwnd), in sctp_cwnd_update_after_packet_dropped()
1272 struct sctp_nets *net, int burst_limit) in sctp_cwnd_update_after_output() argument
1274 int old_cwnd = net->cwnd; in sctp_cwnd_update_after_output()
1276 if (net->ssthresh < net->cwnd) in sctp_cwnd_update_after_output()
1277 net->ssthresh = net->cwnd; in sctp_cwnd_update_after_output()
1279 net->cwnd = (net->flight_size + (burst_limit * net->mtu)); in sctp_cwnd_update_after_output()
1280 sctp_enforce_cwnd_limit(&stcb->asoc, net); in sctp_cwnd_update_after_output()
1281 SDT_PROBE5(sctp, cwnd, net, bl, in sctp_cwnd_update_after_output()
1284 net, in sctp_cwnd_update_after_output()
1285 old_cwnd, net->cwnd); in sctp_cwnd_update_after_output()
1287 sctp_log_cwnd(stcb, net, (net->cwnd - old_cwnd), SCTP_CWND_LOG_FROM_BRST); in sctp_cwnd_update_after_output()
1302 sctp_cwnd_update_after_ecn_echo(struct sctp_tcb *stcb, struct sctp_nets *net, in sctp_cwnd_update_after_ecn_echo() argument
1306 sctp_cwnd_update_after_ecn_echo_common(stcb, net, in_window, num_pkt_lost, 0); in sctp_cwnd_update_after_ecn_echo()
1315 sctp_cwnd_update_rtcc_after_ecn_echo(struct sctp_tcb *stcb, struct sctp_nets *net, in sctp_cwnd_update_rtcc_after_ecn_echo() argument
1318 sctp_cwnd_update_after_ecn_echo_common(stcb, net, in_window, num_pkt_lost, 1); in sctp_cwnd_update_rtcc_after_ecn_echo()
1324 sctp_cwnd_update_rtcc_tsn_acknowledged(struct sctp_nets *net, in sctp_cwnd_update_rtcc_tsn_acknowledged() argument
1327 net->cc_mod.rtcc.bw_bytes += tp1->send_size; in sctp_cwnd_update_rtcc_tsn_acknowledged()
1332 struct sctp_nets *net) in sctp_cwnd_prepare_rtcc_net_for_sack() argument
1334 if (net->cc_mod.rtcc.tls_needs_set > 0) { in sctp_cwnd_prepare_rtcc_net_for_sack()
1339 timevalsub(<ls, &net->cc_mod.rtcc.tls); in sctp_cwnd_prepare_rtcc_net_for_sack()
1340 net->cc_mod.rtcc.new_tot_time = (ltls.tv_sec * 1000000) + ltls.tv_usec; in sctp_cwnd_prepare_rtcc_net_for_sack()
1346 struct sctp_nets *net) in sctp_cwnd_new_rtcc_transmission_begins() argument
1350 if (net->cc_mod.rtcc.lbw) { in sctp_cwnd_new_rtcc_transmission_begins()
1352 vtag = (net->rtt << 32) | (((uint32_t)(stcb->sctp_ep->sctp_lport)) << 16) | in sctp_cwnd_new_rtcc_transmission_begins()
1354 probepoint = (((uint64_t)net->cwnd) << 32); in sctp_cwnd_new_rtcc_transmission_begins()
1357 SDT_PROBE5(sctp, cwnd, net, rttvar, in sctp_cwnd_new_rtcc_transmission_begins()
1359 ((net->cc_mod.rtcc.lbw << 32) | 0), in sctp_cwnd_new_rtcc_transmission_begins()
1360 ((net->cc_mod.rtcc.lbw_rtt << 32) | net->rtt), in sctp_cwnd_new_rtcc_transmission_begins()
1361 net->flight_size, in sctp_cwnd_new_rtcc_transmission_begins()
1363 net->cc_mod.rtcc.lbw_rtt = 0; in sctp_cwnd_new_rtcc_transmission_begins()
1364 net->cc_mod.rtcc.cwnd_at_bw_set = 0; in sctp_cwnd_new_rtcc_transmission_begins()
1365 net->cc_mod.rtcc.lbw = 0; in sctp_cwnd_new_rtcc_transmission_begins()
1366 net->cc_mod.rtcc.bw_bytes_at_last_rttc = 0; in sctp_cwnd_new_rtcc_transmission_begins()
1367 net->cc_mod.rtcc.vol_reduce = 0; in sctp_cwnd_new_rtcc_transmission_begins()
1368 net->cc_mod.rtcc.bw_tot_time = 0; in sctp_cwnd_new_rtcc_transmission_begins()
1369 net->cc_mod.rtcc.bw_bytes = 0; in sctp_cwnd_new_rtcc_transmission_begins()
1370 net->cc_mod.rtcc.tls_needs_set = 0; in sctp_cwnd_new_rtcc_transmission_begins()
1371 if (net->cc_mod.rtcc.steady_step) { in sctp_cwnd_new_rtcc_transmission_begins()
1372 net->cc_mod.rtcc.vol_reduce = 0; in sctp_cwnd_new_rtcc_transmission_begins()
1373 net->cc_mod.rtcc.step_cnt = 0; in sctp_cwnd_new_rtcc_transmission_begins()
1374 net->cc_mod.rtcc.last_step_state = 0; in sctp_cwnd_new_rtcc_transmission_begins()
1376 if (net->cc_mod.rtcc.ret_from_eq) { in sctp_cwnd_new_rtcc_transmission_begins()
1386 cwnd = min((net->mtu * 4), max((2 * net->mtu), SCTP_INITIAL_CWND)); in sctp_cwnd_new_rtcc_transmission_begins()
1394 cwnd = (net->mtu - sizeof(struct sctphdr)) * cwnd_in_mtu; in sctp_cwnd_new_rtcc_transmission_begins()
1396 if (net->cwnd > cwnd) { in sctp_cwnd_new_rtcc_transmission_begins()
1401 net->cwnd = cwnd; in sctp_cwnd_new_rtcc_transmission_begins()
1409 struct sctp_nets *net) in sctp_set_rtcc_initial_cc_param() argument
1413 sctp_set_initial_cc_param(stcb, net); in sctp_set_rtcc_initial_cc_param()
1415 probepoint = (((uint64_t)net->cwnd) << 32); in sctp_set_rtcc_initial_cc_param()
1417 vtag = (net->rtt << 32) | in sctp_set_rtcc_initial_cc_param()
1420 SDT_PROBE5(sctp, cwnd, net, rttvar, in sctp_set_rtcc_initial_cc_param()
1426 net->cc_mod.rtcc.lbw_rtt = 0; in sctp_set_rtcc_initial_cc_param()
1427 net->cc_mod.rtcc.cwnd_at_bw_set = 0; in sctp_set_rtcc_initial_cc_param()
1428 net->cc_mod.rtcc.vol_reduce = 0; in sctp_set_rtcc_initial_cc_param()
1429 net->cc_mod.rtcc.lbw = 0; in sctp_set_rtcc_initial_cc_param()
1430 net->cc_mod.rtcc.vol_reduce = 0; in sctp_set_rtcc_initial_cc_param()
1431 net->cc_mod.rtcc.bw_bytes_at_last_rttc = 0; in sctp_set_rtcc_initial_cc_param()
1432 net->cc_mod.rtcc.bw_tot_time = 0; in sctp_set_rtcc_initial_cc_param()
1433 net->cc_mod.rtcc.bw_bytes = 0; in sctp_set_rtcc_initial_cc_param()
1434 net->cc_mod.rtcc.tls_needs_set = 0; in sctp_set_rtcc_initial_cc_param()
1435 net->cc_mod.rtcc.ret_from_eq = SCTP_BASE_SYSCTL(sctp_rttvar_eqret); in sctp_set_rtcc_initial_cc_param()
1436 net->cc_mod.rtcc.steady_step = SCTP_BASE_SYSCTL(sctp_steady_step); in sctp_set_rtcc_initial_cc_param()
1437 net->cc_mod.rtcc.use_dccc_ecn = SCTP_BASE_SYSCTL(sctp_use_dccc_ecn); in sctp_set_rtcc_initial_cc_param()
1438 net->cc_mod.rtcc.step_cnt = 0; in sctp_set_rtcc_initial_cc_param()
1439 net->cc_mod.rtcc.last_step_state = 0; in sctp_set_rtcc_initial_cc_param()
1448 struct sctp_nets *net; in sctp_cwnd_rtcc_socket_option() local
1457 TAILQ_FOREACH(net, &stcb->asoc.nets, sctp_next) { in sctp_cwnd_rtcc_socket_option()
1458 net->cc_mod.rtcc.ret_from_eq = cc_opt->aid_value.assoc_value; in sctp_cwnd_rtcc_socket_option()
1465 TAILQ_FOREACH(net, &stcb->asoc.nets, sctp_next) { in sctp_cwnd_rtcc_socket_option()
1466 net->cc_mod.rtcc.use_dccc_ecn = cc_opt->aid_value.assoc_value; in sctp_cwnd_rtcc_socket_option()
1469 TAILQ_FOREACH(net, &stcb->asoc.nets, sctp_next) { in sctp_cwnd_rtcc_socket_option()
1470 net->cc_mod.rtcc.steady_step = cc_opt->aid_value.assoc_value; in sctp_cwnd_rtcc_socket_option()
1478 net = TAILQ_FIRST(&stcb->asoc.nets); in sctp_cwnd_rtcc_socket_option()
1479 if (net == NULL) { in sctp_cwnd_rtcc_socket_option()
1482 cc_opt->aid_value.assoc_value = net->cc_mod.rtcc.ret_from_eq; in sctp_cwnd_rtcc_socket_option()
1484 net = TAILQ_FIRST(&stcb->asoc.nets); in sctp_cwnd_rtcc_socket_option()
1485 if (net == NULL) { in sctp_cwnd_rtcc_socket_option()
1488 cc_opt->aid_value.assoc_value = net->cc_mod.rtcc.use_dccc_ecn; in sctp_cwnd_rtcc_socket_option()
1490 net = TAILQ_FIRST(&stcb->asoc.nets); in sctp_cwnd_rtcc_socket_option()
1491 if (net == NULL) { in sctp_cwnd_rtcc_socket_option()
1494 cc_opt->aid_value.assoc_value = net->cc_mod.rtcc.steady_step; in sctp_cwnd_rtcc_socket_option()
1504 struct sctp_nets *net) in sctp_cwnd_update_rtcc_packet_transmitted() argument
1506 if (net->cc_mod.rtcc.tls_needs_set == 0) { in sctp_cwnd_update_rtcc_packet_transmitted()
1507 SCTP_GETPTIME_TIMEVAL(&net->cc_mod.rtcc.tls); in sctp_cwnd_update_rtcc_packet_transmitted()
1508 net->cc_mod.rtcc.tls_needs_set = 2; in sctp_cwnd_update_rtcc_packet_transmitted()
1523 struct sctp_nets *net, in sctp_rtt_rtcc_calculated() argument
1526 net->cc_mod.rtcc.rtt_set_this_sack = 1; in sctp_rtt_rtcc_calculated()
1616 sctp_hs_cwnd_increase(struct sctp_tcb *stcb, struct sctp_nets *net) in sctp_hs_cwnd_increase() argument
1619 int old_cwnd = net->cwnd; in sctp_hs_cwnd_increase()
1621 cur_val = net->cwnd >> 10; in sctp_hs_cwnd_increase()
1626 if (net->net_ack > net->mtu) { in sctp_hs_cwnd_increase()
1627 net->cwnd += net->mtu; in sctp_hs_cwnd_increase()
1629 net->cwnd += net->net_ack; in sctp_hs_cwnd_increase()
1632 for (i = net->last_hs_used; i < SCTP_HS_TABLE_SIZE; i++) { in sctp_hs_cwnd_increase()
1638 net->last_hs_used = indx; in sctp_hs_cwnd_increase()
1640 net->cwnd += incr; in sctp_hs_cwnd_increase()
1642 sctp_enforce_cwnd_limit(&stcb->asoc, net); in sctp_hs_cwnd_increase()
1644 sctp_log_cwnd(stcb, net, (net->cwnd - old_cwnd), SCTP_CWND_LOG_FROM_SS); in sctp_hs_cwnd_increase()
1649 sctp_hs_cwnd_decrease(struct sctp_tcb *stcb, struct sctp_nets *net) in sctp_hs_cwnd_decrease() argument
1652 int old_cwnd = net->cwnd; in sctp_hs_cwnd_decrease()
1654 cur_val = net->cwnd >> 10; in sctp_hs_cwnd_decrease()
1657 net->ssthresh = net->cwnd / 2; in sctp_hs_cwnd_decrease()
1658 if (net->ssthresh < (net->mtu * 2)) { in sctp_hs_cwnd_decrease()
1659 net->ssthresh = 2 * net->mtu; in sctp_hs_cwnd_decrease()
1661 net->cwnd = net->ssthresh; in sctp_hs_cwnd_decrease()
1664 net->ssthresh = net->cwnd - (int)((net->cwnd / 100) * in sctp_hs_cwnd_decrease()
1665 (int32_t)sctp_cwnd_adjust[net->last_hs_used].drop_percent); in sctp_hs_cwnd_decrease()
1666 net->cwnd = net->ssthresh; in sctp_hs_cwnd_decrease()
1668 indx = net->last_hs_used; in sctp_hs_cwnd_decrease()
1669 cur_val = net->cwnd >> 10; in sctp_hs_cwnd_decrease()
1673 net->last_hs_used = 0; in sctp_hs_cwnd_decrease()
1680 net->last_hs_used = indx; in sctp_hs_cwnd_decrease()
1683 sctp_enforce_cwnd_limit(&stcb->asoc, net); in sctp_hs_cwnd_decrease()
1685 sctp_log_cwnd(stcb, net, (net->cwnd - old_cwnd), SCTP_CWND_LOG_FROM_FR); in sctp_hs_cwnd_decrease()
1693 struct sctp_nets *net; in sctp_hs_cwnd_update_after_fr() local
1699 TAILQ_FOREACH(net, &asoc->nets, sctp_next) { in sctp_hs_cwnd_update_after_fr()
1703 if (net->net_ack > 0) { in sctp_hs_cwnd_update_after_fr()
1712 sctp_hs_cwnd_decrease(stcb, net); in sctp_hs_cwnd_update_after_fr()
1716 net->partial_bytes_acked = 0; in sctp_hs_cwnd_update_after_fr()
1730 net->fast_retran_loss_recovery = 1; in sctp_hs_cwnd_update_after_fr()
1734 net->fast_recovery_tsn = asoc->sending_seq - 1; in sctp_hs_cwnd_update_after_fr()
1736 net->fast_recovery_tsn = lchk->rec.data.tsn - 1; in sctp_hs_cwnd_update_after_fr()
1740 stcb->sctp_ep, stcb, net, in sctp_hs_cwnd_update_after_fr()
1743 stcb->sctp_ep, stcb, net); in sctp_hs_cwnd_update_after_fr()
1745 } else if (net->net_ack > 0) { in sctp_hs_cwnd_update_after_fr()
1760 struct sctp_nets *net; in sctp_hs_cwnd_update_after_sack() local
1765 TAILQ_FOREACH(net, &asoc->nets, sctp_next) { in sctp_hs_cwnd_update_after_sack()
1771 if (net->fast_retran_loss_recovery && net->new_pseudo_cumack) { in sctp_hs_cwnd_update_after_sack()
1772 if (SCTP_TSN_GE(asoc->last_acked_seq, net->fast_recovery_tsn) || in sctp_hs_cwnd_update_after_sack()
1773 SCTP_TSN_GE(net->pseudo_cumack, net->fast_recovery_tsn)) { in sctp_hs_cwnd_update_after_sack()
1774 net->will_exit_fast_recovery = 1; in sctp_hs_cwnd_update_after_sack()
1779 if (net->net_ack == 0) { in sctp_hs_cwnd_update_after_sack()
1781 sctp_log_cwnd(stcb, net, 0, SCTP_CWND_LOG_FROM_SACK); in sctp_hs_cwnd_update_after_sack()
1811 ((asoc->sctp_cmt_on_off > 0) && net->new_pseudo_cumack)) { in sctp_hs_cwnd_update_after_sack()
1813 if (net->cwnd <= net->ssthresh) { in sctp_hs_cwnd_update_after_sack()
1815 if (net->flight_size + net->net_ack >= net->cwnd) { in sctp_hs_cwnd_update_after_sack()
1816 sctp_hs_cwnd_increase(stcb, net); in sctp_hs_cwnd_update_after_sack()
1819 sctp_log_cwnd(stcb, net, net->net_ack, in sctp_hs_cwnd_update_after_sack()
1825 net->partial_bytes_acked += net->net_ack; in sctp_hs_cwnd_update_after_sack()
1826 if ((net->flight_size + net->net_ack >= net->cwnd) && in sctp_hs_cwnd_update_after_sack()
1827 (net->partial_bytes_acked >= net->cwnd)) { in sctp_hs_cwnd_update_after_sack()
1828 net->partial_bytes_acked -= net->cwnd; in sctp_hs_cwnd_update_after_sack()
1829 net->cwnd += net->mtu; in sctp_hs_cwnd_update_after_sack()
1830 sctp_enforce_cwnd_limit(asoc, net); in sctp_hs_cwnd_update_after_sack()
1832 sctp_log_cwnd(stcb, net, net->mtu, in sctp_hs_cwnd_update_after_sack()
1837 sctp_log_cwnd(stcb, net, net->net_ack, in sctp_hs_cwnd_update_after_sack()
1844 sctp_log_cwnd(stcb, net, net->mtu, in sctp_hs_cwnd_update_after_sack()
1894 htcp_cwnd_undo(struct sctp_tcb *stcb, struct sctp_nets *net) in htcp_cwnd_undo() argument
1896 net->cc_mod.htcp_ca.last_cong = net->cc_mod.htcp_ca.undo_last_cong; in htcp_cwnd_undo()
1897 net->cc_mod.htcp_ca.maxRTT = net->cc_mod.htcp_ca.undo_maxRTT; in htcp_cwnd_undo()
1898 net->cc_mod.htcp_ca.old_maxB = net->cc_mod.htcp_ca.undo_old_maxB; in htcp_cwnd_undo()
1899 return (max(net->cwnd, ((net->ssthresh / net->mtu << 7) / net->cc_mod.htcp_ca.beta) * net->mtu)); in htcp_cwnd_undo()
1905 measure_rtt(struct sctp_nets *net) in measure_rtt() argument
1907 uint32_t srtt = net->lastsa >> SCTP_RTT_SHIFT; in measure_rtt()
1910 if (net->cc_mod.htcp_ca.minRTT > srtt || !net->cc_mod.htcp_ca.minRTT) in measure_rtt()
1911 net->cc_mod.htcp_ca.minRTT = srtt; in measure_rtt()
1914 if (net->fast_retran_ip == 0 && net->ssthresh < 0xFFFF && htcp_ccount(&net->cc_mod.htcp_ca) > 3) { in measure_rtt()
1915 if (net->cc_mod.htcp_ca.maxRTT < net->cc_mod.htcp_ca.minRTT) in measure_rtt()
1916 net->cc_mod.htcp_ca.maxRTT = net->cc_mod.htcp_ca.minRTT; in measure_rtt()
1917 if (net->cc_mod.htcp_ca.maxRTT < srtt && srtt <= net->cc_mod.htcp_ca.maxRTT + MSEC_TO_TICKS(20)) in measure_rtt()
1918 net->cc_mod.htcp_ca.maxRTT = srtt; in measure_rtt()
1923 measure_achieved_throughput(struct sctp_nets *net) in measure_achieved_throughput() argument
1927 if (net->fast_retran_ip == 0) in measure_achieved_throughput()
1928 net->cc_mod.htcp_ca.bytes_acked = net->net_ack; in measure_achieved_throughput()
1935 if (net->fast_retran_ip == 1) { in measure_achieved_throughput()
1936 net->cc_mod.htcp_ca.bytecount = 0; in measure_achieved_throughput()
1937 net->cc_mod.htcp_ca.lasttime = now; in measure_achieved_throughput()
1941 net->cc_mod.htcp_ca.bytecount += net->net_ack; in measure_achieved_throughput()
1942 …if ((net->cc_mod.htcp_ca.bytecount >= net->cwnd - (((net->cc_mod.htcp_ca.alpha >> 7) ? (net->cc_mo… in measure_achieved_throughput()
1943 (now - net->cc_mod.htcp_ca.lasttime >= net->cc_mod.htcp_ca.minRTT) && in measure_achieved_throughput()
1944 (net->cc_mod.htcp_ca.minRTT > 0)) { in measure_achieved_throughput()
1945 …uint32_t cur_Bi = net->cc_mod.htcp_ca.bytecount / net->mtu * hz / (now - net->cc_mod.htcp_ca.lastt… in measure_achieved_throughput()
1947 if (htcp_ccount(&net->cc_mod.htcp_ca) <= 3) { in measure_achieved_throughput()
1949 net->cc_mod.htcp_ca.minB = net->cc_mod.htcp_ca.maxB = net->cc_mod.htcp_ca.Bi = cur_Bi; in measure_achieved_throughput()
1951 net->cc_mod.htcp_ca.Bi = (3 * net->cc_mod.htcp_ca.Bi + cur_Bi) / 4; in measure_achieved_throughput()
1952 if (net->cc_mod.htcp_ca.Bi > net->cc_mod.htcp_ca.maxB) in measure_achieved_throughput()
1953 net->cc_mod.htcp_ca.maxB = net->cc_mod.htcp_ca.Bi; in measure_achieved_throughput()
1954 if (net->cc_mod.htcp_ca.minB > net->cc_mod.htcp_ca.maxB) in measure_achieved_throughput()
1955 net->cc_mod.htcp_ca.minB = net->cc_mod.htcp_ca.maxB; in measure_achieved_throughput()
1957 net->cc_mod.htcp_ca.bytecount = 0; in measure_achieved_throughput()
1958 net->cc_mod.htcp_ca.lasttime = now; in measure_achieved_throughput()
2026 htcp_param_update(struct sctp_nets *net) in htcp_param_update() argument
2028 uint32_t minRTT = net->cc_mod.htcp_ca.minRTT; in htcp_param_update()
2029 uint32_t maxRTT = net->cc_mod.htcp_ca.maxRTT; in htcp_param_update()
2031 htcp_beta_update(&net->cc_mod.htcp_ca, minRTT, maxRTT); in htcp_param_update()
2032 htcp_alpha_update(&net->cc_mod.htcp_ca); in htcp_param_update()
2039 net->cc_mod.htcp_ca.maxRTT = minRTT + ((maxRTT - minRTT) * 95) / 100; in htcp_param_update()
2043 htcp_recalc_ssthresh(struct sctp_nets *net) in htcp_recalc_ssthresh() argument
2045 htcp_param_update(net); in htcp_recalc_ssthresh()
2046 return (max(((net->cwnd / net->mtu * net->cc_mod.htcp_ca.beta) >> 7) * net->mtu, 2U * net->mtu)); in htcp_recalc_ssthresh()
2050 htcp_cong_avoid(struct sctp_tcb *stcb, struct sctp_nets *net) in htcp_cong_avoid() argument
2057 if (net->cwnd <= net->ssthresh) { in htcp_cong_avoid()
2059 if (net->flight_size + net->net_ack >= net->cwnd) { in htcp_cong_avoid()
2060 if (net->net_ack > (net->mtu * SCTP_BASE_SYSCTL(sctp_L2_abc_variable))) { in htcp_cong_avoid()
2061 net->cwnd += (net->mtu * SCTP_BASE_SYSCTL(sctp_L2_abc_variable)); in htcp_cong_avoid()
2063 sctp_log_cwnd(stcb, net, net->mtu, in htcp_cong_avoid()
2068 net->cwnd += net->net_ack; in htcp_cong_avoid()
2070 sctp_log_cwnd(stcb, net, net->net_ack, in htcp_cong_avoid()
2075 sctp_enforce_cwnd_limit(&stcb->asoc, net); in htcp_cong_avoid()
2078 sctp_log_cwnd(stcb, net, net->net_ack, in htcp_cong_avoid()
2083 measure_rtt(net); in htcp_cong_avoid()
2090 …if (((net->partial_bytes_acked / net->mtu * net->cc_mod.htcp_ca.alpha) >> 7) * net->mtu >= net->cw… in htcp_cong_avoid()
2095 net->cwnd += net->mtu; in htcp_cong_avoid()
2096 net->partial_bytes_acked = 0; in htcp_cong_avoid()
2097 sctp_enforce_cwnd_limit(&stcb->asoc, net); in htcp_cong_avoid()
2098 htcp_alpha_update(&net->cc_mod.htcp_ca); in htcp_cong_avoid()
2100 sctp_log_cwnd(stcb, net, net->mtu, in htcp_cong_avoid()
2104 net->partial_bytes_acked += net->net_ack; in htcp_cong_avoid()
2106 sctp_log_cwnd(stcb, net, net->net_ack, in htcp_cong_avoid()
2111 net->cc_mod.htcp_ca.bytes_acked = net->mtu; in htcp_cong_avoid()
2118 htcp_min_cwnd(struct sctp_tcb *stcb, struct sctp_nets *net) in htcp_min_cwnd() argument
2120 return (net->ssthresh); in htcp_min_cwnd()
2125 htcp_init(struct sctp_nets *net) in htcp_init() argument
2127 memset(&net->cc_mod.htcp_ca, 0, sizeof(struct htcp)); in htcp_init()
2128 net->cc_mod.htcp_ca.alpha = ALPHA_BASE; in htcp_init()
2129 net->cc_mod.htcp_ca.beta = BETA_MIN; in htcp_init()
2130 net->cc_mod.htcp_ca.bytes_acked = net->mtu; in htcp_init()
2131 net->cc_mod.htcp_ca.last_cong = sctp_get_tick_count(); in htcp_init()
2135 sctp_htcp_set_initial_cc_param(struct sctp_tcb *stcb, struct sctp_nets *net) in sctp_htcp_set_initial_cc_param() argument
2141 net->cwnd = min((net->mtu * 4), max((2 * net->mtu), SCTP_INITIAL_CWND)); in sctp_htcp_set_initial_cc_param()
2142 net->ssthresh = stcb->asoc.peers_rwnd; in sctp_htcp_set_initial_cc_param()
2143 sctp_enforce_cwnd_limit(&stcb->asoc, net); in sctp_htcp_set_initial_cc_param()
2144 htcp_init(net); in sctp_htcp_set_initial_cc_param()
2147 sctp_log_cwnd(stcb, net, 0, SCTP_CWND_INITIALIZATION); in sctp_htcp_set_initial_cc_param()
2156 struct sctp_nets *net; in sctp_htcp_cwnd_update_after_sack() local
2161 TAILQ_FOREACH(net, &asoc->nets, sctp_next) { in sctp_htcp_cwnd_update_after_sack()
2167 if (net->fast_retran_loss_recovery && net->new_pseudo_cumack) { in sctp_htcp_cwnd_update_after_sack()
2168 if (SCTP_TSN_GE(asoc->last_acked_seq, net->fast_recovery_tsn) || in sctp_htcp_cwnd_update_after_sack()
2169 SCTP_TSN_GE(net->pseudo_cumack, net->fast_recovery_tsn)) { in sctp_htcp_cwnd_update_after_sack()
2170 net->will_exit_fast_recovery = 1; in sctp_htcp_cwnd_update_after_sack()
2175 if (net->net_ack == 0) { in sctp_htcp_cwnd_update_after_sack()
2177 sctp_log_cwnd(stcb, net, 0, SCTP_CWND_LOG_FROM_SACK); in sctp_htcp_cwnd_update_after_sack()
2207 ((asoc->sctp_cmt_on_off > 0) && net->new_pseudo_cumack)) { in sctp_htcp_cwnd_update_after_sack()
2208 htcp_cong_avoid(stcb, net); in sctp_htcp_cwnd_update_after_sack()
2209 measure_achieved_throughput(net); in sctp_htcp_cwnd_update_after_sack()
2212 sctp_log_cwnd(stcb, net, net->mtu, in sctp_htcp_cwnd_update_after_sack()
2223 struct sctp_nets *net; in sctp_htcp_cwnd_update_after_fr() local
2229 TAILQ_FOREACH(net, &asoc->nets, sctp_next) { in sctp_htcp_cwnd_update_after_fr()
2233 if (net->net_ack > 0) { in sctp_htcp_cwnd_update_after_fr()
2241 int old_cwnd = net->cwnd; in sctp_htcp_cwnd_update_after_fr()
2244 htcp_reset(&net->cc_mod.htcp_ca); in sctp_htcp_cwnd_update_after_fr()
2245 net->ssthresh = htcp_recalc_ssthresh(net); in sctp_htcp_cwnd_update_after_fr()
2246 net->cwnd = net->ssthresh; in sctp_htcp_cwnd_update_after_fr()
2247 sctp_enforce_cwnd_limit(asoc, net); in sctp_htcp_cwnd_update_after_fr()
2249 sctp_log_cwnd(stcb, net, (net->cwnd - old_cwnd), in sctp_htcp_cwnd_update_after_fr()
2254 net->partial_bytes_acked = 0; in sctp_htcp_cwnd_update_after_fr()
2268 net->fast_retran_loss_recovery = 1; in sctp_htcp_cwnd_update_after_fr()
2272 net->fast_recovery_tsn = asoc->sending_seq - 1; in sctp_htcp_cwnd_update_after_fr()
2274 net->fast_recovery_tsn = lchk->rec.data.tsn - 1; in sctp_htcp_cwnd_update_after_fr()
2278 stcb->sctp_ep, stcb, net, in sctp_htcp_cwnd_update_after_fr()
2281 stcb->sctp_ep, stcb, net); in sctp_htcp_cwnd_update_after_fr()
2283 } else if (net->net_ack > 0) { in sctp_htcp_cwnd_update_after_fr()
2295 struct sctp_nets *net) in sctp_htcp_cwnd_update_after_timeout() argument
2297 int old_cwnd = net->cwnd; in sctp_htcp_cwnd_update_after_timeout()
2300 htcp_reset(&net->cc_mod.htcp_ca); in sctp_htcp_cwnd_update_after_timeout()
2301 net->ssthresh = htcp_recalc_ssthresh(net); in sctp_htcp_cwnd_update_after_timeout()
2302 net->cwnd = net->mtu; in sctp_htcp_cwnd_update_after_timeout()
2303 net->partial_bytes_acked = 0; in sctp_htcp_cwnd_update_after_timeout()
2305 sctp_log_cwnd(stcb, net, net->cwnd - old_cwnd, SCTP_CWND_LOG_FROM_RTX); in sctp_htcp_cwnd_update_after_timeout()
2311 struct sctp_nets *net, int in_window, int num_pkt_lost SCTP_UNUSED) in sctp_htcp_cwnd_update_after_ecn_echo() argument
2315 old_cwnd = net->cwnd; in sctp_htcp_cwnd_update_after_ecn_echo()
2319 htcp_reset(&net->cc_mod.htcp_ca); in sctp_htcp_cwnd_update_after_ecn_echo()
2321 net->ssthresh = htcp_recalc_ssthresh(net); in sctp_htcp_cwnd_update_after_ecn_echo()
2322 if (net->ssthresh < net->mtu) { in sctp_htcp_cwnd_update_after_ecn_echo()
2323 net->ssthresh = net->mtu; in sctp_htcp_cwnd_update_after_ecn_echo()
2325 net->RTO <<= 1; in sctp_htcp_cwnd_update_after_ecn_echo()
2327 net->cwnd = net->ssthresh; in sctp_htcp_cwnd_update_after_ecn_echo()
2328 sctp_enforce_cwnd_limit(&stcb->asoc, net); in sctp_htcp_cwnd_update_after_ecn_echo()
2330 sctp_log_cwnd(stcb, net, (net->cwnd - old_cwnd), SCTP_CWND_LOG_FROM_SAT); in sctp_htcp_cwnd_update_after_ecn_echo()