MINOR: mux-quic: account Rx data per stream

Add counters to measure Rx buffers usage per QCS. This reused the newly
defined bdata_ctr type already used for Tx accounting.

Note that for now, <tot> value of bdata_ctr is not used. This is because
it is not easy to account for data accross contiguous buffers.

These values are displayed both on log/traces and "show quic" output.
This commit is contained in:
Amaury Denoyelle 2025-03-24 11:27:27 +01:00
parent a1dc9070e7
commit 1ccede211c
3 changed files with 12 additions and 2 deletions

View File

@ -17,6 +17,7 @@
#include <haproxy/quic_frame-t.h>
#include <haproxy/quic_pacing-t.h>
#include <haproxy/quic_stream-t.h>
#include <haproxy/quic_utils-t.h>
#include <haproxy/stconn-t.h>
#include <haproxy/task-t.h>
#include <haproxy/time-t.h>
@ -157,6 +158,7 @@ struct qcs {
struct buffer app_buf; /* receive buffer used by stconn layer */
uint64_t msd; /* current max-stream-data limit to enforce */
uint64_t msd_base; /* max-stream-data previous to latest update */
struct bdata_ctr data; /* data utilization counter. Note that <tot> is now used for now as accounting may be difficult with ncbuf. */
} rx;
struct {
struct quic_fctl fc; /* stream flow control applied on sending */

View File

@ -67,6 +67,7 @@ static void qcs_free_rxbuf(struct qcs *qcs, struct qc_stream_rxbuf *rxbuf)
eb64_delete(&rxbuf->off_node);
pool_free(pool_head_qc_stream_rxbuf, rxbuf);
bdata_ctr_bdec(&qcs->rx.data);
}
/* Free <qcs> instance. This function is reserved for internal usage : it must
@ -177,6 +178,7 @@ static struct qcs *qcs_new(struct qcc *qcc, uint64_t id, enum qcs_type type)
qcs->rx.msd = qcc->lfctl.msd_uni_r;
}
qcs->rx.msd_base = 0;
bdata_ctr_init(&qcs->rx.data);
qcs->wait_event.tasklet = NULL;
qcs->wait_event.events = 0;
@ -1151,6 +1153,7 @@ static int qcs_transfer_rx_data(struct qcs *qcs, struct qc_stream_rxbuf *rxbuf)
b_free(&b_next);
offer_buffers(NULL, 1);
pool_free(pool_head_qc_stream_rxbuf, rxbuf_next);
bdata_ctr_bdec(&qcs->rx.data);
}
ret = 0;
@ -1723,6 +1726,7 @@ static struct qc_stream_rxbuf *qcs_get_rxbuf(struct qcs *qcs, uint64_t offset,
buf->off_node.key = aligned_off;
buf->off_end = aligned_off + qmux_stream_rx_bufsz();
eb64_insert(&qcs->rx.bufs, &buf->off_node);
bdata_ctr_binc(&qcs->rx.data);
}
ncbuf = &buf->ncb;
@ -4121,8 +4125,10 @@ void qcc_show_quic(struct qcc *qcc)
qcs, (ullong)qcs->id, qcs->flags,
qcs_st_to_str(qcs->st));
if (!quic_stream_is_uni(qcs->id) || !quic_stream_is_local(qcc, qcs->id))
if (!quic_stream_is_uni(qcs->id) || !quic_stream_is_local(qcc, qcs->id)) {
chunk_appendf(&trash, " rxb=%u(%u)", qcs->rx.data.bcnt, qcs->rx.data.bmax);
chunk_appendf(&trash, " rxoff=%llu", (ullong)qcs->rx.offset);
}
if (!quic_stream_is_uni(qcs->id) || !quic_stream_is_remote(qcc, qcs->id)) {
if (qcs->stream)

View File

@ -162,7 +162,9 @@ void qmux_dump_qcs_info(struct buffer *msg, const struct qcs *qcs)
chunk_appendf(msg, " qcs=%p .id=%llu .st=%s .flg=0x%04x", qcs, (ullong)qcs->id,
qcs_st_to_str(qcs->st), qcs->flags);
chunk_appendf(msg, " .rx=%llu/%llu", (ullong)qcs->rx.offset_max, (ullong)qcs->rx.msd);
chunk_appendf(msg, " .rx=%llu/%llu rxb=%u(%u)",
(ullong)qcs->rx.offset_max, (ullong)qcs->rx.msd,
qcs->rx.data.bcnt, qcs->rx.data.bmax);
chunk_appendf(msg, " .tx=%llu %llu/%llu", (ullong)qcs->tx.fc.off_soft,
(ullong)qcs->tx.fc.off_real,
(ullong)qcs->tx.fc.limit);