FreeBSD kernel IPv4 code
cc.c
Go to the documentation of this file.
1/*-
2 * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
3 *
4 * Copyright (c) 2007-2008
5 * Swinburne University of Technology, Melbourne, Australia.
6 * Copyright (c) 2009-2010 Lawrence Stewart <lstewart@freebsd.org>
7 * Copyright (c) 2010 The FreeBSD Foundation
8 * All rights reserved.
9 *
10 * This software was developed at the Centre for Advanced Internet
11 * Architectures, Swinburne University of Technology, by Lawrence Stewart and
12 * James Healy, made possible in part by a grant from the Cisco University
13 * Research Program Fund at Community Foundation Silicon Valley.
14 *
15 * Portions of this software were developed at the Centre for Advanced
16 * Internet Architectures, Swinburne University of Technology, Melbourne,
17 * Australia by David Hayes under sponsorship from the FreeBSD Foundation.
18 *
19 * Redistribution and use in source and binary forms, with or without
20 * modification, are permitted provided that the following conditions
21 * are met:
22 * 1. Redistributions of source code must retain the above copyright
23 * notice, this list of conditions and the following disclaimer.
24 * 2. Redistributions in binary form must reproduce the above copyright
25 * notice, this list of conditions and the following disclaimer in the
26 * documentation and/or other materials provided with the distribution.
27 *
28 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
29 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
30 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
31 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
32 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
33 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
34 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
35 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
36 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
37 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
38 * SUCH DAMAGE.
39 */
40
41/*
42 * This software was first released in 2007 by James Healy and Lawrence Stewart
43 * whilst working on the NewTCP research project at Swinburne University of
44 * Technology's Centre for Advanced Internet Architectures, Melbourne,
45 * Australia, which was made possible in part by a grant from the Cisco
46 * University Research Program Fund at Community Foundation Silicon Valley.
47 * More details are available at:
48 * http://caia.swin.edu.au/urp/newtcp/
49 */
50
51#include <sys/cdefs.h>
52__FBSDID("$FreeBSD$");
53#include <opt_cc.h>
54#include <sys/param.h>
55#include <sys/kernel.h>
56#include <sys/libkern.h>
57#include <sys/lock.h>
58#include <sys/malloc.h>
59#include <sys/module.h>
60#include <sys/mutex.h>
61#include <sys/queue.h>
62#include <sys/rwlock.h>
63#include <sys/sbuf.h>
64#include <sys/socket.h>
65#include <sys/socketvar.h>
66#include <sys/sysctl.h>
67
68#include <net/vnet.h>
69
70#include <netinet/in.h>
71#include <netinet/in_pcb.h>
72#include <netinet/tcp.h>
73#include <netinet/tcp_seq.h>
74#include <netinet/tcp_var.h>
75#include <netinet/tcp_log_buf.h>
76#include <netinet/tcp_hpts.h>
77#include <netinet/cc/cc.h>
79
80/*
81 * Have a sane default if no CC_DEFAULT is specified in the kernel config file.
82 */
83#ifndef CC_DEFAULT
84#define CC_DEFAULT "newreno"
85#endif
86
93
94MALLOC_DEFINE(M_CC_MEM, "CC Mem", "Congestion Control State memory");
95
96/*
97 * List of available cc algorithms on the current system. First element
98 * is used as the system default CC algorithm.
99 */
100struct cc_head cc_list = STAILQ_HEAD_INITIALIZER(cc_list);
101
102/* Protects the cc_list TAILQ. */
103struct rwlock cc_list_lock;
104
105VNET_DEFINE(struct cc_algo *, default_cc_ptr) = NULL;
106
107VNET_DEFINE(uint32_t, newreno_beta) = 50;
108#define V_newreno_beta VNET(newreno_beta)
109
110void
111cc_refer(struct cc_algo *algo)
112{
114 refcount_acquire(&algo->cc_refcount);
115}
116
117void
118cc_release(struct cc_algo *algo)
119{
121 refcount_release(&algo->cc_refcount);
122}
123
124
125void
126cc_attach(struct tcpcb *tp, struct cc_algo *algo)
127{
128 /*
129 * Attach the tcpcb to the algorithm.
130 */
132 CC_ALGO(tp) = algo;
133 cc_refer(algo);
135}
136
137void
138cc_detach(struct tcpcb *tp)
139{
140 struct cc_algo *algo;
141
143 algo = CC_ALGO(tp);
144 CC_ALGO(tp) = NULL;
145 cc_release(algo);
147}
148
149/*
150 * Sysctl handler to show and change the default CC algorithm.
151 */
152static int
153cc_default_algo(SYSCTL_HANDLER_ARGS)
154{
155 char default_cc[TCP_CA_NAME_MAX];
156 struct cc_algo *funcs;
157 int error;
158
159 /* Get the current default: */
161 if (CC_DEFAULT_ALGO() != NULL)
162 strlcpy(default_cc, CC_DEFAULT_ALGO()->name, sizeof(default_cc));
163 else
164 memset(default_cc, 0, TCP_CA_NAME_MAX);
166
167 error = sysctl_handle_string(oidp, default_cc, sizeof(default_cc), req);
168
169 /* Check for error or no change */
170 if (error != 0 || req->newptr == NULL)
171 goto done;
172
173 error = ESRCH;
174 /* Find algo with specified name and set it to default. */
176 STAILQ_FOREACH(funcs, &cc_list, entries) {
177 if (strncmp(default_cc, funcs->name, sizeof(default_cc)))
178 continue;
179 if (funcs->flags & CC_MODULE_BEING_REMOVED) {
180 /* Its being removed, its not eligible */
181 continue;
182 }
183 V_default_cc_ptr = funcs;
184 error = 0;
185 break;
186 }
188done:
189 return (error);
190}
191
192/*
193 * Sysctl handler to display the list of available CC algorithms.
194 */
195static int
196cc_list_available(SYSCTL_HANDLER_ARGS)
197{
198 struct cc_algo *algo;
199 int error, nalgos;
200 int linesz;
201 char *buffer, *cp;
202 size_t bufsz, outsz;
203
204 error = nalgos = 0;
206 STAILQ_FOREACH(algo, &cc_list, entries) {
207 nalgos++;
208 }
210 if (nalgos == 0) {
211 return (ENOENT);
212 }
213 bufsz = (nalgos+2) * ((TCP_CA_NAME_MAX + 13) + 1);
214 buffer = malloc(bufsz, M_TEMP, M_WAITOK);
215 cp = buffer;
216
217 linesz = snprintf(cp, bufsz, "\n%-16s%c %s\n", "CCmod", 'D',
218 "PCB count");
219 cp += linesz;
220 bufsz -= linesz;
221 outsz = linesz;
223 STAILQ_FOREACH(algo, &cc_list, entries) {
224 linesz = snprintf(cp, bufsz, "%-16s%c %u\n",
225 algo->name,
226 (algo == CC_DEFAULT_ALGO()) ? '*' : ' ',
227 algo->cc_refcount);
228 if (linesz >= bufsz) {
229 error = EOVERFLOW;
230 break;
231 }
232 cp += linesz;
233 bufsz -= linesz;
234 outsz += linesz;
235 }
237 if (error == 0)
238 error = sysctl_handle_string(oidp, buffer, outsz + 1, req);
239 free(buffer, M_TEMP);
240 return (error);
241}
242
243/*
244 * Return the number of times a proposed removal_cc is
245 * being used as the default.
246 */
247static int
248cc_check_default(struct cc_algo *remove_cc)
249{
250 int cnt = 0;
251 VNET_ITERATOR_DECL(vnet_iter);
252
254
255 VNET_LIST_RLOCK_NOSLEEP();
256 VNET_FOREACH(vnet_iter) {
257 CURVNET_SET(vnet_iter);
258 if ((CC_DEFAULT_ALGO() != NULL) &&
259 strncmp(CC_DEFAULT_ALGO()->name,
260 remove_cc->name,
261 TCP_CA_NAME_MAX) == 0) {
262 cnt++;
263 }
264 CURVNET_RESTORE();
265 }
266 VNET_LIST_RUNLOCK_NOSLEEP();
267 return (cnt);
268}
269
270/*
271 * Initialise CC subsystem on system boot.
272 */
273static void
275{
277 STAILQ_INIT(&cc_list);
278}
279
280/*
281 * Returns non-zero on success, 0 on failure.
282 */
283int
284cc_deregister_algo(struct cc_algo *remove_cc)
285{
286 struct cc_algo *funcs;
287 int found = 0;
288
289 /* Remove algo from cc_list so that new connections can't use it. */
291
292 /* This is unlikely to fail */
293 STAILQ_FOREACH(funcs, &cc_list, entries) {
294 if (funcs == remove_cc)
295 found = 1;
296 }
297 if (found == 0) {
298 /* Nothing to remove? */
300 return (ENOENT);
301 }
302 /* We assert it should have been MOD_QUIESCE'd */
303 KASSERT((remove_cc->flags & CC_MODULE_BEING_REMOVED),
304 ("remove_cc:%p does not have CC_MODULE_BEING_REMOVED flag", remove_cc));
305 if (cc_check_default(remove_cc)) {
307 return(EBUSY);
308 }
309 if (remove_cc->cc_refcount != 0) {
311 return (EBUSY);
312 }
313 STAILQ_REMOVE(&cc_list, remove_cc, cc_algo, entries);
315 return (0);
316}
317
318/*
319 * Returns 0 on success, non-zero on failure.
320 */
321int
323{
324 struct cc_algo *funcs;
325 int err;
326
327 err = 0;
328
329 /*
330 * Iterate over list of registered CC algorithms and make sure
331 * we're not trying to add a duplicate.
332 */
334 STAILQ_FOREACH(funcs, &cc_list, entries) {
335 if (funcs == add_cc ||
336 strncmp(funcs->name, add_cc->name,
337 TCP_CA_NAME_MAX) == 0) {
338 err = EEXIST;
339 break;
340 }
341 }
342 /* Init its reference count */
343 if (err == 0)
344 refcount_init(&add_cc->cc_refcount, 0);
345 /*
346 * The first loaded congestion control module will become
347 * the default until we find the "CC_DEFAULT" defined in
348 * the config (if we do).
349 */
350 if (!err) {
351 STAILQ_INSERT_TAIL(&cc_list, add_cc, entries);
352 if (strcmp(add_cc->name, CC_DEFAULT) == 0) {
353 V_default_cc_ptr = add_cc;
354 } else if (V_default_cc_ptr == NULL) {
355 V_default_cc_ptr = add_cc;
356 }
357 }
359
360 return (err);
361}
362
363static void
365{
366 struct cc_algo *cc;
367
368 if (IS_DEFAULT_VNET(curvnet))
369 return;
370
371 CURVNET_SET(vnet0);
372 cc = V_default_cc_ptr;
373 CURVNET_RESTORE();
374
375 V_default_cc_ptr = cc;
376}
377VNET_SYSINIT(vnet_cc_sysinit, SI_SUB_PROTO_IFATTACHDOMAIN, SI_ORDER_ANY,
378 vnet_cc_sysinit, NULL);
379
380/*
381 * Perform any necessary tasks before we exit congestion recovery.
382 */
383void
385{
386 int pipe;
387
388 if (IN_FASTRECOVERY(CCV(ccv, t_flags))) {
389 /*
390 * Fast recovery will conclude after returning from this
391 * function. Window inflation should have left us with
392 * approximately snd_ssthresh outstanding data. But in case we
393 * would be inclined to send a burst, better to do it via the
394 * slow start mechanism.
395 *
396 * XXXLAS: Find a way to do this without needing curack
397 */
399 pipe = tcp_compute_pipe(ccv->ccvc.tcp);
400 else
401 pipe = CCV(ccv, snd_max) - ccv->curack;
402 if (pipe < CCV(ccv, snd_ssthresh))
403 /*
404 * Ensure that cwnd does not collapse to 1 MSS under
405 * adverse conditions. Implements RFC6582
406 */
407 CCV(ccv, snd_cwnd) = max(pipe, CCV(ccv, t_maxseg)) +
408 CCV(ccv, t_maxseg);
409 else
410 CCV(ccv, snd_cwnd) = CCV(ccv, snd_ssthresh);
411 }
412}
413
414void
416{
417 uint32_t rw;
418 /*
419 * If we've been idle for more than one retransmit timeout the old
420 * congestion window is no longer current and we have to reduce it to
421 * the restart window before we can transmit again.
422 *
423 * The restart window is the initial window or the last CWND, whichever
424 * is smaller.
425 *
426 * This is done to prevent us from flooding the path with a full CWND at
427 * wirespeed, overloading router and switch buffers along the way.
428 *
429 * See RFC5681 Section 4.1. "Restarting Idle Connections".
430 *
431 * In addition, per RFC2861 Section 2, the ssthresh is set to the
432 * maximum of the former ssthresh or 3/4 of the old cwnd, to
433 * not exit slow-start prematurely.
434 */
436
437 CCV(ccv, snd_ssthresh) = max(CCV(ccv, snd_ssthresh),
438 CCV(ccv, snd_cwnd)-(CCV(ccv, snd_cwnd)>>2));
439
440 CCV(ccv, snd_cwnd) = min(rw, CCV(ccv, snd_cwnd));
441}
442
443/*
444 * Perform any necessary tasks before we enter congestion recovery.
445 */
446void
448{
449 uint32_t cwin, factor;
450 u_int mss;
451
452 cwin = CCV(ccv, snd_cwnd);
453 mss = tcp_fixed_maxseg(ccv->ccvc.tcp);
454 /*
455 * Other TCP congestion controls use newreno_cong_signal(), but
456 * with their own private cc_data. Make sure the cc_data is used
457 * correctly.
458 */
459 factor = V_newreno_beta;
460
461 /* Catch algos which mistakenly leak private signal types. */
462 KASSERT((type & CC_SIGPRIVMASK) == 0,
463 ("%s: congestion signal type 0x%08x is private\n", __func__, type));
464
465 cwin = max(((uint64_t)cwin * (uint64_t)factor) / (100ULL * (uint64_t)mss),
466 2) * mss;
467
468 switch (type) {
469 case CC_NDUPACK:
470 if (!IN_FASTRECOVERY(CCV(ccv, t_flags))) {
471 if (!IN_CONGRECOVERY(CCV(ccv, t_flags)))
472 CCV(ccv, snd_ssthresh) = cwin;
473 ENTER_RECOVERY(CCV(ccv, t_flags));
474 }
475 break;
476 case CC_ECN:
477 if (!IN_CONGRECOVERY(CCV(ccv, t_flags))) {
478 CCV(ccv, snd_ssthresh) = cwin;
479 CCV(ccv, snd_cwnd) = cwin;
480 ENTER_CONGRECOVERY(CCV(ccv, t_flags));
481 }
482 break;
483 case CC_RTO:
484 CCV(ccv, snd_ssthresh) = max(min(CCV(ccv, snd_wnd),
485 CCV(ccv, snd_cwnd)) / 2 / mss,
486 2) * mss;
487 CCV(ccv, snd_cwnd) = mss;
488 break;
489 }
490}
491
492void
494{
495 if (type == CC_ACK && !IN_RECOVERY(CCV(ccv, t_flags)) &&
496 (ccv->flags & CCF_CWND_LIMITED)) {
497 u_int cw = CCV(ccv, snd_cwnd);
498 u_int incr = CCV(ccv, t_maxseg);
499
500 /*
501 * Regular in-order ACK, open the congestion window.
502 * Method depends on which congestion control state we're
503 * in (slow start or cong avoid) and if ABC (RFC 3465) is
504 * enabled.
505 *
506 * slow start: cwnd <= ssthresh
507 * cong avoid: cwnd > ssthresh
508 *
509 * slow start and ABC (RFC 3465):
510 * Grow cwnd exponentially by the amount of data
511 * ACKed capping the max increment per ACK to
512 * (abc_l_var * maxseg) bytes.
513 *
514 * slow start without ABC (RFC 5681):
515 * Grow cwnd exponentially by maxseg per ACK.
516 *
517 * cong avoid and ABC (RFC 3465):
518 * Grow cwnd linearly by maxseg per RTT for each
519 * cwnd worth of ACKed data.
520 *
521 * cong avoid without ABC (RFC 5681):
522 * Grow cwnd linearly by approximately maxseg per RTT using
523 * maxseg^2 / cwnd per ACK as the increment.
524 * If cwnd > maxseg^2, fix the cwnd increment at 1 byte to
525 * avoid capping cwnd.
526 */
527 if (cw > CCV(ccv, snd_ssthresh)) {
528 if (V_tcp_do_rfc3465) {
529 if (ccv->flags & CCF_ABC_SENTAWND)
530 ccv->flags &= ~CCF_ABC_SENTAWND;
531 else
532 incr = 0;
533 } else
534 incr = max((incr * incr / cw), 1);
535 } else if (V_tcp_do_rfc3465) {
536 /*
537 * In slow-start with ABC enabled and no RTO in sight?
538 * (Must not use abc_l_var > 1 if slow starting after
539 * an RTO. On RTO, snd_nxt = snd_una, so the
540 * snd_nxt == snd_max check is sufficient to
541 * handle this).
542 *
543 * XXXLAS: Find a way to signal SS after RTO that
544 * doesn't rely on tcpcb vars.
545 */
546 uint16_t abc_val;
547
548 if (ccv->flags & CCF_USE_LOCAL_ABC)
549 abc_val = ccv->labc;
550 else
551 abc_val = V_tcp_abc_l_var;
552 if (CCV(ccv, snd_nxt) == CCV(ccv, snd_max))
553 incr = min(ccv->bytes_this_ack,
554 ccv->nsegs * abc_val *
555 CCV(ccv, t_maxseg));
556 else
557 incr = min(ccv->bytes_this_ack, CCV(ccv, t_maxseg));
558
559 }
560 /* ABC is on by default, so incr equals 0 frequently. */
561 if (incr > 0)
562 CCV(ccv, snd_cwnd) = min(cw + incr,
563 TCP_MAXWIN << CCV(ccv, snd_scale));
564 }
565}
566
567static int
569{
571 if (cc_check_default(algo)) {
572 /* A default cannot be removed */
574 return (EBUSY);
575 }
578 return (0);
579}
580
581/*
582 * Handles kld related events. Returns 0 on success, non-zero on failure.
583 */
584int
585cc_modevent(module_t mod, int event_type, void *data)
586{
587 struct cc_algo *algo;
588 int err;
589
590 err = 0;
591 algo = (struct cc_algo *)data;
592
593 switch(event_type) {
594 case MOD_LOAD:
595 if ((algo->cc_data_sz == NULL) && (algo->cb_init != NULL)) {
596 /*
597 * A module must have a cc_data_sz function
598 * even if it has no data it should return 0.
599 */
600 printf("Module Load Fails, it lacks a cc_data_sz() function but has a cb_init()!\n");
601 err = EINVAL;
602 break;
603 }
604 if (algo->mod_init != NULL)
605 err = algo->mod_init();
606 if (!err)
607 err = cc_register_algo(algo);
608 break;
609
610 case MOD_SHUTDOWN:
611 break;
612 case MOD_QUIESCE:
613 /* Stop any new assigments */
614 err = cc_stop_new_assignments(algo);
615 break;
616 case MOD_UNLOAD:
617 /*
618 * Deregister and remove the module from the list
619 */
621 /* Even with -f we can't unload if its the default */
622 if (cc_check_default(algo)) {
623 /* A default cannot be removed */
625 return (EBUSY);
626 }
627 /*
628 * If -f was used and users are still attached to
629 * the algorithm things are going to go boom.
630 */
631 err = cc_deregister_algo(algo);
632 if ((err == 0) && (algo->mod_destroy != NULL)) {
633 algo->mod_destroy();
634 }
635 break;
636 default:
637 err = EINVAL;
638 break;
639 }
640
641 return (err);
642}
643
644SYSINIT(cc, SI_SUB_PROTO_IFATTACHDOMAIN, SI_ORDER_FIRST, cc_init, NULL);
645
646/* Declare sysctl tree and populate it. */
647SYSCTL_NODE(_net_inet_tcp, OID_AUTO, cc, CTLFLAG_RW | CTLFLAG_MPSAFE, NULL,
648 "Congestion control related settings");
649
650SYSCTL_PROC(_net_inet_tcp_cc, OID_AUTO, algorithm,
651 CTLFLAG_VNET | CTLTYPE_STRING | CTLFLAG_RW | CTLFLAG_MPSAFE,
652 NULL, 0, cc_default_algo, "A",
653 "Default congestion control algorithm");
654
655SYSCTL_PROC(_net_inet_tcp_cc, OID_AUTO, available,
656 CTLTYPE_STRING | CTLFLAG_RD | CTLFLAG_MPSAFE,
657 NULL, 0, cc_list_available, "A",
658 "List available congestion control algorithms");
659
660SYSCTL_NODE(_net_inet_tcp_cc, OID_AUTO, hystartplusplus,
661 CTLFLAG_RW | CTLFLAG_MPSAFE, NULL,
662 "New Reno related HyStart++ settings");
663
664SYSCTL_UINT(_net_inet_tcp_cc_hystartplusplus, OID_AUTO, minrtt_thresh,
665 CTLFLAG_RW,
667 "HyStarts++ minimum RTT thresh used in clamp (in microseconds)");
668
669SYSCTL_UINT(_net_inet_tcp_cc_hystartplusplus, OID_AUTO, maxrtt_thresh,
670 CTLFLAG_RW,
671 &hystart_maxrtt_thresh, 16000,
672 "HyStarts++ maximum RTT thresh used in clamp (in microseconds)");
673
674SYSCTL_UINT(_net_inet_tcp_cc_hystartplusplus, OID_AUTO, n_rttsamples,
675 CTLFLAG_RW,
677 "The number of RTT samples that must be seen to consider HyStart++");
678
679SYSCTL_UINT(_net_inet_tcp_cc_hystartplusplus, OID_AUTO, css_growth_div,
680 CTLFLAG_RW,
682 "The divisor to the growth when in Hystart++ CSS");
683
684SYSCTL_UINT(_net_inet_tcp_cc_hystartplusplus, OID_AUTO, css_rounds,
685 CTLFLAG_RW,
687 "The number of rounds HyStart++ lasts in CSS before falling to CA");
688
689SYSCTL_UINT(_net_inet_tcp_cc_hystartplusplus, OID_AUTO, bblogs,
690 CTLFLAG_RW,
691 &hystart_bblogs, 0,
692 "Do we enable HyStart++ Black Box logs to be generated if BB logging is on");
693
694VNET_DEFINE(int, cc_do_abe) = 0;
695SYSCTL_INT(_net_inet_tcp_cc, OID_AUTO, abe, CTLFLAG_VNET | CTLFLAG_RW,
696 &VNET_NAME(cc_do_abe), 0,
697 "Enable draft-ietf-tcpm-alternativebackoff-ecn (TCP Alternative Backoff with ECN)");
698
699VNET_DEFINE(int, cc_abe_frlossreduce) = 0;
700SYSCTL_INT(_net_inet_tcp_cc, OID_AUTO, abe_frlossreduce, CTLFLAG_VNET | CTLFLAG_RW,
701 &VNET_NAME(cc_abe_frlossreduce), 0,
702 "Apply standard beta instead of ABE-beta during ECN-signalled congestion "
703 "recovery episodes if loss also needs to be repaired");
static int cc_check_default(struct cc_algo *remove_cc)
Definition: cc.c:248
static void vnet_cc_sysinit(void *arg)
Definition: cc.c:364
uint32_t hystart_css_growth_div
Definition: cc.c:90
int cc_modevent(module_t mod, int event_type, void *data)
Definition: cc.c:585
uint32_t hystart_maxrtt_thresh
Definition: cc.c:88
int cc_deregister_algo(struct cc_algo *remove_cc)
Definition: cc.c:284
VNET_SYSINIT(vnet_cc_sysinit, SI_SUB_PROTO_IFATTACHDOMAIN, SI_ORDER_ANY, vnet_cc_sysinit, NULL)
void cc_refer(struct cc_algo *algo)
Definition: cc.c:111
uint32_t hystart_css_rounds
Definition: cc.c:91
void newreno_cc_post_recovery(struct cc_var *ccv)
Definition: cc.c:384
void cc_attach(struct tcpcb *tp, struct cc_algo *algo)
Definition: cc.c:126
SYSCTL_UINT(_net_inet_tcp_cc_hystartplusplus, OID_AUTO, minrtt_thresh, CTLFLAG_RW, &hystart_minrtt_thresh, 4000, "HyStarts++ minimum RTT thresh used in clamp (in microseconds)")
#define V_newreno_beta
Definition: cc.c:108
VNET_DEFINE(struct cc_algo *, default_cc_ptr)
uint32_t hystart_bblogs
Definition: cc.c:92
struct cc_head cc_list
Definition: cc.c:100
int cc_register_algo(struct cc_algo *add_cc)
Definition: cc.c:322
uint32_t hystart_minrtt_thresh
Definition: cc.c:87
void newreno_cc_ack_received(struct cc_var *ccv, uint16_t type)
Definition: cc.c:493
static int cc_stop_new_assignments(struct cc_algo *algo)
Definition: cc.c:568
void newreno_cc_cong_signal(struct cc_var *ccv, uint32_t type)
Definition: cc.c:447
SYSCTL_NODE(_net_inet_tcp, OID_AUTO, cc, CTLFLAG_RW|CTLFLAG_MPSAFE, NULL, "Congestion control related settings")
SYSCTL_INT(_net_inet_tcp_cc, OID_AUTO, abe, CTLFLAG_VNET|CTLFLAG_RW, &VNET_NAME(cc_do_abe), 0, "Enable draft-ietf-tcpm-alternativebackoff-ecn (TCP Alternative Backoff with ECN)")
__FBSDID("$FreeBSD$")
SYSINIT(cc, SI_SUB_PROTO_IFATTACHDOMAIN, SI_ORDER_FIRST, cc_init, NULL)
struct rwlock cc_list_lock
Definition: cc.c:103
void cc_release(struct cc_algo *algo)
Definition: cc.c:118
uint32_t hystart_n_rttsamples
Definition: cc.c:89
#define CC_DEFAULT
Definition: cc.c:84
SYSCTL_PROC(_net_inet_tcp_cc, OID_AUTO, algorithm, CTLFLAG_VNET|CTLTYPE_STRING|CTLFLAG_RW|CTLFLAG_MPSAFE, NULL, 0, cc_default_algo, "A", "Default congestion control algorithm")
void newreno_cc_after_idle(struct cc_var *ccv)
Definition: cc.c:415
static int cc_list_available(SYSCTL_HANDLER_ARGS)
Definition: cc.c:196
static int cc_default_algo(SYSCTL_HANDLER_ARGS)
Definition: cc.c:153
MALLOC_DEFINE(M_CC_MEM, "CC Mem", "Congestion Control State memory")
void cc_detach(struct tcpcb *tp)
Definition: cc.c:138
static void cc_init(void)
Definition: cc.c:274
#define CC_NDUPACK
Definition: cc.h:137
#define CCF_CWND_LIMITED
Definition: cc.h:109
#define CC_LIST_WLOCK()
Definition: cc.h:223
#define CC_DEFAULT_ALGO()
Definition: cc.h:216
#define V_default_cc_ptr
Definition: cc.h:64
#define CC_LIST_LOCK_INIT()
Definition: cc.h:219
#define CC_LIST_RUNLOCK()
Definition: cc.h:222
#define CCF_USE_LOCAL_ABC
Definition: cc.h:110
#define CC_ECN
Definition: cc.h:134
#define CC_LIST_RLOCK()
Definition: cc.h:221
#define CC_ALGO(tp)
Definition: cc.h:210
#define CCF_ABC_SENTAWND
Definition: cc.h:108
#define CC_ACK
Definition: cc.h:123
#define CC_MODULE_BEING_REMOVED
Definition: cc.h:207
#define CC_SIGPRIVMASK
Definition: cc.h:139
#define CC_RTO
Definition: cc.h:135
#define CC_LIST_WUNLOCK()
Definition: cc.h:224
#define CC_LIST_LOCK_ASSERT()
Definition: cc.h:225
#define CCV(ccv, what)
Definition: cc_module.h:59
__uint32_t uint32_t
Definition: in.h:62
__uint16_t uint16_t
Definition: in.h:57
Definition: cc.h:146
u_int cc_refcount
Definition: cc.h:203
int(* mod_destroy)(void)
Definition: cc.h:153
uint8_t flags
Definition: cc.h:204
size_t(* cc_data_sz)(void)
Definition: cc.h:156
int(* mod_init)(void)
Definition: cc.h:150
char name[TCP_CA_NAME_MAX]
Definition: cc.h:147
int(* cb_init)(struct cc_var *ccv, void *ptr)
Definition: cc.h:167
Definition: cc.h:93
union cc_var::ccv_container ccvc
int bytes_this_ack
Definition: cc.h:95
uint8_t labc
Definition: cc.h:104
uint16_t nsegs
Definition: cc.h:103
tcp_seq curack
Definition: cc.h:96
uint32_t flags
Definition: cc.h:97
Definition: tcp_var.h:132
uint32_t tcp_compute_initwnd(uint32_t maxseg)
Definition: tcp_input.c:4049
int tcp_compute_pipe(struct tcpcb *tp)
Definition: tcp_input.c:4041
u_int tcp_maxseg(const struct tcpcb *tp)
Definition: tcp_subr.c:3538
u_int tcp_fixed_maxseg(const struct tcpcb *tp)
Definition: tcp_subr.c:3587
#define IN_CONGRECOVERY(t_flags)
Definition: tcp_var.h:534
#define IN_FASTRECOVERY(t_flags)
Definition: tcp_var.h:530
#define IN_RECOVERY(t_flags)
Definition: tcp_var.h:538
#define ENTER_RECOVERY(t_flags)
Definition: tcp_var.h:539
#define V_tcp_do_newsack
Definition: tcp_var.h:1045
#define V_tcp_do_rfc3465
Definition: tcp_var.h:1044
#define ENTER_CONGRECOVERY(t_flags)
Definition: tcp_var.h:535
#define V_tcp_abc_l_var
Definition: tcp_var.h:1031
struct tcpcb * tcp
Definition: cc.h:100