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

[win-pv-devel] [PATCH] Provide registry override for disabling RSS



For diagnostic purposes it is useful to be able to simulate the situation
where XENVIF does not support RSS (because the backend does not support
it).

This patch adds code to check a REG_DWORD value called
'FrontendDisableToeplitz' and will not allow the Toeplitz hash algorithm
to be configured if the value is non-zero. This prevents XENNET from
advertizing the RSS capability to the network stack.

Signed-off-by: Paul Durrant <paul.durrant@xxxxxxxxxx>
---
 src/xenvif/frontend.c | 24 +++++++++++++++++++++++-
 src/xenvif/receiver.c |  8 ++++----
 2 files changed, 27 insertions(+), 5 deletions(-)

diff --git a/src/xenvif/frontend.c b/src/xenvif/frontend.c
index 27796a1..b510cc1 100644
--- a/src/xenvif/frontend.c
+++ b/src/xenvif/frontend.c
@@ -81,6 +81,7 @@ struct _XENVIF_FRONTEND {
     ULONG                       MaxQueues;
     ULONG                       NumQueues;
     BOOLEAN                     Split;
+    ULONG                       DisableToeplitz;
 
     PXENVIF_MAC                 Mac;
     PXENVIF_RECEIVER            Receiver;
@@ -1932,10 +1933,15 @@ FrontendSetHashAlgorithm(
     switch (Algorithm) {
     case XENVIF_PACKET_HASH_ALGORITHM_NONE:
     case XENVIF_PACKET_HASH_ALGORITHM_UNSPECIFIED:
-    case XENVIF_PACKET_HASH_ALGORITHM_TOEPLITZ:
         status = STATUS_SUCCESS;
         break;
 
+    case XENVIF_PACKET_HASH_ALGORITHM_TOEPLITZ:
+        status = (Frontend->DisableToeplitz != 0) ?
+                 STATUS_NOT_SUPPORTED :
+                 STATUS_SUCCESS;
+        break;
+
     default:
         status = STATUS_NOT_SUPPORTED;
         break;
@@ -2773,6 +2779,8 @@ FrontendInitialize(
     ULONG                   Length;
     PCHAR                   Path;
     PCHAR                   Prefix;
+    HANDLE                  ParametersKey;
+    ULONG                   FrontendDisableToeplitz;
     NTSTATUS                status;
 
     Trace("====>\n");
@@ -2831,6 +2839,16 @@ FrontendInitialize(
     FrontendSetMaxQueues(*Frontend);
     (*Frontend)->Hash.Algorithm = XENVIF_PACKET_HASH_ALGORITHM_UNSPECIFIED;
 
+    (*Frontend)->DisableToeplitz = 0;
+
+    ParametersKey = DriverGetParametersKey();
+
+    status = RegistryQueryDwordValue(ParametersKey,
+                                     "FrontendDisableToeplitz",
+                                     &FrontendDisableToeplitz);
+    if (NT_SUCCESS(status))
+        (*Frontend)->DisableToeplitz = FrontendDisableToeplitz;
+
     status = MacInitialize(*Frontend, &(*Frontend)->Mac);
     if (!NT_SUCCESS(status))
         goto fail6;
@@ -2910,6 +2928,8 @@ fail7:
 fail6:
     Error("fail6\n");
 
+    (*Frontend)->DisableToeplitz = 0;
+
     RtlZeroMemory(&(*Frontend)->Hash, sizeof (XENVIF_FRONTEND_HASH));
     (*Frontend)->MaxQueues = 0;
 
@@ -3005,6 +3025,8 @@ FrontendTeardown(
     MacTeardown(__FrontendGetMac(Frontend));
     Frontend->Mac = NULL;
 
+    Frontend->DisableToeplitz = 0;
+
     RtlZeroMemory(&Frontend->Hash, sizeof (XENVIF_FRONTEND_HASH));
     Frontend->MaxQueues = 0;
 
diff --git a/src/xenvif/receiver.c b/src/xenvif/receiver.c
index f54d368..99c113e 100644
--- a/src/xenvif/receiver.c
+++ b/src/xenvif/receiver.c
@@ -3751,6 +3751,10 @@ ReceiverSetHashAlgorithm(
 
     Frontend = Receiver->Frontend;
 
+    status = FrontendSetHashAlgorithm(Frontend, Algorithm);
+    if (!NT_SUCCESS(status))
+        goto fail1;
+
     KeRaiseIrql(DISPATCH_LEVEL, &Irql);
 
     for (Index = 0;
@@ -3769,10 +3773,6 @@ ReceiverSetHashAlgorithm(
 
     KeLowerIrql(Irql);
 
-    status = FrontendSetHashAlgorithm(Frontend, Algorithm);
-    if (!NT_SUCCESS(status))
-        goto fail1;
-
     return STATUS_SUCCESS;
 
 fail1:
-- 
2.5.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®.