From: Amaury Denoyelle Date: Mon, 24 Mar 2025 10:27:27 +0000 (+0100) Subject: MINOR: mux-quic: account Rx data per stream X-Git-Tag: v3.2-dev16~33 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=1ccede211c1361c0465191daa3659b3648f5f4e5;p=thirdparty%2Fhaproxy.git 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, 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. --- diff --git a/include/haproxy/mux_quic-t.h b/include/haproxy/mux_quic-t.h index 1c7c19a32..6ce9adfe2 100644 --- a/include/haproxy/mux_quic-t.h +++ b/include/haproxy/mux_quic-t.h @@ -17,6 +17,7 @@ #include #include #include +#include #include #include #include @@ -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 is now used for now as accounting may be difficult with ncbuf. */ } rx; struct { struct quic_fctl fc; /* stream flow control applied on sending */ diff --git a/src/mux_quic.c b/src/mux_quic.c index 6a0b31897..b335eaecf 100644 --- a/src/mux_quic.c +++ b/src/mux_quic.c @@ -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 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) diff --git a/src/qmux_trace.c b/src/qmux_trace.c index 649af8efe..272564739 100644 --- a/src/qmux_trace.c +++ b/src/qmux_trace.c @@ -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);