diff --git a/include/haproxy/global-t.h b/include/haproxy/global-t.h index 40b5a65b7..922277695 100644 --- a/include/haproxy/global-t.h +++ b/include/haproxy/global-t.h @@ -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) diff --git a/include/haproxy/quic_tune-t.h b/include/haproxy/quic_tune-t.h index 7d083c589..04bd38b66 100644 --- a/include/haproxy/quic_tune-t.h +++ b/include/haproxy/quic_tune-t.h @@ -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; diff --git a/src/cfgparse-quic.c b/src/cfgparse-quic.c index a1621967c..b2551d8b6 100644 --- a/src/cfgparse-quic.c +++ b/src/cfgparse-quic.c @@ -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; diff --git a/src/haproxy.c b/src/haproxy.c index dd02a096a..1a7182811 100644 --- a/src/haproxy.c +++ b/src/haproxy.c @@ -101,6 +101,7 @@ #include #include #include +#include #include #include #include @@ -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) { diff --git a/src/proto_quic.c b/src/proto_quic.c index 7790571de..26b2fda99 100644 --- a/src/proto_quic.c +++ b/src/proto_quic.c @@ -44,6 +44,7 @@ #include #include #include +#include #include #include #include @@ -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; } } diff --git a/src/quic_cc_cubic.c b/src/quic_cc_cubic.c index 8d7b85434..96d91efa7 100644 --- a/src/quic_cc_cubic.c +++ b/src/quic_cc_cubic.c @@ -2,6 +2,7 @@ #include #include #include +#include #include #include @@ -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); diff --git a/src/quic_conn.c b/src/quic_conn.c index d135afc60..77f28a4f2 100644 --- a/src/quic_conn.c +++ b/src/quic_conn.c @@ -60,6 +60,7 @@ #include #include #include +#include #include #include #include @@ -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); diff --git a/src/quic_tx.c b/src/quic_tx.c index 1ac8b0d92..06f851b4d 100644 --- a/src/quic_tx.c +++ b/src/quic_tx.c @@ -28,6 +28,7 @@ #include #include #include +#include #include 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) &&