datapath-windows/ovsext/Vport.c
/*
 * --------------------------------------------------------------------------
 * Enumerates the ports on the Hyper-V switch.
 * --------------------------------------------------------------------------
 */
Enumerates the ports on the Hyper-V switch.
Enumerates the ports on the Hyper - V switch .
NDIS_STATUS
OvsAddConfiguredSwitchPorts(POVS_SWITCH_CONTEXT switchContext)
{
    NDIS_STATUS status = NDIS_STATUS_SUCCESS;
    ULONG arrIndex;
    PNDIS_SWITCH_PORT_PARAMETERS portParam;
    PNDIS_SWITCH_PORT_ARRAY portArray = NULL;
    OVS_LOG_TRACE("Enter: switchContext:%p", switchContext);
    status = OvsGetPortsOnSwitch(switchContext, &portArray);
    if (status != NDIS_STATUS_SUCCESS) {
        goto cleanup;
    }
    for (arrIndex = 0; arrIndex < portArray->NumElements; arrIndex++) {
         portParam = NDIS_SWITCH_PORT_AT_ARRAY_INDEX(portArray, arrIndex);
         if (portParam->IsValidationPort) {
             continue;
         }
         status = HvCreatePort(switchContext, portParam, 0);
         if (status != STATUS_SUCCESS && status != STATUS_DATA_NOT_ACCEPTED) {
             break;
         }
    }
cleanup:
    if (status != NDIS_STATUS_SUCCESS) {
        OvsClearAllSwitchVports(switchContext);
    }
    OvsFreeSwitchPortsArray(portArray);
    OVS_LOG_TRACE("Exit: status: %x", status);
    return status;
}
NDIS_STATUS OvsAddConfiguredSwitchPorts ( POVS_SWITCH_CONTEXT switchContext ) { NDIS_STATUS status = NDIS_STATUS_SUCCESS ; ULONG arrIndex ; PNDIS_SWITCH_PORT_PARAMETERS portParam ; PNDIS_SWITCH_PORT_ARRAY portArray = NULL ; OVS_LOG_TRACE ( " " , switchContext ) ; status = OvsGetPortsOnSwitch ( switchContext , & portArray ) ; if ( status != NDIS_STATUS_SUCCESS ) { goto cleanup ; } for ( arrIndex = 0 ; arrIndex < portArray -> NumElements ; arrIndex ++ ) { portParam = NDIS_SWITCH_PORT_AT_ARRAY_INDEX ( portArray , arrIndex ) ; if ( portParam -> IsValidationPort ) { continue ; } status = HvCreatePort ( switchContext , portParam , 0 ) ; if ( status != STATUS_SUCCESS && status != STATUS_DATA_NOT_ACCEPTED ) { break ; } } cleanup : if ( status != NDIS_STATUS_SUCCESS ) { OvsClearAllSwitchVports ( switchContext ) ; } OvsFreeSwitchPortsArray ( portArray ) ; OVS_LOG_TRACE ( " " , status ) ; return status ; }
Enumerates the ports on the Hyper-V switch.
Enumerates the ports on the Hyper - V switch .