Lines Matching +full:down +full:- +full:scaling

1 /*-
2 * SPDX-License-Identifier: BSD-2-Clause
4 * Copyright (c) 2007-2008
6 * Copyright (c) 2009-2010 Lawrence Stewart <lstewart@freebsd.org>
42 * An implementation of the H-TCP congestion control algorithm for FreeBSD,
43 * based on the Internet Draft "draft-leith-tcp-htcp-06.txt" by Leith and
86 /* RTT_ref (ms) used in the calculation of alpha if RTT scaling is enabled. */
96 * i.e. 1 + 10(delta - delta_l) + ((delta - delta_l) / 2) ^ 2
98 * "diff" is passed in to the macro as "delta - delta_l" and is expected to be
115 * up-shifting all the terms in the function and performing the required
116 * calculations, we down-shift the final result by HTCP_ALPHA_INC_SHIFT to
174 /* Per-netstack vars. */
196 uint32_t mss = tcp_fixed_maxseg(ccv->tp); in htcp_ack_received()
198 htcp_data = ccv->cc_data; in htcp_ack_received()
207 (ccv->flags & CCF_CWND_LIMITED) && (!V_tcp_do_rfc3465 || in htcp_ack_received()
209 (V_tcp_do_rfc3465 && ccv->flags & CCF_ABC_SENTAWND))) { in htcp_ack_received()
217 if (htcp_data->alpha == 1 || in htcp_ack_received()
223 CCV(ccv, snd_cwnd) += htcp_data->alpha * in htcp_ack_received()
225 ccv->flags &= ~CCF_ABC_SENTAWND; in htcp_ack_received()
232 CCV(ccv, snd_cwnd) += (((htcp_data->alpha << in htcp_ack_received()
243 free(ccv->cc_data, M_CC_MEM); in htcp_cb_destroy()
257 INP_WLOCK_ASSERT(tptoinpcb(ccv->tp)); in htcp_cb_init()
266 htcp_data->alpha = HTCP_INIT_ALPHA; in htcp_cb_init()
267 htcp_data->beta = HTCP_MINBETA; in htcp_cb_init()
268 htcp_data->maxrtt = TCPTV_SRTTBASE; in htcp_cb_init()
269 htcp_data->minrtt = TCPTV_SRTTBASE; in htcp_cb_init()
270 htcp_data->prev_cwnd = 0; in htcp_cb_init()
271 htcp_data->t_last_cong = ticks; in htcp_cb_init()
273 ccv->cc_data = htcp_data; in htcp_cb_init()
287 htcp_data = ccv->cc_data; in htcp_cong_signal()
288 mss = tcp_fixed_maxseg(ccv->tp); in htcp_cong_signal()
299 htcp_data->maxrtt = (htcp_data->minrtt + in htcp_cong_signal()
300 (htcp_data->maxrtt - htcp_data->minrtt) * in htcp_cong_signal()
303 htcp_data->t_last_cong = ticks; in htcp_cong_signal()
304 htcp_data->prev_cwnd = CCV(ccv, snd_cwnd); in htcp_cong_signal()
316 htcp_data->maxrtt = (htcp_data->minrtt + (htcp_data->maxrtt - in htcp_cong_signal()
317 htcp_data->minrtt) * 95) / 100; in htcp_cong_signal()
320 htcp_data->t_last_cong = ticks; in htcp_cong_signal()
321 htcp_data->prev_cwnd = CCV(ccv, snd_cwnd); in htcp_cong_signal()
329 pipe = tcp_compute_pipe(ccv->tp); in htcp_cong_signal()
331 pipe = CCV(ccv, snd_max) - in htcp_cong_signal()
347 htcp_data->t_last_cong = ticks; in htcp_cong_signal()
374 uint32_t mss = tcp_fixed_maxseg(ccv->tp); in htcp_post_recovery()
377 htcp_data = ccv->cc_data; in htcp_post_recovery()
388 pipe = tcp_compute_pipe(ccv->tp); in htcp_post_recovery()
390 pipe = CCV(ccv, snd_max) - ccv->curack; in htcp_post_recovery()
394 * Ensure that cwnd down not collape to 1 MSS under in htcp_post_recovery()
399 CCV(ccv, snd_cwnd) = max(1, ((htcp_data->beta * in htcp_post_recovery()
400 htcp_data->prev_cwnd / mss) in htcp_post_recovery()
411 htcp_data = ccv->cc_data; in htcp_recalc_alpha()
418 * losses and restart alpha from scratch by setting t_last_cong = now - in htcp_recalc_alpha()
425 if (now < htcp_data->t_last_cong) in htcp_recalc_alpha()
426 htcp_data->t_last_cong = now - HTCP_DELTA_L; in htcp_recalc_alpha()
428 diff = now - htcp_data->t_last_cong - HTCP_DELTA_L; in htcp_recalc_alpha()
441 * 2 * (1 - beta) * alpha_raw in htcp_recalc_alpha()
444 alpha = max(1, (2 * ((1 << HTCP_SHIFT) - in htcp_recalc_alpha()
445 htcp_data->beta) * alpha) >> HTCP_SHIFT); in htcp_recalc_alpha()
448 * RTT scaling: (RTT / RTT_ref) * alpha in htcp_recalc_alpha()
455 (tcp_get_srtt(ccv->tp, TCP_TMR_GRANULARITY_TICKS) << HTCP_SHIFT) / in htcp_recalc_alpha()
462 htcp_data->alpha = alpha; in htcp_recalc_alpha()
471 htcp_data = ccv->cc_data; in htcp_recalc_beta()
479 if (V_htcp_adaptive_backoff && htcp_data->minrtt != TCPTV_SRTTBASE && in htcp_recalc_beta()
480 htcp_data->maxrtt != TCPTV_SRTTBASE) in htcp_recalc_beta()
481 htcp_data->beta = min(max(HTCP_MINBETA, in htcp_recalc_beta()
482 (htcp_data->minrtt << HTCP_SHIFT) / htcp_data->maxrtt), in htcp_recalc_beta()
485 htcp_data->beta = HTCP_MINBETA; in htcp_recalc_beta()
497 htcp_data = ccv->cc_data; in htcp_record_rtt()
506 if ((tcp_get_srtt(ccv->tp, TCP_TMR_GRANULARITY_TICKS) < htcp_data->minrtt || in htcp_record_rtt()
507 htcp_data->minrtt == TCPTV_SRTTBASE) && in htcp_record_rtt()
509 htcp_data->minrtt = tcp_get_srtt(ccv->tp, TCP_TMR_GRANULARITY_TICKS); in htcp_record_rtt()
515 if (tcp_get_srtt(ccv->tp, TCP_TMR_GRANULARITY_TICKS) > htcp_data->maxrtt in htcp_record_rtt()
517 htcp_data->maxrtt = tcp_get_srtt(ccv->tp, TCP_TMR_GRANULARITY_TICKS); in htcp_record_rtt()
528 htcp_data = ccv->cc_data; in htcp_ssthresh_update()
540 htcp_data->beta) >> HTCP_SHIFT; in htcp_ssthresh_update()
546 "H-TCP related settings");
549 "enable H-TCP adaptive backoff");
552 "enable H-TCP RTT scaling");