Lines Matching +full:1 +full:- +full:based
1 /*-
2 * SPDX-License-Identifier: BSD-2-Clause
4 * Copyright (c) 2009-2010
6 * Copyright (c) 2010-2011 The FreeBSD Foundation
21 * 1. Redistributions of source code must retain the above copyright
41 * An implementation of the CAIA-Hamilton delay based congestion control
42 * algorithm, based on "Improved coexistence and loss tolerance for delay based
45 * 11-14 October 2010.
84 * Private signal type for rate based congestion signal.
85 * See <netinet/cc.h> for appropriate bit-range to use for private signals.
102 * Shadow window - keeps track of what the NewReno congestion window
103 * would have been if delay-based cwnd backoffs had not been made. This
104 * functionality aids coexistence with loss-based TCP flows which may be
109 * Loss-based TCP compatibility flag - When set, it turns on the shadow
123 VNET_DEFINE_STATIC(uint32_t, chd_loss_fair) = 1;
124 VNET_DEFINE_STATIC(uint32_t, chd_use_max) = 1;
150 uint32_t mss = tcp_fixed_maxseg(ccv->tp);
153 win -= max((win / 2), 1);
158 * Probabilistic backoff function. Returns 1 if we should backoff or 0
169 chd_data->loss_compete = 0;
171 (V_chd_qthresh - V_chd_qmin)) *
172 (qdly - V_chd_qmin);
176 (maxqdly - V_chd_qthresh)) *
177 (maxqdly - qdly);
179 chd_data->loss_compete = 1;
182 chd_data->loss_compete = 0;
194 uint32_t mss = tcp_fixed_maxseg(ccv->tp);
196 chd_data = ccv->cc_data;
202 /* In slow-start with ABC enabled. */
205 incr = min(ccv->bytes_this_ack,
209 incr = min(ccv->bytes_this_ack, mss);
216 if (ccv->flags & CCF_ABC_SENTAWND) {
217 ccv->flags &= ~CCF_ABC_SENTAWND;
224 if (chd_data->shadow_w > 0) {
226 chd_data->shadow_w = min(chd_data->shadow_w + incr,
235 * All ACK signals are used for timing measurements to determine delay-based
247 chd_data = ccv->cc_data;
248 new_measurement = e_t->flags & ERTT_NEW_MEASUREMENT;
251 chd_data->maxrtt_in_rtt = imax(e_t->rtt, chd_data->maxrtt_in_rtt);
256 * is delay based congestion.
258 rtt = V_chd_use_max ? chd_data->maxrtt_in_rtt : e_t->rtt;
259 chd_data->maxrtt_in_rtt = 0;
261 if (rtt && e_t->minrtt && !IN_RECOVERY(CCV(ccv, t_flags))) {
262 qdly = rtt - e_t->minrtt;
265 * Probabilistic delay based congestion
269 e_t->maxrtt - e_t->minrtt, chd_data);
271 chd_data->loss_compete = 0;
274 e_t->flags &= ~ERTT_NEW_MEASUREMENT;
279 * Update shadow_w before delay based backoff.
281 if (chd_data->loss_compete ||
282 qdly > chd_data->prev_backoff_qdly) {
286 * loss based flows.
288 chd_data->shadow_w = max(CCV(ccv, snd_cwnd),
289 chd_data->shadow_w);
293 * not competing with loss based flows at the moment.
295 chd_data->shadow_w = 0;
298 chd_data->prev_backoff_qdly = qdly;
300 * Send delay-based congestion signal to the congestion signal
312 free(ccv->cc_data, M_CC_MEM);
326 INP_WLOCK_ASSERT(tptoinpcb(ccv->tp));
334 chd_data->shadow_w = 0;
335 ccv->cc_data = chd_data;
348 chd_data = ccv->cc_data;
349 qdly = imax(e_t->rtt, chd_data->maxrtt_in_rtt) - e_t->minrtt;
364 * than qthresh, assume that we are competing with loss based
369 if (chd_data->loss_compete) {
371 chd_data->shadow_w);
383 if (chd_data->shadow_w > 0) {
384 uint32_t mss = tcp_fixed_maxseg(ccv->tp);
385 chd_data->shadow_w = max(chd_data->shadow_w /
402 chd_data = ccv->cc_data;
403 chd_data->prev_backoff_qdly = 0;
404 chd_data->maxrtt_in_rtt = 0;
405 chd_data->loss_compete = 0;
408 * competing with loss based flows from the start.
410 chd_data->shadow_w = CCV(ccv, snd_cwnd);
433 if (error == 0 && req->newptr != NULL) {
434 if (new > 1)
451 if (error == 0 && req->newptr != NULL) {
469 if (error == 0 && req->newptr != NULL) {
481 "CAIA Hamilton delay-based congestion control related settings");
485 &VNET_NAME(chd_loss_fair), 1, &chd_loss_fair_handler,
503 CTLFLAG_VNET | CTLFLAG_RW, &VNET_NAME(chd_use_max), 1,
509 MODULE_DEPEND(chd, ertt, 1, 1, 1);