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

[PATCH] Make sure Frontend->NumQueues is not zero


  • To: <win-pv-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Owen Smith <owen.smith@xxxxxxxxxx>
  • Date: Mon, 12 Jul 2021 17:07:01 +0100
  • Authentication-results: esa2.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none
  • Cc: Owen Smith <owen.smith@xxxxxxxxxx>
  • Delivery-date: Mon, 12 Jul 2021 16:07:20 +0000
  • Ironport-hdrordr: A9a23:1wg8yqlTQKACWMCpWHLhqlP+q7bpDfIg3DAbv31ZSRFFG/Fxl6 iV8sjzsiWE7Ar5OUtQ/+xoV5PhfZqxz/JICOoqTNKftWvdyQiVxehZhOOIqVDd8kXFh4lgPM xbEpSWZueeMbEDt7eZ3DWF
  • Ironport-sdr: uvb5QPAk/v3bAmQFYipy8vqTrsKa9x4GbhlXwX203LLRdSaoKgRDt/FGmG3y7fM7+WKzQ6rK3i xMVl5ehEnenooldKT3N/PnXO8b9cssSFdb2tOTvi1vpKasV3UAfyn4qqvftavsKbN2B9jSBVcb 2xwGIjLDEOFKq7i1IZJPOG9QTgJAyFC7T1fUNPUkjf870PTMbS/XYrpjHHRE8s3ztLpV5xdRiL 9+QnqdxhFBDSuprxAlSE0GljE29lLU4W+4Ar60AMZejjnd/bkIoSdFiDXEvhPB41nCb5HhFPqa TnU=
  • List-id: Developer list for the Windows PV Drivers subproject <win-pv-devel.lists.xenproject.org>

- Checks multi-queue-max-queues is non-zero
- ASSERTs Frontend->NumQueues is non-zero in the accessor

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

diff --git a/src/xenvif/frontend.c b/src/xenvif/frontend.c
index 30de494..f5cb382 100644
--- a/src/xenvif/frontend.c
+++ b/src/xenvif/frontend.c
@@ -1785,6 +1785,9 @@ FrontendSetNumQueues(
         XENBUS_STORE(Free,
                      &Frontend->StoreInterface,
                      Buffer);
+
+        if (BackendMaxQueues == 0)
+            BackendMaxQueues = 1;
     } else {
         BackendMaxQueues = 1;
     }
@@ -1800,6 +1803,7 @@ __FrontendGetNumQueues(
     IN  PXENVIF_FRONTEND    Frontend
     )
 {
+    ASSERT(Frontend->NumQueues != 0);
     return Frontend->NumQueues;
 }
 
@@ -1953,7 +1957,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 :
@@ -2358,7 +2361,7 @@ fail4:
     MacDisconnect(__FrontendGetMac(Frontend));
 
     Frontend->Split = FALSE;
-    Frontend->NumQueues = 0;
+    Frontend->NumQueues = 1;
 
 fail3:
     Error("fail3\n");
@@ -2395,7 +2398,7 @@ FrontendDisconnect(
     MacDisconnect(__FrontendGetMac(Frontend));
 
     Frontend->Split = FALSE;
-    Frontend->NumQueues = 0;
+    Frontend->NumQueues = 1;
 
     XENBUS_DEBUG(Deregister,
                  &Frontend->DebugInterface,
@@ -3063,6 +3066,7 @@ FrontendTeardown(
     RtlZeroMemory(&Frontend->Lock, sizeof (KSPIN_LOCK));
 
     Frontend->BackendDomain = 0;
+    Frontend->NumQueues = 0;
 
     __FrontendFree(Frontend->Prefix);
     Frontend->Prefix = NULL;
-- 
2.31.1.windows.1




 


Rackspace

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