MEDIUM: quic: xprt traces rework
Add a least as much as possible TRACE_ENTER() and TRACE_LEAVE() calls
to any function. Note that some functions do not have any access to the
a quic_conn argument when receiving or parsing datagram at very low level.
diff --git a/src/quic_frame.c b/src/quic_frame.c
index 386c409..f590be2 100644
--- a/src/quic_frame.c
+++ b/src/quic_frame.c
@@ -279,7 +279,7 @@
ar = eb64_last(&tx_ack->arngs->root);
ar_node = eb64_entry(ar, struct quic_arng_node, first);
- TRACE_PROTO("ack range", QUIC_EV_CONN_PRSAFRM,
+ TRACE_DEVEL("ack range", QUIC_EV_CONN_PRSAFRM,
qc,, &ar_node->last, &ar_node->first.key);
if (!quic_enc_int(buf, end, ar_node->last) ||
!quic_enc_int(buf, end, tx_ack->ack_delay) ||
@@ -289,7 +289,7 @@
while ((prev_ar = eb64_prev(ar))) {
prev_ar_node = eb64_entry(prev_ar, struct quic_arng_node, first);
- TRACE_PROTO("ack range", QUIC_EV_CONN_PRSAFRM, qc,,
+ TRACE_DEVEL("ack range", QUIC_EV_CONN_PRSAFRM, qc,,
&prev_ar_node->last, &prev_ar_node->first.key);
if (!quic_enc_int(buf, end, ar_node->first.key - prev_ar_node->last - 2) ||
!quic_enc_int(buf, end, prev_ar_node->last - prev_ar_node->first.key))
@@ -1085,34 +1085,39 @@
const unsigned char **buf, const unsigned char *end,
struct quic_conn *qc)
{
+ int ret = 0;
const struct quic_frame_parser *parser;
+ TRACE_ENTER(QUIC_EV_CONN_PRSFRM, qc);
if (end <= *buf) {
TRACE_DEVEL("wrong frame", QUIC_EV_CONN_PRSFRM, qc);
- return 0;
+ goto leave;
}
frm->type = *(*buf)++;
if (frm->type >= QUIC_FT_MAX) {
TRACE_DEVEL("wrong frame type", QUIC_EV_CONN_PRSFRM, qc, frm);
- return 0;
+ goto leave;
}
parser = &quic_frame_parsers[frm->type];
if (!(parser->mask & (1U << pkt->type))) {
TRACE_DEVEL("unauthorized frame", QUIC_EV_CONN_PRSFRM, qc, frm);
- return 0;
+ goto leave;
}
TRACE_PROTO("frame", QUIC_EV_CONN_PRSFRM, qc, frm);
if (!parser->func(frm, qc, buf, end)) {
TRACE_DEVEL("parsing error", QUIC_EV_CONN_PRSFRM, qc, frm);
- return 0;
+ goto leave;
}
pkt->flags |= parser->flags;
- return 1;
+ ret = 1;
+ leave:
+ TRACE_LEAVE(QUIC_EV_CONN_PRSFRM, qc);
+ return ret;
}
/* Encode <frm> QUIC frame into <buf> buffer.
@@ -1122,29 +1127,34 @@
struct quic_frame *frm, struct quic_tx_packet *pkt,
struct quic_conn *qc)
{
+ int ret = 0;
const struct quic_frame_builder *builder;
+ TRACE_ENTER(QUIC_EV_CONN_BFRM, qc);
builder = &quic_frame_builders[frm->type];
if (!(builder->mask & (1U << pkt->type))) {
/* XXX This it a bug to send an unauthorized frame with such a packet type XXX */
- TRACE_DEVEL("frame skipped", QUIC_EV_CONN_BFRM, qc, frm);
+ TRACE_ERROR("unauthorized frame", QUIC_EV_CONN_BFRM, qc, frm);
BUG_ON(!(builder->mask & (1U << pkt->type)));
}
if (end <= *buf) {
TRACE_DEVEL("not enough room", QUIC_EV_CONN_BFRM, qc, frm);
- return 0;
+ goto leave;
}
TRACE_PROTO("frame", QUIC_EV_CONN_BFRM, qc, frm);
*(*buf)++ = frm->type;
if (!quic_frame_builders[frm->type].func(buf, end, frm, qc)) {
TRACE_DEVEL("frame building error", QUIC_EV_CONN_BFRM, qc, frm);
- return 0;
+ goto leave;
}
pkt->flags |= builder->flags;
- return 1;
+ ret = 1;
+ leave:
+ TRACE_LEAVE(QUIC_EV_CONN_BFRM, qc);
+ return ret;
}