Skip to content

Commit a9694eb

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 a9694eb

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;
@@ -1644,6 +1645,45 @@ const _: () = {
16441645
["Offset of field: QUIC_LISTENER_STATISTICS::BindingRecvDroppedPackets"]
16451646
[::std::mem::offset_of!(QUIC_LISTENER_STATISTICS, BindingRecvDroppedPackets) - 16usize];
16461647
};
1648+
#[repr(C)]
1649+
#[derive(Debug, Copy, Clone)]
1650+
pub struct QUIC_WORKER_STATISTICS {
1651+
pub IdealProcessor: u16,
1652+
pub Reserved: [u8; 6usize],
1653+
pub CumulativeActiveTimeUs: u64,
1654+
pub CumulativeWallTimeUs: u64,
1655+
}
1656+
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
1657+
const _: () = {
1658+
["Size of QUIC_WORKER_STATISTICS"][::std::mem::size_of::<QUIC_WORKER_STATISTICS>() - 24usize];
1659+
["Alignment of QUIC_WORKER_STATISTICS"]
1660+
[::std::mem::align_of::<QUIC_WORKER_STATISTICS>() - 8usize];
1661+
["Offset of field: QUIC_WORKER_STATISTICS::IdealProcessor"]
1662+
[::std::mem::offset_of!(QUIC_WORKER_STATISTICS, IdealProcessor) - 0usize];
1663+
["Offset of field: QUIC_WORKER_STATISTICS::Reserved"]
1664+
[::std::mem::offset_of!(QUIC_WORKER_STATISTICS, Reserved) - 2usize];
1665+
["Offset of field: QUIC_WORKER_STATISTICS::CumulativeActiveTimeUs"]
1666+
[::std::mem::offset_of!(QUIC_WORKER_STATISTICS, CumulativeActiveTimeUs) - 8usize];
1667+
["Offset of field: QUIC_WORKER_STATISTICS::CumulativeWallTimeUs"]
1668+
[::std::mem::offset_of!(QUIC_WORKER_STATISTICS, CumulativeWallTimeUs) - 16usize];
1669+
};
1670+
#[repr(C)]
1671+
#[derive(Debug, Copy, Clone)]
1672+
pub struct QUIC_WORKER_STATISTICS_LIST {
1673+
pub WorkerCount: u32,
1674+
pub WorkerStatsSize: u32,
1675+
}
1676+
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
1677+
const _: () = {
1678+
["Size of QUIC_WORKER_STATISTICS_LIST"]
1679+
[::std::mem::size_of::<QUIC_WORKER_STATISTICS_LIST>() - 8usize];
1680+
["Alignment of QUIC_WORKER_STATISTICS_LIST"]
1681+
[::std::mem::align_of::<QUIC_WORKER_STATISTICS_LIST>() - 4usize];
1682+
["Offset of field: QUIC_WORKER_STATISTICS_LIST::WorkerCount"]
1683+
[::std::mem::offset_of!(QUIC_WORKER_STATISTICS_LIST, WorkerCount) - 0usize];
1684+
["Offset of field: QUIC_WORKER_STATISTICS_LIST::WorkerStatsSize"]
1685+
[::std::mem::offset_of!(QUIC_WORKER_STATISTICS_LIST, WorkerStatsSize) - 4usize];
1686+
};
16471687
pub const QUIC_PERFORMANCE_COUNTERS_QUIC_PERF_COUNTER_CONN_CREATED: QUIC_PERFORMANCE_COUNTERS = 0;
16481688
pub const QUIC_PERFORMANCE_COUNTERS_QUIC_PERF_COUNTER_CONN_HANDSHAKE_FAIL:
16491689
QUIC_PERFORMANCE_COUNTERS = 1;

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;
@@ -1637,6 +1638,45 @@ const _: () = {
16371638
["Offset of field: QUIC_LISTENER_STATISTICS::BindingRecvDroppedPackets"]
16381639
[::std::mem::offset_of!(QUIC_LISTENER_STATISTICS, BindingRecvDroppedPackets) - 16usize];
16391640
};
1641+
#[repr(C)]
1642+
#[derive(Debug, Copy, Clone)]
1643+
pub struct QUIC_WORKER_STATISTICS {
1644+
pub IdealProcessor: u16,
1645+
pub Reserved: [u8; 6usize],
1646+
pub CumulativeActiveTimeUs: u64,
1647+
pub CumulativeWallTimeUs: u64,
1648+
}
1649+
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
1650+
const _: () = {
1651+
["Size of QUIC_WORKER_STATISTICS"][::std::mem::size_of::<QUIC_WORKER_STATISTICS>() - 24usize];
1652+
["Alignment of QUIC_WORKER_STATISTICS"]
1653+
[::std::mem::align_of::<QUIC_WORKER_STATISTICS>() - 8usize];
1654+
["Offset of field: QUIC_WORKER_STATISTICS::IdealProcessor"]
1655+
[::std::mem::offset_of!(QUIC_WORKER_STATISTICS, IdealProcessor) - 0usize];
1656+
["Offset of field: QUIC_WORKER_STATISTICS::Reserved"]
1657+
[::std::mem::offset_of!(QUIC_WORKER_STATISTICS, Reserved) - 2usize];
1658+
["Offset of field: QUIC_WORKER_STATISTICS::CumulativeActiveTimeUs"]
1659+
[::std::mem::offset_of!(QUIC_WORKER_STATISTICS, CumulativeActiveTimeUs) - 8usize];
1660+
["Offset of field: QUIC_WORKER_STATISTICS::CumulativeWallTimeUs"]
1661+
[::std::mem::offset_of!(QUIC_WORKER_STATISTICS, CumulativeWallTimeUs) - 16usize];
1662+
};
1663+
#[repr(C)]
1664+
#[derive(Debug, Copy, Clone)]
1665+
pub struct QUIC_WORKER_STATISTICS_LIST {
1666+
pub WorkerCount: u32,
1667+
pub WorkerStatsSize: u32,
1668+
}
1669+
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
1670+
const _: () = {
1671+
["Size of QUIC_WORKER_STATISTICS_LIST"]
1672+
[::std::mem::size_of::<QUIC_WORKER_STATISTICS_LIST>() - 8usize];
1673+
["Alignment of QUIC_WORKER_STATISTICS_LIST"]
1674+
[::std::mem::align_of::<QUIC_WORKER_STATISTICS_LIST>() - 4usize];
1675+
["Offset of field: QUIC_WORKER_STATISTICS_LIST::WorkerCount"]
1676+
[::std::mem::offset_of!(QUIC_WORKER_STATISTICS_LIST, WorkerCount) - 0usize];
1677+
["Offset of field: QUIC_WORKER_STATISTICS_LIST::WorkerStatsSize"]
1678+
[::std::mem::offset_of!(QUIC_WORKER_STATISTICS_LIST, WorkerStatsSize) - 4usize];
1679+
};
16401680
pub const QUIC_PERFORMANCE_COUNTERS_QUIC_PERF_COUNTER_CONN_CREATED: QUIC_PERFORMANCE_COUNTERS = 0;
16411681
pub const QUIC_PERFORMANCE_COUNTERS_QUIC_PERF_COUNTER_CONN_HANDSHAKE_FAIL:
16421682
QUIC_PERFORMANCE_COUNTERS = 1;

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)