summaryrefslogtreecommitdiff
path: root/datapath-windows/ovsext/Switch.c
diff options
context:
space:
mode:
authorSorin Vinturis <svinturis@cloudbasesolutions.com>2015-06-19 16:33:56 +0000
committerGurucharan Shetty <gshetty@nicira.com>2015-06-19 12:57:12 -0700
commit18b19ad911702dcaa861368f1bb059ed5e84ae31 (patch)
treec25fef1453a86777aa7b4eb80db32ab4a4887ac9 /datapath-windows/ovsext/Switch.c
parent0b623ad5a8b8ab2a8b7441bd43579eb52bdc672f (diff)
downloadopenvswitch-18b19ad911702dcaa861368f1bb059ed5e84ae31.tar.gz
datapath-windows: Initialize reference count when enabling extension
When the extension is initialized the global reference count, used for preventing early deallocation of the switch extension, is set to 1. Enabling and then disabling the extension leaves the latter reference count to zero. Because of this the switch context fails to be acquired, i.e OvsAcquireSwitchContext returns zero, and that affects driver's communication to the userspace. The solution is to initialize the reference count each time the extension is enabled. Signed-off-by: Sorin Vinturis <svinturis@cloudbasesolutions.com> Reported-by: Nithin Raju <nithin@vmware.com> Reported-at: https://github.com/openvswitch/ovs-issues/issues/86 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.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/datapath-windows/ovsext/Switch.c b/datapath-windows/ovsext/Switch.c
index 99a306d26..f176fa09f 100644
--- a/datapath-windows/ovsext/Switch.c
+++ b/datapath-windows/ovsext/Switch.c
@@ -46,7 +46,7 @@ extern PDEVICE_OBJECT gOvsDeviceObject;
* Reference count used to prevent premature deallocation of the global switch
* context structure, gOvsSwitchContext.
*/
-volatile LONG gOvsSwitchContextRefCount = 1;
+volatile LONG gOvsSwitchContextRefCount = 0;
static NDIS_STATUS OvsCreateSwitch(NDIS_HANDLE ndisFilterHandle,
POVS_SWITCH_CONTEXT *switchContextOut);
@@ -137,6 +137,7 @@ OvsExtAttach(NDIS_HANDLE ndisFilterHandle,
switchContext->controlFlowState = OvsSwitchAttached;
switchContext->dataFlowState = OvsSwitchPaused;
+ gOvsSwitchContextRefCount = 1;
gOvsSwitchContext = switchContext;
KeMemoryBarrier();