VirtualBox

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


Ignore:
Timestamp:
Jul 18, 2008 10:00:56 AM (16 years ago)
Author:
vboxsync
Message:

Reduced the force of the scheduling/yield hack and make it not apply when the trunk is sending stuff.

Location:
trunk/src/VBox/Devices/Network
Files:
2 edited

Legend:

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

    r10739 r10740  
    604604 * Sends a frame to a specific interface.
    605605 *
    606  * @param   pIf         The interface.
    607  * @param   pSG         The gather buffer which data is being sent to the interface.
    608  */
    609 static void intnetR0IfSend(PINTNETIF pIf, PINTNETSG pSG)
     606 * @param   pIf             The interface.
     607 * @param   pIfSender       The interface sending the frame. This is NULL if it's the trunk.
     608 * @param   pSG             The gather buffer which data is being sent to the interface.
     609 */
     610static void intnetR0IfSend(PINTNETIF pIf, PINTNETIF pIfSender, PINTNETSG pSG)
    610611{
    611612    LogFlow(("intnetR0IfSend: pIf=%p:{.hIf=%RX32}\n", pIf, pIf->hIf));
     
    620621    }
    621622
    622 /** @todo we'll have to drop this I'm afraid since it'll screw up the host networking otherwise... */
     623#if 0 /* This is bad stuff now as we're blocking while locking down the network.
     624         we really shouldn't delay the network traffic on the host just because
     625         some bugger isn't responding. Will have to deal with this in a different
     626         manner if required. */
    623627    /*
    624628     * Retry a few times, yielding the CPU in between.
    625      * But don't let a unresponsive VM harm performance, so give up after a short while.
     629     * But don't let a unresponsive VM harm performance, so give up after a couple of tries.
    626630     */
    627631    if (pIf->cYields < 100)
    628632    {
    629633        unsigned cYields = 10;
    630         do
     634#else
     635    /*
     636     * Scheduling hack, for unicore machines primarily.
     637     */
     638    if (    pIf->cYields < 4 /* just twice */
     639        &&  pIfSender /* but not if it's from the trunk */)
     640    {
     641        unsigned cYields = 2;
     642#endif
     643        while (--cYields > 0)
    631644        {
    632645            RTSemEventSignal(pIf->Event);
     
    642655            }
    643656            pIf->cYields++;
    644         } while (--cYields > 0);
     657        }
    645658        STAM_REL_COUNTER_INC(&pIf->pIntBuf->cStatYieldsNok);
    646659    }
     
    751764    for (PINTNETIF pIf = pNetwork->pIFs; pIf; pIf = pIf->pNext)
    752765        if (pIf != pIfSender)
    753             intnetR0IfSend(pIf, pSG);
     766            intnetR0IfSend(pIf, pIfSender, pSG);
    754767
    755768    /*
     
    816829        {
    817830            fExactIntNetRecipient |= fIt;
    818             intnetR0IfSend(pIf, pSG);
     831            intnetR0IfSend(pIf, pIfSender, pSG);
    819832        }
    820833    }
  • trunk/src/VBox/Devices/Network/testcase/tstIntNetR0.cpp

    r10733 r10740  
    4343#include <iprt/time.h>
    4444#include <iprt/asm.h>
     45#include <iprt/getopt.h>
    4546
    4647
     
    381382}
    382383
    383 int main()
    384 {
    385 
     384int main(int argc, char **argv)
     385{
    386386    /*
    387      * Init runtime and create an INTNET instance.
     387     * Init the runtime and parse arguments.
    388388     */
    389389    RTR3Init();
    390     RTPrintf("tstIntNetR0: TESTING...\n");
     390
     391    static RTOPTIONDEF const s_aOptions[] =
     392    {
     393        { "--recv-buffer",  'r', RTGETOPT_REQ_UINT32 },
     394        { "--send-buffer",  's', RTGETOPT_REQ_UINT32 },
     395    };
     396
     397    uint32_t cbRecv = 32 * _1K;
     398    uint32_t cbSend = 1536*2;
     399
     400    int ch;
     401    int iArg = 1;
     402    RTOPTIONUNION Value;
     403    while ((ch = RTGetOpt(argc,argv, &s_aOptions[0], RT_ELEMENTS(s_aOptions), &iArg, &Value)))
     404        switch (ch)
     405        {
     406            case 'r':
     407                cbRecv = Value.u32;
     408                break;
     409
     410            case 's':
     411                cbSend = Value.u32;
     412                break;
     413
     414            default:
     415                RTPrintf("tstIntNetR0: invalid argument: %s\n", Value.psz);
     416                return 1;
     417        }
     418    if (iArg < argc)
     419    {
     420        RTPrintf("tstIntNetR0: invalid argument: %s\n", argv[iArg]);
     421        return 1;
     422    }
     423
     424    /*
     425     * Create an INTNET instance.
     426     */
     427    RTPrintf("tstIntNetR0: TESTING cbSend=%d cbRecv=%d ...\n", cbSend, cbRecv);
    391428    PINTNET pIntNet;
    392429    int rc = INTNETR0Create(&pIntNet);
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