VirtualBox

Changeset 34586 in vbox for trunk/src/VBox/VMM


Ignore:
Timestamp:
Dec 1, 2010 8:08:49 PM (14 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
68383
Message:

AsyncCompletion: Allow to change bandwidth limits during runtime

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/VMM/PDMAsyncCompletion.cpp

    r33840 r34586  
    874874
    875875                            if (RT_SUCCESS(rc))
    876                                 rc = CFGMR3QueryU32(pCur, "Start", &cbStart);
    877                             if (RT_SUCCESS(rc))
    878876                                rc = CFGMR3QueryU32(pCur, "Max", &cbMax);
    879877                            if (RT_SUCCESS(rc))
    880                                 rc = CFGMR3QueryU32(pCur, "Step", &cbStep);
     878                                rc = CFGMR3QueryU32Def(pCur, "Start", &cbStart, cbMax);
     879                            if (RT_SUCCESS(rc))
     880                                rc = CFGMR3QueryU32Def(pCur, "Step", &cbStep, 0);
    881881                            if (RT_SUCCESS(rc))
    882882                                rc = pdmacAsyncCompletionBwMgrCreate(pEndpointClass, pszBwGrpId, cbMax, cbStart, cbStep);
     
    15831583}
    15841584
     1585VMMR3DECL(int) PDMR3AsyncCompletionBwMgrSetMaxForFile(PVM pVM, const char *pcszBwMgr, uint32_t cbMaxNew)
     1586{
     1587    int rc = VINF_SUCCESS;
     1588    AssertPtrReturn(pVM, VERR_INVALID_POINTER);
     1589    AssertPtrReturn(pcszBwMgr, VERR_INVALID_POINTER);
     1590    PPDMACBWMGR pBwMgr;
     1591
     1592    PPDMASYNCCOMPLETIONEPCLASS pEpClass = pVM->pUVM->pdm.s.apAsyncCompletionEndpointClass[PDMASYNCCOMPLETIONEPCLASSTYPE_FILE];
     1593
     1594    pBwMgr = pdmacBwMgrFindById(pEpClass, pcszBwMgr);
     1595    if (pBwMgr)
     1596    {
     1597        /*
     1598         * Set the new value for the start and max value to let the manager pick up
     1599         * the new limit immediately.
     1600         */
     1601        ASMAtomicXchgU32(&pBwMgr->cbTransferPerSecMax, cbMaxNew);
     1602        ASMAtomicXchgU32(&pBwMgr->cbTransferPerSecStart, cbMaxNew);
     1603    }
     1604    else
     1605        rc = VERR_NOT_FOUND;
     1606
     1607    return rc;
     1608}
     1609
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