datapath-windows/ovsext/Vport.c
/*
 * --------------------------------------------------------------------------
 * Function to process deletion of a port on the Hyper-V switch.
 * --------------------------------------------------------------------------
 */
Function to process deletion of a port on the Hyper-V switch.
Function to process deletion of a port on the Hyper - V switch .
VOID
HvDeletePort(POVS_SWITCH_CONTEXT switchContext,
             PNDIS_SWITCH_PORT_PARAMETERS portParams)
{
    POVS_VPORT_ENTRY vport;
    LOCK_STATE_EX lockState;
    VPORT_PORT_ENTER(portParams);
    NdisAcquireRWLockWrite(switchContext->dispatchLock, &lockState, 0);
    vport = OvsFindVportByPortIdAndNicIndex(switchContext,
                                            portParams->PortId, 0);
    if (vport) {
        OVS_VPORT_EVENT_ENTRY event;
        event.portNo = vport->portNo;
        event.ovsType = vport->ovsType;
        event.upcallPid = vport->upcallPid;
        RtlCopyMemory(&event.ovsName, &vport->ovsName, sizeof event.ovsName);
        event.type = OVS_EVENT_LINK_DOWN;
        OvsRemoveAndDeleteVport(NULL, switchContext, vport, TRUE, FALSE);
        OvsPostVportEvent(&event);
    } else {
        OVS_LOG_WARN("Vport not present.");
    }
    NdisReleaseRWLock(switchContext->dispatchLock, &lockState);
    VPORT_PORT_EXIT(portParams);
}
VOID HvDeletePort ( POVS_SWITCH_CONTEXT switchContext , PNDIS_SWITCH_PORT_PARAMETERS portParams ) { POVS_VPORT_ENTRY vport ; LOCK_STATE_EX lockState ; VPORT_PORT_ENTER ( portParams ) ; NdisAcquireRWLockWrite ( switchContext -> dispatchLock , & lockState , 0 ) ; vport = OvsFindVportByPortIdAndNicIndex ( switchContext , portParams -> PortId , 0 ) ; if ( vport ) { OVS_VPORT_EVENT_ENTRY event ; event . portNo = vport -> portNo ; event . ovsType = vport -> ovsType ; event . upcallPid = vport -> upcallPid ; RtlCopyMemory ( & event . ovsName , & vport -> ovsName , sizeof event . ovsName ) ; event . type = OVS_EVENT_LINK_DOWN ; OvsRemoveAndDeleteVport ( NULL , switchContext , vport , TRUE , FALSE ) ; OvsPostVportEvent ( & event ) ; } else { OVS_LOG_WARN ( " " ) ; } NdisReleaseRWLock ( switchContext -> dispatchLock , & lockState ) ; VPORT_PORT_EXIT ( portParams ) ; }
Function to process deletion of a port on the Hyper-V switch.
Function to process deletion of a port on the Hyper - V switch .
/*
     * XXX: we can only destroy and remove the port if its datapath port
     * counterpart was deleted. If the datapath port counterpart is present,
     * we only mark the vport for deletion, so that a netlink command vport
     * delete will delete the vport.
    */