1a74702c6SGeorge Wang/* Copyright (c) 2017 - 2022 LiteSpeed Technologies Inc. See LICENSE. */ 250aadb33SDmitri Tikhonov/* 350aadb33SDmitri Tikhonov * lsquic_cubic.h -- CUBIC congestion control protocol. 450aadb33SDmitri Tikhonov */ 550aadb33SDmitri Tikhonov 650aadb33SDmitri Tikhonov#ifndef LSQUIC_CUBIC_H 750aadb33SDmitri Tikhonov#define LSQUIC_CUBIC_H 1 850aadb33SDmitri Tikhonov 9f07b3eaeSTyler Young#include "lsquic_shared_support.h" 10f07b3eaeSTyler Young 115392f7a3SLiteSpeed Techstruct lsquic_conn; 125392f7a3SLiteSpeed Tech 1350aadb33SDmitri Tikhonovstruct lsquic_cubic { 1450aadb33SDmitri Tikhonov lsquic_time_t cu_min_delay; 1550aadb33SDmitri Tikhonov lsquic_time_t cu_epoch_start; 16bfc7bfd8SDmitri Tikhonov double cu_K; 17bfc7bfd8SDmitri Tikhonov unsigned long cu_origin_point; 18bfc7bfd8SDmitri Tikhonov unsigned long cu_last_max_cwnd; 19bfc7bfd8SDmitri Tikhonov unsigned long cu_cwnd; 20bfc7bfd8SDmitri Tikhonov unsigned long cu_tcp_cwnd; 21bfc7bfd8SDmitri Tikhonov unsigned long cu_ssthresh; 225392f7a3SLiteSpeed Tech const struct lsquic_conn 235392f7a3SLiteSpeed Tech *cu_conn; /* Used for logging */ 245392f7a3SLiteSpeed Tech const struct lsquic_rtt_stats 255392f7a3SLiteSpeed Tech *cu_rtt_stats; 2650aadb33SDmitri Tikhonov enum cubic_flags { 2750aadb33SDmitri Tikhonov CU_TCP_FRIENDLY = (1 << 0), 2850aadb33SDmitri Tikhonov } cu_flags; 29bfc7bfd8SDmitri Tikhonov unsigned cu_sampling_rate; 3050aadb33SDmitri Tikhonov lsquic_time_t cu_last_logged; 3150aadb33SDmitri Tikhonov}; 3250aadb33SDmitri Tikhonov 33bfc7bfd8SDmitri Tikhonov#define DEFAULT_CUBIC_FLAGS (CU_TCP_FRIENDLY) 34bfc7bfd8SDmitri Tikhonov 35bfc7bfd8SDmitri Tikhonov#define TCP_MSS 1460 3650aadb33SDmitri Tikhonov 37f07b3eaeSTyler YoungLSQUIC_EXTERN const struct cong_ctl_if lsquic_cong_cubic_if; 3850aadb33SDmitri Tikhonov 3950aadb33SDmitri Tikhonovvoid 405392f7a3SLiteSpeed Techlsquic_cubic_set_flags (struct lsquic_cubic *cubic, enum cubic_flags flags); 4150aadb33SDmitri Tikhonov 4250aadb33SDmitri Tikhonov#endif 43