]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: mux-quic: define dump functions for QCC and QCS
authorAmaury Denoyelle <adenoyelle@haproxy.com>
Wed, 31 Jul 2024 15:27:33 +0000 (17:27 +0200)
committerAmaury Denoyelle <adenoyelle@haproxy.com>
Wed, 7 Aug 2024 13:40:52 +0000 (15:40 +0200)
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.

include/haproxy/qmux_trace.h
src/qmux_trace.c

index 49759a3b80bfe7d1c89df594f832e6856995841f..c8fdfde5df8c2d30ddd91a18d7a1e5d120a7d9af 100644 (file)
@@ -4,8 +4,12 @@
 #ifdef USE_QUIC
 
 #include <haproxy/api-t.h>
+#include <haproxy/buf.h>
 #include <haproxy/trace.h>
 
+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 */
index 254ebb0175d45c06ce9ac1c436f12fd108211cc0..2cca6207d1a32ce8645b2769e6914870b69d94a9 100644 (file)
@@ -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);
+}