]> git.proxmox.com Git - mirror_ovs.git/commitdiff
datapath-windows: Do not delete internal port on OID_SWITCH_NIC_DISCONNECT
authorJinjun Gao <jinjung@vmware.com>
Sun, 8 Dec 2019 09:28:17 +0000 (09:28 +0000)
committerAlin Gabriel Serdean <aserdean@ovn.org>
Mon, 9 Dec 2019 11:33:44 +0000 (13:33 +0200)
According to the microsoft doc:
https://docs.microsoft.com/en-us/windows-hardware/drivers/network/hyper-v-extensible-switch-port-and-network-adapter-states
Below OID request sequence is validation:
         OID_SWITCH_NIC_CONNECT -> OID_SWITCH_NIC_DISCONNECT
                  ^                           |
                  |                           V
         OID_SWITCH_NIC_CREATE  <- OID_SWITCH_NIC_DELETE

In above sequence, the windows extensible switch interface assumes the
OID_SWITCH_PORT_CREATE has issued and the port has been created
successfully. If delete the internal port in HvDisconnectNic(),
HvCreateNic() will fail when received OID_SWITCH_NIC_CREATE late because
there is no corresponding port.

Signed-off-by: Jinjun Gao <jinjung@vmware.com>
Signed-off-by: Alin Gabriel Serdean <aserdean@ovn.org>
datapath-windows/ovsext/Vport.c

index 57e75109d20a504418fdc4d5b2e041645a5df662..9f1587f443dfecede8cd579a12bb48217a4a243a 100644 (file)
@@ -628,6 +628,7 @@ HvDisconnectNic(POVS_SWITCH_CONTEXT switchContext,
     event.upcallPid = vport->upcallPid;
     RtlCopyMemory(&event.ovsName, &vport->ovsName, sizeof event.ovsName);
     event.type = OVS_EVENT_LINK_DOWN;
+    OvsPostVportEvent(&event);
 
     /*
      * Delete the port from the hash tables accessible to userspace. After this
@@ -635,13 +636,18 @@ HvDisconnectNic(POVS_SWITCH_CONTEXT switchContext,
      */
     if (OvsIsRealExternalVport(vport)) {
         OvsRemoveAndDeleteVport(NULL, switchContext, vport, FALSE, TRUE);
-        OvsPostVportEvent(&event);
     }
 
     if (isInternalPort) {
         OvsUnBindVportWithIpHelper(vport, switchContext);
-        OvsRemoveAndDeleteVport(NULL, switchContext, vport, TRUE, TRUE);
-        OvsPostVportEvent(&event);
+        /*
+         * Don't delete the port from the hash tables here for internal port
+         * because the internal port cannot be recreated in HvCreateNic(). It
+         * only can be created in HvCreatePort() by issuing
+         * OID_SWITCH_PORT_CREATE. We should wait extensible switch interface
+         * to issue OID_SWITCH_PORT_TEARDOWN and OID_SWITCH_PORT_DELETE to
+         * delete the internal port.
+         */
     }
     NdisReleaseRWLock(switchContext->dispatchLock, &lockState);