Skip to content

Commit

Permalink
Update Polling Idle Timeout Dynamically (#3592)
Browse files Browse the repository at this point in the history
  • Loading branch information
nibanks committed Jun 16, 2023
1 parent b08b0ec commit 9cb2760
Show file tree
Hide file tree
Showing 13 changed files with 117 additions and 31 deletions.
17 changes: 12 additions & 5 deletions src/core/library.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down
8 changes: 4 additions & 4 deletions src/generated/linux/library.c.clog.h
Original file line number Diff line number Diff line change
Expand Up @@ -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)\
Expand Down
8 changes: 4 additions & 4 deletions src/generated/linux/library.c.clog.h.lttng.h
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
12 changes: 11 additions & 1 deletion src/inc/quic_datapath.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
11 changes: 11 additions & 0 deletions src/platform/datapath_epoll.c
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
11 changes: 11 additions & 0 deletions src/platform/datapath_kqueue.c
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
10 changes: 10 additions & 0 deletions src/platform/datapath_raw.c
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
10 changes: 10 additions & 0 deletions src/platform/datapath_raw.h
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
11 changes: 11 additions & 0 deletions src/platform/datapath_raw_dpdk.c
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
11 changes: 11 additions & 0 deletions src/platform/datapath_raw_xdp.c
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
11 changes: 11 additions & 0 deletions src/platform/datapath_winkernel.c
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
11 changes: 11 additions & 0 deletions src/platform/datapath_winuser.c
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
17 changes: 0 additions & 17 deletions src/test/lib/ApiTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down

0 comments on commit 9cb2760

Please sign in to comment.