]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: quic: add counters of sent bytes with and without GSO
authorAmaury Denoyelle <adenoyelle@haproxy.com>
Mon, 8 Jul 2024 08:51:42 +0000 (10:51 +0200)
committerAmaury Denoyelle <adenoyelle@haproxy.com>
Thu, 11 Jul 2024 09:02:44 +0000 (11:02 +0200)
Add a sent bytes counter for each quic_conn instance. A secondary field
which only account bytes sent via GSO which is useful to ensure if this
is activated.

For the moment, these counters are reported on "show quic" but not
aggregated on proxy quic module stats.

include/haproxy/quic_conn-t.h
src/quic_cli.c
src/quic_tx.c

index d9415c4872bf1b156328b9ce543ef575fe43fc82..0b33bd0268da27efb973196b4f31af92d4ab8c91 100644 (file)
@@ -262,6 +262,8 @@ struct quic_conn_cntrs {
        long long socket_full;           /* total number of EAGAIN errors on sendto() calls */
        long long sendto_err;            /* total number of errors on sendto() calls, EAGAIN excepted */
        long long sendto_err_unknown;    /* total number of errors on sendto() calls which are currently not supported */
+       long long sent_bytes;            /* total number of sent bytes, with or without GSO */
+       long long sent_bytes_gso;        /* total number of sent bytes using GSO */
        long long sent_pkt;              /* total number of sent packets */
        long long lost_pkt;              /* total number of lost packets */
        long long conn_migration_done;   /* total number of connection migration handled */
index f0e147c7e7a279136c5b36ba646a0a94f3e887cc..6e9ee0c268e83e3a6a5bb544dd4e9ab32d9656ec 100644 (file)
@@ -300,11 +300,14 @@ static void dump_quic_full(struct show_quic_ctx *ctx, struct quic_conn *qc)
        }
 
        if (ctx->fields & QUIC_DUMP_FLD_CC) {
-               chunk_appendf(&trash, "  srtt=%-4u rttvar=%-4u rttmin=%-4u ptoc=%-4u cwnd=%-6llu"
-                                     " mcwnd=%-6llu sentpkts=%-6llu lostpkts=%-6llu reorderedpkts=%-6llu\n",
+               chunk_appendf(&trash, "  srtt=%-4u  rttvar=%-4u rttmin=%-4u ptoc=%-4u\n"
+                                     "  cwnd=%-6llu            mcwnd=%-6llu\n"
+                                     "  sentbytes=%-12llu sentbytesgso=%-12llu sentpkts=%-6llu\n"
+                                     "  lostpkts=%-6llu        reorderedpkts=%-6llu\n",
                              qc->path->loss.srtt, qc->path->loss.rtt_var,
                              qc->path->loss.rtt_min, qc->path->loss.pto_count, (ullong)qc->path->cwnd,
-                             (ullong)qc->path->mcwnd, (ullong)qc->cntrs.sent_pkt, (ullong)qc->path->loss.nb_lost_pkt, (ullong)qc->path->loss.nb_reordered_pkt);
+                             (ullong)qc->path->mcwnd, (ullong)qc->cntrs.sent_bytes, (ullong)qc->cntrs.sent_bytes_gso,
+                             (ullong)qc->cntrs.sent_pkt, (ullong)qc->path->loss.nb_lost_pkt, (ullong)qc->path->loss.nb_reordered_pkt);
        }
 
        if (qc->cntrs.dropped_pkt) {
index 06c973a455fb574eb6cc312af7b222ef842c653e..37ff14fea405fe6443fd2b1b5fed3f2041d764ec 100644 (file)
@@ -347,6 +347,11 @@ static int qc_send_ppkts(struct buffer *buf, struct ssl_sock_ctx *ctx)
                                skip_sendto = 1;
                                TRACE_ERROR("sendto error, simulate sending for the rest of data", QUIC_EV_CONN_SPPKTS, qc);
                        }
+                       else {
+                               qc->cntrs.sent_bytes += ret;
+                               if (gso && ret > gso)
+                                       qc->cntrs.sent_bytes_gso += ret;
+                       }
                }
 
                b_del(buf, dglen + QUIC_DGRAM_HEADLEN);