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

[win-pv-devel] [PATCH 03/10] Store maximum number of queues allowed



Read "MultiQueueMaxQueues" from parameters key to determine in-guest
limit to multi-queue support.
The maximum number of queues used will be the smallest of;
  "HKLM/CurrentControlSet/Services/XENVIF/Parameters/MultiQueueMaxQueues",
  "device/vif/<number>/multi-queue-max-queues" and 
  number of guest vCPUs

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

diff --git a/src/xenvif/driver.c b/src/xenvif/driver.c
index 6f81620..b1fbb79 100644
--- a/src/xenvif/driver.c
+++ b/src/xenvif/driver.c
@@ -47,6 +47,7 @@ typedef struct _XENVIF_DRIVER {
     PDRIVER_OBJECT      DriverObject;
     HANDLE              ParametersKey;
     HANDLE              AddressesKey;
+    ULONG               QueueMax;
 } XENVIF_DRIVER, *PXENVIF_DRIVER;
 
 static XENVIF_DRIVER    Driver;
@@ -123,6 +124,33 @@ DriverGetAddressesKey(
     return __DriverGetAddressesKey();
 }
 
+static FORCEINLINE VOID
+__DriverSetQueueMax(
+    IN  ULONG       Count
+    )
+{
+    ULONG   Processors;
+
+    Processors = KeQueryActiveProcessorCount(NULL);
+    Driver.QueueMax = Count > Processors ? Processors : Count;
+}
+
+static FORCEINLINE ULONG
+__DriverGetQueueMax(
+    VOID
+    )
+{
+    return Driver.QueueMax;
+}
+
+ULONG
+DriverGetQueueMax(
+    VOID
+    )
+{
+    return __DriverGetQueueMax();
+}
+
 DRIVER_UNLOAD       DriverUnload;
 
 VOID
@@ -254,6 +282,7 @@ DriverEntry(
     HANDLE              ParametersKey;
     HANDLE              AddressesKey;
     ULONG               Index;
+    ULONG               Queues;
     NTSTATUS            status;
 
     ASSERT3P(__DriverGetDriverObject(), ==, NULL);
@@ -304,6 +333,13 @@ DriverEntry(
 
     __DriverSetAddressesKey(AddressesKey);
 
+    status = RegistryQueryDwordValue(ParametersKey,
+                                     "MultiQueueMaxQueues",
+                                     &Queues);
+    if (!NT_SUCCESS(status))
+        Queues = MAXIMUM_PROCESSORS;
+    __DriverSetQueueMax(Queues);
+
     RegistryCloseKey(ServiceKey);
 
     DriverObject->DriverExtension->AddDevice = AddDevice;
diff --git a/src/xenvif/driver.h b/src/xenvif/driver.h
index cdef7d1..9375930 100644
--- a/src/xenvif/driver.h
+++ b/src/xenvif/driver.h
@@ -52,6 +52,11 @@ DriverGetAliasesKey(
     VOID
     );
 
+extern ULONG
+DriverGetQueueMax(
+    VOID
+    );
+
 typedef struct _XENVIF_PDO  XENVIF_PDO, *PXENVIF_PDO;
 typedef struct _XENVIF_FDO  XENVIF_FDO, *PXENVIF_FDO;
 
-- 
1.9.4.msysgit.1


_______________________________________________
win-pv-devel mailing list
win-pv-devel@xxxxxxxxxxxxxxxxxxxx
http://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®.