Changeset 93628 in vbox for trunk/src/VBox/Devices
- Timestamp:
- Feb 6, 2022 11:44:05 PM (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Network/DrvNetShaper.cpp
r93115 r93628 121 121 */ 122 122 PDMBOTHCBDECL(int) drvNetShaperUp_AllocBuf(PPDMINETWORKUP pInterface, size_t cbMin, 123 123 PCPDMNETWORKGSO pGso, PPPDMSCATTERGATHER ppSgBuf) 124 124 { 125 125 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; 143 143 } 144 144
Note:
See TracChangeset
for help on using the changeset viewer.