Skip to content

Commit

Permalink
datapath-windows: Initialize reference count when enabling extension
Browse files Browse the repository at this point in the history
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: openvswitch/ovs-issues#86
Acked-by: Nithin Raju <nithin@vmware.com>
Signed-off-by: Gurucharan Shetty <gshetty@nicira.com>
  • Loading branch information
svinturis authored and shettyg committed Jun 19, 2015
1 parent 0b623ad commit 18b19ad
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion datapath-windows/ovsext/Switch.c
Expand Up @@ -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);
Expand Down Expand Up @@ -137,6 +137,7 @@ OvsExtAttach(NDIS_HANDLE ndisFilterHandle,
switchContext->controlFlowState = OvsSwitchAttached;
switchContext->dataFlowState = OvsSwitchPaused;

gOvsSwitchContextRefCount = 1;
gOvsSwitchContext = switchContext;
KeMemoryBarrier();

Expand Down

0 comments on commit 18b19ad

Please sign in to comment.