[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH 4/4] Use NDIS 6.85 interfaces, if available


  • To: <win-pv-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Owen Smith <owen.smith@xxxxxxxxxx>
  • Date: Tue, 26 Oct 2021 08:12:11 +0100
  • Authentication-results: esa6.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none
  • Cc: Owen Smith <owen.smith@xxxxxxxxxx>
  • Delivery-date: Tue, 26 Oct 2021 07:12:31 +0000
  • Ironport-data: A9a23:VR35yK4lvIvFY8fdtafPMgxRtBzAchMFZxGqfqrLsTDasY5as4F+v jMWDzuDP/7cZTPxftkjaYTioxhXscLTyoBmQVFq/Cs3Hi5G8cbLO4+Ufxz6V8+wwmwvb67FA +E2MISowBUcFyeEzvuV3zyIQUBUjclkfJKlYAL/En03FVAMpBsJ00o5wrdh2NAw27BVPivW0 T/Mi5yHULOa82Yc3lI8s8pvfzs24ZweEBtB1rAPTagjUG32zhH5P7pGTU2FFFPqQ5E8IwKPb 72rIIdVXI/u10xF5tuNyt4Xe6CRK1LYFVDmZnF+A8BOjvXez8CbP2lS2Pc0MC9qZzu1c99Z5 cpxisa0Vz4VJ5LthvQAekFRUA9HIvgTkFPHCSDXXc27ykTHdz3nwul0DVFwNoodkgp1KTgQr 7pCcmlLN03dwbLtqF64YrAEasALK9bmOsUEv3B8zRnSDOo8QICFSKLPjTNd9Gpu3pwXQ62AD yYfQRNvMxrfbRJUAFUWVpUStfqTrWjVfBQN/Tp5ooJoujOOnWSdyoPFL9vTP8SUAMlYgEucj mbH5HjiRAEXMsSFzjiI+W7qgfXA9R4XQ6pLSuf+rKQzxgTOmCpDU3X6SGdXv9GUlXKBAdZBE nANxQswvbUbrEXoYODiCkjQTGG/gjYQXN9ZEusf4Q6Ly7bJ7wvxOlXoXgKte/R965doHW1CO kuh2oqzX2Q24eL9pWe1r+/M9VuP1T4pwXjujMPuZTAO5MX/u8kNhxbLQ8cL/EWd34CtR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vzrSYL51+hQC/HibFcwstahxqEbefDZ3AYevbg7K0GDXwg95tlLmfZg6S6PvmHHxX2CKH fs/ogBivpARQChoXMxHBtWNd7wtNyQYZZgGxHe0JYg3mFk0e2T+roD8s9oRU9g9RReNVov7p71 EnQ2ojtKPFBHOra7I1pfOaLn
  • List-id: Developer list for the Windows PV Drivers subproject <win-pv-devel.lists.xenproject.org>

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>
---
 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>
-- 
2.33.0.windows.2




 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.