diff options
author | Sorin Vinturis <svinturis@cloudbasesolutions.com> | 2015-04-23 20:27:53 +0000 |
---|---|---|
committer | Gurucharan Shetty <gshetty@nicira.com> | 2015-04-23 14:49:33 -0700 |
commit | 3ed424e5e5d614e08a58ffe700bbe88ed0514a7b (patch) | |
tree | 6a064375ebbe3686970f6b77a77d2cf4a0fffea4 /datapath-windows/ovsext/Switch.c | |
parent | dd92c6165ddb53922562c43fdcc8845dc4bb435a (diff) | |
download | openvswitch-3ed424e5e5d614e08a58ffe700bbe88ed0514a7b.tar.gz |
datapath-windows: Removed gOvsCtrlLock global spinlock
There is no need to use gOvsCtrlLock spinlock to guard the switch
context, as there is now the switch context's reference count used
for this purpose.
Now the gOvsCtrlLock spinlock guards only one shared resource, the
OVS_OPEN_INSTANCE global instance array.
Signed-off-by: Sorin Vinturis <svinturis@cloudbasesolutions.com>
Acked-by: Nithin Raju <nithin@vmware.com>
Signed-off-by: Gurucharan Shetty <gshetty@nicira.com>
Diffstat (limited to 'datapath-windows/ovsext/Switch.c')
-rw-r--r-- | datapath-windows/ovsext/Switch.c | 13 |
1 files changed, 4 insertions, 9 deletions
diff --git a/datapath-windows/ovsext/Switch.c b/datapath-windows/ovsext/Switch.c index 9e1e9a4c0..4f784b8a2 100644 --- a/datapath-windows/ovsext/Switch.c +++ b/datapath-windows/ovsext/Switch.c @@ -35,10 +35,9 @@ #include "Debug.h" POVS_SWITCH_CONTEXT gOvsSwitchContext; -BOOLEAN gOvsInAttach; +LONG volatile gOvsInAttach; UINT64 ovsTimeIncrementPerTick; -extern PNDIS_SPIN_LOCK gOvsCtrlLock; extern NDIS_HANDLE gOvsExtDriverHandle; extern NDIS_HANDLE gOvsExtDriverObject; @@ -89,22 +88,18 @@ OvsExtAttach(NDIS_HANDLE ndisFilterHandle, goto cleanup; } - NdisAcquireSpinLock(gOvsCtrlLock); if (gOvsSwitchContext) { - NdisReleaseSpinLock(gOvsCtrlLock); OVS_LOG_TRACE("Exit: Failed to create OVS Switch, only one datapath is" "supported, %p.", gOvsSwitchContext); goto cleanup; } - if (gOvsInAttach) { - NdisReleaseSpinLock(gOvsCtrlLock); + + if (InterlockedCompareExchange(&gOvsInAttach, 1, 0)) { /* Just fail the request. */ OVS_LOG_TRACE("Exit: Failed to create OVS Switch, since another attach" "instance is in attach process."); goto cleanup; } - gOvsInAttach = TRUE; - NdisReleaseSpinLock(gOvsCtrlLock); status = OvsInitIpHelper(ndisFilterHandle); if (status != STATUS_SUCCESS) { @@ -121,7 +116,7 @@ OvsExtAttach(NDIS_HANDLE ndisFilterHandle, /* * Register the switch context with NDIS so NDIS can pass it back to the - * Filterxxx callback functions as the 'FilterModuleContext' parameter. + * FilterXXX callback functions as the 'FilterModuleContext' parameter. */ RtlZeroMemory(&ovsExtAttributes, sizeof(NDIS_FILTER_ATTRIBUTES)); ovsExtAttributes.Header.Revision = NDIS_FILTER_ATTRIBUTES_REVISION_1; |