summaryrefslogtreecommitdiff
path: root/datapath-windows/ovsext/Switch.c
diff options
context:
space:
mode:
authorAlin Serdean <aserdean@cloudbasesolutions.com>2016-03-10 13:33:42 +0000
committerBen Pfaff <blp@ovn.org>2016-04-26 08:19:31 -0700
commit31bb0c7a3260bc1224d7ec1484d31ddec1f745d8 (patch)
tree265f3dc0154cf6b7aede4d9f19d20fb9f7cb0404 /datapath-windows/ovsext/Switch.c
parent46ed13827e8793c9638bcf550390b52265fe7c52 (diff)
downloadopenvswitch-31bb0c7a3260bc1224d7ec1484d31ddec1f745d8.tar.gz
datapath-windows: Pause switch state on PnP event
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@cloudbasesolutions.com> Acked-by: Sairam Venugopal <vsairam@vmware.com> Acked-by: Nithin Raju <nithin@vmware.com> Signed-off-by: Ben Pfaff <blp@ovn.org>
Diffstat (limited to 'datapath-windows/ovsext/Switch.c')
-rw-r--r--datapath-windows/ovsext/Switch.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/datapath-windows/ovsext/Switch.c b/datapath-windows/ovsext/Switch.c
index 7ad2e9846..825fa3c8f 100644
--- a/datapath-windows/ovsext/Switch.c
+++ b/datapath-windows/ovsext/Switch.c
@@ -353,14 +353,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;
}
@@ -613,6 +612,11 @@ OvsExtNetPnPEvent(NDIS_HANDLE filterModuleContext,
}
}
+ if (netPnPEvent->NetPnPEvent.NetEvent == NetEventFilterPreDetach) {
+ switchContext->dataFlowState = OvsSwitchPaused;
+ KeMemoryBarrier();
+ }
+
status = NdisFNetPnPEvent(switchContext->NdisFilterHandle,
netPnPEvent);
OVS_LOG_TRACE("Exit: OvsExtNetPnPEvent");