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.
(cherry picked from commit a8b2f843d2
)
Signed-off-by: Willy Tarreau <w@1wt.eu>
This commit is contained in:
parent
2f6f992255
commit
402bdb2c7d
@ -182,7 +182,7 @@ enum quic_pkt_type {
|
||||
#define QUIC_EV_CONN_LPKT (1ULL << 6)
|
||||
#define QUIC_EV_CONN_SPKT (1ULL << 7)
|
||||
#define QUIC_EV_CONN_ENCPKT (1ULL << 8)
|
||||
#define QUIC_EV_CONN_HPKT (1ULL << 9)
|
||||
#define QUIC_EV_CONN_TXPKT (1ULL << 9)
|
||||
#define QUIC_EV_CONN_PAPKT (1ULL << 10)
|
||||
#define QUIC_EV_CONN_PAPKTS (1ULL << 11)
|
||||
#define QUIC_EV_CONN_IO_CB (1ULL << 12)
|
||||
@ -195,7 +195,7 @@ enum quic_pkt_type {
|
||||
#define QUIC_EV_CONN_PHPKTS (1ULL << 19)
|
||||
#define QUIC_EV_CONN_TRMHP (1ULL << 20)
|
||||
#define QUIC_EV_CONN_ELRMHP (1ULL << 21)
|
||||
#define QUIC_EV_CONN_ELRXPKTS (1ULL << 22)
|
||||
#define QUIC_EV_CONN_RXPKT (1ULL << 22)
|
||||
#define QUIC_EV_CONN_SSLDATA (1ULL << 23)
|
||||
#define QUIC_EV_CONN_RXCDATA (1ULL << 24)
|
||||
#define QUIC_EV_CONN_ADDDATA (1ULL << 25)
|
||||
@ -218,6 +218,8 @@ enum quic_pkt_type {
|
||||
#define QUIC_EV_CONN_FRMLIST (1ULL << 42)
|
||||
#define QUIC_EV_STATELESS_RST (1ULL << 43)
|
||||
#define QUIC_EV_TRANSP_PARAMS (1ULL << 44)
|
||||
#define QUIC_EV_CONN_IDLE_TIMER (1ULL << 45)
|
||||
#define QUIC_EV_CONN_SUB (1ULL << 46)
|
||||
|
||||
/* Similar to kernel min()/max() definitions. */
|
||||
#define QUIC_MIN(a, b) ({ \
|
||||
|
@ -279,7 +279,7 @@ static int quic_build_ack_frame(unsigned char **buf, const unsigned char *end,
|
||||
|
||||
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 @@ static int quic_build_ack_frame(unsigned char **buf, const unsigned char *end,
|
||||
|
||||
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 @@ int qc_parse_frm(struct quic_frame *frm, struct quic_rx_packet *pkt,
|
||||
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 @@ int qc_build_frm(unsigned char **buf, const unsigned char *end,
|
||||
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;
|
||||
}
|
||||
|
||||
|
@ -17,7 +17,9 @@ void quic_loss_srtt_update(struct quic_loss *ql,
|
||||
unsigned int rtt, unsigned int ack_delay,
|
||||
struct quic_conn *qc)
|
||||
{
|
||||
TRACE_PROTO("Loss info update", QUIC_EV_CONN_RTTUPDT, qc, &rtt, &ack_delay, ql);
|
||||
TRACE_ENTER(QUIC_EV_CONN_RTTUPDT, qc);
|
||||
TRACE_DEVEL("Loss info update", QUIC_EV_CONN_RTTUPDT, qc, &rtt, &ack_delay, ql);
|
||||
|
||||
ql->latest_rtt = rtt;
|
||||
if (!ql->rtt_min) {
|
||||
/* No previous measurement. */
|
||||
@ -41,7 +43,9 @@ void quic_loss_srtt_update(struct quic_loss *ql,
|
||||
/* 8*srtt = 7*srtt + rtt */
|
||||
ql->srtt += rtt - (ql->srtt >> 3);
|
||||
}
|
||||
TRACE_PROTO("Loss info update", QUIC_EV_CONN_RTTUPDT, qc,,, ql);
|
||||
|
||||
TRACE_DEVEL("Loss info update", QUIC_EV_CONN_RTTUPDT, qc,,, ql);
|
||||
TRACE_LEAVE(QUIC_EV_CONN_RTTUPDT, qc);
|
||||
}
|
||||
|
||||
/* Returns for <qc> QUIC connection the first packet number space which
|
||||
@ -53,15 +57,19 @@ struct quic_pktns *quic_loss_pktns(struct quic_conn *qc)
|
||||
enum quic_tls_pktns i;
|
||||
struct quic_pktns *pktns;
|
||||
|
||||
TRACE_ENTER(QUIC_EV_CONN_SPTO, qc);
|
||||
|
||||
pktns = &qc->pktns[QUIC_TLS_PKTNS_INITIAL];
|
||||
TRACE_PROTO("pktns", QUIC_EV_CONN_SPTO, qc, pktns);
|
||||
TRACE_DEVEL("pktns", QUIC_EV_CONN_SPTO, qc, pktns);
|
||||
for (i = QUIC_TLS_PKTNS_HANDSHAKE; i < QUIC_TLS_PKTNS_MAX; i++) {
|
||||
TRACE_PROTO("pktns", QUIC_EV_CONN_SPTO, qc, &qc->pktns[i]);
|
||||
TRACE_DEVEL("pktns", QUIC_EV_CONN_SPTO, qc, &qc->pktns[i]);
|
||||
if (!tick_isset(pktns->tx.loss_time) ||
|
||||
qc->pktns[i].tx.loss_time < pktns->tx.loss_time)
|
||||
pktns = &qc->pktns[i];
|
||||
}
|
||||
|
||||
TRACE_LEAVE(QUIC_EV_CONN_SPTO, qc);
|
||||
|
||||
return pktns;
|
||||
}
|
||||
|
||||
@ -108,6 +116,7 @@ struct quic_pktns *quic_pto_pktns(struct quic_conn *qc,
|
||||
|
||||
if (i == QUIC_TLS_PKTNS_01RTT) {
|
||||
if (!handshake_completed) {
|
||||
TRACE_STATE("handshake not already completed", QUIC_EV_CONN_SPTO, qc);
|
||||
pktns = p;
|
||||
goto out;
|
||||
}
|
||||
@ -121,7 +130,7 @@ struct quic_pktns *quic_pto_pktns(struct quic_conn *qc,
|
||||
lpto = tmp_pto;
|
||||
pktns = p;
|
||||
}
|
||||
TRACE_PROTO("pktns", QUIC_EV_CONN_SPTO, qc, p);
|
||||
TRACE_DEVEL("pktns", QUIC_EV_CONN_SPTO, qc, p);
|
||||
}
|
||||
|
||||
out:
|
||||
|
1666
src/xprt_quic.c
1666
src/xprt_quic.c
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user