[ovs-dev] [PATCH v2] datapath-windows: Pause switch state on PnP event

Alin Serdean aserdean at cloudbasesolutions.com
Thu Mar 10 13:33:42 UTC 2016


A PnP(plug and play) event will be triggered before trying to disable
the extension. We could use this PnP event to prepare for detaching
the datapath.

This patch sets the switch into a paused state so no more net buffers
are queued.

Also clean some commentaries.

Signed-off-by: Alin Gabriel Serdean <aserdean at cloudbasesolutions.com>
---
v2: Address comments
---
 datapath-windows/ovsext/Switch.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/datapath-windows/ovsext/Switch.c b/datapath-windows/ovsext/Switch.c
index 77bafb4..2a19988 100644
--- a/datapath-windows/ovsext/Switch.c
+++ b/datapath-windows/ovsext/Switch.c
@@ -345,14 +345,13 @@ OvsExtPause(NDIS_HANDLE filterModuleContext,
     OVS_LOG_TRACE("Enter: filterModuleContext %p",
                   filterModuleContext);
 
-    ASSERT(switchContext->dataFlowState == OvsSwitchRunning);
     switchContext->dataFlowState = OvsSwitchPaused;
     KeMemoryBarrier();
     while(switchContext->pendingOidCount > 0) {
         NdisMSleep(1000);
     }
 
-    OVS_LOG_TRACE("Exit: OvsDetach Successfully");
+    OVS_LOG_TRACE("Exit: OvsExtPause Successfully");
     return NDIS_STATUS_SUCCESS;
 }
 
@@ -605,6 +604,11 @@ OvsExtNetPnPEvent(NDIS_HANDLE filterModuleContext,
         }
     }
 
+    if (netPnPEvent->NetPnPEvent.NetEvent == NetEventFilterPreDetach) {
+        switchContext->dataFlowState = OvsSwitchPaused;
+        KeMemoryBarrier();
+    }
+
     status = NdisFNetPnPEvent(switchContext->NdisFilterHandle,
                               netPnPEvent);
     OVS_LOG_TRACE("Exit: OvsExtNetPnPEvent");
-- 
1.9.5.msysgit.0



More information about the dev mailing list