From 5bf80635cf528b68a0651459a0a00c7f04a943c4 Mon Sep 17 00:00:00 2001 From: "QUIC Dev[bot]" Date: Sat, 3 May 2025 00:01:55 +0000 Subject: [PATCH 1/3] Added RttVariance to connection statistics. Added RttVariance to connection statistics. --- scripts/generate-dotnet.ps1 | 1 + src/core/connection.c | 4 +++- src/cs/lib/msquic_generated.cs | 3 +++ src/inc/msquic.h | 3 +++ 4 files changed, 10 insertions(+), 1 deletion(-) diff --git a/scripts/generate-dotnet.ps1 b/scripts/generate-dotnet.ps1 index e1847ba4f8..0a1ed5d7f9 100644 --- a/scripts/generate-dotnet.ps1 +++ b/scripts/generate-dotnet.ps1 @@ -48,6 +48,7 @@ $Arguments = @( "-e QUIC_STATISTICS_V2_SIZE_1" # Inconsistent definitions across platforms "-e QUIC_STATISTICS_V2_SIZE_2" # Inconsistent definitions across platforms "-e QUIC_STATISTICS_V2_SIZE_3" # Inconsistent definitions across platforms + "-e QUIC_STATISTICS_V2_SIZE_4" # Inconsistent definitions across platforms ) $FullArgs = $Arguments -join " " diff --git a/src/core/connection.c b/src/core/connection.c index 340d90df33..344bade822 100644 --- a/src/core/connection.c +++ b/src/core/connection.c @@ -6871,10 +6871,12 @@ QuicConnGetV2Statistics( if (STATISTICS_HAS_FIELD(*StatsLength, SendEcnCongestionCount)) { Stats->SendEcnCongestionCount = Connection->Stats.Send.EcnCongestionCount; } - if (STATISTICS_HAS_FIELD(*StatsLength, HandshakeHopLimitTTL)) { Stats->HandshakeHopLimitTTL = Connection->Stats.Handshake.HandshakeHopLimitTTL; } + if (STATISTICS_HAS_FIELD(*StatsLength, RttVariance)) { + Stats->RttVariance = (uint32_t)Path->RttVariance; + } *StatsLength = CXPLAT_MIN(*StatsLength, sizeof(QUIC_STATISTICS_V2)); diff --git a/src/cs/lib/msquic_generated.cs b/src/cs/lib/msquic_generated.cs index 6cb3bd992c..c437627ec9 100644 --- a/src/cs/lib/msquic_generated.cs +++ b/src/cs/lib/msquic_generated.cs @@ -910,6 +910,9 @@ internal uint RESERVED [NativeTypeName("uint8_t")] internal byte HandshakeHopLimitTTL; + + [NativeTypeName("uint32_t")] + internal uint RttVariance; } internal partial struct QUIC_LISTENER_STATISTICS diff --git a/src/inc/msquic.h b/src/inc/msquic.h index be28d165bf..40121e5f5b 100644 --- a/src/inc/msquic.h +++ b/src/inc/msquic.h @@ -581,6 +581,8 @@ typedef struct QUIC_STATISTICS_V2 { uint8_t HandshakeHopLimitTTL; // The TTL value in the initial packet of the handshake. + uint32_t RttVariance; // In microseconds + // N.B. New fields must be appended to end } QUIC_STATISTICS_V2; @@ -591,6 +593,7 @@ typedef struct QUIC_STATISTICS_V2 { #define QUIC_STATISTICS_V2_SIZE_1 QUIC_STRUCT_SIZE_THRU_FIELD(QUIC_STATISTICS_V2, KeyUpdateCount) // v2.0 final size #define QUIC_STATISTICS_V2_SIZE_2 QUIC_STRUCT_SIZE_THRU_FIELD(QUIC_STATISTICS_V2, DestCidUpdateCount) // v2.1 final size #define QUIC_STATISTICS_V2_SIZE_3 QUIC_STRUCT_SIZE_THRU_FIELD(QUIC_STATISTICS_V2, SendEcnCongestionCount) // v2.2 final size +#define QUIC_STATISTICS_V2_SIZE_4 QUIC_STRUCT_SIZE_THRU_FIELD(QUIC_STATISTICS_V2, RttVariance) // v2.3 final size typedef struct QUIC_LISTENER_STATISTICS { From f685696e47a1a36e41e22c5f6add952a78b5cf0c Mon Sep 17 00:00:00 2001 From: jarnovanderlinden Date: Sun, 4 May 2025 00:47:20 +1200 Subject: [PATCH 2/3] Corrected version number --- src/inc/msquic.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/inc/msquic.h b/src/inc/msquic.h index 40121e5f5b..207b43e250 100644 --- a/src/inc/msquic.h +++ b/src/inc/msquic.h @@ -593,7 +593,7 @@ typedef struct QUIC_STATISTICS_V2 { #define QUIC_STATISTICS_V2_SIZE_1 QUIC_STRUCT_SIZE_THRU_FIELD(QUIC_STATISTICS_V2, KeyUpdateCount) // v2.0 final size #define QUIC_STATISTICS_V2_SIZE_2 QUIC_STRUCT_SIZE_THRU_FIELD(QUIC_STATISTICS_V2, DestCidUpdateCount) // v2.1 final size #define QUIC_STATISTICS_V2_SIZE_3 QUIC_STRUCT_SIZE_THRU_FIELD(QUIC_STATISTICS_V2, SendEcnCongestionCount) // v2.2 final size -#define QUIC_STATISTICS_V2_SIZE_4 QUIC_STRUCT_SIZE_THRU_FIELD(QUIC_STATISTICS_V2, RttVariance) // v2.3 final size +#define QUIC_STATISTICS_V2_SIZE_4 QUIC_STRUCT_SIZE_THRU_FIELD(QUIC_STATISTICS_V2, RttVariance) // v2.5 final size typedef struct QUIC_LISTENER_STATISTICS { From 68dd876ab145d6fcff7e1c67a682999c07c987b5 Mon Sep 17 00:00:00 2001 From: jarnovanderlinden Date: Tue, 6 May 2025 11:04:46 +1200 Subject: [PATCH 3/3] Update Rust bindings Updated Rust bindings Made it clearer what the version number on the QUIC_STATISTICS_V2 sizes refers to. --- src/inc/msquic.h | 8 ++++---- src/rs/ffi/linux_bindings.rs | 3 +++ src/rs/ffi/win_bindings.rs | 3 +++ 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/src/inc/msquic.h b/src/inc/msquic.h index 207b43e250..98b26d5275 100644 --- a/src/inc/msquic.h +++ b/src/inc/msquic.h @@ -590,10 +590,10 @@ typedef struct QUIC_STATISTICS_V2 { #define QUIC_STRUCT_SIZE_THRU_FIELD(Struct, Field) \ (FIELD_OFFSET(Struct, Field) + sizeof(((Struct*)0)->Field)) -#define QUIC_STATISTICS_V2_SIZE_1 QUIC_STRUCT_SIZE_THRU_FIELD(QUIC_STATISTICS_V2, KeyUpdateCount) // v2.0 final size -#define QUIC_STATISTICS_V2_SIZE_2 QUIC_STRUCT_SIZE_THRU_FIELD(QUIC_STATISTICS_V2, DestCidUpdateCount) // v2.1 final size -#define QUIC_STATISTICS_V2_SIZE_3 QUIC_STRUCT_SIZE_THRU_FIELD(QUIC_STATISTICS_V2, SendEcnCongestionCount) // v2.2 final size -#define QUIC_STATISTICS_V2_SIZE_4 QUIC_STRUCT_SIZE_THRU_FIELD(QUIC_STATISTICS_V2, RttVariance) // v2.5 final size +#define QUIC_STATISTICS_V2_SIZE_1 QUIC_STRUCT_SIZE_THRU_FIELD(QUIC_STATISTICS_V2, KeyUpdateCount) // MsQuic v2.0 final size +#define QUIC_STATISTICS_V2_SIZE_2 QUIC_STRUCT_SIZE_THRU_FIELD(QUIC_STATISTICS_V2, DestCidUpdateCount) // MsQuic v2.1 final size +#define QUIC_STATISTICS_V2_SIZE_3 QUIC_STRUCT_SIZE_THRU_FIELD(QUIC_STATISTICS_V2, SendEcnCongestionCount) // MsQuic v2.2 final size +#define QUIC_STATISTICS_V2_SIZE_4 QUIC_STRUCT_SIZE_THRU_FIELD(QUIC_STATISTICS_V2, RttVariance) // MsQuic v2.5 final size typedef struct QUIC_LISTENER_STATISTICS { diff --git a/src/rs/ffi/linux_bindings.rs b/src/rs/ffi/linux_bindings.rs index 99ddcd7254..57101a8bc6 100644 --- a/src/rs/ffi/linux_bindings.rs +++ b/src/rs/ffi/linux_bindings.rs @@ -1142,6 +1142,7 @@ pub struct QUIC_STATISTICS_V2 { pub DestCidUpdateCount: u32, pub SendEcnCongestionCount: u32, pub HandshakeHopLimitTTL: u8, + pub RttVariance: u32, } #[allow(clippy::unnecessary_operation, clippy::identity_op)] const _: () = { @@ -1211,6 +1212,8 @@ const _: () = { [::std::mem::offset_of!(QUIC_STATISTICS_V2, SendEcnCongestionCount) - 196usize]; ["Offset of field: QUIC_STATISTICS_V2::HandshakeHopLimitTTL"] [::std::mem::offset_of!(QUIC_STATISTICS_V2, HandshakeHopLimitTTL) - 200usize]; + ["Offset of field: QUIC_STATISTICS_V2::RttVariance"] + [::std::mem::offset_of!(QUIC_STATISTICS_V2, RttVariance) - 204usize]; }; impl QUIC_STATISTICS_V2 { #[inline] diff --git a/src/rs/ffi/win_bindings.rs b/src/rs/ffi/win_bindings.rs index 6e59aa2858..b504d5da3b 100644 --- a/src/rs/ffi/win_bindings.rs +++ b/src/rs/ffi/win_bindings.rs @@ -1136,6 +1136,7 @@ pub struct QUIC_STATISTICS_V2 { pub DestCidUpdateCount: u32, pub SendEcnCongestionCount: u32, pub HandshakeHopLimitTTL: u8, + pub RttVariance: u32, } #[allow(clippy::unnecessary_operation, clippy::identity_op)] const _: () = { @@ -1205,6 +1206,8 @@ const _: () = { [::std::mem::offset_of!(QUIC_STATISTICS_V2, SendEcnCongestionCount) - 196usize]; ["Offset of field: QUIC_STATISTICS_V2::HandshakeHopLimitTTL"] [::std::mem::offset_of!(QUIC_STATISTICS_V2, HandshakeHopLimitTTL) - 200usize]; + ["Offset of field: QUIC_STATISTICS_V2::RttVariance"] + [::std::mem::offset_of!(QUIC_STATISTICS_V2, RttVariance) - 204usize]; }; impl QUIC_STATISTICS_V2 { #[inline]