Changeset View
Changeset View
Standalone View
Standalone View
sys/netinet/cc/cc_cubic.h
Show All 36 Lines | |||||
*/ | */ | ||||
#ifndef _NETINET_CC_CUBIC_H_ | #ifndef _NETINET_CC_CUBIC_H_ | ||||
#define _NETINET_CC_CUBIC_H_ | #define _NETINET_CC_CUBIC_H_ | ||||
/* Number of bits of precision for fixed point math calcs. */ | /* Number of bits of precision for fixed point math calcs. */ | ||||
#define CUBIC_SHIFT 8 | #define CUBIC_SHIFT 8 | ||||
#define CUBIC_SCALE (1<<CUBIC_SHIFT) | |||||
#define CUBIC_SHIFT_4 32 | #define CUBIC_SHIFT_4 32 | ||||
/* 0.5 << CUBIC_SHIFT. */ | /* 0.5 << CUBIC_SHIFT. */ | ||||
#define RENO_BETA 128 | #define RENO_BETA 128 | ||||
/* ~0.8 << CUBIC_SHIFT. */ | /* ~0.8 << CUBIC_SHIFT. */ | ||||
#define CUBIC_BETA 204 | #define CUBIC_BETA 204 | ||||
▲ Show 20 Lines • Show All 165 Lines • ▼ Show 20 Lines | |||||
*/ | */ | ||||
static __inline unsigned long | static __inline unsigned long | ||||
tf_cwnd(int ticks_since_cong, int rtt_ticks, unsigned long wmax, | tf_cwnd(int ticks_since_cong, int rtt_ticks, unsigned long wmax, | ||||
uint32_t smss) | uint32_t smss) | ||||
{ | { | ||||
/* Equation 4 of I-D. */ | /* Equation 4 of I-D. */ | ||||
return (((wmax * CUBIC_BETA) + (((THREE_X_PT2 * ticks_since_cong * | return (((wmax * CUBIC_BETA) + (((THREE_X_PT2 * ticks_since_cong * | ||||
smss) << CUBIC_SHIFT) / TWO_SUB_PT2 / rtt_ticks)) >> CUBIC_SHIFT); | smss) << CUBIC_SHIFT) / (TWO_SUB_PT2 * rtt_ticks))) >> CUBIC_SHIFT); | ||||
} | } | ||||
#endif /* _NETINET_CC_CUBIC_H_ */ | #endif /* _NETINET_CC_CUBIC_H_ */ |