Skip to content

Commit

Permalink
quic: fix idle timeout
Browse files Browse the repository at this point in the history
- Fix idle timeout and ACK delay being incorrect when clock scale
  is not canonical
- Improve QUIC tile metrics
- Fix test_quic_bw blocking with small stream sizes
  • Loading branch information
riptl authored and ripatel-fd committed Jan 9, 2025
1 parent 0599cbd commit 8318af4
Show file tree
Hide file tree
Showing 12 changed files with 240 additions and 157 deletions.
14 changes: 9 additions & 5 deletions book/api/metrics-generated.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,10 @@
| quic_​txns_​received_​quic_​fast | `counter` | Count of txns received via TPU. (TPU/QUIC unfragmented) |
| quic_​txns_​received_​quic_​frag | `counter` | Count of txns received via TPU. (TPU/QUIC fragmented) |
| quic_​txns_​abandoned | `counter` | Count of txns abandoned because a conn was lost. |
| quic_​quic_​packet_​too_​small | `counter` | Count of packets received on the QUIC port that were too small to be a valid IP packet. |
| quic_​quic_​txn_​too_​small | `counter` | Count of txns received via QUIC dropped because they were too small. |
| quic_​quic_​txn_​too_​large | `counter` | Count of txns received via QUIC dropped because they were too large. |
| quic_​non_​quic_​packet_​too_​small | `counter` | Count of packets received on the non-QUIC port that were too small to be a valid IP packet. |
| quic_​non_​quic_​packet_​too_​large | `counter` | Count of packets received on the non-QUIC port that were too large to be a valid transaction. |
| quic_​txn_​undersz | `counter` | Count of txns received via QUIC dropped because they were too small. |
| quic_​txn_​oversz | `counter` | Count of txns received via QUIC dropped because they were too large. |
| quic_​legacy_​txn_​undersz | `counter` | Count of packets received on the non-QUIC port that were too small to be a valid IP packet. |
| quic_​legacy_​txn_​oversz | `counter` | Count of packets received on the non-QUIC port that were too large to be a valid transaction. |
| quic_​received_​packets | `counter` | Number of IP packets received. |
| quic_​received_​bytes | `counter` | Total bytes received (including IP, UDP, QUIC headers). |
| quic_​sent_​packets | `counter` | Number of IP packets sent. |
Expand Down Expand Up @@ -119,6 +118,11 @@
| quic_​pkt_​no_​key_​early | `counter` | Number of packets that failed decryption due to missing key. (early data) |
| quic_​pkt_​no_​key_​handshake | `counter` | Number of packets that failed decryption due to missing key. (handshake) |
| quic_​pkt_​no_​key_​app | `counter` | Number of packets that failed decryption due to missing key. (app data) |
| quic_​pkt_​net_​header_​invalid | `counter` | Number of packets dropped due to weird IP or UDP header. |
| quic_​pkt_​quic_​header_​invalid | `counter` | Number of packets dropped due to weird QUIC header. |
| quic_​pkt_​undersz | `counter` | Number of QUIC packets dropped due to being too small. |
| quic_​pkt_​oversz | `counter` | Number of QUIC packets dropped due to being too large. |
| quic_​pkt_​verneg | `counter` | Number of QUIC version negotiation packets received. |

## Verify Tile
| Metric | Type | Description |
Expand Down
7 changes: 5 additions & 2 deletions src/app/fdctl/run/tiles/fd_net.c
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,11 @@

#include "../../../../disco/metrics/fd_metrics.h"

#include "../../../../waltz/quic/fd_quic.h"
#include "../../../../waltz/xdp/fd_xdp.h"
#include "../../../../waltz/xdp/fd_xdp1.h"
#include "../../../../waltz/xdp/fd_xsk_aio_private.h"
#include "../../../../waltz/xdp/fd_xsk_private.h"
#include "../../../../util/log/fd_dtrace.h"
#include "../../../../util/net/fd_ip4.h"
#include "../../../../waltz/ip/fd_ip.h"

Expand Down Expand Up @@ -175,7 +175,10 @@ net_rx_aio_send( void * _ctx,
uchar const * udp = iphdr + iplen;

/* Ignore if UDP header is too short */
if( FD_UNLIKELY( udp+8U > packet_end ) ) continue;
if( FD_UNLIKELY( udp+8U > packet_end ) ) {
FD_DTRACE_PROBE( net_tile_err_rx_undersz );
continue;
}

/* Extract IP dest addr and UDP src/dest port */
uint ip_srcaddr = *(uint *)( iphdr+12UL );
Expand Down
2 changes: 0 additions & 2 deletions src/ballet/txn/fuzz_txn_parse.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,7 @@ LLVMFuzzerInitialize( int * argc,
/* Set up shell without signal handlers */
putenv( "FD_LOG_BACKTRACE=0" );
fd_boot( argc, argv );
#ifndef FD_DEBUG_MODE
fd_log_level_core_set(3); /* crash on warning log */
#endif
atexit( fd_halt );
return 0;
}
Expand Down
19 changes: 11 additions & 8 deletions src/disco/gui/fd_gui.c
Original file line number Diff line number Diff line change
Expand Up @@ -334,14 +334,17 @@ fd_gui_txn_waterfall_snap( fd_gui_t * gui,
fd_topo_tile_t const * quic = &topo->tiles[ fd_topo_find_tile( topo, "quic", i ) ];
volatile ulong * quic_metrics = fd_metrics_tile( quic->metrics );

cur->out.tpu_udp_invalid += quic_metrics[ MIDX( COUNTER, QUIC, NON_QUIC_PACKET_TOO_SMALL ) ];
cur->out.tpu_udp_invalid += quic_metrics[ MIDX( COUNTER, QUIC, NON_QUIC_PACKET_TOO_LARGE ) ];
cur->out.tpu_quic_invalid += quic_metrics[ MIDX( COUNTER, QUIC, QUIC_PACKET_TOO_SMALL ) ];
cur->out.tpu_quic_invalid += quic_metrics[ MIDX( COUNTER, QUIC, QUIC_TXN_TOO_LARGE ) ];
cur->out.tpu_quic_invalid += quic_metrics[ MIDX( COUNTER, QUIC, PKT_CRYPTO_FAILED ) ];
cur->out.tpu_quic_invalid += quic_metrics[ MIDX( COUNTER, QUIC, PKT_NO_CONN ) ];
cur->out.quic_abandoned += quic_metrics[ MIDX( COUNTER, QUIC, TXNS_ABANDONED ) ];
cur->out.quic_frag_drop += quic_metrics[ MIDX( COUNTER, QUIC, TXNS_OVERRUN ) ];
cur->out.tpu_udp_invalid += quic_metrics[ MIDX( COUNTER, QUIC, LEGACY_TXN_UNDERSZ ) ];
cur->out.tpu_udp_invalid += quic_metrics[ MIDX( COUNTER, QUIC, LEGACY_TXN_OVERSZ ) ];
cur->out.tpu_quic_invalid += quic_metrics[ MIDX( COUNTER, QUIC, PKT_UNDERSZ ) ];
cur->out.tpu_quic_invalid += quic_metrics[ MIDX( COUNTER, QUIC, PKT_OVERSZ ) ];
cur->out.tpu_quic_invalid += quic_metrics[ MIDX( COUNTER, QUIC, TXN_OVERSZ ) ];
cur->out.tpu_quic_invalid += quic_metrics[ MIDX( COUNTER, QUIC, PKT_CRYPTO_FAILED ) ];
cur->out.tpu_quic_invalid += quic_metrics[ MIDX( COUNTER, QUIC, PKT_NO_CONN ) ];
cur->out.tpu_quic_invalid += quic_metrics[ MIDX( COUNTER, QUIC, PKT_NET_HEADER_INVALID ) ];
cur->out.tpu_quic_invalid += quic_metrics[ MIDX( COUNTER, QUIC, PKT_QUIC_HEADER_INVALID ) ];
cur->out.quic_abandoned += quic_metrics[ MIDX( COUNTER, QUIC, TXNS_ABANDONED ) ];
cur->out.quic_frag_drop += quic_metrics[ MIDX( COUNTER, QUIC, TXNS_OVERRUN ) ];

for( ulong j=0UL; j<gui->summary.net_tile_cnt; j++ ) {
/* TODO: Not precise... net frags that were skipped might not have been destined for QUIC tile */
Expand Down
14 changes: 9 additions & 5 deletions src/disco/metrics/generated/fd_metrics_quic.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,10 @@ const fd_metrics_meta_t FD_METRICS_QUIC[FD_METRICS_QUIC_TOTAL] = {
DECLARE_METRIC_ENUM( QUIC_TXNS_RECEIVED, COUNTER, TPU_RECV_TYPE, QUIC_FAST ),
DECLARE_METRIC_ENUM( QUIC_TXNS_RECEIVED, COUNTER, TPU_RECV_TYPE, QUIC_FRAG ),
DECLARE_METRIC( QUIC_TXNS_ABANDONED, COUNTER ),
DECLARE_METRIC( QUIC_QUIC_PACKET_TOO_SMALL, COUNTER ),
DECLARE_METRIC( QUIC_QUIC_TXN_TOO_SMALL, COUNTER ),
DECLARE_METRIC( QUIC_QUIC_TXN_TOO_LARGE, COUNTER ),
DECLARE_METRIC( QUIC_NON_QUIC_PACKET_TOO_SMALL, COUNTER ),
DECLARE_METRIC( QUIC_NON_QUIC_PACKET_TOO_LARGE, COUNTER ),
DECLARE_METRIC( QUIC_TXN_UNDERSZ, COUNTER ),
DECLARE_METRIC( QUIC_TXN_OVERSZ, COUNTER ),
DECLARE_METRIC( QUIC_LEGACY_TXN_UNDERSZ, COUNTER ),
DECLARE_METRIC( QUIC_LEGACY_TXN_OVERSZ, COUNTER ),
DECLARE_METRIC( QUIC_RECEIVED_PACKETS, COUNTER ),
DECLARE_METRIC( QUIC_RECEIVED_BYTES, COUNTER ),
DECLARE_METRIC( QUIC_SENT_PACKETS, COUNTER ),
Expand Down Expand Up @@ -73,4 +72,9 @@ const fd_metrics_meta_t FD_METRICS_QUIC[FD_METRICS_QUIC_TOTAL] = {
DECLARE_METRIC_ENUM( QUIC_PKT_NO_KEY, COUNTER, QUIC_ENC_LEVEL, EARLY ),
DECLARE_METRIC_ENUM( QUIC_PKT_NO_KEY, COUNTER, QUIC_ENC_LEVEL, HANDSHAKE ),
DECLARE_METRIC_ENUM( QUIC_PKT_NO_KEY, COUNTER, QUIC_ENC_LEVEL, APP ),
DECLARE_METRIC( QUIC_PKT_NET_HEADER_INVALID, COUNTER ),
DECLARE_METRIC( QUIC_PKT_QUIC_HEADER_INVALID, COUNTER ),
DECLARE_METRIC( QUIC_PKT_UNDERSZ, COUNTER ),
DECLARE_METRIC( QUIC_PKT_OVERSZ, COUNTER ),
DECLARE_METRIC( QUIC_PKT_VERNEG, COUNTER ),
};
Loading

0 comments on commit 8318af4

Please sign in to comment.