lsquic_cubic.h revision 5392f7a3
1/* Copyright (c) 2017 - 2019 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
9struct lsquic_conn;
10
11struct lsquic_cubic {
12    lsquic_time_t   cu_min_delay;
13    lsquic_time_t   cu_epoch_start;
14    double          cu_K;
15    unsigned long   cu_origin_point;
16    unsigned long   cu_last_max_cwnd;
17    unsigned long   cu_cwnd;
18    unsigned long   cu_tcp_cwnd;
19    unsigned long   cu_ssthresh;
20    const struct lsquic_conn
21                   *cu_conn;            /* Used for logging */
22    const struct lsquic_rtt_stats
23                   *cu_rtt_stats;
24    enum cubic_flags {
25        CU_TCP_FRIENDLY = (1 << 0),
26    }               cu_flags;
27    unsigned        cu_sampling_rate;
28    lsquic_time_t   cu_last_logged;
29};
30
31#define DEFAULT_CUBIC_FLAGS (CU_TCP_FRIENDLY)
32
33#define TCP_MSS 1460
34
35extern const struct cong_ctl_if lsquic_cong_cubic_if;
36
37void
38lsquic_cubic_set_flags (struct lsquic_cubic *cubic, enum cubic_flags flags);
39
40#endif
41