1/* Copyright (c) 2017 - 2022 LiteSpeed Technologies Inc.  See LICENSE. */
2/*
3 * lsquic_cubic.h -- CUBIC congestion control protocol.
4 */
5
6#ifndef LSQUIC_CUBIC_H
7#define LSQUIC_CUBIC_H 1
8
9#include "lsquic_shared_support.h"
10
11struct lsquic_conn;
12
13struct lsquic_cubic {
14    lsquic_time_t   cu_min_delay;
15    lsquic_time_t   cu_epoch_start;
16    double          cu_K;
17    unsigned long   cu_origin_point;
18    unsigned long   cu_last_max_cwnd;
19    unsigned long   cu_cwnd;
20    unsigned long   cu_tcp_cwnd;
21    unsigned long   cu_ssthresh;
22    const struct lsquic_conn
23                   *cu_conn;            /* Used for logging */
24    const struct lsquic_rtt_stats
25                   *cu_rtt_stats;
26    enum cubic_flags {
27        CU_TCP_FRIENDLY = (1 << 0),
28    }               cu_flags;
29    unsigned        cu_sampling_rate;
30    lsquic_time_t   cu_last_logged;
31};
32
33#define DEFAULT_CUBIC_FLAGS (CU_TCP_FRIENDLY)
34
35#define TCP_MSS 1460
36
37LSQUIC_EXTERN const struct cong_ctl_if lsquic_cong_cubic_if;
38
39void
40lsquic_cubic_set_flags (struct lsquic_cubic *cubic, enum cubic_flags flags);
41
42#endif
43