mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-08-08 08:07:10 +02:00
MINOR: quic: Add new traces about by connection RX buffer handling
Move quic_rx_pkts_del() out of quic_conn.h to make it benefit from the TRACE API. Add traces which already already helped in diagnosing an issue encountered with ngtcp2 which sent too much 1RTT packets before the handshake completion. This has been fixed here after having discussed with Tasuhiro on QUIC dev slack: https://github.com/ngtcp2/ngtcp2/pull/663 Must be backported to 2.7.
This commit is contained in:
parent
9fc10aff05
commit
1dbeb35f80
@ -648,39 +648,6 @@ static inline int qc_el_rx_pkts(struct quic_enc_level *qel)
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* Release the memory for the RX packets which are no more referenced
|
||||
* and consume their payloads which have been copied to the RX buffer
|
||||
* for the connection.
|
||||
* Always succeeds.
|
||||
*/
|
||||
static inline void quic_rx_pkts_del(struct quic_conn *qc)
|
||||
{
|
||||
struct quic_rx_packet *pkt, *pktback;
|
||||
|
||||
list_for_each_entry_safe(pkt, pktback, &qc->rx.pkt_list, qc_rx_pkt_list) {
|
||||
if (pkt->data != (unsigned char *)b_head(&qc->rx.buf)) {
|
||||
size_t cdata;
|
||||
|
||||
cdata = b_contig_data(&qc->rx.buf, 0);
|
||||
if (cdata && !*b_head(&qc->rx.buf)) {
|
||||
/* Consume the remaining data */
|
||||
b_del(&qc->rx.buf, cdata);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
if (pkt->refcnt)
|
||||
break;
|
||||
|
||||
b_del(&qc->rx.buf, pkt->raw_len);
|
||||
LIST_DELETE(&pkt->qc_rx_pkt_list);
|
||||
pool_free(pool_head_quic_rx_packet, pkt);
|
||||
}
|
||||
|
||||
/* In frequent cases the buffer will be emptied at this stage. */
|
||||
b_realign_if_empty(&qc->rx.buf);
|
||||
}
|
||||
|
||||
/* Increment the reference counter of <pkt> */
|
||||
static inline void quic_rx_packet_refinc(struct quic_rx_packet *pkt)
|
||||
{
|
||||
|
@ -6470,6 +6470,46 @@ static int qc_handle_conn_migration(struct quic_conn *qc,
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* Release the memory for the RX packets which are no more referenced
|
||||
* and consume their payloads which have been copied to the RX buffer
|
||||
* for the connection.
|
||||
* Always succeeds.
|
||||
*/
|
||||
static inline void quic_rx_pkts_del(struct quic_conn *qc)
|
||||
{
|
||||
struct quic_rx_packet *pkt, *pktback;
|
||||
|
||||
list_for_each_entry_safe(pkt, pktback, &qc->rx.pkt_list, qc_rx_pkt_list) {
|
||||
TRACE_PRINTF(TRACE_LEVEL_DEVELOPER, QUIC_EV_CONN_LPKT, qc, 0, 0, 0,
|
||||
"pkt #%lld(type=%d,len=%zu,rawlen=%zu,refcnt=%u) (diff: %zd)",
|
||||
(long long)pkt->pn_node.key,
|
||||
pkt->type, pkt->len, pkt->raw_len, pkt->refcnt,
|
||||
(unsigned char *)b_head(&qc->rx.buf) - pkt->data);
|
||||
if (pkt->data != (unsigned char *)b_head(&qc->rx.buf)) {
|
||||
size_t cdata;
|
||||
|
||||
cdata = b_contig_data(&qc->rx.buf, 0);
|
||||
TRACE_PRINTF(TRACE_LEVEL_DEVELOPER, QUIC_EV_CONN_LPKT, qc, 0, 0, 0,
|
||||
"cdata=%zu *b_head()=0x%x", cdata, *b_head(&qc->rx.buf));
|
||||
if (cdata && !*b_head(&qc->rx.buf)) {
|
||||
/* Consume the remaining data */
|
||||
b_del(&qc->rx.buf, cdata);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
if (pkt->refcnt)
|
||||
break;
|
||||
|
||||
b_del(&qc->rx.buf, pkt->raw_len);
|
||||
LIST_DELETE(&pkt->qc_rx_pkt_list);
|
||||
pool_free(pool_head_quic_rx_packet, pkt);
|
||||
}
|
||||
|
||||
/* In frequent cases the buffer will be emptied at this stage. */
|
||||
b_realign_if_empty(&qc->rx.buf);
|
||||
}
|
||||
|
||||
/* Handle a parsed packet <pkt> by the connection <qc>. Data will be copied
|
||||
* into <qc> receive buffer after header protection removal procedure.
|
||||
*
|
||||
@ -6518,6 +6558,8 @@ static void qc_rx_pkt_handle(struct quic_conn *qc, struct quic_rx_packet *pkt,
|
||||
quic_rx_pkts_del(qc);
|
||||
b_cspace = b_contig_space(&qc->rx.buf);
|
||||
if (b_cspace < pkt->len) {
|
||||
TRACE_PRINTF(TRACE_LEVEL_DEVELOPER, QUIC_EV_CONN_LPKT, qc, 0, 0, 0,
|
||||
"bspace=%zu pkt->len=%zu", b_cspace, pkt->len);
|
||||
/* Do not consume buf if space not at the end. */
|
||||
if (b_tail(&qc->rx.buf) + b_cspace < b_wrap(&qc->rx.buf)) {
|
||||
TRACE_PROTO("Packet dropped",
|
||||
|
Loading…
Reference in New Issue
Block a user