datapath-windows/ovsext/Oid.c
/*
 * --------------------------------------------------------------------------
 * Implements filter driver's FilterOidRequest function.
 * --------------------------------------------------------------------------
 */
Implements filter driver's FilterOidRequest function.
Implements filter driver ' s FilterOidRequest function .
NDIS_STATUS
OvsExtOidRequest(NDIS_HANDLE filterModuleContext,
                 PNDIS_OID_REQUEST oidRequest)
{
    POVS_SWITCH_CONTEXT switchObject = (POVS_SWITCH_CONTEXT)filterModuleContext;
    NDIS_STATUS status;
    PNDIS_OID_REQUEST clonedOidRequest = NULL;
    struct _METHOD *methodInfo = &(oidRequest->DATA.METHOD_INFORMATION);
    BOOLEAN completeOid = FALSE;
    ULONG bytesNeeded = 0;
    OVS_LOG_TRACE("Enter: oidRequest %p, reqType: %d",
                  oidRequest, oidRequest->RequestType);
    status = NdisAllocateCloneOidRequest(switchObject->NdisFilterHandle,
                                         oidRequest, OVS_MEMORY_TAG,
                                         &clonedOidRequest);
    if (status != NDIS_STATUS_SUCCESS) {
        goto done;
    }
    NdisInterlockedIncrement(&(switchObject->pendingOidCount));
    OvsOidSetOrigRequest(clonedOidRequest, oidRequest);
    OvsOidSetContext(clonedOidRequest, NULL);
    switch(clonedOidRequest->RequestType) {
    case NdisRequestSetInformation:
        status = OvsProcessSetOid(switchObject, clonedOidRequest,
                                                   &completeOid);
        break;
    case NdisRequestMethod:
        status = OvsProcessMethodOid(switchObject, clonedOidRequest,
                                     &completeOid, &bytesNeeded);
        break;
    default:
        break;
    }
    if (completeOid == TRUE) {
        OVS_LOG_INFO("Complete True oidRequest %p.", oidRequest);
        OvsOidSetOrigRequest(clonedOidRequest, NULL);
        NdisFreeCloneOidRequest(switchObject->NdisFilterHandle,
                                             clonedOidRequest);
        methodInfo->BytesNeeded = bytesNeeded;
        NdisInterlockedDecrement(&switchObject->pendingOidCount);
        goto done;
    }
    status = NdisFOidRequest(switchObject->NdisFilterHandle, clonedOidRequest);
    if (status != NDIS_STATUS_PENDING) {
        OvsExtOidRequestComplete(switchObject, clonedOidRequest, status);
        status = NDIS_STATUS_PENDING;
    }
done:
    OVS_LOG_TRACE("Exit: status %8x.", status);
    return status;
}
NDIS_STATUS OvsExtOidRequest ( NDIS_HANDLE filterModuleContext , PNDIS_OID_REQUEST oidRequest ) { POVS_SWITCH_CONTEXT switchObject = ( POVS_SWITCH_CONTEXT ) filterModuleContext ; NDIS_STATUS status ; PNDIS_OID_REQUEST clonedOidRequest = NULL ; struct _METHOD * methodInfo = & ( oidRequest -> DATA . METHOD_INFORMATION ) ; BOOLEAN completeOid = FALSE ; ULONG bytesNeeded = 0 ; OVS_LOG_TRACE ( " " , oidRequest , oidRequest -> RequestType ) ; status = NdisAllocateCloneOidRequest ( switchObject -> NdisFilterHandle , oidRequest , OVS_MEMORY_TAG , & clonedOidRequest ) ; if ( status != NDIS_STATUS_SUCCESS ) { goto done ; } NdisInterlockedIncrement ( & ( switchObject -> pendingOidCount ) ) ; OvsOidSetOrigRequest ( clonedOidRequest , oidRequest ) ; OvsOidSetContext ( clonedOidRequest , NULL ) ; switch ( clonedOidRequest -> RequestType ) { case NdisRequestSetInformation : status = OvsProcessSetOid ( switchObject , clonedOidRequest , & completeOid ) ; break ; case NdisRequestMethod : status = OvsProcessMethodOid ( switchObject , clonedOidRequest , & completeOid , & bytesNeeded ) ; break ; default : break ; } if ( completeOid == TRUE ) { OVS_LOG_INFO ( " " , oidRequest ) ; OvsOidSetOrigRequest ( clonedOidRequest , NULL ) ; NdisFreeCloneOidRequest ( switchObject -> NdisFilterHandle , clonedOidRequest ) ; methodInfo -> BytesNeeded = bytesNeeded ; NdisInterlockedDecrement ( & switchObject -> pendingOidCount ) ; goto done ; } status = NdisFOidRequest ( switchObject -> NdisFilterHandle , clonedOidRequest ) ; if ( status != NDIS_STATUS_PENDING ) { OvsExtOidRequestComplete ( switchObject , clonedOidRequest , status ) ; status = NDIS_STATUS_PENDING ; } done : OVS_LOG_TRACE ( " " , status ) ; return status ; }
Implements filter driver's FilterOidRequest function.
Implements filter driver ' s FilterOidRequest function .
/* set the original oid request in cloned one. */ /* We do not handle other request types as of now.
         * We are just a passthrough for those. */ /* dont leave any reference back to original request,
         * even if we are freeing it up. */ /* pass the request down */ /* sample code says so */