#include <haproxy/buf-t.h>
#include <haproxy/list-t.h>
+#include <haproxy/quic_utils-t.h>
/* A QUIC STREAM buffer used for Tx.
*
uint64_t ack_offset; /* last acknowledged offset */
struct eb_root buf_tree; /* list of active and released buffers */
+ struct bdata_ctr data; /* data utilization counter */
int flags; /* QC_SD_FL_* values */
--- /dev/null
+#ifndef _HAPROXY_QUIC_UTILS_T_H
+#define _HAPROXY_QUIC_UTILS_T_H
+
+#ifdef USE_QUIC
+
+#include <haproxy/api-t.h>
+
+/* Counter which can be used to measure data amount accross several buffers. */
+struct bdata_ctr {
+ uint64_t tot; /* sum of data present in all underlying buffers */
+ uint8_t bcnt; /* current number of allocated underlying buffers */
+ uint8_t bmax; /* max number of allocated buffers during stream lifetime */
+};
+
+#endif /* USE_QUIC */
+
+#endif /* _HAPROXY_QUIC_UTILS_T_H */
--- /dev/null
+#ifndef _HAPROXY_QUIC_UTILS_H
+#define _HAPROXY_QUIC_UTILS_H
+
+#ifdef USE_QUIC
+
+#include <haproxy/quic_utils-t.h>
+
+#include <haproxy/buf-t.h>
+#include <haproxy/chunk.h>
+
+static inline void bdata_ctr_init(struct bdata_ctr *ctr)
+{
+ ctr->tot = 0;
+ ctr->bcnt = 0;
+ ctr->bmax = 0;
+}
+
+static inline void bdata_ctr_binc(struct bdata_ctr *ctr)
+{
+ ++ctr->bcnt;
+ ctr->bmax = MAX(ctr->bcnt, ctr->bmax);
+}
+
+static inline void bdata_ctr_bdec(struct bdata_ctr *ctr)
+{
+ --ctr->bcnt;
+}
+
+static inline void bdata_ctr_add(struct bdata_ctr *ctr, size_t data)
+{
+ ctr->tot += data;
+}
+
+static inline void bdata_ctr_del(struct bdata_ctr *ctr, size_t data)
+{
+ ctr->tot -= data;
+}
+
+static inline void bdata_ctr_print(struct buffer *chunk,
+ const struct bdata_ctr *ctr,
+ const char *prefix)
+{
+ chunk_appendf(chunk, " %s%d(%d)/%llu",
+ prefix, ctr->bcnt, ctr->bmax, (ullong)ctr->tot);
+}
+
+#endif /* USE_QUIC */
+
+#endif /* _HAPROXY_QUIC_UTILS_H */
#include <haproxy/quic_tp-t.h>
#include <haproxy/quic_tune.h>
#include <haproxy/quic_tx.h>
+#include <haproxy/quic_utils.h>
#include <haproxy/session.h>
#include <haproxy/ssl_sock-t.h>
#include <haproxy/stconn.h>
if (count) {
qfctl_sinc(&qcc->tx.fc, count);
qfctl_sinc(&qcs->tx.fc, count);
+ bdata_ctr_add(&qcs->stream->data, count);
}
TRACE_LEAVE(QMUX_EV_QCS_SEND, qcc->conn, qcs);
chunk_appendf(&trash, " qcs=0x%p id=%llu flags=0x%x st=%s",
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))
chunk_appendf(&trash, " rxoff=%llu", (ullong)qcs->rx.offset);
- if (!quic_stream_is_uni(qcs->id) || !quic_stream_is_remote(qcc, qcs->id))
+
+ if (!quic_stream_is_uni(qcs->id) || !quic_stream_is_remote(qcc, qcs->id)) {
+ if (qcs->stream)
+ bdata_ctr_print(&trash, &qcs->stream->data, "txb=");
chunk_appendf(&trash, " txoff=%llu(%llu) msd=%llu",
(ullong)qcs->tx.fc.off_real,
(ullong)qcs->tx.fc.off_soft - (ullong)qcs->tx.fc.off_real,
(ullong)qcs->tx.fc.limit);
+ }
chunk_appendf(&trash, "\n");
node = eb64_next(node);
}
#include <haproxy/mux_quic.h>
#include <haproxy/quic_conn-t.h>
#include <haproxy/quic_frame-t.h>
+#include <haproxy/quic_utils.h>
/* trace source and events */
static void qmux_trace(enum trace_level level, uint64_t mask,
(ullong)qcs->tx.fc.off_real,
(ullong)qcs->tx.fc.limit);
+ if (qcs->stream)
+ bdata_ctr_print(msg, &qcs->stream->data, " buf=");
+
chunk_appendf(msg, " .ti=%u/%u/%u",
tot_time_read(&qcs->timer.base),
tot_time_read(&qcs->timer.buf),
#include <haproxy/mux_quic.h>
#include <haproxy/pool.h>
#include <haproxy/quic_conn.h>
+#include <haproxy/quic_utils.h>
#include <haproxy/task.h>
DECLARE_STATIC_POOL(pool_head_quic_stream_desc, "qc_stream_desc",
pool_free(pool_head_sbuf, buf->area);
}
else {
+ bdata_ctr_del(&stream->data, b_data(buf));
+ bdata_ctr_bdec(&stream->data);
b_free(buf);
offer_buffers(NULL, 1);
}
stream->buf = NULL;
stream->buf_tree = EB_ROOT_UNIQUE;
stream->buf_offset = 0;
+ bdata_ctr_init(&stream->data);
stream->ack_offset = 0;
stream->flags = 0;
diff = offset + len - stream->ack_offset;
b_del(&buf->buf, diff);
stream->ack_offset += diff;
+ bdata_ctr_del(&stream->data, diff);
/* notify room from acked data if buffer has been released. */
if (stream->notify_room && qc_stream_buf_is_released(buf, stream)) {
}
eb64_insert(&stream->buf_tree, &stream->buf->offset_node);
+ bdata_ctr_binc(&stream->data);
return &stream->buf->buf;
}