Skip to content

Commit 8cce724

Browse files
authored
Refactor Global Execution Config Flags (#5059)
1 parent 56d7de7 commit 8cce724

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

59 files changed

+1118
-490
lines changed

.github/workflows/build.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ jobs:
6666
os: 'windows-2022'
6767
arch: 'x64'
6868
tls: 'schannel'
69-
official: '-OfficialRelease'
69+
official: '-ForceOfficialRelease'
7070
repo: ${{ github.repository }}
7171

7272
build-windows-kernel:

docs/Settings.md

+2
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,9 @@ The following settings are available via registry as well as via [QUIC_SETTINGS]
6565
| Congestion Control Algorithm | uint16_t | CongestionControlAlgorithm | 0 (Cubic) | The congestion control algorithm used for the connection. |
6666
| ECN | uint8_t | EcnEnabled | 0 (FALSE) | Enable sender-side ECN support. |
6767
| Stream Multi Receive | uint8_t | StreamMultiReceiveEnabled | 0 (FALSE) | Enable multi receive support |
68+
| XDP | uint8_t | XdpEnabled | 0 (FALSE) | Enable XDP. |
6869
| QTIP | uint8_t | QTIPEnabled | 0 (FALSE) | Enable QTIP. XDP must be used. Clients will only send/recv QTIP xor UDP traffic, listeners accept both. [More info](./QTIP.md)|
70+
| RIO | uint8_t | RioEnabled | 0 (FALSE) | Enable RIO. |
6971

7072
The types map to registry types as follows:
7173
- `uint64_t` is a `REG_QWORD`.

docs/api/QUIC_SETTINGS.md

+6-2
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,10 @@ typedef struct QUIC_SETTINGS {
5555
uint64_t OneWayDelayEnabled : 1;
5656
uint64_t NetStatsEventEnabled : 1;
5757
uint64_t StreamMultiReceiveEnabled : 1;
58+
uint64_t XdpEnabled : 1;
5859
uint64_t QTIPEnabled : 1;
59-
uint64_t RESERVED : 20;
60+
uint64_t RioEnabled : 1;
61+
uint64_t RESERVED : 18;
6062
#else
6163
uint64_t RESERVED : 26;
6264
#endif
@@ -107,8 +109,10 @@ typedef struct QUIC_SETTINGS {
107109
uint64_t OneWayDelayEnabled : 1;
108110
uint64_t NetStatsEventEnabled : 1;
109111
uint64_t StreamMultiReceiveEnabled : 1;
112+
uint64_t XdpEnabled : 1;
110113
uint64_t QTIPEnabled : 1;
111-
uint64_t ReservedFlags : 57;
114+
uint64_t RioEnabled : 1;
115+
uint64_t ReservedFlags : 55;
112116
#else
113117
uint64_t ReservedFlags : 63;
114118
#endif

scripts/build.ps1

+7
Original file line numberDiff line numberDiff line change
@@ -198,6 +198,9 @@ param (
198198
[Parameter(Mandatory = $false)]
199199
[switch]$OfficialRelease = $false,
200200

201+
[Parameter(Mandatory = $false)]
202+
[switch]$ForceOfficialRelease = $false,
203+
201204
[Parameter(Mandatory = $false)]
202205
[switch]$EnableTelemetryAsserts = $true,
203206

@@ -301,6 +304,10 @@ if ($OfficialRelease) {
301304
$global:LASTEXITCODE = 0
302305
}
303306

307+
if ($ForceOfficialRelease) {
308+
$OfficialRelease = $true
309+
}
310+
304311
# Root directory of the project.
305312
$RootDir = Split-Path $PSScriptRoot -Parent
306313

src/core/connection.c

+20-2
Original file line numberDiff line numberDiff line change
@@ -1840,7 +1840,7 @@ QuicConnStart(
18401840
CXPLAT_UDP_CONFIG UdpConfig = {0};
18411841
UdpConfig.LocalAddress = Connection->State.LocalAddressSet ? &Path->Route.LocalAddress : NULL;
18421842
UdpConfig.RemoteAddress = &Path->Route.RemoteAddress;
1843-
UdpConfig.Flags = Connection->State.ShareBinding ? CXPLAT_SOCKET_FLAG_SHARE : 0;
1843+
UdpConfig.Flags = CXPLAT_SOCKET_FLAG_NONE;
18441844
UdpConfig.InterfaceIndex = Connection->State.LocalInterfaceSet ? (uint32_t)Path->Route.LocalAddress.Ipv6.sin6_scope_id : 0, // NOLINT(google-readability-casting)
18451845
UdpConfig.PartitionIndex = QuicPartitionIdGetIndex(Connection->PartitionID);
18461846
#ifdef QUIC_COMPARTMENT_ID
@@ -1850,9 +1850,18 @@ QuicConnStart(
18501850
UdpConfig.OwningProcess = Configuration->OwningProcess;
18511851
#endif
18521852

1853+
if (Connection->State.ShareBinding) {
1854+
UdpConfig.Flags |= CXPLAT_SOCKET_FLAG_SHARE;
1855+
}
1856+
if (Connection->Settings.XdpEnabled) {
1857+
UdpConfig.Flags |= CXPLAT_SOCKET_FLAG_XDP;
1858+
}
18531859
if (Connection->Settings.QTIPEnabled) {
18541860
UdpConfig.Flags |= CXPLAT_SOCKET_FLAG_QTIP;
18551861
}
1862+
if (Connection->Settings.RioEnabled) {
1863+
UdpConfig.Flags |= CXPLAT_SOCKET_FLAG_RIO;
1864+
}
18561865

18571866
//
18581867
// Get the binding for the current local & remote addresses.
@@ -6228,17 +6237,26 @@ QuicConnParamSet(
62286237
CXPLAT_UDP_CONFIG UdpConfig = {0};
62296238
UdpConfig.LocalAddress = LocalAddress;
62306239
UdpConfig.RemoteAddress = &Connection->Paths[0].Route.RemoteAddress;
6231-
UdpConfig.Flags = Connection->State.ShareBinding ? CXPLAT_SOCKET_FLAG_SHARE : 0;
6240+
UdpConfig.Flags = CXPLAT_SOCKET_FLAG_NONE;
62326241
UdpConfig.InterfaceIndex = 0;
62336242
#ifdef QUIC_COMPARTMENT_ID
62346243
UdpConfig.CompartmentId = Connection->Configuration->CompartmentId;
62356244
#endif
62366245
#ifdef QUIC_OWNING_PROCESS
62376246
UdpConfig.OwningProcess = Connection->Configuration->OwningProcess;
62386247
#endif
6248+
if (Connection->State.ShareBinding) {
6249+
UdpConfig.Flags |= CXPLAT_SOCKET_FLAG_SHARE;
6250+
}
6251+
if (Connection->Settings.XdpEnabled) {
6252+
UdpConfig.Flags |= CXPLAT_SOCKET_FLAG_XDP;
6253+
}
62396254
if (Connection->Settings.QTIPEnabled) {
62406255
UdpConfig.Flags |= CXPLAT_SOCKET_FLAG_QTIP;
62416256
}
6257+
if (Connection->Settings.RioEnabled) {
6258+
UdpConfig.Flags |= CXPLAT_SOCKET_FLAG_RIO;
6259+
}
62426260
Status =
62436261
QuicLibraryGetBinding(
62446262
&UdpConfig,

src/core/connection_pool.c

+27-9
Original file line numberDiff line numberDiff line change
@@ -158,15 +158,13 @@ QUIC_STATUS
158158
QuicConnPoolGetStartingLocalAddress(
159159
_In_ QUIC_ADDR* RemoteAddress,
160160
_Out_ QUIC_ADDR* LocalAddress,
161-
_In_ BOOLEAN UseQTIP
161+
_In_ CXPLAT_SOCKET_FLAGS SocketFlags
162162
)
163163
{
164164
CXPLAT_SOCKET* Socket = NULL;
165165
CXPLAT_UDP_CONFIG UdpConfig;
166166
CxPlatZeroMemory(&UdpConfig, sizeof(UdpConfig));
167-
if (UseQTIP) {
168-
UdpConfig.Flags |= CXPLAT_SOCKET_FLAG_QTIP;
169-
}
167+
UdpConfig.Flags = SocketFlags;
170168
UdpConfig.RemoteAddress = RemoteAddress;
171169
QUIC_STATUS Status =
172170
CxPlatSocketCreateUdp(MsQuicLib.Datapath, &UdpConfig, &Socket);
@@ -462,17 +460,37 @@ MsQuicConnectionPoolCreate(
462460
// Copying how Connection Settings flow downwards. It will first inherit the global settings,
463461
// if a global setting field is not set, but the configuration setting is set, override the global.
464462
//
465-
BOOLEAN UseQTIP = MsQuicLib.Settings.QTIPEnabled;
466-
if (!MsQuicLib.Settings.IsSet.QTIPEnabled
467-
&& ((QUIC_CONFIGURATION*) Config->Configuration)->Settings.IsSet.QTIPEnabled) {
468-
UseQTIP = ((QUIC_CONFIGURATION*) Config->Configuration)->Settings.QTIPEnabled;
463+
QUIC_CONFIGURATION* ConnectionConfig =
464+
(QUIC_CONFIGURATION*)Config->Configuration;
465+
CXPLAT_SOCKET_FLAGS SocketFlags = CXPLAT_SOCKET_FLAG_NONE;
466+
467+
if (MsQuicLib.Settings.XdpEnabled) {
468+
SocketFlags |= CXPLAT_SOCKET_FLAG_XDP;
469+
}
470+
if (ConnectionConfig->Settings.IsSet.XdpEnabled) {
471+
if (ConnectionConfig->Settings.XdpEnabled) {
472+
SocketFlags |= CXPLAT_SOCKET_FLAG_XDP;
473+
} else {
474+
SocketFlags &= ~CXPLAT_SOCKET_FLAG_XDP;
475+
}
476+
}
477+
478+
if (MsQuicLib.Settings.QTIPEnabled) {
479+
SocketFlags |= CXPLAT_SOCKET_FLAG_QTIP;
480+
}
481+
if (ConnectionConfig->Settings.IsSet.QTIPEnabled) {
482+
if (ConnectionConfig->Settings.QTIPEnabled) {
483+
SocketFlags |= CXPLAT_SOCKET_FLAG_QTIP;
484+
} else {
485+
SocketFlags &= ~CXPLAT_SOCKET_FLAG_QTIP;
486+
}
469487
}
470488

471489
//
472490
// Get the local address and a port to start from.
473491
//
474492
QUIC_ADDR LocalAddress;
475-
Status = QuicConnPoolGetStartingLocalAddress(&ResolvedRemoteAddress, &LocalAddress, UseQTIP);
493+
Status = QuicConnPoolGetStartingLocalAddress(&ResolvedRemoteAddress, &LocalAddress, SocketFlags);
476494
if (QUIC_FAILED(Status)) {
477495
goto Error;
478496
}

src/core/library.c

+32-13
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,19 @@ QuicLibraryEvaluateSendRetryState(
3030
void
3131
);
3232

33+
CXPLAT_DATAPATH_FEATURES
34+
QuicLibraryGetDatapathFeatures(
35+
void
36+
)
37+
{
38+
CXPLAT_SOCKET_FLAGS SocketFlags = CXPLAT_SOCKET_FLAG_NONE;
39+
if (MsQuicLib.Settings.XdpEnabled) {
40+
SocketFlags |= CXPLAT_SOCKET_FLAG_XDP;
41+
}
42+
CXPLAT_DBG_ASSERT(MsQuicLib.Datapath != NULL);
43+
return CxPlatDataPathGetSupportedFeatures(MsQuicLib.Datapath, SocketFlags);
44+
}
45+
3346
//
3447
// Initializes all global variables if not already done.
3548
//
@@ -700,13 +713,18 @@ QuicLibraryLazyInitialize(
700713
&DatapathCallbacks,
701714
NULL, // TcpCallbacks
702715
MsQuicLib.WorkerPool,
703-
MsQuicLib.ExecutionConfig,
704716
&MsQuicLib.Datapath);
705717
if (QUIC_SUCCEEDED(Status)) {
706718
QuicTraceEvent(
707719
DataPathInitialized,
708720
"[data] Initialized, DatapathFeatures=%u",
709-
CxPlatDataPathGetSupportedFeatures(MsQuicLib.Datapath));
721+
QuicLibraryGetDatapathFeatures());
722+
if (MsQuicLib.ExecutionConfig &&
723+
MsQuicLib.ExecutionConfig->PollingIdleTimeoutUs != 0) {
724+
CxPlatDataPathUpdatePollingIdleTimeout(
725+
MsQuicLib.Datapath,
726+
MsQuicLib.ExecutionConfig->PollingIdleTimeoutUs);
727+
}
710728
} else {
711729
MsQuicLibraryFreePartitions();
712730
#ifndef _KERNEL_MODE
@@ -839,6 +857,8 @@ QuicLibrarySetGlobalParam(
839857
QUIC_STATUS Status = QUIC_STATUS_SUCCESS;
840858
QUIC_SETTINGS_INTERNAL InternalSettings = {0};
841859

860+
CXPLAT_DBG_ASSERT(MsQuicLib.Loaded);
861+
842862
switch (Param) {
843863
case QUIC_PARAM_GLOBAL_RETRY_MEMORY_PERCENT:
844864

@@ -1040,13 +1060,9 @@ QuicLibrarySetGlobalParam(
10401060
CXPLAT_DBG_ASSERT(MsQuicLib.Partitions != NULL);
10411061
CXPLAT_DBG_ASSERT(MsQuicLib.Datapath != NULL);
10421062

1043-
if (MsQuicLib.ExecutionConfig == NULL) {
1044-
Status = QUIC_STATUS_INVALID_STATE;
1045-
} else {
1046-
MsQuicLib.ExecutionConfig->PollingIdleTimeoutUs = Config->PollingIdleTimeoutUs;
1047-
CxPlatDataPathUpdateConfig(MsQuicLib.Datapath, MsQuicLib.ExecutionConfig);
1048-
Status = QUIC_STATUS_SUCCESS;
1049-
}
1063+
CxPlatDataPathUpdatePollingIdleTimeout(
1064+
MsQuicLib.Datapath, Config->PollingIdleTimeoutUs);
1065+
Status = QUIC_STATUS_SUCCESS;
10501066
CxPlatLockRelease(&MsQuicLib.Lock);
10511067
break;
10521068
}
@@ -1188,6 +1204,8 @@ QuicLibraryGetGlobalParam(
11881204
QUIC_STATUS Status;
11891205
uint32_t GitHashLength;
11901206

1207+
CXPLAT_DBG_ASSERT(MsQuicLib.Loaded);
1208+
11911209
switch (Param) {
11921210
case QUIC_PARAM_GLOBAL_RETRY_MEMORY_PERCENT:
11931211

@@ -1379,7 +1397,7 @@ QuicLibraryGetGlobalParam(
13791397
Status = QUIC_STATUS_SUCCESS;
13801398
break;
13811399

1382-
case QUIC_PARAM_GLOBAL_DATAPATH_FEATURES:
1400+
case QUIC_PARAM_GLOBAL_DATAPATH_FEATURES: {
13831401
if (*BufferLength < sizeof(uint32_t)) {
13841402
*BufferLength = sizeof(uint32_t);
13851403
Status = QUIC_STATUS_BUFFER_TOO_SMALL;
@@ -1397,10 +1415,11 @@ QuicLibraryGetGlobalParam(
13971415
}
13981416

13991417
*BufferLength = sizeof(uint32_t);
1400-
*(uint32_t*)Buffer = CxPlatDataPathGetSupportedFeatures(MsQuicLib.Datapath);
1418+
*(uint32_t*)Buffer = QuicLibraryGetDatapathFeatures();
14011419

14021420
Status = QUIC_STATUS_SUCCESS;
14031421
break;
1422+
}
14041423

14051424
case QUIC_PARAM_GLOBAL_VERSION_NEGOTIATION_ENABLED:
14061425

@@ -2040,7 +2059,7 @@ QuicLibraryGetBinding(
20402059
// one and already create the binding.
20412060
//
20422061

2043-
if (CxPlatDataPathGetSupportedFeatures(MsQuicLib.Datapath) & CXPLAT_DATAPATH_FEATURE_LOCAL_PORT_SHARING) {
2062+
if (QuicLibraryGetDatapathFeatures() & CXPLAT_DATAPATH_FEATURE_LOCAL_PORT_SHARING) {
20442063
//
20452064
// The datapath supports multiple connected sockets on the same local
20462065
// tuple, so we need to do collision detection based on the whole
@@ -2275,7 +2294,7 @@ QuicTraceRundown(
22752294
QuicTraceEvent(
22762295
DataPathRundown,
22772296
"[data] Rundown, DatapathFeatures=%u",
2278-
CxPlatDataPathGetSupportedFeatures(MsQuicLib.Datapath));
2297+
QuicLibraryGetDatapathFeatures());
22792298
}
22802299

22812300
QuicTraceEvent(

src/core/listener.c

+6
Original file line numberDiff line numberDiff line change
@@ -330,9 +330,15 @@ MsQuicListenerStart(
330330
UdpConfig.CibirIdLength);
331331
}
332332

333+
if (MsQuicLib.Settings.XdpEnabled) {
334+
UdpConfig.Flags |= CXPLAT_SOCKET_FLAG_XDP;
335+
}
333336
if (MsQuicLib.Settings.QTIPEnabled) {
334337
UdpConfig.Flags |= CXPLAT_SOCKET_FLAG_QTIP;
335338
}
339+
if (MsQuicLib.Settings.RioEnabled) {
340+
UdpConfig.Flags |= CXPLAT_SOCKET_FLAG_RIO;
341+
}
336342

337343
CXPLAT_TEL_ASSERT(Listener->Binding == NULL);
338344
Status =

src/core/quicdef.h

+12
Original file line numberDiff line numberDiff line change
@@ -523,11 +523,21 @@ CXPLAT_STATIC_ASSERT(
523523
//
524524
#define QUIC_DEFAULT_RELIABLE_RESET_ENABLED FALSE
525525

526+
//
527+
// The default settings for allowing XDP support
528+
//
529+
#define QUIC_DEFAULT_XDP_ENABLED FALSE
530+
526531
//
527532
// The default settings for allowing QTIP support
528533
//
529534
#define QUIC_DEFAULT_QTIP_ENABLED FALSE
530535

536+
//
537+
// The default settings for allowing RIO support
538+
//
539+
#define QUIC_DEFAULT_RIO_ENABLED FALSE
540+
531541
//
532542
// The default settings for allowing One-Way Delay support.
533543
//
@@ -647,7 +657,9 @@ CXPLAT_STATIC_ASSERT(
647657
#define QUIC_SETTING_HYSTART_ENABLED "HyStartEnabled"
648658
#define QUIC_SETTING_ENCRYPTION_OFFLOAD_ALLOWED "EncryptionOffloadAllowed"
649659
#define QUIC_SETTING_RELIABLE_RESET_ENABLED "ReliableResetEnabled"
660+
#define QUIC_SETTING_XDP_ENABLED "XdpEnabled"
650661
#define QUIC_SETTING_QTIP_ENABLED "QTIPEnabled"
662+
#define QUIC_SETTING_RIO_ENABLED "RioEnabled"
651663
#define QUIC_SETTING_ONE_WAY_DELAY_ENABLED "OneWayDelayEnabled"
652664
#define QUIC_SETTING_NET_STATS_EVENT_ENABLED "NetStatsEventEnabled"
653665
#define QUIC_SETTING_STREAM_MULTI_RECEIVE_ENABLED "StreamMultiReceiveEnabled"

0 commit comments

Comments
 (0)