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

[PATCH v2 3/3] Check controller enable status in PutRequest



Add a Controller->Enabled flag to signify whether the controller
currently accepts requests.

Check this flag in ControllerPutRequest instead of Controller->Connected.

Signed-off-by: Tu Dinh <ngoc-tu.dinh@xxxxxxxxxx>
---
 src/xenvif/controller.c | 15 ++++++++++++---
 1 file changed, 12 insertions(+), 3 deletions(-)

diff --git a/src/xenvif/controller.c b/src/xenvif/controller.c
index 6a091d6..ca854ef 100644
--- a/src/xenvif/controller.c
+++ b/src/xenvif/controller.c
@@ -72,6 +72,7 @@ struct _XENVIF_CONTROLLER {
     PXENBUS_EVTCHN_CHANNEL              Channel;
     ULONG                               Events;
     BOOLEAN                             Connected;
+    BOOLEAN                             Enabled;
     USHORT                              RequestId;
     struct xen_netif_ctrl_request       Request;
     struct xen_netif_ctrl_response      Response;
@@ -194,7 +195,7 @@ ControllerPutRequest(
     NTSTATUS                        status;
 
     status = STATUS_NOT_SUPPORTED;
-    if (!Controller->Connected)
+    if (!Controller->Enabled)
         goto fail1;
 
     status = STATUS_INSUFFICIENT_RESOURCES;
@@ -688,7 +689,11 @@ ControllerEnable(
     IN  PXENVIF_CONTROLLER      Controller
     )
 {
-    UNREFERENCED_PARAMETER(Controller);
+    __ControllerAcquireLock(Controller);
+
+    Controller->Enabled = TRUE;
+
+    __ControllerReleaseLock(Controller);
 
     Trace("<===>\n");
 }
@@ -698,7 +703,11 @@ ControllerDisable(
     IN  PXENVIF_CONTROLLER      Controller
     )
 {
-    UNREFERENCED_PARAMETER(Controller);
+    __ControllerAcquireLock(Controller);
+
+    Controller->Enabled = FALSE;
+
+    __ControllerReleaseLock(Controller);
 
     Trace("<===>\n");
 }
-- 
2.51.0.windows.2



--
Ngoc Tu Dinh | Vates XCP-ng Developer

XCP-ng & Xen Orchestra - Vates solutions

web: https://vates.tech




 


Rackspace

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