MINOR: quic: move global tune options into quic_tune
A new structure quic_tune has recently been defined. Its purpose is to store global options related to QUIC. Previously, only the tunable to toggle pacing was stored in it. This commit moves several QUIC related tunable from global to quic_tune structure. This better centralizes QUIC configuration option and gives room for future generic options.
This commit is contained in:
parent
119a79f479
commit
a71007c088
@ -79,14 +79,12 @@
|
||||
#define GTUNE_DISABLE_H2_WEBSOCKET (1<<21)
|
||||
#define GTUNE_DISABLE_ACTIVE_CLOSE (1<<22)
|
||||
#define GTUNE_QUICK_EXIT (1<<23)
|
||||
#define GTUNE_QUIC_SOCK_PER_CONN (1<<24)
|
||||
/* (1<<24) unused */
|
||||
#define GTUNE_NO_QUIC (1<<25)
|
||||
#define GTUNE_USE_FAST_FWD (1<<26)
|
||||
#define GTUNE_LISTENER_MQ_FAIR (1<<27)
|
||||
#define GTUNE_LISTENER_MQ_OPT (1<<28)
|
||||
#define GTUNE_LISTENER_MQ_ANY (GTUNE_LISTENER_MQ_FAIR | GTUNE_LISTENER_MQ_OPT)
|
||||
#define GTUNE_QUIC_CC_HYSTART (1<<29)
|
||||
#define GTUNE_QUIC_NO_UDP_GSO (1<<30)
|
||||
|
||||
/* subsystem-specific debugging options for tune.debug */
|
||||
#define GDBG_CPU_AFFINITY (1U<< 0)
|
||||
|
@ -7,6 +7,9 @@
|
||||
#endif
|
||||
|
||||
#define QUIC_TUNE_NO_PACING 0x00000001
|
||||
#define QUIC_TUNE_NO_UDP_GSO 0x00000002
|
||||
#define QUIC_TUNE_SOCK_PER_CONN 0x00000004
|
||||
#define QUIC_TUNE_CC_HYSTART 0x00000008
|
||||
|
||||
struct quic_tune {
|
||||
uint options;
|
||||
|
@ -212,10 +212,10 @@ static int cfg_parse_quic_tune_socket_owner(char **args, int section_type,
|
||||
return -1;
|
||||
|
||||
if (strcmp(args[1], "connection") == 0) {
|
||||
global.tune.options |= GTUNE_QUIC_SOCK_PER_CONN;
|
||||
quic_tune.options |= QUIC_TUNE_SOCK_PER_CONN;
|
||||
}
|
||||
else if (strcmp(args[1], "listener") == 0) {
|
||||
global.tune.options &= ~GTUNE_QUIC_SOCK_PER_CONN;
|
||||
quic_tune.options &= ~QUIC_TUNE_SOCK_PER_CONN;
|
||||
}
|
||||
else {
|
||||
memprintf(err, "'%s' expects either 'listener' or 'connection' but got '%s'.", args[0], args[1]);
|
||||
@ -357,7 +357,7 @@ static int cfg_parse_quic_tune_setting0(char **args, int section_type,
|
||||
quic_tune.options |= QUIC_TUNE_NO_PACING;
|
||||
}
|
||||
else if (strcmp(suffix, "disable-udp-gso") == 0) {
|
||||
global.tune.options |= GTUNE_QUIC_NO_UDP_GSO;
|
||||
quic_tune.options |= QUIC_TUNE_NO_UDP_GSO;
|
||||
}
|
||||
else {
|
||||
memprintf(err, "'%s' keyword unhandled (please report this bug).", args[0]);
|
||||
@ -397,9 +397,9 @@ static int cfg_parse_quic_tune_on_off(char **args, int section_type, struct prox
|
||||
}
|
||||
else if (strcmp(suffix, "cc-hystart") == 0) {
|
||||
if (on)
|
||||
global.tune.options |= GTUNE_QUIC_CC_HYSTART;
|
||||
quic_tune.options |= QUIC_TUNE_CC_HYSTART;
|
||||
else
|
||||
global.tune.options &= ~GTUNE_QUIC_CC_HYSTART;
|
||||
quic_tune.options &= ~QUIC_TUNE_CC_HYSTART;
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
@ -101,6 +101,7 @@
|
||||
#include <haproxy/openssl-compat.h>
|
||||
#include <haproxy/quic_conn.h>
|
||||
#include <haproxy/quic_tp-t.h>
|
||||
#include <haproxy/quic_tune.h>
|
||||
#include <haproxy/pattern.h>
|
||||
#include <haproxy/peers.h>
|
||||
#include <haproxy/pool.h>
|
||||
@ -1435,9 +1436,6 @@ static void init_args(int argc, char **argv)
|
||||
#endif
|
||||
#ifdef USE_THREAD
|
||||
global.tune.options |= GTUNE_IDLE_POOL_SHARED;
|
||||
#endif
|
||||
#ifdef USE_QUIC
|
||||
global.tune.options |= GTUNE_QUIC_SOCK_PER_CONN;
|
||||
#endif
|
||||
global.tune.options |= GTUNE_STRICT_LIMITS;
|
||||
|
||||
@ -1446,6 +1444,10 @@ static void init_args(int argc, char **argv)
|
||||
/* Use zero-copy forwarding by default */
|
||||
global.tune.no_zero_copy_fwd = 0;
|
||||
|
||||
#ifdef USE_QUIC
|
||||
quic_tune.options |= QUIC_TUNE_SOCK_PER_CONN;
|
||||
#endif
|
||||
|
||||
/* keep a copy of original arguments for the master process */
|
||||
old_argv = copy_argv(argc, argv);
|
||||
if (!old_argv) {
|
||||
|
@ -44,6 +44,7 @@
|
||||
#include <haproxy/proxy-t.h>
|
||||
#include <haproxy/quic_conn.h>
|
||||
#include <haproxy/quic_sock.h>
|
||||
#include <haproxy/quic_tune.h>
|
||||
#include <haproxy/sock.h>
|
||||
#include <haproxy/sock_inet.h>
|
||||
#include <haproxy/task.h>
|
||||
@ -802,7 +803,7 @@ static int quic_test_socketopts(void)
|
||||
int ret;
|
||||
|
||||
/* Check for connection socket-owner mode support. */
|
||||
if (global.tune.options & GTUNE_QUIC_SOCK_PER_CONN) {
|
||||
if (quic_tune.options & QUIC_TUNE_SOCK_PER_CONN) {
|
||||
ret = quic_test_conn_socket_owner();
|
||||
if (ret < 0) {
|
||||
goto err;
|
||||
@ -810,12 +811,12 @@ static int quic_test_socketopts(void)
|
||||
else if (!ret) {
|
||||
ha_diag_warning("Your platform does not seem to support UDP source address retrieval through IP_PKTINFO or an alternative flag. "
|
||||
"QUIC connections will use listener socket.\n");
|
||||
global.tune.options &= ~GTUNE_QUIC_SOCK_PER_CONN;
|
||||
quic_tune.options &= ~QUIC_TUNE_SOCK_PER_CONN;
|
||||
}
|
||||
}
|
||||
|
||||
/* Check for UDP GSO support. */
|
||||
if (!(global.tune.options & GTUNE_QUIC_NO_UDP_GSO)) {
|
||||
if (!(quic_tune.options & QUIC_TUNE_NO_UDP_GSO)) {
|
||||
ret = quic_test_gso();
|
||||
if (ret < 0) {
|
||||
goto err;
|
||||
@ -823,7 +824,7 @@ static int quic_test_socketopts(void)
|
||||
else if (!ret) {
|
||||
ha_diag_warning("Your platform does not support UDP GSO. "
|
||||
"This will be automatically disabled for QUIC transfer.\n");
|
||||
global.tune.options |= GTUNE_QUIC_NO_UDP_GSO;
|
||||
quic_tune.options |= QUIC_TUNE_NO_UDP_GSO;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2,6 +2,7 @@
|
||||
#include <haproxy/quic_cc.h>
|
||||
#include <haproxy/quic_cc_hystart.h>
|
||||
#include <haproxy/quic_trace.h>
|
||||
#include <haproxy/quic_tune.h>
|
||||
#include <haproxy/ticks.h>
|
||||
#include <haproxy/trace.h>
|
||||
|
||||
@ -102,7 +103,7 @@ static void quic_cc_cubic_reset(struct quic_cc *cc)
|
||||
c->last_w_max = 0;
|
||||
c->W_est = 0;
|
||||
c->recovery_start_time = 0;
|
||||
if (global.tune.options & GTUNE_QUIC_CC_HYSTART)
|
||||
if (quic_tune.options & QUIC_TUNE_CC_HYSTART)
|
||||
quic_cc_hystart_reset(&c->hystart);
|
||||
TRACE_LEAVE(QUIC_EV_CONN_CC, cc->qc);
|
||||
}
|
||||
@ -448,7 +449,7 @@ static void quic_cc_cubic_ss_cb(struct quic_cc *cc, struct quic_cc_event *ev)
|
||||
TRACE_PROTO("CC cubic", QUIC_EV_CONN_CC, cc->qc, ev);
|
||||
switch (ev->type) {
|
||||
case QUIC_CC_EVT_ACK:
|
||||
if (global.tune.options & GTUNE_QUIC_CC_HYSTART) {
|
||||
if (quic_tune.options & QUIC_TUNE_CC_HYSTART) {
|
||||
struct quic_hystart *h = &c->hystart;
|
||||
unsigned int acked = QUIC_MIN(ev->ack.acked, (uint64_t)HYSTART_LIMIT * path->mtu);
|
||||
|
||||
|
@ -60,6 +60,7 @@
|
||||
#include <haproxy/quic_token.h>
|
||||
#include <haproxy/quic_tp.h>
|
||||
#include <haproxy/quic_trace.h>
|
||||
#include <haproxy/quic_tune.h>
|
||||
#include <haproxy/quic_tx.h>
|
||||
#include <haproxy/cbuf.h>
|
||||
#include <haproxy/proto_quic.h>
|
||||
@ -1174,7 +1175,7 @@ struct quic_conn *qc_new_conn(const struct quic_version *qv, int ipv4,
|
||||
conn_id->qc = qc;
|
||||
|
||||
if (HA_ATOMIC_LOAD(&l->rx.quic_mode) == QUIC_SOCK_MODE_CONN &&
|
||||
(global.tune.options & GTUNE_QUIC_SOCK_PER_CONN) &&
|
||||
(quic_tune.options & QUIC_TUNE_SOCK_PER_CONN) &&
|
||||
is_addr(local_addr)) {
|
||||
TRACE_USER("Allocate a socket for QUIC connection", QUIC_EV_CONN_INIT, qc);
|
||||
qc_alloc_fd(qc, local_addr, peer_addr);
|
||||
|
@ -28,6 +28,7 @@
|
||||
#include <haproxy/quic_stream.h>
|
||||
#include <haproxy/quic_tls.h>
|
||||
#include <haproxy/quic_trace.h>
|
||||
#include <haproxy/quic_tune.h>
|
||||
#include <haproxy/ssl_sock-t.h>
|
||||
|
||||
DECLARE_POOL(pool_head_quic_tx_packet, "quic_tx_packet", sizeof(struct quic_tx_packet));
|
||||
@ -427,7 +428,7 @@ static int qc_send_ppkts(struct buffer *buf, struct ssl_sock_ctx *ctx)
|
||||
}
|
||||
qc->path->in_flight += pkt->in_flight_len;
|
||||
pkt->pktns->tx.in_flight += pkt->in_flight_len;
|
||||
if ((global.tune.options & GTUNE_QUIC_CC_HYSTART) && pkt->pktns == qc->apktns)
|
||||
if ((quic_tune.options & QUIC_TUNE_CC_HYSTART) && pkt->pktns == qc->apktns)
|
||||
cc->algo->hystart_start_round(cc, pkt->pn_node.key);
|
||||
if (pkt->in_flight_len)
|
||||
qc_set_timer(qc);
|
||||
@ -763,7 +764,7 @@ static int qc_prep_pkts(struct quic_conn *qc, struct buffer *buf,
|
||||
/* Everything sent. Continue within the same datagram. */
|
||||
prv_pkt = cur_pkt;
|
||||
}
|
||||
else if (!(global.tune.options & GTUNE_QUIC_NO_UDP_GSO) &&
|
||||
else if (!(quic_tune.options & QUIC_TUNE_NO_UDP_GSO) &&
|
||||
!(HA_ATOMIC_LOAD(&qc->li->flags) & LI_F_UDP_GSO_NOTSUPP) &&
|
||||
dglen == qc->path->mtu &&
|
||||
(char *)end < b_wrap(buf) &&
|
||||
|
Loading…
x
Reference in New Issue
Block a user