[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [PATCH 4/4] Use NDIS 6.85 interfaces, if available
On 26/10/2021 08:12, Owen Smith wrote: NDIS 6.85 was introduced in Server 2022, and the "NICStrictPropertyValidation" test requires that drivers for Server 2022 declare support for NDIS 6.85. Conditionally include the minimum NDIS 6.85 support, if available in the WDK, in order to pass this test. No additional features of NDIS 6.85 have been included. NDIS_RUNTIME_VERSION_685 is only defined if the ndis.h header is from WDK 20384 or later, and NDIS685_MINIPORT is defined by the project. Signed-off-by: Owen Smith <owen.smith@xxxxxxxxxx> Acked-by: Paul Durrant <paul@xxxxxxx> --- src/xennet/adapter.c | 46 ++++++++++++++++++++++++++---------- src/xennet/miniport.c | 13 ++++++++-- vs2019/xennet/xennet.vcxproj | 2 +- 3 files changed, 45 insertions(+), 16 deletions(-) diff --git a/src/xennet/adapter.c b/src/xennet/adapter.c index b47e5e7..c075f5e 100644 --- a/src/xennet/adapter.c +++ b/src/xennet/adapter.c @@ -360,6 +360,12 @@ AdapterIndicateOffloadChanged( RtlZeroMemory(&Current, sizeof(Current)); Current.Header.Type = NDIS_OBJECT_TYPE_OFFLOAD;+#ifdef NDIS_RUNTIME_VERSION_685+ if (NdisGetVersion() >= NDIS_RUNTIME_VERSION_685) { + Current.Header.Revision = NDIS_OFFLOAD_REVISION_6; + Current.Header.Size = NDIS_SIZEOF_NDIS_OFFLOAD_REVISION_6; + } else +#endif if (NdisGetVersion() >= NDIS_RUNTIME_VERSION_660) { Current.Header.Revision = NDIS_OFFLOAD_REVISION_4; Current.Header.Size = NDIS_SIZEOF_NDIS_OFFLOAD_REVISION_4; @@ -453,6 +459,11 @@ AdapterIndicateOffloadChanged( Status.StatusCode = NDIS_STATUS_TASK_OFFLOAD_CURRENT_CONFIG; Status.StatusBuffer = &Current;+#ifdef NDIS_RUNTIME_VERSION_685+ if (NdisGetVersion() >= NDIS_RUNTIME_VERSION_685) + Status.StatusBufferSize = NDIS_SIZEOF_NDIS_OFFLOAD_REVISION_6; + else +#endif if (NdisGetVersion() >= NDIS_RUNTIME_VERSION_660) Status.StatusBufferSize = NDIS_SIZEOF_NDIS_OFFLOAD_REVISION_4; else @@ -2411,19 +2422,22 @@ AdapterQueryInformation(case OID_GEN_DRIVER_VERSION:BytesNeeded = sizeof(ULONG); - if (NdisGetVersion() >= NDIS_RUNTIME_VERSION_660) { - ndisStatus = __SetUlong(Buffer, - BufferLength, - (NDIS_MINIPORT_MAJOR_VERSION << 8) | - NDIS_MINIPORT_MINOR_VERSION, - &BytesWritten); - } else { - ndisStatus = __SetUlong(Buffer, - BufferLength, - (NDIS_MINIPORT_MINIMUM_MAJOR_VERSION << 8) | - NDIS_MINIPORT_MINIMUM_MINOR_VERSION, - &BytesWritten); - } +#ifdef NDIS_RUNTIME_VERSION_685 + if (NdisGetVersion() >= NDIS_RUNTIME_VERSION_685) + Value32 = (NDIS_MINIPORT_MAJOR_VERSION << 8) | + NDIS_MINIPORT_MINOR_VERSION; + else +#endif + if (NdisGetVersion() >= NDIS_RUNTIME_VERSION_660) + Value32 = (6 << 8) | 60; // NDIS 6.60 + else + Value32 = (NDIS_MINIPORT_MINIMUM_MAJOR_VERSION << 8) | + NDIS_MINIPORT_MINIMUM_MINOR_VERSION; + + ndisStatus = __SetUlong(Buffer, + BufferLength, + Value32, + &BytesWritten); break;case OID_GEN_MAC_OPTIONS:@@ -3182,6 +3196,12 @@ AdapterSetOffloadAttributes( RtlZeroMemory(&Supported, sizeof(Supported)); Supported.Header.Type = NDIS_OBJECT_TYPE_OFFLOAD;+#ifdef NDIS_RUNTIME_VERSION_685+ if (NdisGetVersion() >= NDIS_RUNTIME_VERSION_685) { + Supported.Header.Revision = NDIS_OFFLOAD_REVISION_6; + Supported.Header.Size = NDIS_SIZEOF_NDIS_OFFLOAD_REVISION_6; + } else +#endif if (NdisGetVersion() >= NDIS_RUNTIME_VERSION_660) { Supported.Header.Revision = NDIS_OFFLOAD_REVISION_4; Supported.Header.Size = NDIS_SIZEOF_NDIS_OFFLOAD_REVISION_4; diff --git a/src/xennet/miniport.c b/src/xennet/miniport.c index e24e1ad..f714909 100644 --- a/src/xennet/miniport.c +++ b/src/xennet/miniport.c @@ -342,9 +342,18 @@ MiniportRegister( MiniportDriverCharacteristics.Header.Size = NDIS_SIZEOF_MINIPORT_DRIVER_CHARACTERISTICS_REVISION_2; MiniportDriverCharacteristics.Header.Revision = NDIS_MINIPORT_DRIVER_CHARACTERISTICS_REVISION_2;- if (NdisGetVersion() >= NDIS_RUNTIME_VERSION_660) {+#ifdef NDIS_RUNTIME_VERSION_685 + if (NdisGetVersion() >= NDIS_RUNTIME_VERSION_685) { + MiniportDriverCharacteristics.Header.Size = NDIS_SIZEOF_MINIPORT_DRIVER_CHARACTERISTICS_REVISION_3; + MiniportDriverCharacteristics.Header.Revision = NDIS_MINIPORT_DRIVER_CHARACTERISTICS_REVISION_3; + MiniportDriverCharacteristics.MajorNdisVersion = NDIS_MINIPORT_MAJOR_VERSION; // 6 - MiniportDriverCharacteristics.MinorNdisVersion = NDIS_MINIPORT_MINOR_VERSION; // 60 + MiniportDriverCharacteristics.MinorNdisVersion = NDIS_MINIPORT_MINOR_VERSION; // 85 + } else +#endif + if (NdisGetVersion() >= NDIS_RUNTIME_VERSION_660) { + MiniportDriverCharacteristics.MajorNdisVersion = 6; + MiniportDriverCharacteristics.MinorNdisVersion = 60; } else { MiniportDriverCharacteristics.MajorNdisVersion = NDIS_MINIPORT_MINIMUM_MAJOR_VERSION; // 6 MiniportDriverCharacteristics.MinorNdisVersion = NDIS_MINIPORT_MINIMUM_MINOR_VERSION; // 30 diff --git a/vs2019/xennet/xennet.vcxproj b/vs2019/xennet/xennet.vcxproj index 2eba039..cee1325 100644 --- a/vs2019/xennet/xennet.vcxproj +++ b/vs2019/xennet/xennet.vcxproj @@ -21,7 +21,7 @@ </PropertyGroup> <ItemDefinitionGroup> <ClCompile> - <PreprocessorDefinitions>PROJECT=$(ProjectName);NDIS_MINIPORT_DRIVER;NDIS_WDM=1;NDIS630_MINIPORT=1;NDIS660_MINIPORT=1;POOL_NX_OPTIN=1;NT_PROCESSOR_GROUPS;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <PreprocessorDefinitions>PROJECT=$(ProjectName);NDIS_MINIPORT_DRIVER;NDIS_WDM=1;NDIS630_MINIPORT=1;NDIS660_MINIPORT=1;NDIS685_MINIPORT=1;POOL_NX_OPTIN=1;NT_PROCESSOR_GROUPS;%(PreprocessorDefinitions)</PreprocessorDefinitions> <IntrinsicFunctions>true</IntrinsicFunctions> <AdditionalIncludeDirectories>$(WindowsSdkDir)\include\km;..\..\include;..\..\include\xen;</AdditionalIncludeDirectories> <WarningLevel>EnableAllWarnings</WarningLevel>
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |