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()
164 srtt = net->lastsa; in sctp_cwnd_update_after_fr()
176 net->ssthresh = (uint32_t)(((uint64_t)4 * in sctp_cwnd_update_after_fr()
177 (uint64_t)net->mtu * in sctp_cwnd_update_after_fr()
178 (uint64_t)net->cwnd) / in sctp_cwnd_update_after_fr()
183 if ((net->cwnd > t_cwnd / 2) && in sctp_cwnd_update_after_fr()
184 (net->ssthresh < 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()
187 if (net->ssthresh < net->mtu) { in sctp_cwnd_update_after_fr()
188 net->ssthresh = net->mtu; in sctp_cwnd_update_after_fr()
191 net->ssthresh = net->cwnd / 2; in sctp_cwnd_update_after_fr()
192 if (net->ssthresh < (net->mtu * 2)) { in sctp_cwnd_update_after_fr()
193 net->ssthresh = 2 * net->mtu; in sctp_cwnd_update_after_fr()
196 net->cwnd = net->ssthresh; in sctp_cwnd_update_after_fr()
197 sctp_enforce_cwnd_limit(asoc, net); in sctp_cwnd_update_after_fr()
198 SDT_PROBE5(sctp, cwnd, net, fr, in sctp_cwnd_update_after_fr()
199 stcb->asoc.my_vtag, ((stcb->sctp_ep->sctp_lport << 16) | (stcb->rport)), net, in sctp_cwnd_update_after_fr()
200 old_cwnd, net->cwnd); in sctp_cwnd_update_after_fr()
202 sctp_log_cwnd(stcb, net, (net->cwnd - old_cwnd), in sctp_cwnd_update_after_fr()
207 net->partial_bytes_acked = 0; in sctp_cwnd_update_after_fr()
221 net->fast_retran_loss_recovery = 1; in sctp_cwnd_update_after_fr()
225 net->fast_recovery_tsn = asoc->sending_seq - 1; in sctp_cwnd_update_after_fr()
227 net->fast_recovery_tsn = lchk->rec.data.tsn - 1; in sctp_cwnd_update_after_fr()
231 stcb->sctp_ep, stcb, net, in sctp_cwnd_update_after_fr()
234 stcb->sctp_ep, stcb, net); in sctp_cwnd_update_after_fr()
236 } else if (net->net_ack > 0) { in sctp_cwnd_update_after_fr()
252 cc_bw_same(struct sctp_tcb *stcb, struct sctp_nets *net, uint64_t nbw, in cc_bw_same() argument
257 probepoint = (((uint64_t)net->cwnd) << 32); in cc_bw_same()
258 if (net->rtt > net->cc_mod.rtcc.lbw_rtt + rtt_offset) { in cc_bw_same()
265 SDT_PROBE5(sctp, cwnd, net, rttvar, in cc_bw_same()
267 ((net->cc_mod.rtcc.lbw << 32) | nbw), in cc_bw_same()
268 ((net->cc_mod.rtcc.lbw_rtt << 32) | net->rtt), in cc_bw_same()
269 net->flight_size, in cc_bw_same()
271 if ((net->cc_mod.rtcc.steady_step) && (inst_ind != SCTP_INST_LOOSING)) { in cc_bw_same()
272 if (net->cc_mod.rtcc.last_step_state == 5) in cc_bw_same()
273 net->cc_mod.rtcc.step_cnt++; in cc_bw_same()
275 net->cc_mod.rtcc.step_cnt = 1; in cc_bw_same()
276 net->cc_mod.rtcc.last_step_state = 5; in cc_bw_same()
277 if ((net->cc_mod.rtcc.step_cnt == net->cc_mod.rtcc.steady_step) || in cc_bw_same()
278 ((net->cc_mod.rtcc.step_cnt > net->cc_mod.rtcc.steady_step) && in cc_bw_same()
279 ((net->cc_mod.rtcc.step_cnt % net->cc_mod.rtcc.steady_step) == 0))) { in cc_bw_same()
281 oth = net->cc_mod.rtcc.vol_reduce; in cc_bw_same()
283 oth |= net->cc_mod.rtcc.step_cnt; in cc_bw_same()
285 oth |= net->cc_mod.rtcc.last_step_state; in cc_bw_same()
286 SDT_PROBE5(sctp, cwnd, net, rttstep, in cc_bw_same()
288 ((net->cc_mod.rtcc.lbw << 32) | nbw), in cc_bw_same()
289 ((net->cc_mod.rtcc.lbw_rtt << 32) | net->rtt), in cc_bw_same()
292 if (net->cwnd > (4 * net->mtu)) { in cc_bw_same()
293 net->cwnd -= net->mtu; in cc_bw_same()
294 net->cc_mod.rtcc.vol_reduce++; in cc_bw_same()
296 net->cc_mod.rtcc.step_cnt = 0; in cc_bw_same()
302 if (net->rtt < net->cc_mod.rtcc.lbw_rtt - rtt_offset) { in cc_bw_same()
310 SDT_PROBE5(sctp, cwnd, net, rttvar, in cc_bw_same()
312 ((net->cc_mod.rtcc.lbw << 32) | nbw), in cc_bw_same()
313 ((net->cc_mod.rtcc.lbw_rtt << 32) | net->rtt), in cc_bw_same()
314 net->flight_size, in cc_bw_same()
316 if (net->cc_mod.rtcc.steady_step) { in cc_bw_same()
317 oth = net->cc_mod.rtcc.vol_reduce; in cc_bw_same()
319 oth |= net->cc_mod.rtcc.step_cnt; in cc_bw_same()
321 oth |= net->cc_mod.rtcc.last_step_state; in cc_bw_same()
322 SDT_PROBE5(sctp, cwnd, net, rttstep, in cc_bw_same()
324 ((net->cc_mod.rtcc.lbw << 32) | nbw), in cc_bw_same()
325 ((net->cc_mod.rtcc.lbw_rtt << 32) | net->rtt), in cc_bw_same()
328 if ((net->cc_mod.rtcc.last_step_state == 5) && in cc_bw_same()
329 (net->cc_mod.rtcc.step_cnt > net->cc_mod.rtcc.steady_step)) { in cc_bw_same()
331 net->cc_mod.rtcc.step_cnt = 0; in cc_bw_same()
334 net->cc_mod.rtcc.last_step_state = 6; in cc_bw_same()
335 net->cc_mod.rtcc.step_cnt = 0; in cc_bw_same()
338 net->cc_mod.rtcc.lbw = nbw; in cc_bw_same()
339 net->cc_mod.rtcc.lbw_rtt = net->rtt; in cc_bw_same()
340 net->cc_mod.rtcc.cwnd_at_bw_set = net->cwnd; in cc_bw_same()
352 probepoint |= ((7 << 16) | net->cc_mod.rtcc.ret_from_eq); in cc_bw_same()
353 SDT_PROBE5(sctp, cwnd, net, rttvar, in cc_bw_same()
355 ((net->cc_mod.rtcc.lbw << 32) | nbw), in cc_bw_same()
356 ((net->cc_mod.rtcc.lbw_rtt << 32) | net->rtt), in cc_bw_same()
357 net->flight_size, in cc_bw_same()
359 if ((net->cc_mod.rtcc.steady_step) && (inst_ind != SCTP_INST_LOOSING)) { in cc_bw_same()
360 if (net->cc_mod.rtcc.last_step_state == 5) in cc_bw_same()
361 net->cc_mod.rtcc.step_cnt++; in cc_bw_same()
363 net->cc_mod.rtcc.step_cnt = 1; in cc_bw_same()
364 net->cc_mod.rtcc.last_step_state = 5; in cc_bw_same()
365 if ((net->cc_mod.rtcc.step_cnt == net->cc_mod.rtcc.steady_step) || in cc_bw_same()
366 ((net->cc_mod.rtcc.step_cnt > net->cc_mod.rtcc.steady_step) && in cc_bw_same()
367 ((net->cc_mod.rtcc.step_cnt % net->cc_mod.rtcc.steady_step) == 0))) { in cc_bw_same()
369 if (net->cwnd > (4 * net->mtu)) { in cc_bw_same()
370 net->cwnd -= net->mtu; in cc_bw_same()
371 net->cc_mod.rtcc.vol_reduce++; in cc_bw_same()
374 net->cc_mod.rtcc.step_cnt = 0; in cc_bw_same()
383 return ((int)net->cc_mod.rtcc.ret_from_eq); in cc_bw_same()
387 cc_bw_decrease(struct sctp_tcb *stcb, struct sctp_nets *net, uint64_t nbw, uint64_t rtt_offset, in cc_bw_decrease() argument
393 probepoint = (((uint64_t)net->cwnd) << 32); in cc_bw_decrease()
394 if (net->rtt > net->cc_mod.rtcc.lbw_rtt + rtt_offset) { in cc_bw_decrease()
397 if ((net->cwnd > net->cc_mod.rtcc.cwnd_at_bw_set) && in cc_bw_decrease()
402 SDT_PROBE5(sctp, cwnd, net, rttvar, in cc_bw_decrease()
404 ((net->cc_mod.rtcc.lbw << 32) | nbw), in cc_bw_decrease()
405 ((net->cc_mod.rtcc.lbw_rtt << 32) | net->rtt), in cc_bw_decrease()
406 net->flight_size, in cc_bw_decrease()
408 if (net->cc_mod.rtcc.ret_from_eq) { in cc_bw_decrease()
413 net->ssthresh = net->cwnd - 1; in cc_bw_decrease()
414 net->partial_bytes_acked = 0; in cc_bw_decrease()
420 SDT_PROBE5(sctp, cwnd, net, rttvar, in cc_bw_decrease()
422 ((net->cc_mod.rtcc.lbw << 32) | nbw), in cc_bw_decrease()
423 ((net->cc_mod.rtcc.lbw_rtt << 32) | net->rtt), in cc_bw_decrease()
424 net->flight_size, in cc_bw_decrease()
427 if (net->cc_mod.rtcc.steady_step) { in cc_bw_decrease()
428 oth = net->cc_mod.rtcc.vol_reduce; in cc_bw_decrease()
430 oth |= net->cc_mod.rtcc.step_cnt; in cc_bw_decrease()
432 oth |= net->cc_mod.rtcc.last_step_state; in cc_bw_decrease()
433 SDT_PROBE5(sctp, cwnd, net, rttstep, in cc_bw_decrease()
435 ((net->cc_mod.rtcc.lbw << 32) | nbw), in cc_bw_decrease()
436 ((net->cc_mod.rtcc.lbw_rtt << 32) | net->rtt), in cc_bw_decrease()
443 if ((net->cc_mod.rtcc.vol_reduce) && in cc_bw_decrease()
445 net->cwnd += net->mtu; in cc_bw_decrease()
446 sctp_enforce_cwnd_limit(&stcb->asoc, net); in cc_bw_decrease()
447 net->cc_mod.rtcc.vol_reduce--; in cc_bw_decrease()
449 net->cc_mod.rtcc.last_step_state = 2; in cc_bw_decrease()
450 net->cc_mod.rtcc.step_cnt = 0; in cc_bw_decrease()
453 } else if (net->rtt < net->cc_mod.rtcc.lbw_rtt - rtt_offset) { in cc_bw_decrease()
457 SDT_PROBE5(sctp, cwnd, net, rttvar, in cc_bw_decrease()
459 ((net->cc_mod.rtcc.lbw << 32) | nbw), in cc_bw_decrease()
460 ((net->cc_mod.rtcc.lbw_rtt << 32) | net->rtt), in cc_bw_decrease()
461 net->flight_size, in cc_bw_decrease()
463 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()
475 if ((net->cc_mod.rtcc.vol_reduce) && in cc_bw_decrease()
477 net->cwnd += net->mtu; in cc_bw_decrease()
478 sctp_enforce_cwnd_limit(&stcb->asoc, net); in cc_bw_decrease()
479 net->cc_mod.rtcc.vol_reduce--; in cc_bw_decrease()
481 net->cc_mod.rtcc.last_step_state = 3; in cc_bw_decrease()
482 net->cc_mod.rtcc.step_cnt = 0; in cc_bw_decrease()
489 SDT_PROBE5(sctp, cwnd, net, rttvar, in cc_bw_decrease()
491 ((net->cc_mod.rtcc.lbw << 32) | nbw), in cc_bw_decrease()
492 ((net->cc_mod.rtcc.lbw_rtt << 32) | net->rtt), in cc_bw_decrease()
493 net->flight_size, in cc_bw_decrease()
495 if (net->cc_mod.rtcc.steady_step) { in cc_bw_decrease()
496 oth = net->cc_mod.rtcc.vol_reduce; in cc_bw_decrease()
498 oth |= net->cc_mod.rtcc.step_cnt; in cc_bw_decrease()
500 oth |= net->cc_mod.rtcc.last_step_state; in cc_bw_decrease()
501 SDT_PROBE5(sctp, cwnd, net, rttstep, in cc_bw_decrease()
503 ((net->cc_mod.rtcc.lbw << 32) | nbw), in cc_bw_decrease()
504 ((net->cc_mod.rtcc.lbw_rtt << 32) | net->rtt), in cc_bw_decrease()
507 if ((net->cc_mod.rtcc.vol_reduce) && in cc_bw_decrease()
509 net->cwnd += net->mtu; in cc_bw_decrease()
510 sctp_enforce_cwnd_limit(&stcb->asoc, net); in cc_bw_decrease()
511 net->cc_mod.rtcc.vol_reduce--; in cc_bw_decrease()
513 net->cc_mod.rtcc.last_step_state = 4; in cc_bw_decrease()
514 net->cc_mod.rtcc.step_cnt = 0; in cc_bw_decrease()
517 net->cc_mod.rtcc.lbw = nbw; in cc_bw_decrease()
518 net->cc_mod.rtcc.lbw_rtt = net->rtt; in cc_bw_decrease()
519 net->cc_mod.rtcc.cwnd_at_bw_set = net->cwnd; in cc_bw_decrease()
528 cc_bw_increase(struct sctp_tcb *stcb, struct sctp_nets *net, uint64_t nbw, uint64_t vtag) in cc_bw_increase() argument
538 probepoint = (((uint64_t)net->cwnd) << 32); in cc_bw_increase()
539 SDT_PROBE5(sctp, cwnd, net, rttvar, in cc_bw_increase()
541 ((net->cc_mod.rtcc.lbw << 32) | nbw), in cc_bw_increase()
542 ((net->cc_mod.rtcc.lbw_rtt << 32) | net->rtt), in cc_bw_increase()
543 net->flight_size, in cc_bw_increase()
545 if (net->cc_mod.rtcc.steady_step) { in cc_bw_increase()
546 oth = net->cc_mod.rtcc.vol_reduce; in cc_bw_increase()
548 oth |= net->cc_mod.rtcc.step_cnt; in cc_bw_increase()
550 oth |= net->cc_mod.rtcc.last_step_state; in cc_bw_increase()
551 SDT_PROBE5(sctp, cwnd, net, rttstep, in cc_bw_increase()
553 ((net->cc_mod.rtcc.lbw << 32) | nbw), in cc_bw_increase()
554 ((net->cc_mod.rtcc.lbw_rtt << 32) | net->rtt), in cc_bw_increase()
557 net->cc_mod.rtcc.last_step_state = 0; in cc_bw_increase()
558 net->cc_mod.rtcc.step_cnt = 0; in cc_bw_increase()
559 net->cc_mod.rtcc.vol_reduce = 0; in cc_bw_increase()
561 net->cc_mod.rtcc.lbw = nbw; in cc_bw_increase()
562 net->cc_mod.rtcc.lbw_rtt = net->rtt; in cc_bw_increase()
563 net->cc_mod.rtcc.cwnd_at_bw_set = net->cwnd; in cc_bw_increase()
571 cc_bw_limit(struct sctp_tcb *stcb, struct sctp_nets *net, uint64_t nbw) in cc_bw_limit() argument
621 probepoint = (((uint64_t)net->cwnd) << 32); in cc_bw_limit()
622 rtt = net->rtt; in cc_bw_limit()
623 if (net->cc_mod.rtcc.rtt_set_this_sack) { in cc_bw_limit()
624 net->cc_mod.rtcc.rtt_set_this_sack = 0; in cc_bw_limit()
625 bytes_for_this_rtt = net->cc_mod.rtcc.bw_bytes - net->cc_mod.rtcc.bw_bytes_at_last_rttc; in cc_bw_limit()
626 net->cc_mod.rtcc.bw_bytes_at_last_rttc = net->cc_mod.rtcc.bw_bytes; in cc_bw_limit()
627 if (net->rtt) { in cc_bw_limit()
628 div = net->rtt / 1000; in cc_bw_limit()
640 inst_ind = net->cc_mod.rtcc.last_inst_ind; in cc_bw_limit()
641 inst_bw = bytes_for_this_rtt / (uint64_t)(net->rtt); in cc_bw_limit()
646 inst_ind = net->cc_mod.rtcc.last_inst_ind; in cc_bw_limit()
651 SDT_PROBE5(sctp, cwnd, net, rttvar, in cc_bw_limit()
654 ((net->cc_mod.rtcc.lbw_rtt << 32) | rtt), in cc_bw_limit()
655 net->flight_size, in cc_bw_limit()
659 inst_ind = net->cc_mod.rtcc.last_inst_ind; in cc_bw_limit()
661 bw_offset = net->cc_mod.rtcc.lbw >> bw_shift; in cc_bw_limit()
662 if (nbw > net->cc_mod.rtcc.lbw + bw_offset) { in cc_bw_limit()
663 ret = cc_bw_increase(stcb, net, nbw, vtag); in cc_bw_limit()
666 rtt_offset = net->cc_mod.rtcc.lbw_rtt >> SCTP_BASE_SYSCTL(sctp_rttvar_rtt); in cc_bw_limit()
667 if (nbw < net->cc_mod.rtcc.lbw - bw_offset) { in cc_bw_limit()
668 ret = cc_bw_decrease(stcb, net, nbw, rtt_offset, vtag, inst_ind); in cc_bw_limit()
675 ret = cc_bw_same(stcb, net, nbw, rtt_offset, vtag, inst_ind); in cc_bw_limit()
677 net->cc_mod.rtcc.last_inst_ind = inst_ind; in cc_bw_limit()
686 struct sctp_nets *net; in sctp_cwnd_update_after_sack_common() local
704 TAILQ_FOREACH(net, &stcb->asoc.nets, sctp_next) { in sctp_cwnd_update_after_sack_common()
705 t_ssthresh += net->ssthresh; in sctp_cwnd_update_after_sack_common()
707 srtt = net->lastsa; in sctp_cwnd_update_after_sack_common()
711 t_ucwnd_sbw += (uint64_t)net->cwnd / (uint64_t)srtt; in sctp_cwnd_update_after_sack_common()
712 t_path_mptcp += (((uint64_t)net->cwnd) << SHIFT_MPTCP_MULTI_Z) / in sctp_cwnd_update_after_sack_common()
713 (((uint64_t)net->mtu) * (uint64_t)srtt); in sctp_cwnd_update_after_sack_common()
714 tmp = (((uint64_t)net->cwnd) << SHIFT_MPTCP_MULTI_N) / in sctp_cwnd_update_after_sack_common()
715 ((uint64_t)net->mtu * (uint64_t)(srtt * srtt)); in sctp_cwnd_update_after_sack_common()
736 TAILQ_FOREACH(net, &asoc->nets, sctp_next) { in sctp_cwnd_update_after_sack_common()
741 if (net->fast_retran_loss_recovery && net->new_pseudo_cumack) { in sctp_cwnd_update_after_sack_common()
742 if (SCTP_TSN_GE(asoc->last_acked_seq, net->fast_recovery_tsn) || in sctp_cwnd_update_after_sack_common()
743 SCTP_TSN_GE(net->pseudo_cumack, net->fast_recovery_tsn)) { in sctp_cwnd_update_after_sack_common()
744 net->will_exit_fast_recovery = 1; in sctp_cwnd_update_after_sack_common()
749 if (net->net_ack == 0) { in sctp_cwnd_update_after_sack_common()
751 sctp_log_cwnd(stcb, net, 0, SCTP_CWND_LOG_FROM_SACK); in sctp_cwnd_update_after_sack_common()
779 if (use_rtcc && (net->cc_mod.rtcc.tls_needs_set > 0)) { in sctp_cwnd_update_after_sack_common()
789 if ((net->cc_mod.rtcc.new_tot_time / 1000) > 0) { in sctp_cwnd_update_after_sack_common()
790 nbw = net->cc_mod.rtcc.bw_bytes / (net->cc_mod.rtcc.new_tot_time / 1000); in sctp_cwnd_update_after_sack_common()
792 nbw = net->cc_mod.rtcc.bw_bytes; in sctp_cwnd_update_after_sack_common()
794 if (net->cc_mod.rtcc.lbw) { in sctp_cwnd_update_after_sack_common()
795 if (cc_bw_limit(stcb, net, nbw)) { in sctp_cwnd_update_after_sack_common()
802 probepoint = (((uint64_t)net->cwnd) << 32); in sctp_cwnd_update_after_sack_common()
804 vtag = (net->rtt << 32) | in sctp_cwnd_update_after_sack_common()
808 SDT_PROBE5(sctp, cwnd, net, rttvar, in sctp_cwnd_update_after_sack_common()
811 ((net->cc_mod.rtcc.lbw_rtt << 32) | net->rtt), in sctp_cwnd_update_after_sack_common()
812 net->flight_size, in sctp_cwnd_update_after_sack_common()
814 net->cc_mod.rtcc.lbw = nbw; in sctp_cwnd_update_after_sack_common()
815 net->cc_mod.rtcc.lbw_rtt = net->rtt; in sctp_cwnd_update_after_sack_common()
816 if (net->cc_mod.rtcc.rtt_set_this_sack) { in sctp_cwnd_update_after_sack_common()
817 net->cc_mod.rtcc.rtt_set_this_sack = 0; in sctp_cwnd_update_after_sack_common()
818 net->cc_mod.rtcc.bw_bytes_at_last_rttc = net->cc_mod.rtcc.bw_bytes; in sctp_cwnd_update_after_sack_common()
827 ((asoc->sctp_cmt_on_off > 0) && net->new_pseudo_cumack)) { in sctp_cwnd_update_after_sack_common()
829 if (net->cwnd <= net->ssthresh) { in sctp_cwnd_update_after_sack_common()
831 if (net->flight_size + net->net_ack >= net->cwnd) { in sctp_cwnd_update_after_sack_common()
834 old_cwnd = net->cwnd; in sctp_cwnd_update_after_sack_common()
837 limit = (uint32_t)(((uint64_t)net->mtu * in sctp_cwnd_update_after_sack_common()
839 (uint64_t)net->ssthresh) / in sctp_cwnd_update_after_sack_common()
841 incr = (uint32_t)(((uint64_t)net->net_ack * in sctp_cwnd_update_after_sack_common()
842 (uint64_t)net->ssthresh) / in sctp_cwnd_update_after_sack_common()
856 srtt = net->lastsa; in sctp_cwnd_update_after_sack_common()
860 limit = (uint32_t)(((uint64_t)net->mtu * in sctp_cwnd_update_after_sack_common()
862 (uint64_t)net->cwnd) / in sctp_cwnd_update_after_sack_common()
865 incr = (uint32_t)(((uint64_t)net->net_ack * in sctp_cwnd_update_after_sack_common()
866 (uint64_t)net->cwnd) / in sctp_cwnd_update_after_sack_common()
877 limit = (uint32_t)(((uint64_t)net->mtu * in sctp_cwnd_update_after_sack_common()
881 incr = (uint32_t)(((uint64_t)net->net_ack * in sctp_cwnd_update_after_sack_common()
887 if (incr > net->net_ack) { in sctp_cwnd_update_after_sack_common()
888 incr = net->net_ack; in sctp_cwnd_update_after_sack_common()
890 if (incr > net->mtu) { in sctp_cwnd_update_after_sack_common()
891 incr = net->mtu; in sctp_cwnd_update_after_sack_common()
895 incr = net->net_ack; in sctp_cwnd_update_after_sack_common()
896 if (incr > net->mtu * SCTP_BASE_SYSCTL(sctp_L2_abc_variable)) { in sctp_cwnd_update_after_sack_common()
897 incr = net->mtu * SCTP_BASE_SYSCTL(sctp_L2_abc_variable); in sctp_cwnd_update_after_sack_common()
901 net->cwnd += incr; in sctp_cwnd_update_after_sack_common()
902 sctp_enforce_cwnd_limit(asoc, net); in sctp_cwnd_update_after_sack_common()
904 sctp_log_cwnd(stcb, net, incr, in sctp_cwnd_update_after_sack_common()
907 SDT_PROBE5(sctp, cwnd, net, ack, in sctp_cwnd_update_after_sack_common()
910 net, in sctp_cwnd_update_after_sack_common()
911 old_cwnd, net->cwnd); in sctp_cwnd_update_after_sack_common()
914 sctp_log_cwnd(stcb, net, net->net_ack, in sctp_cwnd_update_after_sack_common()
923 net->partial_bytes_acked += net->net_ack; in sctp_cwnd_update_after_sack_common()
925 if ((net->flight_size + net->net_ack >= net->cwnd) && in sctp_cwnd_update_after_sack_common()
926 (net->partial_bytes_acked >= net->cwnd)) { in sctp_cwnd_update_after_sack_common()
927 net->partial_bytes_acked -= net->cwnd; in sctp_cwnd_update_after_sack_common()
928 old_cwnd = net->cwnd; in sctp_cwnd_update_after_sack_common()
931 incr = (uint32_t)(((uint64_t)net->mtu * in sctp_cwnd_update_after_sack_common()
932 (uint64_t)net->ssthresh) / in sctp_cwnd_update_after_sack_common()
943 srtt = net->lastsa; in sctp_cwnd_update_after_sack_common()
947 incr = (uint32_t)((uint64_t)net->mtu * in sctp_cwnd_update_after_sack_common()
948 (uint64_t)net->cwnd / in sctp_cwnd_update_after_sack_common()
958 (uint64_t)net->cwnd) >> in sctp_cwnd_update_after_sack_common()
960 if (incr > net->mtu) { in sctp_cwnd_update_after_sack_common()
961 incr = net->mtu; in sctp_cwnd_update_after_sack_common()
965 incr = net->mtu; in sctp_cwnd_update_after_sack_common()
968 net->cwnd += incr; in sctp_cwnd_update_after_sack_common()
969 sctp_enforce_cwnd_limit(asoc, net); in sctp_cwnd_update_after_sack_common()
970 SDT_PROBE5(sctp, cwnd, net, ack, in sctp_cwnd_update_after_sack_common()
973 net, in sctp_cwnd_update_after_sack_common()
974 old_cwnd, net->cwnd); in sctp_cwnd_update_after_sack_common()
976 sctp_log_cwnd(stcb, net, net->mtu, in sctp_cwnd_update_after_sack_common()
981 sctp_log_cwnd(stcb, net, net->net_ack, in sctp_cwnd_update_after_sack_common()
988 sctp_log_cwnd(stcb, net, net->mtu, in sctp_cwnd_update_after_sack_common()
996 sctp_cwnd_update_exit_pf_common(struct sctp_tcb *stcb, struct sctp_nets *net) in sctp_cwnd_update_exit_pf_common() argument
1000 old_cwnd = net->cwnd; in sctp_cwnd_update_exit_pf_common()
1001 net->cwnd = net->mtu; in sctp_cwnd_update_exit_pf_common()
1002 SDT_PROBE5(sctp, cwnd, net, ack, in sctp_cwnd_update_exit_pf_common()
1003 stcb->asoc.my_vtag, ((stcb->sctp_ep->sctp_lport << 16) | (stcb->rport)), net, in sctp_cwnd_update_exit_pf_common()
1004 old_cwnd, net->cwnd); in sctp_cwnd_update_exit_pf_common()
1006 (void *)net, net->cwnd); in sctp_cwnd_update_exit_pf_common()
1010 sctp_cwnd_update_after_timeout(struct sctp_tcb *stcb, struct sctp_nets *net) in sctp_cwnd_update_after_timeout() argument
1012 int old_cwnd = net->cwnd; in sctp_cwnd_update_after_timeout()
1041 net->ssthresh = (uint32_t)(((uint64_t)4 * in sctp_cwnd_update_after_timeout()
1042 (uint64_t)net->mtu * in sctp_cwnd_update_after_timeout()
1043 (uint64_t)net->ssthresh) / in sctp_cwnd_update_after_timeout()
1048 srtt = net->lastsa; in sctp_cwnd_update_after_timeout()
1055 net->ssthresh = (uint32_t)((uint64_t)t_cwnd - cc_delta); in sctp_cwnd_update_after_timeout()
1057 net->ssthresh = net->mtu; in sctp_cwnd_update_after_timeout()
1060 if ((net->cwnd > t_cwnd / 2) && in sctp_cwnd_update_after_timeout()
1061 (net->ssthresh < net->cwnd - t_cwnd / 2)) { in sctp_cwnd_update_after_timeout()
1062 net->ssthresh = net->cwnd - t_cwnd / 2; in sctp_cwnd_update_after_timeout()
1064 if (net->ssthresh < net->mtu) { in sctp_cwnd_update_after_timeout()
1065 net->ssthresh = net->mtu; in sctp_cwnd_update_after_timeout()
1068 net->ssthresh = max(net->cwnd / 2, 4 * net->mtu); in sctp_cwnd_update_after_timeout()
1070 net->cwnd = net->mtu; in sctp_cwnd_update_after_timeout()
1071 net->partial_bytes_acked = 0; in sctp_cwnd_update_after_timeout()
1072 SDT_PROBE5(sctp, cwnd, net, to, in sctp_cwnd_update_after_timeout()
1075 net, in sctp_cwnd_update_after_timeout()
1076 old_cwnd, net->cwnd); in sctp_cwnd_update_after_timeout()
1078 sctp_log_cwnd(stcb, net, net->cwnd - old_cwnd, SCTP_CWND_LOG_FROM_RTX); in sctp_cwnd_update_after_timeout()
1083 sctp_cwnd_update_after_ecn_echo_common(struct sctp_tcb *stcb, struct sctp_nets *net, in sctp_cwnd_update_after_ecn_echo_common() argument
1086 int old_cwnd = net->cwnd; in sctp_cwnd_update_after_ecn_echo_common()
1088 if ((use_rtcc) && (net->lan_type == SCTP_LAN_LOCAL) && (net->cc_mod.rtcc.use_dccc_ecn)) { in sctp_cwnd_update_after_ecn_echo_common()
1095 if (net->ecn_prev_cwnd < net->cwnd) { in sctp_cwnd_update_after_ecn_echo_common()
1097 net->cwnd = net->ecn_prev_cwnd - (net->mtu * num_pkt_lost); in sctp_cwnd_update_after_ecn_echo_common()
1100 net->cwnd /= 2; in sctp_cwnd_update_after_ecn_echo_common()
1103 net->ssthresh = net->cwnd - (num_pkt_lost * net->mtu); in sctp_cwnd_update_after_ecn_echo_common()
1105 sctp_log_cwnd(stcb, net, (net->cwnd - old_cwnd), SCTP_CWND_LOG_FROM_SAT); in sctp_cwnd_update_after_ecn_echo_common()
1112 net->ssthresh -= (net->mtu * num_pkt_lost); in sctp_cwnd_update_after_ecn_echo_common()
1113 net->cwnd -= (net->mtu * num_pkt_lost); in sctp_cwnd_update_after_ecn_echo_common()
1115 sctp_log_cwnd(stcb, net, (net->cwnd - old_cwnd), SCTP_CWND_LOG_FROM_SAT); in sctp_cwnd_update_after_ecn_echo_common()
1122 net->ssthresh = net->cwnd / 2; in sctp_cwnd_update_after_ecn_echo_common()
1123 if (net->ssthresh < net->mtu) { in sctp_cwnd_update_after_ecn_echo_common()
1124 net->ssthresh = net->mtu; in sctp_cwnd_update_after_ecn_echo_common()
1129 net->RTO <<= 1; in sctp_cwnd_update_after_ecn_echo_common()
1131 net->cwnd = net->ssthresh; in sctp_cwnd_update_after_ecn_echo_common()
1132 SDT_PROBE5(sctp, cwnd, net, ecn, in sctp_cwnd_update_after_ecn_echo_common()
1135 net, in sctp_cwnd_update_after_ecn_echo_common()
1136 old_cwnd, net->cwnd); in sctp_cwnd_update_after_ecn_echo_common()
1138 sctp_log_cwnd(stcb, net, (net->cwnd - old_cwnd), SCTP_CWND_LOG_FROM_SAT); in sctp_cwnd_update_after_ecn_echo_common()
1147 struct sctp_nets *net, struct sctp_pktdrop_chunk *cp, in sctp_cwnd_update_after_packet_dropped() argument
1152 int old_cwnd = net->cwnd; in sctp_cwnd_update_after_packet_dropped()
1162 if (*on_queue < net->flight_size) { in sctp_cwnd_update_after_packet_dropped()
1163 *on_queue = net->flight_size; in sctp_cwnd_update_after_packet_dropped()
1166 bw_avail = (uint32_t)(((uint64_t)(*bottle_bw) * net->rtt) / (uint64_t)1000000); in sctp_cwnd_update_after_packet_dropped()
1185 net->partial_bytes_acked = 0; in sctp_cwnd_update_after_packet_dropped()
1193 net->cwnd = net->prev_cwnd; in sctp_cwnd_update_after_packet_dropped()
1196 seg_inflight = net->flight_size / net->mtu; in sctp_cwnd_update_after_packet_dropped()
1197 seg_onqueue = *on_queue / net->mtu; in sctp_cwnd_update_after_packet_dropped()
1201 if (net->cwnd > net->flight_size) { in sctp_cwnd_update_after_packet_dropped()
1209 diff_adj = net->cwnd - net->flight_size; in sctp_cwnd_update_after_packet_dropped()
1220 net->cwnd -= my_portion; in sctp_cwnd_update_after_packet_dropped()
1223 if (net->cwnd <= net->mtu) { in sctp_cwnd_update_after_packet_dropped()
1224 net->cwnd = net->mtu; in sctp_cwnd_update_after_packet_dropped()
1227 net->ssthresh = net->cwnd - 1; in sctp_cwnd_update_after_packet_dropped()
1235 (stcb->asoc.max_burst * net->mtu < incr)) { in sctp_cwnd_update_after_packet_dropped()
1236 incr = stcb->asoc.max_burst * net->mtu; in sctp_cwnd_update_after_packet_dropped()
1238 net->cwnd += incr; in sctp_cwnd_update_after_packet_dropped()
1240 if (net->cwnd > bw_avail) { in sctp_cwnd_update_after_packet_dropped()
1242 net->cwnd = bw_avail; in sctp_cwnd_update_after_packet_dropped()
1244 if (net->cwnd < net->mtu) { in sctp_cwnd_update_after_packet_dropped()
1246 net->cwnd = net->mtu; in sctp_cwnd_update_after_packet_dropped()
1248 sctp_enforce_cwnd_limit(&stcb->asoc, net); in sctp_cwnd_update_after_packet_dropped()
1249 if (net->cwnd - old_cwnd != 0) { in sctp_cwnd_update_after_packet_dropped()
1251 SDT_PROBE5(sctp, cwnd, net, pd, in sctp_cwnd_update_after_packet_dropped()
1254 net, in sctp_cwnd_update_after_packet_dropped()
1255 old_cwnd, net->cwnd); in sctp_cwnd_update_after_packet_dropped()
1257 sctp_log_cwnd(stcb, net, (net->cwnd - old_cwnd), in sctp_cwnd_update_after_packet_dropped()
1265 struct sctp_nets *net, int burst_limit) in sctp_cwnd_update_after_output() argument
1267 int old_cwnd = net->cwnd; in sctp_cwnd_update_after_output()
1269 if (net->ssthresh < net->cwnd) in sctp_cwnd_update_after_output()
1270 net->ssthresh = net->cwnd; in sctp_cwnd_update_after_output()
1272 net->cwnd = (net->flight_size + (burst_limit * net->mtu)); in sctp_cwnd_update_after_output()
1273 sctp_enforce_cwnd_limit(&stcb->asoc, net); in sctp_cwnd_update_after_output()
1274 SDT_PROBE5(sctp, cwnd, net, bl, in sctp_cwnd_update_after_output()
1277 net, in sctp_cwnd_update_after_output()
1278 old_cwnd, net->cwnd); in sctp_cwnd_update_after_output()
1280 sctp_log_cwnd(stcb, net, (net->cwnd - old_cwnd), SCTP_CWND_LOG_FROM_BRST); in sctp_cwnd_update_after_output()
1295 sctp_cwnd_update_after_ecn_echo(struct sctp_tcb *stcb, struct sctp_nets *net, in sctp_cwnd_update_after_ecn_echo() argument
1299 sctp_cwnd_update_after_ecn_echo_common(stcb, net, in_window, num_pkt_lost, 0); in sctp_cwnd_update_after_ecn_echo()
1308 sctp_cwnd_update_rtcc_after_ecn_echo(struct sctp_tcb *stcb, struct sctp_nets *net, in sctp_cwnd_update_rtcc_after_ecn_echo() argument
1311 sctp_cwnd_update_after_ecn_echo_common(stcb, net, in_window, num_pkt_lost, 1); in sctp_cwnd_update_rtcc_after_ecn_echo()
1315 sctp_cwnd_update_rtcc_tsn_acknowledged(struct sctp_nets *net, in sctp_cwnd_update_rtcc_tsn_acknowledged() argument
1318 net->cc_mod.rtcc.bw_bytes += tp1->send_size; in sctp_cwnd_update_rtcc_tsn_acknowledged()
1323 struct sctp_nets *net) in sctp_cwnd_prepare_rtcc_net_for_sack() argument
1325 if (net->cc_mod.rtcc.tls_needs_set > 0) { in sctp_cwnd_prepare_rtcc_net_for_sack()
1330 timevalsub(&ltls, &net->cc_mod.rtcc.tls); in sctp_cwnd_prepare_rtcc_net_for_sack()
1331 net->cc_mod.rtcc.new_tot_time = (ltls.tv_sec * 1000000) + ltls.tv_usec; in sctp_cwnd_prepare_rtcc_net_for_sack()
1337 struct sctp_nets *net) in sctp_cwnd_new_rtcc_transmission_begins() argument
1341 if (net->cc_mod.rtcc.lbw) { in sctp_cwnd_new_rtcc_transmission_begins()
1343 vtag = (net->rtt << 32) | (((uint32_t)(stcb->sctp_ep->sctp_lport)) << 16) | in sctp_cwnd_new_rtcc_transmission_begins()
1345 probepoint = (((uint64_t)net->cwnd) << 32); in sctp_cwnd_new_rtcc_transmission_begins()
1348 SDT_PROBE5(sctp, cwnd, net, rttvar, in sctp_cwnd_new_rtcc_transmission_begins()
1350 ((net->cc_mod.rtcc.lbw << 32) | 0), in sctp_cwnd_new_rtcc_transmission_begins()
1351 ((net->cc_mod.rtcc.lbw_rtt << 32) | net->rtt), in sctp_cwnd_new_rtcc_transmission_begins()
1352 net->flight_size, in sctp_cwnd_new_rtcc_transmission_begins()
1354 net->cc_mod.rtcc.lbw_rtt = 0; in sctp_cwnd_new_rtcc_transmission_begins()
1355 net->cc_mod.rtcc.cwnd_at_bw_set = 0; in sctp_cwnd_new_rtcc_transmission_begins()
1356 net->cc_mod.rtcc.lbw = 0; in sctp_cwnd_new_rtcc_transmission_begins()
1357 net->cc_mod.rtcc.bw_bytes_at_last_rttc = 0; in sctp_cwnd_new_rtcc_transmission_begins()
1358 net->cc_mod.rtcc.vol_reduce = 0; in sctp_cwnd_new_rtcc_transmission_begins()
1359 net->cc_mod.rtcc.bw_tot_time = 0; in sctp_cwnd_new_rtcc_transmission_begins()
1360 net->cc_mod.rtcc.bw_bytes = 0; in sctp_cwnd_new_rtcc_transmission_begins()
1361 net->cc_mod.rtcc.tls_needs_set = 0; in sctp_cwnd_new_rtcc_transmission_begins()
1362 if (net->cc_mod.rtcc.steady_step) { in sctp_cwnd_new_rtcc_transmission_begins()
1363 net->cc_mod.rtcc.vol_reduce = 0; in sctp_cwnd_new_rtcc_transmission_begins()
1364 net->cc_mod.rtcc.step_cnt = 0; in sctp_cwnd_new_rtcc_transmission_begins()
1365 net->cc_mod.rtcc.last_step_state = 0; in sctp_cwnd_new_rtcc_transmission_begins()
1367 if (net->cc_mod.rtcc.ret_from_eq) { in sctp_cwnd_new_rtcc_transmission_begins()
1377 cwnd = min((net->mtu * 4), max((2 * net->mtu), SCTP_INITIAL_CWND)); in sctp_cwnd_new_rtcc_transmission_begins()
1385 cwnd = (net->mtu - sizeof(struct sctphdr)) * cwnd_in_mtu; in sctp_cwnd_new_rtcc_transmission_begins()
1387 if (net->cwnd > cwnd) { in sctp_cwnd_new_rtcc_transmission_begins()
1392 net->cwnd = cwnd; in sctp_cwnd_new_rtcc_transmission_begins()
1400 struct sctp_nets *net) in sctp_set_rtcc_initial_cc_param() argument
1404 sctp_set_initial_cc_param(stcb, net); in sctp_set_rtcc_initial_cc_param()
1406 probepoint = (((uint64_t)net->cwnd) << 32); in sctp_set_rtcc_initial_cc_param()
1408 vtag = (net->rtt << 32) | in sctp_set_rtcc_initial_cc_param()
1411 SDT_PROBE5(sctp, cwnd, net, rttvar, in sctp_set_rtcc_initial_cc_param()
1417 net->cc_mod.rtcc.lbw_rtt = 0; in sctp_set_rtcc_initial_cc_param()
1418 net->cc_mod.rtcc.cwnd_at_bw_set = 0; in sctp_set_rtcc_initial_cc_param()
1419 net->cc_mod.rtcc.vol_reduce = 0; in sctp_set_rtcc_initial_cc_param()
1420 net->cc_mod.rtcc.lbw = 0; in sctp_set_rtcc_initial_cc_param()
1421 net->cc_mod.rtcc.vol_reduce = 0; in sctp_set_rtcc_initial_cc_param()
1422 net->cc_mod.rtcc.bw_bytes_at_last_rttc = 0; in sctp_set_rtcc_initial_cc_param()
1423 net->cc_mod.rtcc.bw_tot_time = 0; in sctp_set_rtcc_initial_cc_param()
1424 net->cc_mod.rtcc.bw_bytes = 0; in sctp_set_rtcc_initial_cc_param()
1425 net->cc_mod.rtcc.tls_needs_set = 0; in sctp_set_rtcc_initial_cc_param()
1426 net->cc_mod.rtcc.ret_from_eq = SCTP_BASE_SYSCTL(sctp_rttvar_eqret); in sctp_set_rtcc_initial_cc_param()
1427 net->cc_mod.rtcc.steady_step = SCTP_BASE_SYSCTL(sctp_steady_step); in sctp_set_rtcc_initial_cc_param()
1428 net->cc_mod.rtcc.use_dccc_ecn = SCTP_BASE_SYSCTL(sctp_use_dccc_ecn); in sctp_set_rtcc_initial_cc_param()
1429 net->cc_mod.rtcc.step_cnt = 0; in sctp_set_rtcc_initial_cc_param()
1430 net->cc_mod.rtcc.last_step_state = 0; in sctp_set_rtcc_initial_cc_param()
1437 struct sctp_nets *net; in sctp_cwnd_rtcc_socket_option() local
1446 TAILQ_FOREACH(net, &stcb->asoc.nets, sctp_next) { in sctp_cwnd_rtcc_socket_option()
1447 net->cc_mod.rtcc.ret_from_eq = cc_opt->aid_value.assoc_value; in sctp_cwnd_rtcc_socket_option()
1454 TAILQ_FOREACH(net, &stcb->asoc.nets, sctp_next) { in sctp_cwnd_rtcc_socket_option()
1455 net->cc_mod.rtcc.use_dccc_ecn = cc_opt->aid_value.assoc_value; in sctp_cwnd_rtcc_socket_option()
1458 TAILQ_FOREACH(net, &stcb->asoc.nets, sctp_next) { in sctp_cwnd_rtcc_socket_option()
1459 net->cc_mod.rtcc.steady_step = cc_opt->aid_value.assoc_value; in sctp_cwnd_rtcc_socket_option()
1467 net = TAILQ_FIRST(&stcb->asoc.nets); in sctp_cwnd_rtcc_socket_option()
1468 if (net == NULL) { in sctp_cwnd_rtcc_socket_option()
1471 cc_opt->aid_value.assoc_value = net->cc_mod.rtcc.ret_from_eq; in sctp_cwnd_rtcc_socket_option()
1473 net = TAILQ_FIRST(&stcb->asoc.nets); in sctp_cwnd_rtcc_socket_option()
1474 if (net == NULL) { in sctp_cwnd_rtcc_socket_option()
1477 cc_opt->aid_value.assoc_value = net->cc_mod.rtcc.use_dccc_ecn; in sctp_cwnd_rtcc_socket_option()
1479 net = TAILQ_FIRST(&stcb->asoc.nets); in sctp_cwnd_rtcc_socket_option()
1480 if (net == NULL) { in sctp_cwnd_rtcc_socket_option()
1483 cc_opt->aid_value.assoc_value = net->cc_mod.rtcc.steady_step; in sctp_cwnd_rtcc_socket_option()
1493 struct sctp_nets *net) in sctp_cwnd_update_rtcc_packet_transmitted() argument
1495 if (net->cc_mod.rtcc.tls_needs_set == 0) { in sctp_cwnd_update_rtcc_packet_transmitted()
1496 SCTP_GETPTIME_TIMEVAL(&net->cc_mod.rtcc.tls); in sctp_cwnd_update_rtcc_packet_transmitted()
1497 net->cc_mod.rtcc.tls_needs_set = 2; in sctp_cwnd_update_rtcc_packet_transmitted()
1512 struct sctp_nets *net, in sctp_rtt_rtcc_calculated() argument
1515 net->cc_mod.rtcc.rtt_set_this_sack = 1; in sctp_rtt_rtcc_calculated()
1605 sctp_hs_cwnd_increase(struct sctp_tcb *stcb, struct sctp_nets *net) in sctp_hs_cwnd_increase() argument
1608 int old_cwnd = net->cwnd; in sctp_hs_cwnd_increase()
1610 cur_val = net->cwnd >> 10; in sctp_hs_cwnd_increase()
1615 if (net->net_ack > net->mtu) { in sctp_hs_cwnd_increase()
1616 net->cwnd += net->mtu; in sctp_hs_cwnd_increase()
1618 net->cwnd += net->net_ack; in sctp_hs_cwnd_increase()
1621 for (i = net->last_hs_used; i < SCTP_HS_TABLE_SIZE; i++) { in sctp_hs_cwnd_increase()
1627 net->last_hs_used = indx; in sctp_hs_cwnd_increase()
1629 net->cwnd += incr; in sctp_hs_cwnd_increase()
1631 sctp_enforce_cwnd_limit(&stcb->asoc, net); in sctp_hs_cwnd_increase()
1633 sctp_log_cwnd(stcb, net, (net->cwnd - old_cwnd), SCTP_CWND_LOG_FROM_SS); in sctp_hs_cwnd_increase()
1638 sctp_hs_cwnd_decrease(struct sctp_tcb *stcb, struct sctp_nets *net) in sctp_hs_cwnd_decrease() argument
1641 int old_cwnd = net->cwnd; in sctp_hs_cwnd_decrease()
1643 cur_val = net->cwnd >> 10; in sctp_hs_cwnd_decrease()
1646 net->ssthresh = net->cwnd / 2; in sctp_hs_cwnd_decrease()
1647 if (net->ssthresh < (net->mtu * 2)) { in sctp_hs_cwnd_decrease()
1648 net->ssthresh = 2 * net->mtu; in sctp_hs_cwnd_decrease()
1650 net->cwnd = net->ssthresh; in sctp_hs_cwnd_decrease()
1653 net->ssthresh = net->cwnd - (int)((net->cwnd / 100) * in sctp_hs_cwnd_decrease()
1654 (int32_t)sctp_cwnd_adjust[net->last_hs_used].drop_percent); in sctp_hs_cwnd_decrease()
1655 net->cwnd = net->ssthresh; in sctp_hs_cwnd_decrease()
1657 indx = net->last_hs_used; in sctp_hs_cwnd_decrease()
1658 cur_val = net->cwnd >> 10; in sctp_hs_cwnd_decrease()
1662 net->last_hs_used = 0; in sctp_hs_cwnd_decrease()
1669 net->last_hs_used = indx; in sctp_hs_cwnd_decrease()
1672 sctp_enforce_cwnd_limit(&stcb->asoc, net); in sctp_hs_cwnd_decrease()
1674 sctp_log_cwnd(stcb, net, (net->cwnd - old_cwnd), SCTP_CWND_LOG_FROM_FR); in sctp_hs_cwnd_decrease()
1682 struct sctp_nets *net; in sctp_hs_cwnd_update_after_fr() local
1688 TAILQ_FOREACH(net, &asoc->nets, sctp_next) { in sctp_hs_cwnd_update_after_fr()
1692 if (net->net_ack > 0) { in sctp_hs_cwnd_update_after_fr()
1701 sctp_hs_cwnd_decrease(stcb, net); in sctp_hs_cwnd_update_after_fr()
1705 net->partial_bytes_acked = 0; in sctp_hs_cwnd_update_after_fr()
1719 net->fast_retran_loss_recovery = 1; in sctp_hs_cwnd_update_after_fr()
1723 net->fast_recovery_tsn = asoc->sending_seq - 1; in sctp_hs_cwnd_update_after_fr()
1725 net->fast_recovery_tsn = lchk->rec.data.tsn - 1; in sctp_hs_cwnd_update_after_fr()
1729 stcb->sctp_ep, stcb, net, in sctp_hs_cwnd_update_after_fr()
1732 stcb->sctp_ep, stcb, net); in sctp_hs_cwnd_update_after_fr()
1734 } else if (net->net_ack > 0) { in sctp_hs_cwnd_update_after_fr()
1749 struct sctp_nets *net; in sctp_hs_cwnd_update_after_sack() local
1754 TAILQ_FOREACH(net, &asoc->nets, sctp_next) { in sctp_hs_cwnd_update_after_sack()
1759 if (net->fast_retran_loss_recovery && net->new_pseudo_cumack) { in sctp_hs_cwnd_update_after_sack()
1760 if (SCTP_TSN_GE(asoc->last_acked_seq, net->fast_recovery_tsn) || in sctp_hs_cwnd_update_after_sack()
1761 SCTP_TSN_GE(net->pseudo_cumack, net->fast_recovery_tsn)) { in sctp_hs_cwnd_update_after_sack()
1762 net->will_exit_fast_recovery = 1; in sctp_hs_cwnd_update_after_sack()
1767 if (net->net_ack == 0) { in sctp_hs_cwnd_update_after_sack()
1769 sctp_log_cwnd(stcb, net, 0, SCTP_CWND_LOG_FROM_SACK); in sctp_hs_cwnd_update_after_sack()
1799 ((asoc->sctp_cmt_on_off > 0) && net->new_pseudo_cumack)) { in sctp_hs_cwnd_update_after_sack()
1801 if (net->cwnd <= net->ssthresh) { in sctp_hs_cwnd_update_after_sack()
1803 if (net->flight_size + net->net_ack >= net->cwnd) { in sctp_hs_cwnd_update_after_sack()
1804 sctp_hs_cwnd_increase(stcb, net); in sctp_hs_cwnd_update_after_sack()
1807 sctp_log_cwnd(stcb, net, net->net_ack, in sctp_hs_cwnd_update_after_sack()
1813 net->partial_bytes_acked += net->net_ack; in sctp_hs_cwnd_update_after_sack()
1814 if ((net->flight_size + net->net_ack >= net->cwnd) && in sctp_hs_cwnd_update_after_sack()
1815 (net->partial_bytes_acked >= net->cwnd)) { in sctp_hs_cwnd_update_after_sack()
1816 net->partial_bytes_acked -= net->cwnd; in sctp_hs_cwnd_update_after_sack()
1817 net->cwnd += net->mtu; in sctp_hs_cwnd_update_after_sack()
1818 sctp_enforce_cwnd_limit(asoc, net); in sctp_hs_cwnd_update_after_sack()
1820 sctp_log_cwnd(stcb, net, net->mtu, in sctp_hs_cwnd_update_after_sack()
1825 sctp_log_cwnd(stcb, net, net->net_ack, in sctp_hs_cwnd_update_after_sack()
1832 sctp_log_cwnd(stcb, net, net->mtu, in sctp_hs_cwnd_update_after_sack()
1880 htcp_cwnd_undo(struct sctp_tcb *stcb, struct sctp_nets *net) in htcp_cwnd_undo() argument
1882 net->cc_mod.htcp_ca.last_cong = net->cc_mod.htcp_ca.undo_last_cong; in htcp_cwnd_undo()
1883 net->cc_mod.htcp_ca.maxRTT = net->cc_mod.htcp_ca.undo_maxRTT; in htcp_cwnd_undo()
1884 net->cc_mod.htcp_ca.old_maxB = net->cc_mod.htcp_ca.undo_old_maxB; in htcp_cwnd_undo()
1885 return (max(net->cwnd, ((net->ssthresh / net->mtu << 7) / net->cc_mod.htcp_ca.beta) * net->mtu)); in htcp_cwnd_undo()
1891 measure_rtt(struct sctp_nets *net) in measure_rtt() argument
1893 uint32_t srtt = net->lastsa >> SCTP_RTT_SHIFT; in measure_rtt()
1896 if (net->cc_mod.htcp_ca.minRTT > srtt || !net->cc_mod.htcp_ca.minRTT) in measure_rtt()
1897 net->cc_mod.htcp_ca.minRTT = srtt; in measure_rtt()
1900 if (net->fast_retran_ip == 0 && net->ssthresh < 0xFFFF && htcp_ccount(&net->cc_mod.htcp_ca) > 3) { in measure_rtt()
1901 if (net->cc_mod.htcp_ca.maxRTT < net->cc_mod.htcp_ca.minRTT) in measure_rtt()
1902 net->cc_mod.htcp_ca.maxRTT = net->cc_mod.htcp_ca.minRTT; in measure_rtt()
1903 …if (net->cc_mod.htcp_ca.maxRTT < srtt && srtt <= net->cc_mod.htcp_ca.maxRTT + sctp_msecs_to_ticks(… in measure_rtt()
1904 net->cc_mod.htcp_ca.maxRTT = srtt; in measure_rtt()
1909 measure_achieved_throughput(struct sctp_nets *net) in measure_achieved_throughput() argument
1913 if (net->fast_retran_ip == 0) in measure_achieved_throughput()
1914 net->cc_mod.htcp_ca.bytes_acked = net->net_ack; in measure_achieved_throughput()
1921 if (net->fast_retran_ip == 1) { in measure_achieved_throughput()
1922 net->cc_mod.htcp_ca.bytecount = 0; in measure_achieved_throughput()
1923 net->cc_mod.htcp_ca.lasttime = now; in measure_achieved_throughput()
1927 net->cc_mod.htcp_ca.bytecount += net->net_ack; in measure_achieved_throughput()
1928 …if ((net->cc_mod.htcp_ca.bytecount >= net->cwnd - (((net->cc_mod.htcp_ca.alpha >> 7) ? (net->cc_mo… in measure_achieved_throughput()
1929 (now - net->cc_mod.htcp_ca.lasttime >= net->cc_mod.htcp_ca.minRTT) && in measure_achieved_throughput()
1930 (net->cc_mod.htcp_ca.minRTT > 0)) { in measure_achieved_throughput()
1931 …uint32_t cur_Bi = net->cc_mod.htcp_ca.bytecount / net->mtu * hz / (now - net->cc_mod.htcp_ca.lastt… in measure_achieved_throughput()
1933 if (htcp_ccount(&net->cc_mod.htcp_ca) <= 3) { in measure_achieved_throughput()
1935 net->cc_mod.htcp_ca.minB = net->cc_mod.htcp_ca.maxB = net->cc_mod.htcp_ca.Bi = cur_Bi; in measure_achieved_throughput()
1937 net->cc_mod.htcp_ca.Bi = (3 * net->cc_mod.htcp_ca.Bi + cur_Bi) / 4; in measure_achieved_throughput()
1938 if (net->cc_mod.htcp_ca.Bi > net->cc_mod.htcp_ca.maxB) in measure_achieved_throughput()
1939 net->cc_mod.htcp_ca.maxB = net->cc_mod.htcp_ca.Bi; in measure_achieved_throughput()
1940 if (net->cc_mod.htcp_ca.minB > net->cc_mod.htcp_ca.maxB) in measure_achieved_throughput()
1941 net->cc_mod.htcp_ca.minB = net->cc_mod.htcp_ca.maxB; in measure_achieved_throughput()
1943 net->cc_mod.htcp_ca.bytecount = 0; in measure_achieved_throughput()
1944 net->cc_mod.htcp_ca.lasttime = now; in measure_achieved_throughput()
2012 htcp_param_update(struct sctp_nets *net) in htcp_param_update() argument
2014 uint32_t minRTT = net->cc_mod.htcp_ca.minRTT; in htcp_param_update()
2015 uint32_t maxRTT = net->cc_mod.htcp_ca.maxRTT; in htcp_param_update()
2017 htcp_beta_update(&net->cc_mod.htcp_ca, minRTT, maxRTT); in htcp_param_update()
2018 htcp_alpha_update(&net->cc_mod.htcp_ca); in htcp_param_update()
2025 net->cc_mod.htcp_ca.maxRTT = minRTT + ((maxRTT - minRTT) * 95) / 100; in htcp_param_update()
2029 htcp_recalc_ssthresh(struct sctp_nets *net) in htcp_recalc_ssthresh() argument
2031 htcp_param_update(net); in htcp_recalc_ssthresh()
2032 return (max(((net->cwnd / net->mtu * net->cc_mod.htcp_ca.beta) >> 7) * net->mtu, 2U * net->mtu)); in htcp_recalc_ssthresh()
2036 htcp_cong_avoid(struct sctp_tcb *stcb, struct sctp_nets *net) in htcp_cong_avoid() argument
2043 if (net->cwnd <= net->ssthresh) { in htcp_cong_avoid()
2045 if (net->flight_size + net->net_ack >= net->cwnd) { in htcp_cong_avoid()
2046 if (net->net_ack > (net->mtu * SCTP_BASE_SYSCTL(sctp_L2_abc_variable))) { in htcp_cong_avoid()
2047 net->cwnd += (net->mtu * SCTP_BASE_SYSCTL(sctp_L2_abc_variable)); in htcp_cong_avoid()
2049 sctp_log_cwnd(stcb, net, net->mtu, in htcp_cong_avoid()
2054 net->cwnd += net->net_ack; in htcp_cong_avoid()
2056 sctp_log_cwnd(stcb, net, net->net_ack, in htcp_cong_avoid()
2060 sctp_enforce_cwnd_limit(&stcb->asoc, net); in htcp_cong_avoid()
2063 sctp_log_cwnd(stcb, net, net->net_ack, in htcp_cong_avoid()
2068 measure_rtt(net); in htcp_cong_avoid()
2075 …if (((net->partial_bytes_acked / net->mtu * net->cc_mod.htcp_ca.alpha) >> 7) * net->mtu >= net->cw… in htcp_cong_avoid()
2080 net->cwnd += net->mtu; in htcp_cong_avoid()
2081 net->partial_bytes_acked = 0; in htcp_cong_avoid()
2082 sctp_enforce_cwnd_limit(&stcb->asoc, net); in htcp_cong_avoid()
2083 htcp_alpha_update(&net->cc_mod.htcp_ca); in htcp_cong_avoid()
2085 sctp_log_cwnd(stcb, net, net->mtu, in htcp_cong_avoid()
2089 net->partial_bytes_acked += net->net_ack; in htcp_cong_avoid()
2091 sctp_log_cwnd(stcb, net, net->net_ack, in htcp_cong_avoid()
2096 net->cc_mod.htcp_ca.bytes_acked = net->mtu; in htcp_cong_avoid()
2103 htcp_min_cwnd(struct sctp_tcb *stcb, struct sctp_nets *net) in htcp_min_cwnd() argument
2105 return (net->ssthresh); in htcp_min_cwnd()
2110 htcp_init(struct sctp_nets *net) in htcp_init() argument
2112 memset(&net->cc_mod.htcp_ca, 0, sizeof(struct htcp)); in htcp_init()
2113 net->cc_mod.htcp_ca.alpha = ALPHA_BASE; in htcp_init()
2114 net->cc_mod.htcp_ca.beta = BETA_MIN; in htcp_init()
2115 net->cc_mod.htcp_ca.bytes_acked = net->mtu; in htcp_init()
2116 net->cc_mod.htcp_ca.last_cong = sctp_get_tick_count(); in htcp_init()
2120 sctp_htcp_set_initial_cc_param(struct sctp_tcb *stcb, struct sctp_nets *net) in sctp_htcp_set_initial_cc_param() argument
2126 net->cwnd = min((net->mtu * 4), max((2 * net->mtu), SCTP_INITIAL_CWND)); in sctp_htcp_set_initial_cc_param()
2127 net->ssthresh = stcb->asoc.peers_rwnd; in sctp_htcp_set_initial_cc_param()
2128 sctp_enforce_cwnd_limit(&stcb->asoc, net); in sctp_htcp_set_initial_cc_param()
2129 htcp_init(net); in sctp_htcp_set_initial_cc_param()
2132 sctp_log_cwnd(stcb, net, 0, SCTP_CWND_INITIALIZATION); in sctp_htcp_set_initial_cc_param()
2141 struct sctp_nets *net; in sctp_htcp_cwnd_update_after_sack() local
2146 TAILQ_FOREACH(net, &asoc->nets, sctp_next) { in sctp_htcp_cwnd_update_after_sack()
2151 if (net->fast_retran_loss_recovery && net->new_pseudo_cumack) { in sctp_htcp_cwnd_update_after_sack()
2152 if (SCTP_TSN_GE(asoc->last_acked_seq, net->fast_recovery_tsn) || in sctp_htcp_cwnd_update_after_sack()
2153 SCTP_TSN_GE(net->pseudo_cumack, net->fast_recovery_tsn)) { in sctp_htcp_cwnd_update_after_sack()
2154 net->will_exit_fast_recovery = 1; in sctp_htcp_cwnd_update_after_sack()
2159 if (net->net_ack == 0) { in sctp_htcp_cwnd_update_after_sack()
2161 sctp_log_cwnd(stcb, net, 0, SCTP_CWND_LOG_FROM_SACK); in sctp_htcp_cwnd_update_after_sack()
2191 ((asoc->sctp_cmt_on_off > 0) && net->new_pseudo_cumack)) { in sctp_htcp_cwnd_update_after_sack()
2192 htcp_cong_avoid(stcb, net); in sctp_htcp_cwnd_update_after_sack()
2193 measure_achieved_throughput(net); in sctp_htcp_cwnd_update_after_sack()
2196 sctp_log_cwnd(stcb, net, net->mtu, in sctp_htcp_cwnd_update_after_sack()
2207 struct sctp_nets *net; in sctp_htcp_cwnd_update_after_fr() local
2213 TAILQ_FOREACH(net, &asoc->nets, sctp_next) { in sctp_htcp_cwnd_update_after_fr()
2217 if (net->net_ack > 0) { in sctp_htcp_cwnd_update_after_fr()
2225 int old_cwnd = net->cwnd; in sctp_htcp_cwnd_update_after_fr()
2228 htcp_reset(&net->cc_mod.htcp_ca); in sctp_htcp_cwnd_update_after_fr()
2229 net->ssthresh = htcp_recalc_ssthresh(net); in sctp_htcp_cwnd_update_after_fr()
2230 net->cwnd = net->ssthresh; in sctp_htcp_cwnd_update_after_fr()
2231 sctp_enforce_cwnd_limit(asoc, net); in sctp_htcp_cwnd_update_after_fr()
2233 sctp_log_cwnd(stcb, net, (net->cwnd - old_cwnd), in sctp_htcp_cwnd_update_after_fr()
2238 net->partial_bytes_acked = 0; in sctp_htcp_cwnd_update_after_fr()
2252 net->fast_retran_loss_recovery = 1; in sctp_htcp_cwnd_update_after_fr()
2256 net->fast_recovery_tsn = asoc->sending_seq - 1; in sctp_htcp_cwnd_update_after_fr()
2258 net->fast_recovery_tsn = lchk->rec.data.tsn - 1; in sctp_htcp_cwnd_update_after_fr()
2262 stcb->sctp_ep, stcb, net, in sctp_htcp_cwnd_update_after_fr()
2265 stcb->sctp_ep, stcb, net); in sctp_htcp_cwnd_update_after_fr()
2267 } else if (net->net_ack > 0) { in sctp_htcp_cwnd_update_after_fr()
2279 struct sctp_nets *net) in sctp_htcp_cwnd_update_after_timeout() argument
2281 int old_cwnd = net->cwnd; in sctp_htcp_cwnd_update_after_timeout()
2284 htcp_reset(&net->cc_mod.htcp_ca); in sctp_htcp_cwnd_update_after_timeout()
2285 net->ssthresh = htcp_recalc_ssthresh(net); in sctp_htcp_cwnd_update_after_timeout()
2286 net->cwnd = net->mtu; in sctp_htcp_cwnd_update_after_timeout()
2287 net->partial_bytes_acked = 0; in sctp_htcp_cwnd_update_after_timeout()
2289 sctp_log_cwnd(stcb, net, net->cwnd - old_cwnd, SCTP_CWND_LOG_FROM_RTX); in sctp_htcp_cwnd_update_after_timeout()
2295 struct sctp_nets *net, int in_window, int num_pkt_lost SCTP_UNUSED) in sctp_htcp_cwnd_update_after_ecn_echo() argument
2299 old_cwnd = net->cwnd; in sctp_htcp_cwnd_update_after_ecn_echo()
2303 htcp_reset(&net->cc_mod.htcp_ca); in sctp_htcp_cwnd_update_after_ecn_echo()
2305 net->ssthresh = htcp_recalc_ssthresh(net); in sctp_htcp_cwnd_update_after_ecn_echo()
2306 if (net->ssthresh < net->mtu) { in sctp_htcp_cwnd_update_after_ecn_echo()
2307 net->ssthresh = net->mtu; in sctp_htcp_cwnd_update_after_ecn_echo()
2309 net->RTO <<= 1; in sctp_htcp_cwnd_update_after_ecn_echo()
2311 net->cwnd = net->ssthresh; in sctp_htcp_cwnd_update_after_ecn_echo()
2312 sctp_enforce_cwnd_limit(&stcb->asoc, net); in sctp_htcp_cwnd_update_after_ecn_echo()
2314 sctp_log_cwnd(stcb, net, (net->cwnd - old_cwnd), SCTP_CWND_LOG_FROM_SAT); in sctp_htcp_cwnd_update_after_ecn_echo()