Skip to content

Commit cbd435b

Browse files
guhetierCopilot
andcommitted
Fix CI: kernel/official build guards, Rust bindings
- Guard QUIC_PARAM_GLOBAL_WORKER_STATISTICS case with #ifndef _KERNEL_MODE (worker pool API not available in kernel builds) - Guard test code with #ifdef QUIC_API_ENABLE_PREVIEW_FEATURES for official builds that don't define preview features - Exclude worker stats tests from kernel test driver registration - Add QUIC_WORKER_STATISTICS and QUIC_WORKER_STATISTICS_LIST to Rust FFI bindings (win_bindings.rs and linux_bindings.rs) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 6fe9d9e commit cbd435b

7 files changed

Lines changed: 90 additions & 0 deletions

File tree

src/core/library.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1876,6 +1876,7 @@ QuicLibraryGetGlobalParam(
18761876
break;
18771877
}
18781878

1879+
#ifndef _KERNEL_MODE
18791880
case QUIC_PARAM_GLOBAL_WORKER_STATISTICS: {
18801881

18811882
if (MsQuicLib.WorkerPool == NULL) {
@@ -1911,6 +1912,7 @@ QuicLibraryGetGlobalParam(
19111912
Status = QUIC_STATUS_SUCCESS;
19121913
break;
19131914
}
1915+
#endif
19141916

19151917
default:
19161918
Status = QUIC_STATUS_INVALID_PARAMETER;

src/rs/ffi/linux_bindings.rs

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,7 @@ pub const QUIC_PARAM_GLOBAL_STATELESS_RESET_KEY: u32 = 16777227;
176176
pub const QUIC_PARAM_GLOBAL_STATISTICS_V2_SIZES: u32 = 16777228;
177177
pub const QUIC_PARAM_GLOBAL_STATELESS_RETRY_CONFIG: u32 = 16777229;
178178
pub const QUIC_PARAM_GLOBAL_XDP_MAP_CONFIG: u32 = 16777230;
179+
pub const QUIC_PARAM_GLOBAL_WORKER_STATISTICS: u32 = 16777231;
179180
pub const QUIC_PARAM_CONFIGURATION_SETTINGS: u32 = 50331648;
180181
pub const QUIC_PARAM_CONFIGURATION_TICKET_KEYS: u32 = 50331649;
181182
pub const QUIC_PARAM_CONFIGURATION_VERSION_SETTINGS: u32 = 50331650;
@@ -519,6 +520,45 @@ const _: () = {
519520
};
520521
#[repr(C)]
521522
#[derive(Debug, Copy, Clone)]
523+
pub struct QUIC_WORKER_STATISTICS {
524+
pub IdealProcessor: u16,
525+
pub Reserved: [u8; 6usize],
526+
pub CumulativeActiveTimeUs: u64,
527+
pub CumulativeWallTimeUs: u64,
528+
}
529+
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
530+
const _: () = {
531+
["Size of QUIC_WORKER_STATISTICS"][::std::mem::size_of::<QUIC_WORKER_STATISTICS>() - 24usize];
532+
["Alignment of QUIC_WORKER_STATISTICS"]
533+
[::std::mem::align_of::<QUIC_WORKER_STATISTICS>() - 8usize];
534+
["Offset of field: QUIC_WORKER_STATISTICS::IdealProcessor"]
535+
[::std::mem::offset_of!(QUIC_WORKER_STATISTICS, IdealProcessor) - 0usize];
536+
["Offset of field: QUIC_WORKER_STATISTICS::Reserved"]
537+
[::std::mem::offset_of!(QUIC_WORKER_STATISTICS, Reserved) - 2usize];
538+
["Offset of field: QUIC_WORKER_STATISTICS::CumulativeActiveTimeUs"]
539+
[::std::mem::offset_of!(QUIC_WORKER_STATISTICS, CumulativeActiveTimeUs) - 8usize];
540+
["Offset of field: QUIC_WORKER_STATISTICS::CumulativeWallTimeUs"]
541+
[::std::mem::offset_of!(QUIC_WORKER_STATISTICS, CumulativeWallTimeUs) - 16usize];
542+
};
543+
#[repr(C)]
544+
#[derive(Debug, Copy, Clone)]
545+
pub struct QUIC_WORKER_STATISTICS_LIST {
546+
pub WorkerCount: u32,
547+
pub WorkerStatsSize: u32,
548+
}
549+
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
550+
const _: () = {
551+
["Size of QUIC_WORKER_STATISTICS_LIST"]
552+
[::std::mem::size_of::<QUIC_WORKER_STATISTICS_LIST>() - 8usize];
553+
["Alignment of QUIC_WORKER_STATISTICS_LIST"]
554+
[::std::mem::align_of::<QUIC_WORKER_STATISTICS_LIST>() - 4usize];
555+
["Offset of field: QUIC_WORKER_STATISTICS_LIST::WorkerCount"]
556+
[::std::mem::offset_of!(QUIC_WORKER_STATISTICS_LIST, WorkerCount) - 0usize];
557+
["Offset of field: QUIC_WORKER_STATISTICS_LIST::WorkerStatsSize"]
558+
[::std::mem::offset_of!(QUIC_WORKER_STATISTICS_LIST, WorkerStatsSize) - 4usize];
559+
};
560+
#[repr(C)]
561+
#[derive(Debug, Copy, Clone)]
522562
pub struct QUIC_REGISTRATION_CONFIG {
523563
pub AppName: *const ::std::os::raw::c_char,
524564
pub ExecutionProfile: QUIC_EXECUTION_PROFILE,

src/rs/ffi/win_bindings.rs

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,7 @@ pub const QUIC_PARAM_GLOBAL_STATELESS_RESET_KEY: u32 = 16777227;
170170
pub const QUIC_PARAM_GLOBAL_STATISTICS_V2_SIZES: u32 = 16777228;
171171
pub const QUIC_PARAM_GLOBAL_STATELESS_RETRY_CONFIG: u32 = 16777229;
172172
pub const QUIC_PARAM_GLOBAL_XDP_MAP_CONFIG: u32 = 16777230;
173+
pub const QUIC_PARAM_GLOBAL_WORKER_STATISTICS: u32 = 16777231;
173174
pub const QUIC_PARAM_CONFIGURATION_SETTINGS: u32 = 50331648;
174175
pub const QUIC_PARAM_CONFIGURATION_TICKET_KEYS: u32 = 50331649;
175176
pub const QUIC_PARAM_CONFIGURATION_VERSION_SETTINGS: u32 = 50331650;
@@ -517,6 +518,45 @@ const _: () = {
517518
};
518519
#[repr(C)]
519520
#[derive(Debug, Copy, Clone)]
521+
pub struct QUIC_WORKER_STATISTICS {
522+
pub IdealProcessor: u16,
523+
pub Reserved: [u8; 6usize],
524+
pub CumulativeActiveTimeUs: u64,
525+
pub CumulativeWallTimeUs: u64,
526+
}
527+
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
528+
const _: () = {
529+
["Size of QUIC_WORKER_STATISTICS"][::std::mem::size_of::<QUIC_WORKER_STATISTICS>() - 24usize];
530+
["Alignment of QUIC_WORKER_STATISTICS"]
531+
[::std::mem::align_of::<QUIC_WORKER_STATISTICS>() - 8usize];
532+
["Offset of field: QUIC_WORKER_STATISTICS::IdealProcessor"]
533+
[::std::mem::offset_of!(QUIC_WORKER_STATISTICS, IdealProcessor) - 0usize];
534+
["Offset of field: QUIC_WORKER_STATISTICS::Reserved"]
535+
[::std::mem::offset_of!(QUIC_WORKER_STATISTICS, Reserved) - 2usize];
536+
["Offset of field: QUIC_WORKER_STATISTICS::CumulativeActiveTimeUs"]
537+
[::std::mem::offset_of!(QUIC_WORKER_STATISTICS, CumulativeActiveTimeUs) - 8usize];
538+
["Offset of field: QUIC_WORKER_STATISTICS::CumulativeWallTimeUs"]
539+
[::std::mem::offset_of!(QUIC_WORKER_STATISTICS, CumulativeWallTimeUs) - 16usize];
540+
};
541+
#[repr(C)]
542+
#[derive(Debug, Copy, Clone)]
543+
pub struct QUIC_WORKER_STATISTICS_LIST {
544+
pub WorkerCount: u32,
545+
pub WorkerStatsSize: u32,
546+
}
547+
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
548+
const _: () = {
549+
["Size of QUIC_WORKER_STATISTICS_LIST"]
550+
[::std::mem::size_of::<QUIC_WORKER_STATISTICS_LIST>() - 8usize];
551+
["Alignment of QUIC_WORKER_STATISTICS_LIST"]
552+
[::std::mem::align_of::<QUIC_WORKER_STATISTICS_LIST>() - 4usize];
553+
["Offset of field: QUIC_WORKER_STATISTICS_LIST::WorkerCount"]
554+
[::std::mem::offset_of!(QUIC_WORKER_STATISTICS_LIST, WorkerCount) - 0usize];
555+
["Offset of field: QUIC_WORKER_STATISTICS_LIST::WorkerStatsSize"]
556+
[::std::mem::offset_of!(QUIC_WORKER_STATISTICS_LIST, WorkerStatsSize) - 4usize];
557+
};
558+
#[repr(C)]
559+
#[derive(Debug, Copy, Clone)]
520560
pub struct QUIC_REGISTRATION_CONFIG {
521561
pub AppName: *const ::std::os::raw::c_char,
522562
pub ExecutionProfile: QUIC_EXECUTION_PROFILE,

src/test/MsQuicTests.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,8 +89,10 @@ void QuicTestTlsParam();
8989
void QuicTestTlsHandshakeInfo(const bool& EnableResumption);
9090
void QuicTestStreamParam();
9191
void QuicTestGetPerfCounters();
92+
#ifdef QUIC_API_ENABLE_PREVIEW_FEATURES
9293
void QuicTestGetWorkerStatistics();
9394
void QuicTestValidateWorkerStatistics();
95+
#endif
9496
void QuicTestVersionSettings();
9597
void QuicTestValidateParamApi();
9698
void QuicTestCredentialLoad(const QUIC_CREDENTIAL_BLOB& Config);

src/test/bin/quic_gtest.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -390,6 +390,7 @@ TEST(ParameterValidation, ValidateGetPerfCounters) {
390390
}
391391
}
392392

393+
#ifdef QUIC_API_ENABLE_PREVIEW_FEATURES
393394
TEST(ParameterValidation, ValidateGetWorkerStatistics) {
394395
TestLogger Logger("QuicTestGetWorkerStatistics");
395396
if (TestingKernelMode) {
@@ -407,6 +408,7 @@ TEST(ParameterValidation, ValidateWorkerStatistics) {
407408
QuicTestValidateWorkerStatistics();
408409
}
409410
}
411+
#endif // QUIC_API_ENABLE_PREVIEW_FEATURES
410412

411413
TEST(ParameterValidation, ValidateConfiguration) {
412414
#ifdef QUIC_TEST_SCHANNEL_FLAGS

src/test/bin/winkernel/control.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -463,8 +463,10 @@ ExecuteTestRequest(
463463
RegisterTestFunction(QuicTestTlsHandshakeInfo);
464464
RegisterTestFunction(QuicTestStreamParam);
465465
RegisterTestFunction(QuicTestGetPerfCounters);
466+
#ifndef _KERNEL_MODE
466467
RegisterTestFunction(QuicTestGetWorkerStatistics);
467468
RegisterTestFunction(QuicTestValidateWorkerStatistics);
469+
#endif
468470
RegisterTestFunction(QuicTestValidateConfiguration);
469471
RegisterTestFunction(QuicTestValidateListener);
470472
RegisterTestFunction(QuicTestValidateConnection);

src/test/lib/ApiTest.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6045,6 +6045,7 @@ QuicTestGetPerfCounters()
60456045
TEST_EQUAL(BufferLength, (sizeof(uint64_t) * (QUIC_PERF_COUNTER_MAX - 4)));
60466046
}
60476047

6048+
#ifdef QUIC_API_ENABLE_PREVIEW_FEATURES
60486049
void
60496050
QuicTestGetWorkerStatistics()
60506051
{
@@ -6225,6 +6226,7 @@ QuicTestValidateWorkerStatistics()
62256226
delete[] BeforeBuffer;
62266227
delete[] AfterBuffer;
62276228
}
6229+
#endif // QUIC_API_ENABLE_PREVIEW_FEATURES
62286230

62296231
#ifdef QUIC_API_ENABLE_PREVIEW_FEATURES
62306232
void

0 commit comments

Comments
 (0)