@@ -915,6 +915,8 @@ QuicLibraryLazyInitialize(
915915
916916 CXPLAT_DATAPATH_INIT_CONFIG InitConfig = {0 };
917917 InitConfig .EnableDscpOnRecv = MsQuicLib .EnableDscpOnRecv ;
918+ InitConfig .XdpMapConfigs = MsQuicLib .XdpMapConfigs ;
919+ InitConfig .XdpMapConfigCount = MsQuicLib .XdpMapConfigCount ;
918920
919921 Status =
920922 CxPlatDataPathInitialize (
@@ -1057,6 +1059,34 @@ QuicLibApplyLoadBalancingSetting(
10571059 MsQuicLib .CidTotalLength );
10581060}
10591061
1062+ static
1063+ void
1064+ QuicLibXdpMapConfigToPlat (
1065+ _Out_writes_ (Count ) CXPLAT_XDP_MAP_CONFIG * Dest ,
1066+ _In_reads_ (Count ) const QUIC_XDP_MAP_CONFIG * Src ,
1067+ _In_ uint32_t Count
1068+ )
1069+ {
1070+ for (uint32_t i = 0 ; i < Count ; i ++ ) {
1071+ Dest [i ].InterfaceIndex = Src [i ].InterfaceIndex ;
1072+ Dest [i ].MapHandle = Src [i ].MapHandle ;
1073+ }
1074+ }
1075+
1076+ static
1077+ void
1078+ QuicLibXdpMapConfigFromPlat (
1079+ _Out_writes_ (Count ) QUIC_XDP_MAP_CONFIG * Dest ,
1080+ _In_reads_ (Count ) const CXPLAT_XDP_MAP_CONFIG * Src ,
1081+ _In_ uint32_t Count
1082+ )
1083+ {
1084+ for (uint32_t i = 0 ; i < Count ; i ++ ) {
1085+ Dest [i ].InterfaceIndex = Src [i ].InterfaceIndex ;
1086+ Dest [i ].MapHandle = Src [i ].MapHandle ;
1087+ }
1088+ }
1089+
10601090_IRQL_requires_max_ (PASSIVE_LEVEL )
10611091QUIC_STATUS
10621092QuicLibrarySetGlobalParam (
@@ -1473,20 +1503,23 @@ QuicLibrarySetGlobalParam(
14731503 break ;
14741504 }
14751505
1476- QUIC_XDP_MAP_CONFIG * NewConfigs =
1477- CXPLAT_ALLOC_NONPAGED (BufferLength , QUIC_POOL_XDP_MAP_CONFIG );
1506+ const size_t AllocSize = Count * sizeof (CXPLAT_XDP_MAP_CONFIG );
1507+ CXPLAT_XDP_MAP_CONFIG * NewConfigs =
1508+ CXPLAT_ALLOC_NONPAGED (
1509+ AllocSize ,
1510+ QUIC_POOL_XDP_MAP_CONFIG );
14781511 if (NewConfigs == NULL ) {
14791512 CxPlatLockRelease (& MsQuicLib .Lock );
14801513 QuicTraceEvent (
14811514 AllocFailure ,
14821515 "Allocation of '%s' failed. (%llu bytes)" ,
14831516 "XDP map config" ,
1484- BufferLength );
1517+ AllocSize );
14851518 Status = QUIC_STATUS_OUT_OF_MEMORY ;
14861519 break ;
14871520 }
14881521
1489- CxPlatCopyMemory (NewConfigs , Configs , BufferLength );
1522+ QuicLibXdpMapConfigToPlat (NewConfigs , Configs , Count );
14901523
14911524 if (MsQuicLib .XdpMapConfigs != NULL ) {
14921525 CXPLAT_FREE (MsQuicLib .XdpMapConfigs , QUIC_POOL_XDP_MAP_CONFIG );
@@ -1507,6 +1540,7 @@ QuicLibrarySetGlobalParam(
15071540}
15081541
15091542_IRQL_requires_max_ (PASSIVE_LEVEL )
1543+ _Success_ (return == QUIC_STATUS_SUCCESS )
15101544QUIC_STATUS
15111545QuicLibraryGetGlobalParam (
15121546 _In_ uint32_t Param ,
@@ -1871,7 +1905,10 @@ QuicLibraryGetGlobalParam(
18711905 break ;
18721906 }
18731907 * BufferLength = RequiredLength ;
1874- CxPlatCopyMemory (Buffer , MsQuicLib .XdpMapConfigs , RequiredLength );
1908+ QuicLibXdpMapConfigFromPlat (
1909+ (QUIC_XDP_MAP_CONFIG * )Buffer ,
1910+ MsQuicLib .XdpMapConfigs ,
1911+ MsQuicLib .XdpMapConfigCount );
18751912 CxPlatLockRelease (& MsQuicLib .Lock );
18761913 Status = QUIC_STATUS_SUCCESS ;
18771914 break ;
0 commit comments