datapath-windows/ovsext/Oid.c
/*
 * --------------------------------------------------------------------------
 * Utility function to query if the extensible switch has completed activation
 * successfully.
 * --------------------------------------------------------------------------
 */
Utility function to query if the extensible switch has completed activation
successfully.
Utility function to query if the extensible switch has completed activation successfully .
NDIS_STATUS
OvsQuerySwitchActivationComplete(POVS_SWITCH_CONTEXT switchContext,
                                 BOOLEAN *switchActive)
{
    NDIS_STATUS status;
    PNDIS_SWITCH_PARAMETERS switchParams;
    UINT32 outputSizeNeeded;
    OVS_LOG_TRACE("Enter: switchContext: %p, switchActive: %p",
                  switchContext, switchActive);
    switchParams = OvsAllocateMemoryWithTag(sizeof *switchParams,
                                            OVS_OID_POOL_TAG);
    if (!switchParams) {
        status = NDIS_STATUS_RESOURCES;
        goto done;
    }
    RtlZeroMemory(switchParams, sizeof *switchParams);
    switchParams->Header.Revision = NDIS_SWITCH_PARAMETERS_REVISION_1;
    switchParams->Header.Type = NDIS_OBJECT_TYPE_DEFAULT;
    switchParams->Header.Size = NDIS_SIZEOF_NDIS_SWITCH_PARAMETERS_REVISION_1;
    status = OvsIssueOidRequest(switchContext, NdisRequestQueryInformation,
                                OID_SWITCH_PARAMETERS, NULL, 0,
                                (PVOID)switchParams, sizeof *switchParams,
                                &outputSizeNeeded);
    ASSERT(status != NDIS_STATUS_INVALID_LENGTH);
    ASSERT(status != NDIS_STATUS_PENDING);
    if (status == NDIS_STATUS_SUCCESS) {
        ASSERT(switchParams->Header.Type == NDIS_OBJECT_TYPE_DEFAULT);
        ASSERT(switchParams->Header.Revision == NDIS_SWITCH_PARAMETERS_REVISION_1);
        ASSERT(switchParams->Header.Size ==
                NDIS_SIZEOF_NDIS_SWITCH_PARAMETERS_REVISION_1);
        *switchActive = switchParams->IsActive;
    }
    OvsFreeMemoryWithTag(switchParams, OVS_OID_POOL_TAG);
done:
    OVS_LOG_TRACE("Exit: status %8x, switchActive: %d.",
                  status, *switchActive);
    return status;
}
NDIS_STATUS OvsQuerySwitchActivationComplete ( POVS_SWITCH_CONTEXT switchContext , BOOLEAN * switchActive ) { NDIS_STATUS status ; PNDIS_SWITCH_PARAMETERS switchParams ; UINT32 outputSizeNeeded ; OVS_LOG_TRACE ( " " , switchContext , switchActive ) ; switchParams = OvsAllocateMemoryWithTag ( sizeof * switchParams , OVS_OID_POOL_TAG ) ; if ( ! switchParams ) { status = NDIS_STATUS_RESOURCES ; goto done ; } RtlZeroMemory ( switchParams , sizeof * switchParams ) ; switchParams -> Header . Revision = NDIS_SWITCH_PARAMETERS_REVISION_1 ; switchParams -> Header . Type = NDIS_OBJECT_TYPE_DEFAULT ; switchParams -> Header . Size = NDIS_SIZEOF_NDIS_SWITCH_PARAMETERS_REVISION_1 ; status = OvsIssueOidRequest ( switchContext , NdisRequestQueryInformation , OID_SWITCH_PARAMETERS , NULL , 0 , ( PVOID ) switchParams , sizeof * switchParams , & outputSizeNeeded ) ; ASSERT ( status != NDIS_STATUS_INVALID_LENGTH ) ; ASSERT ( status != NDIS_STATUS_PENDING ) ; if ( status == NDIS_STATUS_SUCCESS ) { ASSERT ( switchParams -> Header . Type == NDIS_OBJECT_TYPE_DEFAULT ) ; ASSERT ( switchParams -> Header . Revision == NDIS_SWITCH_PARAMETERS_REVISION_1 ) ; ASSERT ( switchParams -> Header . Size == NDIS_SIZEOF_NDIS_SWITCH_PARAMETERS_REVISION_1 ) ; * switchActive = switchParams -> IsActive ; } OvsFreeMemoryWithTag ( switchParams , OVS_OID_POOL_TAG ) ; done : OVS_LOG_TRACE ( " " , status , * switchActive ) ; return status ; }
Utility function to query if the extensible switch has completed activation
 successfully.
Utility function to query if the extensible switch has completed activation successfully .
/*
     * Even though 'switchParms' is supposed to be populated by the OID, it
     * needs to be initialized nevertheless. Otherwise, OID returns
     * NDIS_STATUS_INVALID_PARAMETER. This is not clear in the documentation.
     */