Example #1
0
/*
    Split the VNIC into a separate context
    */
VOID
HvlPerformCtxSplit(
    PHVL pHvl,
    PVNIC pVNic
    )
{
    PHVL_CONTEXT pCtx = pVNic->pHvlCtx, pNewCtx = NULL;
    
    if (pCtx->ulNumVNics > 1)
    {
        HvlRemoveVNicFromCtx(pHvl, pVNic);

        HvlAssignVNicToContext(pHvl, pVNic, &pNewCtx);

        /*
            Make the new context part of the inactive context list. It will be picked up whenever 
            we next context switch to it
            */
        InsertTailList(&pHvl->InactiveContextList, &pNewCtx->Link);

        MpTrace(COMP_HVL, DBG_NORMAL, ("Splitted VNIC (%d, context = %p) into a separate context %p", VNIC_PORT_NO, pCtx, pNewCtx));
    }
    else
    {
        // there is nothing to be done
    }        
}
Example #2
0
NDIS_STATUS
Hvl11DeregisterVNic(
    _In_  PHVL    pHvl,
    _In_  PVNIC   pVNic               
    )
{
    NDIS_STATUS ndisStatus = NDIS_STATUS_SUCCESS;

    HvlLock(pHvl);

    HvlRemoveVNicFromCtx(pHvl, pVNic);

    // remove it from the list of VNICs that the HVL maintains
    RemoveEntryList (&pVNic->VNicLink);
    InitializeListHead(&pVNic->VNicLink);

    // if there was a cached notification sourced by this VNIC clear it now
    if (pHvl->CachedChannelNotification.Header.pSourceVNic == pVNic)
    {
        HvlClearCachedNotification(pHvl);
    }
    
    HvlUnlock(pHvl);
    
    return ndisStatus;
}
Example #3
0
/*
    Merges pCtxToMerge with pDstCtx. pDstCtx has the merged context
    */
VOID
HvlMergeCtxs(
    PHVL pHvl,
    PHVL_CONTEXT pCtxToMerge,
    PHVL_CONTEXT pDstCtx
    )
{
    LIST_ENTRY *pEntryVNic = NULL;
    PVNIC pVNic = NULL;
    VNIC_SIGNATURE Ctx1Sig = HvlCtxGetSignature(pCtxToMerge);
    VNIC_SIGNATURE Ctx2Sig = HvlCtxGetSignature(pDstCtx);

    // this function should only be called if the signatures are compatible
    ASSERT(VNic11AreCompatibleSignatures(&Ctx1Sig, &Ctx2Sig));

    MpTrace(COMP_HVL, DBG_NORMAL, ("Merging context %p into context %p. ", pCtxToMerge, pDstCtx));

    /*
        Go through the list of VNICs and add them to the destination context
        */
    pEntryVNic = pCtxToMerge->VNicList.Flink;
    while (pEntryVNic != &pCtxToMerge->VNicList)
    {
        pVNic = CONTAINING_RECORD(pEntryVNic, VNIC, CtxLink);

        // remove the VNIC from this context
        HvlRemoveVNicFromCtx(pHvl, pVNic);

        // move this VNIC to the destination context
        HvlAddVNicToCtx(pVNic, pDstCtx);

        /*
            Make the entry point to the first VNIC in the list
            */
        pEntryVNic = pCtxToMerge->VNicList.Flink;
    }

    ASSERT(IsListEmpty(&pCtxToMerge->VNicList));

    // set the merged signature on the destination context
    HvlCtxSetSignature(pDstCtx, VNic11MergeSignatures(&Ctx1Sig, &Ctx2Sig));        
}
Example #4
0
NDIS_STATUS
Hvl11DeregisterHelperPort(
    _In_  PHVL    pHvl,
    _In_  PVNIC   pVNic
    )
{
    NDIS_STATUS ndisStatus = NDIS_STATUS_SUCCESS;

    UNREFERENCED_PARAMETER(pVNic);

    ASSERT(HvlIsHelperVNic(pHvl, pVNic));
    
    HvlLock(pHvl);

    HvlRemoveVNicFromCtx(pHvl, pVNic);

    HvlUnlock(pHvl);
    
    return ndisStatus;
}