VirtualBox

Changeset 93628 in vbox for trunk/src/VBox/Devices


Ignore:
Timestamp:
Feb 6, 2022 11:44:05 PM (3 years ago)
Author:
vboxsync
Message:

VMM/PDMNetShaper,Main,DrvNetShaper: Moved the network shaper data off the hyper heap and into the VM structure. bugref:10093 bugref:5582

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/Network/DrvNetShaper.cpp

    r93115 r93628  
    121121 */
    122122PDMBOTHCBDECL(int) drvNetShaperUp_AllocBuf(PPDMINETWORKUP pInterface, size_t cbMin,
    123                                                   PCPDMNETWORKGSO pGso, PPPDMSCATTERGATHER ppSgBuf)
     123                                           PCPDMNETWORKGSO pGso, PPPDMSCATTERGATHER ppSgBuf)
    124124{
    125125    PDRVNETSHAPER pThis = RT_FROM_MEMBER(pInterface, DRVNETSHAPER, CTX_SUFF(INetworkUp));
    126     if (RT_UNLIKELY(!pThis->CTX_SUFF(pIBelowNet)))
    127         return VERR_NET_DOWN;
    128     //LogFlow(("drvNetShaperUp_AllocBuf: cb=%d\n", cbMin));
    129     STAM_REL_COUNTER_ADD(&pThis->StatXmitBytesRequested, cbMin);
    130     STAM_REL_COUNTER_INC(&pThis->StatXmitPktsRequested);
    131 #if defined(IN_RING3) || defined(IN_RING0)
    132     if (!PDMDrvHlpNetShaperAllocateBandwidth(pThis->CTX_SUFF(pDrvIns), &pThis->Filter, cbMin))
    133     {
    134         STAM_REL_COUNTER_ADD(&pThis->StatXmitBytesDenied, cbMin);
    135         STAM_REL_COUNTER_INC(&pThis->StatXmitPktsDenied);
    136         return VERR_TRY_AGAIN;
    137     }
    138 #endif
    139     STAM_REL_COUNTER_ADD(&pThis->StatXmitBytesGranted, cbMin);
    140     STAM_REL_COUNTER_INC(&pThis->StatXmitPktsGranted);
    141     //LogFlow(("drvNetShaperUp_AllocBuf: got cb=%d\n", cbMin));
    142     return pThis->CTX_SUFF(pIBelowNet)->pfnAllocBuf(pThis->CTX_SUFF(pIBelowNet), cbMin, pGso, ppSgBuf);
     126    if (pThis->CTX_SUFF(pIBelowNet))
     127    {
     128        //LogFlow(("drvNetShaperUp_AllocBuf: cb=%d\n", cbMin));
     129        STAM_REL_COUNTER_ADD(&pThis->StatXmitBytesRequested, cbMin);
     130        STAM_REL_COUNTER_INC(&pThis->StatXmitPktsRequested);
     131        if (!PDMDrvHlpNetShaperAllocateBandwidth(pThis->CTX_SUFF(pDrvIns), &pThis->Filter, cbMin))
     132        {
     133            STAM_REL_COUNTER_ADD(&pThis->StatXmitBytesDenied, cbMin);
     134            STAM_REL_COUNTER_INC(&pThis->StatXmitPktsDenied);
     135            return VERR_TRY_AGAIN;
     136        }
     137        STAM_REL_COUNTER_ADD(&pThis->StatXmitBytesGranted, cbMin);
     138        STAM_REL_COUNTER_INC(&pThis->StatXmitPktsGranted);
     139        //LogFlow(("drvNetShaperUp_AllocBuf: got cb=%d\n", cbMin));
     140        return pThis->CTX_SUFF(pIBelowNet)->pfnAllocBuf(pThis->CTX_SUFF(pIBelowNet), cbMin, pGso, ppSgBuf);
     141    }
     142    return VERR_NET_DOWN;
    143143}
    144144
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette