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 <svintu...@cloudbasesolutions.com> Reported-by: Nithin Raju <nit...@vmware.com> Reported-at: https://github.com/openvswitch/ovs-issues/issues/86 Acked-by: Nithin Raju <nit...@vmware.com> --- datapath-windows/ovsext/Switch.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/datapath-windows/ovsext/Switch.c b/datapath-windows/ovsext/Switch.c index 99a306d..f176fa0 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(); -- 1.9.0.msysgit.0 _______________________________________________ dev mailing list dev@openvswitch.org http://openvswitch.org/mailman/listinfo/dev