From 8834e5c27ff9739ff4bf0199894d839581d30da8 Mon Sep 17 00:00:00 2001 From: Alin Serdean Date: Tue, 12 Jan 2016 18:00:32 +0000 Subject: [PATCH] datapath-windows: fix endless loop on reboot 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 Acked-by: Nithin Raju Signed-off-by: Gurucharan Shetty --- datapath-windows/ovsext/Switch.c | 24 ++++++++---------------- 1 file changed, 8 insertions(+), 16 deletions(-) diff --git a/datapath-windows/ovsext/Switch.c b/datapath-windows/ovsext/Switch.c index 4d9cfda40..77bafb466 100644 --- a/datapath-windows/ovsext/Switch.c +++ b/datapath-windows/ovsext/Switch.c @@ -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; -- 2.20.1