From: Frédéric Lécaille Date: Wed, 22 Nov 2023 09:04:59 +0000 (+0100) Subject: MINOR: quic: Add traces to debug frames handling during retransmissions X-Git-Tag: v2.9-dev11~33 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=34bc100b8f2ae486c1a8cf183f219f7132f6bfc4;p=thirdparty%2Fhaproxy.git MINOR: quic: Add traces to debug frames handling during retransmissions This is really boring to not know why some retransmissions could not be done from qc_prep_hpkts() which allocates frames, prepare packets and send them. Especially to not know about if frames are not remaining allocated and attached to list on the stack. This patch already helped in diagnosing such an issue during "-dMfail" tests. --- diff --git a/src/quic_tx.c b/src/quic_tx.c index b1cfba6a89..229316ad70 100644 --- a/src/quic_tx.c +++ b/src/quic_tx.c @@ -545,10 +545,14 @@ static inline void qc_free_frm_list(struct quic_conn *qc, struct list *l) { struct quic_frame *frm, *frmbak; + TRACE_ENTER(QUIC_EV_CONN_TXPKT, qc); + list_for_each_entry_safe(frm, frmbak, l, list) { LIST_DEL_INIT(&frm->ref); qc_frm_free(qc, &frm); } + + TRACE_LEAVE(QUIC_EV_CONN_TXPKT, qc); } /* Free TX packet and all the packets coalesced to it. */ @@ -557,11 +561,15 @@ static inline void qc_free_tx_coalesced_pkts(struct quic_conn *qc, { struct quic_tx_packet *pkt, *nxt_pkt; + TRACE_ENTER(QUIC_EV_CONN_TXPKT, qc); + for (pkt = p; pkt; pkt = nxt_pkt) { qc_free_frm_list(qc, &pkt->frms); nxt_pkt = pkt->next; pool_free(pool_head_quic_tx_packet, pkt); } + + TRACE_LEAVE(QUIC_EV_CONN_TXPKT, qc); } /* Purge TX buffer from its prepare packets. */ @@ -1232,8 +1240,10 @@ int qc_send_hdshk_pkts(struct quic_conn *qc, int old_data, goto leave; } - if (b_data(buf) && !qc_purge_txbuf(qc, buf)) + if (b_data(buf) && !qc_purge_txbuf(qc, buf)) { + TRACE_ERROR("Could not purge TX buffer", QUIC_EV_CONN_TXPKT, qc); goto out; + } /* Currently buf cannot be non-empty at this stage. Even if a previous * sendto() has failed it is emptied to simulate packet emission and @@ -1260,12 +1270,14 @@ int qc_send_hdshk_pkts(struct quic_conn *qc, int old_data, ret = qc_prep_hpkts(qc, buf, &qels); if (ret == -1) { qc_txb_release(qc); + TRACE_ERROR("Could not build some packets", QUIC_EV_CONN_TXPKT, qc); goto out; } if (ret && !qc_send_ppkts(buf, qc->xprt_ctx)) { if (qc->flags & QUIC_FL_CONN_TO_KILL) qc_txb_release(qc); + TRACE_ERROR("Could not send some packets", QUIC_EV_CONN_TXPKT, qc); goto out; }