datapath-windows: fix endless loop on reboot
authorAlin Serdean <aserdean@cloudbasesolutions.com>
Tue, 12 Jan 2016 18:00:32 +0000 (18:00 +0000)
committerGurucharan Shetty <guru@ovn.org>
Wed, 3 Feb 2016 16:13:52 +0000 (08:13 -0800)
Testing under 2012 gave some more inisight on an old bug.

If a PNP event with the value of NetEventSwitchActivate was triggered
we were calling OvsQuerySwitchActivationComplete which does an OID request
to the underlying drivers, however this triggered a hang because as per
documentation:
https://msdn.microsoft.com/en-us/library/windows/hardware/ff561830%28v=vs.85%29.aspx
"A driver can call NdisFOidRequest when it is in the Restarting, Running,
Pausing, or Paused state."
This resulted in an endless booting cycle.
Looking at the documentation again:
https://msdn.microsoft.com/en-us/library/windows/hardware/ff568751%28v=vs.85%29.aspx
NetEventSwitchActivate indicates that the extensible switch has completed
activation so we can now safely query the switch itself.

Also we are not forwarding the PNP event to the overlaying drivers unless
we succeeded in the operation, this issue has been fixed also.

Signed-off-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com>
Acked-by: Nithin Raju <nithin@vmware.com>
Signed-off-by: Gurucharan Shetty <guru@ovn.org>
datapath-windows/ovsext/Switch.c

index 4d9cfda..77bafb4 100644 (file)
@@ -588,7 +588,6 @@ OvsExtNetPnPEvent(NDIS_HANDLE filterModuleContext,
 {
     NDIS_STATUS status = NDIS_STATUS_SUCCESS;
     POVS_SWITCH_CONTEXT switchContext = (POVS_SWITCH_CONTEXT)filterModuleContext;
-    BOOLEAN switchActive;
 
     OVS_LOG_TRACE("Enter: filterModuleContext: %p, NetEvent: %d",
                   filterModuleContext, (netPnPEvent->NetPnPEvent).NetEvent);
@@ -597,24 +596,17 @@ OvsExtNetPnPEvent(NDIS_HANDLE filterModuleContext,
      * an asynchronous notification of the switch completing activation.
      */
     if (netPnPEvent->NetPnPEvent.NetEvent == NetEventSwitchActivate) {
-        status = OvsQuerySwitchActivationComplete(switchContext, &switchActive);
-        if (status != NDIS_STATUS_SUCCESS) {
-            switchContext->isActivateFailed = TRUE;
-        } else {
-            ASSERT(switchContext->isActivated == FALSE);
-            if (switchContext->isActivated == FALSE && switchActive == TRUE) {
-                status = OvsActivateSwitch(switchContext);
-                OVS_LOG_TRACE("OvsExtNetPnPEvent: activated switch: %p "
-                              "status: %s", switchContext,
-                              status ? "TRUE" : "FALSE");
-            }
+        ASSERT(switchContext->isActivated == FALSE);
+        if (switchContext->isActivated == FALSE) {
+            status = OvsActivateSwitch(switchContext);
+            OVS_LOG_TRACE("OvsExtNetPnPEvent: activated switch: %p "
+                          "status: %s", switchContext,
+                          status ? "TRUE" : "FALSE");
         }
     }
 
-    if (status == NDIS_STATUS_SUCCESS) {
-        status = NdisFNetPnPEvent(switchContext->NdisFilterHandle,
-                                  netPnPEvent);
-    }
+    status = NdisFNetPnPEvent(switchContext->NdisFilterHandle,
+                              netPnPEvent);
     OVS_LOG_TRACE("Exit: OvsExtNetPnPEvent");
 
     return status;