Changeset 43228 in vbox for trunk/src/VBox
- Timestamp:
- Sep 6, 2012 3:28:12 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/VMM/VMMR3/PDMNetShaper.cpp
r42064 r43228 1 1 /* $Id$ */ 2 2 /** @file 3 * PDM Network Shaper - Limit network traffic according to bandwidth 4 * group settings. 3 * PDM Network Shaper - Limit network traffic according to bandwidth group settings. 5 4 */ 6 5 … … 67 66 68 67 69 /******************************************************************************* 70 * Internal Functions * 71 *******************************************************************************/ 68 69 72 70 73 71 static PPDMNSBWGROUP pdmNsBwGroupFindById(PPDMNETSHAPER pShaper, const char *pcszId) … … 90 88 } 91 89 90 92 91 static void pdmNsBwGroupLink(PPDMNSBWGROUP pBwGroup) 93 92 { … … 100 99 rc = RTCritSectLeave(&pShaper->cs); AssertRC(rc); 101 100 } 101 102 102 103 103 #if 0 … … 123 123 } 124 124 #endif 125 125 126 126 127 static void pdmNsBwGroupSetLimit(PPDMNSBWGROUP pBwGroup, uint64_t cbTransferPerSecMax) … … 132 133 pBwGroup->cbTransferPerSecMax, pBwGroup->cbBucketSize)); 133 134 } 135 134 136 135 137 static int pdmNsBwGroupCreate(PPDMNETSHAPER pShaper, const char *pcszBwGroup, uint64_t cbTransferPerSecMax) … … 160 162 161 163 pdmNsBwGroupSetLimit(pBwGroup, cbTransferPerSecMax); 162 ; 164 163 165 pBwGroup->cbTokensLast = pBwGroup->cbBucketSize; 164 166 pBwGroup->tsUpdatedLast = RTTimeSystemNanoTS(); … … 183 185 } 184 186 187 185 188 static void pdmNsBwGroupTerminate(PPDMNSBWGROUP pBwGroup) 186 189 { … … 196 199 } 197 200 201 198 202 DECLINLINE(void) pdmNsBwGroupUnref(PPDMNSBWGROUP pBwGroup) 199 203 { … … 201 205 ASMAtomicDecU32(&pBwGroup->cRefs); 202 206 } 207 203 208 204 209 static void pdmNsBwGroupXmitPending(PPDMNSBWGROUP pBwGroup) … … 235 240 } 236 241 242 237 243 static void pdmNsFilterLink(PPDMNSFILTER pFilter) 238 244 { … … 245 251 rc = PDMCritSectLeave(&pBwGroup->cs); AssertRC(rc); 246 252 } 253 247 254 248 255 static void pdmNsFilterUnlink(PPDMNSFILTER pFilter) … … 275 282 } 276 283 284 277 285 VMMR3DECL(int) PDMR3NsAttach(PVM pVM, PPDMDRVINS pDrvIns, const char *pcszBwGroup, 278 286 PPDMNSFILTER pFilter) … … 314 322 return rc; 315 323 } 324 316 325 317 326 VMMR3DECL(int) PDMR3NsDetach(PVM pVM, PPDMDRVINS pDrvIns, PPDMNSFILTER pFilter) … … 337 346 } 338 347 348 339 349 VMMR3DECL(bool) PDMR3NsAllocateBandwidth(PPDMNSFILTER pFilter, size_t cbTransfer) 340 350 { 341 351 return pdmNsAllocateBandwidth(pFilter, cbTransfer); 342 352 } 353 343 354 344 355 VMMR3DECL(int) PDMR3NsBwGroupSetLimit(PVM pVM, const char *pcszBwGroup, uint64_t cbTransferPerSecMax) … … 393 404 } 394 405 406 395 407 /** 396 408 * @copydoc FNPDMTHREADWAKEUPINT … … 403 415 return VINF_SUCCESS; 404 416 } 417 405 418 406 419 /** … … 433 446 } 434 447 448 435 449 /** 436 450 * Initialize the network shaper. … … 494 508 { 495 509 PUVM pUVM = pVM->pUVM; 496 AssertMsg(!pUVM->pdm.s.pNetShaper, 497 ("Network shaper was already initialized\n")); 498 499 char szDesc[256]; 500 static unsigned iThread; 501 502 RTStrPrintf(szDesc, sizeof(szDesc), "PDMNSTXThread-%d", ++iThread); 510 AssertMsg(!pUVM->pdm.s.pNetShaper, ("Network shaper was already initialized\n")); 511 512 char szDesc[64]; 513 static unsigned s_iThread; 514 515 RTStrPrintf(szDesc, sizeof(szDesc), "PDMNsTx-%d", ++s_iThread); 503 516 rc = PDMR3ThreadCreate(pVM, &pNetShaper->hTxThread, pNetShaper, 504 517 pdmR3NsTxThread, pdmR3NsTxWakeUp, 0,
Note:
See TracChangeset
for help on using the changeset viewer.