]> xenbits.xensource.com Git - pvdrivers/win/xennet.git/commitdiff
Use NDIS 6.85 interfaces, if available
authorOwen Smith <owen.smith@citrix.com>
Tue, 26 Oct 2021 07:12:11 +0000 (08:12 +0100)
committerPaul Durrant <pdurrant@amazon.com>
Sun, 28 Nov 2021 20:31:52 +0000 (12:31 -0800)
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@citrix.com>
src/xennet/adapter.c
src/xennet/miniport.c
vs2019/xennet/xennet.vcxproj

index b47e5e7542aa9593e37b0087f38f53f58f6e0721..743cf35cd1dcf2ce8d87d5e69e4119fe051b537c 100644 (file)
@@ -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;
index e24e1ad1ccfb4b9462f01f383a9182c03b4a8f15..f7149094ef893e161256bb7574822acd76dc7d03 100644 (file)
@@ -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
index 2eba0394fb3437ad683ecc9c6de8ebf038ed0520..cee1325437d42c44d0c674792e3f0d0b0d19b9bf 100644 (file)
@@ -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>