]> xenbits.xensource.com Git - people/pauldu/xenvif.git/commitdiff
Provide registry override for disabling RSS
authorPaul Durrant <paul.durrant@citrix.com>
Mon, 7 Nov 2016 11:35:09 +0000 (11:35 +0000)
committerPaul Durrant <paul.durrant@citrix.com>
Mon, 7 Nov 2016 11:35:09 +0000 (11:35 +0000)
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@citrix.com>
src/xenvif/frontend.c
src/xenvif/receiver.c

index 27796a10ccbbcde8f81c1b28719dca6e5d82b175..b510cc136af605b70976feb706fb37dda0d51cb2 100644 (file)
@@ -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;
 
index f54d36831a085bf6d786e762e8a6691f2459add2..99c113e8d0eeb6272fd2dd8fc5db54f347df0c5d 100644 (file)
@@ -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: