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

[win-pv-devel] [PATCH 21/26] Add overrides for MaxTransferLength and MaxPhysicalBreaks



From: Owen Smith <owen.smith@xxxxxxxxxx>

Signed-off-by: Owen Smith <owen.smith@xxxxxxxxxx>
---
 src/xenvbd/adapter.c | 25 +++++++++++++++++++++++--
 src/xenvbd/driver.h  |  5 ++---
 2 files changed, 25 insertions(+), 5 deletions(-)

diff --git a/src/xenvbd/adapter.c b/src/xenvbd/adapter.c
index c4fa9f6..945888d 100644
--- a/src/xenvbd/adapter.c
+++ b/src/xenvbd/adapter.c
@@ -1768,6 +1768,8 @@ AdapterHwFindAdapter(
     PDEVICE_OBJECT                          DeviceObject;
     PDEVICE_OBJECT                          PhysicalDeviceObject;
     PDEVICE_OBJECT                          LowerDeviceObject;
+    ULONG                                   MaxTransferLength;
+    ULONG                                   MaxPhysicalBreaks;
     NTSTATUS                                status;
 
     UNREFERENCED_PARAMETER(Context);
@@ -1775,9 +1777,28 @@ 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       = XENVBD_MAX_TRANSFER_LENGTH;
-    ConfigInfo->NumberOfPhysicalBreaks      = XENVBD_MAX_PHYSICAL_BREAKS;
+    ConfigInfo->MaximumTransferLength       = MaxTransferLength;
+    ConfigInfo->NumberOfPhysicalBreaks      = MaxPhysicalBreaks;
     ConfigInfo->AlignmentMask               = 0; // Byte-Aligned
     ConfigInfo->NumberOfBuses               = 1;
     ConfigInfo->InitiatorBusId[0]           = 1;
diff --git a/src/xenvbd/driver.h b/src/xenvbd/driver.h
index 73a4e11..aae3da1 100644
--- a/src/xenvbd/driver.h
+++ b/src/xenvbd/driver.h
@@ -35,9 +35,8 @@
 #include <ntddk.h>
 
 #define XENVBD_MAX_TARGETS              (255)
-#define XENVBD_MAX_PAGES_PER_SRB        (1024)
-#define XENVBD_MAX_TRANSFER_LENGTH      (XENVBD_MAX_PAGES_PER_SRB * PAGE_SIZE)
-#define XENVBD_MAX_PHYSICAL_BREAKS      (XENVBD_MAX_PAGES_PER_SRB - 1)
+#define XENVBD_MAX_TRANSFER_LENGTH      ((16 * 11) * PAGE_SIZE) // 1/2 ring of 
direct (or 1 indirect)
+#define XENVBD_MAX_PHYSICAL_BREAKS      ((16 * 11) - 1)         // 1/2 ring of 
direct (or 1 indirect)
 
 extern VOID
 DriverSetAdapter(
-- 
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®.