VirtualBox

Changeset 10734 in vbox for trunk


Ignore:
Timestamp:
Jul 17, 2008 11:04:13 PM (16 years ago)
Author:
vboxsync
Message:

intnet: Implemented intnetR0TrunkIfSend().

File:
1 edited

Legend:

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

    r10733 r10734  
    666666static void intnetR0TrunkIfSend(PINTNETTRUNKIF pThis, PINTNETNETWORK pNetwork, uint32_t fDst, PINTNETSG pSG, bool fTrunkLocked)
    667667{
    668     Assert(fTrunkLocked);
    669     /** @todo implement + move?  */
     668    /*
     669     * Quick sanity check.
     670     */
     671    AssertPtr(pThis);
     672    AssertPtr(pNetwork);
     673    AssertPtr(pSG);
     674    Assert(fDst);
     675    AssertReturnVoid(pThis->pIfPort);
     676
     677    /*
     678     * Temporarily leave the network lock while transmitting the frame.
     679     *
     680     * Note that we're relying on the out-bound lock to serialize threads down
     681     * in INTNETR0IfSend. It's theoretically possible for there to be race now
     682     * because I didn't implement async SG handling yet. Which is why we currently
     683     * require the trunk to be locked, well, one of the reasons.
     684     */
     685    AssertReturnVoid(fTrunkLocked); /* to be removed. */
     686
     687    int rc;
     688    if (    fTrunkLocked
     689        ||  intnetR0TrunkIfRetain(pThis))
     690    {
     691        rc = RTSemFastMutexRelease(pNetwork->FastMutex);
     692        AssertRC(rc);
     693        if (RT_SUCCESS(rc))
     694        {
     695            if (    fTrunkLocked
     696                ||  intnetR0TrunkIfOutLock(pThis))
     697            {
     698                rc = pThis->pIfPort->pfnXmit(pThis->pIfPort, pSG, fDst);
     699
     700                if (!fTrunkLocked)
     701                    intnetR0TrunkIfOutUnlock(pThis);
     702            }
     703            else
     704            {
     705                AssertFailed();
     706                rc = VERR_SEM_DESTROYED;
     707            }
     708
     709            int rc2 = RTSemFastMutexRequest(pNetwork->FastMutex);
     710            AssertRC(rc2);
     711        }
     712
     713        if (!fTrunkLocked)
     714            intnetR0TrunkIfRelease(pThis);
     715    }
     716    else
     717    {
     718        AssertFailed();
     719        rc = VERR_SEM_DESTROYED;
     720    }
     721
     722    /** @todo failure statistics? */
    670723}
    671724
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