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

[PATCH] Fail if multi-queue-max-queues is 0


  • To: <win-pv-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Owen Smith <owen.smith@xxxxxxxxxx>
  • Date: Wed, 14 Jul 2021 11:39:43 +0100
  • Authentication-results: esa6.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none
  • Cc: Owen Smith <owen.smith@xxxxxxxxxx>
  • Delivery-date: Wed, 14 Jul 2021 10:42:48 +0000
  • Ironport-hdrordr: A9a23:fozPO6k0ot/McUD8IjhpbcbmM8TpDfIm3DAbv31ZSRFFG/Fxl6 iV88jzsiWE7Qr5OUtQ/uxoV5PgfZqxz/NICOoqTNWftWvd2FdARbsKheCJ/9SJIVybygc378 ldmsZFZOEYdWIK7vrH3A==
  • Ironport-sdr: gBuXQ9Tfgo0J7aeZ3lZFuAggeVmoG7cC5Zjkst+Vhp/U1Q2Y8fRtPI4BRPKY4u1IFf1m3eeUhz bkyyybz/dLWVW7NfhNSHWradzKbkMhsim2Zjkml6Dakl6eHDvm7R+t+MX8LgDSfic/F7FsADQ/ rVjGFTnGyucnh4cPe49gIAVMtygSBcMN4vAdj7hyKJGHEAwQs/7OblJ88gwFi9yajwIqbu0pEr Vm+zXTurssUofcv+s49nQF9R4Jj4RRBpoa3UZ7ktakcaQplkGab8D1EZqoNaI9VMVENEW7HPHx 42o=
  • List-id: Developer list for the Windows PV Drivers subproject <win-pv-devel.lists.xenproject.org>

Validate backend has correctly set multi-queue-max-queues, and add ASSERTions
to NumQueues and MaxQueues accessors to validate they are not 0

Signed-off-by: Owen Smith <owen.smith@xxxxxxxxxx>
---
 src/xenvif/frontend.c | 40 ++++++++++++++++++++++++++++------------
 1 file changed, 28 insertions(+), 12 deletions(-)

diff --git a/src/xenvif/frontend.c b/src/xenvif/frontend.c
index 30de494..5940e16 100644
--- a/src/xenvif/frontend.c
+++ b/src/xenvif/frontend.c
@@ -261,6 +261,7 @@ __FrontendGetMaxQueues(
     IN  PXENVIF_FRONTEND    Frontend
     )
 {
+    ASSERT(Frontend->MaxQueues != 0);
     return Frontend->MaxQueues;
 }
 
@@ -1764,7 +1765,7 @@ FrontendDebugCallback(
     }
 }
 
-static VOID
+static NTSTATUS
 FrontendSetNumQueues(
     IN  PXENVIF_FRONTEND    Frontend
     )
@@ -1789,10 +1790,19 @@ FrontendSetNumQueues(
         BackendMaxQueues = 1;
     }
 
+    status = STATUS_INVALID_PARAMETER;
+    if (BackendMaxQueues == 0)
+        goto fail1;
+
     Frontend->NumQueues = __min(__FrontendGetMaxQueues(Frontend),
                                 BackendMaxQueues);
 
     Info("%s: %u\n", __FrontendGetPath(Frontend), Frontend->NumQueues);
+    return STATUS_SUCCESS;
+
+fail1:
+    Error("fail1 %08x\n", status);
+    return status;
 }
 
 static FORCEINLINE ULONG
@@ -1800,6 +1810,7 @@ __FrontendGetNumQueues(
     IN  PXENVIF_FRONTEND    Frontend
     )
 {
+    ASSERT(Frontend->NumQueues != 0);
     return Frontend->NumQueues;
 }
 
@@ -1953,7 +1964,6 @@ FrontendSetHashAlgorithm(
     case XENVIF_PACKET_HASH_ALGORITHM_TOEPLITZ:
         // Don't allow toeplitz hashing to be configured for a single
         // queue, or if it has been explicitly disabled
-        ASSERT(__FrontendGetNumQueues(Frontend) != 0);
         status = (__FrontendGetNumQueues(Frontend) == 1 ||
                   Frontend->DisableToeplitz != 0) ?
                  STATUS_NOT_SUPPORTED :
@@ -2218,20 +2228,23 @@ FrontendConnect(
     if (!NT_SUCCESS(status))
         goto fail3;
 
-    FrontendSetNumQueues(Frontend);
+    status = FrontendSetNumQueues(Frontend);
+    if (!NT_SUCCESS(status))
+        goto fail4;
+
     FrontendSetSplit(Frontend);
 
     status = ReceiverConnect(__FrontendGetReceiver(Frontend));
     if (!NT_SUCCESS(status))
-        goto fail4;
+        goto fail5;
 
     status = TransmitterConnect(__FrontendGetTransmitter(Frontend));
     if (!NT_SUCCESS(status))
-        goto fail5;
+        goto fail6;
 
     status = ControllerConnect(__FrontendGetController(Frontend));
     if (!NT_SUCCESS(status))
-        goto fail6;
+        goto fail7;
 
     Attempt = 0;
     do {
@@ -2286,7 +2299,7 @@ abort:
     } while (status == STATUS_RETRY);
 
     if (!NT_SUCCESS(status))
-        goto fail7;
+        goto fail8;
 
     State = XenbusStateUnknown;
     while (State != XenbusStateConnected) {
@@ -2325,7 +2338,7 @@ abort:
 
     status = STATUS_UNSUCCESSFUL;
     if (State != XenbusStateConnected)
-        goto fail8;
+        goto fail9;
 
     ControllerEnable(__FrontendGetController(Frontend));
 
@@ -2334,24 +2347,27 @@ abort:
     Trace("<====\n");
     return STATUS_SUCCESS;
 
+fail9:
+    Error("fail9\n");
+
 fail8:
     Error("fail8\n");
 
+    ControllerDisconnect(__FrontendGetController(Frontend));
+
 fail7:
     Error("fail7\n");
 
-    ControllerDisconnect(__FrontendGetController(Frontend));
+    TransmitterDisconnect(__FrontendGetTransmitter(Frontend));
 
 fail6:
     Error("fail6\n");
 
-    TransmitterDisconnect(__FrontendGetTransmitter(Frontend));
+    ReceiverDisconnect(__FrontendGetReceiver(Frontend));
 
 fail5:
     Error("fail5\n");
 
-    ReceiverDisconnect(__FrontendGetReceiver(Frontend));
-
 fail4:
     Error("fail4\n");
 
-- 
2.31.1.windows.1




 


Rackspace

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