datapath-windows/ovsext/Vport.c
/*
 * --------------------------------------------------------------------------
 * Function to process delete event of a NIC on the Hyper-V switch.
 * --------------------------------------------------------------------------
 */
Function to process delete event of a NIC on the Hyper-V switch.
Function to process delete event of a NIC on the Hyper - V switch .
VOID
HvDeleteNic(POVS_SWITCH_CONTEXT switchContext,
            PNDIS_SWITCH_NIC_PARAMETERS nicParam)
{
    LOCK_STATE_EX lockState;
    POVS_VPORT_ENTRY vport;
    VPORT_NIC_ENTER(nicParam);
    OvsWaitActivate(switchContext, OVS_VPORT_DEFAULT_WAIT_TIME_MICROSEC);
    if (!switchContext->isActivated) {
        OVS_LOG_WARN("Switch is not activated yet.");
        goto done;
    }
    NdisAcquireRWLockWrite(switchContext->dispatchLock, &lockState, 0);
    vport = OvsFindVportByPortIdAndNicIndex(switchContext,
                                            nicParam->PortId,
                                            nicParam->NicIndex);
    if (!vport) {
        OVS_LOG_WARN("Vport not present.");
        NdisReleaseRWLock(switchContext->dispatchLock, &lockState);
        goto done;
    }
    vport->nicState = NdisSwitchNicStateUnknown;
    vport->ovsState = OVS_STATE_PORT_CREATED;
    if (OvsIsRealExternalVport(vport)) {
        OvsRemoveAndDeleteVport(NULL, switchContext, vport, TRUE, FALSE);
    }
    NdisReleaseRWLock(switchContext->dispatchLock, &lockState);
done:
    VPORT_NIC_EXIT(nicParam);
}
VOID HvDeleteNic ( POVS_SWITCH_CONTEXT switchContext , PNDIS_SWITCH_NIC_PARAMETERS nicParam ) { LOCK_STATE_EX lockState ; POVS_VPORT_ENTRY vport ; VPORT_NIC_ENTER ( nicParam ) ; OvsWaitActivate ( switchContext , OVS_VPORT_DEFAULT_WAIT_TIME_MICROSEC ) ; if ( ! switchContext -> isActivated ) { OVS_LOG_WARN ( " " ) ; goto done ; } NdisAcquireRWLockWrite ( switchContext -> dispatchLock , & lockState , 0 ) ; vport = OvsFindVportByPortIdAndNicIndex ( switchContext , nicParam -> PortId , nicParam -> NicIndex ) ; if ( ! vport ) { OVS_LOG_WARN ( " " ) ; NdisReleaseRWLock ( switchContext -> dispatchLock , & lockState ) ; goto done ; } vport -> nicState = NdisSwitchNicStateUnknown ; vport -> ovsState = OVS_STATE_PORT_CREATED ; if ( OvsIsRealExternalVport ( vport ) ) { OvsRemoveAndDeleteVport ( NULL , switchContext , vport , TRUE , FALSE ) ; } NdisReleaseRWLock ( switchContext -> dispatchLock , & lockState ) ; done : VPORT_NIC_EXIT ( nicParam ) ; }
Function to process delete event of a NIC on the Hyper-V switch.
Function to process delete event of a NIC on the Hyper - V switch .
/* Wait for lists to be initialized. */ /* This vport was created in HvCreateNic(). */