cc_cubic.h (c968c769af8b01a628de146aecd5aa1f8788ceac) cc_cubic.h (a9696510f5caef4a7c525fcf4359597798829350)
1/*-
2 * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
3 *
4 * Copyright (c) 2008-2010 Lawrence Stewart <lstewart@freebsd.org>
5 * Copyright (c) 2010 The FreeBSD Foundation
6 * All rights reserved.
7 *
8 * This software was developed by Lawrence Stewart while studying at the Centre

--- 64 unchanged lines hidden (view full) ---

73#define CUBIC_MIN_RTT_SAMPLES 8
74
75/*
76 * (2^21)^3 is long max. Dividing (2^63) by Cubic_C_factor
77 * and taking cube-root yields 448845 as the effective useful limit
78 */
79#define CUBED_ROOT_MAX_ULONG 448845
80
1/*-
2 * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
3 *
4 * Copyright (c) 2008-2010 Lawrence Stewart <lstewart@freebsd.org>
5 * Copyright (c) 2010 The FreeBSD Foundation
6 * All rights reserved.
7 *
8 * This software was developed by Lawrence Stewart while studying at the Centre

--- 64 unchanged lines hidden (view full) ---

73#define CUBIC_MIN_RTT_SAMPLES 8
74
75/*
76 * (2^21)^3 is long max. Dividing (2^63) by Cubic_C_factor
77 * and taking cube-root yields 448845 as the effective useful limit
78 */
79#define CUBED_ROOT_MAX_ULONG 448845
80
81/* Flags used in the cubic structure */
82#define CUBICFLAG_CONG_EVENT 0x00000001 /* congestion experienced */
83#define CUBICFLAG_IN_SLOWSTART 0x00000002 /* in slow start */
84#define CUBICFLAG_IN_APPLIMIT 0x00000004 /* application limited */
85#define CUBICFLAG_RTO_EVENT 0x00000008 /* RTO experienced */
86#define CUBICFLAG_HYSTART_ENABLED 0x00000010 /* Hystart++ is enabled */
87#define CUBICFLAG_HYSTART_IN_CSS 0x00000020 /* We are in Hystart++ CSS */
88
89/* Kernel only bits */
90#ifdef _KERNEL
91struct cubic {
92 /* Cubic K in fixed point form with CUBIC_SHIFT worth of precision. */
93 int64_t K;
94 /* Sum of RTT samples across an epoch in ticks. */
95 int64_t sum_rtt_ticks;
96 /* cwnd at the most recent congestion event. */
97 unsigned long max_cwnd;
98 /* cwnd at the previous congestion event. */
99 unsigned long prev_max_cwnd;
100 /* A copy of prev_max_cwnd. Used for CC_RTO_ERR */
101 unsigned long prev_max_cwnd_cp;
102 /* various flags */
103 uint32_t flags;
104 /* Minimum observed rtt in ticks. */
105 int min_rtt_ticks;
106 /* Mean observed rtt between congestion epochs. */
107 int mean_rtt_ticks;
108 /* ACKs since last congestion event. */
109 int epoch_ack_count;
110 /* Timestamp (in ticks) of arriving in congestion avoidance from last
111 * congestion event.
112 */
113 int t_last_cong;
114 /* Timestamp (in ticks) of a previous congestion event. Used for
115 * CC_RTO_ERR.
116 */
117 int t_last_cong_prev;
118 uint32_t css_baseline_minrtt;
119 uint32_t css_current_round_minrtt;
120 uint32_t css_lastround_minrtt;
121 uint32_t css_rttsample_count;
122 uint32_t css_entered_at_round;
123 uint32_t css_current_round;
124 uint32_t css_fas_at_css_entry;
125 uint32_t css_lowrtt_fas;
126 uint32_t css_last_fas;
127};
128#endif
129
81/* Userland only bits. */
82#ifndef _KERNEL
83
84extern int hz;
85
86/*
87 * Implementation based on the formulae found in the CUBIC Internet Draft
88 * "draft-ietf-tcpm-cubic-04".

--- 161 unchanged lines hidden ---
130/* Userland only bits. */
131#ifndef _KERNEL
132
133extern int hz;
134
135/*
136 * Implementation based on the formulae found in the CUBIC Internet Draft
137 * "draft-ietf-tcpm-cubic-04".

--- 161 unchanged lines hidden ---