41#ifndef _NETINET_CC_CUBIC_H_
42#define _NETINET_CC_CUBIC_H_
44#include <sys/limits.h>
49#define CUBIC_SHIFT_4 32
58#define ONE_SUB_CUBIC_BETA 77
61#define THREE_X_PT3 231
64#define TWO_SUB_PT3 435
67#define CUBIC_C_FACTOR 102
70#define CUBIC_FC_FACTOR 217
73#define CUBIC_MIN_RTT_SAMPLES 8
79#define CUBED_ROOT_MAX_ULONG 448845
82#define CUBICFLAG_CONG_EVENT 0x00000001
83#define CUBICFLAG_IN_SLOWSTART 0x00000002
84#define CUBICFLAG_IN_APPLIMIT 0x00000004
85#define CUBICFLAG_RTO_EVENT 0x00000008
86#define CUBICFLAG_HYSTART_ENABLED 0x00000010
87#define CUBICFLAG_HYSTART_IN_CSS 0x00000020
142theoretical_cubic_k(
double wmax_pkts)
148 return (pow((wmax_pkts * 0.3) / C, (1.0 / 3.0)) * pow(2,
CUBIC_SHIFT));
151static __inline
unsigned long
152theoretical_cubic_cwnd(
int ticks_since_cong,
unsigned long wmax,
uint32_t smss)
157 wmax_pkts = wmax / (double)smss;
159 return (smss * (wmax_pkts +
160 (C * pow(ticks_since_cong / (
double)hz -
161 theoretical_cubic_k(wmax_pkts) / pow(2,
CUBIC_SHIFT), 3.0))));
164static __inline
unsigned long
165theoretical_reno_cwnd(
int ticks_since_cong,
int rtt_ticks,
unsigned long wmax,
169 return ((wmax * 0.5) + ((ticks_since_cong / (
float)rtt_ticks) * smss));
172static __inline
unsigned long
173theoretical_tf_cwnd(
int ticks_since_cong,
int rtt_ticks,
unsigned long wmax,
177 return ((wmax * 0.7) + ((3 * 0.3) / (2 - 0.3) *
178 (ticks_since_cong / (
float)rtt_ticks) * smss));
188static __inline int64_t
224static __inline
unsigned long
232 cwnd = (((int64_t)ticks_since_cong <<
CUBIC_SHIFT) - (K * hz)) / hz;
240 cwnd *= (cwnd * cwnd);
254 return (lmax(0,cwnd));
265static __inline
unsigned long
266reno_cwnd(
int ticks_since_cong,
int rtt_ticks,
unsigned long wmax,
275 return (((wmax *
RENO_BETA) + (((ticks_since_cong * smss)
286static __inline
unsigned long
287tf_cwnd(
int ticks_since_cong,
int rtt_ticks,
unsigned long wmax,
static __inline int64_t cubic_k(unsigned long wmax_pkts)
static __inline unsigned long reno_cwnd(int ticks_since_cong, int rtt_ticks, unsigned long wmax, uint32_t smss)
static __inline unsigned long cubic_cwnd(int ticks_since_cong, unsigned long wmax, uint32_t smss, int64_t K)
#define CUBED_ROOT_MAX_ULONG
static __inline unsigned long tf_cwnd(int ticks_since_cong, int rtt_ticks, unsigned long wmax, uint32_t smss)
#define ONE_SUB_CUBIC_BETA
uint32_t css_lastround_minrtt
uint32_t css_baseline_minrtt
unsigned long prev_max_cwnd_cp
uint32_t css_current_round_minrtt
unsigned long prev_max_cwnd
uint32_t css_rttsample_count
uint32_t css_fas_at_css_entry
uint32_t css_entered_at_round
uint32_t css_current_round