Frédéric Lécaille | a7e7ce9 | 2020-11-23 14:14:04 +0100 | [diff] [blame] | 1 | /* |
| 2 | * Congestion controller handling. |
| 3 | * |
| 4 | * This file contains definitions for QUIC congestion control. |
| 5 | * |
Willy Tarreau | 3dfb7da | 2022-03-02 22:33:39 +0100 | [diff] [blame] | 6 | * Copyright 2019 HAProxy Technologies, Frederic Lecaille <flecaille@haproxy.com> |
Frédéric Lécaille | a7e7ce9 | 2020-11-23 14:14:04 +0100 | [diff] [blame] | 7 | * |
| 8 | * This library is free software; you can redistribute it and/or |
| 9 | * modify it under the terms of the GNU Lesser General Public |
| 10 | * License as published by the Free Software Foundation, version 2.1 |
| 11 | * exclusively. |
| 12 | * |
| 13 | * This library is distributed in the hope that it will be useful, |
| 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 16 | * Lesser General Public License for more details. |
| 17 | * |
| 18 | * You should have received a copy of the GNU Lesser General Public |
| 19 | * License along with this library; if not, write to the Free Software |
| 20 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
| 21 | */ |
| 22 | |
| 23 | #include <haproxy/buf.h> |
| 24 | #include <haproxy/quic_cc-t.h> |
| 25 | #include <haproxy/xprt_quic-t.h> |
| 26 | |
| 27 | |
Frédéric Lécaille | 1c9c2f6 | 2022-06-01 15:06:58 +0200 | [diff] [blame] | 28 | struct quic_cc_algo *default_quic_cc_algo = &quic_cc_algo_cubic; |
Frédéric Lécaille | a7e7ce9 | 2020-11-23 14:14:04 +0100 | [diff] [blame] | 29 | |
| 30 | /* |
| 31 | * Initialize <cc> congestion control with <algo> as algorithm depending on <ipv4> |
| 32 | * a boolean which is true for an IPv4 path. |
| 33 | */ |
| 34 | void quic_cc_init(struct quic_cc *cc, |
| 35 | struct quic_cc_algo *algo, struct quic_conn *qc) |
| 36 | { |
| 37 | cc->qc = qc; |
| 38 | cc->algo = algo; |
| 39 | if (cc->algo->init) |
| 40 | (cc->algo->init(cc)); |
| 41 | } |
| 42 | |
| 43 | /* Send <ev> event to <cc> congestion controller. */ |
| 44 | void quic_cc_event(struct quic_cc *cc, struct quic_cc_event *ev) |
| 45 | { |
| 46 | cc->algo->event(cc, ev); |
| 47 | } |
| 48 | |
| 49 | void quic_cc_state_trace(struct buffer *buf, const struct quic_cc *cc) |
| 50 | { |
| 51 | cc->algo->state_trace(buf, cc); |
| 52 | } |