Disconnecting the NIC from HV switch and then unloading the driver hits an
ASSERT (ASSERT(switchContext->numPhysicalNics);).

Also if the external or internal port is deleted from the userspace, the
latter ports would not be re-added until the extension would be reloaded.

This patch ensures that the internal or external ports are being deleted
only by the Hyper-V switch mechanisms, which also solves the issue raised
by the above assert.

Signed-off-by: Sorin Vinturis <svintu...@cloudbasesolutions.com>
Co-authored-by: Alin Gabriel Serdean <aserd...@cloudbasesolutions.com>
Reported-by: Sorin Vinturis <svintu...@cloudbasesolutions.com>
Reported-at: https://github.com/openvswitch/ovs-issues/issues/79
---
 datapath-windows/ovsext/Vport.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/datapath-windows/ovsext/Vport.c b/datapath-windows/ovsext/Vport.c
index 9139545..5283d7b 100644
--- a/datapath-windows/ovsext/Vport.c
+++ b/datapath-windows/ovsext/Vport.c
@@ -1212,7 +1212,7 @@ OvsRemoveAndDeleteVport(PVOID usrParamsContext,
         (POVS_USER_PARAMS_CONTEXT)usrParamsContext;
     BOOLEAN hvSwitchPort = FALSE;
 
-    if (vport->isExternal) {
+    if (vport->isExternal && hvDelete) {
         if (vport->nicIndex == 0) {
             ASSERT(switchContext->numPhysicalNics == 0);
             switchContext->virtualExternalPortId = 0;
@@ -1228,7 +1228,7 @@ OvsRemoveAndDeleteVport(PVOID usrParamsContext,
 
     switch (vport->ovsType) {
     case OVS_VPORT_TYPE_INTERNAL:
-        if (!vport->isBridgeInternal) {
+        if (!vport->isBridgeInternal && hvDelete) {
             switchContext->internalPortId = 0;
             switchContext->internalVport = NULL;
             OvsInternalAdapterDown();
-- 
1.9.0.msysgit.0
_______________________________________________
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev

Reply via email to