MINOR: mux-quic: implement MAX_DATA emission

This commit is similar to the previous one but deals with MAX_DATA for
connection-level data flow control. It uses the same function
qcc_consume_qcs() to update flow control level and generate a MAX_DATA
frame if needed.
This commit is contained in:
Amaury Denoyelle 2022-05-16 16:19:59 +02:00
parent a977355aa1
commit c830e1e904
2 changed files with 22 additions and 0 deletions

View File

@ -56,6 +56,10 @@ struct qcc {
uint64_t msd_bidi_l; /* initial max-stream-data on local streams */
uint64_t msd_bidi_r; /* initial max-stream-data on remote streams */
uint64_t cl_bidi_r; /* total count of closed remote bidi stream since last MAX_STREAMS emission */
uint64_t md; /* current max-data allowed for the peer */
uint64_t md_init; /* initial max-data */
uint64_t sent_offsets; /* sum of all offsets received */
} lfctl;
/* flow-control fields set by the peer which we must respect. */

View File

@ -314,6 +314,21 @@ void qcs_consume(struct qcs *qcs, uint64_t bytes)
LIST_APPEND(&qcc->lfctl.frms, &frm->list);
tasklet_wakeup(qcc->wait_event.tasklet);
}
qcc->lfctl.sent_offsets += bytes;
if (qcc->lfctl.md - qcc->lfctl.sent_offsets < qcc->lfctl.md_init / 2) {
frm = pool_zalloc(pool_head_quic_frame);
BUG_ON(!frm); /* TODO handle this properly */
qcc->lfctl.md = qcc->lfctl.sent_offsets + qcc->lfctl.md_init;
LIST_INIT(&frm->reflist);
frm->type = QUIC_FT_MAX_DATA;
frm->max_data.max_data = qcc->lfctl.md;
LIST_APPEND(&qcs->qcc->lfctl.frms, &frm->list);
tasklet_wakeup(qcs->qcc->wait_event.tasklet);
}
}
/* Retrieve as an ebtree node the stream with <id> as ID, possibly allocates
@ -1249,6 +1264,9 @@ static int qc_init(struct connection *conn, struct proxy *prx,
qcc->lfctl.msd_bidi_r = lparams->initial_max_stream_data_bidi_remote;
qcc->lfctl.cl_bidi_r = 0;
qcc->lfctl.md = qcc->lfctl.md_init = lparams->initial_max_data;
qcc->lfctl.sent_offsets = 0;
rparams = &conn->handle.qc->tx.params;
qcc->rfctl.md = rparams->initial_max_data;
qcc->rfctl.msd_bidi_l = rparams->initial_max_stream_data_bidi_local;