diff --git a/src/core/library.c b/src/core/library.c index 5fce75c18d..22ee0a23cd 100644 --- a/src/core/library.c +++ b/src/core/library.c @@ -976,11 +976,18 @@ QuicLibrarySetGlobalParam( } if (MsQuicLib.Datapath != NULL) { - QuicTraceEvent( - LibraryError, - "[ lib] ERROR, %s.", - "Tried to change execution config after datapath initialization"); - Status = QUIC_STATUS_INVALID_STATE; + // + // We only allow for updating the polling idle timeout after the + // datapath has already been started; and only if the app set some + // custom config to begin with. + // + if (MsQuicLib.ExecutionConfig == NULL) { + Status = QUIC_STATUS_INVALID_STATE; + } else { + MsQuicLib.ExecutionConfig->PollingIdleTimeoutUs = Config->PollingIdleTimeoutUs; + CxPlatDataPathUpdateConfig(MsQuicLib.Datapath, MsQuicLib.ExecutionConfig); + Status = QUIC_STATUS_SUCCESS; + } break; } diff --git a/src/generated/linux/library.c.clog.h b/src/generated/linux/library.c.clog.h index 2b65a1e37f..7311bfc267 100644 --- a/src/generated/linux/library.c.clog.h +++ b/src/generated/linux/library.c.clog.h @@ -490,10 +490,10 @@ tracepoint(CLOG_LIBRARY_C, DataPathInitialized , arg2);\ // Decoder Ring for LibraryError // [ lib] ERROR, %s. // QuicTraceEvent( - LibraryError, - "[ lib] ERROR, %s.", - "Tried to change execution config after datapath initialization"); -// arg2 = arg2 = "Tried to change execution config after datapath initialization" = arg2 + LibraryError, + "[ lib] ERROR, %s.", + "Only v2 is supported in MsQuicOpenVersion"); +// arg2 = arg2 = "Only v2 is supported in MsQuicOpenVersion" = arg2 ----------------------------------------------------------*/ #ifndef _clog_3_ARGS_TRACE_LibraryError #define _clog_3_ARGS_TRACE_LibraryError(uniqueId, encoded_arg_string, arg2)\ diff --git a/src/generated/linux/library.c.clog.h.lttng.h b/src/generated/linux/library.c.clog.h.lttng.h index 8310eee650..0528d09c09 100644 --- a/src/generated/linux/library.c.clog.h.lttng.h +++ b/src/generated/linux/library.c.clog.h.lttng.h @@ -478,10 +478,10 @@ TRACEPOINT_EVENT(CLOG_LIBRARY_C, DataPathInitialized, // Decoder Ring for LibraryError // [ lib] ERROR, %s. // QuicTraceEvent( - LibraryError, - "[ lib] ERROR, %s.", - "Tried to change execution config after datapath initialization"); -// arg2 = arg2 = "Tried to change execution config after datapath initialization" = arg2 + LibraryError, + "[ lib] ERROR, %s.", + "Only v2 is supported in MsQuicOpenVersion"); +// arg2 = arg2 = "Only v2 is supported in MsQuicOpenVersion" = arg2 ----------------------------------------------------------*/ TRACEPOINT_EVENT(CLOG_LIBRARY_C, LibraryError, TP_ARGS( diff --git a/src/inc/quic_datapath.h b/src/inc/quic_datapath.h index db01e94f31..67bdb8376d 100644 --- a/src/inc/quic_datapath.h +++ b/src/inc/quic_datapath.h @@ -428,7 +428,17 @@ CxPlatDataPathInitialize( _IRQL_requires_max_(PASSIVE_LEVEL) void CxPlatDataPathUninitialize( - _In_ CXPLAT_DATAPATH* datapath + _In_ CXPLAT_DATAPATH* Datapath + ); + +// +// Updates the execution configuration of a datapath. +// +_IRQL_requires_max_(PASSIVE_LEVEL) +void +CxPlatDataPathUpdateConfig( + _In_ CXPLAT_DATAPATH* Datapath, + _In_ QUIC_EXECUTION_CONFIG* Config ); #define CXPLAT_DATAPATH_FEATURE_RECV_SIDE_SCALING 0x0001 diff --git a/src/platform/datapath_epoll.c b/src/platform/datapath_epoll.c index c0029e86a0..79b6a54fc5 100644 --- a/src/platform/datapath_epoll.c +++ b/src/platform/datapath_epoll.c @@ -732,6 +732,17 @@ CxPlatDataPathUninitialize( } } +_IRQL_requires_max_(PASSIVE_LEVEL) +void +CxPlatDataPathUpdateConfig( + _In_ CXPLAT_DATAPATH* Datapath, + _In_ QUIC_EXECUTION_CONFIG* Config + ) +{ + UNREFERENCED_PARAMETER(Datapath); + UNREFERENCED_PARAMETER(Config); +} + _IRQL_requires_max_(DISPATCH_LEVEL) uint32_t CxPlatDataPathGetSupportedFeatures( diff --git a/src/platform/datapath_kqueue.c b/src/platform/datapath_kqueue.c index 7a3e973fa0..392452c1b7 100644 --- a/src/platform/datapath_kqueue.c +++ b/src/platform/datapath_kqueue.c @@ -573,6 +573,17 @@ CxPlatDataPathUninitialize( } } +_IRQL_requires_max_(PASSIVE_LEVEL) +void +CxPlatDataPathUpdateConfig( + _In_ CXPLAT_DATAPATH* Datapath, + _In_ QUIC_EXECUTION_CONFIG* Config + ) +{ + UNREFERENCED_PARAMETER(Datapath); + UNREFERENCED_PARAMETER(Config); +} + _IRQL_requires_max_(DISPATCH_LEVEL) uint32_t CxPlatDataPathGetSupportedFeatures( diff --git a/src/platform/datapath_raw.c b/src/platform/datapath_raw.c index 76a51efbe6..0a9754179c 100644 --- a/src/platform/datapath_raw.c +++ b/src/platform/datapath_raw.c @@ -226,6 +226,16 @@ CxPlatDataPathUninitializeComplete( CxPlatRundownRelease(&CxPlatWorkerRundown); } +_IRQL_requires_max_(PASSIVE_LEVEL) +void +CxPlatDataPathUpdateConfig( + _In_ CXPLAT_DATAPATH* Datapath, + _In_ QUIC_EXECUTION_CONFIG* Config + ) +{ + CxPlatDpRawUpdateConfig(Datapath, Config); +} + _IRQL_requires_max_(DISPATCH_LEVEL) uint32_t CxPlatDataPathGetSupportedFeatures( diff --git a/src/platform/datapath_raw.h b/src/platform/datapath_raw.h index b3fd512e9e..e5d40bc83b 100644 --- a/src/platform/datapath_raw.h +++ b/src/platform/datapath_raw.h @@ -142,6 +142,16 @@ CxPlatDataPathUninitializeComplete( _In_ CXPLAT_DATAPATH* Datapath ); +// +// Updates the datapath configuration. +// +_IRQL_requires_max_(PASSIVE_LEVEL) +void +CxPlatDpRawUpdateConfig( + _In_ CXPLAT_DATAPATH* Datapath, + _In_ QUIC_EXECUTION_CONFIG* Config + ); + // // Called on creation and deletion of a socket. It indicates to the raw datapath // that it should update any filtering rules as necessary. diff --git a/src/platform/datapath_raw_dpdk.c b/src/platform/datapath_raw_dpdk.c index 15640e23d0..a10e0656ab 100644 --- a/src/platform/datapath_raw_dpdk.c +++ b/src/platform/datapath_raw_dpdk.c @@ -224,6 +224,17 @@ CxPlatDpRawUninitialize( CxPlatEventUninitialize(Dpdk->StartComplete); } +_IRQL_requires_max_(PASSIVE_LEVEL) +void +CxPlatDpRawUpdateConfig( + _In_ CXPLAT_DATAPATH* Datapath, + _In_ QUIC_EXECUTION_CONFIG* Config + ) +{ + UNREFERENCED_PARAMETER(Datapath); + UNREFERENCED_PARAMETER(Config); +} + _IRQL_requires_max_(PASSIVE_LEVEL) QUIC_STATUS CxPlatSocketUpdateQeo( diff --git a/src/platform/datapath_raw_xdp.c b/src/platform/datapath_raw_xdp.c index 48bebb2d1a..7165d051e3 100644 --- a/src/platform/datapath_raw_xdp.c +++ b/src/platform/datapath_raw_xdp.c @@ -1321,6 +1321,17 @@ CxPlatDpRawUninitialize( CxPlatDpRawRelease(Xdp); } +_IRQL_requires_max_(PASSIVE_LEVEL) +void +CxPlatDpRawUpdateConfig( + _In_ CXPLAT_DATAPATH* Datapath, + _In_ QUIC_EXECUTION_CONFIG* Config + ) +{ + XDP_DATAPATH* Xdp = (XDP_DATAPATH*)Datapath; + Xdp->PollingIdleTimeoutUs = Config->PollingIdleTimeoutUs; +} + _IRQL_requires_max_(PASSIVE_LEVEL) QUIC_STATUS CxPlatSocketUpdateQeo( diff --git a/src/platform/datapath_winkernel.c b/src/platform/datapath_winkernel.c index dee26fe3c1..adb3e0ff89 100644 --- a/src/platform/datapath_winkernel.c +++ b/src/platform/datapath_winkernel.c @@ -1060,6 +1060,17 @@ CxPlatDataPathUninitialize( CXPLAT_FREE(Datapath, QUIC_POOL_DATAPATH); } +_IRQL_requires_max_(PASSIVE_LEVEL) +void +CxPlatDataPathUpdateConfig( + _In_ CXPLAT_DATAPATH* Datapath, + _In_ QUIC_EXECUTION_CONFIG* Config + ) +{ + UNREFERENCED_PARAMETER(Datapath); + UNREFERENCED_PARAMETER(Config); +} + _IRQL_requires_max_(DISPATCH_LEVEL) uint32_t CxPlatDataPathGetSupportedFeatures( diff --git a/src/platform/datapath_winuser.c b/src/platform/datapath_winuser.c index 4f8596f0d4..37eb9cd124 100644 --- a/src/platform/datapath_winuser.c +++ b/src/platform/datapath_winuser.c @@ -1448,6 +1448,17 @@ CxPlatDataPathUninitialize( } } +_IRQL_requires_max_(PASSIVE_LEVEL) +void +CxPlatDataPathUpdateConfig( + _In_ CXPLAT_DATAPATH* Datapath, + _In_ QUIC_EXECUTION_CONFIG* Config + ) +{ + UNREFERENCED_PARAMETER(Datapath); + UNREFERENCED_PARAMETER(Config); +} + _IRQL_requires_max_(DISPATCH_LEVEL) uint32_t CxPlatDataPathGetSupportedFeatures( diff --git a/src/test/lib/ApiTest.cpp b/src/test/lib/ApiTest.cpp index eb01e35038..219ac76924 100644 --- a/src/test/lib/ApiTest.cpp +++ b/src/test/lib/ApiTest.cpp @@ -2128,23 +2128,6 @@ void QuicTestStatefulGlobalSetParam() sizeof(Mode), &Mode)); } - -#ifdef QUIC_API_ENABLE_PREVIEW_FEATURES - // - // Set QUIC_PARAM_GLOBAL_EXECUTION_CONFIG when MsQuicLib.Datapath != NULL - // - { - TestScopeLogger LogScope1("Set QUIC_PARAM_GLOBAL_EXECUTION_CONFIG when MsQuicLib.Datapath != NULL"); - uint16_t Data[QUIC_EXECUTION_CONFIG_MIN_SIZE] = {}; - TEST_QUIC_STATUS( - QUIC_STATUS_INVALID_STATE, - MsQuic->SetParam( - nullptr, - QUIC_PARAM_GLOBAL_EXECUTION_CONFIG, - sizeof(Data), - &Data)); - } -#endif } void QuicTestGlobalParam()