Skip to content

Commit 91a0e0a

Browse files
ami-GSnibanks
andauthored
Remove QUIC_USE_RAW_DATAPATH macro (#3781)
* Remove QUIC_USE_RAW_DATAPATH (logic only) * move logic to core side * remove QUIC_USE_RAW_DATAPATH from test * fix googletest version and add last line * replace from flag to function call * fix build error * fix build/test issues * implement CxPlatResolveRoute for normal socket * add Getter of Datapath feature * fix build issues * adopt comments * adopt comment and fix kernel build error * fix kernel build error * more fix for kernel build * add preview_feature flag back * refactoring CxPlatIsRouteReady * fix linux code check * fix comments * fix IsRouteReady and clean ifdef for _KERNEL_MODE * kernel build error * Set RouteResolved for Rx * fix more tests * move global definition in header file * kernel to avoid calling helper function * move QuitTestIsFeatureSupported after RegistrationOpen * supress warning * remove QuitTestIsFeatureSupported from quic_gtest as it doesn't work as expected by dependency of MsQuicLib.Datapath * remove raw feature check as much as possible * ifdef for UseQTIP visibility * Couple nits and cleanup --------- Co-authored-by: Nick Banks <[email protected]>
1 parent b6633ea commit 91a0e0a

29 files changed

+497
-178
lines changed

CMakeLists.txt

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -333,10 +333,6 @@ if (QUIC_ENABLE_SANITIZERS)
333333
list(APPEND QUIC_COMMON_DEFINES DISABLE_CXPLAT_POOL=1)
334334
endif()
335335

336-
if(QUIC_USE_XDP)
337-
list(APPEND QUIC_COMMON_DEFINES QUIC_USE_RAW_DATAPATH=1)
338-
endif()
339-
340336
if(QUIC_OFFICIAL_RELEASE)
341337
list(APPEND QUIC_COMMON_DEFINES QUIC_OFFICIAL_RELEASE=1)
342338
message(STATUS "Configured for official release build")

src/core/connection.c

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3287,7 +3287,6 @@ QuicConnQueueUnreachable(
32873287
}
32883288
}
32893289

3290-
#ifdef QUIC_USE_RAW_DATAPATH
32913290
_IRQL_requires_max_(DISPATCH_LEVEL)
32923291
_Function_class_(CXPLAT_ROUTE_RESOLUTION_CALLBACK)
32933292
void
@@ -3325,7 +3324,6 @@ QuicConnQueueRouteCompletion(
33253324

33263325
QuicConnRelease(Connection, QUIC_CONN_REF_ROUTE);
33273326
}
3328-
#endif // QUIC_USE_RAW_DATAPATH
33293327

33303328
//
33313329
// Updates the current destination CID to the received packet's source CID, if
@@ -5594,9 +5592,7 @@ QuicConnRecvDatagrams(
55945592
goto Drop;
55955593
}
55965594

5597-
#ifdef QUIC_USE_RAW_DATAPATH
55985595
CxPlatUpdateRoute(&DatagramPath->Route, Datagram->Route);
5599-
#endif
56005596

56015597
if (DatagramPath != CurrentPath) {
56025598
if (BatchCount != 0) {
@@ -5954,7 +5950,6 @@ QuicConnProcessUdpUnreachable(
59545950
}
59555951
}
59565952

5957-
#ifdef QUIC_USE_RAW_DATAPATH
59585953
_IRQL_requires_max_(PASSIVE_LEVEL)
59595954
void
59605955
QuicConnProcessRouteCompletion(
@@ -6004,7 +5999,6 @@ QuicConnProcessRouteCompletion(
60045999
NULL);
60056000
}
60066001
}
6007-
#endif // QUIC_USE_RAW_DATAPATH
60086002

60096003
_IRQL_requires_max_(PASSIVE_LEVEL)
60106004
void
@@ -7592,12 +7586,10 @@ QuicConnDrainOperations(
75927586
QuicConnTraceRundownOper(Connection);
75937587
break;
75947588

7595-
#ifdef QUIC_USE_RAW_DATAPATH
75967589
case QUIC_OPER_TYPE_ROUTE_COMPLETION:
75977590
QuicConnProcessRouteCompletion(
75987591
Connection, Oper->ROUTE.PhysicalAddress, Oper->ROUTE.PathId, Oper->ROUTE.Succeeded);
75997592
break;
7600-
#endif // QUIC_USE_RAW_DATAPATH
76017593

76027594
default:
76037595
CXPLAT_FRE_ASSERT(FALSE);

src/core/connection.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1516,7 +1516,6 @@ QuicConnQueueUnreachable(
15161516
_In_ const QUIC_ADDR* RemoteAddress
15171517
);
15181518

1519-
#ifdef QUIC_USE_RAW_DATAPATH
15201519
//
15211520
// Queues a route completion event to a connection for processing.
15221521
//
@@ -1531,7 +1530,6 @@ QuicConnQueueRouteCompletion(
15311530
_In_ uint8_t PathId,
15321531
_In_ BOOLEAN Succeeded
15331532
);
1534-
#endif // QUIC_USE_RAW_DATAPATH
15351533

15361534
//
15371535
// Queues up an update to the packet tolerance we want the peer to use.

src/core/cubic.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -312,9 +312,9 @@ CubicCongestionControlOnCongestionEvent(
312312
"[conn][%p] Persistent congestion event",
313313
Connection);
314314
Connection->Stats.Send.PersistentCongestionCount++;
315-
#ifdef QUIC_USE_RAW_DATAPATH
316-
Connection->Paths[0].Route.State = RouteSuspected;
317-
#endif
315+
316+
Connection->Paths[0].Route.State = RouteSuspected; // used only for RAW datapath
317+
318318
Cubic->IsInPersistentCongestion = TRUE;
319319
Cubic->WindowPrior =
320320
Cubic->WindowMax =

src/core/library.c

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1293,6 +1293,29 @@ QuicLibraryGetGlobalParam(
12931293
Status = QUIC_STATUS_SUCCESS;
12941294
break;
12951295

1296+
case QUIC_PARAM_GLOBAL_DATAPATH_FEATURES:
1297+
if (*BufferLength < sizeof(uint32_t)) {
1298+
*BufferLength = sizeof(uint32_t);
1299+
Status = QUIC_STATUS_BUFFER_TOO_SMALL;
1300+
break;
1301+
}
1302+
1303+
if (Buffer == NULL) {
1304+
Status = QUIC_STATUS_INVALID_PARAMETER;
1305+
break;
1306+
}
1307+
1308+
if (MsQuicLib.Datapath == NULL) {
1309+
Status = QUIC_STATUS_INVALID_STATE;
1310+
break;
1311+
}
1312+
1313+
*BufferLength = sizeof(uint32_t);
1314+
*(uint32_t*)Buffer = CxPlatDataPathGetSupportedFeatures(MsQuicLib.Datapath);
1315+
1316+
Status = QUIC_STATUS_SUCCESS;
1317+
break;
1318+
12961319
case QUIC_PARAM_GLOBAL_VERSION_NEGOTIATION_ENABLED:
12971320

12981321
if (*BufferLength < sizeof(BOOLEAN)) {

src/core/listener.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -293,7 +293,8 @@ MsQuicListenerStart(
293293
#ifdef QUIC_OWNING_PROCESS
294294
UdpConfig.OwningProcess = NULL; // Owning process not supported for listeners.
295295
#endif
296-
#ifdef QUIC_USE_RAW_DATAPATH
296+
297+
// for RAW datapath
297298
UdpConfig.CibirIdLength = Listener->CibirId[0];
298299
UdpConfig.CibirIdOffsetSrc = MsQuicLib.CidServerIdLength + 2;
299300
UdpConfig.CibirIdOffsetDst = MsQuicLib.CidServerIdLength + 2;
@@ -304,7 +305,6 @@ MsQuicListenerStart(
304305
&Listener->CibirId[2],
305306
UdpConfig.CibirIdLength);
306307
}
307-
#endif
308308

309309
CXPLAT_TEL_ASSERT(Listener->Binding == NULL);
310310
Status =

src/core/path.c

Lines changed: 2 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -34,12 +34,12 @@ QuicPathInitialize(
3434
Path->RttVariance = Path->SmoothedRtt / 2;
3535
Path->EcnValidationState =
3636
Connection->Settings.EcnEnabled ? ECN_VALIDATION_TESTING : ECN_VALIDATION_FAILED;
37-
#ifdef QUIC_USE_RAW_DATAPATH
37+
3838
if (MsQuicLib.ExecutionConfig &&
3939
MsQuicLib.ExecutionConfig->Flags & QUIC_EXECUTION_CONFIG_FLAG_QTIP) {
4040
CxPlatRandom(sizeof(Path->Route.TcpState.SequenceNumber), &Path->Route.TcpState.SequenceNumber);
4141
}
42-
#endif
42+
4343
QuicTraceLogConnInfo(
4444
PathInitialized,
4545
Connection,
@@ -183,21 +183,6 @@ QuicConnGetPathByID(
183183
return NULL;
184184
}
185185

186-
_IRQL_requires_max_(PASSIVE_LEVEL)
187-
void
188-
QuicCopyRouteInfo(
189-
_Inout_ CXPLAT_ROUTE* DstRoute,
190-
_In_ CXPLAT_ROUTE* SrcRoute
191-
)
192-
{
193-
#ifdef QUIC_USE_RAW_DATAPATH
194-
CxPlatCopyMemory(DstRoute, SrcRoute, (uint8_t*)&SrcRoute->State - (uint8_t*)SrcRoute);
195-
CxPlatUpdateRoute(DstRoute, SrcRoute);
196-
#else
197-
*DstRoute = *SrcRoute;
198-
#endif
199-
}
200-
201186
_IRQL_requires_max_(PASSIVE_LEVEL)
202187
_Ret_maybenull_
203188
QUIC_PATH*

src/core/send.c

Lines changed: 41 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -1018,6 +1018,45 @@ QuicSendGetNextStream(
10181018
return NULL;
10191019
}
10201020

1021+
BOOLEAN
1022+
CxPlatIsRouteReady(
1023+
_In_ QUIC_CONNECTION *Connection,
1024+
_In_ QUIC_PATH* Path
1025+
)
1026+
{
1027+
//
1028+
// Make sure the route is resolved before sending packets.
1029+
//
1030+
if (Path->Route.State == RouteResolved) {
1031+
return TRUE;
1032+
}
1033+
1034+
//
1035+
// We need to set the path challenge flag back on so that when route is resolved,
1036+
// we know we need to continue to send the challenge.
1037+
//
1038+
CXPLAT_DBG_ASSERT(Path->IsActive);
1039+
if (Path->Route.State == RouteUnresolved || Path->Route.State == RouteSuspected) {
1040+
QuicConnAddRef(Connection, QUIC_CONN_REF_ROUTE);
1041+
QUIC_STATUS Status =
1042+
CxPlatResolveRoute(
1043+
Path->Binding->Socket, &Path->Route, Path->ID, (void*)Connection, QuicConnQueueRouteCompletion);
1044+
if (Status == QUIC_STATUS_SUCCESS) {
1045+
QuicConnRelease(Connection, QUIC_CONN_REF_ROUTE);
1046+
return TRUE;
1047+
}
1048+
//
1049+
// Route resolution failed or pended. We need to pause sending.
1050+
//
1051+
CXPLAT_DBG_ASSERT(Status == QUIC_STATUS_PENDING || QUIC_FAILED(Status));
1052+
}
1053+
//
1054+
// Path->Route.State == RouteResolving
1055+
// Can't send now. Once route resolution completes, we will resume sending.
1056+
//
1057+
return FALSE;
1058+
}
1059+
10211060
//
10221061
// This function sends a path challenge frame out on all paths that currently
10231062
// need one sent.
@@ -1042,37 +1081,10 @@ QuicSendPathChallenges(
10421081
continue;
10431082
}
10441083

1045-
#ifdef QUIC_USE_RAW_DATAPATH
1046-
//
1047-
// Make sure the route is resolved before sending the path challenge.
1048-
//
1049-
// We need to set the path challenge flag back on so that when route is resolved,
1050-
// we know we need to continue to send the challenge.
1051-
//
1052-
CXPLAT_DBG_ASSERT(Path->Route.State != RouteSuspected);
1053-
if (Path->Route.State == RouteUnresolved) {
1054-
QuicConnAddRef(Connection, QUIC_CONN_REF_ROUTE);
1055-
QUIC_STATUS Status =
1056-
CxPlatResolveRoute(
1057-
Path->Binding->Socket, &Path->Route, Path->ID, (void*)Connection, QuicConnQueueRouteCompletion);
1058-
if (Status == QUIC_STATUS_SUCCESS) {
1059-
QuicConnRelease(Connection, QUIC_CONN_REF_ROUTE);
1060-
} else {
1061-
//
1062-
// Route resolution failed or pended. We need to pause sending.
1063-
//
1064-
CXPLAT_DBG_ASSERT(Status == QUIC_STATUS_PENDING || QUIC_FAILED(Status));
1065-
Send->SendFlags |= QUIC_CONN_SEND_FLAG_PATH_CHALLENGE;
1066-
continue;
1067-
}
1068-
} else if (Path->Route.State == RouteResolving) {
1069-
//
1070-
// Can't send now. Once route resolution completes, we will resume sending.
1071-
//
1084+
if (!CxPlatIsRouteReady(Connection, Path)) {
10721085
Send->SendFlags |= QUIC_CONN_SEND_FLAG_PATH_CHALLENGE;
10731086
continue;
10741087
}
1075-
#endif
10761088

10771089
QUIC_PACKET_BUILDER Builder = { 0 };
10781090
if (!QuicPacketBuilderInitialize(&Builder, Connection, Path)) {
@@ -1159,32 +1171,9 @@ QuicSendFlush(
11591171

11601172
CXPLAT_DBG_ASSERT(!Connection->State.HandleClosed);
11611173

1162-
#ifdef QUIC_USE_RAW_DATAPATH
1163-
//
1164-
// Make sure the route is resolved before sending packets.
1165-
//
1166-
CXPLAT_DBG_ASSERT(Path->IsActive);
1167-
if (Path->Route.State == RouteUnresolved || Path->Route.State == RouteSuspected) {
1168-
QuicConnAddRef(Connection, QUIC_CONN_REF_ROUTE);
1169-
QUIC_STATUS Status =
1170-
CxPlatResolveRoute(
1171-
Path->Binding->Socket, &Path->Route, Path->ID, (void*)Connection, QuicConnQueueRouteCompletion);
1172-
if (Status == QUIC_STATUS_SUCCESS) {
1173-
QuicConnRelease(Connection, QUIC_CONN_REF_ROUTE);
1174-
} else {
1175-
//
1176-
// Route resolution failed or pended. We need to pause sending.
1177-
//
1178-
CXPLAT_DBG_ASSERT(Status == QUIC_STATUS_PENDING || QUIC_FAILED(Status));
1179-
return TRUE;
1180-
}
1181-
} else if (Path->Route.State == RouteResolving) {
1182-
//
1183-
// Can't send now. Once route resolution completes, we will resume sending.
1184-
//
1174+
if (!CxPlatIsRouteReady(Connection, Path)) {
11851175
return TRUE;
11861176
}
1187-
#endif
11881177

11891178
QuicConnTimerCancel(Connection, QUIC_CONN_TIMER_PACING);
11901179
QuicConnRemoveOutFlowBlockedReason(

src/inc/msquicp.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,7 @@ typedef struct QUIC_PRIVATE_TRANSPORT_PARAMETER {
114114
#define QUIC_PARAM_GLOBAL_VERSION_NEGOTIATION_ENABLED 0x81000003 // BOOLEAN
115115
#endif
116116
#define QUIC_PARAM_GLOBAL_IN_USE 0x81000004 // BOOLEAN
117+
#define QUIC_PARAM_GLOBAL_DATAPATH_FEATURES 0x81000005 // uint32_t
117118

118119
//
119120
// The different private parameters for Configuration.

0 commit comments

Comments
 (0)