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

[win-pv-devel] [PATCH 24/26] Read overrides at start of day



From: Owen Smith <owen.smith@xxxxxxxxxx>

Reads MaxTransferLength and MaxPhysicalBreaks earlier

Signed-off-by: Owen Smith <owen.smith@xxxxxxxxxx>
---
 src/xenvbd/adapter.c | 32 ++------------------------------
 src/xenvbd/driver.c  | 44 ++++++++++++++++++++++++++++++++++++++++++++
 src/xenvbd/driver.h  | 10 ++++++++++
 3 files changed, 56 insertions(+), 30 deletions(-)

diff --git a/src/xenvbd/adapter.c b/src/xenvbd/adapter.c
index b0a94e2..86c7275 100644
--- a/src/xenvbd/adapter.c
+++ b/src/xenvbd/adapter.c
@@ -1768,8 +1768,6 @@ AdapterHwFindAdapter(
     PDEVICE_OBJECT                          DeviceObject;
     PDEVICE_OBJECT                          PhysicalDeviceObject;
     PDEVICE_OBJECT                          LowerDeviceObject;
-    ULONG                                   MaxTransferLength;
-    ULONG                                   MaxPhysicalBreaks;
     NTSTATUS                                status;
 
     UNREFERENCED_PARAMETER(Context);
@@ -1777,28 +1775,9 @@ AdapterHwFindAdapter(
     UNREFERENCED_PARAMETER(ArgumentString);
     UNREFERENCED_PARAMETER(Again);
 
-    // override settings
-    status = RegistryQueryDwordValue(DriverGetParametersKey(),
-                                     "MaxTransferLength",
-                                     &MaxTransferLength);
-    if (!NT_SUCCESS(status))
-        MaxTransferLength = XENVBD_MAX_TRANSFER_LENGTH;
-    if ((MaxTransferLength & (PAGE_SIZE - 1)) != 0)
-        MaxTransferLength = XENVBD_MAX_TRANSFER_LENGTH;
-
-    status = RegistryQueryDwordValue(DriverGetParametersKey(),
-                                     "MaxPhysicalBreaks",
-                                     &MaxPhysicalBreaks);
-    if (!NT_SUCCESS(status))
-        MaxPhysicalBreaks = XENVBD_MAX_PHYSICAL_BREAKS;
-
-    Verbose("MaxTransferLength: %u, MaxPhysicalBreaks: %u\n",
-            MaxTransferLength,
-            MaxPhysicalBreaks);
-
     // setup config info
-    ConfigInfo->MaximumTransferLength       = MaxTransferLength;
-    ConfigInfo->NumberOfPhysicalBreaks      = MaxPhysicalBreaks;
+    ConfigInfo->MaximumTransferLength       = DriverGetMaxTransferLength();
+    ConfigInfo->NumberOfPhysicalBreaks      = DriverGetMaxPhysicalBreaks();
     ConfigInfo->AlignmentMask               = 0; // Byte-Aligned
     ConfigInfo->NumberOfBuses               = 1;
     ConfigInfo->InitiatorBusId[0]           = 1;
@@ -1876,13 +1855,6 @@ AdapterHwInitialize(
     Verbose("Perf: %u Channels\n",
             Perf.ConcurrentChannels);
 
-    if (Perf.Flags & STOR_PERF_CONCURRENT_CHANNELS)
-        Perf.ConcurrentChannels = KeQueryActiveProcessorCount(NULL);
-
-    status = StorPortInitializePerfOpts(DevExt,
-                                        FALSE,
-                                        &Perf);
-
     return TRUE;
 }
 
diff --git a/src/xenvbd/driver.c b/src/xenvbd/driver.c
index 4823390..28d2d49 100644
--- a/src/xenvbd/driver.c
+++ b/src/xenvbd/driver.c
@@ -50,6 +50,8 @@
 typedef struct _XENVBD_DRIVER {
     PXENVBD_ADAPTER     Adapter;
     HANDLE              ParametersKey;
+    ULONG               MaxTransferLength;
+    ULONG               MaxPhysicalBreaks;
     PDRIVER_DISPATCH    StorPortDispatchPnp;
     PDRIVER_DISPATCH    StorPortDispatchPower;
     PDRIVER_UNLOAD      StorPortDriverUnload;
@@ -85,6 +87,22 @@ DriverGetParametersKey(
     return __DriverGetParametersKey();
 }
 
+ULONG
+DriverGetMaxTransferLength(
+    VOID
+    )
+{
+    return Driver.MaxTransferLength;
+}
+
+ULONG
+DriverGetMaxPhysicalBreaks(
+    VOID
+    )
+{
+    return Driver.MaxPhysicalBreaks;
+}
+
 BOOLEAN
 DriverReadOverride(
     IN  PCHAR   Name
@@ -254,6 +272,9 @@ DriverUnload(
 
     BufferTerminate();
 
+    Driver.MaxTransferLength = 0;
+    Driver.MaxPhysicalBreaks = 0;
+
     RegistryCloseKey(Driver.ParametersKey);
     Driver.ParametersKey = NULL;
 
@@ -305,6 +326,26 @@ DriverEntry(
 
     Driver.ParametersKey = ParametersKey;
     Driver.Adapter = NULL;
+
+    // override settings
+    status = RegistryQueryDwordValue(ParametersKey,
+                                     "MaxTransferLength",
+                                     &Driver.MaxTransferLength);
+    if (!NT_SUCCESS(status))
+        Driver.MaxTransferLength = XENVBD_MAX_TRANSFER_LENGTH;
+    if ((Driver.MaxTransferLength & (PAGE_SIZE - 1)) != 0)
+        Driver.MaxTransferLength = XENVBD_MAX_TRANSFER_LENGTH;
+
+    status = RegistryQueryDwordValue(ParametersKey,
+                                     "MaxPhysicalBreaks",
+                                     &Driver.MaxPhysicalBreaks);
+    if (!NT_SUCCESS(status))
+        Driver.MaxPhysicalBreaks = XENVBD_MAX_PHYSICAL_BREAKS;
+
+    Verbose("MaxTransferLength: %u, MaxPhysicalBreaks: %u\n",
+            Driver.MaxTransferLength,
+            Driver.MaxPhysicalBreaks);
+
     BufferInitialize();
 
     status = AdapterDriverEntry(RegistryPath,
@@ -330,6 +371,9 @@ fail4:
 
     BufferTerminate();
 
+    Driver.MaxTransferLength = 0;
+    Driver.MaxPhysicalBreaks = 0;
+
     RegistryCloseKey(Driver.ParametersKey);
     Driver.ParametersKey = NULL;
 
diff --git a/src/xenvbd/driver.h b/src/xenvbd/driver.h
index aae3da1..e9cdcc0 100644
--- a/src/xenvbd/driver.h
+++ b/src/xenvbd/driver.h
@@ -48,6 +48,16 @@ DriverGetParametersKey(
     VOID
     );
 
+extern ULONG
+DriverGetMaxTransferLength(
+    VOID
+    );
+
+extern ULONG
+DriverGetMaxPhysicalBreaks(
+    VOID
+    );
+
 extern BOOLEAN
 DriverReadOverride(
     IN  PCHAR   Name
-- 
2.8.3


_______________________________________________
win-pv-devel mailing list
win-pv-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/cgi-bin/mailman/listinfo/win-pv-devel

 


Rackspace

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