MINOR: quic: Add new stats counter to diagnose RX buffer overrun

Remove the call to qc_list_all_rx_pkts() which print messages on stderr
during RX buffer overruns and add a new counter for the number of dropped packets
because of such events.

Must be backported to 2.6
This commit is contained in:
Frédéric Lécaille 2022-06-29 12:03:34 +02:00
parent 95a8dfb4c7
commit 45a16295e3
3 changed files with 9 additions and 3 deletions

View File

@ -10,6 +10,7 @@ extern struct stats_module quic_stats_module;
enum {
QUIC_ST_DROPPED_PACKET,
QUIC_ST_DROPPED_PACKET_BUFOVERRUN,
QUIC_ST_DROPPED_PARSING,
QUIC_ST_LOST_PACKET,
QUIC_ST_TOO_SHORT_INITIAL_DGRAM,
@ -49,6 +50,7 @@ enum {
struct quic_counters {
long long dropped_pkt; /* total number of dropped packets */
long long dropped_pkt_bufoverrun;/* total number of dropped packets because of buffer overrun */
long long dropped_parsing; /* total number of dropped packets upon parsing errors */
long long lost_pkt; /* total number of lost packets */
long long too_short_initial_dgram; /* total number of too short datagrams with Initial packets */

View File

@ -4,6 +4,8 @@
static struct name_desc quic_stats[] = {
[QUIC_ST_DROPPED_PACKET] = { .name = "quic_dropped_pkt",
.desc = "Total number of dropped packets" },
[QUIC_ST_DROPPED_PACKET_BUFOVERRUN] = { .name = "quic_dropped_pkt_bufoverrun",
.desc = "Total number of dropped packets because of buffer overrun" },
[QUIC_ST_DROPPED_PARSING] = { .name = "quic_dropped_parsing_pkt",
.desc = "Total number of dropped packets upon parsing error" },
[QUIC_ST_LOST_PACKET] = { .name = "quic_lost_pkt",
@ -79,6 +81,7 @@ static void quic_fill_stats(void *data, struct field *stats)
struct quic_counters *counters = data;
stats[QUIC_ST_DROPPED_PACKET] = mkf_u64(FN_COUNTER, counters->dropped_pkt);
stats[QUIC_ST_DROPPED_PACKET_BUFOVERRUN] = mkf_u64(FN_COUNTER, counters->dropped_pkt_bufoverrun);
stats[QUIC_ST_DROPPED_PARSING] = mkf_u64(FN_COUNTER, counters->dropped_parsing);
stats[QUIC_ST_LOST_PACKET] = mkf_u64(FN_COUNTER, counters->lost_pkt);
stats[QUIC_ST_TOO_SHORT_INITIAL_DGRAM] = mkf_u64(FN_COUNTER, counters->too_short_initial_dgram);

View File

@ -5575,7 +5575,8 @@ static void qc_lstnr_pkt_rcv(unsigned char *buf, const unsigned char *end,
if (b_tail(&qc->rx.buf) + b_cspace < b_wrap(&qc->rx.buf)) {
TRACE_PROTO("Packet dropped",
QUIC_EV_CONN_LPKT, qc, NULL, NULL, qv);
goto drop;
HA_ATOMIC_INC(&prx_counters->dropped_pkt_bufoverrun);
goto drop_no_conn;
}
/* Let us consume the remaining contiguous space. */
@ -5587,8 +5588,8 @@ static void qc_lstnr_pkt_rcv(unsigned char *buf, const unsigned char *end,
if (b_contig_space(&qc->rx.buf) < pkt->len) {
TRACE_PROTO("Too big packet",
QUIC_EV_CONN_LPKT, qc, pkt, &pkt->len, qv);
qc_list_all_rx_pkts(qc);
goto drop;
HA_ATOMIC_INC(&prx_counters->dropped_pkt_bufoverrun);
goto drop_no_conn;
}
}