]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: mux-quic: provide a "show_sd" helper to output stream debugging info
authorWilly Tarreau <w@1wt.eu>
Fri, 2 Sep 2022 14:00:40 +0000 (16:00 +0200)
committerWilly Tarreau <w@1wt.eu>
Fri, 2 Sep 2022 14:43:25 +0000 (16:43 +0200)
It's very limited but at least provides the very basic info about QCS and
QCC when issuing "show sess all":

  scf=0x7fa9642394a0 flags=0x00000080 state=EST endp=CONN,0x7fa9642351f0,0x02001001 sub=3
>     qcs=0x7fa9642351f0 .flg=0x5 .id=396 .st=HCR .ctx=0x7fa9642353f0, .err=0
>     qcc=0x7fa96405ce20 .flg=0 .nbsc=100 .nbhreq=100, .task=0x7fa964054260
      co0=0x7fa96405cd50 ctrl=quic4 xprt=QUIC mux=QUIC data=STRM target=LISTENER:0x328c530
      flags=0x00200300 fd=-1 fd.state=00 updt=0 fd.tmask=0x0

It will need to be improved but it's better than nothing already. This
should be backported to 2.6 if the other dumps are backported.

src/mux_quic.c

index e29fa1ccd4eab0d345bd6b471b019a5b3f3067d2..c93a41500fd657fffd12f2258997a191cc3c1768 100644 (file)
@@ -2334,6 +2334,33 @@ static char *qcs_st_to_str(enum qcs_state st)
        }
 }
 
+/* for debugging with CLI's "show sess" command. May emit multiple lines, each
+ * new one being prefixed with <pfx>, if <pfx> is not NULL, otherwise a single
+ * line is used. Each field starts with a space so it's safe to print it after
+ * existing fields.
+ */
+static int qc_show_sd(struct buffer *msg, struct sedesc *sd, const char *pfx)
+{
+       struct qcs *qcs = sd->se;
+       struct qcc *qcc;
+       int ret = 0;
+
+       if (!qcs)
+               return ret;
+
+       chunk_appendf(msg, " qcs=%p .flg=%#x .id=%llu .st=%s .ctx=%p, .err=%#llx",
+                     qcs, qcs->flags, (ull)qcs->id, qcs_st_to_str(qcs->st), qcs->ctx, (ull)qcs->err);
+
+       if (pfx)
+               chunk_appendf(msg, "\n%s", pfx);
+
+       qcc = qcs->qcc;
+       chunk_appendf(msg, " qcc=%p .flg=%#x .nbsc=%llu .nbhreq=%llu, .task=%p",
+                     qcc, qcc->flags, (ull)qcc->nb_sc, (ull)qcc->nb_hreq, qcc->task);
+       return ret;
+}
+
+
 static void qmux_trace_frm(const struct quic_frame *frm)
 {
        switch (frm->type) {
@@ -2407,6 +2434,7 @@ static const struct mux_ops qc_ops = {
        .subscribe = qc_subscribe,
        .unsubscribe = qc_unsubscribe,
        .wake = qc_wake,
+       .show_sd = qc_show_sd,
        .flags = MX_FL_HTX|MX_FL_NO_UPG|MX_FL_FRAMED,
        .name = "QUIC",
 };