mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2026-04-04 10:31:01 +02:00
MINOR: mux-quic: use QMux transport parameters from qstrm xprt
Defines an API for xprt_qstrm so that the QMux transport parameters can be retrieved by the MUX layer on its initialization. This concerns both local and remote parameters. Functions xprt_qstrm_lparams/rparams() are defined and exported for this. They are both used in qmux_init() if QMux protocol is active.
This commit is contained in:
parent
3c42a7e9ac
commit
b26178396a
7
include/haproxy/xprt_qstrm.h
Normal file
7
include/haproxy/xprt_qstrm.h
Normal file
@ -0,0 +1,7 @@
|
||||
#ifndef _HAPROXY_XPRT_QSTRM_H
|
||||
#define _HAPROXY_XPRT_QSTRM_H
|
||||
|
||||
const struct quic_transport_params *xprt_qstrm_lparams(const void *context);
|
||||
const struct quic_transport_params *xprt_qstrm_rparams(const void *context);
|
||||
|
||||
#endif /* _HAPROXY_XPRT_QSTRM_H */
|
||||
@ -34,6 +34,7 @@
|
||||
#include <haproxy/stconn.h>
|
||||
#include <haproxy/time.h>
|
||||
#include <haproxy/trace.h>
|
||||
#include <haproxy/xprt_qstrm.h>
|
||||
#include <haproxy/xref.h>
|
||||
|
||||
DECLARE_TYPED_POOL(pool_head_qcc, "qcc", struct qcc);
|
||||
@ -3701,7 +3702,7 @@ static int qmux_init(struct connection *conn, struct proxy *prx,
|
||||
struct session *sess, struct buffer *input)
|
||||
{
|
||||
struct qcc *qcc;
|
||||
struct quic_transport_params *lparams, *rparams;
|
||||
const struct quic_transport_params *lparams, *rparams;
|
||||
void *conn_ctx = conn->ctx;
|
||||
|
||||
TRACE_ENTER(QMUX_EV_QCC_NEW);
|
||||
@ -3720,26 +3721,49 @@ static int qmux_init(struct connection *conn, struct proxy *prx,
|
||||
qcc->glitches = 0;
|
||||
qcc->err = quic_err_transport(QC_ERR_NO_ERROR);
|
||||
|
||||
/* Server parameters, params used for RX flow control. */
|
||||
lparams = &conn->handle.qc->rx.params;
|
||||
if (conn_is_quic(conn)) {
|
||||
/* Server parameters, params used for RX flow control. */
|
||||
lparams = &conn->handle.qc->rx.params;
|
||||
|
||||
qcc->lfctl.ms_bidi = qcc->lfctl.ms_bidi_init = lparams->initial_max_streams_bidi;
|
||||
qcc->lfctl.ms_uni = lparams->initial_max_streams_uni;
|
||||
qcc->lfctl.msd_bidi_l = lparams->initial_max_stream_data_bidi_local;
|
||||
qcc->lfctl.msd_bidi_r = lparams->initial_max_stream_data_bidi_remote;
|
||||
qcc->lfctl.msd_uni_r = lparams->initial_max_stream_data_uni;
|
||||
qcc->lfctl.cl_bidi_r = 0;
|
||||
qcc->lfctl.ms_bidi = qcc->lfctl.ms_bidi_init = lparams->initial_max_streams_bidi;
|
||||
qcc->lfctl.ms_uni = lparams->initial_max_streams_uni;
|
||||
qcc->lfctl.msd_bidi_l = lparams->initial_max_stream_data_bidi_local;
|
||||
qcc->lfctl.msd_bidi_r = lparams->initial_max_stream_data_bidi_remote;
|
||||
qcc->lfctl.msd_uni_r = lparams->initial_max_stream_data_uni;
|
||||
qcc->lfctl.cl_bidi_r = 0;
|
||||
|
||||
qcc->lfctl.md = qcc->lfctl.md_init = lparams->initial_max_data;
|
||||
qcc->lfctl.offsets_recv = qcc->lfctl.offsets_consume = 0;
|
||||
qcc->lfctl.md = qcc->lfctl.md_init = lparams->initial_max_data;
|
||||
qcc->lfctl.offsets_recv = qcc->lfctl.offsets_consume = 0;
|
||||
|
||||
rparams = &conn->handle.qc->tx.params;
|
||||
qfctl_init(&qcc->tx.fc, rparams->initial_max_data);
|
||||
qcc->rfctl.ms_uni = rparams->initial_max_streams_uni;
|
||||
qcc->rfctl.ms_bidi = rparams->initial_max_streams_bidi;
|
||||
qcc->rfctl.msd_bidi_l = rparams->initial_max_stream_data_bidi_local;
|
||||
qcc->rfctl.msd_bidi_r = rparams->initial_max_stream_data_bidi_remote;
|
||||
qcc->rfctl.msd_uni_l = rparams->initial_max_stream_data_uni;
|
||||
rparams = &conn->handle.qc->tx.params;
|
||||
qfctl_init(&qcc->tx.fc, rparams->initial_max_data);
|
||||
qcc->rfctl.ms_uni = rparams->initial_max_streams_uni;
|
||||
qcc->rfctl.ms_bidi = rparams->initial_max_streams_bidi;
|
||||
qcc->rfctl.msd_bidi_l = rparams->initial_max_stream_data_bidi_local;
|
||||
qcc->rfctl.msd_bidi_r = rparams->initial_max_stream_data_bidi_remote;
|
||||
qcc->rfctl.msd_uni_l = rparams->initial_max_stream_data_uni;
|
||||
}
|
||||
else {
|
||||
rparams = xprt_qstrm_rparams(conn->xprt_ctx);
|
||||
qfctl_init(&qcc->tx.fc, rparams->initial_max_data);
|
||||
|
||||
qcc->rfctl.ms_uni = rparams->initial_max_streams_uni;
|
||||
qcc->rfctl.ms_bidi = rparams->initial_max_streams_bidi;
|
||||
qcc->rfctl.msd_bidi_l = rparams->initial_max_stream_data_bidi_local;
|
||||
qcc->rfctl.msd_bidi_r = rparams->initial_max_stream_data_bidi_remote;
|
||||
qcc->rfctl.msd_uni_l = rparams->initial_max_stream_data_uni;
|
||||
|
||||
/* TODO */
|
||||
qcc->lfctl.ms_bidi = qcc->lfctl.ms_bidi_init = 16384;
|
||||
qcc->lfctl.ms_uni = 3;
|
||||
qcc->lfctl.msd_bidi_l = 16384;
|
||||
qcc->lfctl.msd_bidi_r = 16384;
|
||||
qcc->lfctl.msd_uni_r = 16384;
|
||||
qcc->lfctl.cl_bidi_r = 0;
|
||||
|
||||
qcc->lfctl.md = qcc->lfctl.md_init = 16384;
|
||||
qcc->lfctl.offsets_recv = qcc->lfctl.offsets_consume = 0;
|
||||
}
|
||||
|
||||
qcc->tx.buf_in_flight = 0;
|
||||
|
||||
|
||||
@ -22,6 +22,18 @@ struct xprt_qstrm_ctx {
|
||||
|
||||
DECLARE_STATIC_TYPED_POOL(xprt_qstrm_ctx_pool, "xprt_qstrm_ctx", struct xprt_qstrm_ctx);
|
||||
|
||||
const struct quic_transport_params *xprt_qstrm_lparams(const void *context)
|
||||
{
|
||||
const struct xprt_qstrm_ctx *ctx = context;
|
||||
return &ctx->lparams;
|
||||
}
|
||||
|
||||
const struct quic_transport_params *xprt_qstrm_rparams(const void *context)
|
||||
{
|
||||
const struct xprt_qstrm_ctx *ctx = context;
|
||||
return &ctx->rparams;
|
||||
}
|
||||
|
||||
int conn_recv_qstrm(struct connection *conn, struct xprt_qstrm_ctx *ctx, int flag)
|
||||
{
|
||||
struct quic_frame frm;
|
||||
@ -80,11 +92,7 @@ int conn_send_qstrm(struct connection *conn, struct xprt_qstrm_ctx *ctx, int fla
|
||||
goto fail;
|
||||
|
||||
frm.type = QUIC_FT_QX_TRANSPORT_PARAMETERS;
|
||||
frm.qmux_transport_params.params.initial_max_streams_bidi = 100;
|
||||
frm.qmux_transport_params.params.initial_max_streams_uni = 3;
|
||||
frm.qmux_transport_params.params.initial_max_stream_data_bidi_local = qmux_stream_rx_bufsz();
|
||||
frm.qmux_transport_params.params.initial_max_stream_data_bidi_remote = qmux_stream_rx_bufsz();
|
||||
frm.qmux_transport_params.params.initial_max_stream_data_uni = qmux_stream_rx_bufsz();
|
||||
frm.qmux_transport_params.params = ctx->lparams;
|
||||
|
||||
b_reset(&trash);
|
||||
old = pos = (unsigned char *)b_head(&trash);
|
||||
@ -187,6 +195,15 @@ static int xprt_qstrm_init(struct connection *conn, void **xprt_ctx)
|
||||
ctx->ctx_lower = NULL;
|
||||
ctx->ops_lower = NULL;
|
||||
|
||||
memset(&ctx->rparams, 0, sizeof(struct quic_transport_params));
|
||||
|
||||
/* TP configuration advertised by us */
|
||||
ctx->lparams.initial_max_streams_bidi = 100;
|
||||
ctx->lparams.initial_max_streams_uni = 3;
|
||||
ctx->lparams.initial_max_stream_data_bidi_local = qmux_stream_rx_bufsz();
|
||||
ctx->lparams.initial_max_stream_data_bidi_remote = qmux_stream_rx_bufsz();
|
||||
ctx->lparams.initial_max_stream_data_uni = qmux_stream_rx_bufsz();
|
||||
|
||||
*xprt_ctx = ctx;
|
||||
|
||||
return 0;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user