MINOR: mux-quic: define globally stream rxbuf size

QCS uses ncbuf for STREAM data storage. This serves as a limit for
maximum STREAM buffering capacity, advertised via QUIC transport
parameters for initial flow-control values.

Define a new function qmux_stream_rx_bufsz() which can be used to
retrieve this Rx buffer size. This can be used both in MUX/H3 layers and
in QUIC transport parameters.
This commit is contained in:
Amaury Denoyelle 2025-02-26 11:27:42 +01:00
parent 7dd1eec2b1
commit 4b1e63d191
4 changed files with 11 additions and 9 deletions

View File

@ -112,9 +112,6 @@ struct qcc {
void *ctx; /* Application layer context */
};
/* Maximum size of stream Rx buffer. */
#define QC_S_RX_BUF_SZ (global.tune.bufsize - NCB_RESERVED_SZ)
/* QUIC stream states
*
* On initialization a stream is put on idle state. It is opened as soon as

View File

@ -46,6 +46,11 @@ int qcc_recv_max_stream_data(struct qcc *qcc, uint64_t id, uint64_t max);
int qcc_recv_reset_stream(struct qcc *qcc, uint64_t id, uint64_t err, uint64_t final_size);
int qcc_recv_stop_sending(struct qcc *qcc, uint64_t id, uint64_t err);
static inline int qmux_stream_rx_bufsz(void)
{
return global.tune.bufsize - NCB_RESERVED_SZ;
}
/* Bit shift to get the stream sub ID for internal use which is obtained
* shifting the stream IDs by this value, knowing that the
* QCS_ID_TYPE_SHIFT less significant bits identify the stream ID

View File

@ -1380,7 +1380,7 @@ static ssize_t h3_rcv_buf(struct qcs *qcs, struct buffer *b, int fin)
* SETTINGS_MAX_FIELD_SECTION_SIZE parameter to prevent
* excessive decompressed size.
*/
if (flen > QC_S_RX_BUF_SZ) {
if (flen > qmux_stream_rx_bufsz()) {
TRACE_ERROR("received a too big frame", H3_EV_RX_FRAME, qcs->qcc->conn, qcs);
qcc_set_error(qcs->qcc, H3_ERR_EXCESSIVE_LOAD, 1);
qcc_report_glitch(qcs->qcc, 1);

View File

@ -46,7 +46,7 @@ static void quic_dflt_transport_params_cpy(struct quic_transport_params *dst)
*/
void quic_transport_params_init(struct quic_transport_params *p, int server)
{
const uint64_t ncb_size = global.tune.bufsize - NCB_RESERVED_SZ;
const uint64_t stream_rx_bufsz = qmux_stream_rx_bufsz();
const int max_streams_bidi = global.tune.quic_frontend_max_streams_bidi;
const int max_streams_uni = 3;
@ -64,10 +64,10 @@ void quic_transport_params_init(struct quic_transport_params *p, int server)
p->initial_max_streams_bidi = max_streams_bidi;
p->initial_max_streams_uni = max_streams_uni;
p->initial_max_stream_data_bidi_local = ncb_size;
p->initial_max_stream_data_bidi_remote = ncb_size;
p->initial_max_stream_data_uni = ncb_size;
p->initial_max_data = (max_streams_bidi + max_streams_uni) * ncb_size;
p->initial_max_stream_data_bidi_local = stream_rx_bufsz;
p->initial_max_stream_data_bidi_remote = stream_rx_bufsz;
p->initial_max_stream_data_uni = stream_rx_bufsz;
p->initial_max_data = (max_streams_bidi + max_streams_uni) * stream_rx_bufsz;
if (server) {
p->with_stateless_reset_token = 1;