From: Amaury Denoyelle Date: Wed, 31 Jul 2024 15:27:33 +0000 (+0200) Subject: MINOR: mux-quic: define dump functions for QCC and QCS X-Git-Tag: v3.1-dev5~34 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=eb4dfa3b36ae949d4a55782417af08f4689096f4;p=thirdparty%2Fhaproxy.git MINOR: mux-quic: define dump functions for QCC and QCS Extract trace code to dump QCC and QCS instances into dedicated functions named qmux_dump_qc{c,s}_info(). This will allow to easily print QCC/QCS infos outside of traces. --- diff --git a/include/haproxy/qmux_trace.h b/include/haproxy/qmux_trace.h index 49759a3b80..c8fdfde5df 100644 --- a/include/haproxy/qmux_trace.h +++ b/include/haproxy/qmux_trace.h @@ -4,8 +4,12 @@ #ifdef USE_QUIC #include +#include #include +struct qcc; +struct qcs; + extern struct trace_source trace_qmux; #define TRACE_SOURCE &trace_qmux @@ -68,6 +72,9 @@ struct qcs_build_stream_trace_arg { uint64_t offset; }; +void qmux_dump_qcc_info(struct buffer *msg, const struct qcc *qcc); +void qmux_dump_qcs_info(struct buffer *msg, const struct qcs *qcs); + #endif /* USE_QUIC */ #endif /* _HAPROXY_QMUX_TRACE_H */ diff --git a/src/qmux_trace.c b/src/qmux_trace.c index 254ebb0175..2cca6207d1 100644 --- a/src/qmux_trace.c +++ b/src/qmux_trace.c @@ -72,20 +72,10 @@ static void qmux_trace(enum trace_level level, uint64_t mask, return; if (src->verbosity > QMUX_VERB_CLEAN) { - chunk_appendf(&trace_buf, " : qcc=%p(F)", qcc); - if (qcc->conn->handle.qc) - chunk_appendf(&trace_buf, " qc=%p", qcc->conn->handle.qc); - - chunk_appendf(&trace_buf, " md=%llu/%llu", - (ullong)qcc->tx.fc.limit, (ullong)qcc->tx.fc.off_real); - - if (qcs) { - chunk_appendf(&trace_buf, " qcs=%p .id=%llu .st=%s", - qcs, (ullong)qcs->id, - qcs_st_to_str(qcs->st)); - chunk_appendf(&trace_buf, " msd=%llu/%llu", - (ullong)qcs->tx.fc.limit, (ullong)qcs->tx.fc.off_real); - } + qmux_dump_qcc_info(&trace_buf, qcc); + + if (qcs) + qmux_dump_qcs_info(&trace_buf, qcs); if (mask & QMUX_EV_QCC_NQCS) { const uint64_t *id = a3; @@ -112,3 +102,26 @@ static void qmux_trace(enum trace_level level, uint64_t mask, /* register qmux traces */ INITCALL1(STG_REGISTER, trace_register_source, TRACE_SOURCE); + +void qmux_dump_qcc_info(struct buffer *msg, const struct qcc *qcc) +{ + chunk_appendf(msg, " qcc=%p(F)", qcc); + if (qcc->conn->handle.qc) + chunk_appendf(msg, " qc=%p", qcc->conn->handle.qc); + chunk_appendf(msg, " .sc=%llu .hreq=%llu .flg=0x%04x", (ullong)qcc->nb_sc, (ullong)qcc->nb_hreq, qcc->flags); + + chunk_appendf(msg, " .tx=%llu %llu/%llu", (ullong)qcc->tx.fc.off_soft, + (ullong)qcc->tx.fc.off_real, + (ullong)qcc->tx.fc.limit); +} + +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, " .tx=%llu %llu/%llu", (ullong)qcs->tx.fc.off_soft, + (ullong)qcs->tx.fc.off_real, + (ullong)qcs->tx.fc.limit); +}