From: Frédéric Lécaille Date: Tue, 28 Nov 2023 13:02:17 +0000 (+0100) Subject: REORG: quic: Move qc_notify_send() to quic_conn X-Git-Tag: v2.9-dev12~51 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=714d1096bc5ab09ac0ab30c7371e2c8c594afda9;p=thirdparty%2Fhaproxy.git REORG: quic: Move qc_notify_send() to quic_conn Move qc_notify_send() from quic_tx.c to quic_conn.c. Note that it was already exported from both quic_conn.h and quic_tx.h. Modify this latter header to fix the duplication. --- diff --git a/include/haproxy/quic_tx.h b/include/haproxy/quic_tx.h index e556cce834..0659c14e36 100644 --- a/include/haproxy/quic_tx.h +++ b/include/haproxy/quic_tx.h @@ -37,7 +37,6 @@ int qc_prep_hpkts(struct quic_conn *qc, struct buffer *buf, struct list *qels); int qc_send_ppkts(struct buffer *buf, struct ssl_sock_ctx *ctx); int qc_send_app_pkts(struct quic_conn *qc, struct list *frms); int qc_dgrams_retransmit(struct quic_conn *qc); -int qc_notify_send(struct quic_conn *qc); void qc_prep_hdshk_fast_retrans(struct quic_conn *qc, struct list *ifrms, struct list *hfrms); int send_retry(int fd, struct sockaddr_storage *addr, diff --git a/src/quic_conn.c b/src/quic_conn.c index 9559eb4627..b5545976a2 100644 --- a/src/quic_conn.c +++ b/src/quic_conn.c @@ -1725,6 +1725,35 @@ int qc_check_dcid(struct quic_conn *qc, unsigned char *dcid, size_t dcid_len) return 0; } +/* Wake-up upper layer for sending if all conditions are met : + * - room in congestion window or probe packet to sent + * - socket FD ready to sent or listener socket used + * + * Returns 1 if upper layer has been woken up else 0. + */ +int qc_notify_send(struct quic_conn *qc) +{ + const struct quic_pktns *pktns = qc->apktns; + + if (qc->subs && qc->subs->events & SUB_RETRY_SEND) { + /* RFC 9002 7.5. Probe Timeout + * + * Probe packets MUST NOT be blocked by the congestion controller. + */ + if ((quic_cc_path_prep_data(qc->path) || pktns->tx.pto_probe) && + (!qc_test_fd(qc) || !fd_send_active(qc->fd))) { + tasklet_wakeup(qc->subs->tasklet); + qc->subs->events &= ~SUB_RETRY_SEND; + if (!qc->subs->events) + qc->subs = NULL; + + return 1; + } + } + + return 0; +} + /* Notify upper layer of a fatal error which forces to close the connection. */ void qc_notify_err(struct quic_conn *qc) { diff --git a/src/quic_tx.c b/src/quic_tx.c index 4af91b2a84..5ff9764a18 100644 --- a/src/quic_tx.c +++ b/src/quic_tx.c @@ -2581,36 +2581,6 @@ static struct quic_tx_packet *qc_build_pkt(unsigned char **pos, free_quic_tx_packet(qc, pkt); goto leave; } - -/* Wake-up upper layer for sending if all conditions are met : - * - room in congestion window or probe packet to sent - * - socket FD ready to sent or listener socket used - * - * Returns 1 if upper layer has been woken up else 0. - */ -int qc_notify_send(struct quic_conn *qc) -{ - const struct quic_pktns *pktns = qc->apktns; - - if (qc->subs && qc->subs->events & SUB_RETRY_SEND) { - /* RFC 9002 7.5. Probe Timeout - * - * Probe packets MUST NOT be blocked by the congestion controller. - */ - if ((quic_cc_path_prep_data(qc->path) || pktns->tx.pto_probe) && - (!qc_test_fd(qc) || !fd_send_active(qc->fd))) { - tasklet_wakeup(qc->subs->tasklet); - qc->subs->events &= ~SUB_RETRY_SEND; - if (!qc->subs->events) - qc->subs = NULL; - - return 1; - } - } - - return 0; -} - /* * Local variables: * c-indent-level: 8