MINOR: quic: Add some counters at QUIC connection level
Add some statistical counters to quic_conn struct from quic_counters struct which
are used at listener level to handle them at QUIC connection level. This avoid
calling atomic functions. Furthermore this will be useful soon when a counter will
be added for the total number of packets which have been sent which will be very
often incremented.
Some counters were not added, espcially those which count the number of QUIC errors
by QUIC error types. Indeed such counters would be incremented most of the time
only one time at QUIC connection level.
Implement quic_conn_prx_cntrs_update() which accumulates the QUIC connection level
statistical counters to the listener level statistical counters.
Must be backported to 2.7.
diff --git a/src/quic_sock.c b/src/quic_sock.c
index c01653b..66083ec 100644
--- a/src/quic_sock.c
+++ b/src/quic_sock.c
@@ -631,17 +631,12 @@
} while (ret < 0 && errno == EINTR);
if (ret < 0) {
- struct proxy *prx = qc->li->bind_conf->frontend;
- struct quic_counters *prx_counters =
- EXTRA_COUNTERS_GET(prx->extra_counters_fe,
- &quic_stats_module);
-
if (errno == EAGAIN || errno == EWOULDBLOCK ||
errno == ENOTCONN || errno == EINPROGRESS) {
if (errno == EAGAIN || errno == EWOULDBLOCK)
- HA_ATOMIC_INC(&prx_counters->socket_full);
+ qc->cntrs.socket_full++;
else
- HA_ATOMIC_INC(&prx_counters->sendto_err);
+ qc->cntrs.sendto_err++;
/* transient error */
fd_want_send(qc->fd);
@@ -652,7 +647,7 @@
}
else {
/* unrecoverable error */
- HA_ATOMIC_INC(&prx_counters->sendto_err_unknown);
+ qc->cntrs.sendto_err_unknown++;
TRACE_PRINTF(TRACE_LEVEL_USER, QUIC_EV_CONN_SPPKTS, qc, 0, 0, 0,
"UDP send failure errno=%d (%s)", errno, strerror(errno));
return -1;